2 * linux/drivers/ide/pci/pdcadma.c Version 0.05 Sept 10, 2002
4 * Copyright (C) 1999-2000 Andre Hedrick <andre@linux-ide.org>
5 * May be copied or modified under the terms of the GNU General Public License
9 #include <linux/config.h>
10 #include <linux/types.h>
11 #include <linux/kernel.h>
12 #include <linux/delay.h>
13 #include <linux/timer.h>
15 #include <linux/ioport.h>
16 #include <linux/blkdev.h>
17 #include <linux/hdreg.h>
19 #include <linux/interrupt.h>
20 #include <linux/init.h>
21 #include <linux/pci.h>
22 #include <linux/ide.h>
27 #include "ide_modes.h"
30 #if defined(DISPLAY_PDCADMA_TIMINGS) && defined(CONFIG_PROC_FS)
31 #include <linux/stat.h>
32 #include <linux/proc_fs.h>
34 static u8 pdcadma_proc = 0;
35 #define PDC_MAX_DEVS 5
36 static struct pci_dev *pdc_devs[PDC_MAX_DEVS];
37 static int n_pdc_devs;
39 static int pdcadma_get_info (char *buffer, char **addr, off_t offset, int count)
44 for (i = 0; i < n_pdc_devs; i++) {
45 struct pci_dev *dev = pdc_devs[i];
46 unsigned long bibma = pci_resource_start(dev, 4);
49 "PDC ADMA %04X Chipset.\n", dev->device);
50 p += sprintf(p, "UDMA\n");
51 p += sprintf(p, "PIO\n");
54 return p-buffer; /* => must be less than 4k! */
56 #endif /* defined(DISPLAY_PDCADMA_TIMINGS) && defined(CONFIG_PROC_FS) */
59 * pdcadma_dma functions() initiates/aborts (U)DMA read/write
60 * operations on a drive.
63 int (*ide_dma_read)(ide_drive_t *drive);
64 int (*ide_dma_write)(ide_drive_t *drive);
65 int (*ide_dma_begin)(ide_drive_t *drive);
66 int (*ide_dma_end)(ide_drive_t *drive);
67 int (*ide_dma_check)(ide_drive_t *drive);
68 int (*ide_dma_on)(ide_drive_t *drive);
69 int (*ide_dma_off)(ide_drive_t *drive);
70 int (*ide_dma_off_quietly)(ide_drive_t *drive);
71 int (*ide_dma_test_irq)(ide_drive_t *drive);
72 int (*ide_dma_host_on)(ide_drive_t *drive);
73 int (*ide_dma_host_off)(ide_drive_t *drive);
74 int (*ide_dma_bad_drive)(ide_drive_t *drive);
75 int (*ide_dma_good_drive)(ide_drive_t *drive);
76 int (*ide_dma_count)(ide_drive_t *drive);
77 int (*ide_dma_verbose)(ide_drive_t *drive);
78 int (*ide_dma_retune)(ide_drive_t *drive);
79 int (*ide_dma_lostirq)(ide_drive_t *drive);
80 int (*ide_dma_timeout)(ide_drive_t *drive);
84 static unsigned int __init init_chipset_pdcadma (struct pci_dev *dev, const char *name)
86 #if defined(DISPLAY_PDCADMA_TIMINGS) && defined(CONFIG_PROC_FS)
87 pdc_devs[n_pdc_devs++] = dev;
91 ide_pci_register_host_proc(&pdcadma_procs[0]);
93 #endif /* DISPLAY_PDCADMA_TIMINGS && CONFIG_PROC_FS */
97 static void __init init_hwif_pdcadma (ide_hwif_t *hwif)
102 // hwif->tuneproc = &pdcadma_tune_drive;
103 // hwif->speedproc = &pdcadma_tune_chipset;
105 // if (hwif->dma_base) {
106 // hwif->autodma = 1;
111 // hwif->atapi_dma = 1;
112 // hwif->ultra_mask = 0x7f;
113 // hwif->mwdma_mask = 0x07;
114 // hwif->swdma_mask = 0x07;
118 static void __init init_dma_pdcadma (ide_hwif_t *hwif, unsigned long dmabase)
121 ide_setup_dma(hwif, dmabase, 8);
125 extern void ide_setup_pci_device(struct pci_dev *, ide_pci_device_t *);
127 static int __devinit pdcadma_init_one(struct pci_dev *dev, const struct pci_device_id *id)
129 ide_pci_device_t *d = &pdcadma_chipsets[id->driver_data];
130 if (dev->device != d->device)
132 ide_setup_pci_device(dev, d);
137 static struct pci_device_id pdcadma_pci_tbl[] __devinitdata = {
138 { PCI_VENDOR_ID_PDC, PCI_DEVICE_ID_PDC_1841, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
142 static struct pci_driver driver = {
143 .name = "PDCADMA-IDE",
144 .id_table = pdcadma_pci_tbl,
145 .probe = pdcadma_init_one,
148 static int pdcadma_ide_init(void)
150 return ide_pci_register_driver(&driver);
153 static void pdcadma_ide_exit(void)
155 ide_pci_unregister_driver(&driver);
158 module_init(pdcadma_ide_init);
159 module_exit(pdcadma_ide_exit);
161 MODULE_AUTHOR("Andre Hedrick");
162 MODULE_DESCRIPTION("PCI driver module for PDCADMA IDE");
163 MODULE_LICENSE("GPL");