summaryrefslogtreecommitdiff
path: root/Silicon/BroxtonSoC/BroxtonSiPkg/NorthCluster/MemoryInit/Mmrc/ProjectIndependent/Include/MmrcData.h
blob: 0d64528c452f5ba89e1ce2fc685428ab34df013d (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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
/** @file
  Internal and external data structures, Macros, and enumerations.

  Copyright (c) 2005 - 2017, Intel Corporation. All rights reserved.<BR>

  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.

**/
#ifndef _MMRCDATA_H_
#define _MMRCDATA_H_

#include "Spd.h"
#include "MmrcProjectDefinitions.h"

#if SIM || JTAG
#include <stdio.h>
#endif

#if USE_64_BIT_VARIABLES
#define UINTX UINT64
#else
#define UINTX UINT32
#endif
typedef UINT32           MMRC_STATUS;

//
// MRC version description.
//
typedef union {
  struct{
    UINT8      Major;             ///< Major version number
    UINT8      Minor;             ///< Minor version number
    UINT8      Rev;               ///< Revision number
    UINT8      Build;             ///< Build number
  } Version;
  struct{
    UINT32     Major     : 4;        ///< Major version number
    UINT32     DevId     : 3;        ///< Field that can be used to identify dev that built test BIOS
    UINT32     TestBuild : 1;        ///< Flag that indicates that BIOS was built on a dev machine
    UINT32     Minor     : 8;        ///< Minor version number
    UINT32     Rev       : 8;        ///< Revision number
    UINT32     Build     : 8;        ///< Build number
  } Bits;
  UINT32     Data;
  UINT16     Data16[2];
  UINT8      Data8[4];
} MrcVersion;

#ifndef ABSOLUTE
#define ABSOLUTE                      1
#define RELATIVE                      2
#endif

#pragma pack(push)
#pragma pack(1)

typedef enum {
  BootFrequency,
  HighFrequency,
  MaxFrequencyIndex
} FREQUENCY_INDEX;

//
// Bit definitions
//
#ifndef BIT0
#define BIT0                  0x00000001
#define BIT1                  0x00000002
#define BIT2                  0x00000004
#define BIT3                  0x00000008
#define BIT4                  0x00000010
#define BIT5                  0x00000020
#define BIT6                  0x00000040
#define BIT7                  0x00000080
#define BIT8                  0x00000100
#define BIT9                  0x00000200
#define BIT10                 0x00000400
#define BIT11                 0x00000800
#define BIT12                 0x00001000
#define BIT13                 0x00002000
#define BIT14                 0x00004000
#define BIT15                 0x00008000
#define BIT16                 0x00010000
#define BIT17                 0x00020000
#define BIT18                 0x00040000
#define BIT19                 0x00080000
#define BIT20                 0x00100000
#define BIT21                 0x00200000
#define BIT22                 0x00400000
#define BIT23                 0x00800000
#define BIT24                 0x01000000
#define BIT25                 0x02000000
#define BIT26                 0x04000000
#define BIT27                 0x08000000
#define BIT28                 0x10000000
#define BIT29                 0x20000000
#define BIT30                 0x40000000
#define BIT31                 0x80000000
#endif

typedef enum  {
  Pfct =  0,
  PfctT,
  PfctC,
  PfctCT,
  PfctF,
  PfctFT,
  PfctFC,
  PfctFCT,
  PfctP,
  PfctPT,
  PfctPC,
  PfctPCT,
  PfctPF,
  PfctPFT,
  PfctPFC,
  PfctPFCT,
  MaxPfct,
} ENUM_PCFT_TYPE;

typedef struct {
  UINT8   SpdPresent;
  UINT8   Buffer[MAX_SPD_ADDR + 1];
} SPD_DATA;

/**
  Final training values stored on a per blueprint level. Needs to be per blueprint
  in case of a system with more than 1 level of memory per channel.

**/
typedef struct {
  UINT16    Values[MAX_BLUEPRINTS][MAX_NUM_ALGOS][MAX_RANKS][MAX_STROBES];
} TRAINING_SETTING;

typedef struct {
  UINT8  ManuIDlo;
  UINT8  ManuIDhi;
  UINT8  ManuLoc;
  UINT8  ManuDateLO;
  UINT8  ManuDateHI;
  UINT8  SerialNumber1;
  UINT8  SerialNumber2;
  UINT8  SerialNumber3;
  UINT8  SerialNumber4;
  UINT8  DimmCount;
} FASTBOOTDATA;

//
// BOOT_VARIABLE_NV_DATA
// Use this structure to store NV data that changes from boot to boot.
//
typedef struct {
  UINT16                    ScramblerSeed[MAX_CHANNELS];
  UINT32                    SaMemCfgCrc;
  UINT32                    MrcParamsSaveRestoreCrc;
} BOOT_VARIABLE_NV_DATA;

typedef struct {
  TRAINING_SETTING          Trained_Value;
  BOOLEAN                   Enabled;
  UINT32                    TotalMem;
  UINT8                     DimmCount;
  UINT8                     DimmPresent[MAX_DIMMS];
  UINT32                    SlotMem[MAX_DIMMS];
  SPD_DATA                  SpdData[MAX_DIMMS];
  UINT8                     D_Ranks[MAX_DIMMS];
  UINT8                     D_DataWidth[MAX_DIMMS];
  UINT8                     D_Banks[MAX_DIMMS];
  UINT8                     D_BusWidth[MAX_DIMMS];
  UINT8                     D_Size_SPD[MAX_DIMMS];
  UINT8                     D_Size[MAX_DIMMS];
  UINT8                     D_SizeActual[MAX_DIMMS];
  UINT8                     D_Type[MAX_DIMMS];
  UINT16                    DimmFrequency[MAX_DIMMS];
  BOOLEAN                   RankEnabled[MAX_RANKS];
  BOOLEAN                   EccEnabled;
  UINT32                    EccStrobes;
  UINT8                     MaxDq[MAX_RANKS];
  FASTBOOTDATA              FastBootData[MAX_DIMMS];
  UINT16                    DramType;
  UINT16                    CurrentPlatform;
  UINT16                    CurrentFrequency;
  UINT16                    CurrentConfiguration;
  UINT16                    CurrentDdrType;
  BOOLEAN                   ExecuteOnThisChannel;
  UINT16                    TimingData[16];
  INT16                     RMT_Data[MAX_RANKS + PSEUDO_RANKS][MAX_RMT_ELEMENTS][2];
#if RMT_PER_BIT_MARGIN
  INT16                     RMT_DQData[MAX_RANKS + PSEUDO_RANKS][MAX_RMT_ELEMENTS][MAX_BITS*MAX_STROBES][2];
#endif
  UINT8                     Tcl;
  UINT8                     VrefSmbAddress;
  UINT32                    PtCtl0;
  UINT8                     Dimm2DunitMapping[MAX_STROBES*8];
  UINT8                     Dimm2DunitReverseMapping[MAX_STROBES*8];
#if SIM && DDR4_SUPPORT
  UINT16                    TbMr5;
#endif
#if FAULTY_PART_TRACKING
  FAULTY_PART               FaultyPart[MAX_RANKS];
#endif
  UINT32                    WrVref[MAX_RANKS][MAX_STROBES];
  UINT32                    CaVref[MAX_RANKS];
  UINT32                    Storage[18];
  UINT8                     ASR_Supported;
  UINT8                     OdtHigh;
  UINT16                    LP4_MR0VALUE;
  UINT16                    LP4_MR4VALUE;
} CHANNEL;

typedef struct {
  UINT32        Signature;
  UINT16        CurrentFrequency;
  UINT8         DVFSFreqIndex;
  UINT16        DDR3L_MRVALUE;
  UINT8         DDR3L_PageSize;
  UINT32        SystemMemorySize;
  UINT32        MrcVer;
  UINT32        CachedValues[MAX_CHANNELS][MAX_NUM_CACHE_ELEMENTS][MAX_RANKS][MAX_STROBES];
  UINT32        CachedValuesPB[MAX_CHANNELS][MAX_NUM_CACHE_ELEMENTS_PB][MAX_RANKS][MAX_STROBES][MAX_BITS];
  UINT8         BusWidth;
  CHANNEL       Channel[MAX_CHANNELS];
  UINT32        MarginCheckResultState;
  DRAM_POLICY   DramPolicyData;
  UINT32        MuxcodeNv[MaxFrequencyIndex];
  BOOLEAN       SetupMaxPiDone[MaxFrequencyIndex];
  UINT32        DataSize;
} MRC_PARAMS_SAVE_RESTORE;

//
// Structure for all data that is saved to NV RAM
// and restored on the subsequent boots
//
typedef struct {
  MRC_PARAMS_SAVE_RESTORE MrcParamsSaveRestore;
  BOOT_VARIABLE_NV_DATA   BootVariableNvData;
} MRC_NV_DATA_FRAME;

#pragma pack()
#pragma pack(pop)
#endif