// gEfiConsoleInDeviceGuid to the device handle directly.\r
// The policy is, make hot plug device plug in and play immediately.\r
//\r
- if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {\r
+ if (IsHotPlugDevice (DevicePath)) {\r
gBS->InstallMultipleProtocolInterfaces (\r
&ControllerHandle,\r
&gEfiConsoleInDeviceGuid,\r
// and install gEfiConsoleOutDeviceGuid to the device handle directly.\r
// The policy is, make hot plug device plug in and play immediately.\r
//\r
- if (IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {\r
+ if (IsHotPlugDevice (DevicePath)) {\r
gBS->InstallMultipleProtocolInterfaces (\r
&ControllerHandle,\r
&gEfiConsoleOutDeviceGuid,\r
EFI_STATUS Status;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
\r
+ //\r
+ // Get the Device Path Protocol firstly\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ ControllerHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ (VOID **) &DevicePath,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle,\r
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
//\r
// If it is not a hot-plug device, first delete it from the ConInDev variable.\r
//\r
- if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {\r
+ if (!IsHotPlugDevice (DevicePath)) {\r
+ //\r
+ // Remove DevicePath from ConInDev\r
//\r
- // Get the Device Path Protocol so the environment variables can be updated\r
- //\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- (VOID **) &DevicePath,\r
- This->DriverBindingHandle,\r
- ControllerHandle,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // Remove DevicePath from ConInDev\r
- //\r
- ConPlatformUpdateDeviceVariable (\r
- L"ConInDev",\r
- DevicePath,\r
- DELETE\r
- );\r
- }\r
+ ConPlatformUpdateDeviceVariable (\r
+ L"ConInDev",\r
+ DevicePath,\r
+ DELETE\r
+ );\r
}\r
+\r
//\r
// Uninstall the Console Device GUIDs from Controller Handle\r
//\r
EFI_STATUS Status;\r
EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
\r
+ //\r
+ // Get the Device Path Protocol firstly\r
+ //\r
+ Status = gBS->OpenProtocol (\r
+ ControllerHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ (VOID **) &DevicePath,\r
+ This->DriverBindingHandle,\r
+ ControllerHandle,\r
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
//\r
// If it is not a hot-plug device, first delete it from the ConOutDev and ErrOutDev variable.\r
//\r
- if (!IsHotPlugDevice (This->DriverBindingHandle, ControllerHandle)) {\r
+ if (!IsHotPlugDevice (DevicePath)) {\r
//\r
- // Get the Device Path Protocol so the environment variables can be updated\r
+ // Remove DevicePath from ConOutDev, and ErrOutDev\r
//\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- (VOID **) &DevicePath,\r
- This->DriverBindingHandle,\r
- ControllerHandle,\r
- EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
- );\r
- if (!EFI_ERROR (Status)) {\r
- //\r
- // Remove DevicePath from ConOutDev, and ErrOutDev\r
- //\r
- ConPlatformUpdateDeviceVariable (\r
- L"ConOutDev",\r
- DevicePath,\r
- DELETE\r
- );\r
- ConPlatformUpdateDeviceVariable (\r
- L"ErrOutDev",\r
- DevicePath,\r
- DELETE\r
- );\r
- }\r
+ ConPlatformUpdateDeviceVariable (\r
+ L"ConOutDev",\r
+ DevicePath,\r
+ DELETE\r
+ );\r
+ ConPlatformUpdateDeviceVariable (\r
+ L"ErrOutDev",\r
+ DevicePath,\r
+ DELETE\r
+ );\r
}\r
+ \r
//\r
// Uninstall the Console Device GUIDs from Controller Handle\r
//\r
}\r
\r
/**\r
- Check if the device supports hot-plug.\r
+ Check if the device supports hot-plug through its device path.\r
+\r
+ This function could be updated to check more types of Hot Plug devices.\r
+ Currently, it checks USB and PCCard device.\r
\r
- @param DriverBindingHandle Protocol instance pointer.\r
- @param ControllerHandle Handle of device to check.\r
+ @param DevicePath Pointer to device's device path.\r
\r
@retval TRUE The devcie is a hot-plug device\r
@retval FALSE The devcie is not a hot-plug device.\r
**/\r
BOOLEAN\r
IsHotPlugDevice (\r
- EFI_HANDLE DriverBindingHandle,\r
- EFI_HANDLE ControllerHandle\r
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
)\r
{\r
- EFI_STATUS Status;\r
-\r
//\r
- // HotPlugDeviceGuid indicates ControllerHandle stands for a hot plug device.\r
- //\r
- Status = gBS->OpenProtocol (\r
- ControllerHandle,\r
- &gEfiHotPlugDeviceGuid,\r
- NULL,\r
- DriverBindingHandle,\r
- ControllerHandle,\r
- EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- return FALSE;\r
+ // Check device whether is hot plug device or not throught Device Path\r
+ // \r
+ if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&\r
+ (DevicePathSubType (DevicePath) == MSG_USB_DP ||\r
+ DevicePathSubType (DevicePath) == MSG_USB_CLASS_DP ||\r
+ DevicePathSubType (DevicePath) == MSG_USB_WWID_DP)) {\r
+ //\r
+ // If Device is USB device\r
+ //\r
+ return TRUE;\r
+ }\r
+ if ((DevicePathType (DevicePath) == HARDWARE_DEVICE_PATH) &&\r
+ (DevicePathSubType (DevicePath) == HW_PCCARD_DP)) {\r
+ //\r
+ // If Device is PCCard\r
+ //\r
+ return TRUE;\r
}\r
\r
- return TRUE;\r
+ return FALSE;\r
}\r