blob: e8f547c00862994eb966356abd558ab2aedbd62e [file] [log] [blame]
Angel Pons57566302020-04-05 13:22:10 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Tom Warren64982c502014-01-23 13:37:50 -07003
4#include <console/console.h>
Julius Wernerf0d21ff32014-10-20 13:24:14 -07005#include <soc/sdram.h>
6
Tom Warren64982c502014-01-23 13:37:50 -07007#include "sdram_configs.h"
8
Tom Warren64982c502014-01-23 13:37:50 -07009static struct sdram_params sdram_configs[] = {
Tom Warren96ef1882014-06-10 13:46:48 -070010#include "bct/sdram-unused.inc" /* ram_code = 0000 */
11#include "bct/sdram-hynix-2GB-792.inc" /* ram_code = 0001 */
12#include "bct/sdram-unused.inc" /* ram_code = 0010 */
13#include "bct/sdram-unused.inc" /* ram_code = 0011 */
14#include "bct/sdram-hynix-4GB-792.inc" /* ram_code = 0100 */
15#include "bct/sdram-unused.inc" /* ram_code = 0101 */
16#include "bct/sdram-kingston-2GB-792.inc" /* ram_code = 0110 */
17#include "bct/sdram-unused.inc" /* ram_code = 0111 */
18#include "bct/sdram-unused.inc" /* ram_code = 1000 */
19#include "bct/sdram-unused.inc" /* ram_code = 1001 */
20#include "bct/sdram-unused.inc" /* ram_code = 1010 */
21#include "bct/sdram-unused.inc" /* ram_code = 1011 */
22#include "bct/sdram-unused.inc" /* ram_code = 1100 */
23#include "bct/sdram-unused.inc" /* ram_code = 1101 */
24#include "bct/sdram-unused.inc" /* ram_code = 1110 */
25#include "bct/sdram-unused.inc" /* ram_code = 1111 */
Tom Warren64982c502014-01-23 13:37:50 -070026};
27
28const struct sdram_params *get_sdram_config()
29{
30 uint32_t ramcode = sdram_get_ram_code();
31 /*
32 * If we need to apply some special hacks to RAMCODE mapping (ex, by
33 * board_id), do that now.
34 */
35
36 printk(BIOS_SPEW, "%s: RAMCODE=%d\n", __func__, ramcode);
37 if (ramcode >= sizeof(sdram_configs) / sizeof(sdram_configs[0]) ||
38 sdram_configs[ramcode].MemoryType == NvBootMemoryType_Unused) {
39 die("Invalid RAMCODE.");
40 }
41
42 return &sdram_configs[ramcode];
43}