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