diff options
author | Olof Johansson <olof@lixom.net> | 2007-04-16 02:26:34 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-04-24 07:31:48 -0400 |
commit | df7e70a2b0899845bb9a53548beeed05b9947705 (patch) | |
tree | 932c5e404d73f8bc2795e96a1ff9ce8536e98fed | |
parent | a14c4508f4bb1bb7772b1976a82646be8d8b515a (diff) |
[POWERPC] pasemi: Allow 8KB config space for I/O bridge
Device 0 function 0 on the root bus is really a two-function bus agent,
but only the first function is visible. Because of this, we need to
allow config accesses into the second range. Modify the check for valid
offsets accordingly.
Signed-off-by: Olof Johansson <olof@lixom.net>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/platforms/pasemi/pci.c | 16 |
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) | 36 | static 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 | ||
38 | static void volatile __iomem *pa_pxp_cfg_addr(struct pci_controller *hose, | 48 | static 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); |