]> 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 #include <PiDxe.h>
21
22 #include <IndustryStandard/Pci.h>
23 #include <IndustryStandard/Acpi.h>
24 #include <IndustryStandard/SmBios.h>
25 #include <IndustryStandard/PeImage.h>
26 #include <IndustryStandard/Virtio095.h>
27
28 #include <Library/DebugLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/UefiBootServicesTableLib.h>
31 #include <Library/UefiRuntimeServicesTableLib.h>
32 #include <Library/MemoryAllocationLib.h>
33 #include <Library/BaseLib.h>
34 #include <Library/PcdLib.h>
35 #include <Library/PciLib.h>
36 #include <Library/UefiBootManagerLib.h>
37 #include <Library/BootLogoLib.h>
38 #include <Library/HobLib.h>
39 #include <Library/UefiLib.h>
40 #include <Library/DxeServicesTableLib.h>
41 #include <Library/DevicePathLib.h>
42 #include <Library/IoLib.h>
43 #include <Library/NvVarsFileLib.h>
44 #include <Library/QemuFwCfgLib.h>
45 #include <Library/QemuFwCfgS3Lib.h>
46 #include <Library/QemuBootOrderLib.h>
47
48 #include <Protocol/Decompress.h>
49 #include <Protocol/PciIo.h>
50 #include <Protocol/FirmwareVolume2.h>
51 #include <Protocol/SimpleFileSystem.h>
52 #include <Protocol/PciRootBridgeIo.h>
53 #include <Protocol/S3SaveState.h>
54 #include <Protocol/DxeSmmReadyToLock.h>
55 #include <Protocol/LoadedImage.h>
56
57 #include <Guid/Acpi.h>
58 #include <Guid/SmBios.h>
59 #include <Guid/HobList.h>
60 #include <Guid/GlobalVariable.h>
61 #include <Guid/EventGroup.h>
62 #include <Guid/DebugAgentGuid.h>
63
64 #include <OvmfPlatforms.h>
65
66 extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];
67 extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode;
68 extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode;
69 extern UART_DEVICE_PATH gUartDeviceNode;
70 extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode;
71
72 #define PCI_DEVICE_PATH_NODE(Func, Dev) \
73 { \
74 { \
75 HARDWARE_DEVICE_PATH, \
76 HW_PCI_DP, \
77 { \
78 (UINT8) (sizeof (PCI_DEVICE_PATH)), \
79 (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \
80 } \
81 }, \
82 (Func), \
83 (Dev) \
84 }
85
86 #define PNPID_DEVICE_PATH_NODE(PnpId) \
87 { \
88 { \
89 ACPI_DEVICE_PATH, \
90 ACPI_DP, \
91 { \
92 (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
93 (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
94 }, \
95 }, \
96 EISA_PNP_ID((PnpId)), \
97 0 \
98 }
99
100 #define gPciIsaBridge \
101 PCI_DEVICE_PATH_NODE(0, 0x1f)
102
103 #define gP2PBridge \
104 PCI_DEVICE_PATH_NODE(0, 0x1e)
105
106 #define gPnpPs2Keyboard \
107 PNPID_DEVICE_PATH_NODE(0x0303)
108
109 #define gPnp16550ComPort \
110 PNPID_DEVICE_PATH_NODE(0x0501)
111
112 #define gUart \
113 { \
114 { \
115 MESSAGING_DEVICE_PATH, \
116 MSG_UART_DP, \
117 { \
118 (UINT8) (sizeof (UART_DEVICE_PATH)), \
119 (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \
120 } \
121 }, \
122 0, \
123 115200, \
124 8, \
125 1, \
126 1 \
127 }
128
129 #define gPcAnsiTerminal \
130 { \
131 { \
132 MESSAGING_DEVICE_PATH, \
133 MSG_VENDOR_DP, \
134 { \
135 (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \
136 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
137 } \
138 }, \
139 DEVICE_PATH_MESSAGING_PC_ANSI \
140 }
141
142 #define gEndEntire \
143 { \
144 END_DEVICE_PATH_TYPE, \
145 END_ENTIRE_DEVICE_PATH_SUBTYPE, \
146 { \
147 END_DEVICE_PATH_LENGTH, \
148 0 \
149 } \
150 }
151
152 #define PCI_CLASS_SCC 0x07
153 #define PCI_SUBCLASS_SERIAL 0x00
154 #define PCI_IF_16550 0x02
155 #define IS_PCI_16550SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
156 #define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
157
158 typedef struct {
159 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
160 UINTN ConnectType;
161 } PLATFORM_CONSOLE_CONNECT_ENTRY;
162
163 #define CONSOLE_OUT BIT0
164 #define CONSOLE_IN BIT1
165 #define STD_ERROR BIT2
166 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
167 extern PLATFORM_CONSOLE_CONNECT_ENTRY gXenPlatformConsole[];
168
169 //
170 // Platform BDS Functions
171 //
172
173 VOID
174 PlatformInitializeConsole (
175 IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole
176 );
177
178 /**
179 Loads and boots UEFI Linux via the FwCfg interface.
180
181 @retval EFI_NOT_FOUND - The Linux kernel was not found
182
183 **/
184 EFI_STATUS
185 TryRunningQemuKernel (
186 VOID
187 );
188
189 #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_