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_
24 #include <IndustryStandard/Pci.h>
25 #include <IndustryStandard/Acpi.h>
26 #include <IndustryStandard/SmBios.h>
27 #include <IndustryStandard/PeImage.h>
28 #include <IndustryStandard/Virtio095.h>
30 #include <Library/DebugLib.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/UefiBootServicesTableLib.h>
33 #include <Library/UefiRuntimeServicesTableLib.h>
34 #include <Library/MemoryAllocationLib.h>
35 #include <Library/BaseLib.h>
36 #include <Library/PcdLib.h>
37 #include <Library/PciLib.h>
38 #include <Library/UefiBootManagerLib.h>
39 #include <Library/BootLogoLib.h>
40 #include <Library/HobLib.h>
41 #include <Library/UefiLib.h>
42 #include <Library/DxeServicesTableLib.h>
43 #include <Library/DevicePathLib.h>
44 #include <Library/IoLib.h>
45 #include <Library/NvVarsFileLib.h>
46 #include <Library/QemuFwCfgLib.h>
47 #include <Library/QemuFwCfgS3Lib.h>
48 #include <Library/QemuBootOrderLib.h>
50 #include <Protocol/Decompress.h>
51 #include <Protocol/PciIo.h>
52 #include <Protocol/FirmwareVolume2.h>
53 #include <Protocol/SimpleFileSystem.h>
54 #include <Protocol/PciRootBridgeIo.h>
55 #include <Protocol/S3SaveState.h>
56 #include <Protocol/DxeSmmReadyToLock.h>
57 #include <Protocol/LoadedImage.h>
59 #include <Guid/Acpi.h>
60 #include <Guid/SmBios.h>
61 #include <Guid/HobList.h>
62 #include <Guid/GlobalVariable.h>
63 #include <Guid/EventGroup.h>
64 #include <Guid/DebugAgentGuid.h>
66 #include <OvmfPlatforms.h>
68 extern EFI_DEVICE_PATH_PROTOCOL
*gPlatformConnectSequence
[];
69 extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode
;
70 extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode
;
71 extern UART_DEVICE_PATH gUartDeviceNode
;
72 extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode
;
74 #define PCI_DEVICE_PATH_NODE(Func, Dev) \
77 HARDWARE_DEVICE_PATH, \
80 (UINT8) (sizeof (PCI_DEVICE_PATH)), \
81 (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \
88 #define PNPID_DEVICE_PATH_NODE(PnpId) \
94 (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
95 (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
98 EISA_PNP_ID((PnpId)), \
102 #define gPciIsaBridge \
103 PCI_DEVICE_PATH_NODE(0, 0x1f)
106 PCI_DEVICE_PATH_NODE(0, 0x1e)
108 #define gPnpPs2Keyboard \
109 PNPID_DEVICE_PATH_NODE(0x0303)
111 #define gPnp16550ComPort \
112 PNPID_DEVICE_PATH_NODE(0x0501)
117 MESSAGING_DEVICE_PATH, \
120 (UINT8) (sizeof (UART_DEVICE_PATH)), \
121 (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \
131 #define gPcAnsiTerminal \
134 MESSAGING_DEVICE_PATH, \
137 (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \
138 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
141 DEVICE_PATH_MESSAGING_PC_ANSI \
146 END_DEVICE_PATH_TYPE, \
147 END_ENTIRE_DEVICE_PATH_SUBTYPE, \
149 END_DEVICE_PATH_LENGTH, \
154 #define PCI_CLASS_SCC 0x07
155 #define PCI_SUBCLASS_SERIAL 0x00
156 #define PCI_IF_16550 0x02
157 #define IS_PCI_16550SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
158 #define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
161 EFI_DEVICE_PATH_PROTOCOL
*DevicePath
;
163 } PLATFORM_CONSOLE_CONNECT_ENTRY
;
165 #define CONSOLE_OUT BIT0
166 #define CONSOLE_IN BIT1
167 #define STD_ERROR BIT2
168 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole
[];
171 // Platform BDS Functions
175 PlatformInitializeConsole (
176 IN PLATFORM_CONSOLE_CONNECT_ENTRY
*PlatformConsole
180 Loads and boots UEFI Linux via the FwCfg interface.
182 @retval EFI_NOT_FOUND - The Linux kernel was not found
186 TryRunningQemuKernel (
190 #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_