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