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