2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-17 01:34:00 +08:00

pata_qdi: Fix initialisation

The QDI init code contains some bugs which mean it only works if you have
a test setup that causes both a successful and failed probe. Fix this

Found by Philip Guo

(Who found it working on code analysis tools not running VLB IDE
controllers)

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
This commit is contained in:
Alan Cox 2007-03-02 14:56:35 +00:00 committed by Jeff Garzik
parent fb9f8905a8
commit cc7c15ec16

View File

@ -363,7 +363,8 @@ static __init int qdi_init(void)
release_region(port, 2); release_region(port, 2);
continue; continue;
} }
ct += qdi_init_one(port, 6500, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04); if (qdi_init_one(port, 6500, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04) == 0)
ct++;
} }
if (((r & 0xF0) == 0xA0) || (r & 0xF0) == 0x50) { if (((r & 0xF0) == 0xA0) || (r & 0xF0) == 0x50) {
/* QD6580: dual channel */ /* QD6580: dual channel */
@ -375,11 +376,14 @@ static __init int qdi_init(void)
res = inb(port + 3); res = inb(port + 3);
if (res & 1) { if (res & 1) {
/* Single channel mode */ /* Single channel mode */
ct += qdi_init_one(port, 6580, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04); if (qdi_init_one(port, 6580, ide_port[r & 0x01], ide_irq[r & 0x01], r & 0x04))
ct++;
} else { } else {
/* Dual channel mode */ /* Dual channel mode */
ct += qdi_init_one(port, 6580, 0x1F0, 14, r & 0x04); if (qdi_init_one(port, 6580, 0x1F0, 14, r & 0x04) == 0)
ct += qdi_init_one(port + 2, 6580, 0x170, 15, r & 0x04); ct++;
if (qdi_init_one(port + 2, 6580, 0x170, 15, r & 0x04) == 0)
ct++;
} }
} }
} }