blob: 5976e319f870fb6366ffdb021eafb265b2751914 [file] [log] [blame]
Kane Chen33faac62014-07-27 12:54:44 -07001/*
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 Sarkarc16d3892017-02-23 16:56:54 +053019#include <stdint.h>
20
Raul E Rangel99f54a62018-04-11 10:58:14 -060021#define DIMM_INFO_SERIAL_SIZE 4
Aaron Durbin4b6f2622018-10-09 07:31:24 -060022#define DIMM_INFO_PART_NUMBER_SIZE 33
Richard Spiegelbd654802018-02-22 10:03:39 -070023#define DIMM_INFO_TOTAL 8 /* Maximum num of dimm is 8 */
24
Raul E Rangel5041e9b2018-03-20 12:37:27 -060025/**
Kane Chen33faac62014-07-27 12:54:44 -070026 * 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 Rangel5041e9b2018-03-20 12:37:27 -060028 *
29 * Values are specified according to the JEDEC SPD Standard.
Kane Chen33faac62014-07-27 12:54:44 -070030 */
31struct dimm_info {
Raul E Rangel5041e9b2018-03-20 12:37:27 -060032 /*
33 * Size of the module in MiB.
34 */
Kane Chen33faac62014-07-27 12:54:44 -070035 uint32_t dimm_size;
Raul E Rangel5041e9b2018-03-20 12:37:27 -060036 /*
37 * SMBIOS (not SPD) device type.
38 *
39 * See the smbios.h smbios_memory_device_type enum.
40 */
Kane Chen33faac62014-07-27 12:54:44 -070041 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 Rangel5041e9b2018-03-20 12:37:27 -060047 /*
Raul E Rangel99f54a62018-04-11 10:58:14 -060048 * SPD serial number.
Raul E Rangel5041e9b2018-03-20 12:37:27 -060049 */
Richard Spiegelbd654802018-02-22 10:03:39 -070050 uint8_t serial[DIMM_INFO_SERIAL_SIZE];
Raul E Rangel5041e9b2018-03-20 12:37:27 -060051 /*
52 * The last byte is '\0' for the end of string
53 *
54 * Must contain only printable ASCII.
55 */
Richard Spiegelbd654802018-02-22 10:03:39 -070056 uint8_t module_part_number[DIMM_INFO_PART_NUMBER_SIZE];
Raul E Rangel5041e9b2018-03-20 12:37:27 -060057 /*
58 * SPD Manufacturer ID
59 */
Kane Chen33faac62014-07-27 12:54:44 -070060 uint16_t mod_id;
Raul E Rangel5041e9b2018-03-20 12:37:27 -060061 /*
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 Chen33faac62014-07-27 12:54:44 -070068 uint8_t mod_type;
Raul E Rangel5041e9b2018-03-20 12:37:27 -060069 /*
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 Chen33faac62014-07-27 12:54:44 -070088 uint8_t bus_width;
Stefan Reinauer6a001132017-07-13 02:20:27 +020089} __packed;
Kane Chen33faac62014-07-27 12:54:44 -070090
91struct memory_info {
92 uint8_t dimm_cnt;
Richard Spiegelbd654802018-02-22 10:03:39 -070093 struct dimm_info dimm[DIMM_INFO_TOTAL];
Stefan Reinauer6a001132017-07-13 02:20:27 +020094} __packed;
Kane Chen33faac62014-07-27 12:54:44 -070095
96#endif