1 | /** @file
|
---|
2 | Main file for NULL named library for Profile1 shell command functions.
|
---|
3 |
|
---|
4 | Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
|
---|
5 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
6 |
|
---|
7 | **/
|
---|
8 |
|
---|
9 | #ifndef _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_
|
---|
10 | #define _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_
|
---|
11 |
|
---|
12 | #include <Uefi.h>
|
---|
13 |
|
---|
14 | #include <Guid/GlobalVariable.h>
|
---|
15 | #include <Guid/ConsoleInDevice.h>
|
---|
16 | #include <Guid/ConsoleOutDevice.h>
|
---|
17 | #include <Guid/FileSystemInfo.h>
|
---|
18 | #include <Guid/ShellLibHiiGuid.h>
|
---|
19 |
|
---|
20 | #include <Protocol/Shell.h>
|
---|
21 | #include <Protocol/ShellParameters.h>
|
---|
22 | #include <Protocol/DevicePath.h>
|
---|
23 | #include <Protocol/LoadedImage.h>
|
---|
24 | #include <Protocol/UnicodeCollation.h>
|
---|
25 | #include <Protocol/DriverDiagnostics2.h>
|
---|
26 | #include <Protocol/DriverDiagnostics.h>
|
---|
27 | #include <Protocol/PlatformDriverOverride.h>
|
---|
28 | #include <Protocol/BusSpecificDriverOverride.h>
|
---|
29 | #include <Protocol/PlatformToDriverConfiguration.h>
|
---|
30 | #include <Protocol/DriverSupportedEfiVersion.h>
|
---|
31 | #include <Protocol/DriverFamilyOverride.h>
|
---|
32 | #include <Protocol/DriverHealth.h>
|
---|
33 | #include <Protocol/SimplePointer.h>
|
---|
34 | #include <Protocol/CpuIo2.h>
|
---|
35 | #include <Protocol/PciRootBridgeIo.h>
|
---|
36 |
|
---|
37 | #include <Library/BaseLib.h>
|
---|
38 | #include <Library/BaseMemoryLib.h>
|
---|
39 | #include <Library/DebugLib.h>
|
---|
40 | #include <Library/MemoryAllocationLib.h>
|
---|
41 | #include <Library/PcdLib.h>
|
---|
42 | #include <Library/ShellCommandLib.h>
|
---|
43 | #include <Library/ShellLib.h>
|
---|
44 | #include <Library/SortLib.h>
|
---|
45 | #include <Library/UefiLib.h>
|
---|
46 | #include <Library/UefiRuntimeServicesTableLib.h>
|
---|
47 | #include <Library/UefiBootServicesTableLib.h>
|
---|
48 | #include <Library/HiiLib.h>
|
---|
49 | #include <Library/FileHandleLib.h>
|
---|
50 | #include <Library/DevicePathLib.h>
|
---|
51 | #include <Library/PrintLib.h>
|
---|
52 | #include <Library/HandleParsingLib.h>
|
---|
53 |
|
---|
54 | extern EFI_HII_HANDLE gShellDebug1HiiHandle;
|
---|
55 |
|
---|
56 | /**
|
---|
57 | Function returns a system configuration table that is stored in the
|
---|
58 | EFI System Table based on the provided GUID.
|
---|
59 |
|
---|
60 | @param[in] TableGuid A pointer to the table's GUID type.
|
---|
61 | @param[in, out] Table On exit, a pointer to a system configuration table.
|
---|
62 |
|
---|
63 | @retval EFI_SUCCESS A configuration table matching TableGuid was found.
|
---|
64 | @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found.
|
---|
65 | **/
|
---|
66 | EFI_STATUS
|
---|
67 | GetSystemConfigurationTable (
|
---|
68 | IN EFI_GUID *TableGuid,
|
---|
69 | IN OUT VOID **Table
|
---|
70 | );
|
---|
71 |
|
---|
72 | /**
|
---|
73 | Function for 'setsize' command.
|
---|
74 |
|
---|
75 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
76 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
77 | **/
|
---|
78 | SHELL_STATUS
|
---|
79 | EFIAPI
|
---|
80 | ShellCommandRunSetSize (
|
---|
81 | IN EFI_HANDLE ImageHandle,
|
---|
82 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
83 | );
|
---|
84 |
|
---|
85 | /**
|
---|
86 | Function for 'comp' command.
|
---|
87 |
|
---|
88 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
89 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
90 | **/
|
---|
91 | SHELL_STATUS
|
---|
92 | EFIAPI
|
---|
93 | ShellCommandRunComp (
|
---|
94 | IN EFI_HANDLE ImageHandle,
|
---|
95 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
96 | );
|
---|
97 |
|
---|
98 | /**
|
---|
99 | Function for 'mode' command.
|
---|
100 |
|
---|
101 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
102 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
103 | **/
|
---|
104 | SHELL_STATUS
|
---|
105 | EFIAPI
|
---|
106 | ShellCommandRunMode (
|
---|
107 | IN EFI_HANDLE ImageHandle,
|
---|
108 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
109 | );
|
---|
110 |
|
---|
111 | /**
|
---|
112 | Function for 'memmap' command.
|
---|
113 |
|
---|
114 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
115 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
116 | **/
|
---|
117 | SHELL_STATUS
|
---|
118 | EFIAPI
|
---|
119 | ShellCommandRunMemMap (
|
---|
120 | IN EFI_HANDLE ImageHandle,
|
---|
121 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
122 | );
|
---|
123 |
|
---|
124 | /**
|
---|
125 | Function for 'compress' command.
|
---|
126 |
|
---|
127 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
128 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
129 | **/
|
---|
130 | SHELL_STATUS
|
---|
131 | EFIAPI
|
---|
132 | ShellCommandRunEfiCompress (
|
---|
133 | IN EFI_HANDLE ImageHandle,
|
---|
134 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
135 | );
|
---|
136 |
|
---|
137 | /**
|
---|
138 | Function for 'decompress' command.
|
---|
139 |
|
---|
140 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
141 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
142 | **/
|
---|
143 | SHELL_STATUS
|
---|
144 | EFIAPI
|
---|
145 | ShellCommandRunEfiDecompress (
|
---|
146 | IN EFI_HANDLE ImageHandle,
|
---|
147 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
148 | );
|
---|
149 |
|
---|
150 | /**
|
---|
151 | Function for 'dmem' command.
|
---|
152 |
|
---|
153 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
154 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
155 | **/
|
---|
156 | SHELL_STATUS
|
---|
157 | EFIAPI
|
---|
158 | ShellCommandRunDmem (
|
---|
159 | IN EFI_HANDLE ImageHandle,
|
---|
160 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
161 | );
|
---|
162 |
|
---|
163 | /**
|
---|
164 | Function for 'loadpcirom' command.
|
---|
165 |
|
---|
166 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
167 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
168 | **/
|
---|
169 | SHELL_STATUS
|
---|
170 | EFIAPI
|
---|
171 | ShellCommandRunLoadPciRom (
|
---|
172 | IN EFI_HANDLE ImageHandle,
|
---|
173 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
174 | );
|
---|
175 |
|
---|
176 | /**
|
---|
177 | Function for 'mm' command.
|
---|
178 |
|
---|
179 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
180 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
181 | **/
|
---|
182 | SHELL_STATUS
|
---|
183 | EFIAPI
|
---|
184 | ShellCommandRunMm (
|
---|
185 | IN EFI_HANDLE ImageHandle,
|
---|
186 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
187 | );
|
---|
188 |
|
---|
189 | /**
|
---|
190 | Function for 'setvar' command.
|
---|
191 |
|
---|
192 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
193 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
194 | **/
|
---|
195 | SHELL_STATUS
|
---|
196 | EFIAPI
|
---|
197 | ShellCommandRunSetVar (
|
---|
198 | IN EFI_HANDLE ImageHandle,
|
---|
199 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
200 | );
|
---|
201 |
|
---|
202 | /**
|
---|
203 | Function for 'sermode' command.
|
---|
204 |
|
---|
205 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
206 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
207 | **/
|
---|
208 | SHELL_STATUS
|
---|
209 | EFIAPI
|
---|
210 | ShellCommandRunSerMode (
|
---|
211 | IN EFI_HANDLE ImageHandle,
|
---|
212 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
213 | );
|
---|
214 |
|
---|
215 | /**
|
---|
216 | Function for 'bcfg' command.
|
---|
217 |
|
---|
218 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
219 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
220 | **/
|
---|
221 | SHELL_STATUS
|
---|
222 | EFIAPI
|
---|
223 | ShellCommandRunBcfg (
|
---|
224 | IN EFI_HANDLE ImageHandle,
|
---|
225 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
226 | );
|
---|
227 |
|
---|
228 | /**
|
---|
229 | Function for 'pci' command.
|
---|
230 |
|
---|
231 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
232 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
233 | **/
|
---|
234 | SHELL_STATUS
|
---|
235 | EFIAPI
|
---|
236 | ShellCommandRunPci (
|
---|
237 | IN EFI_HANDLE ImageHandle,
|
---|
238 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
239 | );
|
---|
240 |
|
---|
241 | /**
|
---|
242 | Function for 'smbiosview' command.
|
---|
243 |
|
---|
244 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
245 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
246 | **/
|
---|
247 | SHELL_STATUS
|
---|
248 | EFIAPI
|
---|
249 | ShellCommandRunSmbiosView (
|
---|
250 | IN EFI_HANDLE ImageHandle,
|
---|
251 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
252 | );
|
---|
253 |
|
---|
254 | /**
|
---|
255 | Function for 'dmpstore' command.
|
---|
256 |
|
---|
257 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
258 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
259 | **/
|
---|
260 | SHELL_STATUS
|
---|
261 | EFIAPI
|
---|
262 | ShellCommandRunDmpStore (
|
---|
263 | IN EFI_HANDLE ImageHandle,
|
---|
264 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
265 | );
|
---|
266 |
|
---|
267 | /**
|
---|
268 | Function for 'dblk' command.
|
---|
269 |
|
---|
270 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
271 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
272 | **/
|
---|
273 | SHELL_STATUS
|
---|
274 | EFIAPI
|
---|
275 | ShellCommandRunDblk (
|
---|
276 | IN EFI_HANDLE ImageHandle,
|
---|
277 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
278 | );
|
---|
279 |
|
---|
280 | /**
|
---|
281 | Function for 'edit' command.
|
---|
282 |
|
---|
283 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
284 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
285 | **/
|
---|
286 | SHELL_STATUS
|
---|
287 | EFIAPI
|
---|
288 | ShellCommandRunEdit (
|
---|
289 | IN EFI_HANDLE ImageHandle,
|
---|
290 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
291 | );
|
---|
292 |
|
---|
293 | /**
|
---|
294 | Function for 'hexedit' command.
|
---|
295 |
|
---|
296 | @param[in] ImageHandle Handle to the Image (NULL if Internal).
|
---|
297 | @param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
---|
298 | **/
|
---|
299 | SHELL_STATUS
|
---|
300 | EFIAPI
|
---|
301 | ShellCommandRunHexEdit (
|
---|
302 | IN EFI_HANDLE ImageHandle,
|
---|
303 | IN EFI_SYSTEM_TABLE *SystemTable
|
---|
304 | );
|
---|
305 |
|
---|
306 | /**
|
---|
307 | Clear the line at the specified Row.
|
---|
308 |
|
---|
309 | @param[in] Row The row number to be cleared ( start from 1 )
|
---|
310 | @param[in] LastCol The last printable column.
|
---|
311 | @param[in] LastRow The last printable row.
|
---|
312 | **/
|
---|
313 | VOID
|
---|
314 | EditorClearLine (
|
---|
315 | IN UINTN Row,
|
---|
316 | IN UINTN LastCol,
|
---|
317 | IN UINTN LastRow
|
---|
318 | );
|
---|
319 |
|
---|
320 | /**
|
---|
321 | Check if file name has illegal characters.
|
---|
322 |
|
---|
323 | @param Name The filename to check.
|
---|
324 |
|
---|
325 | @retval TRUE The filename is ok.
|
---|
326 | @retval FALSE The filename is not ok.
|
---|
327 | **/
|
---|
328 | BOOLEAN
|
---|
329 | IsValidFileName (
|
---|
330 | IN CONST CHAR16 *Name
|
---|
331 | );
|
---|
332 |
|
---|
333 | /**
|
---|
334 | Find a filename that is valid (not taken) with the given extension.
|
---|
335 |
|
---|
336 | @param[in] Extension The file extension.
|
---|
337 |
|
---|
338 | @retval NULL Something went wrong.
|
---|
339 | @return the valid filename.
|
---|
340 | **/
|
---|
341 | CHAR16 *
|
---|
342 | EditGetDefaultFileName (
|
---|
343 | IN CONST CHAR16 *Extension
|
---|
344 | );
|
---|
345 |
|
---|
346 | /**
|
---|
347 | Read a file into an allocated buffer. The buffer is the responsibility
|
---|
348 | of the caller to free.
|
---|
349 |
|
---|
350 | @param[in] FileName The filename of the file to open.
|
---|
351 | @param[out] Buffer Upon successful return, the pointer to the
|
---|
352 | address of the allocated buffer.
|
---|
353 | @param[out] BufferSize If not NULL, then the pointer to the size
|
---|
354 | of the allocated buffer.
|
---|
355 | @param[out] ReadOnly Upon successful return TRUE if the file is
|
---|
356 | read only. FALSE otherwise.
|
---|
357 |
|
---|
358 | @retval EFI_NOT_FOUND The filename did not represent a file in the
|
---|
359 | file system. Directories cannot be read with
|
---|
360 | this method.
|
---|
361 | @retval EFI_SUCCESS The file was read into the buffer.
|
---|
362 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
|
---|
363 | @retval EFI_LOAD_ERROR The file read operation failed.
|
---|
364 | @retval EFI_INVALID_PARAMETER A parameter was invalid.
|
---|
365 | @retval EFI_INVALID_PARAMETER FileName was NULL.
|
---|
366 | @retval EFI_INVALID_PARAMETER FileName was a directory.
|
---|
367 | **/
|
---|
368 | EFI_STATUS
|
---|
369 | ReadFileIntoBuffer (
|
---|
370 | IN CONST CHAR16 *FileName,
|
---|
371 | OUT VOID **Buffer,
|
---|
372 | OUT UINTN *BufferSize OPTIONAL,
|
---|
373 | OUT BOOLEAN *ReadOnly
|
---|
374 | );
|
---|
375 |
|
---|
376 | #endif
|
---|