mirror of https://github.com/acidanthera/audk.git
Update ConPlatform to ensure console dev variable is correct.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7796 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
0dc9978436
commit
ca6b86efed
|
@ -226,6 +226,7 @@ ConPlatformTextInDriverBindingStart (
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn;
|
EFI_SIMPLE_TEXT_INPUT_PROTOCOL *TextIn;
|
||||||
|
BOOLEAN IsInConInVariable;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Get the Device Path Protocol so the environment variables can be updated
|
// Get the Device Path Protocol so the environment variables can be updated
|
||||||
|
@ -255,6 +256,19 @@ ConPlatformTextInDriverBindingStart (
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// Check if the device path is in ConIn Variable
|
||||||
|
//
|
||||||
|
IsInConInVariable = FALSE;
|
||||||
|
Status = ConPlatformUpdateDeviceVariable (
|
||||||
|
L"ConIn",
|
||||||
|
DevicePath,
|
||||||
|
CHECK
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
IsInConInVariable = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the device path, if it is a hot plug device,
|
// Check the device path, if it is a hot plug device,
|
||||||
// do not put the device path into ConInDev, and install
|
// do not put the device path into ConInDev, and install
|
||||||
|
@ -268,6 +282,16 @@ ConPlatformTextInDriverBindingStart (
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
//
|
||||||
|
// Append the device path to ConInDev only if it is in ConIn variable.
|
||||||
|
//
|
||||||
|
if (IsInConInVariable) {
|
||||||
|
ConPlatformUpdateDeviceVariable (
|
||||||
|
L"ConInDev",
|
||||||
|
DevicePath,
|
||||||
|
APPEND
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// If it is not a hot-plug device, append the device path to the
|
// If it is not a hot-plug device, append the device path to the
|
||||||
|
@ -283,13 +307,7 @@ ConPlatformTextInDriverBindingStart (
|
||||||
// If the device path is an instance in the ConIn environment variable,
|
// If the device path is an instance in the ConIn environment variable,
|
||||||
// then install EfiConsoleInDeviceGuid onto ControllerHandle
|
// then install EfiConsoleInDeviceGuid onto ControllerHandle
|
||||||
//
|
//
|
||||||
Status = ConPlatformUpdateDeviceVariable (
|
if (IsInConInVariable) {
|
||||||
L"ConIn",
|
|
||||||
DevicePath,
|
|
||||||
CHECK
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
gBS->InstallMultipleProtocolInterfaces (
|
gBS->InstallMultipleProtocolInterfaces (
|
||||||
&ControllerHandle,
|
&ControllerHandle,
|
||||||
&gEfiConsoleInDeviceGuid,
|
&gEfiConsoleInDeviceGuid,
|
||||||
|
@ -341,6 +359,8 @@ ConPlatformTextOutDriverBindingStart (
|
||||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;
|
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *TextOut;
|
||||||
BOOLEAN NeedClose;
|
BOOLEAN NeedClose;
|
||||||
|
BOOLEAN IsInConOutVariable;
|
||||||
|
BOOLEAN IsInErrOutVariable;
|
||||||
|
|
||||||
NeedClose = TRUE;
|
NeedClose = TRUE;
|
||||||
|
|
||||||
|
@ -372,6 +392,29 @@ ConPlatformTextOutDriverBindingStart (
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// Check if the device path is in ConOut & ErrOut Variable
|
||||||
|
//
|
||||||
|
IsInConOutVariable = FALSE;
|
||||||
|
Status = ConPlatformUpdateDeviceVariable (
|
||||||
|
L"ConOut",
|
||||||
|
DevicePath,
|
||||||
|
CHECK
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
IsInConOutVariable = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
IsInErrOutVariable = FALSE;
|
||||||
|
Status = ConPlatformUpdateDeviceVariable (
|
||||||
|
L"ErrOut",
|
||||||
|
DevicePath,
|
||||||
|
CHECK
|
||||||
|
);
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
IsInErrOutVariable = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check the device path, if it is a hot plug device,
|
// Check the device path, if it is a hot plug device,
|
||||||
// do not put the device path into ConOutDev and ErrOutDev,
|
// do not put the device path into ConOutDev and ErrOutDev,
|
||||||
|
@ -385,6 +428,26 @@ ConPlatformTextOutDriverBindingStart (
|
||||||
NULL,
|
NULL,
|
||||||
NULL
|
NULL
|
||||||
);
|
);
|
||||||
|
//
|
||||||
|
// Append the device path to ConOutDev only if it is in ConOut variable.
|
||||||
|
//
|
||||||
|
if (IsInConOutVariable) {
|
||||||
|
ConPlatformUpdateDeviceVariable (
|
||||||
|
L"ConOutDev",
|
||||||
|
DevicePath,
|
||||||
|
APPEND
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Append the device path to ErrOutDev only if it is in ErrOut variable.
|
||||||
|
//
|
||||||
|
if (IsInErrOutVariable) {
|
||||||
|
ConPlatformUpdateDeviceVariable (
|
||||||
|
L"ErrOutDev",
|
||||||
|
DevicePath,
|
||||||
|
APPEND
|
||||||
|
);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//
|
//
|
||||||
// If it is not a hot-plug device, first append the device path to the
|
// If it is not a hot-plug device, first append the device path to the
|
||||||
|
@ -408,13 +471,7 @@ ConPlatformTextOutDriverBindingStart (
|
||||||
// If the device path is an instance in the ConOut environment variable,
|
// If the device path is an instance in the ConOut environment variable,
|
||||||
// then install EfiConsoleOutDeviceGuid onto ControllerHandle
|
// then install EfiConsoleOutDeviceGuid onto ControllerHandle
|
||||||
//
|
//
|
||||||
Status = ConPlatformUpdateDeviceVariable (
|
if (IsInConOutVariable) {
|
||||||
L"ConOut",
|
|
||||||
DevicePath,
|
|
||||||
CHECK
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
NeedClose = FALSE;
|
NeedClose = FALSE;
|
||||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||||
&ControllerHandle,
|
&ControllerHandle,
|
||||||
|
@ -427,12 +484,7 @@ ConPlatformTextOutDriverBindingStart (
|
||||||
// If the device path is an instance in the ErrOut environment variable,
|
// If the device path is an instance in the ErrOut environment variable,
|
||||||
// then install EfiStandardErrorDeviceGuid onto ControllerHandle
|
// then install EfiStandardErrorDeviceGuid onto ControllerHandle
|
||||||
//
|
//
|
||||||
Status = ConPlatformUpdateDeviceVariable (
|
if (IsInErrOutVariable) {
|
||||||
L"ErrOut",
|
|
||||||
DevicePath,
|
|
||||||
CHECK
|
|
||||||
);
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
NeedClose = FALSE;
|
NeedClose = FALSE;
|
||||||
gBS->InstallMultipleProtocolInterfaces (
|
gBS->InstallMultipleProtocolInterfaces (
|
||||||
&ControllerHandle,
|
&ControllerHandle,
|
||||||
|
@ -497,18 +549,13 @@ ConPlatformTextInDriverBindingStop (
|
||||||
//
|
//
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
// If it is not a hot-plug device, first delete it from the ConInDev variable.
|
// Remove DevicePath from ConInDev if exists.
|
||||||
//
|
//
|
||||||
if (!IsHotPlugDevice (DevicePath)) {
|
ConPlatformUpdateDeviceVariable (
|
||||||
//
|
L"ConInDev",
|
||||||
// Remove DevicePath from ConInDev
|
DevicePath,
|
||||||
//
|
DELETE
|
||||||
ConPlatformUpdateDeviceVariable (
|
);
|
||||||
L"ConInDev",
|
|
||||||
DevicePath,
|
|
||||||
DELETE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -524,11 +571,11 @@ ConPlatformTextInDriverBindingStop (
|
||||||
// Close the Simple Text Input Protocol
|
// Close the Simple Text Input Protocol
|
||||||
//
|
//
|
||||||
gBS->CloseProtocol (
|
gBS->CloseProtocol (
|
||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
&gEfiSimpleTextInProtocolGuid,
|
&gEfiSimpleTextInProtocolGuid,
|
||||||
This->DriverBindingHandle,
|
This->DriverBindingHandle,
|
||||||
ControllerHandle
|
ControllerHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -573,23 +620,18 @@ ConPlatformTextOutDriverBindingStop (
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
//
|
//
|
||||||
// If it is not a hot-plug device, first delete it from the ConOutDev and ErrOutDev variable.
|
// Remove DevicePath from ConOutDev and ErrOutDev if exists.
|
||||||
//
|
//
|
||||||
if (!IsHotPlugDevice (DevicePath)) {
|
ConPlatformUpdateDeviceVariable (
|
||||||
//
|
L"ConOutDev",
|
||||||
// Remove DevicePath from ConOutDev, and ErrOutDev
|
DevicePath,
|
||||||
//
|
DELETE
|
||||||
ConPlatformUpdateDeviceVariable (
|
);
|
||||||
L"ConOutDev",
|
ConPlatformUpdateDeviceVariable (
|
||||||
DevicePath,
|
L"ErrOutDev",
|
||||||
DELETE
|
DevicePath,
|
||||||
);
|
DELETE
|
||||||
ConPlatformUpdateDeviceVariable (
|
);
|
||||||
L"ErrOutDev",
|
|
||||||
DevicePath,
|
|
||||||
DELETE
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue