]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1. updated "the Bus Driver that creates all of its child handles on the first call...
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 16 Sep 2009 03:05:46 +0000 (03:05 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 16 Sep 2009 03:05:46 +0000 (03:05 +0000)
The others changes include:
a. Check RemainingDevicePath at beginning of Supported(), make sure it has been verified before Start() is called.
b. Check IO protocol firstly rather than EfiDevicePathProtocolGuid, reduce the times entering into Start() function because EfiDevicePathProtocolGuid existed on most of handle.

2. roll back serial drivers not to create child device, if the device speicifed by remainingdevicepath cannot find in the created devices list.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9267 6f19259b-4bc3-4df7-8a09-765794883524

IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c
MdeModulePkg/Universal/Disk/PartitionDxe/Partition.c
Nt32Pkg/WinNtSerialIoDxe/WinNtSerialIo.c
UnixPkg/UnixSerialIoDxe/UnixSerialIo.c

index a5ee00049e297a2ae54c6aea25b88dad5d85d897..d5b5cfbbc78539cc6b31fc4b8c9fdb0cb16e7e37 100644 (file)
@@ -385,18 +385,9 @@ SerialControllerDriverStart (
         break;\r
       }\r
     }\r
-    FreePool (OpenInfoBuffer);\r
 \r
-    if (Index < EntryCount) {\r
-      //\r
-      // If gEfiSerialIoProtocolGuid is opened by one child device, return\r
-      //\r
-      return Status;\r
-    }\r
-    //\r
-    // If gEfiSerialIoProtocolGuid is not opened by any child device,\r
-    // go further to create child device handle based on RemainingDevicePath\r
-    //\r
+    FreePool (OpenInfoBuffer);\r
+    return Status;\r
   }\r
 \r
   if (RemainingDevicePath != NULL) {\r
index 7af1b10f7ed09cd0858af3f38eba74590a025d26..1a4adf54b9a1b39e5cdfacf916d33d8ec531771a 100644 (file)
@@ -132,21 +132,35 @@ PciBusDriverBindingSupported (
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
   EFI_DEV_PATH_PTR                Node;\r
 \r
+  //\r
+  // Check RemainingDevicePath validation\r
+  //\r
   if (RemainingDevicePath != NULL) {\r
-    Node.DevPath = RemainingDevicePath;\r
-    if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||\r
-        Node.DevPath->SubType != HW_PCI_DP         ||\r
-        DevicePathNodeLength(Node.DevPath) != sizeof(PCI_DEVICE_PATH)) {\r
-      return EFI_UNSUPPORTED;\r
+    //\r
+    // Check if RemainingDevicePath is the End of Device Path Node, \r
+    // if yes, go on checking other conditions\r
+    //\r
+    if (!IsDevicePathEnd (RemainingDevicePath)) {\r
+      //\r
+      // If RemainingDevicePath isn't the End of Device Path Node,\r
+      // check its validation\r
+      //\r
+      Node.DevPath = RemainingDevicePath;\r
+      if (Node.DevPath->Type != HARDWARE_DEVICE_PATH ||\r
+          Node.DevPath->SubType != HW_PCI_DP         ||\r
+          DevicePathNodeLength(Node.DevPath) != sizeof(PCI_DEVICE_PATH)) {\r
+        return EFI_UNSUPPORTED;\r
+      }\r
     }\r
   }\r
+\r
   //\r
-  // Open the IO Abstraction(s) needed to perform the supported test\r
+  // Check if Pci Root Bridge IO protocol is installed by platform\r
   //\r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  (VOID **) &ParentDevicePath,\r
+                  &gEfiPciRootBridgeIoProtocolGuid,\r
+                  (VOID **) &PciRootBridgeIo,\r
                   This->DriverBindingHandle,\r
                   Controller,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -159,20 +173,23 @@ PciBusDriverBindingSupported (
     return Status;\r
   }\r
 \r
+  //\r
+  // Close the I/O Abstraction(s) used to perform the supported test\r
+  //\r
   gBS->CloseProtocol (\r
         Controller,\r
-        &gEfiDevicePathProtocolGuid,\r
+        &gEfiPciRootBridgeIoProtocolGuid,\r
         This->DriverBindingHandle,\r
         Controller\r
         );\r
 \r
   //\r
-  // Check if Pci Root Bridge IO protocol is installed by platform\r
+  // Open the EFI Device Path protocol needed to perform the supported test\r
   //\r
   Status = gBS->OpenProtocol (\r
                   Controller,\r
-                  &gEfiPciRootBridgeIoProtocolGuid,\r
-                  (VOID **) &PciRootBridgeIo,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  (VOID **) &ParentDevicePath,\r
                   This->DriverBindingHandle,\r
                   Controller,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -185,9 +202,12 @@ PciBusDriverBindingSupported (
     return Status;\r
   }\r
 \r
+  //\r
+  // Close protocol, don't use device path protocol in the Support() function\r
+  //\r
   gBS->CloseProtocol (\r
         Controller,\r
-        &gEfiPciRootBridgeIoProtocolGuid,\r
+        &gEfiDevicePathProtocolGuid,\r
         This->DriverBindingHandle,\r
         Controller\r
         );\r
@@ -219,6 +239,19 @@ PciBusDriverBindingStart (
 {\r
   EFI_STATUS  Status;\r
 \r
+  //\r
+  // Check RemainingDevicePath validation\r
+  //\r
+  if (RemainingDevicePath != NULL) {\r
+    //\r
+    // Check if RemainingDevicePath is the End of Device Path Node, \r
+    // if yes, return EFI_SUCCESS\r
+    //\r
+    if (IsDevicePathEnd (RemainingDevicePath)) {\r
+      return EFI_SUCCESS;\r
+    }\r
+  }\r
+\r
   Status = gBS->LocateProtocol (\r
                   &gEfiIncompatiblePciDeviceSupportProtocolGuid,\r
                   NULL,\r
index 375f07aa18b2402844927d43b95f57d2c0e6d521..fa9f3e3cc4d903b665fbd5467693632e564e595c 100644 (file)
@@ -69,22 +69,35 @@ PartitionDriverBindingSupported (
   EFI_DISK_IO_PROTOCOL      *DiskIo;\r
   EFI_DEV_PATH              *Node;\r
 \r
+  //\r
+  // Check RemainingDevicePath validation\r
+  //\r
   if (RemainingDevicePath != NULL) {\r
-    Node = (EFI_DEV_PATH *) RemainingDevicePath;\r
-    if (Node->DevPath.Type != MEDIA_DEVICE_PATH ||\r
+    //\r
+    // Check if RemainingDevicePath is the End of Device Path Node, \r
+    // if yes, go on checking other conditions\r
+    //\r
+    if (!IsDevicePathEnd (RemainingDevicePath)) {\r
+      //\r
+      // If RemainingDevicePath isn't the End of Device Path Node,\r
+      // check its validation\r
+      //\r
+      Node = (EFI_DEV_PATH *) RemainingDevicePath;\r
+      if (Node->DevPath.Type != MEDIA_DEVICE_PATH ||\r
         Node->DevPath.SubType != MEDIA_HARDDRIVE_DP ||\r
-        DevicePathNodeLength (&Node->DevPath) != sizeof (HARDDRIVE_DEVICE_PATH)\r
-        ) {\r
+        DevicePathNodeLength (&Node->DevPath) != sizeof (HARDDRIVE_DEVICE_PATH)) {\r
       return EFI_UNSUPPORTED;\r
+      }\r
     }\r
   }\r
+\r
   //\r
   // Open the IO Abstraction(s) needed to perform the supported test\r
   //\r
   Status = gBS->OpenProtocol (\r
                   ControllerHandle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  (VOID **) &ParentDevicePath,\r
+                  &gEfiDiskIoProtocolGuid,\r
+                  (VOID **) &DiskIo,\r
                   This->DriverBindingHandle,\r
                   ControllerHandle,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -101,18 +114,18 @@ PartitionDriverBindingSupported (
   //\r
   gBS->CloseProtocol (\r
          ControllerHandle,\r
-         &gEfiDevicePathProtocolGuid,\r
+         &gEfiDiskIoProtocolGuid,\r
          This->DriverBindingHandle,\r
          ControllerHandle\r
          );\r
 \r
   //\r
-  // Open the IO Abstraction(s) needed to perform the supported test\r
+  // Open the EFI Device Path protocol needed to perform the supported test\r
   //\r
   Status = gBS->OpenProtocol (\r
                   ControllerHandle,\r
-                  &gEfiDiskIoProtocolGuid,\r
-                  (VOID **) &DiskIo,\r
+                  &gEfiDevicePathProtocolGuid,\r
+                  (VOID **) &ParentDevicePath,\r
                   This->DriverBindingHandle,\r
                   ControllerHandle,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -124,12 +137,13 @@ PartitionDriverBindingSupported (
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+\r
   //\r
-  // Close the I/O Abstraction(s) used to perform the supported test\r
+  // Close protocol, don't use device path protocol in the Support() function\r
   //\r
   gBS->CloseProtocol (\r
         ControllerHandle,\r
-        &gEfiDiskIoProtocolGuid,\r
+        &gEfiDevicePathProtocolGuid,\r
         This->DriverBindingHandle,\r
         ControllerHandle\r
         );\r
@@ -181,6 +195,19 @@ PartitionDriverBindingStart (
   PARTITION_DETECT_ROUTINE  *Routine;\r
   BOOLEAN                   MediaPresent;\r
 \r
+  //\r
+  // Check RemainingDevicePath validation\r
+  //\r
+  if (RemainingDevicePath != NULL) {\r
+    //\r
+    // Check if RemainingDevicePath is the End of Device Path Node, \r
+    // if yes, return EFI_SUCCESS\r
+    //\r
+    if (IsDevicePathEnd (RemainingDevicePath)) {\r
+      return EFI_SUCCESS;\r
+    }\r
+  }\r
+\r
   Status = gBS->OpenProtocol (\r
                   ControllerHandle,\r
                   &gEfiBlockIoProtocolGuid,\r
index 52d7ee8b06200a3584201611d5b48de40fb3fbbf..17e4fdacf63f2b53fd78c6f848c4cf6fa112a42d 100644 (file)
@@ -372,18 +372,9 @@ Returns:
         break;\r
       }\r
     }\r
+\r
     FreePool (OpenInfoBuffer);\r
-    \r
-    if (Index < EntryCount) {\r
-      //\r
-      // If gEfiWinNtIoProtocolGuid is opened by one child device, return\r
-      //\r
-      return Status;\r
-    }\r
-    //\r
-    // If gEfiWinNtIoProtocolGuid is not opened by any child device,\r
-    // go further to create child device handle based on RemainingDevicePath\r
-    //\r
+    return Status;\r
   }\r
 \r
   if (RemainingDevicePath == NULL) {\r
index ff9bced4e98a7ffca598eaf725766b0e336198e3..e41e74964fda7ee8e4ed670f60a8344e19d669d6 100644 (file)
@@ -466,16 +466,7 @@ Returns:
     }\r
 \r
     FreePool (OpenInfoBuffer);\r
-    if (Index < EntryCount) {\r
-      //\r
-      // If gEfiUnixIoProtocolGuid is opened by one child device, return\r
-      //\r
-      return Status;\r
-    }\r
-    //\r
-    // If gEfiUnixIoProtocolGuid is not opened by any child device,\r
-    // go further to create child device handle based on RemainingDevicePath\r
-    //\r
+    return Status;\r
   }\r
 \r
   if (RemainingDevicePath == NULL) {\r