2004-10-09 20:02:13

by Ed Schouten

[permalink] [raw]
Subject: [Patch 3/5] xbox: block certain PCI devices

When probing certain devices or busses on the Xbox, the system may hang.
Therefore, we need to blacklist certain busses.

You can also download this patch at:
http://linux.g-rave.nl/patches/patch-xbox-pci_workaround.diff
---

direct.c | 16 ++++++++++++++++
1 files changed, 16 insertions(+)

diff -u -r --new-file linux-2.6.9-rc3/arch/i386/pci/direct.c
linux-2.6.9-rc3-ed0/arch/i386/pci/direct.c
--- linux-2.6.9-rc3/arch/i386/pci/direct.c 2004-09-30 05:04:23.000000000
+0200
+++ linux-2.6.9-rc3-ed0/arch/i386/pci/direct.c 2004-10-09
19:49:54.677610000 +0200
@@ -20,6 +20,22 @@
if (!value || (bus > 255) || (devfn > 255) || (reg > 255))
return -EINVAL;

+#ifdef CONFIG_X86_XBOX
+ /*
+ * Workaround for the Microsoft Xbox:
+ * Prevent it from tampering with some devices.
+ */
+ if ((bus == 0) && !PCI_SLOT(devfn) &&
+ ((PCI_FUNC(devfn) == 1) || (PCI_FUNC(devfn) == 2)))
+ return -EINVAL;
+
+ if ((bus == 1) && (PCI_SLOT(devfn) || PCI_FUNC(devfn)))
+ return -EINVAL;
+
+ if (bus >= 2)
+ return -EINVAL;
+#endif
+
spin_lock_irqsave(&pci_config_lock, flags);

outl(PCI_CONF1_ADDRESS(bus, devfn, reg), 0xCF8);