]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Ebl/HwIoDebug.c
Fix gcc warning.
[mirror_edk2.git] / EmbeddedPkg / Ebl / HwIoDebug.c
index 2d23e7c936c6d44c632e5bd22dc8a7ef6e93fdf4..a858ff31afc4a91d5c4abcd2648098cbddafbc25 100644 (file)
@@ -1,10 +1,10 @@
 /** @file\r
   Hardware IO based debug commands\r
 \r
-  Copyright (c) 2007, Intel Corporation<BR>\r
-  Portions copyright (c) 2008-2009, Apple Inc. All rights reserved.\r
+  Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
 \r
-  All rights reserved. This program and the accompanying materials\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
   http://opensource.org/licenses/bsd-license.php\r
 /**\r
   Read from IO space\r
 \r
-  Argv[0] - "ioread"\r
+  Argv[0] - "ioread"[.#] # is optiona width 1, 2, or 4. Default 1\r
   Argv[1] - Hex IO address\r
-  Argv[2] - IO Width [1|2|4] with a default of 1\r
 \r
-  ior 0x3f8 4  ;Do a 32-bit IO Read from 0x3f8\r
-  ior 0x3f8 1  ;Do a  8-bit IO Read from 0x3f8\r
+  ior.4 0x3f8  ;Do a 32-bit IO Read from 0x3f8\r
+  ior   0x3f8  ;Do a  8-bit IO Read from 0x3f8\r
 \r
   @param  Argc   Number of command arguments in Argv\r
   @param  Argv   Array of strings that represent the parsed command line. \r
@@ -53,7 +52,7 @@ EblIoReadCmd (
   }\r
 \r
   Port = AsciiStrHexToUintn (Argv[1]);\r
-  Width = (Argc > 2) ? AsciiStrHexToUintn (Argv[2]) : 1;\r
+  Width = WidthFromCommandName (Argv[0], 1);\r
 \r
   if (Width == 1) {\r
     Data = IoRead8 (Port);\r
@@ -74,13 +73,12 @@ EblIoReadCmd (
 /**\r
   Write to IO space\r
 \r
-  Argv[0] - "iowrite"\r
+  Argv[0] - "iowrite"[.#] # is optiona width 1, 2, or 4. Default 1\r
   Argv[1] - Hex IO address\r
   Argv[2] - Hex data to write\r
-  Argv[3] - IO Width [1|2|4] with a default of 1\r
 \r
-  iow 0x3f8 af 4  ;Do a 32-bit IO write of af to 0x3f8\r
-  iow 0x3f8 af    ;Do an 8-bit IO write of af to 0x3f8\r
+  iow.4 0x3f8 af  ;Do a 32-bit IO write of af to 0x3f8\r
+  iow   0x3f8 af  ;Do an 8-bit IO write of af to 0x3f8\r
 \r
   @param  Argc   Number of command arguments in Argv\r
   @param  Argv   Array of strings that represent the parsed command line. \r
@@ -105,7 +103,7 @@ EblIoWriteCmd (
 \r
   Port = AsciiStrHexToUintn (Argv[1]);\r
   Data = AsciiStrHexToUintn (Argv[2]);\r
-  Width = (Argc > 3) ? AsciiStrHexToUintn (Argv[3]) : 1;\r
+  Width = WidthFromCommandName (Argv[0], 1);\r
  \r
   if (Width == 1) {\r
     IoWrite8 (Port, (UINT8)Data);\r
@@ -124,13 +122,13 @@ GLOBAL_REMOVE_IF_UNREFERENCED const EBL_COMMAND_TABLE mCmdHwIoDebugTemplate[] =
 {\r
   {\r
     "ioread",\r
-    " Port [1|2|4]; IO read of width[1] byte(s) from Port",\r
+    "[.{1|2|4}] Port ; IO read of width byte(s) from Port",\r
     NULL,\r
     EblIoReadCmd\r
   },\r
   {\r
     "iowrite",\r
-    " Port Data [1|2|4]; IO write Data of width[1] byte(s) to Port",\r
+    "[.{1|2|4}] Port Data ; IO write Data of width byte(s) to Port",\r
     NULL,\r
     EblIoWriteCmd\r
   }\r