]>
Commit | Line | Data |
---|---|---|
5d73d92f | 1 | /** @file\r |
2 | Main file for NULL named library for Profile1 shell command functions.\r | |
3 | \r | |
ba0014b9 | 4 | Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>\r |
5d73d92f | 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 | |
a1d4bfcc | 15 | #ifndef _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_\r |
3737ac2b | 16 | #define _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_\r |
17 | \r | |
5d73d92f | 18 | #include <Uefi.h>\r |
5d73d92f | 19 | \r |
20 | #include <Guid/GlobalVariable.h>\r | |
21 | #include <Guid/ConsoleInDevice.h>\r | |
22 | #include <Guid/ConsoleOutDevice.h>\r | |
3737ac2b | 23 | #include <Guid/FileSystemInfo.h>\r |
bca163ff | 24 | #include <Guid/ShellLibHiiGuid.h>\r |
5d73d92f | 25 | \r |
28165f24 RN |
26 | #include <Protocol/Shell.h>\r |
27 | #include <Protocol/ShellParameters.h>\r | |
5d73d92f | 28 | #include <Protocol/DevicePath.h>\r |
29 | #include <Protocol/LoadedImage.h>\r | |
30 | #include <Protocol/UnicodeCollation.h>\r | |
5d73d92f | 31 | #include <Protocol/DriverDiagnostics2.h>\r |
32 | #include <Protocol/DriverDiagnostics.h>\r | |
33 | #include <Protocol/PlatformDriverOverride.h>\r | |
34 | #include <Protocol/BusSpecificDriverOverride.h>\r | |
35 | #include <Protocol/PlatformToDriverConfiguration.h>\r | |
36 | #include <Protocol/DriverSupportedEfiVersion.h>\r | |
37 | #include <Protocol/DriverFamilyOverride.h>\r | |
38 | #include <Protocol/DriverHealth.h>\r | |
3737ac2b | 39 | #include <Protocol/SimplePointer.h>\r |
304316f4 | 40 | #include <Protocol/CpuIo2.h>\r |
3737ac2b | 41 | #include <Protocol/PciRootBridgeIo.h>\r |
5d73d92f | 42 | \r |
43 | #include <Library/BaseLib.h>\r | |
44 | #include <Library/BaseMemoryLib.h>\r | |
45 | #include <Library/DebugLib.h>\r | |
46 | #include <Library/MemoryAllocationLib.h>\r | |
47 | #include <Library/PcdLib.h>\r | |
48 | #include <Library/ShellCommandLib.h>\r | |
49 | #include <Library/ShellLib.h>\r | |
50 | #include <Library/SortLib.h>\r | |
51 | #include <Library/UefiLib.h>\r | |
52 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
53 | #include <Library/UefiBootServicesTableLib.h>\r | |
54 | #include <Library/HiiLib.h>\r | |
55 | #include <Library/FileHandleLib.h>\r | |
56 | #include <Library/DevicePathLib.h>\r | |
57 | #include <Library/PrintLib.h>\r | |
58 | #include <Library/HandleParsingLib.h>\r | |
59 | \r | |
60 | \r | |
61 | extern EFI_HANDLE gShellDebug1HiiHandle;\r | |
5d73d92f | 62 | \r |
5d73d92f | 63 | /**\r |
64 | Function returns a system configuration table that is stored in the\r | |
65 | EFI System Table based on the provided GUID.\r | |
66 | \r | |
4ff7e37b ED |
67 | @param[in] TableGuid A pointer to the table's GUID type.\r |
68 | @param[in, out] Table On exit, a pointer to a system configuration table.\r | |
5d73d92f | 69 | \r |
70 | @retval EFI_SUCCESS A configuration table matching TableGuid was found.\r | |
71 | @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found.\r | |
72 | **/\r | |
73 | EFI_STATUS\r | |
5d73d92f | 74 | GetSystemConfigurationTable (\r |
75 | IN EFI_GUID *TableGuid,\r | |
76 | IN OUT VOID **Table\r | |
77 | );\r | |
78 | \r | |
5d73d92f | 79 | /**\r |
80 | Function for 'setsize' command.\r | |
81 | \r | |
82 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
83 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
84 | **/\r | |
85 | SHELL_STATUS\r | |
86 | EFIAPI\r | |
87 | ShellCommandRunSetSize (\r | |
88 | IN EFI_HANDLE ImageHandle,\r | |
89 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
90 | );\r | |
91 | \r | |
92 | /**\r | |
93 | Function for 'comp' command.\r | |
94 | \r | |
95 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
96 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
97 | **/\r | |
98 | SHELL_STATUS\r | |
99 | EFIAPI\r | |
100 | ShellCommandRunComp (\r | |
101 | IN EFI_HANDLE ImageHandle,\r | |
102 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
103 | );\r | |
104 | \r | |
105 | /**\r | |
106 | Function for 'mode' command.\r | |
107 | \r | |
108 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
109 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
110 | **/\r | |
111 | SHELL_STATUS\r | |
112 | EFIAPI\r | |
113 | ShellCommandRunMode (\r | |
114 | IN EFI_HANDLE ImageHandle,\r | |
115 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
116 | );\r | |
117 | \r | |
118 | /**\r | |
119 | Function for 'memmap' command.\r | |
120 | \r | |
121 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
122 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
123 | **/\r | |
124 | SHELL_STATUS\r | |
125 | EFIAPI\r | |
126 | ShellCommandRunMemMap (\r | |
127 | IN EFI_HANDLE ImageHandle,\r | |
128 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
129 | );\r | |
130 | \r | |
131 | /**\r | |
132 | Function for 'compress' command.\r | |
133 | \r | |
134 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
135 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
136 | **/\r | |
137 | SHELL_STATUS\r | |
138 | EFIAPI\r | |
139 | ShellCommandRunEfiCompress (\r | |
140 | IN EFI_HANDLE ImageHandle,\r | |
141 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
142 | );\r | |
143 | \r | |
144 | /**\r | |
145 | Function for 'decompress' command.\r | |
146 | \r | |
147 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
148 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
149 | **/\r | |
150 | SHELL_STATUS\r | |
151 | EFIAPI\r | |
152 | ShellCommandRunEfiDecompress (\r | |
153 | IN EFI_HANDLE ImageHandle,\r | |
154 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
155 | );\r | |
156 | \r | |
157 | /**\r | |
158 | Function for 'dmem' command.\r | |
159 | \r | |
160 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
161 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
162 | **/\r | |
163 | SHELL_STATUS\r | |
164 | EFIAPI\r | |
165 | ShellCommandRunDmem (\r | |
166 | IN EFI_HANDLE ImageHandle,\r | |
167 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
168 | );\r | |
169 | \r | |
170 | /**\r | |
171 | Function for 'loadpcirom' command.\r | |
172 | \r | |
173 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
174 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
175 | **/\r | |
176 | SHELL_STATUS\r | |
177 | EFIAPI\r | |
178 | ShellCommandRunLoadPciRom (\r | |
179 | IN EFI_HANDLE ImageHandle,\r | |
180 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
181 | );\r | |
182 | \r | |
183 | /**\r | |
184 | Function for 'mm' command.\r | |
185 | \r | |
186 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
187 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
188 | **/\r | |
189 | SHELL_STATUS\r | |
190 | EFIAPI\r | |
191 | ShellCommandRunMm (\r | |
192 | IN EFI_HANDLE ImageHandle,\r | |
193 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
194 | );\r | |
195 | \r | |
196 | /**\r | |
197 | Function for 'setvar' command.\r | |
198 | \r | |
199 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
200 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
201 | **/\r | |
202 | SHELL_STATUS\r | |
203 | EFIAPI\r | |
204 | ShellCommandRunSetVar (\r | |
205 | IN EFI_HANDLE ImageHandle,\r | |
206 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
207 | );\r | |
208 | \r | |
209 | /**\r | |
210 | Function for 'sermode' command.\r | |
211 | \r | |
212 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
213 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
214 | **/\r | |
215 | SHELL_STATUS\r | |
216 | EFIAPI\r | |
217 | ShellCommandRunSerMode (\r | |
218 | IN EFI_HANDLE ImageHandle,\r | |
219 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
220 | );\r | |
221 | \r | |
222 | /**\r | |
223 | Function for 'bcfg' command.\r | |
224 | \r | |
225 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
226 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
227 | **/\r | |
228 | SHELL_STATUS\r | |
229 | EFIAPI\r | |
230 | ShellCommandRunBcfg (\r | |
231 | IN EFI_HANDLE ImageHandle,\r | |
232 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
233 | );\r | |
234 | \r | |
235 | /**\r | |
236 | Function for 'pci' command.\r | |
237 | \r | |
238 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
239 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
240 | **/\r | |
241 | SHELL_STATUS\r | |
242 | EFIAPI\r | |
243 | ShellCommandRunPci (\r | |
244 | IN EFI_HANDLE ImageHandle,\r | |
245 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
246 | );\r | |
247 | \r | |
248 | /**\r | |
249 | Function for 'smbiosview' command.\r | |
250 | \r | |
251 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
252 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
253 | **/\r | |
254 | SHELL_STATUS\r | |
255 | EFIAPI\r | |
256 | ShellCommandRunSmbiosView (\r | |
257 | IN EFI_HANDLE ImageHandle,\r | |
258 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
259 | );\r | |
260 | \r | |
261 | /**\r | |
262 | Function for 'dmpstore' command.\r | |
263 | \r | |
264 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
265 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
266 | **/\r | |
267 | SHELL_STATUS\r | |
268 | EFIAPI\r | |
269 | ShellCommandRunDmpStore (\r | |
270 | IN EFI_HANDLE ImageHandle,\r | |
271 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
272 | );\r | |
273 | \r | |
274 | /**\r | |
275 | Function for 'dblk' command.\r | |
276 | \r | |
277 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
278 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
279 | **/\r | |
280 | SHELL_STATUS\r | |
281 | EFIAPI\r | |
282 | ShellCommandRunDblk (\r | |
283 | IN EFI_HANDLE ImageHandle,\r | |
284 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
285 | );\r | |
286 | \r | |
3737ac2b | 287 | /**\r |
288 | Function for 'edit' command.\r | |
289 | \r | |
290 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
291 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
292 | **/\r | |
293 | SHELL_STATUS\r | |
294 | EFIAPI\r | |
295 | ShellCommandRunEdit (\r | |
296 | IN EFI_HANDLE ImageHandle,\r | |
297 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
298 | );\r | |
299 | \r | |
300 | /**\r | |
301 | Function for 'hexedit' command.\r | |
302 | \r | |
303 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
304 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
305 | **/\r | |
306 | SHELL_STATUS\r | |
307 | EFIAPI\r | |
308 | ShellCommandRunHexEdit (\r | |
309 | IN EFI_HANDLE ImageHandle,\r | |
310 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
311 | );\r | |
312 | \r | |
3737ac2b | 313 | /**\r |
314 | Clear the line at the specified Row.\r | |
ba0014b9 | 315 | \r |
3737ac2b | 316 | @param[in] Row The row number to be cleared ( start from 1 )\r |
317 | @param[in] LastCol The last printable column.\r | |
318 | @param[in] LastRow The last printable row.\r | |
319 | **/\r | |
320 | VOID\r | |
3737ac2b | 321 | EditorClearLine (\r |
322 | IN UINTN Row,\r | |
323 | IN UINTN LastCol,\r | |
324 | IN UINTN LastRow\r | |
325 | );\r | |
326 | \r | |
327 | /**\r | |
328 | Check if file name has illegal characters.\r | |
ba0014b9 | 329 | \r |
3737ac2b | 330 | @param Name The filename to check.\r |
331 | \r | |
332 | @retval TRUE The filename is ok.\r | |
333 | @retval FALSE The filename is not ok.\r | |
334 | **/\r | |
335 | BOOLEAN\r | |
3737ac2b | 336 | IsValidFileName (\r |
337 | IN CONST CHAR16 *Name\r | |
338 | );\r | |
339 | \r | |
340 | /**\r | |
341 | Find a filename that is valid (not taken) with the given extension.\r | |
342 | \r | |
343 | @param[in] Extension The file extension.\r | |
344 | \r | |
345 | @retval NULL Something went wrong.\r | |
346 | @return the valid filename.\r | |
347 | **/\r | |
348 | CHAR16 *\r | |
3737ac2b | 349 | EditGetDefaultFileName (\r |
350 | IN CONST CHAR16 *Extension\r | |
351 | );\r | |
352 | \r | |
353 | /**\r | |
ba0014b9 | 354 | Read a file into an allocated buffer. The buffer is the responsibility\r |
3737ac2b | 355 | of the caller to free.\r |
356 | \r | |
357 | @param[in] FileName The filename of the file to open.\r | |
ba0014b9 LG |
358 | @param[out] Buffer Upon successful return, the pointer to the\r |
359 | address of the allocated buffer.\r | |
3737ac2b | 360 | @param[out] BufferSize If not NULL, then the pointer to the size\r |
361 | of the allocated buffer.\r | |
362 | @param[out] ReadOnly Upon successful return TRUE if the file is\r | |
363 | read only. FALSE otherwise.\r | |
364 | \r | |
ba0014b9 | 365 | @retval EFI_NOT_FOUND The filename did not represent a file in the\r |
3737ac2b | 366 | file system. Directories cannot be read with\r |
367 | this method.\r | |
368 | @retval EFI_SUCCESS The file was read into the buffer.\r | |
369 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
370 | @retval EFI_LOAD_ERROR The file read operation failed.\r | |
371 | @retval EFI_INVALID_PARAMETER A parameter was invalid.\r | |
372 | @retval EFI_INVALID_PARAMETER FileName was NULL.\r | |
373 | @retval EFI_INVALID_PARAMETER FileName was a directory.\r | |
374 | **/\r | |
375 | EFI_STATUS\r | |
3737ac2b | 376 | ReadFileIntoBuffer (\r |
377 | IN CONST CHAR16 *FileName,\r | |
378 | OUT VOID **Buffer,\r | |
379 | OUT UINTN *BufferSize OPTIONAL,\r | |
380 | OUT BOOLEAN *ReadOnly\r | |
381 | );\r | |
5d73d92f | 382 | \r |
3737ac2b | 383 | #endif\r |