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