rz1000.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. /*
  2. * Copyright (C) 1995-1998 Linus Torvalds & author (see below)
  3. */
  4. /*
  5. * Principal Author: mlord@pobox.com (Mark Lord)
  6. *
  7. * See linux/MAINTAINERS for address of current maintainer.
  8. *
  9. * This file provides support for disabling the buggy read-ahead
  10. * mode of the RZ1000 IDE chipset, commonly used on Intel motherboards.
  11. *
  12. * Dunno if this fixes both ports, or only the primary port (?).
  13. */
  14. #include <linux/types.h>
  15. #include <linux/module.h>
  16. #include <linux/kernel.h>
  17. #include <linux/hdreg.h>
  18. #include <linux/pci.h>
  19. #include <linux/ide.h>
  20. #include <linux/init.h>
  21. #define DRV_NAME "rz1000"
  22. static void __devinit init_hwif_rz1000 (ide_hwif_t *hwif)
  23. {
  24. struct pci_dev *dev = to_pci_dev(hwif->dev);
  25. u16 reg;
  26. if (!pci_read_config_word (dev, 0x40, &reg) &&
  27. !pci_write_config_word(dev, 0x40, reg & 0xdfff)) {
  28. printk(KERN_INFO "%s: disabled chipset read-ahead "
  29. "(buggy RZ1000/RZ1001)\n", hwif->name);
  30. } else {
  31. if (hwif->mate)
  32. hwif->mate->serialized = hwif->serialized = 1;
  33. hwif->host_flags |= IDE_HFLAG_NO_UNMASK_IRQS;
  34. printk(KERN_INFO "%s: serialized, disabled unmasking "
  35. "(buggy RZ1000/RZ1001)\n", hwif->name);
  36. }
  37. }
  38. static const struct ide_port_info rz1000_chipset __devinitdata = {
  39. .name = DRV_NAME,
  40. .init_hwif = init_hwif_rz1000,
  41. .chipset = ide_rz1000,
  42. .host_flags = IDE_HFLAG_NO_DMA,
  43. };
  44. static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
  45. {
  46. return ide_pci_init_one(dev, &rz1000_chipset, NULL);
  47. }
  48. static const struct pci_device_id rz1000_pci_tbl[] = {
  49. { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), 0 },
  50. { PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001), 0 },
  51. { 0, },
  52. };
  53. MODULE_DEVICE_TABLE(pci, rz1000_pci_tbl);
  54. static struct pci_driver driver = {
  55. .name = "RZ1000_IDE",
  56. .id_table = rz1000_pci_tbl,
  57. .probe = rz1000_init_one,
  58. .remove = ide_pci_remove,
  59. };
  60. static int __init rz1000_ide_init(void)
  61. {
  62. return ide_pci_register_driver(&driver);
  63. }
  64. static void __exit rz1000_ide_exit(void)
  65. {
  66. pci_unregister_driver(&driver);
  67. }
  68. module_init(rz1000_ide_init);
  69. module_exit(rz1000_ide_exit);
  70. MODULE_AUTHOR("Andre Hedrick");
  71. MODULE_DESCRIPTION("PCI driver module for RZ1000 IDE");
  72. MODULE_LICENSE("GPL");