]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Main file for NULL named library for Profile1 shell command functions.\r | |
3 | \r | |
4 | Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\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 _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_\r | |
16 | #define _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_\r | |
17 | \r | |
18 | #include <Uefi.h>\r | |
19 | #include <ShellBase.h>\r | |
20 | \r | |
21 | #include <Guid/GlobalVariable.h>\r | |
22 | #include <Guid/ConsoleInDevice.h>\r | |
23 | #include <Guid/ConsoleOutDevice.h>\r | |
24 | #include <Guid/FileSystemInfo.h>\r | |
25 | \r | |
26 | #include <Protocol/EfiShell.h>\r | |
27 | #include <Protocol/EfiShellParameters.h>\r | |
28 | #include <Protocol/DevicePath.h>\r | |
29 | #include <Protocol/LoadedImage.h>\r | |
30 | #include <Protocol/UnicodeCollation.h>\r | |
31 | #include <Protocol/DevicePathToText.h>\r | |
32 | #include <Protocol/DriverDiagnostics2.h>\r | |
33 | #include <Protocol/DriverDiagnostics.h>\r | |
34 | #include <Protocol/PlatformDriverOverride.h>\r | |
35 | #include <Protocol/BusSpecificDriverOverride.h>\r | |
36 | #include <Protocol/PlatformToDriverConfiguration.h>\r | |
37 | #include <Protocol/DriverSupportedEfiVersion.h>\r | |
38 | #include <Protocol/DriverFamilyOverride.h>\r | |
39 | #include <Protocol/DriverHealth.h>\r | |
40 | #include <Protocol/DevicePathFromText.h>\r | |
41 | #include <Protocol/SimplePointer.h>\r | |
42 | #include <Protocol/PciRootBridgeIo.h>\r | |
43 | \r | |
44 | #include <Library/BaseLib.h>\r | |
45 | #include <Library/BaseMemoryLib.h>\r | |
46 | #include <Library/DebugLib.h>\r | |
47 | #include <Library/MemoryAllocationLib.h>\r | |
48 | #include <Library/PcdLib.h>\r | |
49 | #include <Library/ShellCommandLib.h>\r | |
50 | #include <Library/ShellLib.h>\r | |
51 | #include <Library/SortLib.h>\r | |
52 | #include <Library/UefiLib.h>\r | |
53 | #include <Library/UefiRuntimeServicesTableLib.h>\r | |
54 | #include <Library/UefiBootServicesTableLib.h>\r | |
55 | #include <Library/HiiLib.h>\r | |
56 | #include <Library/FileHandleLib.h>\r | |
57 | #include <Library/DevicePathLib.h>\r | |
58 | #include <Library/PrintLib.h>\r | |
59 | #include <Library/HandleParsingLib.h>\r | |
60 | \r | |
61 | \r | |
62 | extern EFI_HANDLE gShellDebug1HiiHandle;\r | |
63 | extern CONST EFI_GUID gShellDebug1HiiGuid;\r | |
64 | \r | |
65 | /**\r | |
66 | Function printing hex output to the console.\r | |
67 | \r | |
68 | @param[in] Indent Number of spaces to indent.\r | |
69 | @param[in] Offset Offset to start with.\r | |
70 | @param[in] DataSize Length of data.\r | |
71 | @param[in] UserData Pointer to some data.\r | |
72 | **/\r | |
73 | VOID\r | |
74 | DumpHex (\r | |
75 | IN UINTN Indent,\r | |
76 | IN UINTN Offset,\r | |
77 | IN UINTN DataSize,\r | |
78 | IN VOID *UserData\r | |
79 | );\r | |
80 | \r | |
81 | /**\r | |
82 | Function returns a system configuration table that is stored in the\r | |
83 | EFI System Table based on the provided GUID.\r | |
84 | \r | |
85 | @param[in] TableGuid A pointer to the table's GUID type.\r | |
86 | @param[in,out] Table On exit, a pointer to a system configuration table.\r | |
87 | \r | |
88 | @retval EFI_SUCCESS A configuration table matching TableGuid was found.\r | |
89 | @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found.\r | |
90 | **/\r | |
91 | EFI_STATUS\r | |
92 | EFIAPI\r | |
93 | GetSystemConfigurationTable (\r | |
94 | IN EFI_GUID *TableGuid,\r | |
95 | IN OUT VOID **Table\r | |
96 | );\r | |
97 | \r | |
98 | /**\r | |
99 | Convert a string representation of a GUID to the GUID value.\r | |
100 | \r | |
101 | @param[in] StringGuid The pointer to the string containing a GUID printed.\r | |
102 | @param[in,out] Guid The pointer to the buffer to get the GUID value.\r | |
103 | **/\r | |
104 | EFI_STATUS\r | |
105 | EFIAPI\r | |
106 | ConvertStringToGuid (\r | |
107 | IN CONST CHAR16 *StringGuid,\r | |
108 | IN OUT EFI_GUID *Guid\r | |
109 | );\r | |
110 | \r | |
111 | /**\r | |
112 | Convert a Unicode character to numerical value.\r | |
113 | \r | |
114 | This internal function only deal with Unicode character\r | |
115 | which maps to a valid hexadecimal ASII character, i.e.\r | |
116 | L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other\r | |
117 | Unicode character, the value returned does not make sense.\r | |
118 | \r | |
119 | @param Char The character to convert.\r | |
120 | \r | |
121 | @return The numerical value converted.\r | |
122 | \r | |
123 | **/\r | |
124 | UINTN\r | |
125 | EFIAPI\r | |
126 | HexCharToUintn (\r | |
127 | IN CHAR16 Char\r | |
128 | );\r | |
129 | \r | |
130 | /**\r | |
131 | Function for 'setsize' command.\r | |
132 | \r | |
133 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
134 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
135 | **/\r | |
136 | SHELL_STATUS\r | |
137 | EFIAPI\r | |
138 | ShellCommandRunSetSize (\r | |
139 | IN EFI_HANDLE ImageHandle,\r | |
140 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
141 | );\r | |
142 | \r | |
143 | /**\r | |
144 | Function for 'comp' command.\r | |
145 | \r | |
146 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
147 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
148 | **/\r | |
149 | SHELL_STATUS\r | |
150 | EFIAPI\r | |
151 | ShellCommandRunComp (\r | |
152 | IN EFI_HANDLE ImageHandle,\r | |
153 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
154 | );\r | |
155 | \r | |
156 | /**\r | |
157 | Function for 'mode' command.\r | |
158 | \r | |
159 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
160 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
161 | **/\r | |
162 | SHELL_STATUS\r | |
163 | EFIAPI\r | |
164 | ShellCommandRunMode (\r | |
165 | IN EFI_HANDLE ImageHandle,\r | |
166 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
167 | );\r | |
168 | \r | |
169 | /**\r | |
170 | Function for 'memmap' command.\r | |
171 | \r | |
172 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
173 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
174 | **/\r | |
175 | SHELL_STATUS\r | |
176 | EFIAPI\r | |
177 | ShellCommandRunMemMap (\r | |
178 | IN EFI_HANDLE ImageHandle,\r | |
179 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
180 | );\r | |
181 | \r | |
182 | /**\r | |
183 | Function for 'compress' command.\r | |
184 | \r | |
185 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
186 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
187 | **/\r | |
188 | SHELL_STATUS\r | |
189 | EFIAPI\r | |
190 | ShellCommandRunEfiCompress (\r | |
191 | IN EFI_HANDLE ImageHandle,\r | |
192 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
193 | );\r | |
194 | \r | |
195 | /**\r | |
196 | Function for 'decompress' command.\r | |
197 | \r | |
198 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
199 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
200 | **/\r | |
201 | SHELL_STATUS\r | |
202 | EFIAPI\r | |
203 | ShellCommandRunEfiDecompress (\r | |
204 | IN EFI_HANDLE ImageHandle,\r | |
205 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
206 | );\r | |
207 | \r | |
208 | /**\r | |
209 | Function for 'dmem' command.\r | |
210 | \r | |
211 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
212 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
213 | **/\r | |
214 | SHELL_STATUS\r | |
215 | EFIAPI\r | |
216 | ShellCommandRunDmem (\r | |
217 | IN EFI_HANDLE ImageHandle,\r | |
218 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
219 | );\r | |
220 | \r | |
221 | /**\r | |
222 | Function for 'loadpcirom' command.\r | |
223 | \r | |
224 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
225 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
226 | **/\r | |
227 | SHELL_STATUS\r | |
228 | EFIAPI\r | |
229 | ShellCommandRunLoadPciRom (\r | |
230 | IN EFI_HANDLE ImageHandle,\r | |
231 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
232 | );\r | |
233 | \r | |
234 | /**\r | |
235 | Function for 'mm' command.\r | |
236 | \r | |
237 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
238 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
239 | **/\r | |
240 | SHELL_STATUS\r | |
241 | EFIAPI\r | |
242 | ShellCommandRunMm (\r | |
243 | IN EFI_HANDLE ImageHandle,\r | |
244 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
245 | );\r | |
246 | \r | |
247 | /**\r | |
248 | Function for 'setvar' command.\r | |
249 | \r | |
250 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
251 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
252 | **/\r | |
253 | SHELL_STATUS\r | |
254 | EFIAPI\r | |
255 | ShellCommandRunSetVar (\r | |
256 | IN EFI_HANDLE ImageHandle,\r | |
257 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
258 | );\r | |
259 | \r | |
260 | /**\r | |
261 | Function for 'sermode' command.\r | |
262 | \r | |
263 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
264 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
265 | **/\r | |
266 | SHELL_STATUS\r | |
267 | EFIAPI\r | |
268 | ShellCommandRunSerMode (\r | |
269 | IN EFI_HANDLE ImageHandle,\r | |
270 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
271 | );\r | |
272 | \r | |
273 | /**\r | |
274 | Function for 'bcfg' command.\r | |
275 | \r | |
276 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
277 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
278 | **/\r | |
279 | SHELL_STATUS\r | |
280 | EFIAPI\r | |
281 | ShellCommandRunBcfg (\r | |
282 | IN EFI_HANDLE ImageHandle,\r | |
283 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
284 | );\r | |
285 | \r | |
286 | /**\r | |
287 | Function for 'pci' command.\r | |
288 | \r | |
289 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
290 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
291 | **/\r | |
292 | SHELL_STATUS\r | |
293 | EFIAPI\r | |
294 | ShellCommandRunPci (\r | |
295 | IN EFI_HANDLE ImageHandle,\r | |
296 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
297 | );\r | |
298 | \r | |
299 | /**\r | |
300 | Function for 'smbiosview' command.\r | |
301 | \r | |
302 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
303 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
304 | **/\r | |
305 | SHELL_STATUS\r | |
306 | EFIAPI\r | |
307 | ShellCommandRunSmbiosView (\r | |
308 | IN EFI_HANDLE ImageHandle,\r | |
309 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
310 | );\r | |
311 | \r | |
312 | /**\r | |
313 | Function for 'dmpstore' command.\r | |
314 | \r | |
315 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
316 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
317 | **/\r | |
318 | SHELL_STATUS\r | |
319 | EFIAPI\r | |
320 | ShellCommandRunDmpStore (\r | |
321 | IN EFI_HANDLE ImageHandle,\r | |
322 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
323 | );\r | |
324 | \r | |
325 | /**\r | |
326 | Function for 'dblk' command.\r | |
327 | \r | |
328 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
329 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
330 | **/\r | |
331 | SHELL_STATUS\r | |
332 | EFIAPI\r | |
333 | ShellCommandRunDblk (\r | |
334 | IN EFI_HANDLE ImageHandle,\r | |
335 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
336 | );\r | |
337 | \r | |
338 | /**\r | |
339 | Function for 'edit' command.\r | |
340 | \r | |
341 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
342 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
343 | **/\r | |
344 | SHELL_STATUS\r | |
345 | EFIAPI\r | |
346 | ShellCommandRunEdit (\r | |
347 | IN EFI_HANDLE ImageHandle,\r | |
348 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
349 | );\r | |
350 | \r | |
351 | /**\r | |
352 | Function for 'hexedit' command.\r | |
353 | \r | |
354 | @param[in] ImageHandle Handle to the Image (NULL if Internal).\r | |
355 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r | |
356 | **/\r | |
357 | SHELL_STATUS\r | |
358 | EFIAPI\r | |
359 | ShellCommandRunHexEdit (\r | |
360 | IN EFI_HANDLE ImageHandle,\r | |
361 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
362 | );\r | |
363 | \r | |
364 | /** \r | |
365 | Appends a formatted Unicode string to a Null-terminated Unicode string\r | |
366 | \r | |
367 | This function appends a formatted Unicode string to the Null-terminated \r | |
368 | Unicode string specified by String. String is optional and may be NULL.\r | |
369 | Storage for the formatted Unicode string returned is allocated using \r | |
370 | AllocateZeroPool(). The pointer to the appended string is returned. The caller\r | |
371 | is responsible for freeing the returned string.\r | |
372 | \r | |
373 | If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().\r | |
374 | If Format is NULL, then ASSERT().\r | |
375 | If Format is not aligned on a 16-bit boundary, then ASSERT().\r | |
376 | \r | |
377 | @param String A null-terminated Unicode string.\r | |
378 | @param FormatString A null-terminated Unicode format string.\r | |
379 | @param ... The variable argument list whose contents are accessed based \r | |
380 | on the format string specified by Format.\r | |
381 | \r | |
382 | @retval NULL There was not enough available memory.\r | |
383 | @return Null terminated Unicode string is that is the formatted \r | |
384 | string appended to String.\r | |
385 | @sa CatVSPrint\r | |
386 | **/\r | |
387 | CHAR16*\r | |
388 | EFIAPI\r | |
389 | CatSPrint (\r | |
390 | IN CONST CHAR16 *String OPTIONAL,\r | |
391 | IN CONST CHAR16 *FormatString,\r | |
392 | ...\r | |
393 | );\r | |
394 | \r | |
395 | /**\r | |
396 | Clear the line at the specified Row.\r | |
397 | \r | |
398 | @param[in] Row The row number to be cleared ( start from 1 )\r | |
399 | @param[in] LastCol The last printable column.\r | |
400 | @param[in] LastRow The last printable row.\r | |
401 | **/\r | |
402 | VOID\r | |
403 | EFIAPI\r | |
404 | EditorClearLine (\r | |
405 | IN UINTN Row,\r | |
406 | IN UINTN LastCol,\r | |
407 | IN UINTN LastRow\r | |
408 | );\r | |
409 | \r | |
410 | /**\r | |
411 | Check if file name has illegal characters.\r | |
412 | \r | |
413 | @param Name The filename to check.\r | |
414 | \r | |
415 | @retval TRUE The filename is ok.\r | |
416 | @retval FALSE The filename is not ok.\r | |
417 | **/\r | |
418 | BOOLEAN\r | |
419 | EFIAPI\r | |
420 | IsValidFileName (\r | |
421 | IN CONST CHAR16 *Name\r | |
422 | );\r | |
423 | \r | |
424 | /**\r | |
425 | Find a filename that is valid (not taken) with the given extension.\r | |
426 | \r | |
427 | @param[in] Extension The file extension.\r | |
428 | \r | |
429 | @retval NULL Something went wrong.\r | |
430 | @return the valid filename.\r | |
431 | **/\r | |
432 | CHAR16 *\r | |
433 | EFIAPI\r | |
434 | EditGetDefaultFileName (\r | |
435 | IN CONST CHAR16 *Extension\r | |
436 | );\r | |
437 | \r | |
438 | /**\r | |
439 | Read a file into an allocated buffer. The buffer is the responsibility \r | |
440 | of the caller to free.\r | |
441 | \r | |
442 | @param[in] FileName The filename of the file to open.\r | |
443 | @param[out] Buffer Upon successful return, the pointer to the \r | |
444 | address of the allocated buffer. \r | |
445 | @param[out] BufferSize If not NULL, then the pointer to the size\r | |
446 | of the allocated buffer.\r | |
447 | @param[out] ReadOnly Upon successful return TRUE if the file is\r | |
448 | read only. FALSE otherwise.\r | |
449 | \r | |
450 | @retval EFI_NOT_FOUND The filename did not represent a file in the \r | |
451 | file system. Directories cannot be read with\r | |
452 | this method.\r | |
453 | @retval EFI_SUCCESS The file was read into the buffer.\r | |
454 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
455 | @retval EFI_LOAD_ERROR The file read operation failed.\r | |
456 | @retval EFI_INVALID_PARAMETER A parameter was invalid.\r | |
457 | @retval EFI_INVALID_PARAMETER FileName was NULL.\r | |
458 | @retval EFI_INVALID_PARAMETER FileName was a directory.\r | |
459 | **/\r | |
460 | EFI_STATUS\r | |
461 | EFIAPI\r | |
462 | ReadFileIntoBuffer (\r | |
463 | IN CONST CHAR16 *FileName,\r | |
464 | OUT VOID **Buffer,\r | |
465 | OUT UINTN *BufferSize OPTIONAL,\r | |
466 | OUT BOOLEAN *ReadOnly\r | |
467 | );\r | |
468 | \r | |
469 | #endif\r |