mirror of
https://github.com/fail0verflow/switch-coreboot.git
synced 2025-05-04 01:39:18 -04:00
including .c files. The mem controller is an opaque type. This code is called with a pointer and a count of mem controllers. I have serious doubts about the value of this code. It is so generic, and does so little, that it may be useless. It may be useful for documentation, however, as it shows people the sequence of operations for spd. Signed-off-by: Ronald G. Minnich <rminnich@gmail.com> Acked-by: Stefan Reinauer <stepan@coresystems.de> git-svn-id: svn://coreboot.org/repository/LinuxBIOSv3@339 f3766cd6-281f-0410-b1cd-43a5c92072e9
74 lines
2.5 KiB
C
74 lines
2.5 KiB
C
/*
|
|
* This file is part of the LinuxBIOS project.
|
|
*
|
|
* Copyright (C) 2007 Ronald G. Minnich <rminnich@gmail.com>
|
|
* Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; version 2 of the License.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*/
|
|
|
|
#include <hlt.h>
|
|
|
|
/**
|
|
* Print an error message which says why the RAM initialization failed,
|
|
* then halt the processor(s).
|
|
*
|
|
* @param why The reason why the RAM initialization failed.
|
|
*/
|
|
void ram_failure(const char *why)
|
|
{
|
|
printk(BIOS_EMERG, "RAM failure: %s: Halting\n", why);
|
|
hlt();
|
|
}
|
|
|
|
/**
|
|
* ram_initialize() is is the main RAM init function.
|
|
*
|
|
* It sets basic registers that can not be detected, then does the SPD step.
|
|
* Mainboards and other code can skip one of these steps by the expedient
|
|
* of making it an empty function.
|
|
*
|
|
* @param controllers How many memory controllers there are.
|
|
* @param ctrl Pointer to the mem control structure. This is a generic pointer, since the
|
|
* structure is wholly chip-dependent, and a survey of all the types makes it clear that a common
|
|
* struct is not possible. We can not use the device tree here as this code is run before the device tree
|
|
* is available.
|
|
*/
|
|
void ram_initialize(int controllers, void *ctrl)
|
|
{
|
|
int i;
|
|
|
|
/* Set the registers we can set once to reasonable values. */
|
|
for (i = 0; i < controllers; i++) {
|
|
printk(BIOS_INFO,
|
|
"Setting registers of RAM controller %d\n", i);
|
|
ram_set_registers(ctrl, i);
|
|
}
|
|
|
|
/* Now setup those things we can auto detect. */
|
|
for (i = 0; i < controllers; i++) {
|
|
printk(BIOS_INFO,
|
|
"Setting SPD based registers of RAM controller %d\n", i);
|
|
ram_set_spd_registers(ctrl, i);
|
|
}
|
|
|
|
/* Now that everything is setup enable the RAM. Some chipsets do
|
|
* the work for us while on others we need to it by hand.
|
|
*/
|
|
printk(BIOS_DEBUG, "Enabling RAM\n");
|
|
ram_enable(controllers, ctrl);
|
|
|
|
/* RAM initialization is done. */
|
|
printk(BIOS_DEBUG, "RAM enabled successfully\n");
|
|
}
|