Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 4 | * |
Martin Roth | b28f466 | 2018-05-26 17:58:47 -0600 | [diff] [blame] | 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; version 2 of the License. |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | */ |
| 14 | |
| 15 | #include <console/console.h> |
| 16 | #include <device/device.h> |
| 17 | #include <cbmem.h> |
Philipp Hug | 2ef569a | 2018-12-31 14:13:47 +0100 | [diff] [blame] | 18 | #include <symbols.h> |
Patrick Rudolph | bd4bcab | 2019-06-30 22:12:15 +0200 | [diff] [blame] | 19 | #include <ramdetect.h> |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 20 | |
Elyes HAOUAS | 5cb876c | 2018-06-08 18:31:43 +0200 | [diff] [blame] | 21 | static void mainboard_enable(struct device *dev) |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 22 | { |
Patrick Rudolph | bd4bcab | 2019-06-30 22:12:15 +0200 | [diff] [blame] | 23 | size_t dram_mb_detected; |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 24 | |
| 25 | if (!dev) { |
Jonathan Neuschäfer | 2af174a | 2016-10-12 00:18:00 +0200 | [diff] [blame] | 26 | die("No dev0; die\n"); |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 27 | } |
| 28 | |
Patrick Rudolph | bd4bcab | 2019-06-30 22:12:15 +0200 | [diff] [blame] | 29 | dram_mb_detected = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB); |
Patrick Rudolph | c191615 | 2019-07-28 18:29:42 +0200 | [diff] [blame] | 30 | 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] | 31 | |
Ronald G. Minnich | e0e784a | 2014-11-26 19:25:47 +0000 | [diff] [blame] | 32 | cbmem_recovery(0); |
| 33 | } |
| 34 | |
| 35 | struct chip_operations mainboard_ops = { |
| 36 | .enable_dev = mainboard_enable, |
| 37 | }; |