1 /* $NoKeywords */ 2 /** 3 * @file 4 * 5 * MemIscp.h 6 * 7 * Contains common Memory Training ISCP-related structures and defines. 8 * 9 * @xrefitem bom "File Content Label" "Release Content" 10 * @e project: FDK 11 * @e sub-project: UEFI 12 * @e version: $Revision: 317558 $ @e date: $Date: 2015-04-24 17:20:55 -0700 (Fri, 24 Apr 2015) $ 13 * 14 */ 15 /***************************************************************************** 16 * 17 * Copyright 2013 - 2016 ADVANCED MICRO DEVICES, INC. All Rights Reserved. 18 * 19 * This program and the accompanying materials are licensed and made available 20 * under the terms and conditions of the BSD License which accompanies this 21 * distribution. The full text of the license may be found at 22 * http://opensource.org/licenses/bsd-license.php 23 * 24 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 25 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 26 * IMPLIED. 27 * 28 ***************************************************************************/ 29 30 //######################################################################### 31 //######################################################################### 32 //######################################################################### 33 // NOTE: This file shared between SCP and UEFI, make sure all // 34 // changes are reflected in both copies. // 35 //######################################################################### 36 //######################################################################### 37 //######################################################################### 38 39 #ifndef MEMISCP_H_ 40 #define MEMISCP_H_ 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /*---------------------------------------------------------------------------------------- 47 * M O D U L E S U S E D 48 *---------------------------------------------------------------------------------------- 49 */ 50 51 52 /*---------------------------------------------------------------------------------------- 53 * T Y P E D E F S A N D S T R U C T U R E S 54 *---------------------------------------------------------------------------------------- 55 */ 56 57 /// Memory Attribute enum 58 typedef enum { 59 MEM_AVAILABLE = 1, ///< Memory Available 60 MEM_RESERVED, ///< Memory Reserved 61 MEM_ACPI, ///< Memory ACPI 62 MEM_NVS, ///< Memory NVS 63 MEM_UNUSABLE ///< Memory Unavailable 64 } MEMORY_ATTRIBUTE; 65 66 /// Memory descriptor structure for each memory range 67 typedef struct { 68 UINT64 Base0; ///< Base address of memory range 0 69 UINT64 Size0; ///< Size of memory range 0 70 MEMORY_ATTRIBUTE Attribute0; ///< Attribute of memory range 0 71 UINT32 Padding0; ///< 4-byte Padding to get 8-byte alignment 72 UINT64 Base1; ///< Base address of memory range 1 73 UINT64 Size1; ///< Size of memory range 1 74 MEMORY_ATTRIBUTE Attribute1; ///< Attribute of memory range 1 75 UINT32 Padding1; ///< 4-byte Padding to get 8-byte alignment 76 UINT64 Base2; ///< Base address of memory range 2 77 UINT64 Size2; ///< Size of memory range 2 78 MEMORY_ATTRIBUTE Attribute2; ///< Attribute of memory range 2 79 UINT32 Padding2; ///< 4-byte Padding to get 8-byte alignment 80 UINT64 Base3; ///< Base address of memory range 3 81 UINT64 Size3; ///< Size of memory range 3 82 MEMORY_ATTRIBUTE Attribute3; ///< Attribute of memory range 3 83 UINT32 Padding3; ///< 4-byte Padding to get 8-byte alignment 84 } AMD_MEMORY_RANGE_DESCRIPTOR; 85 86 /// SMBIOS Structure Header 87 typedef struct { 88 UINT8 Type; ///< TYPE 89 UINT8 Length; ///< Length of TYPE 90 UINT16 Handle; ///< structure handle, a unique 16-bit number in the range 0 to 0FEFFh 91 } ISCP_SMBIOS_STRUCTURE_HEADER; 92 93 /// DMI Type 16 - Physical Memory Array 94 typedef struct { 95 UINT16 Location; ///< The physical location of the Memory Array, 96 ///< whether on the system board or an add-in board. 97 UINT16 Use; ///< Identifies the function for which the array 98 ///< is used. 99 UINT16 MemoryErrorCorrection; ///< The primary hardware error correction or 100 ///< detection method supported by this memory array. 101 ///< ..for memory devices in this array. 102 UINT16 NumberOfMemoryDevices; ///< The number of slots or sockets available.. 103 ///< ..for memory devices in this array. 104 } ISCP_TYPE16_SMBIOS_INFO; 105 106 /// DMI Type 17 offset 13h - Type Detail 107 typedef struct { 108 UINT16 Reserved1:1; ///< Reserved 109 UINT16 Other:1; ///< Other 110 UINT16 Unknown:1; ///< Unknown 111 UINT16 FastPaged:1; ///< Fast-Paged 112 UINT16 StaticColumn:1; ///< Static column 113 UINT16 PseudoStatic:1; ///< Pseudo-static 114 UINT16 Rambus:1; ///< RAMBUS 115 UINT16 Synchronous:1; ///< Synchronous 116 UINT16 Cmos:1; ///< CMOS 117 UINT16 Edo:1; ///< EDO 118 UINT16 WindowDram:1; ///< Window DRAM 119 UINT16 CacheDram:1; ///< Cache Dram 120 UINT16 NonVolatile:1; ///< Non-volatile 121 UINT16 Registered:1; ///< Registered (Buffered) 122 UINT16 Unbuffered:1; ///< Unbuffered (Unregistered) 123 UINT16 Reserved2:1; ///< Reserved 124 } SMBIOS_T17_TYPE_DETAIL; 125 126 /// DMI Type 17 - Memory Device 127 typedef struct { 128 UINT16 Handle; ///< The temporary handle, or instance number, associated with the structure 129 UINT16 TotalWidth; ///< Total Width, in bits, of this memory device, including any check or error-correction bits. 130 UINT16 DataWidth; ///< Data Width, in bits, of this memory device. 131 UINT16 MemorySize; ///< The size of the memory device. 132 UINT16 FormFactor; ///< The implementation form factor for this memory device. 133 UINT16 DeviceSet; ///< Identifies when the Memory Device is one of a set of.. 134 ///< ..memory devices that must be populated with all devices of.. 135 ///< ..the same type and size, and the set to which this device belongs. 136 CHAR8 DeviceLocator[8]; ///< The string number of the string that identifies the physically labeled socket or board position where the memory device is located. 137 CHAR8 BankLocator[16]; ///< The string number of the string that identifies the physically labeled bank where the memory device is located. 138 UINT16 MemoryType; ///< The type of memory used in this device. 139 SMBIOS_T17_TYPE_DETAIL TypeDetail; ///< Additional detail on the memory device type 140 UINT16 Speed; ///< Identifies the speed of the device, in megahertz (MHz). 141 UINT8 ManufacturerIdCode[8]; ///< Manufacturer ID code. 142 CHAR8 SerialNumber[16]; ///< Serial Number. 143 CHAR8 PartNumber[20]; ///< Part Number. 144 UINT16 Attributes; ///< Bits 7-4: Reserved, Bits 3-0: rank. 145 UINT32 ExtSize; ///< Extended Size. 146 UINT16 ConfigSpeed; ///< Configured memory clock speed 147 } ISCP_TYPE17_SMBIOS_INFO; 148 149 /// DMI Type 19 - Memory Array Mapped Address 150 typedef struct { 151 UINT32 StartingAddr; ///< The physical address, in kilobytes, 152 ///< of a range of memory mapped to the 153 ///< specified physical memory array. 154 UINT32 EndingAddr; ///< The physical ending address of the 155 ///< last kilobyte of a range of addresses 156 ///< mapped to the specified physical memory array. 157 UINT16 MemoryArrayHandle; ///< The handle, or instance number, associated 158 ///< with the physical memory array to which this 159 ///< address range is mapped. 160 UINT8 PartitionWidth; ///< Identifies the number of memory devices that 161 ///< form a single row of memory for the address 162 ///< partition defined by this structure. 163 UINT64 ExtStartingAddr; ///< The physical address, in bytes, of a range of 164 ///< memory mapped to the specified Physical Memory Array. 165 UINT64 ExtEndingAddr; ///< The physical address, in bytes, of a range of 166 ///< memory mapped to the specified Physical Memory Array. 167 } ISCP_TYPE19_SMBIOS_INFO; 168 169 #ifdef __cplusplus 170 } 171 #endif 172 173 174 #endif /* MEMISCP_H_ */ 175