2 Platform BDS customizations include file.
4 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
13 Head file for BDS Platform specific code
17 #ifndef _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
18 #define _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
22 #include <IndustryStandard/Pci.h>
23 #include <IndustryStandard/Acpi.h>
24 #include <IndustryStandard/SmBios.h>
25 #include <IndustryStandard/PeImage.h>
26 #include <IndustryStandard/Virtio095.h>
28 #include <Library/DebugLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31 #include <Library/UefiRuntimeServicesTableLib.h>
32 #include <Library/MemoryAllocationLib.h>
33 #include <Library/BaseLib.h>
34 #include <Library/PcdLib.h>
35 #include <Library/PciLib.h>
36 #include <Library/UefiBootManagerLib.h>
37 #include <Library/BootLogoLib.h>
38 #include <Library/HobLib.h>
39 #include <Library/UefiLib.h>
40 #include <Library/DxeServicesTableLib.h>
41 #include <Library/DevicePathLib.h>
42 #include <Library/IoLib.h>
43 #include <Library/NvVarsFileLib.h>
44 #include <Library/QemuFwCfgLib.h>
45 #include <Library/QemuFwCfgS3Lib.h>
46 #include <Library/QemuBootOrderLib.h>
48 #include <Protocol/Decompress.h>
49 #include <Protocol/PciIo.h>
50 #include <Protocol/FirmwareVolume2.h>
51 #include <Protocol/SimpleFileSystem.h>
52 #include <Protocol/PciRootBridgeIo.h>
53 #include <Protocol/S3SaveState.h>
54 #include <Protocol/DxeSmmReadyToLock.h>
55 #include <Protocol/LoadedImage.h>
57 #include <Guid/Acpi.h>
58 #include <Guid/SmBios.h>
59 #include <Guid/HobList.h>
60 #include <Guid/GlobalVariable.h>
61 #include <Guid/EventGroup.h>
62 #include <Guid/DebugAgentGuid.h>
64 #include <OvmfPlatforms.h>
66 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformConnectSequence
[];
67 extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode
;
68 extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode
;
69 extern UART_DEVICE_PATH gUartDeviceNode
;
70 extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode
;
72 #define PCI_DEVICE_PATH_NODE(Func, Dev) \
75 HARDWARE_DEVICE_PATH, \
78 (UINT8) (sizeof (PCI_DEVICE_PATH)), \
79 (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \
86 #define PNPID_DEVICE_PATH_NODE(PnpId) \
92 (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
93 (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
96 EISA_PNP_ID((PnpId)), \
100 #define gPciIsaBridge \
101 PCI_DEVICE_PATH_NODE(0, 0x1f)
104 PCI_DEVICE_PATH_NODE(0, 0x1e)
106 #define gPnpPs2Keyboard \
107 PNPID_DEVICE_PATH_NODE(0x0303)
109 #define gPnp16550ComPort \
110 PNPID_DEVICE_PATH_NODE(0x0501)
115 MESSAGING_DEVICE_PATH, \
118 (UINT8) (sizeof (UART_DEVICE_PATH)), \
119 (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \
129 #define gPcAnsiTerminal \
132 MESSAGING_DEVICE_PATH, \
135 (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \
136 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
139 DEVICE_PATH_MESSAGING_PC_ANSI \
144 END_DEVICE_PATH_TYPE, \
145 END_ENTIRE_DEVICE_PATH_SUBTYPE, \
147 END_DEVICE_PATH_LENGTH, \
152 #define PCI_CLASS_SCC 0x07
153 #define PCI_SUBCLASS_SERIAL 0x00
154 #define PCI_IF_16550 0x02
155 #define IS_PCI_16550SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
156 #define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
159 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
161 } PLATFORM_CONSOLE_CONNECT_ENTRY
;
163 #define CONSOLE_OUT BIT0
164 #define CONSOLE_IN BIT1
165 #define STD_ERROR BIT2
166 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole
[];
167 extern PLATFORM_CONSOLE_CONNECT_ENTRY gXenPlatformConsole
[];
170 // Platform BDS Functions
174 PlatformInitializeConsole (
175 IN PLATFORM_CONSOLE_CONNECT_ENTRY
*PlatformConsole
179 Loads and boots UEFI Linux via the FwCfg interface.
181 @retval EFI_NOT_FOUND - The Linux kernel was not found
185 TryRunningQemuKernel (
189 #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_