• Bjorn Helgaas's avatar
    PCI: Set ROM shadow location in arch code, not in PCI core · 0c0e0736
    Bjorn Helgaas authored
    IORESOURCE_ROM_SHADOW means there is a copy of a device's option ROM in
    RAM.  The existence of such a copy and its location are arch-specific.
    Previously the IORESOURCE_ROM_SHADOW flag was set in arch code, but the
    0xC0000-0xDFFFF location was hard-coded into the PCI core.
    
    If we're using a shadow copy in RAM, disable the ROM BAR and release the
    address space it was consuming.  Move the location information from the PCI
    core to the arch code that sets IORESOURCE_ROM_SHADOW.  Save the location
    of the RAM copy in the struct resource for PCI_ROM_RESOURCE.
    
    After this change, pci_map_rom() will call pci_assign_resource() and
    pci_enable_rom() for these IORESOURCE_ROM_SHADOW resources, which we did
    not do before.  This is safe because:
    
      - pci_assign_resource() will do nothing because the resource is marked
        IORESOURCE_PCI_FIXED, which means we can't move it, and
    
      - pci_enable_rom() will not turn on the ROM BAR's enable bit because the
        resource is marked IORESOURCE_ROM_SHADOW, which means it is in RAM
        rather than in PCI memory space.
    
    Storing the location in the struct resource means "lspci" will show the
    shadow location, not the value from the ROM BAR.
    Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
    0c0e0736
fixup.c 2.44 KB