aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Lynch <ntl@pobox.com>2006-09-21 15:25:34 -0400
committerPaul Mackerras <paulus@samba.org>2006-09-22 01:19:58 -0400
commitd608df5c7da6ee968aa2ad43c596d5f8d4022299 (patch)
tree421df8cc60c8570e89b15a74cd67b177ca64778c
parented709d134deeaea7925a3d748b33ca7e58cc683d (diff)
[POWERPC] Maple U3 HT - reject inappropriate config space access
When there is a PCI-X mode 2 capable device behind the HT<->PCI-X bridge, the pci core decides that the device has the extended 4K config space, even though the bus is not operating in mode 2. This is because the u3_ht pci ops silently accept offsets greater than 255 but use only the 8 least significant bits, which means reading at offset 0x100 gets the data at offset 0x0, and causes confusion for lspci. Reject accesses to configuration space offsets greater than 255. Signed-off-by: Nathan Lynch <ntl@pobox.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/platforms/maple/pci.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index dc05af5156a9..ec5c14f5ba49 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -213,6 +213,9 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
213 if (hose == NULL) 213 if (hose == NULL)
214 return PCIBIOS_DEVICE_NOT_FOUND; 214 return PCIBIOS_DEVICE_NOT_FOUND;
215 215
216 if (offset > 0xff)
217 return PCIBIOS_BAD_REGISTER_NUMBER;
218
216 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); 219 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
217 if (!addr) 220 if (!addr)
218 return PCIBIOS_DEVICE_NOT_FOUND; 221 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -245,6 +248,9 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
245 if (hose == NULL) 248 if (hose == NULL)
246 return PCIBIOS_DEVICE_NOT_FOUND; 249 return PCIBIOS_DEVICE_NOT_FOUND;
247 250
251 if (offset > 0xff)
252 return PCIBIOS_BAD_REGISTER_NUMBER;
253
248 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); 254 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
249 if (!addr) 255 if (!addr)
250 return PCIBIOS_DEVICE_NOT_FOUND; 256 return PCIBIOS_DEVICE_NOT_FOUND;