Remove the special logic on EFI_PCI_DEVICE_ENABLE in PciBus driver. And update drivers that use this macro. The reason is that
PciIoAttributes() in PciIo.c treats EFI_PCI_DEVICE_ENABLE specially so that when EFI_PCI_DEVICE_ENABLE is passed in, only the supported bits of driver will be enabled. Now many drivers use EFI_PCI_DEVICE_ENABLE to enable PCI device even if some of them don't support some of the attributes like EFI_PCI_IO_ATTRIBUTE_MEMORY. This doesn't conform to UEFI 2.0 spec. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@4115 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1491,6 +1491,7 @@ EhcDriverBindingStart (
|
||||
EFI_STATUS Status;
|
||||
USB2_HC_DEV *Ehc;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT64 Supports;
|
||||
|
||||
//
|
||||
// Open the PciIo Protocol, then enable the USB host controller
|
||||
@@ -1511,10 +1512,19 @@ EhcDriverBindingStart (
|
||||
|
||||
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)) {
|
||||
EHC_ERROR (("EhcDriverBindingStart: failed to enable controller\n"));
|
||||
@@ -1643,6 +1653,7 @@ EhcDriverBindingStop (
|
||||
EFI_USB2_HC_PROTOCOL *Usb2Hc;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
USB2_HC_DEV *Ehc;
|
||||
UINT64 Supports;
|
||||
|
||||
//
|
||||
// Test whether the Controller handler passed in is a valid
|
||||
@@ -1695,12 +1706,21 @@ EhcDriverBindingStop (
|
||||
//
|
||||
// Disable the USB Host Controller
|
||||
//
|
||||
PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationDisable,
|
||||
EFI_PCI_DEVICE_ENABLE,
|
||||
NULL
|
||||
);
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationSupported,
|
||||
0,
|
||||
&Supports
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Supports &= EFI_PCI_DEVICE_ENABLE;
|
||||
Status = PciIo->Attributes (
|
||||
PciIo,
|
||||
EfiPciIoAttributeOperationDisable,
|
||||
Supports,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
gBS->CloseProtocol (
|
||||
Controller,
|
||||
@@ -1710,7 +1730,7 @@ EhcDriverBindingStop (
|
||||
);
|
||||
|
||||
gBS->FreePool (Ehc);
|
||||
return Status;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_DRIVER_BINDING_PROTOCOL
|
||||
|
Reference in New Issue
Block a user