summaryrefslogtreecommitdiff
path: root/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c
diff options
context:
space:
mode:
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-03-25 21:22:20 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2011-03-25 21:22:20 +0000
commit3737ac2bc3c2e6589d88be97345d641ea2006933 (patch)
treed2798373c799cb9c728d2ec4e7b1bb39f2d59d11 /ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c
parent2442e62af75a0c5087fce3fb2040e26a485b0d31 (diff)
downloadedk2-platforms-3737ac2bc3c2e6589d88be97345d641ea2006933.tar.xz
comp - add comments and add input verification
bcfg - updated for bugs. compress - rename for coding standards. add comments. dblk - add comments, input verification, and a header line dmem - add comments, add input verification, add system table info dmpstore - add comments eficompress - add comments and add input verification efidecompress - add comments and add input verification loadpcirom - add comments and more output messages memmap - add more output to exceed the spec. mm - move functions, add comments, add input verification. mode - add comment pci - add input verification. SerMode - add comments and add input verification setsize - add comments and add input verification setvar - add comments and add input verification smbiosview - add input verification. clarify error messages. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11438 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c')
-rw-r--r--ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c41
1 files changed, 30 insertions, 11 deletions
diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c b/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c
index 52612283a2..e464d57fe4 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/SerMode.c
@@ -1,7 +1,7 @@
/** @file
Main file for SerMode shell Debug1 function.
- Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2005 - 2011, 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
@@ -16,9 +16,20 @@
#include <Library/ShellLib.h>
#include <Protocol/SerialIo.h>
+/**
+ Display information about a serial device by it's handle.
+
+ If HandleValid is FALSE, do all devices.
+
+ @param[in] HandleIdx The handle index for the device.
+ @param[in] HandleValid TRUE if HandleIdx is valid.
+
+ @retval SHELL_INVALID_PARAMETER A parameter was invalid.
+ @retval SHELL_SUCCESS The operation was successful.
+**/
SHELL_STATUS
EFIAPI
-iDisplaySettings (
+DisplaySettings (
IN UINTN HandleIdx,
IN BOOLEAN HandleValid
)
@@ -147,6 +158,12 @@ iDisplaySettings (
return ShellStatus;
}
+/**
+ Function for 'sermode' command.
+
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).
+**/
SHELL_STATUS
EFIAPI
ShellCommandRunSerMode (
@@ -169,6 +186,7 @@ ShellCommandRunSerMode (
LIST_ENTRY *Package;
CHAR16 *ProblemParam;
CONST CHAR16 *Temp;
+ UINT64 Intermediate;
ShellStatus = SHELL_SUCCESS;
HandleIdx = 0;
@@ -188,28 +206,29 @@ ShellCommandRunSerMode (
ASSERT(FALSE);
}
} else {
- if (ShellCommandLineGetCount(Package) < 5 && ShellCommandLineGetCount(Package) > 1) {
+ if (ShellCommandLineGetCount(Package) < 6 && ShellCommandLineGetCount(Package) > 2) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
- } else if (ShellCommandLineGetCount(Package) > 5) {
+ } else if (ShellCommandLineGetCount(Package) > 6) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);
ShellStatus = SHELL_INVALID_PARAMETER;
} else {
Temp = ShellCommandLineGetRawValue(Package, 1);
if (Temp != NULL) {
- HandleIdx = StrHexToUintn(Temp);
+ Status = ShellConvertStringToUint64(Temp, &Intermediate, TRUE, FALSE);
+ HandleIdx = (UINTN)Intermediate;
Temp = ShellCommandLineGetRawValue(Package, 2);
if (Temp == NULL) {
- ShellStatus = iDisplaySettings (HandleIdx, TRUE);
+ ShellStatus = DisplaySettings (HandleIdx, TRUE);
goto Done;
}
} else {
- ShellStatus = iDisplaySettings (0, FALSE);
+ ShellStatus = DisplaySettings (0, FALSE);
goto Done;
}
Temp = ShellCommandLineGetRawValue(Package, 2);
if (Temp != NULL) {
- BaudRate = StrHexToUintn(Temp);
+ BaudRate = ShellStrToUintn(Temp);
} else {
ASSERT(FALSE);
BaudRate = 0;
@@ -252,7 +271,7 @@ ShellCommandRunSerMode (
}
Temp = ShellCommandLineGetRawValue(Package, 4);
if (Temp != NULL) {
- DataBits = StrHexToUintn(Temp);
+ DataBits = ShellStrToUintn(Temp);
} else {
//
// make sure this is some number not in the list below.
@@ -270,7 +289,7 @@ ShellCommandRunSerMode (
goto Done;
}
Temp = ShellCommandLineGetRawValue(Package, 5);
- Value = StrHexToUintn(Temp);
+ Value = ShellStrToUintn(Temp);
switch (Value) {
case 0:
StopBits = DefaultStopBits;
@@ -328,7 +347,7 @@ ShellCommandRunSerMode (
}
}
- if (Index == NoHandles) {
+ if (ShellStatus == SHELL_SUCCESS && Index == NoHandles) {
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_BAD_HANDLE), gShellDebug1HiiHandle, HandleIdx);
ShellStatus = SHELL_INVALID_PARAMETER;
}