]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Change MM command output during script execution
authorJaben Carsey <jaben.carsey@intel.com>
Wed, 20 Nov 2013 17:25:02 +0000 (17:25 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 20 Nov 2013 17:25:02 +0000 (17:25 +0000)
- 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

ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c

index 5bb3cff2d1a5aaa111490c331f9c84335622667d..636acb21dbaccf48fcf0d0bc31f3b5f4738157fe 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for Mm shell Debug1 function.\r
 \r
 /** @file\r
   Main file for Mm shell Debug1 function.\r
 \r
-  Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -315,7 +315,10 @@ ShellCommandRunMm (
       }\r
     }\r
 \r
       }\r
     }\r
 \r
-    if (ShellCommandLineGetFlag (Package, L"-n")) {\r
+    //\r
+    // Non interactive for a script file or for the specific parameter\r
+    //\r
+    if (gEfiShellProtocol->BatchIsActive() || ShellCommandLineGetFlag (Package, L"-n")) {\r
       Interactive = FALSE;\r
     }\r
 \r
       Interactive = FALSE;\r
     }\r
 \r
@@ -360,6 +363,11 @@ ShellCommandRunMm (
 \r
     Temp = ShellCommandLineGetRawValue(Package, 2);\r
     if (Temp != NULL) {\r
 \r
     Temp = ShellCommandLineGetRawValue(Package, 2);\r
     if (Temp != NULL) {\r
+      //\r
+      // Per spec if value is specified, then -n is assumed.\r
+      //\r
+      Interactive = FALSE;\r
+\r
       if (!ShellIsHexOrDecimalNumber(Temp, TRUE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp, &Value, TRUE, FALSE))) {\r
         ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
         ShellStatus = SHELL_INVALID_PARAMETER;\r
       if (!ShellIsHexOrDecimalNumber(Temp, TRUE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp, &Value, TRUE, FALSE))) {\r
         ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
         ShellStatus = SHELL_INVALID_PARAMETER;\r
@@ -489,23 +497,34 @@ ShellCommandRunMm (
     if (!Interactive) {\r
       Buffer = 0;\r
       if (AccessType == EFIMemoryMappedIo) {\r
     if (!Interactive) {\r
       Buffer = 0;\r
       if (AccessType == EFIMemoryMappedIo) {\r
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MMIO), gShellDebug1HiiHandle);\r
+        if (!gEfiShellProtocol->BatchIsActive()) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MMIO), gShellDebug1HiiHandle);\r
+        }\r
         IoDev->Mem.Read (IoDev, Width, Address, 1, &Buffer);\r
       } else if (AccessType == EfiIo) {\r
         IoDev->Mem.Read (IoDev, Width, Address, 1, &Buffer);\r
       } else if (AccessType == EfiIo) {\r
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_IO), gShellDebug1HiiHandle);\r
+        if (!gEfiShellProtocol->BatchIsActive()) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_IO), gShellDebug1HiiHandle);\r
+        }\r
         IoDev->Io.Read (IoDev, Width, Address, 1, &Buffer);\r
       } else if (AccessType == EfiPciConfig) {\r
         IoDev->Io.Read (IoDev, Width, Address, 1, &Buffer);\r
       } else if (AccessType == EfiPciConfig) {\r
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCI), gShellDebug1HiiHandle);\r
+        if (!gEfiShellProtocol->BatchIsActive()) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCI), gShellDebug1HiiHandle);\r
+        }\r
         IoDev->Pci.Read (IoDev, Width, Address, 1, &Buffer);\r
       } else if (AccessType == EfiPciEConfig) {\r
         IoDev->Pci.Read (IoDev, Width, Address, 1, &Buffer);\r
       } else if (AccessType == EfiPciEConfig) {\r
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE), gShellDebug1HiiHandle);\r
+        if (!gEfiShellProtocol->BatchIsActive()) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE), gShellDebug1HiiHandle);\r
+        }\r
         IoDev->Pci.Read (IoDev, Width, PciEAddress, 1, &Buffer);\r
       } else {\r
         IoDev->Pci.Read (IoDev, Width, PciEAddress, 1, &Buffer);\r
       } else {\r
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MEM), gShellDebug1HiiHandle);\r
+        if (!gEfiShellProtocol->BatchIsActive()) {\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MEM), gShellDebug1HiiHandle);\r
+        }\r
         ReadMem (Width, Address, 1, &Buffer);\r
       }\r
         ReadMem (Width, Address, 1, &Buffer);\r
       }\r
-\r
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);\r
+      if (!gEfiShellProtocol->BatchIsActive()) {\r
+        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);\r
+      }\r
       if (Size == 1) {\r
         ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), gShellDebug1HiiHandle, (UINTN)Buffer);\r
       } else if (Size == 2) {\r
       if (Size == 1) {\r
         ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), gShellDebug1HiiHandle, (UINTN)Buffer);\r
       } else if (Size == 2) {\r