summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Console/TerminalDxe
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/TerminalDxe
parentd5893e0b04e2ff7182dd7af08af13f046e3ede25 (diff)
downloadedk2-4986c56135200fb7de90b78c47ea47381bfda95f.zip
edk2-4986c56135200fb7de90b78c47ea47381bfda95f.tar.gz
edk2-4986c56135200fb7de90b78c47ea47381bfda95f.tar.bz2
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/TerminalDxe')
-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
3 files changed, 54 insertions, 71 deletions
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index 1da6d90..92ec98a 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 7327da0..af3afec 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 1d849c6..204ca60 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