summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Application/Shell/Shell.c184
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c87
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h2
-rw-r--r--ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf3
-rw-r--r--ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c41
-rw-r--r--ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c26
-rw-r--r--ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c65
-rw-r--r--ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h15
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c1
9 files changed, 339 insertions, 85 deletions
diff --git a/ShellPkg/Application/Shell/Shell.c b/ShellPkg/Application/Shell/Shell.c
index 41fa78004d..695880197b 100644
--- a/ShellPkg/Application/Shell/Shell.c
+++ b/ShellPkg/Application/Shell/Shell.c
@@ -101,6 +101,95 @@ TrimSpaces(
}
/**
+ Parse for the next instance of one string within another string. Can optionally make sure that
+ the string was not escaped (^ character) per the shell specification.
+
+ @param[in] SourceString The string to search within
+ @param[in] FindString The string to look for
+ @param[in] CheckForEscapeCharacter TRUE to skip escaped instances of FinfString, otherwise will return even escaped instances
+**/
+CHAR16*
+EFIAPI
+FindNextInstance(
+ IN CONST CHAR16 *SourceString,
+ IN CONST CHAR16 *FindString,
+ IN CONST BOOLEAN CheckForEscapeCharacter
+ )
+{
+ CHAR16 *Temp;
+ if (SourceString == NULL) {
+ return (NULL);
+ }
+ Temp = StrStr(SourceString, FindString);
+
+ //
+ // If nothing found, or we dont care about escape characters
+ //
+ if (Temp == NULL || !CheckForEscapeCharacter) {
+ return (Temp);
+ }
+
+ //
+ // If we found an escaped character, try again on the remainder of the string
+ //
+ if ((Temp > (SourceString)) && *(Temp-1) == L'^') {
+ return FindNextInstance(Temp+1, FindString, CheckForEscapeCharacter);
+ }
+
+ //
+ // we found the right character
+ //
+ return (Temp);
+}
+
+/**
+ Check whether the string between a pair of % is a valid envifronment variable name.
+
+ @param[in] BeginPercent pointer to the first percent.
+ @param[in] EndPercent pointer to the last percent.
+
+ @retval TRUE is a valid environment variable name.
+ @retval FALSE is NOT a valid environment variable name.
+**/
+BOOLEAN
+IsValidEnvironmentVariableName(
+ IN CONST CHAR16 *BeginPercent,
+ IN CONST CHAR16 *EndPercent
+ )
+{
+ CONST CHAR16 *Walker;
+
+ Walker = NULL;
+
+ ASSERT (BeginPercent != NULL);
+ ASSERT (EndPercent != NULL);
+ ASSERT (BeginPercent < EndPercent);
+
+ if ((BeginPercent + 1) == EndPercent) {
+ return FALSE;
+ }
+
+ for (Walker = BeginPercent + 1; Walker < EndPercent; Walker++) {
+ if (
+ (*Walker >= L'0' && *Walker <= L'9') ||
+ (*Walker >= L'A' && *Walker <= L'Z') ||
+ (*Walker >= L'a' && *Walker <= L'z') ||
+ (*Walker == L'_')
+ ) {
+ if (Walker == BeginPercent + 1 && (*Walker >= L'0' && *Walker <= L'9')) {
+ return FALSE;
+ } else {
+ continue;
+ }
+ } else {
+ return FALSE;
+ }
+ }
+
+ return TRUE;
+}
+
+/**
Find a command line contains a split operation
@param[in] CmdLine The command line to parse.
@@ -142,7 +231,39 @@ ContainsSplit(
)
{
CONST CHAR16 *TempSpot;
- TempSpot = FindSplit(CmdLine);
+ CONST CHAR16 *FirstQuote;
+ CONST CHAR16 *SecondQuote;
+
+ FirstQuote = FindNextInstance (CmdLine, L"\"", TRUE);
+ SecondQuote = NULL;
+ TempSpot = FindSplit(CmdLine);
+
+ if (FirstQuote == NULL ||
+ TempSpot == NULL ||
+ TempSpot == CHAR_NULL ||
+ FirstQuote > TempSpot
+ ) {
+ return (BOOLEAN) ((TempSpot != NULL) && (*TempSpot != CHAR_NULL));
+ }
+
+ while ((TempSpot != NULL) && (*TempSpot != CHAR_NULL)) {
+ if (FirstQuote == NULL || FirstQuote > TempSpot) {
+ break;
+ }
+ SecondQuote = FindNextInstance (FirstQuote + 1, L"\"", TRUE);
+ if (SecondQuote == NULL) {
+ break;
+ }
+ if (SecondQuote < TempSpot) {
+ FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE);
+ continue;
+ } else {
+ FirstQuote = FindNextInstance (SecondQuote + 1, L"\"", TRUE);
+ TempSpot = FindSplit(TempSpot + 1);
+ continue;
+ }
+ }
+
return (BOOLEAN) ((TempSpot != NULL) && (*TempSpot != CHAR_NULL));
}
@@ -1233,48 +1354,6 @@ ShellConvertAlias(
}
/**
- Parse for the next instance of one string within another string. Can optionally make sure that
- the string was not escaped (^ character) per the shell specification.
-
- @param[in] SourceString The string to search within
- @param[in] FindString The string to look for
- @param[in] CheckForEscapeCharacter TRUE to skip escaped instances of FinfString, otherwise will return even escaped instances
-**/
-CHAR16*
-EFIAPI
-FindNextInstance(
- IN CONST CHAR16 *SourceString,
- IN CONST CHAR16 *FindString,
- IN CONST BOOLEAN CheckForEscapeCharacter
- )
-{
- CHAR16 *Temp;
- if (SourceString == NULL) {
- return (NULL);
- }
- Temp = StrStr(SourceString, FindString);
-
- //
- // If nothing found, or we dont care about escape characters
- //
- if (Temp == NULL || !CheckForEscapeCharacter) {
- return (Temp);
- }
-
- //
- // If we found an escaped character, try again on the remainder of the string
- //
- if ((Temp > (SourceString)) && *(Temp-1) == L'^') {
- return FindNextInstance(Temp+1, FindString, CheckForEscapeCharacter);
- }
-
- //
- // we found the right character
- //
- return (Temp);
-}
-
-/**
This function will eliminate unreplaced (and therefore non-found) environment variables.
@param[in,out] CmdLine The command line to update.
@@ -1323,14 +1402,17 @@ StripUnreplacedEnvironmentVariables(
}
ASSERT(FirstPercent < FirstQuote);
if (SecondPercent < FirstQuote) {
- FirstPercent[0] = L'\"';
- SecondPercent[0] = L'\"';
-
- //
- // We need to remove from FirstPercent to SecondPercent
- //
- CopyMem(FirstPercent + 1, SecondPercent, StrSize(SecondPercent));
- CurrentLocator = FirstPercent + 2;
+ if (IsValidEnvironmentVariableName(FirstPercent, SecondPercent)) {
+ //
+ // We need to remove from FirstPercent to SecondPercent
+ //
+ CopyMem(FirstPercent, SecondPercent + 1, StrSize(SecondPercent + 1));
+ //
+ // dont need to update the locator. both % characters are gone.
+ //
+ } else {
+ CurrentLocator = SecondPercent + 1;
+ }
continue;
}
ASSERT(FirstQuote < SecondPercent);
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
index 9c6cf61af5..9a2daa9ca4 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
@@ -349,14 +349,19 @@ PciRootBridgeIoDumpInformation(
}
Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_PH), NULL);
- ASSERT (Temp != NULL);
+ if (Temp == NULL) {
+ return NULL;
+ }
Temp2 = CatSPrint(L"\r\n", Temp, PciRootBridgeIo->ParentHandle);
FreePool(Temp);
RetVal = Temp2;
Temp2 = NULL;
Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_SEG), NULL);
- ASSERT (Temp != NULL);
+ if (Temp == NULL) {
+ SHELL_FREE_NON_NULL(RetVal);
+ return NULL;
+ }
Temp2 = CatSPrint(RetVal, Temp, PciRootBridgeIo->SegmentNumber);
FreePool(Temp);
FreePool(RetVal);
@@ -368,7 +373,10 @@ PciRootBridgeIoDumpInformation(
Status = PciRootBridgeIo->GetAttributes (PciRootBridgeIo, &Supports, &Attributes);
if (!EFI_ERROR(Status)) {
Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_ATT), NULL);
- ASSERT (Temp != NULL);
+ if (Temp == NULL) {
+ SHELL_FREE_NON_NULL(RetVal);
+ return NULL;
+ }
Temp2 = CatSPrint(RetVal, Temp, Attributes);
FreePool(Temp);
FreePool(RetVal);
@@ -376,7 +384,10 @@ PciRootBridgeIoDumpInformation(
Temp2 = NULL;
Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_SUPPORTS), NULL);
- ASSERT (Temp != NULL);
+ if (Temp == NULL) {
+ SHELL_FREE_NON_NULL(RetVal);
+ return NULL;
+ }
Temp2 = CatSPrint(RetVal, Temp, Supports);
FreePool(Temp);
FreePool(RetVal);
@@ -388,7 +399,10 @@ PciRootBridgeIoDumpInformation(
Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Configuration);
if (!EFI_ERROR(Status) && Configuration != NULL) {
Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_TITLE), NULL);
- ASSERT (Temp != NULL);
+ if (Temp == NULL) {
+ SHELL_FREE_NON_NULL(RetVal);
+ return NULL;
+ }
Temp2 = CatSPrint(RetVal, Temp, Supports);
FreePool(Temp);
FreePool(RetVal);
@@ -611,6 +625,9 @@ AdapterInformationDumpInformation (
return (CatSPrint(NULL, L"AdapterInfo"));
}
+ InfoTypesBuffer = NULL;
+ InformationBlock = NULL;
+
//
// Allocate print buffer to store data
//
@@ -643,18 +660,31 @@ AdapterInformationDumpInformation (
);
if (EFI_ERROR (Status)) {
TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GET_SUPP_TYPES_FAILED), NULL);
- RetVal = CatSPrint (RetVal, TempStr, Status);
+ if (TempStr != NULL) {
+ RetVal = CatSPrint (RetVal, TempStr, Status);
+ } else {
+ goto ERROR_EXIT;
+ }
} else {
TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_SUPP_TYPE_HEADER), NULL);
+ if (TempStr == NULL) {
+ goto ERROR_EXIT;
+ }
RetVal = CatSPrint (RetVal, TempStr);
SHELL_FREE_NON_NULL (TempStr);
for (GuidIndex = 0; GuidIndex < InfoTypesBufferCount; GuidIndex++) {
TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GUID_NUMBER), NULL);
+ if (TempStr == NULL) {
+ goto ERROR_EXIT;
+ }
RetVal = CatSPrint (RetVal, TempStr, (GuidIndex + 1), InfoTypesBuffer[GuidIndex]);
SHELL_FREE_NON_NULL (TempStr);
TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GUID_STRING), NULL);
+ if (TempStr == NULL) {
+ goto ERROR_EXIT;
+ }
if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) {
RetVal = CatSPrint (RetVal, TempStr, L"gEfiAdapterInfoMediaStateGuid");
@@ -694,10 +724,16 @@ AdapterInformationDumpInformation (
if (EFI_ERROR (Status)) {
TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_GETINFO_FAILED), NULL);
+ if (TempStr == NULL) {
+ goto ERROR_EXIT;
+ }
RetVal = CatSPrint (RetVal, TempStr, Status);
} else {
if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoMediaStateGuid)) {
TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_MEDIA_STATE), NULL);
+ if (TempStr == NULL) {
+ goto ERROR_EXIT;
+ }
RetVal = CatSPrint (
RetVal,
TempStr,
@@ -706,6 +742,9 @@ AdapterInformationDumpInformation (
);
} else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoNetworkBootGuid)) {
TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_NETWORK_BOOT_INFO), NULL);
+ if (TempStr == NULL) {
+ goto ERROR_EXIT;
+ }
RetVal = CatSPrint (
RetVal,
TempStr,
@@ -720,6 +759,9 @@ AdapterInformationDumpInformation (
);
} else if (CompareGuid (&InfoTypesBuffer[GuidIndex], &gEfiAdapterInfoSanMacAddressGuid) == TRUE) {
TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_SAN_MAC_ADDRESS_INFO), NULL);
+ if (TempStr == NULL) {
+ goto ERROR_EXIT;
+ }
RetVal = CatSPrint (
RetVal,
TempStr,
@@ -732,6 +774,9 @@ AdapterInformationDumpInformation (
);
} else {
TempStr = HiiGetString (mHandleParsingHiiHandle, STRING_TOKEN(STR_UNKNOWN_INFO_TYPE), NULL);
+ if (TempStr == NULL) {
+ goto ERROR_EXIT;
+ }
RetVal = CatSPrint (RetVal, TempStr, &InfoTypesBuffer[GuidIndex]);
}
}
@@ -740,7 +785,14 @@ AdapterInformationDumpInformation (
}
}
+ SHELL_FREE_NON_NULL (InfoTypesBuffer);
return RetVal;
+
+ERROR_EXIT:
+ SHELL_FREE_NON_NULL (RetVal);
+ SHELL_FREE_NON_NULL (InfoTypesBuffer);
+ SHELL_FREE_NON_NULL (InformationBlock);
+ return NULL;
}
//
// Put the information on the NT32 protocol GUIDs here so we are not dependant on the Nt32Pkg
@@ -763,6 +815,21 @@ STATIC CONST EFI_GUID WinNtThunkProtocolGuid = LOCAL_EFI_WIN_NT_THUNK_PROTOCOL_G
STATIC CONST EFI_GUID WinNtIoProtocolGuid = LOCAL_EFI_WIN_NT_BUS_DRIVER_IO_PROTOCOL_GUID;
STATIC CONST EFI_GUID WinNtSerialPortGuid = LOCAL_EFI_WIN_NT_SERIAL_PORT_GUID;
+//
+// Deprecated protocols we dont want to link from IntelFrameworkModulePkg
+//
+#define LOCAL_EFI_ISA_IO_PROTOCOL_GUID \
+ { \
+ 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \
+ }
+#define LOCAL_EFI_ISA_ACPI_PROTOCOL_GUID \
+ { \
+ 0x64a892dc, 0x5561, 0x4536, { 0x92, 0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55 } \
+ }
+STATIC CONST EFI_GUID EfiIsaIoProtocolGuid = LOCAL_EFI_ISA_IO_PROTOCOL_GUID;
+STATIC CONST EFI_GUID EfiIsaAcpiProtocolGuid = LOCAL_EFI_ISA_ACPI_PROTOCOL_GUID;
+
+
STATIC CONST GUID_INFO_BLOCK mGuidStringListNT[] = {
{STRING_TOKEN(STR_WINNT_THUNK), (EFI_GUID*)&WinNtThunkProtocolGuid, NULL},
{STRING_TOKEN(STR_WINNT_DRIVER_IO), (EFI_GUID*)&WinNtIoProtocolGuid, NULL},
@@ -874,8 +941,12 @@ STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = {
{STRING_TOKEN(STR_GPT_NBR), &gEfiPartTypeLegacyMbrGuid, NULL},
{STRING_TOKEN(STR_DRIVER_CONFIG), &gEfiDriverConfigurationProtocolGuid, NULL},
{STRING_TOKEN(STR_DRIVER_CONFIG2), &gEfiDriverConfiguration2ProtocolGuid, NULL},
- {STRING_TOKEN(STR_ISA_IO), &gEfiIsaIoProtocolGuid, NULL},
- {STRING_TOKEN(STR_ISA_ACPI), &gEfiIsaAcpiProtocolGuid, NULL},
+
+//
+// these are using local (non-global) definitions to reduce package dependancy.
+//
+ {STRING_TOKEN(STR_ISA_IO), (EFI_GUID*)&EfiIsaIoProtocolGuid, NULL},
+ {STRING_TOKEN(STR_ISA_ACPI), (EFI_GUID*)&EfiIsaAcpiProtocolGuid, NULL},
//
// the ones under this are GUID identified structs, not protocols
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
index ba6e152d3b..b0e27c09c3 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
@@ -135,8 +135,6 @@
#include <Protocol/DiskIo2.h>
#include <Protocol/AdapterInformation.h>
#include <Protocol/EfiShellDynamicCommand.h>
-#include <Protocol/IsaIo.h>
-#include <Protocol/IsaAcpi.h>
#include <Library/HandleParsingLib.h>
#include <Library/UefiBootServicesTableLib.h>
diff --git a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
index dc97876667..c95f41b115 100644
--- a/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
+++ b/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
@@ -36,7 +36,6 @@
MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
ShellPkg/ShellPkg.dec
- IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
[LibraryClasses]
UefiBootServicesTableLib
@@ -173,8 +172,6 @@
gEfiIdeControllerInitProtocolGuid ##UNDEFINED
gEfiDiskIo2ProtocolGuid ##UNDEFINED
gEfiAdapterInformationProtocolGuid ##UNDEFINED
- gEfiIsaIoProtocolGuid ##UNDEFINED
- gEfiIsaAcpiProtocolGuid ##UNDEFINED
gEfiShellDynamicCommandProtocolGuid ##UNDEFINED
[Guids]
diff --git a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
index 48739e20fd..368d6a487b 100644
--- a/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
+++ b/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
@@ -42,12 +42,26 @@ typedef struct {
CHAR16 *Name;
} MTD_NAME;
-typedef VOID (EFIAPI *SerialDecodeFucntion) (EFI_DEVICE_PATH_PROTOCOL *DevPath, DEVICE_CONSIST_MAPPING_INFO *MapInfo,EFI_DEVICE_PATH_PROTOCOL *);
+/**
+ Serial Decode function.
+
+ @param DevPath The Device path info.
+ @param MapInfo The map info.
+ @param OrigDevPath The original device path protocol.
+
+**/
+typedef
+VOID
+(EFIAPI *SERIAL_DECODE_FUNCTION) (
+ EFI_DEVICE_PATH_PROTOCOL *DevPath,
+ DEVICE_CONSIST_MAPPING_INFO *MapInfo,
+ EFI_DEVICE_PATH_PROTOCOL *OrigDevPath
+ );
typedef struct {
UINT8 Type;
UINT8 SubType;
- SerialDecodeFucntion SerialFun;
+ SERIAL_DECODE_FUNCTION SerialFun;
INTN (EFIAPI *CompareFun) (EFI_DEVICE_PATH_PROTOCOL *DevPath, EFI_DEVICE_PATH_PROTOCOL *DevPath2);
} DEV_PATH_CONSIST_MAPPING_TABLE;
@@ -426,6 +440,7 @@ DevPathCompareDefault (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -453,6 +468,7 @@ DevPathSerialHardDrive (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -476,6 +492,7 @@ DevPathSerialAtapi (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -500,6 +517,7 @@ DevPathSerialCdRom (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -524,6 +542,7 @@ DevPathSerialFibre (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -550,6 +569,7 @@ DevPathSerialUart (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -608,6 +628,7 @@ DevPathSerialUsb (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
@@ -671,6 +692,7 @@ DevPathSerialVendor (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -694,6 +716,7 @@ DevPathSerialLun (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -719,6 +742,7 @@ DevPathSerialSata (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -763,6 +787,7 @@ DevPathSerialIScsi (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -786,6 +811,7 @@ DevPathSerialI2O (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -823,6 +849,7 @@ DevPathSerialMacAddr (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -856,6 +883,7 @@ DevPathSerialInfiniBand (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -901,6 +929,8 @@ DevPathSerialIPv4 (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
+
**/
VOID
EFIAPI
@@ -938,6 +968,8 @@ DevPathSerialIPv6 (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
+
**/
VOID
EFIAPI
@@ -962,6 +994,7 @@ DevPathSerialScsi (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -987,6 +1020,7 @@ DevPathSerial1394 (
@param[in] DevicePathNode The node to get info on.
@param[in] MappingItem The info item to populate.
+ @param[in] DevicePath Ignored.
**/
VOID
EFIAPI
@@ -1015,6 +1049,7 @@ DevPathSerialAcpi (
@param[in] DevicePathNode Ignored.
@param[in] MappingItem Ignored.
+ @param[in] DevicePath Ignored.
Does nothing.
**/
@@ -1265,7 +1300,7 @@ GetDeviceConsistMappingInfo (
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- SerialDecodeFucntion SerialFun;
+ SERIAL_DECODE_FUNCTION SerialFun;
UINTN Index;
EFI_DEVICE_PATH_PROTOCOL *OriginalDevicePath;
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c
index 11b8e91bc5..bd4a374d91 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c
@@ -93,6 +93,8 @@ ShellConnectPciRootBridge (
for (RootBridgeIndex = 0; RootBridgeIndex < RootBridgeHandleCount; RootBridgeIndex++) {
gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE);
}
+
+ FreePool (RootBridgeHandleBuffer);
return EFI_SUCCESS;
}
@@ -192,7 +194,7 @@ ConnectControllers (
**/
EFI_STATUS
EFIAPI
-ConnectFromDevPaths (
+ShellConnectFromDevPaths (
IN CONST CHAR16 *Key
)
{
@@ -462,31 +464,31 @@ ShellCommandRunConnect (
// do the conin and conout from EFI variables
// if the first fails dont 'loose' the error
//
- Status = ConnectFromDevPaths(L"ConInDev");
+ Status = ShellConnectFromDevPaths(L"ConInDev");
if (EFI_ERROR(Status)) {
- ConnectFromDevPaths(L"ConOutDev");
+ ShellConnectFromDevPaths(L"ConOutDev");
} else {
- Status = ConnectFromDevPaths(L"ConOutDev");
+ Status = ShellConnectFromDevPaths(L"ConOutDev");
}
if (EFI_ERROR(Status)) {
- ConnectFromDevPaths(L"ErrOutDev");
+ ShellConnectFromDevPaths(L"ErrOutDev");
} else {
- Status = ConnectFromDevPaths(L"ErrOutDev");
+ Status = ShellConnectFromDevPaths(L"ErrOutDev");
}
if (EFI_ERROR(Status)) {
- ConnectFromDevPaths(L"ErrOut");
+ ShellConnectFromDevPaths(L"ErrOut");
} else {
- Status = ConnectFromDevPaths(L"ErrOut");
+ Status = ShellConnectFromDevPaths(L"ErrOut");
}
if (EFI_ERROR(Status)) {
- ConnectFromDevPaths(L"ConIn");
+ ShellConnectFromDevPaths(L"ConIn");
} else {
- Status = ConnectFromDevPaths(L"ConIn");
+ Status = ShellConnectFromDevPaths(L"ConIn");
}
if (EFI_ERROR(Status)) {
- ConnectFromDevPaths(L"ConOut");
+ ShellConnectFromDevPaths(L"ConOut");
} else {
- Status = ConnectFromDevPaths(L"ConOut");
+ Status = ShellConnectFromDevPaths(L"ConOut");
}
if (EFI_ERROR(Status)) {
ShellStatus = SHELL_DEVICE_ERROR;
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c
index e6a0fba20d..e4747e310a 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Reconnect.c
@@ -1,7 +1,7 @@
/** @file
Main file for Reconnect shell Driver1 function.
- Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2014, 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
@@ -14,6 +14,30 @@
#include "UefiShellDriver1CommandsLib.h"
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
+ {L"-r", TypeFlag},
+ {NULL, TypeMax}
+ };
+
+/**
+ Connect all the possible console devices.
+
+**/
+VOID
+ConnectAllConsoles (
+ VOID
+ )
+{
+ ShellConnectFromDevPaths(L"ConInDev");
+ ShellConnectFromDevPaths(L"ConOutDev");
+ ShellConnectFromDevPaths(L"ErrOutDev");
+
+ ShellConnectFromDevPaths(L"ErrOut");
+ ShellConnectFromDevPaths(L"ConIn");
+ ShellConnectFromDevPaths(L"ConOut");
+}
+
+
/**
Function for 'reconnect' command.
@@ -28,15 +52,46 @@ ShellCommandRunReconnect (
)
{
SHELL_STATUS ShellStatus;
+ LIST_ENTRY *Package;
+ CHAR16 *ProblemParam;
+ EFI_STATUS Status;
gInReconnect = TRUE;
+ ShellStatus = SHELL_SUCCESS;
+
+ //
+ // initialize the shell lib (we must be in non-auto-init...)
+ //
+ Status = ShellInitialize();
+ ASSERT_EFI_ERROR(Status);
- ShellStatus = ShellCommandRunDisconnect(ImageHandle, SystemTable);
- if (ShellStatus == SHELL_SUCCESS) {
- ShellStatus = ShellCommandRunConnect(ImageHandle, SystemTable);
- }
+ Status = CommandInit();
+ ASSERT_EFI_ERROR(Status);
+
+ //
+ // parse the command line
+ //
+ Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);
+ if (EFI_ERROR(Status)) {
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDriver1HiiHandle, ProblemParam);
+ FreePool(ProblemParam);
+ ShellStatus = SHELL_INVALID_PARAMETER;
+ } else {
+ ASSERT(FALSE);
+ }
+ } else {
+ ShellStatus = ShellCommandRunDisconnect(ImageHandle, SystemTable);
+ if (ShellStatus == SHELL_SUCCESS) {
+ if (ShellCommandLineGetFlag(Package, L"-r")) {
+ ConnectAllConsoles();
+ }
+ ShellStatus = ShellCommandRunConnect(ImageHandle, SystemTable);
+ }
+ }
gInReconnect = FALSE;
return (ShellStatus);
}
+
diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h
index 1b8e56822d..c65d0ed695 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h
@@ -207,5 +207,20 @@ ShellCommandRunUnload (
IN EFI_SYSTEM_TABLE *SystemTable
);
+/**
+ Do a connect from an EFI variable via it's key name.
+
+ @param[in] Key The name of the EFI Variable.
+
+ @retval EFI_SUCCESS The operation was successful.
+**/
+EFI_STATUS
+EFIAPI
+ShellConnectFromDevPaths (
+ IN CONST CHAR16 *Key
+ );
+
+
+
#endif
diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
index 6cef8b7d4c..b7ca41b984 100644
--- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
+++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
@@ -2079,7 +2079,6 @@ InternalCommandLineParse (
break;
}
} else if (GetItemValue != 0 && CurrentItemPackage != NULL && !InternalIsFlag(Argv[LoopCounter], AlwaysAllowNumbers, (CONST BOOLEAN)(CurrentItemPackage->Type == TypeTimeValue))) {
- ASSERT(CurrentItemPackage != NULL);
//
// get the item VALUE for a previous flag
//