From f38cd56eea7f486b449e0c8c52e660e64b2b3b9a Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 26 Apr 2008 22:25:18 +0200 Subject: [PATCH] --- yaml --- r: 93637 b: refs/heads/master c: d9b819a025ca1b09dafbe90b5d25ba57a639f048 h: refs/heads/master i: 93635: daa1f0558ca861b43cf91bbf2e8ccbf02d23a2e0 v: v3 --- [refs] | 2 +- trunk/drivers/ide/ide-probe.c | 56 +++++++++++++++++++++-------------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/[refs] b/[refs] index 61311ccbc0b6..c8eed0a3a1b1 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2305d94321bbbdc461acfb24b41fbf50f8a6dd91 +refs/heads/master: d9b819a025ca1b09dafbe90b5d25ba57a639f048 diff --git a/trunk/drivers/ide/ide-probe.c b/trunk/drivers/ide/ide-probe.c index da6025cfa09a..e299c80c6a57 100644 --- a/trunk/drivers/ide/ide-probe.c +++ b/trunk/drivers/ide/ide-probe.c @@ -1630,40 +1630,50 @@ void ide_port_scan(ide_hwif_t *hwif) } EXPORT_SYMBOL_GPL(ide_port_scan); -int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config) +static void ide_legacy_init_one(u8 *idx, hw_regs_t *hw, u8 port_no, + const struct ide_port_info *d, + unsigned long config) { - ide_hwif_t *hwif, *mate; - u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; - hw_regs_t hw[2]; - - memset(&hw, 0, sizeof(hw)); + ide_hwif_t *hwif; + unsigned long base, ctl; + int irq; - ide_std_init_ports(&hw[0], 0x1f0, 0x3f6); - hw[0].irq = 14; + if (port_no == 0) { + base = 0x1f0; + ctl = 0x3f6; + irq = 14; + } else { + base = 0x170; + ctl = 0x376; + irq = 15; + } - ide_std_init_ports(&hw[1], 0x170, 0x376); - hw[1].irq = 15; + ide_std_init_ports(hw, base, ctl); + hw->irq = irq; hwif = ide_find_port_slot(d); if (hwif) { - u8 j = (d->host_flags & IDE_HFLAG_QD_2ND_PORT) ? 1 : 0; - - ide_init_port_hw(hwif, &hw[j]); + ide_init_port_hw(hwif, hw); if (config) hwif->config_data = config; - idx[j] = hwif->index; + idx[port_no] = hwif->index; } +} - if (hwif == NULL && (d->host_flags & IDE_HFLAG_SINGLE)) - return -ENOENT; +int ide_legacy_device_add(const struct ide_port_info *d, unsigned long config) +{ + u8 idx[4] = { 0xff, 0xff, 0xff, 0xff }; + hw_regs_t hw[2]; - mate = ide_find_port_slot(d); - if (mate) { - ide_init_port_hw(mate, &hw[1]); - if (config) - mate->config_data = config; - idx[1] = mate->index; - } + memset(&hw, 0, sizeof(hw)); + + if ((d->host_flags & IDE_HFLAG_QD_2ND_PORT) == 0) + ide_legacy_init_one(idx, &hw[0], 0, d, config); + ide_legacy_init_one(idx, &hw[1], 1, d, config); + + if (idx[0] == 0xff && idx[1] == 0xff && + (d->host_flags & IDE_HFLAG_SINGLE)) + return -ENOENT; ide_device_add(idx, d);