]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. Retired HotPlugDevice protocol.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Feb 2009 02:51:45 +0000 (02:51 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Feb 2009 02:51:45 +0000 (02:51 +0000)
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@7562 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.c
MdeModulePkg/Bus/Usb/UsbKbDxe/EfiKey.h
MdeModulePkg/Bus/Usb/UsbKbDxe/UsbKbDxe.inf
MdeModulePkg/Include/Protocol/HotPlugDevice.h [deleted file]
MdeModulePkg/MdeModulePkg.dec
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.c
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatform.h
MdeModulePkg/Universal/Console/TerminalDxe/Terminal.c
MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h
MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf

index 74f19c3278183ed6f3db32b6e882fe0c0ba3a0e4..07fec7c315780dcaf82aeace026e2c77830f3d1e 100644 (file)
@@ -293,9 +293,8 @@ USBKeyboardDriverBindingStart (
   // Install Simple Text Input Protocol and Simple Text Input Ex Protocol\r
   // for the USB keyboard device.\r
   // USB keyboard is a hot plug device, and expected to work immediately\r
-  // when plugging into system, so a HotPlugDeviceGuid is installed onto\r
-  // the usb keyboard device handle, to distinguish it from other conventional\r
-  // console devices.\r
+  // when plugging into system, other conventional console devices could\r
+  // distinguish it by its device path.\r
   //\r
   Status = gBS->InstallMultipleProtocolInterfaces (\r
                   &Controller,\r
@@ -303,8 +302,6 @@ USBKeyboardDriverBindingStart (
                   &UsbKeyboardDevice->SimpleInput,\r
                   &gEfiSimpleTextInputExProtocolGuid,\r
                   &UsbKeyboardDevice->SimpleInputEx,\r
-                  &gEfiHotPlugDeviceGuid,\r
-                  NULL,\r
                   NULL\r
                   );\r
   if (EFI_ERROR (Status)) {\r
@@ -325,8 +322,6 @@ USBKeyboardDriverBindingStart (
            &UsbKeyboardDevice->SimpleInput,\r
            &gEfiSimpleTextInputExProtocolGuid,\r
            &UsbKeyboardDevice->SimpleInputEx,\r
-           &gEfiHotPlugDeviceGuid,\r
-           NULL,\r
            NULL\r
            );\r
     goto ErrorExit;\r
@@ -356,8 +351,6 @@ USBKeyboardDriverBindingStart (
            &UsbKeyboardDevice->SimpleInput,\r
            &gEfiSimpleTextInputExProtocolGuid,\r
            &UsbKeyboardDevice->SimpleInputEx,\r
-           &gEfiHotPlugDeviceGuid,\r
-           NULL,\r
            NULL\r
            );\r
     goto ErrorExit;\r
@@ -495,8 +488,6 @@ USBKeyboardDriverBindingStop (
                   &UsbKeyboardDevice->SimpleInput,\r
                   &gEfiSimpleTextInputExProtocolGuid,\r
                   &UsbKeyboardDevice->SimpleInputEx,\r
-                  &gEfiHotPlugDeviceGuid,\r
-                  NULL,\r
                   NULL\r
                   );\r
   //\r
index 608d45a18800ecf423901104af0c9a8fce75fcbe..73191e6a272a196cbe22c1107792e14e1b8f57d7 100644 (file)
@@ -23,7 +23,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/UsbIo.h>\r
 #include <Protocol/DevicePath.h>\r
 #include <Protocol/SimpleTextInExNotify.h>\r
-#include <Protocol/HotPlugDevice.h>\r
 \r
 #include <Guid/HiiKeyBoardLayout.h>\r
 \r
index a724e8955ada0ddc36ea68ded4f34ea1405e8de4..b2953fb9cf26ead94cdb13ac647a336e962496f7 100644 (file)
@@ -79,7 +79,6 @@
   gEfiDevicePathProtocolGuid                    ## TO_START\r
   gEfiSimpleTextInProtocolGuid                  ## BY_START\r
   gEfiSimpleTextInputExProtocolGuid             ## BY_START\r
-  gEfiHotPlugDeviceGuid                         ## BY_START\r
   ##\r
   # If HII Database Protocol exists, then keyboard layout from HII database is used.\r
   # Otherwise, USB keyboard module tries to use its carried default layout.\r
diff --git a/MdeModulePkg/Include/Protocol/HotPlugDevice.h b/MdeModulePkg/Include/Protocol/HotPlugDevice.h
deleted file mode 100644 (file)
index e36c826..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file\r
-  This protocol guid is used to specify the device is the hot plug device.\r
-  If the device is the hot plug device, this protocol guid\r
-  will be installed into this device handle.\r
-\r
-Copyright (c) 2006 - 2008, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-**/\r
-\r
-#ifndef __HOT_PLUG_DEVICE_H__\r
-#define __HOT_PLUG_DEVICE_H__\r
-\r
-#define HOT_PLUG_DEVICE_GUID    \\r
-    { 0x220ac432, 0x1d43, 0x49e5, {0xa7, 0x4f, 0x4c, 0x9d, 0xa6, 0x7a, 0xd2, 0x3b } }\r
-\r
-extern EFI_GUID gEfiHotPlugDeviceGuid;\r
-#endif\r
index b3ad2dc2c3c770f60e3508041bf6bd4bc39f7681..386b0a0f70546416c022e61a0a7b770244957fd1 100644 (file)
   ## Include/Protocol/SimpleTextInExNotify.h\r
   gSimpleTextInExNotifyGuid      = { 0x856f2def, 0x4e93, 0x4d6b, { 0x94, 0xce, 0x1c, 0xfe, 0x47, 0x01, 0x3e, 0xa5 }}  \r
 \r
-  ## Protocol Guid specify the device is the hot plug device.\r
-  ## Include/Protocol/HotPlugDevice.h\r
-  gEfiHotPlugDeviceGuid          = { 0x220AC432, 0x1D43, 0x49E5, { 0xA7, 0x4F, 0x4C, 0x9D, 0xA6, 0x7A, 0xD2, 0x3B }}\r
-\r
 [PcdsFeatureFlag.common]\r
   ## Indicate whether platform can support update capsule across a system reset\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset|FALSE|BOOLEAN|0x0001001d\r
index 0cb07a2971aa2a5f505c3495bc28e339739c2221..f6483ed1fd0ec07767fc3b95bdf3971cd11d48fc 100644 (file)
@@ -256,7 +256,7 @@ ConPlatformTextInDriverBindingStart (
     return Status;\r
   }\r
   //\r
-  // Check the device handle, if it is a hot plug device,\r
+  // Check the device path, if it is a hot plug device,\r
   // do not put the device path into ConInDev, and install\r
   // gEfiConsoleInDeviceGuid to the device handle directly.\r
   // The policy is, make hot plug device plug in and play immediately.\r
@@ -373,7 +373,7 @@ ConPlatformTextOutDriverBindingStart (
     return Status;\r
   }\r
   //\r
-  // Check the device handle, if it is a hot plug device,\r
+  // Check the device path, if it is a hot plug device,\r
   // do not put the device path into ConOutDev and ErrOutDev,\r
   // and install gEfiConsoleOutDeviceGuid to the device handle directly.\r
   // The policy is, make hot plug device plug in and play immediately.\r
@@ -953,24 +953,31 @@ IsHotPlugDevice (
   IN  EFI_DEVICE_PATH_PROTOCOL    *DevicePath\r
   )\r
 {\r
-  //\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
+  EFI_DEVICE_PATH_PROTOCOL     *CheckDevicePath;\r
+\r
+  CheckDevicePath = DevicePath;\r
+  while (!IsDevicePathEnd (CheckDevicePath)) {\r
     //\r
-    return TRUE;\r
+    // Check device whether is hot plug device or not throught Device Path\r
+    // \r
+    if ((DevicePathType (CheckDevicePath) == MESSAGING_DEVICE_PATH) &&\r
+        (DevicePathSubType (CheckDevicePath) == MSG_USB_DP ||\r
+         DevicePathSubType (CheckDevicePath) == MSG_USB_CLASS_DP ||\r
+         DevicePathSubType (CheckDevicePath) == MSG_USB_WWID_DP)) {\r
+      //\r
+      // If Device is USB device\r
+      //\r
+      return TRUE;\r
+    }\r
+    if ((DevicePathType (CheckDevicePath) == HARDWARE_DEVICE_PATH) &&\r
+        (DevicePathSubType (CheckDevicePath) == HW_PCCARD_DP)) {\r
+      //\r
+      // If Device is PCCard\r
+      //\r
+      return TRUE;\r
+    }\r
+  \r
+    CheckDevicePath = NextDevicePathNode (CheckDevicePath);\r
   }\r
 \r
   return FALSE;\r
index d0fa03af5bf6d4ebeb4ba12f861b1a042a49ed7b..a47ad1ce303b62204e96cea3e8d423c16fa212cf 100644 (file)
@@ -20,7 +20,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/SimpleTextOut.h>\r
 #include <Protocol/DevicePath.h>\r
 #include <Protocol/SimpleTextIn.h>\r
-#include <Protocol/HotPlugDevice.h>\r
 \r
 #include <Guid/GlobalVariable.h>\r
 #include <Guid/ConsoleInDevice.h>\r
index 92ec98a09fdc0b342729994b265d42ad90bfc0b1..1da6d90677291e53f5b179bb03ce76ae7e228342 100644 (file)
@@ -300,19 +300,12 @@ TerminalDriverBindingStart (
       if (EFI_ERROR (Status)) {\r
         goto Error;\r
       }\r
-      //\r
-      // if the serial device is a hot plug device, do not update the\r
-      // ConInDev, ConOutDev, and StdErrDev variables.\r
-      //\r
-      Status = gBS->OpenProtocol (\r
-                      Controller,\r
-                      &gEfiHotPlugDeviceGuid,\r
-                      NULL,\r
-                      This->DriverBindingHandle,\r
-                      Controller,\r
-                      EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
-                      );\r
-      if (EFI_ERROR (Status)) {\r
+\r
+      if (IsHotPlugDevice (ParentDevicePath)) {\r
+        //\r
+        // if the serial device is a hot plug device, do not update the\r
+        // ConInDev, ConOutDev, and StdErrDev variables.\r
+        //\r
         TerminalUpdateConsoleDevVariable (L"ConInDev", ParentDevicePath);\r
         TerminalUpdateConsoleDevVariable (L"ConOutDev", ParentDevicePath);\r
         TerminalUpdateConsoleDevVariable (L"ErrOutDev", ParentDevicePath);\r
@@ -627,26 +620,7 @@ TerminalDriverBindingStart (
   if (EFI_ERROR (Status)) {\r
     goto Error;\r
   }\r
-  //\r
-  // if the serial device is a hot plug device, attaches the HotPlugGuid\r
-  // onto the terminal device handle.\r
-  //\r
-  Status = gBS->OpenProtocol (\r
-                  Controller,\r
-                  &gEfiHotPlugDeviceGuid,\r
-                  NULL,\r
-                  This->DriverBindingHandle,\r
-                  Controller,\r
-                  EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
-                  );\r
-  if (!EFI_ERROR (Status)) {\r
-    Status = gBS->InstallMultipleProtocolInterfaces (\r
-                    &TerminalDevice->Handle,\r
-                    &gEfiHotPlugDeviceGuid,\r
-                    NULL,\r
-                    NULL\r
-                    );\r
-  }\r
+\r
   //\r
   // Register the Parent-Child relationship via\r
   // EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
@@ -886,25 +860,6 @@ TerminalDriverBindingStop (
           FreeUnicodeStringTable (TerminalDevice->ControllerNameTable);\r
         }\r
 \r
-        Status = gBS->OpenProtocol (\r
-                        ChildHandleBuffer[Index],\r
-                        &gEfiHotPlugDeviceGuid,\r
-                        NULL,\r
-                        This->DriverBindingHandle,\r
-                        Controller,\r
-                        EFI_OPEN_PROTOCOL_TEST_PROTOCOL\r
-                        );\r
-        if (!EFI_ERROR (Status)) {\r
-          Status = gBS->UninstallMultipleProtocolInterfaces (\r
-                          ChildHandleBuffer[Index],\r
-                          &gEfiHotPlugDeviceGuid,\r
-                          NULL,\r
-                          NULL\r
-                          );\r
-        } else {\r
-          Status = EFI_SUCCESS;\r
-        }\r
-\r
         gBS->CloseEvent (TerminalDevice->TwoSecondTimeOut);\r
         gBS->CloseEvent (TerminalDevice->SimpleInput.WaitForKey);\r
         gBS->CloseEvent (TerminalDevice->SimpleInputEx.WaitForKeyEx);\r
@@ -1322,3 +1277,50 @@ InitializeTerminal(
 \r
   return Status;\r
 }\r
+\r
+/**\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  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
+**/\r
+BOOLEAN\r
+IsHotPlugDevice (\r
+  IN  EFI_DEVICE_PATH_PROTOCOL    *DevicePath\r
+  )\r
+{\r
+  EFI_DEVICE_PATH_PROTOCOL     *CheckDevicePath;\r
+\r
+  CheckDevicePath = DevicePath;\r
+  while (!IsDevicePathEnd (CheckDevicePath)) {\r
+    //\r
+    // Check device whether is hot plug device or not throught Device Path\r
+    // \r
+    if ((DevicePathType (CheckDevicePath) == MESSAGING_DEVICE_PATH) &&\r
+        (DevicePathSubType (CheckDevicePath) == MSG_USB_DP ||\r
+         DevicePathSubType (CheckDevicePath) == MSG_USB_CLASS_DP ||\r
+         DevicePathSubType (CheckDevicePath) == MSG_USB_WWID_DP)) {\r
+      //\r
+      // If Device is USB device\r
+      //\r
+      return TRUE;\r
+    }\r
+    if ((DevicePathType (CheckDevicePath) == HARDWARE_DEVICE_PATH) &&\r
+        (DevicePathSubType (CheckDevicePath) == HW_PCCARD_DP)) {\r
+      //\r
+      // If Device is PCCard\r
+      //\r
+      return TRUE;\r
+    }\r
+  \r
+    CheckDevicePath = NextDevicePathNode (CheckDevicePath);\r
+  }\r
+\r
+  return FALSE;\r
+}\r
index af3afecd1538b46d5a0d5699b5848fed5464885c..7327da003a8bb2e318627726585c7a58f3217446 100644 (file)
@@ -22,7 +22,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Guid/PcAnsi.h>\r
 \r
 #include <Protocol/SimpleTextInExNotify.h>\r
-#include <Protocol/HotPlugDevice.h>\r
 #include <Protocol/SimpleTextOut.h>\r
 #include <Protocol/SerialIo.h>\r
 #include <Protocol/DevicePath.h>\r
@@ -1347,4 +1346,21 @@ TerminalIsValidEfiCntlChar (
   IN  CHAR16  CharC\r
   );\r
 \r
+/**\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  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
+**/\r
+BOOLEAN\r
+IsHotPlugDevice (\r
+  IN  EFI_DEVICE_PATH_PROTOCOL    *DevicePath\r
+  );\r
+\r
 #endif\r
index 204ca6040bebfe284b726e31c1f67c2f9a98a70e..1d849c698bac31aa698f03f71eac6cae9eeac772 100644 (file)
@@ -73,7 +73,6 @@
   gEfiSimpleTextInputExProtocolGuid             ## BY_START\r
   gEfiSimpleTextOutProtocolGuid                 ## BY_START\r
   gSimpleTextInExNotifyGuid                     ## SOMETIMES_CONSUMES\r
-  gEfiHotPlugDeviceGuid                         ## SOMETIMES_CONSUMES\r
 \r
 [Pcd]\r
   gEfiMdePkgTokenSpaceGuid.PcdStatusCodeValueRemoteConsoleError\r