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 <boardid.h>
4 #include <cbfs.h>
5 #include <console/console.h>
6 #include <soc/dramc_param.h>
7 
8 /* Reference: go/asurada-id */
9 static const char *const sdram_configs[] = {
10  /* Group 0x0: eMCP 4GB dual rank (with exceptions). */
11  [0x00] = "sdram-lpddr4x-MT29VZZZBD9DQKPR-046-6GB", /* 6GB */
12  [0x01] = "sdram-lpddr4x-MT29VZZZAD8GQFSL-046-4GB", /* single rank */
13  [0x02] = "sdram-lpddr4x-KMDP6001DA-B425-4GB",
14  [0x03] = "sdram-lpddr4x-KMDV6001DA-B620-4GB",
15  [0x04] = "sdram-lpddr4x-EMCP-2RANK-4GB",
16  [0x05] = "sdram-lpddr4x-EMCP-2RANK-4GB",
17  [0x06] = "sdram-lpddr4x-EMCP-2RANK-4GB",
18  [0x07] = "sdram-lpddr4x-EMCP-2RANK-4GB",
19  [0x08] = "sdram-lpddr4x-EMCP-2RANK-4GB",
20  [0x09] = "sdram-lpddr4x-EMCP-2RANK-4GB",
21  [0x0a] = "sdram-lpddr4x-EMCP-2RANK-4GB",
22  [0x0b] = "sdram-lpddr4x-EMCP-2RANK-4GB",
23 
24  /* Group 0x1, 0x2, 0x3 are reserved for eMCP. */
25 
26  /* Group 0x4: discrete 4GB single rank. */
27  [0x40] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
28  [0x41] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
29  [0x42] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
30  [0x43] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
31  [0x44] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
32  [0x45] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
33  [0x46] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
34  [0x47] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
35  [0x48] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
36  [0x49] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
37  [0x4a] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
38  [0x4b] = "sdram-lpddr4x-DISCRETE-1RANK-4GB",
39 
40  /* Group 0x5: discrete 4GB dual rank. */
41  [0x50] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
42  [0x51] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
43  [0x52] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
44  [0x53] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
45  [0x54] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
46  [0x55] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
47  [0x56] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
48  [0x57] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
49  [0x58] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
50  [0x59] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
51  [0x5a] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
52  [0x5b] = "sdram-lpddr4x-DISCRETE-2RANK-4GB",
53 
54  /* Group 0x6: discrete 8GB dual rank, normal mode */
55  [0x60] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
56  [0x61] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
57  [0x62] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
58  [0x63] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
59  [0x64] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
60  [0x65] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
61  [0x66] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
62  [0x67] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
63  [0x68] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
64  [0x69] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
65  [0x6a] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
66  [0x6b] = "sdram-lpddr4x-DISCRETE-2RANK-8GB",
67 
68  /* Group 0x7: discrete 8GB dual rank, byte mode. */
69  [0x70] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
70  [0x71] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
71  [0x72] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
72  [0x73] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
73  [0x74] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
74  [0x75] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
75  [0x76] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
76  [0x77] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
77  [0x78] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
78  [0x79] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
79  [0x7a] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
80  [0x7b] = "sdram-lpddr4x-DISCRETE-2RANK-8GB-BYTE-MODE",
81 };
82 
83 static struct sdram_info params;
84 
85 const struct sdram_info *get_sdram_config(void)
86 {
87  uint32_t ramcode = ram_code();
88 
89  if (ramcode >= ARRAY_SIZE(sdram_configs) ||
90  cbfs_load(sdram_configs[ramcode], &params, sizeof(params)) != sizeof(params))
91  die("Cannot load SDRAM parameter file for RAM code: %#x", ramcode);
92 
93  return &params;
94 }
const struct sdram_info * get_sdram_config(void)
Definition: sdram_configs.c:85
static struct sdram_info params
Definition: sdram_configs.c:83
static const char *const sdram_configs[]
Definition: sdram_configs.c:9
uint32_t ram_code(void)
#define ARRAY_SIZE(a)
Definition: helpers.h:12
static size_t cbfs_load(const char *name, void *buf, size_t size)
Definition: cbfs.h:282
void __noreturn die(const char *fmt,...)
Definition: die.c:17
unsigned int uint32_t
Definition: stdint.h:14