Angel Pons | 585495e | 2020-04-03 01:21:38 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 3 | |
| 4 | #include <console/console.h> |
| 5 | #include <device/device.h> |
| 6 | #include <cbmem.h> |
Philipp Hug | 2ef569a | 2018-12-31 14:13:47 +0100 | [diff] [blame] | 7 | #include <symbols.h> |
Patrick Rudolph | bd4bcab | 2019-06-30 22:12:15 +0200 | [diff] [blame] | 8 | #include <ramdetect.h> |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 9 | |
Elyes HAOUAS | 5cb876c | 2018-06-08 18:31:43 +0200 | [diff] [blame] | 10 | static void mainboard_enable(struct device *dev) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 11 | { |
Patrick Rudolph | bd4bcab | 2019-06-30 22:12:15 +0200 | [diff] [blame] | 12 | size_t dram_mb_detected; |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 13 | |
| 14 | if (!dev) { |
Jonathan Neuschäfer | 2af174a | 2016-10-12 00:18:00 +0200 | [diff] [blame] | 15 | die("No dev0; die\n"); |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 16 | } |
| 17 | |
Patrick Rudolph | bd4bcab | 2019-06-30 22:12:15 +0200 | [diff] [blame] | 18 | dram_mb_detected = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB); |
Patrick Rudolph | c191615 | 2019-07-28 18:29:42 +0200 | [diff] [blame] | 19 | ram_resource(dev, 0, (uintptr_t)_dram / KiB, dram_mb_detected * MiB / KiB); |
Patrick Rudolph | bd4bcab | 2019-06-30 22:12:15 +0200 | [diff] [blame] | 20 | |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 21 | cbmem_recovery(0); |
| 22 | } |
| 23 | |
| 24 | struct chip_operations mainboard_ops = { |
| 25 | .enable_dev = mainboard_enable, |
| 26 | }; |