X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=MdeModulePkg%2FBus%2FPci%2FPciBusDxe%2FPciDeviceSupport.c;h=97bb971a5966a2d869d8da42b47cb4e5be386f27;hp=1ad863c96673642cb2f6d267dc08573785dd97d8;hb=8315563285719f09f13e69a408f34558fc41c822;hpb=d40483911c83dbcff1cb25ae4c9b9c26cf213973 diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c index 1ad863c966..97bb971a59 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c @@ -1,7 +1,7 @@ /** @file Supporting functions implementaion for PCI devices management. -Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -268,6 +268,7 @@ RegisterPciDevice ( &PlatformOpRomSize ); if (!EFI_ERROR (Status)) { + PciIoDevice->EmbeddedRom = FALSE; PciIoDevice->RomSize = PlatformOpRomSize; PciIoDevice->PciIo.RomSize = PlatformOpRomSize; PciIoDevice->PciIo.RomImage = PlatformOpRomBuffer; @@ -281,7 +282,7 @@ RegisterPciDevice ( PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, - (UINT64) (UINTN) PciIoDevice->PciIo.RomImage, + PciIoDevice->PciIo.RomImage, PciIoDevice->PciIo.RomSize ); } @@ -293,6 +294,7 @@ RegisterPciDevice ( &PlatformOpRomSize ); if (!EFI_ERROR (Status)) { + PciIoDevice->EmbeddedRom = FALSE; PciIoDevice->RomSize = PlatformOpRomSize; PciIoDevice->PciIo.RomSize = PlatformOpRomSize; PciIoDevice->PciIo.RomImage = PlatformOpRomBuffer; @@ -306,7 +308,7 @@ RegisterPciDevice ( PciIoDevice->BusNumber, PciIoDevice->DeviceNumber, PciIoDevice->FunctionNumber, - (UINT64) (UINTN) PciIoDevice->PciIo.RomImage, + PciIoDevice->PciIo.RomImage, PciIoDevice->PciIo.RomSize ); } @@ -694,7 +696,7 @@ StartPciDevicesOnBridge ( // // If it is a PPB // - if (!IsListEmpty (&PciIoDevice->ChildList)) { + if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) { Status = StartPciDevicesOnBridge ( Controller, PciIoDevice, @@ -709,7 +711,12 @@ StartPciDevicesOnBridge ( 0, &Supports ); - Supports &= EFI_PCI_DEVICE_ENABLE; + // + // By default every bridge's IO and MMIO spaces are enabled. + // Bridge's Bus Master will be enabled when any device behind it requests + // to enable Bus Master. + // + Supports &= (UINT64) (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY); PciIoDevice->PciIo.Attributes ( &(PciIoDevice->PciIo), EfiPciIoAttributeOperationEnable, @@ -746,7 +753,7 @@ StartPciDevicesOnBridge ( (*NumberOfChildren)++; } - if (!IsListEmpty (&PciIoDevice->ChildList)) { + if (IS_PCI_BRIDGE (&PciIoDevice->Pci)) { Status = StartPciDevicesOnBridge ( Controller, PciIoDevice, @@ -761,7 +768,12 @@ StartPciDevicesOnBridge ( 0, &Supports ); - Supports &= EFI_PCI_DEVICE_ENABLE; + // + // By default every bridge's IO and MMIO spaces are enabled. + // Bridge's Bus Master will be enabled when any device behind it requests + // to enable Bus Master. + // + Supports &= (UINT64) (EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY); PciIoDevice->PciIo.Attributes ( &(PciIoDevice->PciIo), EfiPciIoAttributeOperationEnable,