]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c
1. Add NULL QH to set as QH header;
[mirror_edk2.git] / EdkModulePkg / Bus / Pci / Uhci / Dxe / uhci.c
index 3d81d2c5c375eeb0504f7dd5237f0cc08ba6743b..7e033df2dffd5e91702b898e65f3d5f8210d3d9e 100644 (file)
@@ -485,6 +485,7 @@ UHCIDriverBindingStart (
   UINTN                   FlBaseAddrReg; \r
   EFI_PCI_IO_PROTOCOL     *PciIo; \r
   USB_HC_DEV              *HcDev;\r
+  UINT64                  Supports;\r
   \r
   HcDev = NULL;\r
 \r
@@ -510,10 +511,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
   if (EFI_ERROR (Status)) {\r
     gBS->CloseProtocol (\r
            Controller,\r
@@ -777,6 +787,8 @@ UnInstallUHCInterface (
 --*/\r
 {\r
   USB_HC_DEV  *HcDev;\r
+  EFI_STATUS  Status;\r
+  UINT64      Supports;\r
 \r
   HcDev = USB_HC_DEV_FROM_THIS (This);\r
 \r
@@ -823,12 +835,21 @@ UnInstallUHCInterface (
   //\r
   // Disable the USB Host Controller\r
   //\r
-  HcDev->PciIo->Attributes (\r
-                  HcDev->PciIo,\r
-                  EfiPciIoAttributeOperationDisable,\r
-                  EFI_PCI_DEVICE_ENABLE,\r
-                  NULL\r
-                  );\r
+  Status = HcDev->PciIo->Attributes (\r
+                           HcDev->PciIo,\r
+                           EfiPciIoAttributeOperationSupported,\r
+                           0,\r
+                           &Supports\r
+                           );\r
+  if (!EFI_ERROR (Status)) {\r
+    Supports &= EFI_PCI_DEVICE_ENABLE;\r
+    Status = HcDev->PciIo->Attributes (\r
+                             HcDev->PciIo,\r
+                             EfiPciIoAttributeOperationDisable,\r
+                             Supports,\r
+                             NULL\r
+                             );\r
+  }\r
 \r
   gBS->FreePool (HcDev);\r
 \r