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
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
|
/*++
Copyright (c) 2004 - 2016, 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 that 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.
Module Name:
BdsPlatform.h
Abstract:
Head file for BDS Platform specific code
--*/
#ifndef _BDS_PLATFORM_H
#define _BDS_PLATFORM_H
#include <FrameworkDxe.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/DevicePath.h>
#include <Protocol/SimpleNetwork.h>
#include <Protocol/PciRootBridgeIo.h>
#include <Protocol/LoadFile.h>
#include <Protocol/LegacyBios.h>
#include <Protocol/PciIo.h>
#include <Protocol/SmmAccess2.h>
#include <Protocol/DxeSmmReadyToLock.h>
#include <Protocol/UserManager.h>
#include <Protocol/DeferredImageLoad.h>
#include <Protocol/AcpiS3Save.h>
#include <Protocol/ExitPmAuth.h>
#include <Protocol/MmioDevice.h>
#include <Protocol/I2cBusMcg.h>
#include <Protocol/I2cHostMcg.h>
#include <Guid/CapsuleVendor.h>
#include <Guid/MemoryTypeInformation.h>
#include <Guid/GlobalVariable.h>
#include <Guid/DebugAgentGuid.h>
#include <Library/DebugLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/BaseLib.h>
#include <Library/PcdLib.h>
#include <Library/IoLib.h>
#include <Library/GenericBdsLib.h>
#include <Library/PlatformBdsLib.h>
#include <Library/DevicePathLib.h>
#include <Library/UefiLib.h>
#include <Library/HobLib.h>
#include <Library/PrintLib.h>
#include <Library/PerformanceLib.h>
#include <Library/ReportStatusCodeLib.h>
#include <IndustryStandard/Pci.h>
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformRootBridges [];
extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole [];
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformAllPossiblePciVgaConsole [];
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence [];
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformDriverOption [];
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformBootOption [];
extern EFI_DEVICE_PATH_PROTOCOL *gUserAuthenticationDevice[];
extern BDS_CONSOLE_CONNECT_ENTRY gPlatformSimpleConsole [];
extern EFI_DEVICE_PATH_PROTOCOL *gPlatformSimpleBootOption [];
extern BOOLEAN mEnumBootDevice;
//
// the short form device path for Usb keyboard
//
#define CLASS_HID 3
#define SUBCLASS_BOOT 1
#define PROTOCOL_KEYBOARD 1
#define PCI_DEVICE_PATH_NODE(Func, Dev) \
{ \
HARDWARE_DEVICE_PATH, \
HW_PCI_DP, \
{ \
(UINT8) (sizeof (PCI_DEVICE_PATH)), \
(UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \
}, \
(Func), \
(Dev) \
}
#define PNPID_DEVICE_PATH_NODE(PnpId) \
{ \
{ \
ACPI_DEVICE_PATH, \
ACPI_DP, \
{ \
(UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
(UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
} \
}, \
EISA_PNP_ID((PnpId)), \
0 \
}
#define gUart(BaudRate, DataBits, Parity, StopBits) \
{ \
{ \
MESSAGING_DEVICE_PATH, \
MSG_UART_DP, \
{ \
(UINT8) (sizeof (UART_DEVICE_PATH)), \
(UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \
} \
}, \
0, \
(BaudRate), \
(DataBits), \
(Parity), \
(StopBits) \
}
#define gPcAnsiTerminal \
{ \
{ \
MESSAGING_DEVICE_PATH, \
MSG_VENDOR_DP, \
{ \
(UINT8) (sizeof (VENDOR_DEVICE_PATH)), \
(UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
} \
}, \
DEVICE_PATH_MESSAGING_PC_ANSI \
}
#define gUsbKeyboardMouse \
{ \
{ \
MESSAGING_DEVICE_PATH, \
MSG_USB_CLASS_DP, \
(UINT8) (sizeof (USB_CLASS_DEVICE_PATH)), \
(UINT8) ((sizeof (USB_CLASS_DEVICE_PATH)) >> 8) \
}, \
0xffff, \
0xffff, \
CLASS_HID, \
SUBCLASS_BOOT, \
PROTOCOL_KEYBOARD \
}
#define gEndEntire \
{ \
END_DEVICE_PATH_TYPE, \
END_ENTIRE_DEVICE_PATH_SUBTYPE, \
{ \
END_DEVICE_PATH_LENGTH, \
0 \
} \
}
#define gPciRootBridge \
PNPID_DEVICE_PATH_NODE(0x0A03)
#define gPnpPs2Keyboard \
PNPID_DEVICE_PATH_NODE(0x0303)
#define gPnp16550ComPort \
PNPID_DEVICE_PATH_NODE(0x0501)
#define gPciePort0Bridge \
PCI_DEVICE_PATH_NODE(0, 0x1C)
#define gPciePort1Bridge \
PCI_DEVICE_PATH_NODE(1, 0x1C)
#define gPciePort2Bridge \
PCI_DEVICE_PATH_NODE(2, 0x1C)
#define gPciePort3Bridge \
PCI_DEVICE_PATH_NODE(3, 0x1C)
#define gPciIsaBridge \
PCI_DEVICE_PATH_NODE(0, 0x1f)
//
// Platform Root Bridge
//
typedef struct {
ACPI_HID_DEVICE_PATH PciRootBridge;
EFI_DEVICE_PATH_PROTOCOL End;
} PLATFORM_ROOT_BRIDGE_DEVICE_PATH;
//
// Below is the platform console device path
//
typedef struct {
ACPI_HID_DEVICE_PATH PciRootBridge;
PCI_DEVICE_PATH IsaBridge;
ACPI_HID_DEVICE_PATH Keyboard;
EFI_DEVICE_PATH_PROTOCOL End;
} PLATFORM_ISA_KEYBOARD_DEVICE_PATH;
typedef struct {
VENDOR_DEVICE_PATH VendorDevicePath;
EFI_DEVICE_PATH_PROTOCOL End;
} HII_VENDOR_DEVICE_PATH;
typedef struct {
USB_CLASS_DEVICE_PATH UsbClass;
EFI_DEVICE_PATH_PROTOCOL End;
} USB_CLASS_FORMAT_DEVICE_PATH;
typedef struct {
ACPI_HID_DEVICE_PATH PciRootBridge;
PCI_DEVICE_PATH OnboardVga;
EFI_DEVICE_PATH_PROTOCOL End;
} PLATFORM_ONBOARD_VGA_DEVICE_PATH;
typedef struct {
ACPI_HID_DEVICE_PATH PciRootBridge;
PCI_DEVICE_PATH AgpBridge;
PCI_DEVICE_PATH AgpDevice;
EFI_DEVICE_PATH_PROTOCOL End;
} PLATFORM_OFFBOARD_VGA_DEVICE_PATH;
typedef struct {
ACPI_HID_DEVICE_PATH PciRootBridge;
PCI_DEVICE_PATH IsaBridge;
ACPI_HID_DEVICE_PATH IsaSerial;
UART_DEVICE_PATH Uart;
VENDOR_DEVICE_PATH TerminalType;
EFI_DEVICE_PATH_PROTOCOL End;
} PLATFORM_ISA_SERIAL_DEVICE_PATH;
//
// Below is the boot option device path
//
typedef struct {
BBS_BBS_DEVICE_PATH LegacyHD;
EFI_DEVICE_PATH_PROTOCOL End;
} LEGACY_HD_DEVICE_PATH;
//
// Below is the platform IDE device path
//
typedef struct {
ACPI_HID_DEVICE_PATH PciRootBridge;
PCI_DEVICE_PATH IsaBridge;
ATAPI_DEVICE_PATH Ide;
EFI_DEVICE_PATH_PROTOCOL End;
} PLATFORM_IDE_DEVICE_PATH;
//
// Floppy device path definition
//
typedef struct {
ACPI_HID_DEVICE_PATH PciRootBridge;
PCI_DEVICE_PATH IsaBridge;
ACPI_HID_DEVICE_PATH Floppy;
EFI_DEVICE_PATH_PROTOCOL End;
} PLATFORM_FLOPPY_DEVICE_PATH;
//
// Below is the platform USB controller device path for
// USB disk as user authentication device.
//
typedef struct {
ACPI_HID_DEVICE_PATH PciRootBridge;
PCI_DEVICE_PATH PciDevice;
EFI_DEVICE_PATH_PROTOCOL End;
} PLATFORM_USB_DEVICE_PATH;
//
// Debug Agent UART Console device path definition
//
typedef struct {
VENDOR_DEVICE_PATH VendorHardware;
UART_DEVICE_PATH Uart;
VENDOR_DEVICE_PATH TerminalType;
EFI_DEVICE_PATH_PROTOCOL End;
} VENDOR_UART_DEVICE_PATH;
//
// Below is the platform PCI device path
//
typedef struct {
ACPI_HID_DEVICE_PATH PciRootBridge;
PCI_DEVICE_PATH PciDevice;
EFI_DEVICE_PATH_PROTOCOL End;
} PLATFORM_PCI_DEVICE_PATH;
typedef enum {
PMIC_Equal = 0, // = 0
PMIC_Greater_Than, // > 1
PMIC_Smaller_Than, // < 2
PMIC_Greater_Equal, // >= 3
PMIC_Smaller_Equal, // <= 4
PMIC_Any // don't care 5
} PMIC_Condition_list;
typedef enum {
PMIC_White_List = 0, //White list
PMIC_Black_List = 1 //Black list
} PMIC_Compliance_mode;
typedef struct {
UINT8 Cond_Choice; // PMIC_Condition_list
UINT8 Cond_Number; // the number
}PMIC_Condition_Item;
typedef struct {
PMIC_Condition_Item PMIC_BoardID;
PMIC_Condition_Item PMIC_FabID;
PMIC_Condition_Item Soc_Stepping;//define PMIC type, 1:Dialog , 2:Rohm
PMIC_Condition_Item PMIC_VendID;
PMIC_Condition_Item PMIC_RevID;
PMIC_Compliance_mode mode; //if 1, blacklist; if 0, white list.
} PMIC_Compliance_Item;
//
// Platform BDS Functions
//
VOID
PlatformBdsGetDriverOption (
IN LIST_ENTRY *BdsDriverLists
);
VOID
PlatformBdsPredictBootOption (
IN LIST_ENTRY *BdsBootOptionList
);
EFI_STATUS
PlatformBdsShowProgress (
EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,
EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,
CHAR16 *Title,
EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,
UINTN Progress,
UINTN PreviousValue
);
VOID
PlatformBdsConnectSequence (
VOID
);
EFI_STATUS
PlatformBdsConnectConsole (
IN BDS_CONSOLE_CONNECT_ENTRY *PlatformConsole
);
EFI_STATUS
PlatformBdsNoConsoleAction (
VOID
);
VOID
PlatformBdsEnterFrontPage (
IN UINT16 TimeoutDefault,
IN BOOLEAN ConnectAllHappened
);
VOID
EFIAPI
PlatformBdsUserIdentify (
OUT EFI_USER_PROFILE_HANDLE *User,
OUT BOOLEAN *DeferredImage
);
VOID
EFIAPI
PlatformBdsConnectAuthDevice (
VOID
);
VOID
PlatformBdsEnterFrontPageWithHotKey (
IN UINT16 TimeoutDefault,
IN BOOLEAN ConnectAllHappened
);
EFI_STATUS
ShowProgress (
IN UINT16 TimeoutDefault
);
EFI_STATUS
InitializeFrontPage (
IN BOOLEAN InitializeHiiData
);
VOID
UpdateFrontPageStrings (
VOID
);
EFI_STATUS
InitBMPackage (
VOID
);
VOID
FreeBMPackage (
VOID
);
EFI_STATUS
CallFrontPage (
VOID
);
VOID
CallBootManager (
VOID
);
VOID
CallDeviceManager (
VOID
);
VOID
BdsStartBootMaint (
VOID
);
CHAR16 *
GetStringById (
IN EFI_STRING_ID Id
);
EFI_STATUS
WaitForSingleEvent (
IN EFI_EVENT Event,
IN UINT64 Timeout OPTIONAL
);
EFI_STATUS
BdsLibDeleteOptionFromHandle (
IN EFI_HANDLE Handle
);
EFI_STATUS
BdsDeleteAllInvalidEfiBootOption (
VOID
);
#define ONE_SECOND 10000000
#define FRONT_PAGE_KEY_CONTINUE 0x1000
#define FRONT_PAGE_KEY_LANGUAGE 0x1234
#define FRONT_PAGE_KEY_BOOT_MANAGER 0x1064
#define FRONT_PAGE_KEY_DEVICE_MANAGER 0x8567
#define FRONT_PAGE_KEY_BOOT_MAINTAIN 0x9876
#define PORT_A_DVO 0 // ; DVO A
#define PORT_B_DVO 1 // ; DVO B
#define PORT_C_DVO 2 // ; DVO C
#define PORT_D_DVO 3 // ; DVO D
#define PORT_LVDS 4 // ; Integrated LVDS port
#define PORT_ANALOG_TV 5 // ; Integrated TV port
#define PORT_CRT 6 // ; integrated Analog port
#define PORT_B_DP 7 // ; DisplayPort B
#define PORT_C_DP 8 // ; DisplayPort C
#define PORT_D_DP 9 // ; DisplayPort D
#define PORT_A_DP 10 // ; DisplayPort A (for eDP on ILK)
#define PORT_B_HDMI 11 // ; HDMI B
#define PORT_C_HDMI 12 // ; HDMI C
#define PORT_D_HDMI 13 // ; HDMI D
#define PORT_B_DVI 14 // ; DVI B
#define PORT_C_DVI 15 // ; DVI C
#define PORT_D_DVI 16 // ; DVI D
#define PORT_MIPI_A 21 // ; MIPI
#define PORT_MIPI_B 22
#define PORT_MIPI_C 23
extern BOOLEAN gConnectAllHappened;
extern UINTN gCallbackKey;
VOID
BdsBootDeviceSelect (
VOID
);
VOID FastBoot(VOID);
extern BOOLEAN mModeInitialized;
//
// Boot video resolution and text mode.
//
extern UINT32 mBootHorizontalResolution ;
extern UINT32 mBootVerticalResolution ;
extern UINT32 mBootTextModeColumn ;
extern UINT32 mBootTextModeRow ;
//
// BIOS setup video resolution and text mode.
//
extern UINT32 mSetupTextModeColumn ;
extern UINT32 mSetupTextModeRow ;
extern UINT32 mSetupHorizontalResolution ;
extern UINT32 mSetupVerticalResolution ;
extern EFI_STATUS BdsSetConsoleMode (BOOLEAN);
#endif // _BDS_PLATFORM_H
|