X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EdkModulePkg%2FBus%2FPci%2FPciBus%2FDxe%2FPciIo.c;h=040c57095d866b244481e6c129ee480e4524c5db;hp=4f1737f5af7082295736683737bb525131213a11;hb=d43eee260fdd3080c85a7d6860c19100d7e48e6b;hpb=878ddf1fc3540a715f63594ed22b6929e881afb4 diff --git a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c index 4f1737f5af..040c57095d 100644 --- a/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c +++ b/EdkModulePkg/Bus/Pci/PciBus/Dxe/PciIo.c @@ -21,7 +21,7 @@ Revision History --*/ -#include "Pcibus.h" +#include "pcibus.h" // // Internal use only @@ -369,7 +369,7 @@ Returns: PciIoDevice = PCI_IO_DEVICE_FROM_PCI_IO_THIS (This); - if (Width < 0 || Width >= EfiPciIoWidthMaximum) { + if (Width < 0 || Width > EfiPciIoWidthUint64) { return EFI_INVALID_PARAMETER; } @@ -378,10 +378,6 @@ Returns: return EFI_UNSUPPORTED; } - if (Width > EfiPciIoWidthUint64) { - return EFI_INVALID_PARAMETER; - } - Status = PciIoDevice->PciRootBridgeIo->PollIo ( PciIoDevice->PciRootBridgeIo, (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width, @@ -1350,7 +1346,7 @@ Returns: // decode // - if (Temp->BusNumber > PciIoDevice->BusNumber) { + if (Temp->BusNumber < PciIoDevice->BusNumber) { // // GFX should be set to decode // @@ -1509,12 +1505,26 @@ Returns: Command = 0; BridgeControl = 0; + // + // Check VGA and VGA16, they can not be set at the same time + // + if (((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) && + (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) || + ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) && + (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) || + ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) && + (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) || + ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) && + (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) ) { + return EFI_UNSUPPORTED; + } + // // For PPB & P2C, set relevant attribute bits // if (IS_PCI_BRIDGE (&PciIoDevice->Pci) || IS_CARDBUS_BRIDGE (&PciIoDevice->Pci)) { - if (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) { + if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_IO | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) { BridgeControl |= EFI_PCI_BRIDGE_CONTROL_VGA; } @@ -1522,18 +1532,23 @@ Returns: BridgeControl |= EFI_PCI_BRIDGE_CONTROL_ISA; } - if (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) { + if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) { Command |= EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO; } + if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16 | EFI_PCI_IO_ATTRIBUTE_VGA_IO_16)) { + BridgeControl |= EFI_PCI_BRIDGE_CONTROL_VGA_16; + } + } else { // // Do with the attributes on VGA + // Only for VGA's legacy resource, we just can enable once. // - if ((Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_IO) || - (IS_PCI_VGA(&PciIoDevice->Pci) && - ((Attributes & EFI_PCI_IO_ATTRIBUTE_IO) || - (Attributes & EFI_PCI_IO_ATTRIBUTE_MEMORY)))) { + if (Attributes & + (EFI_PCI_IO_ATTRIBUTE_VGA_IO | + EFI_PCI_IO_ATTRIBUTE_VGA_IO_16 | + EFI_PCI_IO_ATTRIBUTE_VGA_MEMORY)) { // // Check if a VGA has been enabled before enabling a new one // @@ -1554,7 +1569,7 @@ Returns: // // Do with the attributes on GFX // - if (Attributes & EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO) { + if (Attributes & (EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO | EFI_PCI_IO_ATTRIBUTE_VGA_PALETTE_IO_16)) { if (Operation == EfiPciIoAttributeOperationEnable) { // @@ -1956,9 +1971,5 @@ Returns: return TRUE; } - if (PciDevice1->BusNumber > PciDevice2->BusNumber) { - return PciDeviceExisted (PciDevice1->Parent, PciDevice2); - } - - return PciDeviceExisted (PciDevice2->Parent, PciDevice1); + return (PciDeviceExisted (PciDevice1->Parent, PciDevice2)|| PciDeviceExisted (PciDevice2->Parent, PciDevice1)); }