X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fide%2Fide-generic.c;h=2d92214096ab9fca7b1e5f85865757366a57a97d;hb=464b3286b4aa459059c6fda85ba55185fd21d9fc;hp=25fda0a3263fea4603d67121f4b0df29b2195a54;hpb=334d094504c2fe1c44211ecb49146ae6bca8c321;p=linux-2.6 diff --git a/drivers/ide/ide-generic.c b/drivers/ide/ide-generic.c index 25fda0a326..2d92214096 100644 --- a/drivers/ide/ide-generic.c +++ b/drivers/ide/ide-generic.c @@ -22,6 +22,10 @@ #define DRV_NAME "ide_generic" +static int probe_mask = 0x03; +module_param(probe_mask, int, 0); +MODULE_PARM_DESC(probe_mask, "probe mask for legacy ISA IDE ports"); + static ssize_t store_add(struct class *cls, const char *buf, size_t n) { ide_hwif_t *hwif; @@ -33,7 +37,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; @@ -89,20 +93,50 @@ static int __init ide_generic_init(void) u8 idx[MAX_HWIFS]; int i; + printk(KERN_INFO DRV_NAME ": please use \"probe_mask=0x3f\" module " + "parameter for probing all legacy ISA IDE ports\n"); + 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 ((probe_mask & (1 << i)) && 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); + hw.chipset = ide_generic; ide_init_port_hw(hwif, &hw); idx[i] = i; - } else - idx[i] = 0xff; + } } ide_device_add_all(idx, NULL);