3 Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
21 Head file for BDS Platform specific code
25 #ifndef _BDS_PLATFORM_H
26 #define _BDS_PLATFORM_H
28 #include <FrameworkDxe.h>
30 #include <Protocol/FirmwareVolume2.h>
31 #include <Protocol/DevicePath.h>
32 #include <Protocol/SimpleNetwork.h>
33 #include <Protocol/PciRootBridgeIo.h>
34 #include <Protocol/LoadFile.h>
35 #include <Protocol/LegacyBios.h>
36 #include <Protocol/PciIo.h>
37 #include <Protocol/SmmAccess2.h>
38 #include <Protocol/DxeSmmReadyToLock.h>
39 #include <Protocol/UserManager.h>
40 #include <Protocol/DeferredImageLoad.h>
41 #include <Protocol/AcpiS3Save.h>
42 #include <Protocol/ExitPmAuth.h>
43 #include <Protocol/MmioDevice.h>
44 #include <Protocol/I2cBusMcg.h>
45 #include <Protocol/I2cHostMcg.h>
46 #include <Guid/CapsuleVendor.h>
47 #include <Guid/MemoryTypeInformation.h>
48 #include <Guid/GlobalVariable.h>
49 #include <Guid/DebugAgentGuid.h>
52 #include <Library/DebugLib.h>
53 #include <Library/BaseMemoryLib.h>
54 #include <Library/UefiBootServicesTableLib.h>
55 #include <Library/UefiRuntimeServicesTableLib.h>
56 #include <Library/MemoryAllocationLib.h>
57 #include <Library/BaseLib.h>
58 #include <Library/PcdLib.h>
59 #include <Library/IoLib.h>
60 #include <Library/GenericBdsLib.h>
61 #include <Library/PlatformBdsLib.h>
62 #include <Library/DevicePathLib.h>
63 #include <Library/UefiLib.h>
64 #include <Library/HobLib.h>
65 #include <Library/PrintLib.h>
66 #include <Library/PerformanceLib.h>
67 #include <Library/ReportStatusCodeLib.h>
69 #include <IndustryStandard/Pci.h>
71 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformRootBridges
[];
72 extern BDS_CONSOLE_CONNECT_ENTRY gPlatformConsole
[];
73 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformAllPossiblePciVgaConsole
[];
74 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformConnectSequence
[];
75 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformDriverOption
[];
76 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformBootOption
[];
77 extern EFI_DEVICE_PATH_PROTOCOL
*gUserAuthenticationDevice
[];
78 extern BDS_CONSOLE_CONNECT_ENTRY gPlatformSimpleConsole
[];
79 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformSimpleBootOption
[];
81 extern BOOLEAN mEnumBootDevice
;
85 // the short form device path for Usb keyboard
88 #define SUBCLASS_BOOT 1
89 #define PROTOCOL_KEYBOARD 1
91 #define PCI_DEVICE_PATH_NODE(Func, Dev) \
93 HARDWARE_DEVICE_PATH, \
96 (UINT8) (sizeof (PCI_DEVICE_PATH)), \
97 (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \
103 #define PNPID_DEVICE_PATH_NODE(PnpId) \
109 (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
110 (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
113 EISA_PNP_ID((PnpId)), \
117 #define gUart(BaudRate, DataBits, Parity, StopBits) \
120 MESSAGING_DEVICE_PATH, \
123 (UINT8) (sizeof (UART_DEVICE_PATH)), \
124 (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \
134 #define gPcAnsiTerminal \
137 MESSAGING_DEVICE_PATH, \
140 (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \
141 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
144 DEVICE_PATH_MESSAGING_PC_ANSI \
147 #define gUsbKeyboardMouse \
150 MESSAGING_DEVICE_PATH, \
152 (UINT8) (sizeof (USB_CLASS_DEVICE_PATH)), \
153 (UINT8) ((sizeof (USB_CLASS_DEVICE_PATH)) >> 8) \
164 END_DEVICE_PATH_TYPE, \
165 END_ENTIRE_DEVICE_PATH_SUBTYPE, \
167 END_DEVICE_PATH_LENGTH, \
172 #define gPciRootBridge \
173 PNPID_DEVICE_PATH_NODE(0x0A03)
175 #define gPnpPs2Keyboard \
176 PNPID_DEVICE_PATH_NODE(0x0303)
178 #define gPnp16550ComPort \
179 PNPID_DEVICE_PATH_NODE(0x0501)
181 #define gPciePort0Bridge \
182 PCI_DEVICE_PATH_NODE(0, 0x1C)
184 #define gPciePort1Bridge \
185 PCI_DEVICE_PATH_NODE(1, 0x1C)
187 #define gPciePort2Bridge \
188 PCI_DEVICE_PATH_NODE(2, 0x1C)
190 #define gPciePort3Bridge \
191 PCI_DEVICE_PATH_NODE(3, 0x1C)
193 #define gPciIsaBridge \
194 PCI_DEVICE_PATH_NODE(0, 0x1f)
197 // Platform Root Bridge
200 ACPI_HID_DEVICE_PATH PciRootBridge
;
201 EFI_DEVICE_PATH_PROTOCOL End
;
202 } PLATFORM_ROOT_BRIDGE_DEVICE_PATH
;
205 // Below is the platform console device path
208 ACPI_HID_DEVICE_PATH PciRootBridge
;
209 PCI_DEVICE_PATH IsaBridge
;
210 ACPI_HID_DEVICE_PATH Keyboard
;
211 EFI_DEVICE_PATH_PROTOCOL End
;
212 } PLATFORM_ISA_KEYBOARD_DEVICE_PATH
;
215 VENDOR_DEVICE_PATH VendorDevicePath
;
216 EFI_DEVICE_PATH_PROTOCOL End
;
217 } HII_VENDOR_DEVICE_PATH
;
220 USB_CLASS_DEVICE_PATH UsbClass
;
221 EFI_DEVICE_PATH_PROTOCOL End
;
222 } USB_CLASS_FORMAT_DEVICE_PATH
;
225 ACPI_HID_DEVICE_PATH PciRootBridge
;
226 PCI_DEVICE_PATH OnboardVga
;
227 EFI_DEVICE_PATH_PROTOCOL End
;
228 } PLATFORM_ONBOARD_VGA_DEVICE_PATH
;
231 ACPI_HID_DEVICE_PATH PciRootBridge
;
232 PCI_DEVICE_PATH AgpBridge
;
233 PCI_DEVICE_PATH AgpDevice
;
234 EFI_DEVICE_PATH_PROTOCOL End
;
235 } PLATFORM_OFFBOARD_VGA_DEVICE_PATH
;
238 ACPI_HID_DEVICE_PATH PciRootBridge
;
239 PCI_DEVICE_PATH IsaBridge
;
240 ACPI_HID_DEVICE_PATH IsaSerial
;
241 UART_DEVICE_PATH Uart
;
242 VENDOR_DEVICE_PATH TerminalType
;
243 EFI_DEVICE_PATH_PROTOCOL End
;
244 } PLATFORM_ISA_SERIAL_DEVICE_PATH
;
247 // Below is the boot option device path
250 BBS_BBS_DEVICE_PATH LegacyHD
;
251 EFI_DEVICE_PATH_PROTOCOL End
;
252 } LEGACY_HD_DEVICE_PATH
;
255 // Below is the platform IDE device path
258 ACPI_HID_DEVICE_PATH PciRootBridge
;
259 PCI_DEVICE_PATH IsaBridge
;
260 ATAPI_DEVICE_PATH Ide
;
261 EFI_DEVICE_PATH_PROTOCOL End
;
262 } PLATFORM_IDE_DEVICE_PATH
;
265 // Floppy device path definition
268 ACPI_HID_DEVICE_PATH PciRootBridge
;
269 PCI_DEVICE_PATH IsaBridge
;
270 ACPI_HID_DEVICE_PATH Floppy
;
271 EFI_DEVICE_PATH_PROTOCOL End
;
272 } PLATFORM_FLOPPY_DEVICE_PATH
;
275 // Below is the platform USB controller device path for
276 // USB disk as user authentication device.
279 ACPI_HID_DEVICE_PATH PciRootBridge
;
280 PCI_DEVICE_PATH PciDevice
;
281 EFI_DEVICE_PATH_PROTOCOL End
;
282 } PLATFORM_USB_DEVICE_PATH
;
285 // Debug Agent UART Console device path definition
288 VENDOR_DEVICE_PATH VendorHardware
;
289 UART_DEVICE_PATH Uart
;
290 VENDOR_DEVICE_PATH TerminalType
;
291 EFI_DEVICE_PATH_PROTOCOL End
;
292 } VENDOR_UART_DEVICE_PATH
;
295 // Below is the platform PCI device path
298 ACPI_HID_DEVICE_PATH PciRootBridge
;
299 PCI_DEVICE_PATH PciDevice
;
300 EFI_DEVICE_PATH_PROTOCOL End
;
301 } PLATFORM_PCI_DEVICE_PATH
;
304 PMIC_Equal
= 0, // = 0
305 PMIC_Greater_Than
, // > 1
306 PMIC_Smaller_Than
, // < 2
307 PMIC_Greater_Equal
, // >= 3
308 PMIC_Smaller_Equal
, // <= 4
309 PMIC_Any
// don't care 5
310 } PMIC_Condition_list
;
313 PMIC_White_List
= 0, //White list
314 PMIC_Black_List
= 1 //Black list
315 } PMIC_Compliance_mode
;
318 UINT8 Cond_Choice
; // PMIC_Condition_list
319 UINT8 Cond_Number
; // the number
320 }PMIC_Condition_Item
;
323 PMIC_Condition_Item PMIC_BoardID
;
324 PMIC_Condition_Item PMIC_FabID
;
325 PMIC_Condition_Item Soc_Stepping
;//define PMIC type, 1:Dialog , 2:Rohm
326 PMIC_Condition_Item PMIC_VendID
;
327 PMIC_Condition_Item PMIC_RevID
;
328 PMIC_Compliance_mode mode
; //if 1, blacklist; if 0, white list.
329 } PMIC_Compliance_Item
;
332 // Platform BDS Functions
335 PlatformBdsGetDriverOption (
336 IN LIST_ENTRY
*BdsDriverLists
340 PlatformBdsPredictBootOption (
341 IN LIST_ENTRY
*BdsBootOptionList
345 PlatformBdsShowProgress (
346 EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground
,
347 EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground
,
349 EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor
,
355 PlatformBdsConnectSequence (
360 PlatformBdsConnectConsole (
361 IN BDS_CONSOLE_CONNECT_ENTRY
*PlatformConsole
365 PlatformBdsNoConsoleAction (
370 PlatformBdsEnterFrontPage (
371 IN UINT16 TimeoutDefault
,
372 IN BOOLEAN ConnectAllHappened
377 PlatformBdsUserIdentify (
378 OUT EFI_USER_PROFILE_HANDLE
*User
,
379 OUT BOOLEAN
*DeferredImage
384 PlatformBdsConnectAuthDevice (
389 PlatformBdsEnterFrontPageWithHotKey (
390 IN UINT16 TimeoutDefault
,
391 IN BOOLEAN ConnectAllHappened
396 IN UINT16 TimeoutDefault
400 InitializeFrontPage (
401 IN BOOLEAN InitializeHiiData
405 UpdateFrontPageStrings (
451 IN UINT64 Timeout OPTIONAL
455 BdsLibDeleteOptionFromHandle (
460 BdsDeleteAllInvalidEfiBootOption (
465 #define ONE_SECOND 10000000
466 #define FRONT_PAGE_KEY_CONTINUE 0x1000
467 #define FRONT_PAGE_KEY_LANGUAGE 0x1234
468 #define FRONT_PAGE_KEY_BOOT_MANAGER 0x1064
469 #define FRONT_PAGE_KEY_DEVICE_MANAGER 0x8567
470 #define FRONT_PAGE_KEY_BOOT_MAINTAIN 0x9876
472 #define PORT_A_DVO 0 // ; DVO A
473 #define PORT_B_DVO 1 // ; DVO B
474 #define PORT_C_DVO 2 // ; DVO C
475 #define PORT_D_DVO 3 // ; DVO D
476 #define PORT_LVDS 4 // ; Integrated LVDS port
477 #define PORT_ANALOG_TV 5 // ; Integrated TV port
478 #define PORT_CRT 6 // ; integrated Analog port
479 #define PORT_B_DP 7 // ; DisplayPort B
480 #define PORT_C_DP 8 // ; DisplayPort C
481 #define PORT_D_DP 9 // ; DisplayPort D
482 #define PORT_A_DP 10 // ; DisplayPort A (for eDP on ILK)
483 #define PORT_B_HDMI 11 // ; HDMI B
484 #define PORT_C_HDMI 12 // ; HDMI C
485 #define PORT_D_HDMI 13 // ; HDMI D
486 #define PORT_B_DVI 14 // ; DVI B
487 #define PORT_C_DVI 15 // ; DVI C
488 #define PORT_D_DVI 16 // ; DVI D
489 #define PORT_MIPI_A 21 // ; MIPI
490 #define PORT_MIPI_B 22
491 #define PORT_MIPI_C 23
494 extern BOOLEAN gConnectAllHappened
;
495 extern UINTN gCallbackKey
;
498 BdsBootDeviceSelect (
503 extern BOOLEAN mModeInitialized
;
506 // Boot video resolution and text mode.
508 extern UINT32 mBootHorizontalResolution
;
509 extern UINT32 mBootVerticalResolution
;
510 extern UINT32 mBootTextModeColumn
;
511 extern UINT32 mBootTextModeRow
;
514 // BIOS setup video resolution and text mode.
516 extern UINT32 mSetupTextModeColumn
;
517 extern UINT32 mSetupTextModeRow
;
518 extern UINT32 mSetupHorizontalResolution
;
519 extern UINT32 mSetupVerticalResolution
;
520 extern EFI_STATUS
BdsSetConsoleMode (BOOLEAN
);
521 #endif // _BDS_PLATFORM_H