]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/Library/PlatformBootManagerLib/BdsPlatform.h
OvmfPkg/PlatformBootManagerLib: Add EnableQuietBoot & DisableQuietBoot
[mirror_edk2.git] / OvmfPkg / Library / PlatformBootManagerLib / BdsPlatform.h
1 /** @file
2 Platform BDS customizations include file.
3
4 Copyright (c) 2006 - 2016, 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/Bmp.h>
30 #include <IndustryStandard/Pci.h>
31 #include <IndustryStandard/Acpi.h>
32 #include <IndustryStandard/SmBios.h>
33 #include <IndustryStandard/PeImage.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/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/QemuBootOrderLib.h>
52 #include <Library/DxeServicesLib.h>
53
54 #include <Protocol/OEMBadging.h>
55 #include <Protocol/UgaDraw.h>
56 #include <Protocol/BootLogo.h>
57 #include <Protocol/Decompress.h>
58 #include <Protocol/PciIo.h>
59 #include <Protocol/FirmwareVolume2.h>
60 #include <Protocol/SimpleFileSystem.h>
61 #include <Protocol/PciRootBridgeIo.h>
62 #include <Protocol/S3SaveState.h>
63 #include <Protocol/DxeSmmReadyToLock.h>
64 #include <Protocol/LoadedImage.h>
65
66 #include <Guid/Acpi.h>
67 #include <Guid/SmBios.h>
68 #include <Guid/Mps.h>
69 #include <Guid/HobList.h>
70 #include <Guid/GlobalVariable.h>
71 #include <Guid/EventGroup.h>
72
73 #include <OvmfPlatforms.h>
74
75 extern EFI_DEVICE_PATH_PROTOCOL *gPlatformConnectSequence[];
76 extern ACPI_HID_DEVICE_PATH gPnpPs2KeyboardDeviceNode;
77 extern ACPI_HID_DEVICE_PATH gPnp16550ComPortDeviceNode;
78 extern UART_DEVICE_PATH gUartDeviceNode;
79 extern VENDOR_DEVICE_PATH gTerminalTypeDeviceNode;
80
81 #define PCI_DEVICE_PATH_NODE(Func, Dev) \
82 { \
83 { \
84 HARDWARE_DEVICE_PATH, \
85 HW_PCI_DP, \
86 { \
87 (UINT8) (sizeof (PCI_DEVICE_PATH)), \
88 (UINT8) ((sizeof (PCI_DEVICE_PATH)) >> 8) \
89 } \
90 }, \
91 (Func), \
92 (Dev) \
93 }
94
95 #define PNPID_DEVICE_PATH_NODE(PnpId) \
96 { \
97 { \
98 ACPI_DEVICE_PATH, \
99 ACPI_DP, \
100 { \
101 (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
102 (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
103 }, \
104 }, \
105 EISA_PNP_ID((PnpId)), \
106 0 \
107 }
108
109 #define gPciIsaBridge \
110 PCI_DEVICE_PATH_NODE(0, 0x1f)
111
112 #define gP2PBridge \
113 PCI_DEVICE_PATH_NODE(0, 0x1e)
114
115 #define gPnpPs2Keyboard \
116 PNPID_DEVICE_PATH_NODE(0x0303)
117
118 #define gPnp16550ComPort \
119 PNPID_DEVICE_PATH_NODE(0x0501)
120
121 #define gUart \
122 { \
123 { \
124 MESSAGING_DEVICE_PATH, \
125 MSG_UART_DP, \
126 { \
127 (UINT8) (sizeof (UART_DEVICE_PATH)), \
128 (UINT8) ((sizeof (UART_DEVICE_PATH)) >> 8) \
129 } \
130 }, \
131 0, \
132 115200, \
133 8, \
134 1, \
135 1 \
136 }
137
138 #define gPcAnsiTerminal \
139 { \
140 { \
141 MESSAGING_DEVICE_PATH, \
142 MSG_VENDOR_DP, \
143 { \
144 (UINT8) (sizeof (VENDOR_DEVICE_PATH)), \
145 (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8) \
146 } \
147 }, \
148 DEVICE_PATH_MESSAGING_PC_ANSI \
149 }
150
151 #define PCI_CLASS_SCC 0x07
152 #define PCI_SUBCLASS_SERIAL 0x00
153 #define PCI_IF_16550 0x02
154 #define IS_PCI_16550SERIAL(_p) IS_CLASS3 (_p, PCI_CLASS_SCC, PCI_SUBCLASS_SERIAL, PCI_IF_16550)
155
156 #define EFI_SYSTEM_TABLE_MAX_ADDRESS 0xFFFFFFFF
157 #define SYS_TABLE_PAD(ptr) (((~ptr) +1) & 0x07 )
158
159 #define IS_PCI_ISA_PDECODE(_p) IS_CLASS3 (_p, PCI_CLASS_BRIDGE, PCI_CLASS_BRIDGE_ISA_PDECODE, 0)
160
161 typedef struct {
162 ACPI_HID_DEVICE_PATH PciRootBridge;
163 PCI_DEVICE_PATH IsaBridge;
164 ACPI_HID_DEVICE_PATH Keyboard;
165 EFI_DEVICE_PATH_PROTOCOL End;
166 } PLATFORM_DUMMY_ISA_KEYBOARD_DEVICE_PATH;
167
168 typedef struct {
169 ACPI_HID_DEVICE_PATH PciRootBridge;
170 PCI_DEVICE_PATH IsaBridge;
171 ACPI_HID_DEVICE_PATH IsaSerial;
172 UART_DEVICE_PATH Uart;
173 VENDOR_DEVICE_PATH TerminalType;
174 EFI_DEVICE_PATH_PROTOCOL End;
175 } PLATFORM_DUMMY_ISA_SERIAL_DEVICE_PATH;
176
177 typedef struct {
178 ACPI_HID_DEVICE_PATH PciRootBridge;
179 PCI_DEVICE_PATH VgaDevice;
180 EFI_DEVICE_PATH_PROTOCOL End;
181 } PLATFORM_DUMMY_PCI_VGA_DEVICE_PATH;
182
183 typedef struct {
184 ACPI_HID_DEVICE_PATH PciRootBridge;
185 PCI_DEVICE_PATH PciBridge;
186 PCI_DEVICE_PATH SerialDevice;
187 UART_DEVICE_PATH Uart;
188 VENDOR_DEVICE_PATH TerminalType;
189 EFI_DEVICE_PATH_PROTOCOL End;
190 } PLATFORM_DUMMY_PCI_SERIAL_DEVICE_PATH;
191
192 //
193 // the short form device path for Usb keyboard
194 //
195 #define CLASS_HID 3
196 #define SUBCLASS_BOOT 1
197 #define PROTOCOL_KEYBOARD 1
198
199 typedef struct {
200 USB_CLASS_DEVICE_PATH UsbClass;
201 EFI_DEVICE_PATH_PROTOCOL End;
202 } USB_CLASS_FORMAT_DEVICE_PATH;
203
204 typedef struct {
205 EFI_DEVICE_PATH_PROTOCOL *DevicePath;
206 UINTN ConnectType;
207 } PLATFORM_CONSOLE_CONNECT_ENTRY;
208
209 #define CONSOLE_OUT BIT0
210 #define CONSOLE_IN BIT1
211 #define STD_ERROR BIT2
212 extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[];
213
214 //
215 // Platform BDS Functions
216 //
217
218 VOID
219 PlatformInitializeConsole (
220 IN PLATFORM_CONSOLE_CONNECT_ENTRY *PlatformConsole
221 );
222
223 /**
224 Loads and boots UEFI Linux via the FwCfg interface.
225
226 @retval EFI_NOT_FOUND - The Linux kernel was not found
227
228 **/
229 EFI_STATUS
230 TryRunningQemuKernel (
231 VOID
232 );
233
234 /**
235 Use SystemTable Conout to stop video based Simple Text Out consoles from going
236 to the video device. Put up LogoFile on every video device that is a console.
237
238 @param[in] LogoFile File name of logo to display on the center of the screen.
239
240 @retval EFI_SUCCESS ConsoleControl has been flipped to graphics and logo displayed.
241 @retval EFI_UNSUPPORTED Logo not found
242
243 **/
244 EFI_STATUS
245 EnableQuietBoot (
246 IN EFI_GUID *LogoFile
247 );
248
249 /**
250 Use SystemTable Conout to turn on video based Simple Text Out consoles. The
251 Simple Text Out screens will now be synced up with all non video output devices
252
253 @retval EFI_SUCCESS UGA devices are back in text mode and synced up.
254
255 **/
256 EFI_STATUS
257 DisableQuietBoot (
258 VOID
259 );
260
261 #endif // _PLATFORM_SPECIFIC_BDS_PLATFORM_H_