2020-05-05 23:43:18 +02:00
|
|
|
/* Memory information */
|
2020-05-05 22:49:26 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2014-07-27 21:54:44 +02:00
|
|
|
|
|
|
|
#ifndef _MEMORY_INFO_H_
|
|
|
|
#define _MEMORY_INFO_H_
|
|
|
|
|
2017-02-23 12:26:54 +01:00
|
|
|
#include <stdint.h>
|
2020-07-27 15:37:43 +02:00
|
|
|
#include <stdbool.h>
|
2017-02-23 12:26:54 +01:00
|
|
|
|
2018-04-11 18:58:14 +02:00
|
|
|
#define DIMM_INFO_SERIAL_SIZE 4
|
2018-10-09 15:31:24 +02:00
|
|
|
#define DIMM_INFO_PART_NUMBER_SIZE 33
|
2018-02-22 18:03:39 +01:00
|
|
|
#define DIMM_INFO_TOTAL 8 /* Maximum num of dimm is 8 */
|
|
|
|
|
2018-03-20 19:37:27 +01:00
|
|
|
/**
|
2014-07-27 21:54:44 +02:00
|
|
|
* If this table is filled and put in CBMEM,
|
|
|
|
* then these info in CBMEM will be used to generate smbios type 17 table
|
2018-03-20 19:37:27 +01:00
|
|
|
*
|
|
|
|
* Values are specified according to the JEDEC SPD Standard.
|
2014-07-27 21:54:44 +02:00
|
|
|
*/
|
|
|
|
struct dimm_info {
|
2018-03-20 19:37:27 +01:00
|
|
|
/*
|
|
|
|
* Size of the module in MiB.
|
|
|
|
*/
|
2014-07-27 21:54:44 +02:00
|
|
|
uint32_t dimm_size;
|
2018-03-20 19:37:27 +01:00
|
|
|
/*
|
|
|
|
* SMBIOS (not SPD) device type.
|
|
|
|
*
|
2018-11-14 17:51:00 +01:00
|
|
|
* See the smbios.h smbios_memory_type enum.
|
2018-03-20 19:37:27 +01:00
|
|
|
*/
|
2014-07-27 21:54:44 +02:00
|
|
|
uint16_t ddr_type;
|
|
|
|
uint16_t ddr_frequency;
|
|
|
|
uint8_t rank_per_dimm;
|
|
|
|
uint8_t channel_num;
|
|
|
|
uint8_t dimm_num;
|
|
|
|
uint8_t bank_locator;
|
2018-03-20 19:37:27 +01:00
|
|
|
/*
|
2018-04-11 18:58:14 +02:00
|
|
|
* SPD serial number.
|
2018-03-20 19:37:27 +01:00
|
|
|
*/
|
2018-02-22 18:03:39 +01:00
|
|
|
uint8_t serial[DIMM_INFO_SERIAL_SIZE];
|
2018-03-20 19:37:27 +01:00
|
|
|
/*
|
|
|
|
* The last byte is '\0' for the end of string
|
|
|
|
*
|
|
|
|
* Must contain only printable ASCII.
|
|
|
|
*/
|
2018-02-22 18:03:39 +01:00
|
|
|
uint8_t module_part_number[DIMM_INFO_PART_NUMBER_SIZE];
|
2018-03-20 19:37:27 +01:00
|
|
|
/*
|
|
|
|
* SPD Manufacturer ID
|
|
|
|
*/
|
2014-07-27 21:54:44 +02:00
|
|
|
uint16_t mod_id;
|
2018-03-20 19:37:27 +01:00
|
|
|
/*
|
|
|
|
* SPD Module Type.
|
|
|
|
*
|
|
|
|
* See spd.h for valid values.
|
|
|
|
*
|
|
|
|
* e.g., SPD_RDIMM, SPD_SODIMM, SPD_MICRO_DIMM
|
|
|
|
*/
|
2014-07-27 21:54:44 +02:00
|
|
|
uint8_t mod_type;
|
2018-03-20 19:37:27 +01:00
|
|
|
/*
|
|
|
|
* SPD bus width.
|
|
|
|
*
|
|
|
|
* Bits 0 - 2 encode the primary bus width:
|
|
|
|
* 0b000 = 8 bit width
|
|
|
|
* 0b001 = 16 bit width
|
|
|
|
* 0b010 = 32 bit width
|
|
|
|
* 0b011 = 64 bit width
|
|
|
|
*
|
|
|
|
* Bits 3 - 4 encode the extension bits (ECC):
|
|
|
|
* 0b00 = 0 extension bits
|
|
|
|
* 0b01 = 8 bit of ECC
|
|
|
|
*
|
|
|
|
* e.g.,
|
|
|
|
* 64 bit bus with 8 bits of ECC (72 bits total): 0b1011
|
|
|
|
* 64 bit bus with 0 bits of ECC (64 bits total): 0b0011
|
|
|
|
*
|
|
|
|
* See the smbios.h smbios_memory_bus_width enum.
|
|
|
|
*/
|
2014-07-27 21:54:44 +02:00
|
|
|
uint8_t bus_width;
|
2019-05-28 10:37:24 +02:00
|
|
|
/*
|
|
|
|
* Voltage Level
|
|
|
|
*/
|
|
|
|
uint16_t vdd_voltage;
|
2017-07-13 02:20:27 +02:00
|
|
|
} __packed;
|
2014-07-27 21:54:44 +02:00
|
|
|
|
|
|
|
struct memory_info {
|
2020-07-27 15:37:43 +02:00
|
|
|
/* controller specific */
|
|
|
|
bool ecc_capable;
|
|
|
|
/* Maximum capacity the DRAM controller/mainboard supports */
|
|
|
|
uint32_t max_capacity_mib;
|
|
|
|
/* Maximum number of DIMMs the DRAM controller/mainboard supports */
|
|
|
|
uint16_t number_of_devices;
|
|
|
|
|
|
|
|
/* active DIMM configuration */
|
2014-07-27 21:54:44 +02:00
|
|
|
uint8_t dimm_cnt;
|
2018-02-22 18:03:39 +01:00
|
|
|
struct dimm_info dimm[DIMM_INFO_TOTAL];
|
2017-07-13 02:20:27 +02:00
|
|
|
} __packed;
|
2014-07-27 21:54:44 +02:00
|
|
|
|
|
|
|
#endif
|