Alan Cox wrote:
> In which case that is all just fine - it just needs to use the instance as
> the dev_id. (Otherwise two people register irq 9 and neither uses a dev_id,
> which one does free_irq() remove)
ok, this is the new patch
just another question: let say the request_irq() fails for some reason ... should
we call scsi_unregister()?
Massimo
diff -Nru linux/Documentation/Configure.help linux.new/Documentation/Configure.help
--- linux/Documentation/Configure.help Fri Mar 10 19:55:44 2000
+++ linux.new/Documentation/Configure.help Tue Mar 21 15:52:05 2000
@@ -4794,6 +4794,15 @@
substantial, so users of MultiMaster Host Adapters may wish to omit
it.
+DMX3191D SCSI support
+CONFIG_SCSI_DMX3191D
+ This is support for Domex DMX3191D SCSI Host Adapters.
+
+ This driver is also available as a module ( = code which can be
+ inserted in and removed from the running kernel whenever you want).
+ The module will be called dmx3191d.o. If you want to compile it as a
+ module, say M here and read Documentation/modules.txt.
+
DTC3180/3280 SCSI support
CONFIG_SCSI_DTC3280
This is support for DTC 3180/3280 SCSI Host Adapters. Please read
diff -Nru linux/drivers/scsi/Config.in linux.new/drivers/scsi/Config.in
--- linux/drivers/scsi/Config.in Wed Mar 8 20:40:25 2000
+++ linux.new/drivers/scsi/Config.in Tue Mar 21 15:49:53 2000
@@ -69,6 +69,9 @@
if [ "$CONFIG_SCSI_BUSLOGIC" != "n" ]; then
bool ' Omit FlashPoint support' CONFIG_SCSI_OMIT_FLASHPOINT
fi
+if [ "$CONFIG_PCI" = "y" ]; then
+ dep_tristate 'DMX3191D SCSI support' CONFIG_SCSI_DMX3191D $CONFIG_SCSI
+fi
dep_tristate 'DTC3180/3280 SCSI support' CONFIG_SCSI_DTC3280 $CONFIG_SCSI
dep_tristate 'EATA ISA/EISA/PCI (DPT and generic EATA/DMA-compliant boards) support'
CONFIG_SCSI_EATA $CONFIG_SCSI
if [ "$CONFIG_SCSI_EATA" != "n" ]; then
diff -Nru linux/drivers/scsi/Makefile linux.new/drivers/scsi/Makefile
--- linux/drivers/scsi/Makefile Fri Feb 25 07:51:47 2000
+++ linux.new/drivers/scsi/Makefile Tue Mar 21 15:49:13 2000
@@ -613,6 +613,14 @@
endif
endif
+ifeq ($(CONFIG_SCSI_DMX3191D),y)
+L_OBJS += dmx3191d.o
+else
+ ifeq ($(CONFIG_SCSI_DMX3191D),m)
+ M_OBJS += dmx3191d.o
+ endif
+endif
+
ifeq ($(CONFIG_SCSI_DTC3280),y)
L_OBJS += dtc.o
else
diff -Nru linux/drivers/scsi/dmx3191d.c linux.new/drivers/scsi/dmx3191d.c
--- linux/drivers/scsi/dmx3191d.c Thu Jan 1 01:00:00 1970
+++ linux.new/drivers/scsi/dmx3191d.c Tue Mar 21 15:48:19 2000
@@ -0,0 +1,122 @@
+
+/*
+ dmx3191d.c - midlevel driver for the Domex DMX3191D SCSI card.
+ Copyright (C) 2000 by Massimo Piccioni <[EMAIL PROTECTED]>
+
+ Based on the generic NCR5380 driver by Drew Eckhardt et al.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <asm/io.h>
+#include <asm/system.h>
+#include <linux/blk.h>
+#include <linux/init.h>
+#include <linux/ioport.h>
+#include <linux/module.h>
+#include <linux/pci.h>
+#include <linux/sched.h>
+#include <linux/signal.h>
+#include <linux/stat.h>
+#include <linux/version.h>
+
+#include "scsi.h"
+#include "hosts.h"
+#include "constants.h"
+#include "sd.h"
+
+#include "dmx3191d.h"
+
+/* play with these values to tune up your system performances */
+/* default setting from g_NCR5380.c */
+/*
+#define USLEEP
+#define USLEEP_POLL 1
+#define USLEEP_SLEEP 20
+#define USLEEP_WAITLONG 500
+*/
+
+#define AUTOSENSE
+#include "NCR5380.h"
+#include "NCR5380.c"
+
+
+int __init dmx3191d_detect(Scsi_Host_Template *tmpl) {
+ int boards = 0;
+ struct Scsi_Host *instance = NULL;
+ struct pci_dev *pdev = NULL;
+
+ if (!pci_present()) {
+ dmx3191d_printk("PCI support not enabled\n");
+ return 0;
+ }
+
+ tmpl->proc_name = DMX3191D_DRIVER_NAME;
+
+ while ((pdev = pci_find_device(PCI_VENDOR_ID_DOMEX,
+ PCI_DEVICE_ID_DOMEX_DMX3191D, pdev))) {
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13)
+ unsigned long port = pdev->base_address[0] & PCI_IOADDRESS_MASK;
+#else
+ unsigned long port = pdev->resource[0].start;
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,3,13) */
+
+ if (check_region(port, DMX3191D_REGION)) {
+ dmx3191d_printk("region 0x%lx-0x%lx already reserved\n",
+ port, port + DMX3191D_REGION);
+ continue;
+ }
+
+ request_region(port, DMX3191D_REGION, DMX3191D_DRIVER_NAME);
+
+ instance = scsi_register(tmpl, sizeof(struct NCR5380_hostdata));
+ instance->io_port = port;
+ instance->irq = pdev->irq;
+ NCR5380_init(instance, FLAG_NO_PSEUDO_DMA | FLAG_DTC3181E);
+
+ if (request_irq(pdev->irq, dmx3191d_do_intr, SA_SHIRQ,
+ DMX3191D_DRIVER_NAME, instance)) {
+ dmx3191d_printk("irq %d not available\n", pdev->irq);
+ continue;
+ }
+
+ boards++;
+ }
+ return boards;
+}
+
+const char * dmx3191d_info(struct Scsi_Host *host) {
+ static const char *info ="Domex DMX3191D";
+
+ return info;
+}
+
+int dmx3191d_release_resources(struct Scsi_Host *instance)
+{
+ release_region(instance->io_port, DMX3191D_REGION);
+ free_irq(instance->irq, instance);
+
+ return 0;
+}
+
+
+#ifdef MODULE
+Scsi_Host_Template driver_template = DMX3191D;
+
+#include "scsi_module.c"
+
+#endif /* MODULE */
+
diff -Nru linux/drivers/scsi/dmx3191d.h linux.new/drivers/scsi/dmx3191d.h
--- linux/drivers/scsi/dmx3191d.h Thu Jan 1 01:00:00 1970
+++ linux.new/drivers/scsi/dmx3191d.h Tue Mar 21 15:48:19 2000
@@ -0,0 +1,74 @@
+
+/*
+ dmx3191d.h - defines for the Domex DMX3191D SCSI card.
+ Copyright (C) 2000 by Massimo Piccioni <[EMAIL PROTECTED]>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+*/
+
+#ifndef __DMX3191D_H
+#define __DMX3191D_H
+
+#define DMX3191D_DRIVER_NAME "dmx3191d"
+#define DMX3191D_REGION 8
+
+#ifndef PCI_VENDOR_ID_DOMEX
+#define PCI_VENDOR_ID_DOMEX 0x134a
+#define PCI_DEVICE_ID_DOMEX_DMX3191D 0x0001
+#endif
+
+#define dmx3191d_printk( args... ) printk(__FILE__": " ##args)
+
+#ifndef ASM
+int dmx3191d_abort(Scsi_Cmnd *);
+int dmx3191d_detect(Scsi_Host_Template *);
+const char* dmx3191d_info(struct Scsi_Host *);
+int dmx3191d_proc_info(char *, char **, off_t, int, int, int);
+int dmx3191d_queue_command(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
+int dmx3191d_release_resources(struct Scsi_Host *);
+int dmx3191d_reset(Scsi_Cmnd *, unsigned int);
+
+
+#if defined(HOSTS_C) || defined(MODULE)
+#define DMX3191D { \
+ proc_info: dmx3191d_proc_info, \
+ name: "Domex DMX3191D", \
+ detect: dmx3191d_detect, \
+ release: dmx3191d_release_resources, \
+ info: dmx3191d_info, \
+ queuecommand: dmx3191d_queue_command, \
+ abort: dmx3191d_abort, \
+ reset: dmx3191d_reset, \
+ bios_param: NULL, \
+ can_queue: 32, \
+ this_id: 7, \
+ sg_tablesize: SG_ALL, \
+ cmd_per_lun: 2, \
+ use_clustering: DISABLE_CLUSTERING \
+}
+#endif /* HOSTS_C || MODULE */
+
+
+#ifndef HOSTS_C
+#define NCR5380_read(reg) inb(port + reg)
+#define NCR5380_write(reg, value) outb(value, port + reg)
+
+#define NCR5380_implementation_fields unsigned int port
+#define NCR5380_local_declare() NCR5380_implementation_fields
+#define NCR5380_setup(instance) port = instance->io_port
+
+#define NCR5380_abort dmx3191d_abort
+#define do_NCR5380_intr dmx3191d_do_intr
+#define NCR5380_intr dmx3191d_intr
+#define NCR5380_proc_info dmx3191d_proc_info
+#define NCR5380_queue_command dmx3191d_queue_command
+#define NCR5380_reset dmx3191d_reset
+
+#endif /* HOSTS_C */
+#endif /* ASM */
+
+#endif /* __DMX3191D_H */
+
diff -Nru linux/drivers/scsi/hosts.c linux.new/drivers/scsi/hosts.c
--- linux/drivers/scsi/hosts.c Fri Feb 25 07:51:47 2000
+++ linux.new/drivers/scsi/hosts.c Tue Mar 21 15:50:49 2000
@@ -205,6 +205,10 @@
#include "t128.h"
#endif
+#ifdef CONFIG_SCSI_DMX3191D
+#include "dmx3191d.h"
+#endif
+
#ifdef CONFIG_SCSI_DTC3280
#include "dtc.h"
#endif
@@ -549,6 +553,9 @@
#endif
#ifdef CONFIG_SCSI_T128
TRANTOR_T128,
+#endif
+#ifdef CONFIG_SCSI_DMX3191D
+ DMX3191D,
#endif
#ifdef CONFIG_SCSI_DTC3280
DTC3x80,