Files
slimbootloader/BootloaderCommonPkg/Library/ShellLib/CmdMtrr.c
Aiden Park e99762353a Introduce CONSOLE_PRINT macro (#701)
This will allow necessary messages to be printed to consoles.

These macros will redirect debug message to consoles.
  CONSOLE_PRINT
  CONSOLE_PRINT_UNICODE

These conditional macros will redirect debug message to consoles or
DEBUG(). The PrintLevel is valid only when redirected to DEBUG().
  CONSOLE_PRINT_CONDITION
  CONSOLE_PRINT_UNICODE_CONDITION

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-04 14:53:08 -07:00

72 lines
1.4 KiB
C

/** @file
Shell command `mtrr` to display current MTRR configuration.
Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <Library/ShellLib.h>
#include <Library/MtrrLib.h>
/**
Display current MTRR configuration.
@param[in] Shell shell instance
@param[in] Argc number of command line arguments
@param[in] Argv command line arguments
@retval EFI_SUCCESS
**/
STATIC
EFI_STATUS
EFIAPI
ShellCommandMtrrFunc (
IN SHELL *Shell,
IN UINTN Argc,
IN CHAR16 *Argv[]
);
CONST SHELL_COMMAND ShellCommandMtrr = {
L"mtrr",
L"Display current MTRR configuration",
&ShellCommandMtrrFunc
};
/**
Display current MTRR configuration.
@param[in] Shell shell instance
@param[in] Argc number of command line arguments
@param[in] Argv command line arguments
@retval EFI_SUCCESS
**/
STATIC
EFI_STATUS
EFIAPI
ShellCommandMtrrFunc (
IN SHELL *Shell,
IN UINTN Argc,
IN CHAR16 *Argv[]
)
{
UINT32 Index;
// Check flags
for (Index = 0; Index < Argc; Index++) {
if (StrCmp (Argv[Index], L"-h") == 0) {
goto usage;
}
}
PrintMtrr (NULL, TRUE);
return EFI_SUCCESS;
usage:
ShellPrint (L"Usage: %s\n", Argv[0]);
return EFI_ABORTED;
}