[PATCH 4/9] [POWERPC] move Efika support files into platforms/52xx

Arnd Bergmann arnd at arndb.de
Tue Nov 28 08:56:43 EST 2006


On Monday 27 November 2006 22:16, Grant Likely wrote:
> +#ifdef CONFIG_PCI
> +/*
> + * Access functions for PCI config space using RTAS calls.
> + */
> +static int rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
> +                           int len, u32 * val)
> +{
> +       struct pci_controller *hose = bus->sysdata;
> +       unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
> +           | (((bus->number - hose->first_busno) & 0xff) << 16)
> +           | (hose->index << 24);
> +       int ret = -1;
> +       int rval;
> +
> +       rval = rtas_call(rtas_token("read-pci-config"), 2, 2, &ret, addr, len);
> +       *val = ret;
> +       return rval ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
> +}
> +
> +static int rtas_write_config(struct pci_bus *bus, unsigned int devfn,
> +                            int offset, int len, u32 val)
> +{
> +       struct pci_controller *hose = bus->sysdata;
> +       unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
> +           | (((bus->number - hose->first_busno) & 0xff) << 16)
> +           | (hose->index << 24);
> +       int rval;
> +
> +       rval = rtas_call(rtas_token("write-pci-config"), 3, 1, NULL,
> +                        addr, len, val);
> +       return rval ? PCIBIOS_DEVICE_NOT_FOUND : PCIBIOS_SUCCESSFUL;
> +}
> +

I know you're only moving this code, but shouldn't this really use the
code from arch/powerpc/kernel/rtas_pci.c? If it doesn't work out of
the box, I guess we should rather split out the pseries specific
bits from it and make the common parts more generic.

	Arnd <><



More information about the Linuxppc-dev mailing list