summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
diff options
context:
space:
mode:
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-25 07:54:57 +0000
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>2009-02-25 07:54:57 +0000
commitf1aec6ccb4025a96270a25f87d212ec994793673 (patch)
tree1cfb02ef8b46a7684a7e76f8df20404b22cf354c /MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
parent34070f1dbf15eff362a404e45627b3968e172674 (diff)
downloadedk2-f1aec6ccb4025a96270a25f87d212ec994793673.zip
edk2-f1aec6ccb4025a96270a25f87d212ec994793673.tar.gz
edk2-f1aec6ccb4025a96270a25f87d212ec994793673.tar.bz2
1. Retired HotPlugDevice protocol.
2. Check devicepath node to get hot plug information. Currently, USB and PCCard device are checked. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7673 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c')
-rw-r--r--MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c107
1 files changed, 55 insertions, 52 deletions
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
index 92ec98a..7cea36b 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
@@ -300,19 +300,12 @@ TerminalDriverBindingStart (
if (EFI_ERROR (Status)) {
goto Error;
}
- //
- // 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)) {
+
+ if (IsHotPlugDevice (ParentDevicePath)) {
+ //
+ // if the serial device is a hot plug device, do not update the
+ // ConInDev, ConOutDev, and StdErrDev variables.
+ //
TerminalUpdateConsoleDevVariable (L"ConInDev", ParentDevicePath);
TerminalUpdateConsoleDevVariable (L"ConOutDev", ParentDevicePath);
TerminalUpdateConsoleDevVariable (L"ErrOutDev", ParentDevicePath);
@@ -627,26 +620,7 @@ 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.
@@ -886,25 +860,6 @@ 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);
@@ -1322,3 +1277,51 @@ 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;
+}
+