src/mb: Update unlicensable files with the CC-PDDC SPDX ID
[coreboot.git] / src / include / memory_info.h
blob676c17022c5ae059f23db0503aa9cdb8e4bc6d98
1 /* Memory information */
2 /* SPDX-License-Identifier: GPL-2.0-only */
4 #ifndef _MEMORY_INFO_H_
5 #define _MEMORY_INFO_H_
7 #include <stdint.h>
9 #define DIMM_INFO_SERIAL_SIZE 4
10 #define DIMM_INFO_PART_NUMBER_SIZE 33
11 #define DIMM_INFO_TOTAL 32
13 /**
14 * If this table is filled and put in CBMEM,
15 * then these info in CBMEM will be used to generate smbios type 17 table
17 * Values are specified according to the JEDEC SPD Standard.
19 struct dimm_info {
21 * Size of the module in MiB.
23 uint32_t dimm_size;
25 * SMBIOS (not SPD) device type.
27 * See the smbios.h smbios_memory_type enum.
29 uint16_t ddr_type;
31 * ddr_frequency is deprecated.
32 * Use max_speed_mts and configured_speed_mts instead.
34 uint16_t ddr_frequency;
35 uint8_t rank_per_dimm;
36 uint8_t channel_num;
37 uint8_t dimm_num;
38 uint8_t bank_locator;
40 * SPD serial number.
42 uint8_t serial[DIMM_INFO_SERIAL_SIZE];
44 * The last byte is '\0' for the end of string
46 * Must contain only printable ASCII.
48 uint8_t module_part_number[DIMM_INFO_PART_NUMBER_SIZE];
50 * SPD Manufacturer ID
52 uint16_t mod_id;
54 * SPD Module Type.
56 * See spd.h for valid values.
58 * e.g., SPD_RDIMM, SPD_SODIMM, SPD_MICRO_DIMM
60 uint8_t mod_type;
62 * SPD bus width.
64 * Bits 0 - 2 encode the primary bus width:
65 * 0b000 = 8 bit width
66 * 0b001 = 16 bit width
67 * 0b010 = 32 bit width
68 * 0b011 = 64 bit width
70 * Bits 3 - 4 encode the extension bits (ECC):
71 * 0b00 = 0 extension bits
72 * 0b01 = 8 bit of ECC
74 * e.g.,
75 * 64 bit bus with 8 bits of ECC (72 bits total): 0b1011
76 * 64 bit bus with 0 bits of ECC (64 bits total): 0b0011
78 * See the smbios.h smbios_memory_bus_width enum.
80 uint8_t bus_width;
82 * Voltage Level
84 uint16_t vdd_voltage;
86 * Max speed in MT/s
87 * If the value is 0, ddr_frequency should be used instead.
89 uint16_t max_speed_mts;
91 * Configured speed in MT/s
92 * If the value is 0, ddr_frequency should be used instead.
94 uint16_t configured_speed_mts;
95 } __packed;
97 struct memory_info {
99 * SMBIOS error correction type.
100 * See the smbios.h smbios_memory_array_ecc enum.
102 uint8_t ecc_type;
103 /* Maximum capacity the DRAM controller/mainboard supports */
104 uint32_t max_capacity_mib;
105 /* Maximum number of DIMMs the DRAM controller/mainboard supports */
106 uint16_t number_of_devices;
108 /* active DIMM configuration */
109 uint8_t dimm_cnt;
110 struct dimm_info dimm[DIMM_INFO_TOTAL];
111 } __packed;
114 * mainboard_get_dram_part_num returns a DRAM part number override string
115 * return NULL = no part number override provided by mainboard
116 * return non-NULL = pointer to a string terminating in '\0'
118 const char *mainboard_get_dram_part_num(void);
119 #endif