]>
Commit | Line | Data |
---|---|---|
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 | |
38 | #define BOOT_DEVICE_OPTION_MAX 100\r | |
39 | #define BOOT_DEVICE_ADDRESS_MAX 20\r | |
40 | \r | |
41 | typedef 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 | |
47 | typedef struct {\r | |
48 | BDS_LOADER_TYPE LoaderType;\r | |
49 | CHAR8 Arguments[];\r | |
50 | } BDS_LOADER_OPTIONAL_DATA;\r | |
51 | \r | |
52 | typedef enum {\r | |
53 | BDS_DEVICE_FILESYSTEM = 0,\r | |
54 | BDS_DEVICE_MEMMAP,\r | |
55 | BDS_DEVICE_PXE,\r | |
56 | BDS_DEVICE_TFTP,\r | |
57 | BDS_DEVICE_MAX\r | |
58 | } BDS_SUPPORTED_DEVICE_TYPE;\r | |
59 | \r | |
60 | typedef struct {\r | |
61 | LIST_ENTRY Link;\r | |
62 | CHAR16 Description[BOOT_DEVICE_DESCRIPTION_MAX];\r | |
63 | EFI_DEVICE_PATH_PROTOCOL* DevicePathProtocol;\r | |
64 | struct _BDS_LOAD_OPTION_SUPPORT* Support;\r | |
65 | } BDS_SUPPORTED_DEVICE;\r | |
66 | \r | |
67 | #define SUPPORTED_BOOT_DEVICE_FROM_LINK(a) BASE_CR(a, BDS_SUPPORTED_DEVICE, Link)\r | |
68 | \r | |
69 | typedef UINT8* EFI_LOAD_OPTION;\r | |
70 | \r | |
71 | typedef struct {\r | |
72 | LIST_ENTRY Link;\r | |
73 | \r | |
74 | UINT16 LoadOptionIndex;\r | |
75 | EFI_LOAD_OPTION LoadOption;\r | |
76 | UINTN LoadOptionSize;\r | |
77 | \r | |
78 | UINT32 Attributes;\r | |
79 | UINT16 FilePathListLength;\r | |
80 | CHAR16 *Description;\r | |
81 | EFI_DEVICE_PATH_PROTOCOL *FilePathList;\r | |
82 | BDS_LOADER_OPTIONAL_DATA *OptionalData;\r | |
83 | } BDS_LOAD_OPTION;\r | |
84 | \r | |
85 | typedef struct _BDS_LOAD_OPTION_SUPPORT {\r | |
86 | BDS_SUPPORTED_DEVICE_TYPE Type;\r | |
87 | EFI_STATUS (*ListDevices)(IN OUT LIST_ENTRY* BdsLoadOptionList);\r | |
88 | BOOLEAN (*IsSupported)(IN BDS_LOAD_OPTION* BdsLoadOption);\r | |
89 | EFI_STATUS (*CreateDevicePathNode)(IN BDS_SUPPORTED_DEVICE* BdsLoadOption, OUT EFI_DEVICE_PATH_PROTOCOL **DevicePathNode, OUT BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);\r | |
90 | EFI_STATUS (*UpdateDevicePathNode)(IN BDS_LOAD_OPTION *BootOption, OUT EFI_DEVICE_PATH_PROTOCOL** NewDevicePath, OUT BDS_LOADER_TYPE *BootType, OUT UINT32 *Attributes);\r | |
91 | } BDS_LOAD_OPTION_SUPPORT;\r | |
92 | \r | |
93 | #define LOAD_OPTION_FROM_LINK(a) BASE_CR(a, BDS_LOAD_OPTION, Link)\r | |
94 | \r | |
95 | EFI_STATUS\r | |
96 | GetEnvironmentVariable (\r | |
97 | IN CONST CHAR16* VariableName,\r | |
98 | IN VOID* DefaultValue,\r | |
99 | IN OUT UINTN* Size,\r | |
100 | OUT VOID** Value\r | |
101 | );\r | |
102 | \r | |
103 | EFI_STATUS\r | |
104 | BootDeviceListSupportedInit (\r | |
105 | IN OUT LIST_ENTRY *SupportedDeviceList\r | |
106 | );\r | |
107 | \r | |
108 | EFI_STATUS\r | |
109 | BootDeviceListSupportedFree (\r | |
110 | IN LIST_ENTRY *SupportedDeviceList\r | |
111 | );\r | |
112 | \r | |
113 | EFI_STATUS\r | |
114 | BootDeviceGetDeviceSupport (\r | |
115 | IN BDS_LOAD_OPTION *BootOption,\r | |
116 | OUT BDS_LOAD_OPTION_SUPPORT** DeviceSupport\r | |
117 | );\r | |
118 | \r | |
119 | EFI_STATUS\r | |
120 | GetHIInputAscii (\r | |
121 | IN OUT CHAR8 *CmdLine,\r | |
122 | IN UINTN MaxCmdLine\r | |
123 | );\r | |
124 | \r | |
125 | EFI_STATUS\r | |
126 | EditHIInputAscii (\r | |
127 | IN OUT CHAR8 *CmdLine,\r | |
128 | IN UINTN MaxCmdLine\r | |
129 | );\r | |
130 | \r | |
131 | EFI_STATUS\r | |
132 | GetHIInputInteger (\r | |
133 | IN OUT UINTN *Integer\r | |
134 | );\r | |
135 | \r | |
136 | EFI_STATUS\r | |
137 | GetHIInputIP (\r | |
138 | OUT EFI_IP_ADDRESS *Ip\r | |
139 | );\r | |
140 | \r | |
141 | EFI_STATUS\r | |
142 | GetHIInputBoolean (\r | |
143 | OUT BOOLEAN *Value\r | |
144 | );\r | |
145 | \r | |
146 | BOOLEAN\r | |
147 | HasFilePathEfiExtension (\r | |
148 | IN CHAR16* FilePath\r | |
149 | );\r | |
150 | \r | |
151 | EFI_DEVICE_PATH*\r | |
152 | GetLastDevicePathNode (\r | |
153 | IN EFI_DEVICE_PATH* DevicePath\r | |
154 | );\r | |
155 | \r | |
156 | EFI_STATUS\r | |
157 | BdsStartBootOption (\r | |
158 | IN CHAR16* BootOption\r | |
159 | );\r | |
160 | \r | |
161 | EFI_STATUS\r | |
162 | GenerateDeviceDescriptionName (\r | |
163 | IN EFI_HANDLE Handle,\r | |
164 | IN OUT CHAR16* Description\r | |
165 | );\r | |
166 | \r | |
167 | EFI_STATUS\r | |
168 | BootOptionList (\r | |
169 | IN OUT LIST_ENTRY *BootOptionList\r | |
170 | );\r | |
171 | \r | |
172 | EFI_STATUS\r | |
173 | BootOptionParseLoadOption (\r | |
174 | IN EFI_LOAD_OPTION EfiLoadOption,\r | |
175 | IN UINTN EfiLoadOptionSize,\r | |
176 | OUT BDS_LOAD_OPTION **BdsLoadOption\r | |
177 | );\r | |
178 | \r | |
179 | EFI_STATUS\r | |
180 | BootOptionStart (\r | |
181 | IN BDS_LOAD_OPTION *BootOption\r | |
182 | );\r | |
183 | \r | |
184 | EFI_STATUS\r | |
185 | BootOptionCreate (\r | |
186 | IN UINT32 Attributes,\r | |
187 | IN CHAR16* BootDescription,\r | |
188 | IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r | |
189 | IN BDS_LOADER_TYPE BootType,\r | |
190 | IN CHAR8* BootArguments,\r | |
191 | OUT BDS_LOAD_OPTION **BdsLoadOption\r | |
192 | );\r | |
193 | \r | |
194 | EFI_STATUS\r | |
195 | BootOptionUpdate (\r | |
196 | IN BDS_LOAD_OPTION *BdsLoadOption,\r | |
197 | IN UINT32 Attributes,\r | |
198 | IN CHAR16* BootDescription,\r | |
199 | IN EFI_DEVICE_PATH_PROTOCOL* DevicePath,\r | |
200 | IN BDS_LOADER_TYPE BootType,\r | |
201 | IN CHAR8* BootArguments\r | |
202 | );\r | |
203 | \r | |
204 | EFI_STATUS\r | |
205 | BootOptionDelete (\r | |
206 | IN BDS_LOAD_OPTION *BootOption\r | |
207 | );\r | |
208 | \r | |
209 | EFI_STATUS\r | |
210 | BootMenuMain (\r | |
211 | VOID\r | |
212 | );\r | |
213 | \r | |
214 | #endif /* _BDSINTERNAL_H_ */\r |