summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal/Console
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-24 08:03:42 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-24 08:03:42 +0000
commit4986c56135200fb7de90b78c47ea47381bfda95f (patch)
tree33465519d619aee98ad5bd63e872f2e44cebd149 /MdeModulePkg/Universal/Console
parentd5893e0b04e2ff7182dd7af08af13f046e3ede25 (diff)
downloadedk2-4986c56135200fb7de90b78c47ea47381bfda95f.tar.gz
edk2-4986c56135200fb7de90b78c47ea47381bfda95f.tar.bz2
edk2-4986c56135200fb7de90b78c47ea47381bfda95f.zip
temporary roll back changing on gEfiHotPlugDevice.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7640 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Console')
-rw-r--r--MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c159
-rw-r--r--MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h12
-rw-r--r--MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf1
-rw-r--r--MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c106
-rw-r--r--MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h18
-rw-r--r--MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf1
6 files changed, 131 insertions, 166 deletions
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
index f6483ed1fd..f3aa4a4fb3 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
@@ -256,12 +256,12 @@ ConPlatformTextInDriverBindingStart (
return Status;
}
//
- // Check the device path, if it is a hot plug device,
+ // Check the device handle, if it is a hot plug device,
// do not put the device path into ConInDev, and install
// gEfiConsoleInDeviceGuid to the device handle directly.
// The policy is, make hot plug device plug in and play immediately.
//
- if (IsHotPlugDevice (DevicePath)) {
+ if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
gBS->InstallMultipleProtocolInterfaces (
&ControllerHandle,
&gEfiConsoleInDeviceGuid,
@@ -373,12 +373,12 @@ ConPlatformTextOutDriverBindingStart (
return Status;
}
//
- // Check the device path, if it is a hot plug device,
+ // Check the device handle, if it is a hot plug device,
// do not put the device path into ConOutDev and ErrOutDev,
// and install gEfiConsoleOutDeviceGuid to the device handle directly.
// The policy is, make hot plug device plug in and play immediately.
//
- if (IsHotPlugDevice (DevicePath)) {
+ if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
gBS->InstallMultipleProtocolInterfaces (
&ControllerHandle,
&gEfiConsoleOutDeviceGuid,
@@ -482,35 +482,31 @@ ConPlatformTextInDriverBindingStop (
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
//
- // Get the Device Path Protocol firstly
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
// If it is not a hot-plug device, first delete it from the ConInDev variable.
//
- if (!IsHotPlugDevice (DevicePath)) {
- //
- // Remove DevicePath from ConInDev
+ if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
//
- ConPlatformUpdateDeviceVariable (
- L"ConInDev",
- DevicePath,
- DELETE
- );
+ // Get the Device Path Protocol so the environment variables can be updated
+ //
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &DevicePath,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Remove DevicePath from ConInDev
+ //
+ ConPlatformUpdateDeviceVariable (
+ L"ConInDev",
+ DevicePath,
+ DELETE
+ );
+ }
}
-
//
// Uninstall the Console Device GUIDs from Controller Handle
//
@@ -561,40 +557,36 @@ ConPlatformTextOutDriverBindingStop (
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
//
- // Get the Device Path Protocol firstly
- //
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
-
- if (EFI_ERROR (Status)) {
- return Status;
- }
-
- //
// If it is not a hot-plug device, first delete it from the ConOutDev and ErrOutDev variable.
//
- if (!IsHotPlugDevice (DevicePath)) {
+ if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
//
- // Remove DevicePath from ConOutDev, and ErrOutDev
+ // Get the Device Path Protocol so the environment variables can be updated
//
- ConPlatformUpdateDeviceVariable (
- L"ConOutDev",
- DevicePath,
- DELETE
- );
- ConPlatformUpdateDeviceVariable (
- L"ErrOutDev",
- DevicePath,
- DELETE
- );
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &DevicePath,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
+ //
+ // Remove DevicePath from ConOutDev, and ErrOutDev
+ //
+ ConPlatformUpdateDeviceVariable (
+ L"ConOutDev",
+ DevicePath,
+ DELETE
+ );
+ ConPlatformUpdateDeviceVariable (
+ L"ErrOutDev",
+ DevicePath,
+ DELETE
+ );
+ }
}
-
//
// Uninstall the Console Device GUIDs from Controller Handle
//
@@ -937,12 +929,10 @@ ConPlatformUpdateDeviceVariable (
}
/**
- Check if the device supports hot-plug through its device path.
-
- This function could be updated to check more types of Hot Plug devices.
- Currently, it checks USB and PCCard device.
+ Check if the device supports hot-plug.
- @param DevicePath Pointer to device's device path.
+ @param DriverBindingHandle Protocol instance pointer.
+ @param ControllerHandle Handle of device to check.
@retval TRUE The devcie is a hot-plug device
@retval FALSE The devcie is not a hot-plug device.
@@ -950,35 +940,26 @@ ConPlatformUpdateDeviceVariable (
**/
BOOLEAN
IsHotPlugDevice (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ EFI_HANDLE DriverBindingHandle,
+ EFI_HANDLE ControllerHandle
)
{
- EFI_DEVICE_PATH_PROTOCOL *CheckDevicePath;
+ EFI_STATUS Status;
- CheckDevicePath = DevicePath;
- while (!IsDevicePathEnd (CheckDevicePath)) {
- //
- // Check device whether is hot plug device or not throught Device Path
- //
- if ((DevicePathType (CheckDevicePath) == MESSAGING_DEVICE_PATH) &&
- (DevicePathSubType (CheckDevicePath) == MSG_USB_DP ||
- DevicePathSubType (CheckDevicePath) == MSG_USB_CLASS_DP ||
- DevicePathSubType (CheckDevicePath) == MSG_USB_WWID_DP)) {
- //
- // If Device is USB device
- //
- return TRUE;
- }
- if ((DevicePathType (CheckDevicePath) == HARDWARE_DEVICE_PATH) &&
- (DevicePathSubType (CheckDevicePath) == HW_PCCARD_DP)) {
- //
- // If Device is PCCard
- //
- return TRUE;
- }
-
- CheckDevicePath = NextDevicePathNode (CheckDevicePath);
+ //
+ // HotPlugDeviceGuid indicates ControllerHandle stands for a hot plug device.
+ //
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiHotPlugDeviceGuid,
+ NULL,
+ DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
+ return FALSE;
}
- return FALSE;
+ return TRUE;
}
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
index a47ad1ce30..f7883dce6c 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
@@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/SimpleTextOut.h>
#include <Protocol/DevicePath.h>
#include <Protocol/SimpleTextIn.h>
+#include <Protocol/HotPlugDevice.h>
#include <Guid/GlobalVariable.h>
#include <Guid/ConsoleInDevice.h>
@@ -292,12 +293,10 @@ ConPlatformUpdateDeviceVariable (
);
/**
- Check if the device supports hot-plug through its device path.
+ Check if the device supports hot-plug.
- This function could be updated to check more types of Hot Plug devices.
- Currently, it checks USB and PCCard device.
-
- @param DevicePath Pointer to device's device path.
+ @param DriverBindingHandle Protocol instance pointer.
+ @param ControllerHandle Handle of device to check.
@retval TRUE The devcie is a hot-plug device
@retval FALSE The devcie is not a hot-plug device.
@@ -305,7 +304,8 @@ ConPlatformUpdateDeviceVariable (
**/
BOOLEAN
IsHotPlugDevice (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
+ EFI_HANDLE DriverBindingHandle,
+ EFI_HANDLE ControllerHandle
);
//
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
index 892d051a1a..a96a6330a0 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
@@ -87,4 +87,5 @@
gEfiDevicePathProtocolGuid ## TO_START
gEfiSimpleTextInProtocolGuid ## TO_START
gEfiSimpleTextOutProtocolGuid ## TO_START
+ gEfiHotPlugDeviceGuid ## SOMETIMES_CONSUMES (Used to check if it's a hot-plug device)
\ No newline at end of file
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index 1da6d90677..92ec98a09f 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
@@ -300,12 +300,19 @@ TerminalDriverBindingStart (
if (EFI_ERROR (Status)) {
goto Error;
}
-
- if (IsHotPlugDevice (ParentDevicePath)) {
- //
- // if the serial device is a hot plug device, do not update the
- // ConInDev, ConOutDev, and StdErrDev variables.
- //
+ //
+ // if the serial device is a hot plug device, do not update the
+ // ConInDev, ConOutDev, and StdErrDev variables.
+ //
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiHotPlugDeviceGuid,
+ NULL,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ );
+ if (EFI_ERROR (Status)) {
TerminalUpdateConsoleDevVariable (L"ConInDev", ParentDevicePath);
TerminalUpdateConsoleDevVariable (L"ConOutDev", ParentDevicePath);
TerminalUpdateConsoleDevVariable (L"ErrOutDev", ParentDevicePath);
@@ -620,7 +627,26 @@ TerminalDriverBindingStart (
if (EFI_ERROR (Status)) {
goto Error;
}
-
+ //
+ // if the serial device is a hot plug device, attaches the HotPlugGuid
+ // onto the terminal device handle.
+ //
+ Status = gBS->OpenProtocol (
+ Controller,
+ &gEfiHotPlugDeviceGuid,
+ NULL,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->InstallMultipleProtocolInterfaces (
+ &TerminalDevice->Handle,
+ &gEfiHotPlugDeviceGuid,
+ NULL,
+ NULL
+ );
+ }
//
// Register the Parent-Child relationship via
// EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
@@ -860,6 +886,25 @@ TerminalDriverBindingStop (
FreeUnicodeStringTable (TerminalDevice->ControllerNameTable);
}
+ Status = gBS->OpenProtocol (
+ ChildHandleBuffer[Index],
+ &gEfiHotPlugDeviceGuid,
+ NULL,
+ This->DriverBindingHandle,
+ Controller,
+ EFI_OPEN_PROTOCOL_TEST_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
+ Status = gBS->UninstallMultipleProtocolInterfaces (
+ ChildHandleBuffer[Index],
+ &gEfiHotPlugDeviceGuid,
+ NULL,
+ NULL
+ );
+ } else {
+ Status = EFI_SUCCESS;
+ }
+
gBS->CloseEvent (TerminalDevice->TwoSecondTimeOut);
gBS->CloseEvent (TerminalDevice->SimpleInput.WaitForKey);
gBS->CloseEvent (TerminalDevice->SimpleInputEx.WaitForKeyEx);
@@ -1277,50 +1322,3 @@ InitializeTerminal(
return Status;
}
-
-/**
- Check if the device supports hot-plug through its device path.
-
- This function could be updated to check more types of Hot Plug devices.
- Currently, it checks USB and PCCard device.
-
- @param DevicePath Pointer to device's device path.
-
- @retval TRUE The devcie is a hot-plug device
- @retval FALSE The devcie is not a hot-plug device.
-
-**/
-BOOLEAN
-IsHotPlugDevice (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- )
-{
- EFI_DEVICE_PATH_PROTOCOL *CheckDevicePath;
-
- CheckDevicePath = DevicePath;
- while (!IsDevicePathEnd (CheckDevicePath)) {
- //
- // Check device whether is hot plug device or not throught Device Path
- //
- if ((DevicePathType (CheckDevicePath) == MESSAGING_DEVICE_PATH) &&
- (DevicePathSubType (CheckDevicePath) == MSG_USB_DP ||
- DevicePathSubType (CheckDevicePath) == MSG_USB_CLASS_DP ||
- DevicePathSubType (CheckDevicePath) == MSG_USB_WWID_DP)) {
- //
- // If Device is USB device
- //
- return TRUE;
- }
- if ((DevicePathType (CheckDevicePath) == HARDWARE_DEVICE_PATH) &&
- (DevicePathSubType (CheckDevicePath) == HW_PCCARD_DP)) {
- //
- // If Device is PCCard
- //
- return TRUE;
- }
-
- CheckDevicePath = NextDevicePathNode (CheckDevicePath);
- }
-
- return FALSE;
-}
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
index 7327da003a..af3afecd15 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
@@ -22,6 +22,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Guid/PcAnsi.h>
#include <Protocol/SimpleTextInExNotify.h>
+#include <Protocol/HotPlugDevice.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/SerialIo.h>
#include <Protocol/DevicePath.h>
@@ -1346,21 +1347,4 @@ TerminalIsValidEfiCntlChar (
IN CHAR16 CharC
);
-/**
- Check if the device supports hot-plug through its device path.
-
- This function could be updated to check more types of Hot Plug devices.
- Currently, it checks USB and PCCard device.
-
- @param DevicePath Pointer to device's device path.
-
- @retval TRUE The devcie is a hot-plug device
- @retval FALSE The devcie is not a hot-plug device.
-
-**/
-BOOLEAN
-IsHotPlugDevice (
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
- );
-
#endif
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
index 1d849c698b..204ca6040b 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
@@ -73,6 +73,7 @@
gEfiSimpleTextInputExProtocolGuid ## BY_START
gEfiSimpleTextOutProtocolGuid ## BY_START
gSimpleTextInExNotifyGuid ## SOMETIMES_CONSUMES
+ gEfiHotPlugDeviceGuid ## SOMETIMES_CONSUMES
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleError