]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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/HobList.h>
61 #include <Guid/GlobalVariable.h>
62 #include <Guid/EventGroup.h>
63 #include <Guid/DebugAgentGuid.h>
64
65 #include <OvmfPlatforms.h>
66
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;
72
73 #define PCI_DEVICE_PATH_NODE(Func, Dev) \
74 { \
75 { \
76 HARDWARE_DEVICE_PATH, \
77 HW_PCI_DP, \
78 { \
79 (UINT8) (sizeof (PCI_DEVICE_PATH)), \
80 (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \
81 } \
82 }, \
83 (Func), \
84 (Dev) \
85 }
86
87 #define PNPID_DEVICE_PATH_NODE(PnpId) \
88 { \
89 { \
90 ACPI_DEVICE_PATH, \
91 ACPI_DP, \
92 { \
93 (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
94 (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
95 }, \
96 }, \
97 EISA_PNP_ID((PnpId)), \
98 0 \
99 }
100
101 #define gPciIsaBridge \
102 PCI_DEVICE_PATH_NODE(0, 0x1f)
103
104 #define gP2PBridge \
105 PCI_DEVICE_PATH_NODE(0, 0x1e)
106
107 #define gPnpPs2Keyboard \
108 PNPID_DEVICE_PATH_NODE(0x0303)
109
110 #define gPnp16550ComPort \
111 PNPID_DEVICE_PATH_NODE(0x0501)
112
113 #define gUart \
114 { \
115 { \
116 MESSAGING_DEVICE_PATH, \
117 MSG_UART_DP, \
118 { \
119 (UINT8) (sizeof (UART_DEVICE_PATH)), \
120 (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \
121 } \
122 }, \
123 0, \
124 115200, \
125 8, \
126 1, \
127 1 \
128 }
129
130 #define gPcAnsiTerminal \
131 { \
132 { \
133 MESSAGING_DEVICE_PATH, \
134 MSG_VENDOR_DP, \
135 { \
136 (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \
137 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
138 } \
139 }, \
140 DEVICE_PATH_MESSAGING_PC_ANSI \
141 }
142
143 #define gEndEntire \
144 { \
145 END_DEVICE_PATH_TYPE, \
146 END_ENTIRE_DEVICE_PATH_SUBTYPE, \
147 { \
148 END_DEVICE_PATH_LENGTH, \
149 0 \
150 } \
151 }
152
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)
158
159 typedef struct {
160 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
161 UINTN ConnectType;
162 } PLATFORM_CONSOLE_CONNECT_ENTRY;
163
164 #define CONSOLE_OUT BIT0
165 #define CONSOLE_IN BIT1
166 #define STD_ERROR BIT2
167 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
168 extern PLATFORM_CONSOLE_CONNECT_ENTRY gXenPlatformConsole[];
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_