X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkModulePkg%2FBus%2FPci%2FUhci%2FDxe%2Fuhci.c;fp=EdkModulePkg%2FBus%2FPci%2FUhci%2FDxe%2Fuhci.c;h=7e033df2dffd5e91702b898e65f3d5f8210d3d9e;hp=3d81d2c5c375eeb0504f7dd5237f0cc08ba6743b;hb=4d1fe68e1ca84cf0d3eec69d20625fa57769de12;hpb=01bf334d2c017095a1776c2c42fe5dd0337cff0a diff --git a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c b/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c index 3d81d2c5c3..7e033df2df 100644 --- a/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c +++ b/EdkModulePkg/Bus/Pci/Uhci/Dxe/uhci.c @@ -485,6 +485,7 @@ UHCIDriverBindingStart ( UINTN FlBaseAddrReg; EFI_PCI_IO_PROTOCOL *PciIo; USB_HC_DEV *HcDev; + UINT64 Supports; HcDev = NULL; @@ -510,10 +511,19 @@ UHCIDriverBindingStart ( // Status = PciIo->Attributes ( PciIo, - EfiPciIoAttributeOperationEnable, - EFI_PCI_DEVICE_ENABLE, - NULL + EfiPciIoAttributeOperationSupported, + 0, + &Supports ); + if (!EFI_ERROR (Status)) { + Supports &= EFI_PCI_DEVICE_ENABLE; + Status = PciIo->Attributes ( + PciIo, + EfiPciIoAttributeOperationEnable, + Supports, + NULL + ); + } if (EFI_ERROR (Status)) { gBS->CloseProtocol ( Controller, @@ -777,6 +787,8 @@ UnInstallUHCInterface ( --*/ { USB_HC_DEV *HcDev; + EFI_STATUS Status; + UINT64 Supports; HcDev = USB_HC_DEV_FROM_THIS (This); @@ -823,12 +835,21 @@ UnInstallUHCInterface ( // // Disable the USB Host Controller // - HcDev->PciIo->Attributes ( - HcDev->PciIo, - EfiPciIoAttributeOperationDisable, - EFI_PCI_DEVICE_ENABLE, - NULL - ); + Status = HcDev->PciIo->Attributes ( + HcDev->PciIo, + EfiPciIoAttributeOperationSupported, + 0, + &Supports + ); + if (!EFI_ERROR (Status)) { + Supports &= EFI_PCI_DEVICE_ENABLE; + Status = HcDev->PciIo->Attributes ( + HcDev->PciIo, + EfiPciIoAttributeOperationDisable, + Supports, + NULL + ); + } gBS->FreePool (HcDev);