]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
da6dd86616a0fe1297edd812b991840de73dd8ab
[mirror_edk2.git] / OvmfPkg / Library / PlatformBootManagerLib / BdsPlatform.h
1 /** @file
2 Platform BDS customizations include file.
3
4 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 Module Name:
8
9 BdsPlatform.h
10
11 Abstract:
12
13 Head file for BDS Platform specific code
14
15 **/
16
17 #ifndef _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
18 #define _PLATFORM_SPECIFIC_BDS_PLATFORM_H_
19
20
21 #include <PiDxe.h>
22
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>
28
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>
48
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>
57
58 #include <Guid/Acpi.h>
59 #include <Guid/SmBios.h>
60 #include <Guid/Mps.h>
61 #include <Guid/HobList.h>
62 #include <Guid/GlobalVariable.h>
63 #include <Guid/EventGroup.h>
64 #include <Guid/DebugAgentGuid.h>
65
66 #include <OvmfPlatforms.h>
67
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;
73
74 #define PCI_DEVICE_PATH_NODE(Func, Dev) \
75 { \
76 { \
77 HARDWARE_DEVICE_PATH, \
78 HW_PCI_DP, \
79 { \
80 (UINT8) (sizeof (PCI_DEVICE_PATH)), \
81 (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \
82 } \
83 }, \
84 (Func), \
85 (Dev) \
86 }
87
88 #define PNPID_DEVICE_PATH_NODE(PnpId) \
89 { \
90 { \
91 ACPI_DEVICE_PATH, \
92 ACPI_DP, \
93 { \
94 (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
95 (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
96 }, \
97 }, \
98 EISA_PNP_ID((PnpId)), \
99 0 \
100 }
101
102 #define gPciIsaBridge \
103 PCI_DEVICE_PATH_NODE(0, 0x1f)
104
105 #define gP2PBridge \
106 PCI_DEVICE_PATH_NODE(0, 0x1e)
107
108 #define gPnpPs2Keyboard \
109 PNPID_DEVICE_PATH_NODE(0x0303)
110
111 #define gPnp16550ComPort \
112 PNPID_DEVICE_PATH_NODE(0x0501)
113
114 #define gUart \
115 { \
116 { \
117 MESSAGING_DEVICE_PATH, \
118 MSG_UART_DP, \
119 { \
120 (UINT8) (sizeof (UART_DEVICE_PATH)), \
121 (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \
122 } \
123 }, \
124 0, \
125 115200, \
126 8, \
127 1, \
128 1 \
129 }
130
131 #define gPcAnsiTerminal \
132 { \
133 { \
134 MESSAGING_DEVICE_PATH, \
135 MSG_VENDOR_DP, \
136 { \
137 (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \
138 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
139 } \
140 }, \
141 DEVICE_PATH_MESSAGING_PC_ANSI \
142 }
143
144 #define gEndEntire \
145 { \
146 END_DEVICE_PATH_TYPE, \
147 END_ENTIRE_DEVICE_PATH_SUBTYPE, \
148 { \
149 END_DEVICE_PATH_LENGTH, \
150 0 \
151 } \
152 }
153
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)
159
160 typedef struct {
161 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
162 UINTN ConnectType;
163 } PLATFORM_CONSOLE_CONNECT_ENTRY;
164
165 #define CONSOLE_OUT BIT0
166 #define CONSOLE_IN BIT1
167 #define STD_ERROR BIT2
168 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
169
170 //
171 // Platform BDS Functions
172 //
173
174 VOID
175 PlatformInitializeConsole (
176 IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole
177 );
178
179 /**
180 Loads and boots UEFI Linux via the FwCfg interface.
181
182 @retval EFI_NOT_FOUND - The Linux kernel was not found
183
184 **/
185 EFI_STATUS
186 TryRunningQemuKernel (
187 VOID
188 );
189
190 #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_