coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
spd_bin.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef SPD_BIN_H
4 #define SPD_BIN_H
5 
6 #include <stdint.h>
7 #include <commonlib/region.h>
8 
9 #define SPD_PAGE_LEN 256
10 #define SPD_PAGE_LEN_DDR4 512
11 #define SPD_PAGE_0 (0x6C >> 1)
12 #define SPD_PAGE_1 (0x6E >> 1)
13 #define SPD_DRAM_TYPE 2
14 #define SPD_DRAM_DDR3 0x0B
15 #define SPD_DRAM_LPDDR3_INTEL 0xF1
16 #define SPD_DRAM_LPDDR3_JEDEC 0x0F
17 #define SPD_DRAM_DDR4 0x0C
18 #define SPD_DRAM_LPDDR4 0x10
19 #define SPD_DRAM_LPDDR4X 0x11
20 #define SPD_DRAM_DDR5 0x12
21 #define SPD_DRAM_LPDDR5 0x13
22 #define SPD_DENSITY_BANKS 4
23 #define SPD_ADDRESSING 5
24 #define SPD_SN_LEN 4
25 #define DDR3_ORGANIZATION 7
26 #define DDR3_BUS_DEV_WIDTH 8
27 #define DDR4_ORGANIZATION 12
28 #define DDR4_BUS_DEV_WIDTH 13
29 #define DDR3_SPD_PART_OFF 128
30 #define DDR3_SPD_PART_LEN 18
31 #define DDR3_SPD_SN_OFF 122
32 #define LPDDR3_SPD_PART_OFF 128
33 #define LPDDR3_SPD_PART_LEN 18
34 #define DDR4_SPD_PART_OFF 329
35 #define DDR4_SPD_PART_LEN 20
36 #define DDR4_SPD_SN_OFF 325
37 
38 struct spd_block {
39  u8 addr_map[CONFIG_DIMM_MAX]; /* 7 bit I2C addresses */
40  u8 *spd_array[CONFIG_DIMM_MAX];
41  /* Length of each dimm */
43 };
44 
45 void print_spd_info(uint8_t spd[]);
47 void dump_spd_info(struct spd_block *blk);
48 void get_spd_smbus(struct spd_block *blk);
49 
50 /*
51  * get_spd_sn returns the SODIMM serial number. It only supports DDR3 and DDR4.
52  * return CB_SUCCESS, sn is the serial number and sn=0xffffffff if the dimm is not present.
53  * return CB_ERR, if dram_type is not supported or addr is a zero.
54  */
55 enum cb_err get_spd_sn(u8 addr, u32 *sn);
56 
57 /* expects SPD size to be 128 bytes, reads from "spd.bin" in CBFS and
58  verifies the checksum. Only available if CONFIG_DIMM_SPD_SIZE == 128. */
60 #endif
cb_err
coreboot error codes
Definition: cb_err.h:15
static u32 addr
Definition: cirrus.c:14
static uint8_t * buf
Definition: uart.c:7
static const int spd_index[32]
Definition: memory.c:10
enum cb_err get_spd_sn(u8 addr, u32 *sn)
Definition: smbuslib.c:95
int read_ddr3_spd_from_cbfs(u8 *buf, int idx)
void get_spd_smbus(struct spd_block *blk)
Definition: smbuslib.c:72
uintptr_t spd_cbfs_map(u8 spd_index)
Definition: spd_bin.c:217
void print_spd_info(uint8_t spd[])
Definition: spd_bin.c:183
void dump_spd_info(struct spd_block *blk)
Definition: spd_bin.c:10
uint32_t u32
Definition: stdint.h:51
unsigned long uintptr_t
Definition: stdint.h:21
uint16_t u16
Definition: stdint.h:48
uint8_t u8
Definition: stdint.h:45
unsigned char uint8_t
Definition: stdint.h:8
Definition: ddr4.c:86
u8 addr_map[CONFIG_DIMM_MAX]
Definition: spd_bin.h:39
u8 * spd_array[CONFIG_DIMM_MAX]
Definition: spd_bin.h:40
u16 len
Definition: spd_bin.h:42