hc
2024-03-25 edb30157bad0c0001c32b854271ace01d3b9a16a
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
249
250
251
252
253
254
255
256
257
258
259
/** @file
  UBA GPIO Platform Specific functions Library Header File.
 
  @copyright
  Copyright 2016 - 2021 Intel Corporation. <BR>
 
  SPDX-License-Identifier: BSD-2-Clause-Patent
**/
 
#ifndef _UBA_GPIO_PLATFORM_CONFIG_LIB_H
#define _UBA_GPIO_PLATFORM_CONFIG_LIB_H
 
#include <Base.h>
#include <Uefi.h>
#include <Library/GpioLib.h>
 
#define PLATFORM_GPIO_CONFIG_SIGNATURE  SIGNATURE_32 ('P', 'G', 'P', 'O')
#define PLATFORM_GPIO_CONFIG_VERSION    01
 
 
// {d2c2adab-80c0-4a13-a0f8-adede1a51740}
#define   PLATFORM_GPIO_PLATFORM_CONFIG_DATA_GUID \
{ 0xd2c2adab, 0x80c0, 0x4a13, { 0xa0, 0xf8, 0xad, 0xed, 0xe1, 0xa5, 0x17, 0x40 } }
 
//Use this define to skip the usage of a gpio in PLATFORM_GPIO_CONFIG_TABLE
#define UNUSED_GPIO             0x0
 
typedef struct _PLATFORM_GPIO_CONFIG_TABLE{
  //
  // Header information
  //
  INT32                    Signature;
  INT32                    Version;
 
  GPIO_INIT_CONFIG         GpioMfgPad;
  GPIO_PAD                 ReservedM;
  GPIO_PAD                 RcvJumper;
 
  //
  // ADR pads
  //
  GPIO_PAD                 FmAdrTrigger;
  GPIO_PAD                 AdrEnable;
 
  //
  // OemProcMemInit pad
  //
  GPIO_PAD                 ForceTo1SConfigModePad;
 
  //
  // Used by PC Platforms
  //
  GPIO_PAD                 QATGpio;
 
  //
  // Used by PC platforms. This is the first GPIO pad of the pad series to indicate Board ID
  //
  GPIO_PAD                 BoardID0Gpio;
 
  //
  // Used to indicate proper pin to for WHEA SCI detection
  //
  GPIO_PAD                 WheaSciPad;
 
  //
  // Used to generate CPU HP SMI
  //
  GPIO_PAD                 CpuHpSmiPad;
 
  //
  // Used to signal FPGA error
  //
  GPIO_PAD                 FpgaErrorSingnalPad1;
 
  //
  // Used to signal FPGA error
  //
  GPIO_PAD                 FpgaErrorSingnalPad2;
 
  // Flash Security override
  GPIO_PAD                 FlashSecOverride;
} PLATFORM_GPIO_CONFIG_TABLE;
 
 
/**
 
    Reads GPIO pin to get Flash Security Override jumper status
 
    @param[out] Jumper - The pointer to the jumper output
 
    @retval Status - Success if GPIO's are read properly
 
**/
EFI_STATUS
GpioGetFlashSecOvrdVal (
  OUT UINT32 *Jumper
);
/**
 
    Reads GPIO pin to get recovery jumper status
 
    @param[out] RcvJumper - The pointer to the Recovery jumper input
 
    @retval Status - Success if GPIO's are read properly
 
**/
EFI_STATUS
GpioGetRcvPadVal (
  OUT UINT32 *RcvJumper
);
 
 
/**
 
    Reads GPIO pin to get FM ADR trigger pin
 
    @param[out] FmAdrTrigger - The pointer to the ADR trigger input
 
    @retval Status - Success if GPIO's are read properly
 
**/
EFI_STATUS
GpioGetFmAdrTriggerPadVal (
  OUT UINT32 *FmAdrTrigger
);
 
/**
 
    Sets GPIO pin to enable ADR on the board
 
    @param Set[in] - If TRUE means the pas should go 'high', otherwise 'low'
 
    @retval Status - Success if GPIO set properly
 
**/
EFI_STATUS
GpioSetAdrEnablePadOutVal (
  IN BOOLEAN Set
);
 
/**
 
    Reads GPIO pin to Force to S1 config mode pad
 
    @param[out] ForceS1ConfigPad - Input value of the Froce S1 Config pad
 
    @retval Status - Success if GPIO's are read properly
 
**/
EFI_STATUS
GpioGetForcetoS1ConfigModePadVal (
  OUT UINT32 *ForceS1ConfigPad
);
 
/**
 
    Reads GPIO pin related to QAT
 
    @param[out] QATPad - Input value of the QAT pad
 
    @retval Status - Success if GPIO's are read properly
 
**/
EFI_STATUS
GpioGetQATPadVal (
  OUT UINT32 *QATPad
);
 
 
/**
 
    Get GPIO pin for SCI detection for WHEA RAS functionality
 
    @param[out] WheaSciPad - Input value of the Whea SCI pad
 
    @retval Status - Success if GPIO's pad read properly
 
**/
EFI_STATUS
GpioGetWheaSciPad (
  OUT UINT32 *WheaSciPad
);
 
/**
 
    Get GPIO pin for FPGA error detection RAS functionality
 
    @param[out] FpgaErrorPad -The input value of the FPGA error 1 pad
 
    @retval Status - Success if GPIO's pad read properly
 
**/
EFI_STATUS
GpioGetFpgaErrorPad1 (
  OUT UINT32 *FpgaErrorPad
);
 
 
/**
 
    Get GPIO pin for FPGA error detection RAS functionality
 
    @param[out] FpgaErrorPad -The input value of the FPGA error 2 pad
 
    @retval Status - Success if GPIO's pad read properly
 
**/
EFI_STATUS
GpioGetFpgaErrorPad2 (
  OUT UINT32 *FpgaErrorPad
);
 
/**
 
    Get GPIO pin for CPU HP SMI detection for RAS functionality
 
    @retval Status - Success if GPIO's pad read properly
 
**/
EFI_STATUS
GpioGetCpuHpSmiPad (
  OUT UINT32 *CpuHpSmiPad
);
 
 
/**
 
    Reads GPIO pin that is first bit of the Board ID indication word
 
    @param[out] BoardID0Gpio - Input value of the first Board ID pad
 
    @retval Status - Success if GPIO's are read properly
 
**/
EFI_STATUS
GpioGetBoardId0PadVal (
  OUT UINT32 *BoardID0Gpio
);
 
 
/**
 
    Checks whether the MDF jumper has been set
 
    @param None
 
    @retval ManufacturingMode - TRUE when MFG jumper is on, FALSE otherwise
 
**/
BOOLEAN
IsManufacturingMode (
  VOID
);
 
 
STATIC  EFI_GUID gPlatformGpioPlatformConfigDataGuid = PLATFORM_GPIO_PLATFORM_CONFIG_DATA_GUID;
 
#endif //_UBA_GPIO_PLATFORM_CONFIG_LIB_H