]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/Bds/BdsInternal.h
AppPkg: Update email and URL.
[mirror_edk2.git] / ArmPlatformPkg / Bds / BdsInternal.h
CommitLineData
ea46ebbe 1/** @file\r
2*\r
5d9e9d1a 3* Copyright (c) 2011-2015, 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
5d9e9d1a
OM
82// GUID of the EFI Linux Loader\r
83extern CONST EFI_GUID mLinuxLoaderAppGuid;\r
84\r
85// Device path of the EFI Linux Loader in the Firmware Volume\r
86extern EFI_DEVICE_PATH* mLinuxLoaderDevicePath;\r
87\r
ea46ebbe 88EFI_STATUS\r
89BootDeviceListSupportedInit (\r
90 IN OUT LIST_ENTRY *SupportedDeviceList\r
91 );\r
92\r
93EFI_STATUS\r
94BootDeviceListSupportedFree (\r
656416bc 95 IN LIST_ENTRY *SupportedDeviceList,\r
96 IN BDS_SUPPORTED_DEVICE *Except\r
ea46ebbe 97 );\r
98\r
99EFI_STATUS\r
100BootDeviceGetDeviceSupport (\r
22a262c8 101 IN EFI_DEVICE_PATH *DevicePath,\r
102 OUT BDS_LOAD_OPTION_SUPPORT **DeviceSupport\r
ea46ebbe 103 );\r
104\r
74b96132 105EFI_STATUS\r
106GetHIInputStr (\r
107 IN OUT CHAR16 *CmdLine,\r
108 IN UINTN MaxCmdLine\r
109 );\r
110\r
111EFI_STATUS\r
112EditHIInputStr (\r
113 IN OUT CHAR16 *CmdLine,\r
114 IN UINTN MaxCmdLine\r
115 );\r
116\r
ea46ebbe 117EFI_STATUS\r
118GetHIInputAscii (\r
119 IN OUT CHAR8 *CmdLine,\r
120 IN UINTN MaxCmdLine\r
121 );\r
122\r
123EFI_STATUS\r
124EditHIInputAscii (\r
125 IN OUT CHAR8 *CmdLine,\r
126 IN UINTN MaxCmdLine\r
127 );\r
128\r
129EFI_STATUS\r
130GetHIInputInteger (\r
131 IN OUT UINTN *Integer\r
132 );\r
133\r
134EFI_STATUS\r
135GetHIInputIP (\r
136 OUT EFI_IP_ADDRESS *Ip\r
137 );\r
138\r
8bf4ad44
RC
139EFI_STATUS\r
140EditHIInputIP (\r
141 IN EFI_IP_ADDRESS *InIpAddr,\r
142 OUT EFI_IP_ADDRESS *OutIpAddr\r
143 );\r
144\r
ea46ebbe 145EFI_STATUS\r
146GetHIInputBoolean (\r
147 OUT BOOLEAN *Value\r
148 );\r
149\r
ea46ebbe 150EFI_DEVICE_PATH*\r
151GetLastDevicePathNode (\r
152 IN EFI_DEVICE_PATH* DevicePath\r
153 );\r
154\r
155EFI_STATUS\r
156BdsStartBootOption (\r
157 IN CHAR16* BootOption\r
158 );\r
159\r
2ccfb71e 160UINTN\r
161GetUnalignedDevicePathSize (\r
162 IN EFI_DEVICE_PATH* DevicePath\r
163 );\r
164\r
165EFI_DEVICE_PATH*\r
166GetAlignedDevicePath (\r
167 IN EFI_DEVICE_PATH* DevicePath\r
168 );\r
169\r
ea46ebbe 170EFI_STATUS\r
171GenerateDeviceDescriptionName (\r
172 IN EFI_HANDLE Handle,\r
173 IN OUT CHAR16* Description\r
174 );\r
175\r
176EFI_STATUS\r
177BootOptionList (\r
178 IN OUT LIST_ENTRY *BootOptionList\r
179 );\r
180\r
181EFI_STATUS\r
182BootOptionParseLoadOption (\r
183 IN EFI_LOAD_OPTION EfiLoadOption,\r
184 IN UINTN EfiLoadOptionSize,\r
185 OUT BDS_LOAD_OPTION **BdsLoadOption\r
186 );\r
187\r
188EFI_STATUS\r
189BootOptionStart (\r
190 IN BDS_LOAD_OPTION *BootOption\r
191 );\r
192\r
193EFI_STATUS\r
194BootOptionCreate (\r
2ccfb71e 195 IN UINT32 Attributes,\r
196 IN CHAR16* BootDescription,\r
ea46ebbe 197 IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
90a44ec4
OM
198 IN UINT8* OptionalData,\r
199 IN UINTN OptionalDataSize,\r
2ccfb71e 200 OUT BDS_LOAD_OPTION** BdsLoadOption\r
ea46ebbe 201 );\r
202\r
203EFI_STATUS\r
204BootOptionUpdate (\r
2ccfb71e 205 IN BDS_LOAD_OPTION* BdsLoadOption,\r
206 IN UINT32 Attributes,\r
207 IN CHAR16* BootDescription,\r
ea46ebbe 208 IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
90a44ec4
OM
209 IN UINT8* OptionalData,\r
210 IN UINTN OptionalDataSize\r
ea46ebbe 211 );\r
212\r
213EFI_STATUS\r
214BootOptionDelete (\r
215 IN BDS_LOAD_OPTION *BootOption\r
216 );\r
217\r
218EFI_STATUS\r
219BootMenuMain (\r
220 VOID\r
221 );\r
222\r
9fc9aa46
OM
223BOOLEAN\r
224IsUnicodeString (\r
225 IN VOID* String\r
226 );\r
227\r
135b09a2
OM
228/*\r
229 * Try to detect if the given string is an ASCII or Unicode string\r
230 *\r
231 * There are actually few limitation to this function but it is mainly to give\r
232 * a user friendly output.\r
233 *\r
234 * Some limitations:\r
235 * - it only supports unicode string that use ASCII character (< 0x100)\r
236 * - single character ASCII strings are interpreted as Unicode string\r
237 * - string cannot be longer than 2 x BOOT_DEVICE_OPTION_MAX (600 bytes)\r
238 *\r
239 * @param String Buffer that might contain a Unicode or Ascii string\r
240 * @param IsUnicode If not NULL this boolean value returns if the string is an\r
241 * ASCII or Unicode string.\r
242 */\r
243BOOLEAN\r
244IsPrintableString (\r
245 IN VOID* String,\r
246 OUT BOOLEAN *IsUnicode\r
247 );\r
248\r
5c2d456b
OM
249/**\r
250 An empty function to pass error checking of CreateEventEx ().\r
251\r
252 @param Event Event whose notification function is being invoked.\r
253 @param Context Pointer to the notification function's context,\r
254 which is implementation-dependent.\r
255\r
256**/\r
257VOID\r
258EFIAPI\r
259EmptyCallbackFunction (\r
260 IN EFI_EVENT Event,\r
261 IN VOID *Context\r
262 );\r
263\r
5d9e9d1a
OM
264/**\r
265 * This function check if the DevicePath defines an EFI binary\r
266 *\r
267 * This function is used when the BDS support Linux loader to\r
268 * detect if the binary is an EFI application or potentially a\r
269 * Linux kernel.\r
270 */\r
271EFI_STATUS\r
272IsEfiBinary (\r
273 IN EFI_DEVICE_PATH* DevicePath,\r
274 OUT BOOLEAN *EfiBinary\r
275 );\r
276\r
ea46ebbe 277#endif /* _BDSINTERNAL_H_ */\r