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