X-Git-Url: http://pilppa.org/gitweb/?a=blobdiff_plain;f=drivers%2Fide%2Fide-generic.c;h=12de09aaef09a8ad9f008c419dc3e14500b09de6;hb=1664949843e8c0782c8f2e40897285a8dfffdf27;hp=25fda0a3263fea4603d67121f4b0df29b2195a54;hpb=eddeb0e2d863e3941d8768e70cb50c6120e61fa0;p=linux-2.6-omap-h63xx.git diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c index 25fda0a3263..12de09aaef0 100644 --- a/drivers/ide/ide-generic.c +++ b/drivers/ide/ide-generic.c @@ -33,7 +33,7 @@ static ssize_t store_add(struct class *cls, const char *buf, size_t n) if (sscanf(buf, "%x:%x:%d", &base, &ctl, &irq) != 3) return -EINVAL; - hwif = ide_find_port(base); + hwif = ide_find_port(); if (hwif == NULL) return -ENOENT; @@ -90,19 +90,46 @@ static int __init ide_generic_init(void) int i; for (i = 0; i < MAX_HWIFS; i++) { - ide_hwif_t *hwif = &ide_hwifs[i]; + ide_hwif_t *hwif; unsigned long io_addr = ide_default_io_base(i); hw_regs_t hw; - if (hwif->chipset == ide_unknown && io_addr) { + idx[i] = 0xff; + + if (io_addr) { + if (!request_region(io_addr, 8, DRV_NAME)) { + printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX " + "not free.\n", + DRV_NAME, io_addr, io_addr + 7); + continue; + } + + if (!request_region(io_addr + 0x206, 1, DRV_NAME)) { + printk(KERN_ERR "%s: I/O resource 0x%lX " + "not free.\n", + DRV_NAME, io_addr + 0x206); + release_region(io_addr, 8); + continue; + } + + /* + * Skip probing if the corresponding + * slot is already occupied. + */ + hwif = ide_find_port(); + if (hwif == NULL || hwif->index != i) { + idx[i] = 0xff; + continue; + } + memset(&hw, 0, sizeof(hw)); ide_std_init_ports(&hw, io_addr, io_addr + 0x206); hw.irq = ide_default_irq(io_addr); ide_init_port_hw(hwif, &hw); + hwif->mmio = 1; idx[i] = i; - } else - idx[i] = 0xff; + } } ide_device_add_all(idx, NULL);