16 #include <linux/kernel.h>
17 #include <linux/module.h>
18 #include <linux/pci.h>
22 #include <linux/device.h>
27 #define DRV_NAME "pata_oldpiix"
28 #define DRV_VERSION "0.5.5"
38 static int oldpiix_pre_reset(
struct ata_link *
link,
unsigned long deadline)
42 static const struct pci_bits oldpiix_enable_bits[] = {
43 { 0x41
U, 1
U, 0x80
UL, 0x80UL },
44 { 0x43
U, 1
U, 0x80
UL, 0x80UL },
47 if (!pci_test_config_bits(pdev, &oldpiix_enable_bits[ap->
port_no]))
68 unsigned int idetm_port= ap->
port_no ? 0x42 : 0x40;
94 pci_read_config_word(dev, idetm_port, &idetm_data);
100 if (adev->
devno == 0) {
101 idetm_data &= 0xCCE0;
104 idetm_data &= 0xCC0E;
105 idetm_data |= (control << 4);
107 idetm_data |= (timings[
pio][0] << 12) |
108 (timings[pio][1] << 8);
109 pci_write_config_word(dev, idetm_port, idetm_data);
129 u8 idetm_port = ap->
port_no ? 0x42 : 0x40;
133 u8 timings[][2] = { { 0, 0 },
147 const unsigned int needed_pio[3] = {
152 pci_read_config_word(dev, idetm_port, &idetm_data);
162 if (adev->
pio_mode < needed_pio[mwdma])
168 if (adev->
devno == 0) {
169 idetm_data &= 0xCCE0;
172 idetm_data &= 0xCC0E;
173 idetm_data |= (control << 4);
175 idetm_data |= (timings[
pio][0] << 12) | (timings[pio][1] << 8);
176 pci_write_config_word(dev, idetm_port, idetm_data);
199 oldpiix_set_piomode(ap, adev);
200 if (ata_dma_enabled(adev))
201 oldpiix_set_dmamode(ap, adev);
203 return ata_bmdma_qc_issue(qc);
212 .inherits = &ata_bmdma_port_ops,
213 .qc_issue = oldpiix_qc_issue,
215 .set_piomode = oldpiix_set_piomode,
216 .set_dmamode = oldpiix_set_dmamode,
217 .prereset = oldpiix_pre_reset,
242 .port_ops = &oldpiix_pata_ops,
248 return ata_pci_bmdma_init_one(pdev, ppi, &oldpiix_sht,
NULL, 0);
257 static struct pci_driver oldpiix_pci_driver = {
259 .id_table = oldpiix_pci_tbl,
260 .probe = oldpiix_init_one,
261 .remove = ata_pci_remove_one,
263 .suspend = ata_pci_device_suspend,
264 .resume = ata_pci_device_resume,