]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/Bds/BdsInternal.h
ArmPlatformPkg/Bds: Get User inputs in Unicode
[mirror_edk2.git] / ArmPlatformPkg / Bds / BdsInternal.h
CommitLineData
ea46ebbe 1/** @file\r
2*\r
3* Copyright (c) 2011, ARM Limited. All rights reserved.\r
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
21#include <Library/BdsUnixLib.h>\r
22#include <Library/DebugLib.h>\r
23#include <Library/DevicePathLib.h>\r
24#include <Library/UefiLib.h>\r
25#include <Library/PrintLib.h>\r
26#include <Library/PcdLib.h>\r
27#include <Library/MemoryAllocationLib.h>\r
28#include <Library/UefiBootServicesTableLib.h>\r
29#include <Library/UefiRuntimeServicesTableLib.h>\r
30\r
31#include <Protocol/DevicePathFromText.h>\r
32#include <Protocol/DevicePathToText.h>\r
33\r
34#include <Guid/GlobalVariable.h>\r
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
ea46ebbe 39#define BOOT_DEVICE_ADDRESS_MAX 20\r
40\r
41typedef enum {\r
42 BDS_LOADER_EFI_APPLICATION = 0,\r
43 BDS_LOADER_KERNEL_LINUX_ATAG,\r
44 BDS_LOADER_KERNEL_LINUX_FDT,\r
45} BDS_LOADER_TYPE;\r
46\r
656416bc 47typedef struct{\r
48 UINT16 InitrdPathListLength;\r
49 EFI_DEVICE_PATH_PROTOCOL *InitrdPathList;\r
50 CHAR8 CmdLine[BOOT_DEVICE_OPTION_MAX + 1];\r
51} BDS_LINUX_ATAG_ARGUMENTS;\r
52\r
53typedef union {\r
54 BDS_LINUX_ATAG_ARGUMENTS LinuxAtagArguments;\r
55} BDS_LOADER_ARGUMENTS;\r
56\r
ea46ebbe 57typedef struct {\r
656416bc 58 BDS_LOADER_TYPE LoaderType;\r
59 BDS_LOADER_ARGUMENTS Arguments;\r
ea46ebbe 60} BDS_LOADER_OPTIONAL_DATA;\r
61\r
62typedef enum {\r
63 BDS_DEVICE_FILESYSTEM = 0,\r
64 BDS_DEVICE_MEMMAP,\r
65 BDS_DEVICE_PXE,\r
66 BDS_DEVICE_TFTP,\r
67 BDS_DEVICE_MAX\r
68} BDS_SUPPORTED_DEVICE_TYPE;\r
69\r
70typedef struct {\r
71 LIST_ENTRY Link;\r
72 CHAR16 Description[BOOT_DEVICE_DESCRIPTION_MAX];\r
73 EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;\r
74 struct _BDS_LOAD_OPTION_SUPPORT* Support;\r
75} BDS_SUPPORTED_DEVICE;\r
76\r
77#define SUPPORTED_BOOT_DEVICE_FROM_LINK(a) BASE_CR(a, BDS_SUPPORTED_DEVICE, Link)\r
78\r
79typedef UINT8* EFI_LOAD_OPTION;\r
80\r
656416bc 81/* This is defined by the UEFI specs, don't change it */\r
ea46ebbe 82typedef struct {\r
83 LIST_ENTRY Link;\r
84\r
85 UINT16 LoadOptionIndex;\r
86 EFI_LOAD_OPTION LoadOption;\r
87 UINTN LoadOptionSize;\r
88\r
89 UINT32 Attributes;\r
90 UINT16 FilePathListLength;\r
91 CHAR16 *Description;\r
92 EFI_DEVICE_PATH_PROTOCOL *FilePathList;\r
93 BDS_LOADER_OPTIONAL_DATA *OptionalData;\r
94} BDS_LOAD_OPTION;\r
95\r
96typedef struct _BDS_LOAD_OPTION_SUPPORT {\r
97 BDS_SUPPORTED_DEVICE_TYPE Type;\r
98 EFI_STATUS (*ListDevices)(IN OUT LIST_ENTRY* BdsLoadOptionList);\r
99 BOOLEAN (*IsSupported)(IN BDS_LOAD_OPTION* BdsLoadOption);\r
656416bc 100 EFI_STATUS (*CreateDevicePathNode)(IN BDS_SUPPORTED_DEVICE* BdsLoadOption, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, OUT BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);\r
101 EFI_STATUS (*UpdateDevicePathNode)(IN EFI_DEVICE_PATH *OldDevicePath, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);\r
ea46ebbe 102} BDS_LOAD_OPTION_SUPPORT;\r
103\r
104#define LOAD_OPTION_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION, Link)\r
105\r
106EFI_STATUS\r
107GetEnvironmentVariable (\r
108 IN CONST CHAR16* VariableName,\r
109 IN VOID* DefaultValue,\r
110 IN OUT UINTN* Size,\r
111 OUT VOID** Value\r
112 );\r
113\r
114EFI_STATUS\r
115BootDeviceListSupportedInit (\r
116 IN OUT LIST_ENTRY *SupportedDeviceList\r
117 );\r
118\r
119EFI_STATUS\r
120BootDeviceListSupportedFree (\r
656416bc 121 IN LIST_ENTRY *SupportedDeviceList,\r
122 IN BDS_SUPPORTED_DEVICE *Except\r
ea46ebbe 123 );\r
124\r
125EFI_STATUS\r
126BootDeviceGetDeviceSupport (\r
127 IN BDS_LOAD_OPTION *BootOption,\r
128 OUT BDS_LOAD_OPTION_SUPPORT** DeviceSupport\r
129 );\r
130\r
74b96132 131EFI_STATUS\r
132GetHIInputStr (\r
133 IN OUT CHAR16 *CmdLine,\r
134 IN UINTN MaxCmdLine\r
135 );\r
136\r
137EFI_STATUS\r
138EditHIInputStr (\r
139 IN OUT CHAR16 *CmdLine,\r
140 IN UINTN MaxCmdLine\r
141 );\r
142\r
ea46ebbe 143EFI_STATUS\r
144GetHIInputAscii (\r
145 IN OUT CHAR8 *CmdLine,\r
146 IN UINTN MaxCmdLine\r
147 );\r
148\r
149EFI_STATUS\r
150EditHIInputAscii (\r
151 IN OUT CHAR8 *CmdLine,\r
152 IN UINTN MaxCmdLine\r
153 );\r
154\r
155EFI_STATUS\r
156GetHIInputInteger (\r
157 IN OUT UINTN *Integer\r
158 );\r
159\r
160EFI_STATUS\r
161GetHIInputIP (\r
162 OUT EFI_IP_ADDRESS *Ip\r
163 );\r
164\r
165EFI_STATUS\r
166GetHIInputBoolean (\r
167 OUT BOOLEAN *Value\r
168 );\r
169\r
170BOOLEAN\r
171HasFilePathEfiExtension (\r
172 IN CHAR16* FilePath\r
173 );\r
174\r
175EFI_DEVICE_PATH*\r
176GetLastDevicePathNode (\r
177 IN EFI_DEVICE_PATH* DevicePath\r
178 );\r
179\r
180EFI_STATUS\r
181BdsStartBootOption (\r
182 IN CHAR16* BootOption\r
183 );\r
184\r
185EFI_STATUS\r
186GenerateDeviceDescriptionName (\r
187 IN EFI_HANDLE Handle,\r
188 IN OUT CHAR16* Description\r
189 );\r
190\r
191EFI_STATUS\r
192BootOptionList (\r
193 IN OUT LIST_ENTRY *BootOptionList\r
194 );\r
195\r
196EFI_STATUS\r
197BootOptionParseLoadOption (\r
198 IN EFI_LOAD_OPTION EfiLoadOption,\r
199 IN UINTN EfiLoadOptionSize,\r
200 OUT BDS_LOAD_OPTION **BdsLoadOption\r
201 );\r
202\r
203EFI_STATUS\r
204BootOptionStart (\r
205 IN BDS_LOAD_OPTION *BootOption\r
206 );\r
207\r
208EFI_STATUS\r
209BootOptionCreate (\r
210 IN UINT32 Attributes,\r
211 IN CHAR16* BootDescription,\r
212 IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
213 IN BDS_LOADER_TYPE BootType,\r
656416bc 214 IN BDS_LOADER_ARGUMENTS *BootArguments,\r
ea46ebbe 215 OUT BDS_LOAD_OPTION **BdsLoadOption\r
216 );\r
217\r
218EFI_STATUS\r
219BootOptionUpdate (\r
220 IN BDS_LOAD_OPTION *BdsLoadOption,\r
221 IN UINT32 Attributes,\r
222 IN CHAR16* BootDescription,\r
223 IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r
224 IN BDS_LOADER_TYPE BootType,\r
656416bc 225 IN BDS_LOADER_ARGUMENTS *BootArguments\r
ea46ebbe 226 );\r
227\r
228EFI_STATUS\r
229BootOptionDelete (\r
230 IN BDS_LOAD_OPTION *BootOption\r
231 );\r
232\r
233EFI_STATUS\r
234BootMenuMain (\r
235 VOID\r
236 );\r
237\r
238#endif /* _BDSINTERNAL_H_ */\r