3 dmx3191d.c - midlevel driver for the Domex DMX3191D SCSI card.
4 Copyright (C) 2000 by Massimo Piccioni <dafastidio@libero.it>
6 Based on the generic NCR5380 driver by Drew Eckhardt et al.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include <asm/system.h>
25 #include <linux/blkdev.h>
26 #include <linux/init.h>
27 #include <linux/ioport.h>
28 #include <linux/module.h>
29 #include <linux/pci.h>
30 #include <linux/sched.h>
31 #include <linux/signal.h>
32 #include <linux/stat.h>
33 #include <linux/interrupt.h>
34 #include <linux/delay.h>
41 /* play with these values to tune up your system performances */
42 /* default setting from g_NCR5380.c */
46 #define USLEEP_SLEEP 20
47 #define USLEEP_WAITLONG 500
55 static int __init dmx3191d_detect(Scsi_Host_Template *tmpl) {
57 struct Scsi_Host *instance = NULL;
58 struct pci_dev *pdev = NULL;
60 tmpl->proc_name = DMX3191D_DRIVER_NAME;
62 while ((pdev = pci_find_device(PCI_VENDOR_ID_DOMEX,
63 PCI_DEVICE_ID_DOMEX_DMX3191D, pdev))) {
66 if (pci_enable_device(pdev))
69 port = pci_resource_start (pdev, 0);
71 if (!request_region(port, DMX3191D_REGION, DMX3191D_DRIVER_NAME)) {
72 printk(KERN_ERR "dmx3191: region 0x%lx-0x%lx already reserved\n",
73 port, port + DMX3191D_REGION);
77 instance = scsi_register(tmpl, sizeof(struct NCR5380_hostdata));
80 release_region(port, DMX3191D_REGION);
83 scsi_set_device(instance, &pdev->dev);
84 instance->io_port = port;
85 instance->irq = pdev->irq;
86 NCR5380_init(instance, FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E);
88 if (request_irq(pdev->irq, dmx3191d_intr, SA_SHIRQ,
89 DMX3191D_DRIVER_NAME, instance)) {
90 printk(KERN_WARNING "dmx3191: IRQ %d not available - switching to polled mode.\n", pdev->irq);
91 /* Steam powered scsi controllers run without an IRQ
93 instance->irq = SCSI_IRQ_NONE;
101 static const char * dmx3191d_info(struct Scsi_Host *host) {
102 static const char *info ="Domex DMX3191D";
107 static int dmx3191d_release_resources(struct Scsi_Host *instance)
109 release_region(instance->io_port, DMX3191D_REGION);
110 if(instance->irq!=SCSI_IRQ_NONE)
111 free_irq(instance->irq, instance);
116 MODULE_LICENSE("GPL");
118 static Scsi_Host_Template driver_template = {
119 .proc_info = dmx3191d_proc_info,
120 .name = "Domex DMX3191D",
121 .detect = dmx3191d_detect,
122 .release = dmx3191d_release_resources,
123 .info = dmx3191d_info,
124 .queuecommand = dmx3191d_queue_command,
125 .eh_abort_handler = dmx3191d_abort,
126 .eh_bus_reset_handler = dmx3191d_bus_reset,
127 .eh_device_reset_handler = dmx3191d_device_reset,
128 .eh_host_reset_handler = dmx3191d_host_reset,
131 .sg_tablesize = SG_ALL,
133 .use_clustering = DISABLE_CLUSTERING,
135 #include "scsi_module.c"