mirror of https://github.com/acidanthera/audk.git
ShellPkg: Change MM command output during script execution
- Automatically use non-interactive mode during script execution. - Automatically use non-interactive mode when a specific value is read (omitting this behavior was a violation of the UEFI Shell Spec) - Only output the value read in when reading a value in a script; this allows automated use of the MM command. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Chris Phillips <chrisp@hp.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14874 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
2fc67057f0
commit
f79868cd18
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Main file for Mm shell Debug1 function.
|
Main file for Mm shell Debug1 function.
|
||||||
|
|
||||||
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
|
@ -315,7 +315,10 @@ ShellCommandRunMm (
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ShellCommandLineGetFlag (Package, L"-n")) {
|
//
|
||||||
|
// Non interactive for a script file or for the specific parameter
|
||||||
|
//
|
||||||
|
if (gEfiShellProtocol->BatchIsActive() || ShellCommandLineGetFlag (Package, L"-n")) {
|
||||||
Interactive = FALSE;
|
Interactive = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,6 +363,11 @@ ShellCommandRunMm (
|
||||||
|
|
||||||
Temp = ShellCommandLineGetRawValue(Package, 2);
|
Temp = ShellCommandLineGetRawValue(Package, 2);
|
||||||
if (Temp != NULL) {
|
if (Temp != NULL) {
|
||||||
|
//
|
||||||
|
// Per spec if value is specified, then -n is assumed.
|
||||||
|
//
|
||||||
|
Interactive = FALSE;
|
||||||
|
|
||||||
if (!ShellIsHexOrDecimalNumber(Temp, TRUE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp, &Value, TRUE, FALSE))) {
|
if (!ShellIsHexOrDecimalNumber(Temp, TRUE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp, &Value, TRUE, FALSE))) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);
|
||||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||||
|
@ -489,23 +497,34 @@ ShellCommandRunMm (
|
||||||
if (!Interactive) {
|
if (!Interactive) {
|
||||||
Buffer = 0;
|
Buffer = 0;
|
||||||
if (AccessType == EFIMemoryMappedIo) {
|
if (AccessType == EFIMemoryMappedIo) {
|
||||||
|
if (!gEfiShellProtocol->BatchIsActive()) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MMIO), gShellDebug1HiiHandle);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MMIO), gShellDebug1HiiHandle);
|
||||||
|
}
|
||||||
IoDev->Mem.Read (IoDev, Width, Address, 1, &Buffer);
|
IoDev->Mem.Read (IoDev, Width, Address, 1, &Buffer);
|
||||||
} else if (AccessType == EfiIo) {
|
} else if (AccessType == EfiIo) {
|
||||||
|
if (!gEfiShellProtocol->BatchIsActive()) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_IO), gShellDebug1HiiHandle);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_IO), gShellDebug1HiiHandle);
|
||||||
|
}
|
||||||
IoDev->Io.Read (IoDev, Width, Address, 1, &Buffer);
|
IoDev->Io.Read (IoDev, Width, Address, 1, &Buffer);
|
||||||
} else if (AccessType == EfiPciConfig) {
|
} else if (AccessType == EfiPciConfig) {
|
||||||
|
if (!gEfiShellProtocol->BatchIsActive()) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCI), gShellDebug1HiiHandle);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCI), gShellDebug1HiiHandle);
|
||||||
|
}
|
||||||
IoDev->Pci.Read (IoDev, Width, Address, 1, &Buffer);
|
IoDev->Pci.Read (IoDev, Width, Address, 1, &Buffer);
|
||||||
} else if (AccessType == EfiPciEConfig) {
|
} else if (AccessType == EfiPciEConfig) {
|
||||||
|
if (!gEfiShellProtocol->BatchIsActive()) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE), gShellDebug1HiiHandle);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE), gShellDebug1HiiHandle);
|
||||||
|
}
|
||||||
IoDev->Pci.Read (IoDev, Width, PciEAddress, 1, &Buffer);
|
IoDev->Pci.Read (IoDev, Width, PciEAddress, 1, &Buffer);
|
||||||
} else {
|
} else {
|
||||||
|
if (!gEfiShellProtocol->BatchIsActive()) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MEM), gShellDebug1HiiHandle);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MEM), gShellDebug1HiiHandle);
|
||||||
|
}
|
||||||
ReadMem (Width, Address, 1, &Buffer);
|
ReadMem (Width, Address, 1, &Buffer);
|
||||||
}
|
}
|
||||||
|
if (!gEfiShellProtocol->BatchIsActive()) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);
|
||||||
|
}
|
||||||
if (Size == 1) {
|
if (Size == 1) {
|
||||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), gShellDebug1HiiHandle, (UINTN)Buffer);
|
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), gShellDebug1HiiHandle, (UINTN)Buffer);
|
||||||
} else if (Size == 2) {
|
} else if (Size == 2) {
|
||||||
|
|
Loading…
Reference in New Issue