2 #include <linux/kernel.h>
3 #include <linux/init.h>
4 #include <linux/module.h>
7 #define DRV_NAME "ide-4drives"
9 static int probe_4drives;
11 module_param_named(probe, probe_4drives, bool, 0);
12 MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port");
14 static void ide_4drives_port_init_devs(ide_hwif_t *hwif)
17 hwif->drives[0].select.all ^= 0x20;
18 hwif->drives[1].select.all ^= 0x20;
22 static const struct ide_port_ops ide_4drives_port_ops = {
23 .port_init_devs = ide_4drives_port_init_devs,
26 static const struct ide_port_info ide_4drives_port_info = {
27 .port_ops = &ide_4drives_port_ops,
28 .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA,
31 static int __init ide_4drives_init(void)
33 ide_hwif_t *hwif, *mate;
34 unsigned long base = 0x1f0, ctl = 0x3f6;
35 u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
38 if (probe_4drives == 0)
41 if (!request_region(base, 8, DRV_NAME)) {
42 printk(KERN_ERR "%s: I/O resource 0x%lX-0x%lX not free.\n",
43 DRV_NAME, base, base + 7);
47 if (!request_region(ctl, 1, DRV_NAME)) {
48 printk(KERN_ERR "%s: I/O resource 0x%lX not free.\n",
50 release_region(base, 8);
54 memset(&hw, 0, sizeof(hw));
56 ide_std_init_ports(&hw, base, ctl);
58 hw.chipset = ide_4drives;
60 hwif = ide_find_port();
62 ide_init_port_hw(hwif, &hw);
66 mate = ide_find_port();
68 ide_init_port_hw(mate, &hw);
72 ide_device_add(idx, &ide_4drives_port_info);
77 module_init(ide_4drives_init);
79 MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
80 MODULE_DESCRIPTION("generic IDE chipset with 4 drives/port support");
81 MODULE_LICENSE("GPL");