2 Platform BDS customizations include file.
4 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. 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.
19 Head file for BDS Platform specific code
23 #ifndef _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
24 #define _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
29 #include <IndustryStandard/Pci.h>
30 #include <IndustryStandard/Acpi.h>
31 #include <IndustryStandard/SmBios.h>
32 #include <IndustryStandard/PeImage.h>
34 #include <Library/DebugLib.h>
35 #include <Library/BaseMemoryLib.h>
36 #include <Library/UefiBootServicesTableLib.h>
37 #include <Library/UefiRuntimeServicesTableLib.h>
38 #include <Library/MemoryAllocationLib.h>
39 #include <Library/BaseLib.h>
40 #include <Library/PcdLib.h>
41 #include <Library/PciLib.h>
42 #include <Library/UefiBootManagerLib.h>
43 #include <Library/HobLib.h>
44 #include <Library/UefiLib.h>
45 #include <Library/DxeServicesTableLib.h>
46 #include <Library/DevicePathLib.h>
47 #include <Library/IoLib.h>
48 #include <Library/NvVarsFileLib.h>
49 #include <Library/QemuFwCfgLib.h>
51 #include <Protocol/Decompress.h>
52 #include <Protocol/PciIo.h>
53 #include <Protocol/FirmwareVolume2.h>
54 #include <Protocol/SimpleFileSystem.h>
55 #include <Protocol/PciRootBridgeIo.h>
56 #include <Protocol/S3SaveState.h>
57 #include <Protocol/DxeSmmReadyToLock.h>
58 #include <Protocol/LoadedImage.h>
60 #include <Guid/Acpi.h>
61 #include <Guid/SmBios.h>
63 #include <Guid/HobList.h>
64 #include <Guid/GlobalVariable.h>
65 #include <Guid/EventGroup.h>
67 #include <OvmfPlatforms.h>
69 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformConnectSequence
[];
70 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformDriverOption
[];
71 extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode
;
72 extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode
;
73 extern UART_DEVICE_PATH gUartDeviceNode
;
74 extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode
;
76 #define PCI_DEVICE_PATH_NODE(Func, Dev) \
79 HARDWARE_DEVICE_PATH, \
82 (UINT8) (sizeof (PCI_DEVICE_PATH)), \
83 (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \
90 #define PNPID_DEVICE_PATH_NODE(PnpId) \
96 (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
97 (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
100 EISA_PNP_ID((PnpId)), \
104 #define gPciIsaBridge \
105 PCI_DEVICE_PATH_NODE(0, 0x1f)
108 PCI_DEVICE_PATH_NODE(0, 0x1e)
110 #define gPnpPs2Keyboard \
111 PNPID_DEVICE_PATH_NODE(0x0303)
113 #define gPnp16550ComPort \
114 PNPID_DEVICE_PATH_NODE(0x0501)
119 MESSAGING_DEVICE_PATH, \
122 (UINT8) (sizeof (UART_DEVICE_PATH)), \
123 (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \
133 #define gPcAnsiTerminal \
136 MESSAGING_DEVICE_PATH, \
139 (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \
140 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
143 DEVICE_PATH_MESSAGING_PC_ANSI \
146 #define PCI_CLASS_SCC 0x07
147 #define PCI_SUBCLASS_SERIAL 0x00
148 #define PCI_IF_16550 0x02
149 #define IS_PCI_16550SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
151 #define EFI_SYSTEM_TABLE_MAX_ADDRESS 0xFFFFFFFF
152 #define SYS_TABLE_PAD(ptr) (((~ptr) +1) & 0x07 )
154 #define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
157 ACPI_HID_DEVICE_PATH PciRootBridge
;
158 PCI_DEVICE_PATH IsaBridge
;
159 ACPI_HID_DEVICE_PATH Keyboard
;
160 EFI_DEVICE_PATH_PROTOCOL End
;
161 } PLATFORM_DUMMY_ISA_KEYBOARD_DEVICE_PATH
;
164 ACPI_HID_DEVICE_PATH PciRootBridge
;
165 PCI_DEVICE_PATH IsaBridge
;
166 ACPI_HID_DEVICE_PATH IsaSerial
;
167 UART_DEVICE_PATH Uart
;
168 VENDOR_DEVICE_PATH TerminalType
;
169 EFI_DEVICE_PATH_PROTOCOL End
;
170 } PLATFORM_DUMMY_ISA_SERIAL_DEVICE_PATH
;
173 ACPI_HID_DEVICE_PATH PciRootBridge
;
174 PCI_DEVICE_PATH VgaDevice
;
175 EFI_DEVICE_PATH_PROTOCOL End
;
176 } PLATFORM_DUMMY_PCI_VGA_DEVICE_PATH
;
179 ACPI_HID_DEVICE_PATH PciRootBridge
;
180 PCI_DEVICE_PATH PciBridge
;
181 PCI_DEVICE_PATH SerialDevice
;
182 UART_DEVICE_PATH Uart
;
183 VENDOR_DEVICE_PATH TerminalType
;
184 EFI_DEVICE_PATH_PROTOCOL End
;
185 } PLATFORM_DUMMY_PCI_SERIAL_DEVICE_PATH
;
188 // the short form device path for Usb keyboard
191 #define SUBCLASS_BOOT 1
192 #define PROTOCOL_KEYBOARD 1
195 USB_CLASS_DEVICE_PATH UsbClass
;
196 EFI_DEVICE_PATH_PROTOCOL End
;
197 } USB_CLASS_FORMAT_DEVICE_PATH
;
200 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
202 } PLATFORM_CONSOLE_CONNECT_ENTRY
;
204 #define CONSOLE_OUT BIT0
205 #define CONSOLE_IN BIT1
206 #define STD_ERROR BIT2
207 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole
[];
210 // Platform BDS Functions
214 PlatformBdsGetDriverOption (
215 IN LIST_ENTRY
*BdsDriverLists
220 EXTENDMEM_COVERAGE_LEVEL Level
224 PlatformBdsShowProgress (
225 EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground
,
226 EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground
,
228 EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor
,
234 PlatformBdsConnectSequence (
240 EFI_BOOT_MODE BootMode
244 PlatformInitializeConsole (
245 IN PLATFORM_CONSOLE_CONNECT_ENTRY
*PlatformConsole
266 IN EFI_GUID
*TableGuid
,
271 Loads and boots UEFI Linux via the FwCfg interface.
273 @retval EFI_NOT_FOUND - The Linux kernel was not found
277 TryRunningQemuKernel (
281 #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_