From 96f6af14d68faa2b65368a6f779a1c3af2e7658b Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 15 Oct 2007 07:44:27 +0000 Subject: 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 --- MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Init.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'MdeModulePkg/Bus/Pci/UndiRuntimeDxe') diff --git a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Init.c b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Init.c index 8315bc41d0..784bf5560e 100644 --- a/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Init.c +++ b/MdeModulePkg/Bus/Pci/UndiRuntimeDxe/Init.c @@ -287,6 +287,7 @@ Returns: UINT8 *TmpPxePointer; EFI_PCI_IO_PROTOCOL *PciIoFncs; UINTN Len; + UINT64 Supports; Status = gBS->OpenProtocol ( Controller, @@ -380,10 +381,19 @@ Returns: Status = PciIoFncs->Attributes ( PciIoFncs, - EfiPciIoAttributeOperationEnable, - EFI_PCI_DEVICE_ENABLE | EFI_PCI_IO_ATTRIBUTE_MEMORY | EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_BUS_MASTER, - NULL + EfiPciIoAttributeOperationSupported, + 0, + &Supports ); + if (!EFI_ERROR (Status)) { + Supports &= EFI_PCI_DEVICE_ENABLE; + Status = PciIoFncs->Attributes ( + PciIoFncs, + EfiPciIoAttributeOperationEnable, + Supports, + NULL + ); + } // // Read all the registers from device's PCI Configuration space // -- cgit v1.2.3