[PATCH][2.6] JS20 support

Benjamin Herrenschmidt benh at kernel.crashing.org
Wed Nov 26 11:37:05 EST 2003


> FYI, 6 months ago I tried submitting a similar patch for a different
> ide driver.  Alan Cox wrote back to say that doing this was wrong,
> and started talking something about 'legacy ide', and how this would
> break certain older pc's.  I didn't understand the issue.  So just
> be forwarned. Maybe Doug Maxey understands the issue?

it's a mess. Basically, this "fix" is needed for anything "sane" but
will break a few broken x86 (and I suppose x86-wanabee like PReP)
setups, and since Linux is all about running on broken x86 hardware,
we can't get it fixed properly =P

The root of the problem is the amoung of tricks done by x86 hardware
to mimmic the good old disk controllers at fixed port & fixed interrupt
addresses found in old HW and to try to make anything recent still some
what compatible with this old junk. Mix that with the fact that both
channel interrupts may be wired to different physical lines and not to
the PCI interrupt line, just so they end up beeing on the old "legacy"
disk interrupt numbers and you get an idea of how much of a mess it is.

So far, I had rather good results by forcing the controllers into
"fully native" mode from the arch PCI quirks though.

Something around those lines of what I have in the pmac code:

void pmac_pci_fixup_pciata(struct pci_dev* dev)
{
       u8 progif = 0;

       /*
        * On PowerMacs, we try to switch any PCI ATA controller to
	* fully native mode
        */
	if (_machine != _MACH_Pmac)
		return;
	/* Some controllers don't have the class IDE */
	if (dev->vendor == PCI_VENDOR_ID_PROMISE)
		switch(dev->device) {
		case PCI_DEVICE_ID_PROMISE_20246:
		case PCI_DEVICE_ID_PROMISE_20262:
		case PCI_DEVICE_ID_PROMISE_20263:
		case PCI_DEVICE_ID_PROMISE_20265:
		case PCI_DEVICE_ID_PROMISE_20267:
		case PCI_DEVICE_ID_PROMISE_20268:
		case PCI_DEVICE_ID_PROMISE_20269:
		case PCI_DEVICE_ID_PROMISE_20270:
		case PCI_DEVICE_ID_PROMISE_20271:
		case PCI_DEVICE_ID_PROMISE_20275:
		case PCI_DEVICE_ID_PROMISE_20276:
		case PCI_DEVICE_ID_PROMISE_20277:
			goto good;
		}
	/* Others, check PCI class */
	if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
		return;
 good:
	pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
	if ((progif & 5) != 5) {
		printk(KERN_INFO "Forcing PCI IDE into native mode: %s\n", pci_name(dev));
		(void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5);
		if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) ||
		    (progif & 5) != 5)
			printk(KERN_ERR "Rewrite of PROGIF failed !\n");
	}
}


** Sent via the linuxppc64-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc64-dev mailing list