2 Platform BDS customizations include file.
4 Copyright (c) 2020, Rebecca Cran <rebecca@bsdio.com>
5 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
14 Head file for BDS Platform specific code
18 #ifndef _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
19 #define _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
23 #include <IndustryStandard/Pci.h>
24 #include <IndustryStandard/Acpi.h>
25 #include <IndustryStandard/SmBios.h>
26 #include <IndustryStandard/PeImage.h>
27 #include <IndustryStandard/Virtio095.h>
29 #include <Library/DebugLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/UefiRuntimeServicesTableLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/BaseLib.h>
35 #include <Library/PcdLib.h>
36 #include <Library/PciLib.h>
37 #include <Library/UefiBootManagerLib.h>
38 #include <Library/BootLogoLib.h>
39 #include <Library/HobLib.h>
40 #include <Library/UefiLib.h>
41 #include <Library/DxeServicesTableLib.h>
42 #include <Library/DevicePathLib.h>
43 #include <Library/IoLib.h>
44 #include <Library/NvVarsFileLib.h>
45 #include <Library/QemuFwCfgLib.h>
46 #include <Library/QemuFwCfgS3Lib.h>
47 #include <Library/QemuBootOrderLib.h>
49 #include <Protocol/Decompress.h>
50 #include <Protocol/PciIo.h>
51 #include <Protocol/FirmwareVolume2.h>
52 #include <Protocol/SimpleFileSystem.h>
53 #include <Protocol/PciRootBridgeIo.h>
54 #include <Protocol/S3SaveState.h>
55 #include <Protocol/DxeSmmReadyToLock.h>
56 #include <Protocol/LoadedImage.h>
58 #include <Guid/Acpi.h>
59 #include <Guid/SmBios.h>
60 #include <Guid/HobList.h>
61 #include <Guid/GlobalVariable.h>
62 #include <Guid/EventGroup.h>
63 #include <Guid/DebugAgentGuid.h>
65 #include <OvmfPlatforms.h>
67 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformConnectSequence
[];
68 extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode
;
69 extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode
;
70 extern UART_DEVICE_PATH gUartDeviceNode
;
71 extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode
;
73 #define PCI_DEVICE_PATH_NODE(Func, Dev) \
76 HARDWARE_DEVICE_PATH, \
79 (UINT8) (sizeof (PCI_DEVICE_PATH)), \
80 (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \
87 #define PNPID_DEVICE_PATH_NODE(PnpId) \
93 (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
94 (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
97 EISA_PNP_ID((PnpId)), \
101 #define gPciIsaBridge \
102 PCI_DEVICE_PATH_NODE(0, 0x1f)
105 PCI_DEVICE_PATH_NODE(0, 0x1e)
107 #define gPnpPs2Keyboard \
108 PNPID_DEVICE_PATH_NODE(0x0303)
110 #define gPnp16550ComPort \
111 PNPID_DEVICE_PATH_NODE(0x0501)
116 MESSAGING_DEVICE_PATH, \
119 (UINT8) (sizeof (UART_DEVICE_PATH)), \
120 (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \
130 #define gPcAnsiTerminal \
133 MESSAGING_DEVICE_PATH, \
136 (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \
137 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
140 DEVICE_PATH_MESSAGING_PC_ANSI \
145 END_DEVICE_PATH_TYPE, \
146 END_ENTIRE_DEVICE_PATH_SUBTYPE, \
148 END_DEVICE_PATH_LENGTH, \
153 #define PCI_CLASS_SCC 0x07
154 #define PCI_SUBCLASS_SERIAL 0x00
155 #define PCI_IF_16550 0x02
156 #define IS_PCI_16550SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
157 #define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
160 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
162 } PLATFORM_CONSOLE_CONNECT_ENTRY
;
164 #define CONSOLE_OUT BIT0
165 #define CONSOLE_IN BIT1
166 #define STD_ERROR BIT2
167 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole
[];
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_