summaryrefslogtreecommitdiff
path: root/MdeModulePkg
diff options
context:
space:
mode:
Diffstat (limited to 'MdeModulePkg')
-rw-r--r--MdeModulePkg/Include/Protocol/HotPlugDevice.h24
-rw-r--r--MdeModulePkg/MdeModulePkg.dec3
-rw-r--r--MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c113
-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.c107
-rw-r--r--MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h18
-rw-r--r--MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf1
8 files changed, 143 insertions, 136 deletions
diff --git a/MdeModulePkg/Include/Protocol/HotPlugDevice.h b/MdeModulePkg/Include/Protocol/HotPlugDevice.h
deleted file mode 100644
index ae6ef46..0000000
--- a/MdeModulePkg/Include/Protocol/HotPlugDevice.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
- This guid is used to specify the device is the hot plug device.
- If the device is the hot plug device, this guid as the protocol guid
- will be installed into this device handle.
-
-Copyright (c) 2006 - 2008, Intel Corporation
-All rights reserved. This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
-
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-
-**/
-
-#ifndef __HOT_PLUG_DEVICE_H__
-#define __HOT_PLUG_DEVICE_H__
-
-#define HOT_PLUG_DEVICE_GUID \
- { 0x220ac432, 0x1d43, 0x49e5, {0xa7, 0x4f, 0x4c, 0x9d, 0xa6, 0x7a, 0xd2, 0x3b } }
-
-extern EFI_GUID gEfiHotPlugDeviceGuid;
-#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 2e40bd7..6ab79ae 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -217,9 +217,6 @@
## Include/Protocol/TcgPlatform.h
gEfiTcgPlatformProtocolGuid = { 0x8c4c9a41, 0xbf56, 0x4627, { 0x9e, 0xa, 0xc8, 0x38, 0x6d, 0x66, 0x11, 0x5c }}
- ## Protocol Guid specify the device is the hot plug device.
- gEfiHotPlugDeviceGuid = { 0x220AC432, 0x1D43, 0x49E5, { 0xA7, 0x4F, 0x4C, 0x9D, 0xA6, 0x7A, 0xD2, 0x3B }}
-
[PcdsFeatureFlag.common]
## Indicate whether platform can support update capsule across a system reset
gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset|FALSE|BOOLEAN|0x0001001d
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
index bc5216d..6c72c8d 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 handle, 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
// gEfiConsoleInDeviceGuid to the device handle directly.
// The policy is, make hot plug device plug in and play immediately.
//
- if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
+ if (IsHotPlugDevice (DevicePath)) {
gBS->InstallMultipleProtocolInterfaces (
&ControllerHandle,
&gEfiConsoleInDeviceGuid,
@@ -373,12 +373,12 @@ ConPlatformTextOutDriverBindingStart (
return Status;
}
//
- // Check the device handle, 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,
// and install gEfiConsoleOutDeviceGuid to the device handle directly.
// The policy is, make hot plug device plug in and play immediately.
//
- if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
+ if (IsHotPlugDevice (DevicePath)) {
gBS->InstallMultipleProtocolInterfaces (
&ControllerHandle,
&gEfiConsoleOutDeviceGuid,
@@ -482,21 +482,24 @@ ConPlatformTextInDriverBindingStop (
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
//
- // If it is not a hot-plug device, first delete it from the ConInDev variable.
+ // Get the Device Path Protocol firstly
//
- if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &DevicePath,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ //
+ // If there is device path on ControllerHandle
+ //
+ if (!EFI_ERROR (Status)) {
//
- // Get the Device Path Protocol so the environment variables can be updated
+ // If it is not a hot-plug device, first delete it from the ConInDev variable.
//
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
+ if (!IsHotPlugDevice (DevicePath)) {
//
// Remove DevicePath from ConInDev
//
@@ -507,6 +510,7 @@ ConPlatformTextInDriverBindingStop (
);
}
}
+
//
// Uninstall the Console Device GUIDs from Controller Handle
//
@@ -557,21 +561,21 @@ ConPlatformTextOutDriverBindingStop (
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
//
- // If it is not a hot-plug device, first delete it from the ConOutDev and ErrOutDev variable.
+ // Get the Device Path Protocol firstly
//
- if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {
+ Status = gBS->OpenProtocol (
+ ControllerHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID **) &DevicePath,
+ This->DriverBindingHandle,
+ ControllerHandle,
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL
+ );
+ if (!EFI_ERROR (Status)) {
//
- // Get the Device Path Protocol so the environment variables can be updated
+ // If it is not a hot-plug device, first delete it from the ConOutDev and ErrOutDev variable.
//
- Status = gBS->OpenProtocol (
- ControllerHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID **) &DevicePath,
- This->DriverBindingHandle,
- ControllerHandle,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL
- );
- if (!EFI_ERROR (Status)) {
+ if (!IsHotPlugDevice (DevicePath)) {
//
// Remove DevicePath from ConOutDev, and ErrOutDev
//
@@ -587,6 +591,7 @@ ConPlatformTextOutDriverBindingStop (
);
}
}
+
//
// Uninstall the Console Device GUIDs from Controller Handle
//
@@ -929,10 +934,12 @@ ConPlatformUpdateDeviceVariable (
}
/**
- Check if the device supports hot-plug.
+ 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 DriverBindingHandle Protocol instance pointer.
- @param ControllerHandle Handle of device to check.
+ @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.
@@ -940,26 +947,36 @@ ConPlatformUpdateDeviceVariable (
**/
BOOLEAN
IsHotPlugDevice (
- EFI_HANDLE DriverBindingHandle,
- EFI_HANDLE ControllerHandle
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- EFI_STATUS Status;
+ EFI_DEVICE_PATH_PROTOCOL *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;
+ 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 TRUE;
+ return FALSE;
}
+
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
index f7883dc..a47ad1c 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
@@ -20,7 +20,6 @@ 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>
@@ -293,10 +292,12 @@ ConPlatformUpdateDeviceVariable (
);
/**
- Check if the device supports hot-plug.
+ Check if the device supports hot-plug through its device path.
- @param DriverBindingHandle Protocol instance pointer.
- @param ControllerHandle Handle of device to check.
+ 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.
@@ -304,8 +305,7 @@ ConPlatformUpdateDeviceVariable (
**/
BOOLEAN
IsHotPlugDevice (
- EFI_HANDLE DriverBindingHandle,
- EFI_HANDLE ControllerHandle
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
);
//
diff --git a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
index a96a633..892d051 100644
--- a/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
+++ b/MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
@@ -87,5 +87,4 @@
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 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;
+}
+
diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
index e55343c..2f99060 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
@@ -21,7 +21,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Guid/GlobalVariable.h>
#include <Guid/PcAnsi.h>
-#include <Protocol/HotPlugDevice.h>
#include <Protocol/SimpleTextOut.h>
#include <Protocol/SerialIo.h>
#include <Protocol/DevicePath.h>
@@ -1346,4 +1345,21 @@ 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 112b19e..26ee19b 100644
--- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
+++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
@@ -72,7 +72,6 @@
gEfiSimpleTextInProtocolGuid ## BY_START
gEfiSimpleTextInputExProtocolGuid ## BY_START
gEfiSimpleTextOutProtocolGuid ## BY_START
- gEfiHotPlugDeviceGuid ## SOMETIMES_CONSUMES
[Pcd]
gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleError