Debian Codegraph @

src/include/spd_bin.h

raw symbols SCIP
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_0 (0x6C >> 1)
10 #define SPD_PAGE_1 (0x6E >> 1)
11 #define SPD_DENSITY_BANKS 4
12 #define SPD_ADDRESSING 5
13 #define SPD_SN_LEN 4
14 #define DDR3_ORGANIZATION 7
15 #define DDR3_BUS_DEV_WIDTH 8
16 #define DDR4_ORGANIZATION 12
17 #define DDR4_BUS_DEV_WIDTH 13
18 #define DDR4_SPD_SN_OFF 325
19 #define MAX_SPD_PAGE_SIZE_SPD5 128
20 #define MAX_SPD_SIZE (256 * 4)
21 #define SPD_HUB_MEMREG(addr) ((u8)(0x80 | (addr)))
22 #define SPD5_MR11 0x0B
23 #define SPD5_MR0 0x00
24 #define SPD5_MEMREG_REG(addr) ((u8)((~0x80) & (addr)))
25 #define SPD5_MR0_SPD5_HUB_DEV 0x51
26
27 struct spd_offset_table {
28 u16 start; /* Offset 0 */
29 u16 end; /* Offset 2 */
30 };
31
32 struct spd_block {
33 u8 addr_map[CONFIG_DIMM_MAX]; /* 7 bit I2C addresses */
34 u8 *spd_array[CONFIG_DIMM_MAX];
35 /* Length of each dimm */
36 u16 len;
37 };
38
39 void print_spd_info(uint8_t spd[]);
40 uintptr_t spd_cbfs_map(u8 spd_index);
41 void dump_spd_info(struct spd_block *blk);
42 void get_spd_smbus(struct spd_block *blk);
43
44 int spd_read_byte(u8 slave_addr, u8 bus_addr);
45 int spd_read_word(u8 slave_addr, u8 bus_addr);
46 void spd_write_byte(u8 slave_addr, u8 bus_addr, u8 value);
47
48 /*
49 * get_spd_sn returns the SODIMM serial number. It only supports DDR3 and DDR4.
50 * return CB_SUCCESS, sn is the serial number and sn=0xffffffff if the dimm is not present.
51 * return CB_ERR, if dram_type is not supported or addr is a zero.
52 */
53 enum cb_err get_spd_sn(u8 addr, u32 *sn);
54
55 /* expects SPD size to be 128 bytes, reads from "spd.bin" in CBFS and
56 verifies the checksum. Only available if CONFIG_DIMM_SPD_SIZE == 128. */
57 int read_ddr3_spd_from_cbfs(u8 *buf, int idx);
58 #endif