Re: pci: Arch hook to determine config space size

From: Arnd Bergmann (arnd_at_arndb.de)
Date: 01/31/05

  • Next message: Ulrich Drepper: "Re: close-exec flag not working in 2.6.9?"
    To: linuxppc64-dev@ozlabs.org
    Date:	Mon, 31 Jan 2005 21:51:04 +0100
    
    
    

    On Maandag 31 Januar 2005 20:29, Matthew Wilcox wrote:
    > Thanks for copying linux-pci.  I hate this patch.
    >
    > Basically, ppc64's config ops are broken and need to check the offset
    > being read.

    To make things worse, simply allowing the larger config space will
    silently access the wrong device. The least that needs to be done
    is to pass the correct address to the firmware.
    This patch should do the right thing, though I don't have any PCIe
    card to test with.

    Note that at least for the rtas pci config access, the bus/devfn
    values come from the device tree, which makes it somewhat harder
    to screw them up, and rtas ought to check for obviously wrong
    addresses as well.

    Signed-off-by: Arnd Bergmann <arndb@de.ibm.com>

    --- linux-mm.orig/arch/ppc64/kernel/pSeries_pci.c 2005-01-28 07:21:15.000000000 -0500
    +++ linux-mm/arch/ppc64/kernel/pSeries_pci.c 2005-01-31 15:56:10.244983464 -0500
    @@ -63,7 +63,8 @@
             if (where & (size - 1))
                     return PCIBIOS_BAD_REGISTER_NUMBER;
     
    - addr = (dn->busno << 16) | (dn->devfn << 8) | where;
    + addr = ((where & 0xf00) << 20) | (dn->busno << 16)
    + | (dn->devfn << 8) | (where & 0x0ff);
             buid = dn->phb->buid;
             if (buid) {
                     ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval,
    @@ -111,7 +112,8 @@
             if (where & (size - 1))
                     return PCIBIOS_BAD_REGISTER_NUMBER;
     
    - addr = (dn->busno << 16) | (dn->devfn << 8) | where;
    + addr = ((where & 0xf00) << 20) | (dn->busno << 16)
    + | (dn->devfn << 8) | (where & 0x0ff);
             buid = dn->phb->buid;
             if (buid) {
                     ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, buid >> 32, buid & 0xffffffff, size, (ulong) val);

    
    

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/



  • Next message: Ulrich Drepper: "Re: close-exec flag not working in 2.6.9?"

    Relevant Pages