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