]> git.proxmox.com Git - mirror_edk2.git/blob - ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h
3db03c8fab09f2f01261b4b632db2e2992a6e5a0
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / UefiShellDebug1CommandsLib.h
1 /** @file
2 Main file for NULL named library for Profile1 shell command functions.
3
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
9
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.
12
13 **/
14
15 #ifndef _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_
16 #define _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_
17
18 #include <Uefi.h>
19 #include <ShellBase.h>
20
21 #include <Guid/GlobalVariable.h>
22 #include <Guid/ConsoleInDevice.h>
23 #include <Guid/ConsoleOutDevice.h>
24 #include <Guid/FileSystemInfo.h>
25
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>
43
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>
60
61
62 extern EFI_HANDLE gShellDebug1HiiHandle;
63 extern CONST EFI_GUID gShellDebug1HiiGuid;
64
65 /**
66 Function printing hex output to the console.
67
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.
72 **/
73 VOID
74 DumpHex (
75 IN UINTN Indent,
76 IN UINTN Offset,
77 IN UINTN DataSize,
78 IN VOID *UserData
79 );
80
81 /**
82 Function returns a system configuration table that is stored in the
83 EFI System Table based on the provided GUID.
84
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.
87
88 @retval EFI_SUCCESS A configuration table matching TableGuid was found.
89 @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found.
90 **/
91 EFI_STATUS
92 EFIAPI
93 GetSystemConfigurationTable (
94 IN EFI_GUID *TableGuid,
95 IN OUT VOID **Table
96 );
97
98 /**
99 Convert a string representation of a GUID to the GUID value.
100
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.
103 **/
104 EFI_STATUS
105 EFIAPI
106 ConvertStringToGuid (
107 IN CONST CHAR16 *StringGuid,
108 IN OUT EFI_GUID *Guid
109 );
110
111 /**
112 Convert a Unicode character to numerical value.
113
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.
118
119 @param Char The character to convert.
120
121 @return The numerical value converted.
122
123 **/
124 UINTN
125 EFIAPI
126 HexCharToUintn (
127 IN CHAR16 Char
128 );
129
130 /**
131 Function for 'setsize' command.
132
133 @param[in] ImageHandle Handle to the Image (NULL if Internal).
134 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
135 **/
136 SHELL_STATUS
137 EFIAPI
138 ShellCommandRunSetSize (
139 IN EFI_HANDLE ImageHandle,
140 IN EFI_SYSTEM_TABLE *SystemTable
141 );
142
143 /**
144 Function for 'comp' command.
145
146 @param[in] ImageHandle Handle to the Image (NULL if Internal).
147 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
148 **/
149 SHELL_STATUS
150 EFIAPI
151 ShellCommandRunComp (
152 IN EFI_HANDLE ImageHandle,
153 IN EFI_SYSTEM_TABLE *SystemTable
154 );
155
156 /**
157 Function for 'mode' command.
158
159 @param[in] ImageHandle Handle to the Image (NULL if Internal).
160 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
161 **/
162 SHELL_STATUS
163 EFIAPI
164 ShellCommandRunMode (
165 IN EFI_HANDLE ImageHandle,
166 IN EFI_SYSTEM_TABLE *SystemTable
167 );
168
169 /**
170 Function for 'memmap' command.
171
172 @param[in] ImageHandle Handle to the Image (NULL if Internal).
173 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
174 **/
175 SHELL_STATUS
176 EFIAPI
177 ShellCommandRunMemMap (
178 IN EFI_HANDLE ImageHandle,
179 IN EFI_SYSTEM_TABLE *SystemTable
180 );
181
182 /**
183 Function for 'compress' command.
184
185 @param[in] ImageHandle Handle to the Image (NULL if Internal).
186 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
187 **/
188 SHELL_STATUS
189 EFIAPI
190 ShellCommandRunEfiCompress (
191 IN EFI_HANDLE ImageHandle,
192 IN EFI_SYSTEM_TABLE *SystemTable
193 );
194
195 /**
196 Function for 'decompress' command.
197
198 @param[in] ImageHandle Handle to the Image (NULL if Internal).
199 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
200 **/
201 SHELL_STATUS
202 EFIAPI
203 ShellCommandRunEfiDecompress (
204 IN EFI_HANDLE ImageHandle,
205 IN EFI_SYSTEM_TABLE *SystemTable
206 );
207
208 /**
209 Function for 'dmem' command.
210
211 @param[in] ImageHandle Handle to the Image (NULL if Internal).
212 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
213 **/
214 SHELL_STATUS
215 EFIAPI
216 ShellCommandRunDmem (
217 IN EFI_HANDLE ImageHandle,
218 IN EFI_SYSTEM_TABLE *SystemTable
219 );
220
221 /**
222 Function for 'loadpcirom' command.
223
224 @param[in] ImageHandle Handle to the Image (NULL if Internal).
225 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
226 **/
227 SHELL_STATUS
228 EFIAPI
229 ShellCommandRunLoadPciRom (
230 IN EFI_HANDLE ImageHandle,
231 IN EFI_SYSTEM_TABLE *SystemTable
232 );
233
234 /**
235 Function for 'mm' command.
236
237 @param[in] ImageHandle Handle to the Image (NULL if Internal).
238 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
239 **/
240 SHELL_STATUS
241 EFIAPI
242 ShellCommandRunMm (
243 IN EFI_HANDLE ImageHandle,
244 IN EFI_SYSTEM_TABLE *SystemTable
245 );
246
247 /**
248 Function for 'setvar' command.
249
250 @param[in] ImageHandle Handle to the Image (NULL if Internal).
251 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
252 **/
253 SHELL_STATUS
254 EFIAPI
255 ShellCommandRunSetVar (
256 IN EFI_HANDLE ImageHandle,
257 IN EFI_SYSTEM_TABLE *SystemTable
258 );
259
260 /**
261 Function for 'sermode' command.
262
263 @param[in] ImageHandle Handle to the Image (NULL if Internal).
264 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
265 **/
266 SHELL_STATUS
267 EFIAPI
268 ShellCommandRunSerMode (
269 IN EFI_HANDLE ImageHandle,
270 IN EFI_SYSTEM_TABLE *SystemTable
271 );
272
273 /**
274 Function for 'bcfg' command.
275
276 @param[in] ImageHandle Handle to the Image (NULL if Internal).
277 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
278 **/
279 SHELL_STATUS
280 EFIAPI
281 ShellCommandRunBcfg (
282 IN EFI_HANDLE ImageHandle,
283 IN EFI_SYSTEM_TABLE *SystemTable
284 );
285
286 /**
287 Function for 'pci' command.
288
289 @param[in] ImageHandle Handle to the Image (NULL if Internal).
290 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
291 **/
292 SHELL_STATUS
293 EFIAPI
294 ShellCommandRunPci (
295 IN EFI_HANDLE ImageHandle,
296 IN EFI_SYSTEM_TABLE *SystemTable
297 );
298
299 /**
300 Function for 'smbiosview' command.
301
302 @param[in] ImageHandle Handle to the Image (NULL if Internal).
303 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
304 **/
305 SHELL_STATUS
306 EFIAPI
307 ShellCommandRunSmbiosView (
308 IN EFI_HANDLE ImageHandle,
309 IN EFI_SYSTEM_TABLE *SystemTable
310 );
311
312 /**
313 Function for 'dmpstore' command.
314
315 @param[in] ImageHandle Handle to the Image (NULL if Internal).
316 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
317 **/
318 SHELL_STATUS
319 EFIAPI
320 ShellCommandRunDmpStore (
321 IN EFI_HANDLE ImageHandle,
322 IN EFI_SYSTEM_TABLE *SystemTable
323 );
324
325 /**
326 Function for 'dblk' command.
327
328 @param[in] ImageHandle Handle to the Image (NULL if Internal).
329 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
330 **/
331 SHELL_STATUS
332 EFIAPI
333 ShellCommandRunDblk (
334 IN EFI_HANDLE ImageHandle,
335 IN EFI_SYSTEM_TABLE *SystemTable
336 );
337
338 /**
339 Function for 'edit' command.
340
341 @param[in] ImageHandle Handle to the Image (NULL if Internal).
342 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
343 **/
344 SHELL_STATUS
345 EFIAPI
346 ShellCommandRunEdit (
347 IN EFI_HANDLE ImageHandle,
348 IN EFI_SYSTEM_TABLE *SystemTable
349 );
350
351 /**
352 Function for 'hexedit' command.
353
354 @param[in] ImageHandle Handle to the Image (NULL if Internal).
355 @param[in] SystemTable Pointer to the System Table (NULL if Internal).
356 **/
357 SHELL_STATUS
358 EFIAPI
359 ShellCommandRunHexEdit (
360 IN EFI_HANDLE ImageHandle,
361 IN EFI_SYSTEM_TABLE *SystemTable
362 );
363
364 /**
365 Clear the line at the specified Row.
366
367 @param[in] Row The row number to be cleared ( start from 1 )
368 @param[in] LastCol The last printable column.
369 @param[in] LastRow The last printable row.
370 **/
371 VOID
372 EFIAPI
373 EditorClearLine (
374 IN UINTN Row,
375 IN UINTN LastCol,
376 IN UINTN LastRow
377 );
378
379 /**
380 Check if file name has illegal characters.
381
382 @param Name The filename to check.
383
384 @retval TRUE The filename is ok.
385 @retval FALSE The filename is not ok.
386 **/
387 BOOLEAN
388 EFIAPI
389 IsValidFileName (
390 IN CONST CHAR16 *Name
391 );
392
393 /**
394 Find a filename that is valid (not taken) with the given extension.
395
396 @param[in] Extension The file extension.
397
398 @retval NULL Something went wrong.
399 @return the valid filename.
400 **/
401 CHAR16 *
402 EFIAPI
403 EditGetDefaultFileName (
404 IN CONST CHAR16 *Extension
405 );
406
407 /**
408 Read a file into an allocated buffer. The buffer is the responsibility
409 of the caller to free.
410
411 @param[in] FileName The filename of the file to open.
412 @param[out] Buffer Upon successful return, the pointer to the
413 address of the allocated buffer.
414 @param[out] BufferSize If not NULL, then the pointer to the size
415 of the allocated buffer.
416 @param[out] ReadOnly Upon successful return TRUE if the file is
417 read only. FALSE otherwise.
418
419 @retval EFI_NOT_FOUND The filename did not represent a file in the
420 file system. Directories cannot be read with
421 this method.
422 @retval EFI_SUCCESS The file was read into the buffer.
423 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
424 @retval EFI_LOAD_ERROR The file read operation failed.
425 @retval EFI_INVALID_PARAMETER A parameter was invalid.
426 @retval EFI_INVALID_PARAMETER FileName was NULL.
427 @retval EFI_INVALID_PARAMETER FileName was a directory.
428 **/
429 EFI_STATUS
430 EFIAPI
431 ReadFileIntoBuffer (
432 IN CONST CHAR16 *FileName,
433 OUT VOID **Buffer,
434 OUT UINTN *BufferSize OPTIONAL,
435 OUT BOOLEAN *ReadOnly
436 );
437
438 #endif