blob: 02356aa70e6062f998dff28eb096ded379e25671 [file] [log] [blame]
Ronald G. Minniche0e784a2014-11-26 19:25:47 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2014 Google, Inc.
5 *
Martin Rothb28f4662018-05-26 17:58:47 -06006 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
Ronald G. Minniche0e784a2014-11-26 19:25:47 +00009 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#include <console/console.h>
17#include <device/device.h>
18#include <cbmem.h>
Philipp Hug2ef569a2018-12-31 14:13:47 +010019#include <symbols.h>
Patrick Rudolphbd4bcab2019-06-30 22:12:15 +020020#include <ramdetect.h>
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000021
Elyes HAOUAS5cb876c2018-06-08 18:31:43 +020022static void mainboard_enable(struct device *dev)
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000023{
Patrick Rudolphbd4bcab2019-06-30 22:12:15 +020024 size_t dram_mb_detected;
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000025
26 if (!dev) {
Jonathan Neuschäfer2af174a2016-10-12 00:18:00 +020027 die("No dev0; die\n");
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000028 }
29
Patrick Rudolphbd4bcab2019-06-30 22:12:15 +020030 dram_mb_detected = probe_ramsize((uintptr_t)_dram, CONFIG_DRAM_SIZE_MB);
31 ram_resource(dev, 0, (uintptr_t)_dram / KiB, dram_mb_detected / KiB);
32
Ronald G. Minniche0e784a2014-11-26 19:25:47 +000033 cbmem_recovery(0);
34}
35
36struct chip_operations mainboard_ops = {
37 .enable_dev = mainboard_enable,
38};