]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.c
Remove the special logic on EFI_PCI_DEVICE_ENABLE in PciBus driver. And update driver...
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / IdeBusDxe / idebus.c
index 8f555c7cd5326d4b3175081149e5103ea211c1d1..48c2184696494da8e0de3300f94d3a52b79339a2 100644 (file)
@@ -182,6 +182,7 @@ IDEBusDriverBindingStart (
   UINT16                            ControlBlockBaseAddr;\r
   UINTN                             DataSize;\r
   IDE_BUS_DRIVER_PRIVATE_DATA       *IdeBusDriverPrivateData;\r
+  UINT64                            Supports;\r
 \r
   //\r
   // Local variables declaration for IdeControllerInit support\r
@@ -297,10 +298,20 @@ IDEBusDriverBindingStart (
 \r
   Status = PciIo->Attributes (\r
                     PciIo,\r
-                    EfiPciIoAttributeOperationEnable,\r
-                    EFI_PCI_DEVICE_ENABLE,\r
-                    NULL\r
+                    EfiPciIoAttributeOperationSupported,\r
+                    0,\r
+                    &Supports\r
                     );\r
+  if (!EFI_ERROR (Status)) {\r
+    Supports &= EFI_PCI_DEVICE_ENABLE;\r
+    Status = PciIo->Attributes (\r
+                      PciIo,\r
+                      EfiPciIoAttributeOperationEnable,\r
+                      Supports,\r
+                      NULL\r
+                      );\r
+  }\r
+\r
   if (EFI_ERROR (Status)) {\r
     goto ErrorExit;\r
   }\r
@@ -835,6 +846,7 @@ IDEBusDriverBindingStop (
   BOOLEAN                     AllChildrenStopped;\r
   UINTN                       Index;\r
   IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;\r
+  UINT64                      Supports;\r
 \r
   IdeBusDriverPrivateData = NULL;\r
 \r
@@ -849,12 +861,21 @@ IDEBusDriverBindingStop (
                     EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
                     );\r
     if (!EFI_ERROR (Status)) {\r
-      PciIo->Attributes (\r
-              PciIo,\r
-              EfiPciIoAttributeOperationDisable,\r
-              EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE,\r
-              NULL\r
-              );\r
+      Status = PciIo->Attributes (\r
+                        PciIo,\r
+                        EfiPciIoAttributeOperationSupported,\r
+                        0,\r
+                        &Supports\r
+                        );\r
+      if (!EFI_ERROR (Status)) {\r
+        Supports &= EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE;\r
+        PciIo->Attributes (\r
+                PciIo,\r
+                EfiPciIoAttributeOperationDisable,\r
+                Supports,\r
+                NULL\r
+                );\r
+      }\r
     }\r
 \r
     gBS->OpenProtocol (\r