fixed one bug when "reconnect -r"

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8116 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2009-04-17 05:40:21 +00:00
parent 75bf9d0ecc
commit e672aebac6

View File

@ -528,7 +528,7 @@ Index: shellenv/Connect.c
EFI_GUID *ConsoleGuid, EFI_GUID *ConsoleGuid,
EFI_HANDLE *ConsoleHandle, EFI_HANDLE *ConsoleHandle,
VOID **ConsoleInterface VOID **ConsoleInterface
@@ -1018,9 +1027,8 @@ @@ -1018,27 +1027,36 @@
EFI_HANDLE *AllHandleBuffer; EFI_HANDLE *AllHandleBuffer;
VOID *Interface; VOID *Interface;
@ -538,9 +538,14 @@ Index: shellenv/Connect.c
+ AllHandleBuffer = NULL; + AllHandleBuffer = NULL;
DevicePath = LibGetVariable (VariableName, &gEfiGlobalVariableGuid); DevicePath = LibGetVariable (VariableName, &gEfiGlobalVariableGuid);
if (DevicePath != NULL) { - if (DevicePath != NULL) {
@@ -1028,17 +1036,19 @@ - SEnvConnectDevicePath (DevicePath);
FreePool (DevicePath); - FreePool (DevicePath);
+ if (DevicePath == NULL) {
+ //
+ // If no any device defined in EFI variable, do nothing
+ //
+ return;
} }
- AllHandleBuffer = NULL; - AllHandleBuffer = NULL;
@ -554,6 +559,12 @@ Index: shellenv/Connect.c
- if (!EFI_ERROR (Status) && AllHandleCount > 0) { - if (!EFI_ERROR (Status) && AllHandleCount > 0) {
- *ConsoleHandle = AllHandleBuffer[0]; - *ConsoleHandle = AllHandleBuffer[0];
- } else if (*ConsoleHandle == NULL) { - } else if (*ConsoleHandle == NULL) {
+ //
+ // Connect all console devices
+ //
+ SEnvConnectDevicePath (DevicePath);
+ FreePool (DevicePath);
+
+ Status = EFI_NOT_FOUND; + Status = EFI_NOT_FOUND;
+ // + //
+ // Check ConsoleHandle validation whatever it was updated or not. + // Check ConsoleHandle validation whatever it was updated or not.
@ -570,7 +581,7 @@ Index: shellenv/Connect.c
AllHandleBuffer = NULL; AllHandleBuffer = NULL;
Status = BS->LocateHandleBuffer ( Status = BS->LocateHandleBuffer (
ByProtocol, ByProtocol,
@@ -1063,16 +1073,16 @@ @@ -1063,16 +1081,16 @@
&gEfiDevicePathProtocolGuid, &gEfiDevicePathProtocolGuid,
&Interface &Interface
); );
@ -590,7 +601,7 @@ Index: shellenv/Connect.c
if (*ConsoleHandle != NULL) { if (*ConsoleHandle != NULL) {
BS->HandleProtocol ( BS->HandleProtocol (
*ConsoleHandle, *ConsoleHandle,
@@ -1081,7 +1091,7 @@ @@ -1081,7 +1099,7 @@
); );
} }
@ -599,7 +610,7 @@ Index: shellenv/Connect.c
FreePool (AllHandleBuffer); FreePool (AllHandleBuffer);
} }
} }
@@ -1189,8 +1199,7 @@ @@ -1189,8 +1207,7 @@
EFI_STATUS Status; EFI_STATUS Status;
// //
@ -609,7 +620,7 @@ Index: shellenv/Connect.c
// //
Status = SEnvCheckConsoleProxy ( Status = SEnvCheckConsoleProxy (
ST->ConsoleInHandle, ST->ConsoleInHandle,
@@ -1203,23 +1212,21 @@ @@ -1203,23 +1220,21 @@
// Indicate the Console is replaced by redirection operation // Indicate the Console is replaced by redirection operation
// It is not safe to connect Console here // It is not safe to connect Console here
// //
@ -644,7 +655,7 @@ Index: shellenv/Connect.c
&gEfiSimpleTextOutProtocolGuid, &gEfiSimpleTextOutProtocolGuid,
&ST->StandardErrorHandle, &ST->StandardErrorHandle,
(VOID **) &ST->StdErr (VOID **) &ST->StdErr
@@ -1227,7 +1234,6 @@ @@ -1227,7 +1242,6 @@
SEnvConnectConsole ( SEnvConnectConsole (
VarConsoleOut, VarConsoleOut,
@ -652,7 +663,7 @@ Index: shellenv/Connect.c
&gEfiSimpleTextOutProtocolGuid, &gEfiSimpleTextOutProtocolGuid,
&ST->ConsoleOutHandle, &ST->ConsoleOutHandle,
(VOID **) &ST->ConOut (VOID **) &ST->ConOut
@@ -1235,7 +1241,6 @@ @@ -1235,7 +1249,6 @@
SEnvConnectConsole ( SEnvConnectConsole (
VarConsoleIn, VarConsoleIn,
@ -660,7 +671,7 @@ Index: shellenv/Connect.c
&gEfiSimpleTextInProtocolGuid, &gEfiSimpleTextInProtocolGuid,
&ST->ConsoleInHandle, &ST->ConsoleInHandle,
(VOID **) &ST->ConIn (VOID **) &ST->ConIn
@@ -1254,6 +1259,8 @@ @@ -1254,6 +1267,8 @@
SetCrc (&ST->Hdr); SetCrc (&ST->Hdr);
} }