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