[OpenBIOS] [PATCH] PowerPC: Fix PCI I/O ports allocation

Aurelien Jarno aurelien at aurel32.net
Fri Jan 16 03:05:30 CET 2009

Long story, small patch...

On the PowerPC target, the PCI devices using I/O ports are currently not
working correctly with a relatively old kernel (<= 2.6.24). This is due
to the assignation of I/O port 0, while the I/O ports start at 1, which
keeps the device disabled. Recent version of Linux assign resources to
those devices, that's why the problem wasn't present on those versions.

Moreover the QEMU OldWorld machine have a few devices mapped on fixed
I/O ports, that should be skipped when assigning I/O ports to PCI 
devices. Those devices are:
- video card (0x3c0-0x3cf, 0x3b4-0x3b5, 0x3ba, 0x1ce-0x1cf, 0x1d0-0x1d1)
- i8259 (0x20-0x21, 0xa0-0x1a, 0x4d0-0x4d1)
- m48t59 (0x74-0x79)
- OpenBIOS debug port (0xf00-0xf03)

Given that ranges, I have decided to start mapping PCI I/O ports at
0x1000. Note that real G3 beige starts to map them at 0x400. This can be
changed later, when we get rid of the i8259 and m48t59 and if we move
the OpenBIOS debug port.

I have done this change unconditionally because Sparc also have the
problem, though the first I/O port can be chosen differently.

Index: drivers/pci.c
--- drivers/pci.c	(révision 411)
+++ drivers/pci.c	(copie de travail)
@@ -760,7 +760,8 @@
 	/* Find all PCI bridges */
 	mem_base = arch->mem_base;
-	io_base = arch->io_base;
+	/* I/O ports under 0x1000 are used by devices mapped at fixed location. */
+	io_base = arch->io_base + 0x1000;
 	path = strdup("");
 	for (bus = 0; bus<0x100; bus++) {
 		ob_scan_pci_bus(bus, &mem_base, &io_base, &path);

  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   aurel32 at debian.org         | aurelien at aurel32.net
   `-    people.debian.org/~aurel32 | www.aurel32.net

More information about the OpenBIOS mailing list