Angel Pons | 5756630 | 2020-04-05 13:22:10 +0200 | [diff] [blame^] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 3 | |
| 4 | #include <console/console.h> |
Julius Werner | f0d21ff3 | 2014-10-20 13:24:14 -0700 | [diff] [blame] | 5 | #include <soc/sdram.h> |
| 6 | |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 7 | #include "sdram_configs.h" |
| 8 | |
Tom Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 9 | static struct sdram_params sdram_configs[] = { |
Tom Warren | 96ef188 | 2014-06-10 13:46:48 -0700 | [diff] [blame] | 10 | #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 Warren | 64982c50 | 2014-01-23 13:37:50 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | const 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 | } |