Revision: 14874
          http://sourceforge.net/p/edk2/code/14874
Author:   jcarsey
Date:     2013-11-20 17:25:02 +0000 (Wed, 20 Nov 2013)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Chris Phillips <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c

Modified: trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c 2013-11-20 
11:21:06 UTC (rev 14873)
+++ trunk/edk2/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c 2013-11-20 
17:25:02 UTC (rev 14874)
@@ -1,7 +1,7 @@
 /** @file
   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
   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
@@ -315,7 +315,10 @@
       }
     }
 
-    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;
     }
 
@@ -360,6 +363,11 @@
 
     Temp = ShellCommandLineGetRawValue(Package, 2);
     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))) {
         ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), 
gShellDebug1HiiHandle, Temp);
         ShellStatus = SHELL_INVALID_PARAMETER;
@@ -489,23 +497,34 @@
     if (!Interactive) {
       Buffer = 0;
       if (AccessType == EFIMemoryMappedIo) {
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MMIO), 
gShellDebug1HiiHandle);
+        if (!gEfiShellProtocol->BatchIsActive()) {
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MMIO), 
gShellDebug1HiiHandle);
+        }
         IoDev->Mem.Read (IoDev, Width, Address, 1, &Buffer);
       } else if (AccessType == EfiIo) {
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_IO), 
gShellDebug1HiiHandle);
+        if (!gEfiShellProtocol->BatchIsActive()) {
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_IO), 
gShellDebug1HiiHandle);
+        }
         IoDev->Io.Read (IoDev, Width, Address, 1, &Buffer);
       } else if (AccessType == EfiPciConfig) {
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCI), 
gShellDebug1HiiHandle);
+        if (!gEfiShellProtocol->BatchIsActive()) {
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCI), 
gShellDebug1HiiHandle);
+        }
         IoDev->Pci.Read (IoDev, Width, Address, 1, &Buffer);
       } else if (AccessType == EfiPciEConfig) {
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE), 
gShellDebug1HiiHandle);
+        if (!gEfiShellProtocol->BatchIsActive()) {
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE), 
gShellDebug1HiiHandle);
+        }
         IoDev->Pci.Read (IoDev, Width, PciEAddress, 1, &Buffer);
       } else {
-        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MEM), 
gShellDebug1HiiHandle);
+        if (!gEfiShellProtocol->BatchIsActive()) {
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MEM), 
gShellDebug1HiiHandle);
+        }
         ReadMem (Width, Address, 1, &Buffer);
       }
-
-      ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), 
gShellDebug1HiiHandle, Address);
+      if (!gEfiShellProtocol->BatchIsActive()) {
+        ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), 
gShellDebug1HiiHandle, Address);
+      }
       if (Size == 1) {
         ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), 
gShellDebug1HiiHandle, (UINTN)Buffer);
       } else if (Size == 2) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to