30 Nov, 2016

1 commit

  • pci_update_resource() updates a hardware BAR so its address matches the
    kernel's struct resource UNLESS it's a disabled ROM BAR. We only update
    those when we enable the ROM.

    It's not obvious from the code why ROM BARs should be handled specially.
    Apparently there are Matrox devices with defective ROM BARs that read as
    zero when disabled. That means that if pci_enable_rom() reads the disabled
    BAR, sets PCI_ROM_ADDRESS_ENABLE (without re-inserting the address), and
    writes it back, it would enable the ROM at address zero.

    Add comments and references to explain why we can't make the code look more
    rational.

    The code changes are from 755528c860b0 ("Ignore disabled ROM resources at
    setup") and 8085ce084c0f ("[PATCH] Fix PCI ROM mapping").

    Link: https://lkml.org/lkml/2005/8/30/138
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Gavin Shan

    Bjorn Helgaas
     

12 Mar, 2016

2 commits


09 Mar, 2016

2 commits

  • 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: Bjorn Helgaas

    Bjorn Helgaas
     
  • If we're using a RAM shadow copy instead of the ROM BAR, we don't need to
    touch the ROM BAR enable bit.

    Signed-off-by: Bjorn Helgaas

    Bjorn Helgaas
     

16 Jan, 2016

1 commit


09 Jan, 2016

1 commit

  • If the 'image' pointer has been advanced more than 'size', we've already
    iterated through memory outside the resource window.

    We have zero control over whatever we find in the option ROM, if it's even
    an option ROM and not just an accident of random data just happening to
    look like an option ROM.

    Signed-off-by: Edward O'Callaghan
    Signed-off-by: Bjorn Helgaas

    Edward O'Callaghan
     

11 Dec, 2015

1 commit

  • We've always validated that both bytes of the Expansion ROM signature and
    all four bytes of the PCI Data Structure signature (see PCI Firmware spec
    r3.0, sec 5.1.1), but we only printed a warning if the first byte of the
    ROM signature was invalid.

    Print warnings if *any* of those bytes are invalid. Note that we only look
    at these headers if we map or read the ROM.

    [bhelgaas: changelog, tweak printk format]
    Signed-off-by: Vladis Dronov
    Signed-off-by: Bjorn Helgaas

    Vladis Dronov
     

24 Jan, 2015

1 commit

  • If the image size would ever read as 0, pci_get_rom_size() could keep
    processing the same image over and over again. Exit the loop if we ever
    read a length of zero.

    This fixes a soft lockup on boot when the radeon driver calls
    pci_get_rom_size() on an AMD Radeon R7 250X PCIe discrete graphics card.

    [bhelgaas: changelog, reference]
    Link: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1386973
    Reported-by: Federico
    Signed-off-by: Michel Dänzer
    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Alex Deucher
    CC: stable@vger.kernel.org

    Michel Dänzer
     

11 Jun, 2014

2 commits


28 Feb, 2014

1 commit

  • When assigning addresses to resources, mark them with IORESOURCE_UNSET
    before we start and clear IORESOURCE_UNSET if assignment is successful.
    That means that if we print the resource during assignment, we will show
    the size, not a meaningless address.

    Also, clear IORESOURCE_UNSET if we do assign an address, so we print the
    address when it is valid.

    Signed-off-by: Bjorn Helgaas

    Bjorn Helgaas
     

22 Dec, 2013

1 commit

  • These interfaces:

    pcibios_resource_to_bus(struct pci_dev *dev, *bus_region, *resource)
    pcibios_bus_to_resource(struct pci_dev *dev, *resource, *bus_region)

    took a pci_dev, but they really depend only on the pci_bus. And we want to
    use them in resource allocation paths where we have the bus but not a
    device, so this patch converts them to take the pci_bus instead of the
    pci_dev:

    pcibios_resource_to_bus(struct pci_bus *bus, *bus_region, *resource)
    pcibios_bus_to_resource(struct pci_bus *bus, *resource, *bus_region)

    In fact, with standard PCI-PCI bridges, they only depend on the host
    bridge, because that's the only place address translation occurs, but
    we aren't going that far yet.

    [bhelgaas: changelog]
    Signed-off-by: Yinghai Lu
    Signed-off-by: Bjorn Helgaas

    Yinghai Lu
     

27 Mar, 2013

1 commit

  • It turns out that some UEFI systems provide apparently an apparently valid
    PCI ROM BAR that turns out to contain garbage, so the attempt in 547b52463
    to prefer the ROM from the BAR actually breaks a different set of machines.
    As Linus pointed out, the graphics drivers are probably in the best
    position to make this judgement, so this basically reverts 547b52463 and
    f9a37be0f and adds a new helper function. Followup patches will add support
    to nouveau and radeon for probing this ROM source if they can't find a ROM
    from some other source.

    [bhelgaas: added reporter and bugzilla pointers, s/f4eb5ff05/547b52463]
    Reference: https://bugzilla.redhat.com/show_bug.cgi?id=927451
    Reference: http://lkml.kernel.org/r/kg69ef$vdb$1@ger.gmane.org
    Reported-by: Mantas Mikulėnas
    Reported-by: Chris Murphy
    Signed-off-by: Matthew Garrett
    Signed-off-by: Bjorn Helgaas

    Matthew Garrett
     

20 Mar, 2013

1 commit

  • Mantas Mikulėnas reported that his graphics hardware failed to
    initialise after commit f9a37be0f02a ("x86: Use PCI setup data").

    The aim of this commit was to ensure that ROM images were available on
    some Apple systems that don't expose the GPU ROM via any other source.
    In this case, UEFI appears to have provided a broken ROM image that we
    were using even though there was a perfectly valid ROM available via
    other sources. The simplest way to handle this seems to be to just
    re-order pci_map_rom() and leave any firmare-supplied ROM to last.

    Signed-off-by: Matthew Garrett
    Tested-by: Mantas Mikulėnas
    Signed-off-by: Linus Torvalds

    Matthew Garrett
     

11 Dec, 2012

1 commit


06 Dec, 2012

1 commit


23 Aug, 2012

1 commit


01 Nov, 2011

1 commit


14 Feb, 2009

1 commit


05 Feb, 2009

1 commit

  • This patch makes the ROM reading code return an error to user space if
    the size of the ROM read is equal to 0.

    The patch also emits a warnings if the contents of the ROM are invalid,
    and documents the effects of the "enable" file on ROM reading.

    Signed-off-by: Timothy S. Nelson
    Acked-by: Alex Villacis-Lasso
    Signed-off-by: Jesse Barnes

    Timothy S. Nelson
     

04 Nov, 2008

1 commit

  • Fix pci/rom.c kernel-doc function notation:

    Warning(drivers/pci/rom.c:110): Excess function parameter or struct member 'return' description in 'pci_map_rom'
    Warning(drivers/pci/rom.c:177): Excess function parameter or struct member 'return' description in 'pci_map_rom_copy'

    Signed-off-by: Randy Dunlap
    Signed-off-by: Jesse Barnes

    Randy Dunlap
     

27 Sep, 2008

1 commit


04 Mar, 2008

1 commit


02 Feb, 2008

1 commit


10 Jul, 2007

1 commit


02 Dec, 2006

1 commit

  • Support a shadowed ROM when running with an ACPI capable PROM.

    Define a new dev.resource flag IORESOURCE_ROM_BIOS_COPY to
    describe the case of a BIOS shadowed ROM, which can then
    be used to avoid pci_map_rom() making an unneeded call to
    pci_enable_rom().

    Signed-off-by: John Keller
    Signed-off-by: Greg Kroah-Hartman

    John Keller
     

28 Oct, 2006

1 commit


19 Oct, 2006

1 commit

  • pci_fixup_video turns into generic code because there are many platforms need this fixup
    for embedded VGA as well as x86. The Video BIOS integrates into System BIOS on a machine
    has embedded VGA although embedded VGA generally don't have PCI ROM. As a result,
    embedded VGA need the way that the sysfs rom points to the Video BIOS of System
    RAM (0xC0000). PCI-to-PCI Bridge Architecture specification describes the condition whether
    or not PCI ROM forwards VGA compatible memory address. fixup_video suits this specification.
    Although the Video ROM generally implements in x86 code regardless of platform, some
    application such as X Window System can run this code by dosemu86. Therefore,
    pci_fixup_video should turn into generic code.

    Signed-off-by: Eiichiro Oiwa
    Acked-by: Alan Cox
    Acked-by: Jesse Barnes
    Signed-off-by: Greg Kroah-Hartman

    eiichiro.oiwa.nm@hitachi.com
     

01 Jul, 2006

1 commit


28 Jun, 2006

1 commit


31 Oct, 2005

1 commit

  • I recently picked up my older work to remove unnecessary #includes of
    sched.h, starting from a patch by Dave Jones to not include sched.h
    from module.h. This reduces the number of indirect includes of sched.h
    by ~300. Another ~400 pointless direct includes can be removed after
    this disentangling (patch to follow later).
    However, quite a few indirect includes need to be fixed up for this.

    In order to feed the patches through -mm with as little disturbance as
    possible, I've split out the fixes I accumulated up to now (complete for
    i386 and x86_64, more archs to follow later) and post them before the real
    patch. This way this large part of the patch is kept simple with only
    adding #includes, and all hunks are independent of each other. So if any
    hunk rejects or gets in the way of other patches, just drop it. My scripts
    will pick it up again in the next round.

    Signed-off-by: Tim Schmielau
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tim Schmielau
     

02 Sep, 2005

1 commit

  • This fixes a problem with pci_map_rom() which doesn't properly
    update the ROM BAR value with the address thas allocated for it by the
    PCI code. This problem, among other, breaks boot on Mac laptops.

    It'ss a new version based on Linus latest one with better error
    checking.

    Signed-off-by: Benjamin Herrenschmidt
    Signed-off-by: Linus Torvalds

    Benjamin Herrenschmidt
     

30 Jul, 2005

1 commit


01 May, 2005

1 commit


17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds