Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Memory information |
| 3 | * |
| 4 | * Copyright (C) 2014, Intel Corporation. All rights reserved. |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License version |
| 8 | * 2 as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | */ |
| 15 | |
| 16 | #ifndef _MEMORY_INFO_H_ |
| 17 | #define _MEMORY_INFO_H_ |
| 18 | |
Barnali Sarkar | c16d389 | 2017-02-23 16:56:54 +0530 | [diff] [blame] | 19 | #include <stdint.h> |
| 20 | |
Raul E Rangel | 99f54a6 | 2018-04-11 10:58:14 -0600 | [diff] [blame] | 21 | #define DIMM_INFO_SERIAL_SIZE 4 |
Aaron Durbin | 4b6f262 | 2018-10-09 07:31:24 -0600 | [diff] [blame] | 22 | #define DIMM_INFO_PART_NUMBER_SIZE 33 |
Richard Spiegel | bd65480 | 2018-02-22 10:03:39 -0700 | [diff] [blame] | 23 | #define DIMM_INFO_TOTAL 8 /* Maximum num of dimm is 8 */ |
| 24 | |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 25 | /** |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 26 | * If this table is filled and put in CBMEM, |
| 27 | * 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] | 28 | * |
| 29 | * Values are specified according to the JEDEC SPD Standard. |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 30 | */ |
| 31 | struct dimm_info { |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 32 | /* |
| 33 | * Size of the module in MiB. |
| 34 | */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 35 | uint32_t dimm_size; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 36 | /* |
| 37 | * SMBIOS (not SPD) device type. |
| 38 | * |
Elyes HAOUAS | 28114ae | 2018-11-14 17:51:00 +0100 | [diff] [blame^] | 39 | * See the smbios.h smbios_memory_type enum. |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 40 | */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 41 | uint16_t ddr_type; |
| 42 | uint16_t ddr_frequency; |
| 43 | uint8_t rank_per_dimm; |
| 44 | uint8_t channel_num; |
| 45 | uint8_t dimm_num; |
| 46 | uint8_t bank_locator; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 47 | /* |
Raul E Rangel | 99f54a6 | 2018-04-11 10:58:14 -0600 | [diff] [blame] | 48 | * SPD serial number. |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 49 | */ |
Richard Spiegel | bd65480 | 2018-02-22 10:03:39 -0700 | [diff] [blame] | 50 | uint8_t serial[DIMM_INFO_SERIAL_SIZE]; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 51 | /* |
| 52 | * The last byte is '\0' for the end of string |
| 53 | * |
| 54 | * Must contain only printable ASCII. |
| 55 | */ |
Richard Spiegel | bd65480 | 2018-02-22 10:03:39 -0700 | [diff] [blame] | 56 | uint8_t module_part_number[DIMM_INFO_PART_NUMBER_SIZE]; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 57 | /* |
| 58 | * SPD Manufacturer ID |
| 59 | */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 60 | uint16_t mod_id; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 61 | /* |
| 62 | * SPD Module Type. |
| 63 | * |
| 64 | * See spd.h for valid values. |
| 65 | * |
| 66 | * e.g., SPD_RDIMM, SPD_SODIMM, SPD_MICRO_DIMM |
| 67 | */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 68 | uint8_t mod_type; |
Raul E Rangel | 5041e9b | 2018-03-20 12:37:27 -0600 | [diff] [blame] | 69 | /* |
| 70 | * SPD bus width. |
| 71 | * |
| 72 | * Bits 0 - 2 encode the primary bus width: |
| 73 | * 0b000 = 8 bit width |
| 74 | * 0b001 = 16 bit width |
| 75 | * 0b010 = 32 bit width |
| 76 | * 0b011 = 64 bit width |
| 77 | * |
| 78 | * Bits 3 - 4 encode the extension bits (ECC): |
| 79 | * 0b00 = 0 extension bits |
| 80 | * 0b01 = 8 bit of ECC |
| 81 | * |
| 82 | * e.g., |
| 83 | * 64 bit bus with 8 bits of ECC (72 bits total): 0b1011 |
| 84 | * 64 bit bus with 0 bits of ECC (64 bits total): 0b0011 |
| 85 | * |
| 86 | * See the smbios.h smbios_memory_bus_width enum. |
| 87 | */ |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 88 | uint8_t bus_width; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 89 | } __packed; |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 90 | |
| 91 | struct memory_info { |
| 92 | uint8_t dimm_cnt; |
Richard Spiegel | bd65480 | 2018-02-22 10:03:39 -0700 | [diff] [blame] | 93 | struct dimm_info dimm[DIMM_INFO_TOTAL]; |
Stefan Reinauer | 6a00113 | 2017-07-13 02:20:27 +0200 | [diff] [blame] | 94 | } __packed; |
Kane Chen | 33faac6 | 2014-07-27 12:54:44 -0700 | [diff] [blame] | 95 | |
| 96 | #endif |