2 Main file for NULL named library for Profile1 shell command functions.
4 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15 #if !defined (_UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_)
16 #define _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_
19 #include <ShellBase.h>
21 #include <Guid/GlobalVariable.h>
22 #include <Guid/ConsoleInDevice.h>
23 #include <Guid/ConsoleOutDevice.h>
24 #include <Guid/FileSystemInfo.h>
26 #include <Protocol/EfiShell.h>
27 #include <Protocol/EfiShellParameters.h>
28 #include <Protocol/DevicePath.h>
29 #include <Protocol/LoadedImage.h>
30 #include <Protocol/UnicodeCollation.h>
31 #include <Protocol/DevicePathToText.h>
32 #include <Protocol/DriverDiagnostics2.h>
33 #include <Protocol/DriverDiagnostics.h>
34 #include <Protocol/PlatformDriverOverride.h>
35 #include <Protocol/BusSpecificDriverOverride.h>
36 #include <Protocol/PlatformToDriverConfiguration.h>
37 #include <Protocol/DriverSupportedEfiVersion.h>
38 #include <Protocol/DriverFamilyOverride.h>
39 #include <Protocol/DriverHealth.h>
40 #include <Protocol/DevicePathFromText.h>
41 #include <Protocol/SimplePointer.h>
42 #include <Protocol/PciRootBridgeIo.h>
44 #include <Library/BaseLib.h>
45 #include <Library/BaseMemoryLib.h>
46 #include <Library/DebugLib.h>
47 #include <Library/MemoryAllocationLib.h>
48 #include <Library/PcdLib.h>
49 #include <Library/ShellCommandLib.h>
50 #include <Library/ShellLib.h>
51 #include <Library/SortLib.h>
52 #include <Library/UefiLib.h>
53 #include <Library/UefiRuntimeServicesTableLib.h>
54 #include <Library/UefiBootServicesTableLib.h>
55 #include <Library/HiiLib.h>
56 #include <Library/FileHandleLib.h>
57 #include <Library/DevicePathLib.h>
58 #include <Library/PrintLib.h>
59 #include <Library/HandleParsingLib.h>
62 extern EFI_HANDLE gShellDebug1HiiHandle
;
63 extern CONST EFI_GUID gShellDebug1HiiGuid
;
66 Function printing hex output to the console.
68 @param[in] Indent Number of spaces to indent.
69 @param[in] Offset Offset to start with.
70 @param[in] DataSize Length of data.
71 @param[in] UserData Pointer to some data.
82 Function returns a system configuration table that is stored in the
83 EFI System Table based on the provided GUID.
85 @param[in] TableGuid A pointer to the table's GUID type.
86 @param[in,out] Table On exit, a pointer to a system configuration table.
88 @retval EFI_SUCCESS A configuration table matching TableGuid was found.
89 @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found.
93 GetSystemConfigurationTable (
94 IN EFI_GUID
*TableGuid
,
99 Convert a string representation of a GUID to the GUID value.
101 @param[in] StringGuid The pointer to the string containing a GUID printed.
102 @param[in,out] Guid The pointer to the buffer to get the GUID value.
106 ConvertStringToGuid (
107 IN CONST CHAR16
*StringGuid
,
108 IN OUT EFI_GUID
*Guid
112 Convert a Unicode character to numerical value.
114 This internal function only deal with Unicode character
115 which maps to a valid hexadecimal ASII character, i.e.
116 L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other
117 Unicode character, the value returned does not make sense.
119 @param Char The character to convert.
121 @return The numerical value converted.
131 Function for 'setsize' command.
133 @param[in] ImageHandle Handle to the Image (NULL if Internal).
134 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
138 ShellCommandRunSetSize (
139 IN EFI_HANDLE ImageHandle
,
140 IN EFI_SYSTEM_TABLE
*SystemTable
144 Function for 'comp' command.
146 @param[in] ImageHandle Handle to the Image (NULL if Internal).
147 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
151 ShellCommandRunComp (
152 IN EFI_HANDLE ImageHandle
,
153 IN EFI_SYSTEM_TABLE
*SystemTable
157 Function for 'mode' command.
159 @param[in] ImageHandle Handle to the Image (NULL if Internal).
160 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
164 ShellCommandRunMode (
165 IN EFI_HANDLE ImageHandle
,
166 IN EFI_SYSTEM_TABLE
*SystemTable
170 Function for 'memmap' command.
172 @param[in] ImageHandle Handle to the Image (NULL if Internal).
173 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
177 ShellCommandRunMemMap (
178 IN EFI_HANDLE ImageHandle
,
179 IN EFI_SYSTEM_TABLE
*SystemTable
183 Function for 'compress' command.
185 @param[in] ImageHandle Handle to the Image (NULL if Internal).
186 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
190 ShellCommandRunEfiCompress (
191 IN EFI_HANDLE ImageHandle
,
192 IN EFI_SYSTEM_TABLE
*SystemTable
196 Function for 'decompress' command.
198 @param[in] ImageHandle Handle to the Image (NULL if Internal).
199 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
203 ShellCommandRunEfiDecompress (
204 IN EFI_HANDLE ImageHandle
,
205 IN EFI_SYSTEM_TABLE
*SystemTable
209 Function for 'dmem' command.
211 @param[in] ImageHandle Handle to the Image (NULL if Internal).
212 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
216 ShellCommandRunDmem (
217 IN EFI_HANDLE ImageHandle
,
218 IN EFI_SYSTEM_TABLE
*SystemTable
222 Function for 'loadpcirom' command.
224 @param[in] ImageHandle Handle to the Image (NULL if Internal).
225 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
229 ShellCommandRunLoadPciRom (
230 IN EFI_HANDLE ImageHandle
,
231 IN EFI_SYSTEM_TABLE
*SystemTable
235 Function for 'mm' command.
237 @param[in] ImageHandle Handle to the Image (NULL if Internal).
238 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
243 IN EFI_HANDLE ImageHandle
,
244 IN EFI_SYSTEM_TABLE
*SystemTable
248 Function for 'setvar' command.
250 @param[in] ImageHandle Handle to the Image (NULL if Internal).
251 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
255 ShellCommandRunSetVar (
256 IN EFI_HANDLE ImageHandle
,
257 IN EFI_SYSTEM_TABLE
*SystemTable
261 Function for 'sermode' command.
263 @param[in] ImageHandle Handle to the Image (NULL if Internal).
264 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
268 ShellCommandRunSerMode (
269 IN EFI_HANDLE ImageHandle
,
270 IN EFI_SYSTEM_TABLE
*SystemTable
274 Function for 'bcfg' command.
276 @param[in] ImageHandle Handle to the Image (NULL if Internal).
277 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
281 ShellCommandRunBcfg (
282 IN EFI_HANDLE ImageHandle
,
283 IN EFI_SYSTEM_TABLE
*SystemTable
287 Function for 'pci' command.
289 @param[in] ImageHandle Handle to the Image (NULL if Internal).
290 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
295 IN EFI_HANDLE ImageHandle
,
296 IN EFI_SYSTEM_TABLE
*SystemTable
300 Function for 'smbiosview' command.
302 @param[in] ImageHandle Handle to the Image (NULL if Internal).
303 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
307 ShellCommandRunSmbiosView (
308 IN EFI_HANDLE ImageHandle
,
309 IN EFI_SYSTEM_TABLE
*SystemTable
313 Function for 'dmpstore' command.
315 @param[in] ImageHandle Handle to the Image (NULL if Internal).
316 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
320 ShellCommandRunDmpStore (
321 IN EFI_HANDLE ImageHandle
,
322 IN EFI_SYSTEM_TABLE
*SystemTable
326 Function for 'dblk' command.
328 @param[in] ImageHandle Handle to the Image (NULL if Internal).
329 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
333 ShellCommandRunDblk (
334 IN EFI_HANDLE ImageHandle
,
335 IN EFI_SYSTEM_TABLE
*SystemTable
339 Function for 'edit' command.
341 @param[in] ImageHandle Handle to the Image (NULL if Internal).
342 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
346 ShellCommandRunEdit (
347 IN EFI_HANDLE ImageHandle
,
348 IN EFI_SYSTEM_TABLE
*SystemTable
352 Function for 'hexedit' command.
354 @param[in] ImageHandle Handle to the Image (NULL if Internal).
355 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
359 ShellCommandRunHexEdit (
360 IN EFI_HANDLE ImageHandle
,
361 IN EFI_SYSTEM_TABLE
*SystemTable
365 Appends a formatted Unicode string to a Null-terminated Unicode string
367 This function appends a formatted Unicode string to the Null-terminated
368 Unicode string specified by String. String is optional and may be NULL.
369 Storage for the formatted Unicode string returned is allocated using
370 AllocateZeroPool(). The pointer to the appended string is returned. The caller
371 is responsible for freeing the returned string.
373 If String is not NULL and not aligned on a 16-bit boundary, then ASSERT().
374 If Format is NULL, then ASSERT().
375 If Format is not aligned on a 16-bit boundary, then ASSERT().
377 @param String A null-terminated Unicode string.
378 @param FormatString A null-terminated Unicode format string.
379 @param ... The variable argument list whose contents are accessed based
380 on the format string specified by Format.
382 @retval NULL There was not enough available memory.
383 @return Null terminated Unicode string is that is the formatted
384 string appended to String.
390 IN CONST CHAR16
*String OPTIONAL
,
391 IN CONST CHAR16
*FormatString
,
396 Clear the line at the specified Row.
398 @param[in] Row The row number to be cleared ( start from 1 )
399 @param[in] LastCol The last printable column.
400 @param[in] LastRow The last printable row.
411 Check if file name has illegal characters.
413 @param Name The filename to check.
415 @retval TRUE The filename is ok.
416 @retval FALSE The filename is not ok.
421 IN CONST CHAR16
*Name
425 Find a filename that is valid (not taken) with the given extension.
427 @param[in] Extension The file extension.
429 @retval NULL Something went wrong.
430 @return the valid filename.
434 EditGetDefaultFileName (
435 IN CONST CHAR16
*Extension
439 Read a file into an allocated buffer. The buffer is the responsibility
440 of the caller to free.
442 @param[in] FileName The filename of the file to open.
443 @param[out] Buffer Upon successful return, the pointer to the
444 address of the allocated buffer.
445 @param[out] BufferSize If not NULL, then the pointer to the size
446 of the allocated buffer.
447 @param[out] ReadOnly Upon successful return TRUE if the file is
448 read only. FALSE otherwise.
450 @retval EFI_NOT_FOUND The filename did not represent a file in the
451 file system. Directories cannot be read with
453 @retval EFI_SUCCESS The file was read into the buffer.
454 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
455 @retval EFI_LOAD_ERROR The file read operation failed.
456 @retval EFI_INVALID_PARAMETER A parameter was invalid.
457 @retval EFI_INVALID_PARAMETER FileName was NULL.
458 @retval EFI_INVALID_PARAMETER FileName was a directory.
463 IN CONST CHAR16
*FileName
,
465 OUT UINTN
*BufferSize OPTIONAL
,
466 OUT BOOLEAN
*ReadOnly