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