summaryrefslogtreecommitdiff
path: root/Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformDxe/PlatformDxe.h
blob: a27277bb75724d25ef74db005162c2959a704d3c (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
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
/** @file
  Header file for Platform Initialization Driver.

  Copyright (c) 2015 - 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 _PLATFORM_DRIVER_H
#define _PLATFORM_DRIVER_H

#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/PcdLib.h>
#include <Library/HobLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/IoLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <Framework/FrameworkInternalFormRepresentation.h>
#include <Protocol/PciRootBridgeIo.h>
#include <Protocol/FrameworkFormCallback.h>
#include <Protocol/CpuIo.h>
#include <Protocol/BootScriptSave.h>
#include <Protocol/DataHub.h>
#include <Protocol/PciIo.h>
#include <Guid/GlobalVariable.h>
#include <Guid/BoardFeatures.h>
#include <Guid/SetupVariable.h>
#include <Guid/PlatformInfo.h>
#include <IndustryStandard/Pci22.h>
#include <ScAccess.h>
#include <SaAccess.h>
#include <CMOSMap.h>
#include <PlatformBaseAddresses.h>
#include <SetupMode.h>
#include <PlatformBootMode.h>

//
// Internal (Locoal) Header files
//
#include "Configuration.h"

#define _EFI_H_    //skip efi.h

#define PCAT_RTC_ADDRESS_REGISTER   0x74
#define PCAT_RTC_DATA_REGISTER      0x75

#define RTC_ADDRESS_REGISTER_A      0x0A
#define RTC_ADDRESS_REGISTER_B      0x0B
#define RTC_ADDRESS_REGISTER_C      0x0C
#define RTC_ADDRESS_REGISTER_D      0x0D

#define B_RTC_ALARM_INT_ENABLE      0x20
#define B_RTC_ALARM_INT_STATUS      0x20

//
// Platform driver GUID
//
#define EFI_PLATFORM_DRIVER_GUID \
  { 0x056E7324, 0xA718, 0x465b, {0x9A, 0x84, 0x22, 0x8F, 0x06, 0x64, 0x2B, 0x4F }}

#define EFI_SECTION_STRING                  0x1C
#define EFI_FORWARD_DECLARATION(x) typedef struct _##x x
#define PREFIX_BLANK                        0x04

#pragma pack(1)

typedef UINT64  EFI_BOARD_FEATURES;
typedef UINT16  STRING_REF;
typedef UINT16  EFI_FORM_LABEL;

typedef struct {
  CHAR8 AaNumber[7];
  UINT8 BoardId;
  EFI_BOARD_FEATURES Features;
  UINT16 SubsystemDeviceId;
  UINT16 AudioSubsystemDeviceId;
  UINT64 AcpiOemTableId;
} BOARD_ID_DECODE;

typedef
EFI_STATUS
(EFIAPI *EFI_FORM_ROUTINE) (
  SYSTEM_CONFIGURATION *SetupBuffer
  );

typedef struct {
  CHAR16      *OptionString;  ///< Passed in string to generate a token for in a truly dynamic form creation
  STRING_REF  StringToken;    ///< This is used when creating a single op-code without generating a StringToken (have one already)
  UINT16      Value;
  UINT8       Flags;
  UINT16      Key;
} IFR_OPTION;

typedef struct {
  UINT8   Number;
  UINT32  HorizontalResolution;
  UINT32  VerticalResolution;
} PANEL_RESOLUTION;

#pragma pack()

//
// Prototypes
//
/**
  Saves UART2 Base Address To Restore on S3 Resume Flows

  @param[in] Event     A pointer to the Event that triggered the callback.
  @param[in] Context   A pointer to private data registered with the callback function.

**/
VOID
EFIAPI
ConfigureUart2OnReadyToBoot (
  EFI_EVENT  Event,
  VOID       *Context
  );

//
// Prototypes defined in Platform.c start
//
VOID
EFIAPI
ReadyToBootFunction (
  EFI_EVENT  Event,
  VOID       *Context
  );

UINT8
ReadCmosBank1Byte (
  IN  EFI_CPU_IO2_PROTOCOL            *CpuIo,
  IN  UINT8                           Index
  );

VOID
WriteCmosBank1Byte (
  IN  EFI_CPU_IO2_PROTOCOL            *CpuIo,
  IN  UINT8                           Index,
  IN  UINT8                           Data
  );

//
// Prototypes defined in BoardId.c
//
VOID
InitializeBoardId (
  );

//
// Prototypes defined in PciDevice.c
//
EFI_STATUS
PciBusDriverHook (
  );

VOID
EFIAPI
PciBusEvent (
  IN EFI_EVENT    Event,
  IN VOID*        Context
  );

//
// Prototypes defined in IdePlatformPolicy.c
//
VOID
InitPlatformIdePolicy (
  VOID
  );

//
// Prototypes defined in ClockControl.c
//
VOID
InitializeClockRouting (
  VOID
  );

//
// Prototypes defined in SlotConfig.c
//
VOID
InitializeSlotInfo (
  VOID
  );

//
// Prototypes defined in SiPolicy.c
//
VOID
InitSiPolicy (
  VOID
  );

//
// Prototypes defined in SensorVar.c
//
#if defined(SENSOR_INFO_VAR_SUPPORT) && SENSOR_INFO_VAR_SUPPORT != 0
VOID
InitializeSensorInfoVariable (
  );
#endif

//
// Prototypes defined in IchTcoReset.c
//
VOID
InitTcoReset (
  VOID
  );

//
// Prototypes defined in SioPlatformPolicy.c
//
VOID
InitPlatformSaPolicy (
  SYSTEM_CONFIGURATION* SystemConfiguration
  );

VOID
InitSioPlatformPolicy (
  VOID
  );

VOID
EFIAPI
AdjustRtcCentury (
  VOID
  );

//
// Global externs
//
extern SYSTEM_CONFIGURATION mSystemConfiguration;

extern EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *mPciRootBridgeIo;
extern UINT32 mSubsystemVidDid;

extern UINT8 mBoardIdIndex;
extern BOOLEAN mFoundAANum;
extern EFI_BOARD_FEATURES mBoardFeatures;
extern UINT16 mSubsystemDeviceId;
extern UINT16 mSubsystemAudioDeviceId;
extern CHAR8 BoardAaNumber[];

extern BOARD_ID_DECODE mBoardIdDecodeTable[];
extern UINTN mBoardIdDecodeTableSize;

extern BOOLEAN mMfgMode;
extern UINT32 mPlatformBootMode;

extern EFI_GUID gEfiGlobalNvsAreaProtocolGuid;

#endif