]> git.proxmox.com Git - mirror_edk2.git/blame - OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
MdeModulePkg/UefiBootManagerLib: Fix small LoadOptionToVariable leak
[mirror_edk2.git] / OvmfPkg / Library / PlatformBootManagerLib / BdsPlatform.h
CommitLineData
30541881
RN
1/** @file\r
2 Platform BDS customizations include file.\r
3\r
f4d575b5 4 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
30541881
RN
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13Module Name:\r
14\r
15 BdsPlatform.h\r
16\r
17Abstract:\r
18\r
19 Head file for BDS Platform specific code\r
20\r
21**/\r
22\r
23#ifndef _PLATFORM_SPECIFIC_BDS_PLATFORM_H_\r
24#define _PLATFORM_SPECIFIC_BDS_PLATFORM_H_\r
25\r
26\r
27#include <PiDxe.h>\r
28\r
29#include <IndustryStandard/Pci.h>\r
30#include <IndustryStandard/Acpi.h>\r
31#include <IndustryStandard/SmBios.h>\r
32#include <IndustryStandard/PeImage.h>\r
7ebad830 33#include <IndustryStandard/Virtio095.h>\r
30541881
RN
34\r
35#include <Library/DebugLib.h>\r
36#include <Library/BaseMemoryLib.h>\r
37#include <Library/UefiBootServicesTableLib.h>\r
38#include <Library/UefiRuntimeServicesTableLib.h>\r
39#include <Library/MemoryAllocationLib.h>\r
40#include <Library/BaseLib.h>\r
41#include <Library/PcdLib.h>\r
42#include <Library/PciLib.h>\r
2b23b8d4 43#include <Library/UefiBootManagerLib.h>\r
a3cd5cd5 44#include <Library/BootLogoLib.h>\r
30541881
RN
45#include <Library/HobLib.h>\r
46#include <Library/UefiLib.h>\r
47#include <Library/DxeServicesTableLib.h>\r
48#include <Library/DevicePathLib.h>\r
49#include <Library/IoLib.h>\r
50#include <Library/NvVarsFileLib.h>\r
51#include <Library/QemuFwCfgLib.h>\r
687f7521 52#include <Library/QemuFwCfgS3Lib.h>\r
04fe914b 53#include <Library/QemuBootOrderLib.h>\r
30541881
RN
54\r
55#include <Protocol/Decompress.h>\r
56#include <Protocol/PciIo.h>\r
57#include <Protocol/FirmwareVolume2.h>\r
58#include <Protocol/SimpleFileSystem.h>\r
59#include <Protocol/PciRootBridgeIo.h>\r
60#include <Protocol/S3SaveState.h>\r
61#include <Protocol/DxeSmmReadyToLock.h>\r
07dd96e8 62#include <Protocol/LoadedImage.h>\r
30541881
RN
63\r
64#include <Guid/Acpi.h>\r
65#include <Guid/SmBios.h>\r
66#include <Guid/Mps.h>\r
67#include <Guid/HobList.h>\r
68#include <Guid/GlobalVariable.h>\r
69#include <Guid/EventGroup.h>\r
f4d575b5 70#include <Guid/DebugAgentGuid.h>\r
30541881
RN
71\r
72#include <OvmfPlatforms.h>\r
73\r
30541881 74extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];\r
30541881
RN
75extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode;\r
76extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode;\r
77extern UART_DEVICE_PATH gUartDeviceNode;\r
78extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode;\r
30541881
RN
79\r
80#define PCI_DEVICE_PATH_NODE(Func, Dev) \\r
81 { \\r
82 { \\r
83 HARDWARE_DEVICE_PATH, \\r
84 HW_PCI_DP, \\r
85 { \\r
86 (UINT8) (sizeof (PCI_DEVICE_PATH)), \\r
87 (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \\r
88 } \\r
89 }, \\r
90 (Func), \\r
91 (Dev) \\r
92 }\r
93\r
94#define PNPID_DEVICE_PATH_NODE(PnpId) \\r
95 { \\r
96 { \\r
97 ACPI_DEVICE_PATH, \\r
98 ACPI_DP, \\r
99 { \\r
100 (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \\r
101 (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \\r
102 }, \\r
103 }, \\r
104 EISA_PNP_ID((PnpId)), \\r
105 0 \\r
106 }\r
107\r
108#define gPciIsaBridge \\r
109 PCI_DEVICE_PATH_NODE(0, 0x1f)\r
110\r
111#define gP2PBridge \\r
112 PCI_DEVICE_PATH_NODE(0, 0x1e)\r
113\r
114#define gPnpPs2Keyboard \\r
115 PNPID_DEVICE_PATH_NODE(0x0303)\r
116\r
117#define gPnp16550ComPort \\r
118 PNPID_DEVICE_PATH_NODE(0x0501)\r
119\r
120#define gUart \\r
121 { \\r
122 { \\r
123 MESSAGING_DEVICE_PATH, \\r
124 MSG_UART_DP, \\r
125 { \\r
126 (UINT8) (sizeof (UART_DEVICE_PATH)), \\r
127 (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \\r
128 } \\r
129 }, \\r
130 0, \\r
131 115200, \\r
132 8, \\r
133 1, \\r
134 1 \\r
135 }\r
136\r
137#define gPcAnsiTerminal \\r
138 { \\r
139 { \\r
140 MESSAGING_DEVICE_PATH, \\r
141 MSG_VENDOR_DP, \\r
142 { \\r
143 (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \\r
144 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \\r
145 } \\r
146 }, \\r
147 DEVICE_PATH_MESSAGING_PC_ANSI \\r
148 }\r
149\r
f4d575b5
MK
150#define gEndEntire \\r
151 { \\r
152 END_DEVICE_PATH_TYPE, \\r
153 END_ENTIRE_DEVICE_PATH_SUBTYPE, \\r
154 { \\r
155 END_DEVICE_PATH_LENGTH, \\r
156 0 \\r
157 } \\r
158 }\r
159\r
30541881
RN
160#define PCI_CLASS_SCC 0x07\r
161#define PCI_SUBCLASS_SERIAL 0x00\r
162#define PCI_IF_16550 0x02\r
163#define IS_PCI_16550SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)\r
30541881
RN
164#define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)\r
165\r
e9e9ad64
RN
166typedef struct {\r
167 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
168 UINTN ConnectType;\r
169} PLATFORM_CONSOLE_CONNECT_ENTRY;\r
170\r
171#define CONSOLE_OUT BIT0\r
172#define CONSOLE_IN BIT1\r
173#define STD_ERROR BIT2\r
174extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[];\r
175\r
30541881
RN
176//\r
177// Platform BDS Functions\r
178//\r
30541881 179\r
e9e9ad64
RN
180VOID\r
181PlatformInitializeConsole (\r
182 IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole\r
30541881
RN
183 );\r
184\r
30541881
RN
185/**\r
186 Loads and boots UEFI Linux via the FwCfg interface.\r
187\r
188 @retval EFI_NOT_FOUND - The Linux kernel was not found\r
189\r
190**/\r
191EFI_STATUS\r
192TryRunningQemuKernel (\r
193 VOID\r
194 );\r
195\r
196#endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_\r