patch-2.4.2 linux/drivers/acorn/scsi/cumana_2.c

Next file: linux/drivers/acorn/scsi/cumana_2.h
Previous file: linux/drivers/acorn/scsi/cumana_1.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.1/linux/drivers/acorn/scsi/cumana_2.c linux/drivers/acorn/scsi/cumana_2.c
@@ -27,6 +27,7 @@
 #include <linux/stat.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
+#include <linux/init.h>
 
 #include <asm/dma.h>
 #include <asm/ecard.h>
@@ -36,7 +37,9 @@
 
 #include "../../scsi/sd.h"
 #include "../../scsi/hosts.h"
-#include "cumana_2.h"
+#include "fas216.h"
+
+#include <scsi/scsicam.h>
 
 /* Configuration */
 #define CUMANASCSI2_XTALFREQ		40
@@ -89,6 +92,22 @@
  */
 int term[MAX_ECARDS] = { 1, 1, 1, 1, 1, 1, 1, 1 };
 
+#define NR_SG	256
+
+typedef struct {
+	FAS216_Info info;
+
+	/* other info... */
+	unsigned int	status;		/* card status register	*/
+	unsigned int	alatch;		/* Control register	*/
+	unsigned int	terms;		/* Terminator state	*/
+	unsigned int	dmaarea;	/* Pseudo DMA area	*/
+	struct scatterlist sg[NR_SG];	/* Scatter DMA list	*/
+} CumanaScsi2_Info;
+
+#define CSTATUS_IRQ	(1 << 0)
+#define CSTATUS_DRQ	(1 << 1)
+
 /* Prototype: void cumanascsi_2_irqenable(ec, irqnr)
  * Purpose  : Enable interrupts on Cumana SCSI 2 card
  * Params   : ec    - expansion card structure
@@ -541,8 +560,42 @@
 	return pos;
 }
 
-#ifdef MODULE
-Scsi_Host_Template driver_template = CUMANASCSI_2;
+static Scsi_Host_Template cumanascsi2_template = {
+	module:				THIS_MODULE,
+	proc_info:			cumanascsi_2_proc_info,
+	name:				"Cumana SCSI II",
+	detect:				cumanascsi_2_detect,
+	release:			cumanascsi_2_release,
+	info:				cumanascsi_2_info,
+	bios_param:			scsicam_bios_param,
+	can_queue:			1,
+	this_id:			7,
+	sg_tablesize:			SG_ALL,
+	cmd_per_lun:			1,
+	use_clustering:			DISABLE_CLUSTERING,
+	command:			fas216_command,
+	queuecommand:			fas216_queue_command,
+	eh_host_reset_handler:		fas216_eh_host_reset,
+	eh_bus_reset_handler:		fas216_eh_bus_reset,
+	eh_device_reset_handler:	fas216_eh_device_reset,
+	eh_abort_handler:		fas216_eh_abort,
+	use_new_eh_code:		1
+};
 
-#include "../../scsi/scsi_module.c"
-#endif
+static int __init cumanascsi2_init(void)
+{
+	scsi_register_module(MODULE_SCSI_HA, &cumanascsi2_template);
+	if (cumanascsi2_template.present)
+		return 0;
+
+	scsi_unregister_module(MODULE_SCSI_HA, &cumanascsi2_template);
+	return -ENODEV;
+}
+
+static void __exit cumanascsi2_exit(void)
+{
+	scsi_unregister_module(MODULE_SCSI_HA, &cumanascsi2_template);
+}
+
+module_init(cumanascsi2_init);
+module_exit(cumanascsi2_exit);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)