aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/pasemi/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/pasemi/pci.c')
-rw-r--r--arch/powerpc/platforms/pasemi/pci.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/arch/powerpc/platforms/pasemi/pci.c b/arch/powerpc/platforms/pasemi/pci.c
index 7ecb2ba24db9..056243da360b 100644
--- a/arch/powerpc/platforms/pasemi/pci.c
+++ b/arch/powerpc/platforms/pasemi/pci.c
@@ -33,7 +33,17 @@
33 33
34#define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) 34#define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off))
35 35
36#define CONFIG_OFFSET_VALID(off) ((off) < 4096) 36static inline int pa_pxp_offset_valid(u8 bus, u8 devfn, int offset)
37{
38 /* Device 0 Function 0 is special: It's config space spans function 1 as
39 * well, so allow larger offset. It's really a two-function device but the
40 * second function does not probe.
41 */
42 if (bus == 0 && devfn == 0)
43 return offset < 8192;
44 else
45 return offset < 4096;
46}
37 47
38static void volatile __iomem *pa_pxp_cfg_addr(struct pci_controller *hose, 48static void volatile __iomem *pa_pxp_cfg_addr(struct pci_controller *hose,
39 u8 bus, u8 devfn, int offset) 49 u8 bus, u8 devfn, int offset)
@@ -51,7 +61,7 @@ static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn,
51 if (!hose) 61 if (!hose)
52 return PCIBIOS_DEVICE_NOT_FOUND; 62 return PCIBIOS_DEVICE_NOT_FOUND;
53 63
54 if (!CONFIG_OFFSET_VALID(offset)) 64 if (!pa_pxp_offset_valid(bus->number, devfn, offset))
55 return PCIBIOS_BAD_REGISTER_NUMBER; 65 return PCIBIOS_BAD_REGISTER_NUMBER;
56 66
57 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); 67 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);
@@ -85,7 +95,7 @@ static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn,
85 if (!hose) 95 if (!hose)
86 return PCIBIOS_DEVICE_NOT_FOUND; 96 return PCIBIOS_DEVICE_NOT_FOUND;
87 97
88 if (!CONFIG_OFFSET_VALID(offset)) 98 if (!pa_pxp_offset_valid(bus->number, devfn, offset))
89 return PCIBIOS_BAD_REGISTER_NUMBER; 99 return PCIBIOS_BAD_REGISTER_NUMBER;
90 100
91 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); 101 addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset);