summaryrefslogtreecommitdiff
path: root/Silicon/AMD/Styx/AmdModulePkg/Common/MemIscp.h
blob: c8ffe9d8d415f2ab509519b570f0807691d380d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/* $NoKeywords */
/**
 * @file
 *
 * MemIscp.h
 *
 * Contains common Memory Training ISCP-related structures and defines.
 *
 * @xrefitem bom "File Content Label" "Release Content"
 * @e project: FDK
 * @e sub-project: UEFI
 * @e version: $Revision: 317558 $ @e date: $Date: 2015-04-24 17:20:55 -0700 (Fri, 24 Apr 2015) $
 *
 */
/*****************************************************************************
*
*  Copyright 2013 - 2016 ADVANCED MICRO DEVICES, INC.  All Rights Reserved.
*
*  This program and the accompanying materials are licensed and made available
*  under the terms and conditions of the BSD License which accompanies this
*  distribution. The full text of the license may be found at
*  http://opensource.org/licenses/bsd-license.php
*
*  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
*  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
*  IMPLIED.
*
***************************************************************************/

//#########################################################################
//#########################################################################
//#########################################################################
//        NOTE: This file shared between SCP and UEFI, make sure all     //
//              changes are reflected in both copies.                    //
//#########################################################################
//#########################################################################
//#########################################################################

#ifndef MEMISCP_H_
#define MEMISCP_H_

#ifdef __cplusplus
  extern "C" {
  #endif

/*----------------------------------------------------------------------------------------
 *                             M O D U L E S    U S E D
 *----------------------------------------------------------------------------------------
 */


/*----------------------------------------------------------------------------------------
 *                  T Y P E D E F S     A N D     S T R U C T U R E S
 *----------------------------------------------------------------------------------------
 */

  /// Memory Attribute enum
  typedef enum {
    MEM_AVAILABLE = 1,                        ///< Memory Available
    MEM_RESERVED,                             ///< Memory Reserved
    MEM_ACPI,                                 ///< Memory ACPI
    MEM_NVS,                                  ///< Memory NVS
    MEM_UNUSABLE                              ///< Memory Unavailable
  } MEMORY_ATTRIBUTE;

  /// Memory descriptor structure for each memory range
  typedef struct {
    UINT64            Base0;                  ///< Base address of memory range 0
    UINT64            Size0;                  ///< Size of memory range 0
    MEMORY_ATTRIBUTE  Attribute0;             ///< Attribute of memory range 0
    UINT32            Padding0;               ///< 4-byte Padding to get 8-byte alignment
    UINT64            Base1;                  ///< Base address of memory range 1
    UINT64            Size1;                  ///< Size of memory range 1
    MEMORY_ATTRIBUTE  Attribute1;             ///< Attribute of memory range 1
    UINT32            Padding1;               ///< 4-byte Padding to get 8-byte alignment
    UINT64            Base2;                  ///< Base address of memory range 2
    UINT64            Size2;                  ///< Size of memory range 2
    MEMORY_ATTRIBUTE  Attribute2;             ///< Attribute of memory range 2
    UINT32            Padding2;               ///< 4-byte Padding to get 8-byte alignment
    UINT64            Base3;                  ///< Base address of memory range 3
    UINT64            Size3;                  ///< Size of memory range 3
    MEMORY_ATTRIBUTE  Attribute3;             ///< Attribute of memory range 3
    UINT32            Padding3;               ///< 4-byte Padding to get 8-byte alignment
  } AMD_MEMORY_RANGE_DESCRIPTOR;

  /// SMBIOS Structure Header
  typedef struct {
    UINT8   Type;                             ///< TYPE
    UINT8   Length;                           ///< Length of TYPE
    UINT16  Handle;                           ///< structure handle, a unique 16-bit number in the range 0 to 0FEFFh
  } ISCP_SMBIOS_STRUCTURE_HEADER;

  /// DMI Type 16 - Physical Memory Array
  typedef struct {
    UINT16                    Location;               ///< The physical location of the Memory Array,
                                                      ///< whether on the system board or an add-in board.
    UINT16                    Use;                    ///< Identifies the function for which the array
                                                      ///< is used.
    UINT16                    MemoryErrorCorrection;  ///< The primary hardware error correction or
                                                      ///< detection method supported by this memory array.
                                                      ///< ..for memory devices in this array.
    UINT16                    NumberOfMemoryDevices;  ///< The number of slots or sockets available..
                                                      ///< ..for memory devices in this array.
  } ISCP_TYPE16_SMBIOS_INFO;

  /// DMI Type 17 offset 13h - Type Detail
  typedef struct {
    UINT16                    Reserved1:1;            ///< Reserved
    UINT16                    Other:1;                ///< Other
    UINT16                    Unknown:1;              ///< Unknown
    UINT16                    FastPaged:1;            ///< Fast-Paged
    UINT16                    StaticColumn:1;         ///< Static column
    UINT16                    PseudoStatic:1;         ///< Pseudo-static
    UINT16                    Rambus:1;               ///< RAMBUS
    UINT16                    Synchronous:1;          ///< Synchronous
    UINT16                    Cmos:1;                 ///< CMOS
    UINT16                    Edo:1;                  ///< EDO
    UINT16                    WindowDram:1;           ///< Window DRAM
    UINT16                    CacheDram:1;            ///< Cache Dram
    UINT16                    NonVolatile:1;          ///< Non-volatile
    UINT16                    Registered:1;           ///< Registered (Buffered)
    UINT16                    Unbuffered:1;           ///< Unbuffered (Unregistered)
    UINT16                    Reserved2:1;            ///< Reserved
  } SMBIOS_T17_TYPE_DETAIL;

  /// DMI Type 17 - Memory Device
  typedef struct {
    UINT16                    Handle;                  ///< The temporary handle, or instance number, associated with the structure
    UINT16                    TotalWidth;              ///< Total Width, in bits, of this memory device, including any check or error-correction bits.
    UINT16                    DataWidth;               ///< Data Width, in bits, of this memory device.
    UINT16                    MemorySize;              ///< The size of the memory device.
    UINT16                    FormFactor;              ///< The implementation form factor for this memory device.
    UINT16                    DeviceSet;               ///< Identifies when the Memory Device is one of a set of..
                                                       ///< ..memory devices that must be populated with all devices of..
                                                       ///< ..the same type and size, and the set to which this device belongs.
    CHAR8                     DeviceLocator[8];        ///< The string number of the string that identifies the physically labeled socket or board position where the memory device is located.
    CHAR8                     BankLocator[16];         ///< The string number of the string that identifies the physically labeled bank where the memory device is located.
    UINT16                    MemoryType;              ///< The type of memory used in this device.
    SMBIOS_T17_TYPE_DETAIL    TypeDetail;              ///< Additional detail on the memory device type
    UINT16                    Speed;                   ///< Identifies the speed of the device, in megahertz (MHz).
    UINT8                     ManufacturerIdCode[8];   ///< Manufacturer ID code.
    CHAR8                     SerialNumber[16];        ///< Serial Number.
    CHAR8                     PartNumber[20];          ///< Part Number.
    UINT16                    Attributes;              ///< Bits 7-4: Reserved, Bits 3-0: rank.
    UINT32                    ExtSize;                 ///< Extended Size.
    UINT16                    ConfigSpeed;             ///< Configured memory clock speed
  } ISCP_TYPE17_SMBIOS_INFO;

  /// DMI Type 19 - Memory Array Mapped Address
  typedef struct {
    UINT32                    StartingAddr;           ///< The physical address, in kilobytes,
                                                      ///< of a range of memory mapped to the
                                                      ///< specified physical memory array.
    UINT32                    EndingAddr;             ///< The physical ending address of the
                                                      ///< last kilobyte of a range of addresses
                                                      ///< mapped to the specified physical memory array.
    UINT16                    MemoryArrayHandle;      ///< The handle, or instance number, associated
                                                      ///< with the physical memory array to which this
                                                      ///< address range is mapped.
    UINT8                     PartitionWidth;         ///< Identifies the number of memory devices that
                                                      ///< form a single row of memory for the address
                                                      ///< partition defined by this structure.
    UINT64                    ExtStartingAddr;        ///< The physical address, in bytes, of a range of
                                                      ///< memory mapped to the specified Physical Memory Array.
    UINT64                    ExtEndingAddr;          ///< The physical address, in bytes, of a range of
                                                      ///< memory mapped to the specified Physical Memory Array.
  } ISCP_TYPE19_SMBIOS_INFO;

  #ifdef __cplusplus
  }
#endif


#endif /* MEMISCP_H_ */