Patrick Georgi | afd4c87 | 2020-05-05 23:43:18 +0200 | [diff] [blame] | 1 | /* Memory information */ |
Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame^] | 2 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 3 | |
| 4 | #ifndef _MEMORY_INFO_H_ |
| 5 | #define _MEMORY_INFO_H_ |
| 6 | |
Barnali Sarkar | c16d389 | 2017-02-23 16:56:54 +0530 | [diff] [blame] | 7 | #include <stdint.h> |
| 8 | |
Raul E Rangel | 99f54a6 | 2018-04-11 10:58:14 -0600 | [diff] [blame] | 9 | #define DIMM_INFO_SERIAL_SIZE 4 |
Aaron Durbin | 4b6f262 | 2018-10-09 07:31:24 -0600 | [diff] [blame] | 10 | #define DIMM_INFO_PART_NUMBER_SIZE 33 |
Richard Spiegel | bd65480 | 2018-02-22 10:03:39 -0700 | [diff] [blame] | 11 | #define DIMM_INFO_TOTAL 8 /* Maximum num of dimm is 8 */ |
| 12 | |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 13 | /** |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 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 |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 16 | * |
| 17 | * Values are specified according to the JEDEC SPD Standard. |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 18 | */ |
| 19 | struct dimm_info { |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 20 | /* |
| 21 | * Size of the module in MiB. |
| 22 | */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 23 | uint32_t dimm_size; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 24 | /* |
| 25 | * SMBIOS (not SPD) device type. |
| 26 | * |
Elyes HAOUAS | 28114ae | 2018-11-14 17:51:00 +0100 | [diff] [blame] | 27 | * See the smbios.h smbios_memory_type enum. |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 28 | */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 29 | uint16_t ddr_type; |
| 30 | uint16_t ddr_frequency; |
| 31 | uint8_t rank_per_dimm; |
| 32 | uint8_t channel_num; |
| 33 | uint8_t dimm_num; |
| 34 | uint8_t bank_locator; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 35 | /* |
Raul E Rangel | 99f54a6 | 2018-04-11 10:58:14 -0600 | [diff] [blame] | 36 | * SPD serial number. |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 37 | */ |
Richard Spiegel | bd65480 | 2018-02-22 10:03:39 -0700 | [diff] [blame] | 38 | uint8_t serial[DIMM_INFO_SERIAL_SIZE]; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 39 | /* |
| 40 | * The last byte is '\0' for the end of string |
| 41 | * |
| 42 | * Must contain only printable ASCII. |
| 43 | */ |
Richard Spiegel | bd65480 | 2018-02-22 10:03:39 -0700 | [diff] [blame] | 44 | uint8_t module_part_number[DIMM_INFO_PART_NUMBER_SIZE]; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 45 | /* |
| 46 | * SPD Manufacturer ID |
| 47 | */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 48 | uint16_t mod_id; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 49 | /* |
| 50 | * SPD Module Type. |
| 51 | * |
| 52 | * See spd.h for valid values. |
| 53 | * |
| 54 | * e.g., SPD_RDIMM, SPD_SODIMM, SPD_MICRO_DIMM |
| 55 | */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 56 | uint8_t mod_type; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 57 | /* |
| 58 | * SPD bus width. |
| 59 | * |
| 60 | * Bits 0 - 2 encode the primary bus width: |
| 61 | * 0b000 = 8 bit width |
| 62 | * 0b001 = 16 bit width |
| 63 | * 0b010 = 32 bit width |
| 64 | * 0b011 = 64 bit width |
| 65 | * |
| 66 | * Bits 3 - 4 encode the extension bits (ECC): |
| 67 | * 0b00 = 0 extension bits |
| 68 | * 0b01 = 8 bit of ECC |
| 69 | * |
| 70 | * e.g., |
| 71 | * 64 bit bus with 8 bits of ECC (72 bits total): 0b1011 |
| 72 | * 64 bit bus with 0 bits of ECC (64 bits total): 0b0011 |
| 73 | * |
| 74 | * See the smbios.h smbios_memory_bus_width enum. |
| 75 | */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 76 | uint8_t bus_width; |
Christian Walter | f972322 | 2019-05-28 10:37:24 +0200 | [diff] [blame] | 77 | /* |
| 78 | * Voltage Level |
| 79 | */ |
| 80 | uint16_t vdd_voltage; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 81 | } __packed; |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 82 | |
| 83 | struct memory_info { |
| 84 | uint8_t dimm_cnt; |
Richard Spiegel | bd65480 | 2018-02-22 10:03:39 -0700 | [diff] [blame] | 85 | struct dimm_info dimm[DIMM_INFO_TOTAL]; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 86 | } __packed; |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 87 | |
| 88 | #endif |