Blame view

drivers/ide/rz1000.c 2.29 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
  /*
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
2
3
4
5
6
7
8
9
10
11
12
13
14
   *  Copyright (C) 1995-1998  Linus Torvalds & author (see below)
   */
  
  /*
   *  Principal Author:  mlord@pobox.com (Mark Lord)
   *
   *  See linux/MAINTAINERS for address of current maintainer.
   *
   *  This file provides support for disabling the buggy read-ahead
   *  mode of the RZ1000 IDE chipset, commonly used on Intel motherboards.
   *
   *  Dunno if this fixes both ports, or only the primary port (?).
   */
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
15
16
17
  #include <linux/types.h>
  #include <linux/module.h>
  #include <linux/kernel.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
18
19
20
  #include <linux/pci.h>
  #include <linux/ide.h>
  #include <linux/init.h>
ced3ec8aa   Bartlomiej Zolnierkiewicz   ide: prefix messa...
21
  #define DRV_NAME "rz1000"
7f1ac8c4b   Bartlomiej Zolnierkiewicz   rz1000: apply chi...
22
  static int __devinit rz1000_disable_readahead(struct pci_dev *dev)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
23
24
  {
  	u16 reg;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
25

1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
26
27
28
  	if (!pci_read_config_word (dev, 0x40, &reg) &&
  	    !pci_write_config_word(dev, 0x40, reg & 0xdfff)) {
  		printk(KERN_INFO "%s: disabled chipset read-ahead "
7f1ac8c4b   Bartlomiej Zolnierkiewicz   rz1000: apply chi...
29
30
31
  			"(buggy RZ1000/RZ1001)
  ", pci_name(dev));
  		return 0;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
32
  	} else {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
33
  		printk(KERN_INFO "%s: serialized, disabled unmasking "
7f1ac8c4b   Bartlomiej Zolnierkiewicz   rz1000: apply chi...
34
35
36
  			"(buggy RZ1000/RZ1001)
  ", pci_name(dev));
  		return 1;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
37
38
  	}
  }
856204360   Bartlomiej Zolnierkiewicz   ide: constify str...
39
  static const struct ide_port_info rz1000_chipset __devinitdata = {
ced3ec8aa   Bartlomiej Zolnierkiewicz   ide: prefix messa...
40
  	.name		= DRV_NAME,
5e71d9c5a   Bartlomiej Zolnierkiewicz   ide: IDE_HFLAG_BO...
41
  	.host_flags	= IDE_HFLAG_NO_DMA,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
42
43
44
45
  };
  
  static int __devinit rz1000_init_one(struct pci_dev *dev, const struct pci_device_id *id)
  {
7f1ac8c4b   Bartlomiej Zolnierkiewicz   rz1000: apply chi...
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
  	struct ide_port_info d = rz1000_chipset;
  	int rc;
  
  	rc = pci_enable_device(dev);
  	if (rc)
  		return rc;
  
  	if (rz1000_disable_readahead(dev)) {
  		d.host_flags |= IDE_HFLAG_SERIALIZE;
  		d.host_flags |= IDE_HFLAG_NO_UNMASK_IRQS;
  	}
  
  	return ide_pci_init_one(dev, &d, NULL);
  }
  
  static void rz1000_remove(struct pci_dev *dev)
  {
  	ide_pci_remove(dev);
  	pci_disable_device(dev);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
65
  }
9cbcc5e3c   Bartlomiej Zolnierkiewicz   ide: use PCI_VDEV...
66
67
68
  static const struct pci_device_id rz1000_pci_tbl[] = {
  	{ PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1000), 0 },
  	{ PCI_VDEVICE(PCTECH, PCI_DEVICE_ID_PCTECH_RZ1001), 0 },
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
69
70
71
  	{ 0, },
  };
  MODULE_DEVICE_TABLE(pci, rz1000_pci_tbl);
a9ab09e26   Bartlomiej Zolnierkiewicz   ide: use unique n...
72
  static struct pci_driver rz1000_pci_driver = {
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
73
74
75
  	.name		= "RZ1000_IDE",
  	.id_table	= rz1000_pci_tbl,
  	.probe		= rz1000_init_one,
7f1ac8c4b   Bartlomiej Zolnierkiewicz   rz1000: apply chi...
76
  	.remove		= rz1000_remove,
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
77
  };
82ab1eece   Bartlomiej Zolnierkiewicz   ide: add missing ...
78
  static int __init rz1000_ide_init(void)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
79
  {
a9ab09e26   Bartlomiej Zolnierkiewicz   ide: use unique n...
80
  	return ide_pci_register_driver(&rz1000_pci_driver);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
81
  }
0fd188047   Bartlomiej Zolnierkiewicz   rz1000: add ->rem...
82
83
  static void __exit rz1000_ide_exit(void)
  {
a9ab09e26   Bartlomiej Zolnierkiewicz   ide: use unique n...
84
  	pci_unregister_driver(&rz1000_pci_driver);
0fd188047   Bartlomiej Zolnierkiewicz   rz1000: add ->rem...
85
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
86
  module_init(rz1000_ide_init);
0fd188047   Bartlomiej Zolnierkiewicz   rz1000: add ->rem...
87
  module_exit(rz1000_ide_exit);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
88
89
90
91
  
  MODULE_AUTHOR("Andre Hedrick");
  MODULE_DESCRIPTION("PCI driver module for RZ1000 IDE");
  MODULE_LICENSE("GPL");