--- linux-2.4.19-p5/drivers/ide/cmd640.c Fri Feb 16 16:02:36 2001 +++ linux-2.4.19-p5-ac2/drivers/ide/cmd640.c Thu Apr 4 23:15:52 2002 @@ -692,6 +692,44 @@ #endif /* CONFIG_BLK_DEV_CMD640_ENHANCED */ +static int pci_conf1(void) +{ + u32 tmp; + unsigned long flags; + + save_flags(flags); + __cli(); + outb(0x01, 0xCFB); + tmp = inl(0xCF8); + outl(0x80000000, 0xCF8); + if(inl(0xCF8) == 0x80000000) + { + outl(tmp, 0xCF8); + __restore_flags(flags); + return 1; + } + outl(tmp, 0xCF8); + return 0; +} + +static int pci_conf2(void) +{ + unsigned long flags; + + save_flags(flags); + __cli(); + outb(0x00, 0xCFB); + outb(0x00, 0xCF8); + outb(0x00, 0xCFA); + if(inb(0xCF8) == 0x00 && inb(0xCF8) == 0x00) + { + restore_flags(flags); + return 1; + } + restore_flags(flags); + return 0; +} + /* * Probe for a cmd640 chipset, and initialize it if found. Called from ide.c */ @@ -709,9 +747,11 @@ bus_type = "VLB"; } else { cmd640_vlb = 0; - if (probe_for_cmd640_pci1()) + /* Find out what kind of PCI probing is supported otherwise + Justin Gibbs will sulk.. */ + if (pci_conf1() && probe_for_cmd640_pci1()) bus_type = "PCI (type1)"; - else if (probe_for_cmd640_pci2()) + else if (pci_conf2() && probe_for_cmd640_pci2()) bus_type = "PCI (type2)"; else return 0;