]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/Bds/BdsInternal.h
ArmPlatformPkg/Bds: Remove Linux specific boot path
[mirror_edk2.git] / ArmPlatformPkg / Bds / BdsInternal.h
CommitLineData
ea46ebbe 1/** @file\r
2*\r
abc0e107 3* Copyright (c) 2011-2014, ARM Limited. All rights reserved.\r
ea46ebbe 4*\r
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**/\r
14\r
15#ifndef _BDSINTERNAL_H_\r
16#define _BDSINTERNAL_H_\r
17\r
18#include <PiDxe.h>\r
19#include <Library/BaseMemoryLib.h>\r
20#include <Library/BdsLib.h>\r
ea46ebbe 21#include <Library/DebugLib.h>\r
22#include <Library/DevicePathLib.h>\r
23#include <Library/UefiLib.h>\r
24#include <Library/PrintLib.h>\r
25#include <Library/PcdLib.h>\r
26#include <Library/MemoryAllocationLib.h>\r
27#include <Library/UefiBootServicesTableLib.h>\r
28#include <Library/UefiRuntimeServicesTableLib.h>\r
29\r
30#include <Protocol/DevicePathFromText.h>\r
31#include <Protocol/DevicePathToText.h>\r
32\r
33#include <Guid/GlobalVariable.h>\r
0ae6a518 34#include <Guid/Fdt.h>\r
ea46ebbe 35\r
36#define BOOT_DEVICE_DESCRIPTION_MAX 100\r
37#define BOOT_DEVICE_FILEPATH_MAX 100\r
656416bc 38#define BOOT_DEVICE_OPTION_MAX 300\r
e34114ea 39#define BOOT_DEVICE_ADDRESS_MAX (sizeof(L"0x0000000000000000"))\r
ea46ebbe 40\r
11c20f4e 41#define UPDATE_BOOT_ENTRY L"Update entry: "\r
42#define DELETE_BOOT_ENTRY L"Delete entry: "\r
019680b3 43#define MOVE_BOOT_ENTRY L"Move entry: "\r
11c20f4e 44\r
a6e97d28 45typedef struct {\r
46 LIST_ENTRY Link;\r
47 BDS_LOAD_OPTION* BdsLoadOption;\r
48} BDS_LOAD_OPTION_ENTRY;\r
49\r
ea46ebbe 50typedef enum {\r
51 BDS_DEVICE_FILESYSTEM = 0,\r
52 BDS_DEVICE_MEMMAP,\r
53 BDS_DEVICE_PXE,\r
54 BDS_DEVICE_TFTP,\r
55 BDS_DEVICE_MAX\r
56} BDS_SUPPORTED_DEVICE_TYPE;\r
57\r
58typedef struct {\r
793275a8 59 LIST_ENTRY Link;\r
60 CHAR16 Description[BOOT_DEVICE_DESCRIPTION_MAX];\r
61 EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;\r
ea46ebbe 62 struct _BDS_LOAD_OPTION_SUPPORT* Support;\r
63} BDS_SUPPORTED_DEVICE;\r
64\r
65#define SUPPORTED_BOOT_DEVICE_FROM_LINK(a) BASE_CR(a, BDS_SUPPORTED_DEVICE, Link)\r
66\r
ea46ebbe 67typedef struct _BDS_LOAD_OPTION_SUPPORT {\r
68 BDS_SUPPORTED_DEVICE_TYPE Type;\r
69 EFI_STATUS (*ListDevices)(IN OUT LIST_ENTRY* BdsLoadOptionList);\r
22a262c8 70 BOOLEAN (*IsSupported)(IN EFI_DEVICE_PATH *DevicePath);\r
889ac6a8
RC
71 EFI_STATUS (*CreateDevicePathNode)(IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNodes);\r
72 EFI_STATUS (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, IN CHAR16* FileName, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath);\r
73\r
74 /// Define if the boot menu should request if the file is a EFI binary or a Linux kernel\r
75 /// Example: PXE boot always deliver a UEFI application.\r
76 BOOLEAN RequestBootType;\r
ea46ebbe 77} BDS_LOAD_OPTION_SUPPORT;\r
78\r
a6e97d28 79#define LOAD_OPTION_ENTRY_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link)\r
80#define LOAD_OPTION_FROM_LINK(a) ((BDS_LOAD_OPTION_ENTRY*)BASE_CR(a, BDS_LOAD_OPTION_ENTRY, Link))->BdsLoadOption\r
ea46ebbe 81\r
ea46ebbe 82EFI_STATUS\r
83BootDeviceListSupportedInit (\r
84 IN OUT LIST_ENTRY *SupportedDeviceList\r
85 );\r
86\r
87EFI_STATUS\r
88BootDeviceListSupportedFree (\r
656416bc 89 IN LIST_ENTRY *SupportedDeviceList,\r
90 IN BDS_SUPPORTED_DEVICE *Except\r
ea46ebbe 91 );\r
92\r
93EFI_STATUS\r
94BootDeviceGetDeviceSupport (\r
22a262c8 95 IN EFI_DEVICE_PATH *DevicePath,\r
96 OUT BDS_LOAD_OPTION_SUPPORT **DeviceSupport\r
ea46ebbe 97 );\r
98\r
74b96132 99EFI_STATUS\r
100GetHIInputStr (\r
101 IN OUT CHAR16 *CmdLine,\r
102 IN UINTN MaxCmdLine\r
103 );\r
104\r
105EFI_STATUS\r
106EditHIInputStr (\r
107 IN OUT CHAR16 *CmdLine,\r
108 IN UINTN MaxCmdLine\r
109 );\r
110\r
ea46ebbe 111EFI_STATUS\r
112GetHIInputAscii (\r
113 IN OUT CHAR8 *CmdLine,\r
114 IN UINTN MaxCmdLine\r
115 );\r
116\r
117EFI_STATUS\r
118EditHIInputAscii (\r
119 IN OUT CHAR8 *CmdLine,\r
120 IN UINTN MaxCmdLine\r
121 );\r
122\r
123EFI_STATUS\r
124GetHIInputInteger (\r
125 IN OUT UINTN *Integer\r
126 );\r
127\r
128EFI_STATUS\r
129GetHIInputIP (\r
130 OUT EFI_IP_ADDRESS *Ip\r
131 );\r
132\r
8bf4ad44
RC
133EFI_STATUS\r
134EditHIInputIP (\r
135 IN EFI_IP_ADDRESS *InIpAddr,\r
136 OUT EFI_IP_ADDRESS *OutIpAddr\r
137 );\r
138\r
ea46ebbe 139EFI_STATUS\r
140GetHIInputBoolean (\r
141 OUT BOOLEAN *Value\r
142 );\r
143\r
144BOOLEAN\r
145HasFilePathEfiExtension (\r
146 IN CHAR16* FilePath\r
147 );\r
148\r
149EFI_DEVICE_PATH*\r
150GetLastDevicePathNode (\r
151 IN EFI_DEVICE_PATH* DevicePath\r
152 );\r
153\r
154EFI_STATUS\r
155BdsStartBootOption (\r
156 IN CHAR16* BootOption\r
157 );\r
158\r
2ccfb71e 159UINTN\r
160GetUnalignedDevicePathSize (\r
161 IN EFI_DEVICE_PATH* DevicePath\r
162 );\r
163\r
164EFI_DEVICE_PATH*\r
165GetAlignedDevicePath (\r
166 IN EFI_DEVICE_PATH* DevicePath\r
167 );\r
168\r
ea46ebbe 169EFI_STATUS\r
170GenerateDeviceDescriptionName (\r
171 IN EFI_HANDLE Handle,\r
172 IN OUT CHAR16* Description\r
173 );\r
174\r
175EFI_STATUS\r
176BootOptionList (\r
177 IN OUT LIST_ENTRY *BootOptionList\r
178 );\r
179\r
180EFI_STATUS\r
181BootOptionParseLoadOption (\r
182 IN EFI_LOAD_OPTION EfiLoadOption,\r
183 IN UINTN EfiLoadOptionSize,\r
184 OUT BDS_LOAD_OPTION **BdsLoadOption\r
185 );\r
186\r
187EFI_STATUS\r
188BootOptionStart (\r
189 IN BDS_LOAD_OPTION *BootOption\r
190 );\r
191\r
192EFI_STATUS\r
193BootOptionCreate (\r
2ccfb71e 194 IN UINT32 Attributes,\r
195 IN CHAR16* BootDescription,\r
ea46ebbe 196 IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
90a44ec4
OM
197 IN UINT8* OptionalData,\r
198 IN UINTN OptionalDataSize,\r
2ccfb71e 199 OUT BDS_LOAD_OPTION** BdsLoadOption\r
ea46ebbe 200 );\r
201\r
202EFI_STATUS\r
203BootOptionUpdate (\r
2ccfb71e 204 IN BDS_LOAD_OPTION* BdsLoadOption,\r
205 IN UINT32 Attributes,\r
206 IN CHAR16* BootDescription,\r
ea46ebbe 207 IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
90a44ec4
OM
208 IN UINT8* OptionalData,\r
209 IN UINTN OptionalDataSize\r
ea46ebbe 210 );\r
211\r
212EFI_STATUS\r
213BootOptionDelete (\r
214 IN BDS_LOAD_OPTION *BootOption\r
215 );\r
216\r
217EFI_STATUS\r
218BootMenuMain (\r
219 VOID\r
220 );\r
221\r
9fc9aa46
OM
222BOOLEAN\r
223IsUnicodeString (\r
224 IN VOID* String\r
225 );\r
226\r
135b09a2
OM
227/*\r
228 * Try to detect if the given string is an ASCII or Unicode string\r
229 *\r
230 * There are actually few limitation to this function but it is mainly to give\r
231 * a user friendly output.\r
232 *\r
233 * Some limitations:\r
234 * - it only supports unicode string that use ASCII character (< 0x100)\r
235 * - single character ASCII strings are interpreted as Unicode string\r
236 * - string cannot be longer than 2 x BOOT_DEVICE_OPTION_MAX (600 bytes)\r
237 *\r
238 * @param String Buffer that might contain a Unicode or Ascii string\r
239 * @param IsUnicode If not NULL this boolean value returns if the string is an\r
240 * ASCII or Unicode string.\r
241 */\r
242BOOLEAN\r
243IsPrintableString (\r
244 IN VOID* String,\r
245 OUT BOOLEAN *IsUnicode\r
246 );\r
247\r
5c2d456b
OM
248/**\r
249 An empty function to pass error checking of CreateEventEx ().\r
250\r
251 @param Event Event whose notification function is being invoked.\r
252 @param Context Pointer to the notification function's context,\r
253 which is implementation-dependent.\r
254\r
255**/\r
256VOID\r
257EFIAPI\r
258EmptyCallbackFunction (\r
259 IN EFI_EVENT Event,\r
260 IN VOID *Context\r
261 );\r
262\r
ea46ebbe 263#endif /* _BDSINTERNAL_H_ */\r