diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-10-15 07:44:27 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2007-10-15 07:44:27 +0000 |
commit | 96f6af14d68faa2b65368a6f779a1c3af2e7658b (patch) | |
tree | e57846a9a1bbef1848dc1397004465b79db2136a /IntelFrameworkModulePkg | |
parent | c8c6d794df25bfabc28c3624bd5c442c542b6234 (diff) | |
download | edk2-96f6af14d68faa2b65368a6f779a1c3af2e7658b.zip edk2-96f6af14d68faa2b65368a6f779a1c3af2e7658b.tar.gz edk2-96f6af14d68faa2b65368a6f779a1c3af2e7658b.tar.bz2 |
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
Diffstat (limited to 'IntelFrameworkModulePkg')
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.c | 39 | ||||
-rw-r--r-- | IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c | 26 |
2 files changed, 44 insertions, 21 deletions
diff --git a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.c b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.c index 8f555c7..48c2184 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.c +++ b/IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/idebus.c @@ -182,6 +182,7 @@ IDEBusDriverBindingStart ( UINT16 ControlBlockBaseAddr;
UINTN DataSize;
IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;
+ UINT64 Supports;
//
// Local variables declaration for IdeControllerInit support
@@ -297,10 +298,20 @@ IDEBusDriverBindingStart ( 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)) {
goto ErrorExit;
}
@@ -835,6 +846,7 @@ IDEBusDriverBindingStop ( BOOLEAN AllChildrenStopped;
UINTN Index;
IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;
+ UINT64 Supports;
IdeBusDriverPrivateData = NULL;
@@ -849,12 +861,21 @@ IDEBusDriverBindingStop ( EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (!EFI_ERROR (Status)) {
- PciIo->Attributes (
- PciIo,
- EfiPciIoAttributeOperationDisable,
- EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE,
- NULL
- );
+ Status = PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationSupported,
+ 0,
+ &Supports
+ );
+ if (!EFI_ERROR (Status)) {
+ Supports &= EFI_PCI_IO_ATTRIBUTE_IDE_PRIMARY_IO | EFI_PCI_IO_ATTRIBUTE_IDE_SECONDARY_IO | EFI_PCI_DEVICE_ENABLE;
+ PciIo->Attributes (
+ PciIo,
+ EfiPciIoAttributeOperationDisable,
+ Supports,
+ NULL
+ );
+ }
}
gBS->OpenProtocol (
diff --git a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c index 5a40789..63ab8e5 100644 --- a/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c +++ b/IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c @@ -1462,19 +1462,21 @@ Returns: }
//
// Just a trick for ENABLE attribute
+ // EFI_PCI_DEVICE_ENABLE is not defined in UEFI spec, which is the internal usage.
+ // So, this logic doesn't confrom to UEFI spec, which should be removed.
//
- if ((Attributes & EFI_PCI_DEVICE_ENABLE) == EFI_PCI_DEVICE_ENABLE) {
- Attributes &= (PciIoDevice->Supports);
-
- //
- // Raise the EFI_P_PC_ENABLE Status code
- //
- REPORT_STATUS_CODE_WITH_DEVICE_PATH (
- EFI_PROGRESS_CODE,
- EFI_IO_BUS_PCI | EFI_P_PC_ENABLE,
- PciIoDevice->DevicePath
- );
- }
+ // if ((Attributes & EFI_PCI_DEVICE_ENABLE) == EFI_PCI_DEVICE_ENABLE) {
+ // Attributes &= (PciIoDevice->Supports);
+ //
+ // //
+ // // Raise the EFI_P_PC_ENABLE Status code
+ // //
+ // REPORT_STATUS_CODE_WITH_DEVICE_PATH (
+ // EFI_PROGRESS_CODE,
+ // EFI_IO_BUS_PCI | EFI_P_PC_ENABLE,
+ // PciIoDevice->DevicePath
+ // );
+ // }
//
// If no attributes can be supported, then return.
|