]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Pci/UhciDxe/Uhci.c
Remove the special logic on EFI_PCI_DEVICE_ENABLE in PciBus driver. And update driver...
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / UhciDxe / Uhci.c
index 00108b87e2b218afad494582bd5ca99032c84d72..36ce1bd4fec88f2069ebac925262b616563ec20d 100644 (file)
@@ -2068,6 +2068,7 @@ UhciCleanDevUp (
   )\r
 {\r
   USB_HC_DEV          *Uhc;\r
+  UINT64              Supports;\r
 \r
   //\r
   // Uninstall the USB_HC and USB_HC2 protocol, then disable the controller\r
@@ -2089,11 +2090,18 @@ UhciCleanDevUp (
 \r
   UhciFreeAllAsyncReq (Uhc);\r
   UhciDestoryFrameList (Uhc);\r
-\r
+  \r
+  Uhc->PciIo->Attributes (\r
+                Uhc->PciIo,\r
+                EfiPciIoAttributeOperationSupported,\r
+                0,\r
+                &Supports\r
+                );\r
+  Supports &= EFI_PCI_DEVICE_ENABLE;\r
   Uhc->PciIo->Attributes (\r
                 Uhc->PciIo,\r
                 EfiPciIoAttributeOperationDisable,\r
-                EFI_PCI_DEVICE_ENABLE,\r
+                Supports,\r
                 NULL\r
                 );\r
 \r
@@ -2126,6 +2134,7 @@ UhciDriverBindingStart (
   EFI_STATUS          Status;\r
   EFI_PCI_IO_PROTOCOL *PciIo;\r
   USB_HC_DEV          *Uhc;\r
+  UINT64              Supports;\r
 \r
   //\r
   // Open PCIIO, then enable the EHC device and turn off emulation\r
@@ -2148,10 +2157,19 @@ UhciDriverBindingStart (
 \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 CLOSE_PCIIO;\r