EFI_STATUS PciRomLoadEfiDriversFromOptionRomTable ( IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo ) /*++ Routine Description: Arguments: Returns: --*/ { EFI_STATUS Status; EFI_PCI_OPTION_ROM_TABLE *PciOptionRomTable; EFI_PCI_OPTION_ROM_DESCRIPTOR *PciOptionRomDescriptor; UINTN Index; EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors; UINT16 MinBus; UINT16 MaxBus; Status = EfiGetSystemConfigurationTable (&gEfiPciOptionRomTableGuid, (VOID **) &PciOptionRomTable); if (EFI_ERROR (Status)) { return EFI_NOT_FOUND; } Status = EFI_NOT_FOUND; for (Index = 0; Index < PciOptionRomTable->PciOptionRomCount; Index++) { PciOptionRomDescriptor = &PciOptionRomTable->PciOptionRomDescriptors[Index]; if (!PciOptionRomDescriptor->DontLoadEfiRom) { if (PciOptionRomDescriptor->Seg == PciRootBridgeIo->SegmentNumber) { Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Descriptors); if (EFI_ERROR (Status)) { return Status; } PciGetBusRange (&Descriptors, &MinBus, &MaxBus, NULL); if ((MinBus <= PciOptionRomDescriptor->Bus) && (PciOptionRomDescriptor->Bus <= MaxBus)) { Status = PciRomLoadEfiDriversFromRomImage (This, PciOptionRomDescriptor); PciOptionRomDescriptor->DontLoadEfiRom |= 2; } } } } return Status; }
STATIC VOID LoadVideoRom ( VOID ) { PCI_DATA_STRUCTURE *Pcir; UINTN RomSize; // // The virtual machines sometimes load the video rom image // directly at the legacy video BIOS location of C000:0000, // and do not implement the PCI expansion ROM feature. // Pcir = (PCI_DATA_STRUCTURE *) (UINTN) 0xc0000; RomSize = Pcir->ImageLength * 512; PciRomLoadEfiDriversFromRomImage (0xc0000, RomSize); }