2010-11-16 23:36:37 +01:00
|
|
|
/** @file
|
|
|
|
Main file for NULL named library for Profile1 shell command functions.
|
|
|
|
|
2015-12-10 05:18:35 +01:00
|
|
|
Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
|
2010-11-16 23:36:37 +01:00
|
|
|
This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
2011-04-05 22:55:45 +02:00
|
|
|
#ifndef _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_
|
2011-03-25 22:22:20 +01:00
|
|
|
#define _UEFI_SHELL_DEBUG1_COMMANDS_LIB_H_
|
|
|
|
|
2010-11-16 23:36:37 +01:00
|
|
|
#include <Uefi.h>
|
|
|
|
#include <ShellBase.h>
|
|
|
|
|
|
|
|
#include <Guid/GlobalVariable.h>
|
|
|
|
#include <Guid/ConsoleInDevice.h>
|
|
|
|
#include <Guid/ConsoleOutDevice.h>
|
2011-03-25 22:22:20 +01:00
|
|
|
#include <Guid/FileSystemInfo.h>
|
2011-09-21 03:56:00 +02:00
|
|
|
#include <Guid/ShellLibHiiGuid.h>
|
2010-11-16 23:36:37 +01:00
|
|
|
|
|
|
|
#include <Protocol/EfiShell.h>
|
|
|
|
#include <Protocol/EfiShellParameters.h>
|
|
|
|
#include <Protocol/DevicePath.h>
|
|
|
|
#include <Protocol/LoadedImage.h>
|
|
|
|
#include <Protocol/UnicodeCollation.h>
|
|
|
|
#include <Protocol/DriverDiagnostics2.h>
|
|
|
|
#include <Protocol/DriverDiagnostics.h>
|
|
|
|
#include <Protocol/PlatformDriverOverride.h>
|
|
|
|
#include <Protocol/BusSpecificDriverOverride.h>
|
|
|
|
#include <Protocol/PlatformToDriverConfiguration.h>
|
|
|
|
#include <Protocol/DriverSupportedEfiVersion.h>
|
|
|
|
#include <Protocol/DriverFamilyOverride.h>
|
|
|
|
#include <Protocol/DriverHealth.h>
|
2011-03-25 22:22:20 +01:00
|
|
|
#include <Protocol/SimplePointer.h>
|
2015-12-10 05:18:35 +01:00
|
|
|
#include <Protocol/CpuIo2.h>
|
2011-03-25 22:22:20 +01:00
|
|
|
#include <Protocol/PciRootBridgeIo.h>
|
2010-11-16 23:36:37 +01:00
|
|
|
|
|
|
|
#include <Library/BaseLib.h>
|
|
|
|
#include <Library/BaseMemoryLib.h>
|
|
|
|
#include <Library/DebugLib.h>
|
|
|
|
#include <Library/MemoryAllocationLib.h>
|
|
|
|
#include <Library/PcdLib.h>
|
|
|
|
#include <Library/ShellCommandLib.h>
|
|
|
|
#include <Library/ShellLib.h>
|
|
|
|
#include <Library/SortLib.h>
|
|
|
|
#include <Library/UefiLib.h>
|
|
|
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
|
|
|
#include <Library/UefiBootServicesTableLib.h>
|
|
|
|
#include <Library/HiiLib.h>
|
|
|
|
#include <Library/FileHandleLib.h>
|
|
|
|
#include <Library/DevicePathLib.h>
|
|
|
|
#include <Library/PrintLib.h>
|
|
|
|
#include <Library/HandleParsingLib.h>
|
|
|
|
|
|
|
|
|
|
|
|
extern EFI_HANDLE gShellDebug1HiiHandle;
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function returns a system configuration table that is stored in the
|
|
|
|
EFI System Table based on the provided GUID.
|
|
|
|
|
2011-09-02 10:05:34 +02:00
|
|
|
@param[in] TableGuid A pointer to the table's GUID type.
|
|
|
|
@param[in, out] Table On exit, a pointer to a system configuration table.
|
2010-11-16 23:36:37 +01:00
|
|
|
|
|
|
|
@retval EFI_SUCCESS A configuration table matching TableGuid was found.
|
|
|
|
@retval EFI_NOT_FOUND A configuration table matching TableGuid was not found.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
GetSystemConfigurationTable (
|
|
|
|
IN EFI_GUID *TableGuid,
|
|
|
|
IN OUT VOID **Table
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Convert a string representation of a GUID to the GUID value.
|
|
|
|
|
2011-09-02 10:05:34 +02:00
|
|
|
@param[in] StringGuid The pointer to the string containing a GUID printed.
|
|
|
|
@param[in, out] Guid The pointer to the buffer to get the GUID value.
|
2010-11-16 23:36:37 +01:00
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ConvertStringToGuid (
|
|
|
|
IN CONST CHAR16 *StringGuid,
|
|
|
|
IN OUT EFI_GUID *Guid
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Convert a Unicode character to numerical value.
|
|
|
|
|
|
|
|
This internal function only deal with Unicode character
|
|
|
|
which maps to a valid hexadecimal ASII character, i.e.
|
|
|
|
L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other
|
|
|
|
Unicode character, the value returned does not make sense.
|
|
|
|
|
|
|
|
@param Char The character to convert.
|
|
|
|
|
|
|
|
@return The numerical value converted.
|
|
|
|
|
|
|
|
**/
|
|
|
|
UINTN
|
|
|
|
EFIAPI
|
|
|
|
HexCharToUintn (
|
|
|
|
IN CHAR16 Char
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'setsize' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunSetSize (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'comp' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunComp (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'mode' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunMode (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'memmap' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunMemMap (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'compress' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunEfiCompress (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'decompress' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunEfiDecompress (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'dmem' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunDmem (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'loadpcirom' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunLoadPciRom (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'mm' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunMm (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'setvar' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunSetVar (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'sermode' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunSerMode (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'bcfg' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunBcfg (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'pci' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunPci (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'smbiosview' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunSmbiosView (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'dmpstore' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunDmpStore (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'dblk' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunDblk (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
2011-03-25 22:22:20 +01:00
|
|
|
/**
|
|
|
|
Function for 'edit' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunEdit (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Function for 'hexedit' command.
|
|
|
|
|
|
|
|
@param[in] ImageHandle Handle to the Image (NULL if Internal).
|
|
|
|
@param[in] SystemTable Pointer to the System Table (NULL if Internal).
|
|
|
|
**/
|
|
|
|
SHELL_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ShellCommandRunHexEdit (
|
|
|
|
IN EFI_HANDLE ImageHandle,
|
|
|
|
IN EFI_SYSTEM_TABLE *SystemTable
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Clear the line at the specified Row.
|
|
|
|
|
|
|
|
@param[in] Row The row number to be cleared ( start from 1 )
|
|
|
|
@param[in] LastCol The last printable column.
|
|
|
|
@param[in] LastRow The last printable row.
|
|
|
|
**/
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
EditorClearLine (
|
|
|
|
IN UINTN Row,
|
|
|
|
IN UINTN LastCol,
|
|
|
|
IN UINTN LastRow
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Check if file name has illegal characters.
|
|
|
|
|
|
|
|
@param Name The filename to check.
|
|
|
|
|
|
|
|
@retval TRUE The filename is ok.
|
|
|
|
@retval FALSE The filename is not ok.
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
IsValidFileName (
|
|
|
|
IN CONST CHAR16 *Name
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Find a filename that is valid (not taken) with the given extension.
|
|
|
|
|
|
|
|
@param[in] Extension The file extension.
|
|
|
|
|
|
|
|
@retval NULL Something went wrong.
|
|
|
|
@return the valid filename.
|
|
|
|
**/
|
|
|
|
CHAR16 *
|
|
|
|
EFIAPI
|
|
|
|
EditGetDefaultFileName (
|
|
|
|
IN CONST CHAR16 *Extension
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Read a file into an allocated buffer. The buffer is the responsibility
|
|
|
|
of the caller to free.
|
|
|
|
|
|
|
|
@param[in] FileName The filename of the file to open.
|
|
|
|
@param[out] Buffer Upon successful return, the pointer to the
|
|
|
|
address of the allocated buffer.
|
|
|
|
@param[out] BufferSize If not NULL, then the pointer to the size
|
|
|
|
of the allocated buffer.
|
|
|
|
@param[out] ReadOnly Upon successful return TRUE if the file is
|
|
|
|
read only. FALSE otherwise.
|
|
|
|
|
|
|
|
@retval EFI_NOT_FOUND The filename did not represent a file in the
|
|
|
|
file system. Directories cannot be read with
|
|
|
|
this method.
|
|
|
|
@retval EFI_SUCCESS The file was read into the buffer.
|
|
|
|
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
|
|
|
|
@retval EFI_LOAD_ERROR The file read operation failed.
|
|
|
|
@retval EFI_INVALID_PARAMETER A parameter was invalid.
|
|
|
|
@retval EFI_INVALID_PARAMETER FileName was NULL.
|
|
|
|
@retval EFI_INVALID_PARAMETER FileName was a directory.
|
|
|
|
**/
|
|
|
|
EFI_STATUS
|
|
|
|
EFIAPI
|
|
|
|
ReadFileIntoBuffer (
|
|
|
|
IN CONST CHAR16 *FileName,
|
|
|
|
OUT VOID **Buffer,
|
|
|
|
OUT UINTN *BufferSize OPTIONAL,
|
|
|
|
OUT BOOLEAN *ReadOnly
|
|
|
|
);
|
2010-11-16 23:36:37 +01:00
|
|
|
|
2011-03-25 22:22:20 +01:00
|
|
|
#endif
|