ide-4drives.c 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #include <linux/kernel.h>
  2. #include <linux/init.h>
  3. #include <linux/module.h>
  4. #include <linux/ide.h>
  5. int probe_4drives;
  6. module_param_named(probe, probe_4drives, bool, 0);
  7. MODULE_PARM_DESC(probe, "probe for generic IDE chipset with 4 drives/port");
  8. static int __init ide_4drives_init(void)
  9. {
  10. ide_hwif_t *hwif, *mate;
  11. u8 idx[4] = { 0xff, 0xff, 0xff, 0xff };
  12. hw_regs_t hw;
  13. if (probe_4drives == 0)
  14. return -ENODEV;
  15. memset(&hw, 0, sizeof(hw));
  16. ide_std_init_ports(&hw, 0x1f0, 0x3f6);
  17. hw.irq = 14;
  18. hw.chipset = ide_4drives;
  19. hwif = ide_find_port();
  20. if (hwif) {
  21. ide_init_port_hw(hwif, &hw);
  22. idx[0] = hwif->index;
  23. }
  24. mate = ide_find_port();
  25. if (mate) {
  26. ide_init_port_hw(mate, &hw);
  27. mate->drives[0].select.all ^= 0x20;
  28. mate->drives[1].select.all ^= 0x20;
  29. idx[1] = mate->index;
  30. if (hwif) {
  31. hwif->mate = mate;
  32. mate->mate = hwif;
  33. hwif->serialized = mate->serialized = 1;
  34. }
  35. }
  36. ide_device_add(idx, NULL);
  37. return 0;
  38. }
  39. module_init(ide_4drives_init);
  40. MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
  41. MODULE_DESCRIPTION("generic IDE chipset with 4 drives/port support");
  42. MODULE_LICENSE("GPL");