coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
sdram_configs.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <soc/sdram.h>
5 
6 #include "sdram_configs.h"
7 
8 static struct sdram_params sdram_configs[] = {
9 #include "bct/sdram-hynix-2GB-924.inc" /* ram_code = 0000 */
10 #include "bct/sdram-hynix-4GB-792.inc" /* ram_code = 0001 */
11 #include "bct/sdram-unused.inc" /* ram_code = 0010 */
12 #include "bct/sdram-unused.inc" /* ram_code = 0011 */
13 #include "bct/sdram-unused.inc" /* ram_code = 0100 */
14 #include "bct/sdram-unused.inc" /* ram_code = 0101 */
15 #include "bct/sdram-unused.inc" /* ram_code = 0110 */
16 #include "bct/sdram-unused.inc" /* ram_code = 0111 */
17 #include "bct/sdram-unused.inc" /* ram_code = 1000 */
18 #include "bct/sdram-unused.inc" /* ram_code = 1001 */
19 #include "bct/sdram-unused.inc" /* ram_code = 1010 */
20 #include "bct/sdram-unused.inc" /* ram_code = 1011 */
21 #include "bct/sdram-unused.inc" /* ram_code = 1100 */
22 #include "bct/sdram-unused.inc" /* ram_code = 1101 */
23 #include "bct/sdram-unused.inc" /* ram_code = 1110 */
24 #include "bct/sdram-unused.inc" /* ram_code = 1111 */
25 };
26 
28 {
29  uint32_t ramcode = sdram_get_ram_code();
30  /*
31  * If we need to apply some special hacks to RAMCODE mapping (ex, by
32  * board_id), do that now.
33  */
34 
35  printk(BIOS_SPEW, "%s: RAMCODE=%d\n", __func__, ramcode);
36  if (ramcode >= ARRAY_SIZE(sdram_configs) ||
38  die("Invalid RAMCODE.");
39  }
40 
41  return &sdram_configs[ramcode];
42 }
const struct sdram_info * get_sdram_config(void)
Definition: sdram_configs.c:85
#define ARRAY_SIZE(a)
Definition: helpers.h:12
#define printk(level,...)
Definition: stdlib.h:16
void __noreturn die(const char *fmt,...)
Definition: die.c:17
#define BIOS_SPEW
BIOS_SPEW - Excessively verbose output.
Definition: loglevel.h:142
uint32_t sdram_get_ram_code(void)
Definition: sdram.c:601
static struct sdram_params sdram_configs[]
Definition: sdram_configs.c:8
unsigned int uint32_t
Definition: stdint.h:14
Defines the SDRAM parameter structure.
Definition: emi.h:15
uint32_t MemoryType
Definition: sdram_param.h:56
@ NvBootMemoryType_Unused
Definition: sdram_param.h:38