Skip to contentSkip to conversation

sym53c500_cs PCMCIA SCSI driver (new)

PATCH In review Bob Tracy 4 participants 15 messages Apr 10, 2004 – Apr 25, 2004

Subsystems (2)
lore
Share & tools
lore

Bob Tracy

author
#0 lore raw

PATCH 1/1 sym53c500_cs PCMCIA SCSI driver (new)

The attached patch set implements a PCMCIA SCSI driver for host adapters based on the Symbios 53c500 chip. The original driver for this chip was written by Thomas Corner and available only as an add-on to the pcmcia-cs package. I've been maintaining the add-on driver on an infrequent basis for the past several years, and the release of the 2.6 kernel "forced" a long overdue update.

The only host adapter I'm aware of that uses the sym53c500 controller chip is the "new" version of the New Media Bus Toaster (circa 1996), and the attached driver has been tested using this particular adapter on a 2.6.4 kernel. The patch set applies cleanly to 2.6.4 and 2.6.5.

Comments / feedback / cheers / jeers accepted...

Signature · 4 lines
-----------------------------------------------------------------------
Bob Tracy                   WTO + WIPO = DMCA? http://www.anti-dmca.org
[email protected]
-----------------------------------------------------------------------
drivers/scsi/pcmcia/Kconfig renamed from drivers/scsi/pcmcia/Kconfig.orig +10 -0
@@ -69,4 +69,14 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called qlogic_cs.
 
+config PCMCIA_SYM53C500
+	tristate "Symbios 53c500 PCMCIA support"
+	depends on m
+	help
+	  Say Y here if you have a New Media Bus Toaster or other PCMCIA
+	  SCSI adapter based on the Symbios 53c500 controller.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called sym53c500_cs.
+
 endmenu
drivers/scsi/pcmcia/Makefile renamed from drivers/scsi/pcmcia/Makefile.orig +2 -0
@@ -6,7 +6,9 @@
 obj-$(CONFIG_PCMCIA_FDOMAIN)	+= fdomain_cs.o
 obj-$(CONFIG_PCMCIA_AHA152X)	+= aha152x_cs.o
 obj-$(CONFIG_PCMCIA_NINJA_SCSI)	+= nsp_cs.o
+obj-$(CONFIG_PCMCIA_SYM53C500)	+= sym53c500_cs.o
 
 aha152x_cs-objs	:= aha152x_stub.o aha152x_core.o
 fdomain_cs-objs	:= fdomain_stub.o fdomain_core.o
 qlogic_cs-objs	:= qlogic_stub.o qlogic_core.o
+sym53c500_cs-objs	:= sym53c500.o SYM53C500.o
drivers/scsi/pcmcia/SYM53C500.c renamed from drivers/scsi/pcmcia/SYM53C500.c.orig +860 -0

860 lines not on this page · raw message

drivers/scsi/pcmcia/SYM53C500.h renamed from drivers/scsi/pcmcia/SYM53C500.h.orig +69 -0

69 lines not on this page · raw message

drivers/scsi/pcmcia/sym53c500.c renamed from drivers/scsi/pcmcia/sym53c500.c.orig +377 -0

377 lines not on this page · raw message

Documentation/scsi/sym53c500_cs.txt renamed from Documentation/scsi/sym53c500_cs.txt.orig +16 -0
@@ -0,0 +1,16 @@
+The sym53c500_cs driver originated as an add-on to David Hinds' pcmcia-cs
+package, and was written by Tom Corner ([email protected]).  This rewrite
+addresses the following concerns:
+
+	(1) extensive kernel changes between 2.4 and 2.6.
+	(2) deprecated PCMCIA support outside the kernel.
+
+The Symbios Logic 53c500 chip was used in the "new" (circa 1997) version
+of the New Media Bus Toaster PCMCIA SCSI controller.  I am unaware of any
+other products using this chip.
+
+Through the years, there have been a number of downloads of the pcmcia-cs
+version of this driver, and I guess it worked for those users.  It worked
+for Tom Corner, and it works for me.  Your mileage will probably vary.
+
+--Bob Tracy ([email protected])
Documentation/scsi/00-INDEX renamed from Documentation/scsi/00-INDEX.orig +2 -0
@@ -62,6 +62,8 @@
 	- info on API between SCSI layer and low level drivers
 st.txt
 	- info on scsi tape driver
+sym53c500_cs.txt
+	- info on PCMCIA driver for Symbios Logic 53c500 based adapters
 sym53c8xx_2.txt
 	- info on second generation driver for sym53c8xx based adapters
 tmscsim.txt
#1 lore raw
Quoted 7 lines · Bob Tracy

The attached patch set implements a PCMCIA SCSI driver for host adapters based on the Symbios 53c500 chip. The original driver for this chip was written by Thomas Corner and available only as an add-on to the pcmcia-cs package. I've been maintaining the add-on driver on an infrequent basis for the past several years, and the release of the 2.6 kernel "forced" a long overdue update.

Quoted 6 lines

The only host adapter I'm aware of that uses the sym53c500 controller chip is the "new" version of the New Media Bus Toaster (circa 1996), and the attached driver has been tested using this particular adapter on a 2.6.4 kernel. The patch set applies cleanly to 2.6.4 and 2.6.5.

Comments / feedback / cheers / jeers accepted...

I've given it a short spin and here's a bunch of comments:

- the split into three source files is supserflous, one file should do it
- please don't use host.h or scsi.h from drivers/scsi/. The defintions not present in include/scsi/ are deprecated and shall not be used (the most prominent example in your driver are the Scsi_<Foo> typedefs that have been replaced by struct scsi_foo
- the driver doesn't even try to deal with multiple HBAs
- your detection logic could be streamlined a little, e.g. the request/release resource mess

author
#2 lore raw
Quoted 1 line · Christoph Hellwig

I've given it a short spin and here's a bunch of comments:

Thank you for taking the time and trouble to review it.

Quoted 1 line

- the split into three source files is supserflous, one file should do it

Given that the driver currently supports only PCMCIA implementations, I agree. My thinking was if someone comes up with a host adapter that isn't PCMCIA, the SYM53C500.c file is to the sym53c500_cs driver what the qlogicfas.c file is to the qlogic_cs driver, that is, core functions that could support multiple types of host adapters. The logic to handle the different types of adapters isn't there, and I don't know that it ever will be (else, it's probable that someone would have written the Linux driver long before now). However, after baring my ignorance to the world and saying I was unaware of non-PCMCIA implementations, I found a FreeBSD driver for the NCR 53c500. Never say "never," I guess... Your opinion counts for much, but you're the only person I've heard from. Is there a consensus I should forget about the non-PCMCIA cases?

Quoted 4 lines

- please don't use host.h or scsi.h from drivers/scsi/. The defintions not present in include/scsi/ are deprecated and shall not be used (the most prominent example in your driver are the Scsi_<Foo> typedefs that have been replaced by struct scsi_foo

I caught that in the coding style guidelines (and in the mentioned include files), and will fix for the next submission.

Quoted 1 line

- the driver doesn't even try to deal with multiple HBAs

Guilty as charged. Functionally, there's nothing in the driver I submitted that wasn't in the original. Suggestions welcome... Which of the existing PCMCIA SCSI drivers do a proper job of handling multiple host adapters in your opinion? I'll try to adapt that code to fit this driver. If I have to "roll my own" from scratch, I'm probably in over my head.

Quoted 2 lines

- your detection logic could be streamlined a little, e.g. the request/release resource mess

I'll see what I can do.

Although I touched on it above, by way of apology/explanation, the goal for the initial port was to replicate the functionality I already had in older kernel versions. It appears I faithfully replicated the deficiencies of the old driver as well :-). Again, thank you for the feedback.

Anyone else have input before I act on the recommendations I've been given? Unless I hear otherwise, I'll start work on the code consolidation and removal of dependencies on deprecated include files. The detection logic and handling multiple HBAs will take a bit more effort...

Signature · 4 lines
-----------------------------------------------------------------------
Bob Tracy                   WTO + WIPO = DMCA? http://www.anti-dmca.org
[email protected]
-----------------------------------------------------------------------
#3 lore raw
Quoted 5 lines · Bob Tracy

Given that the driver currently supports only PCMCIA implementations, I agree. My thinking was if someone comes up with a host adapter that isn't PCMCIA, the SYM53C500.c file is to the sym53c500_cs driver what the qlogicfas.c file is to the qlogic_cs driver, that is, core functions that could support multiple types of host adapters. The logic to

Quoted 8 lines

handle the different types of adapters isn't there, and I don't know that it ever will be (else, it's probable that someone would have written the Linux driver long before now). However, after baring my ignorance to the world and saying I was unaware of non-PCMCIA implementations, I found a FreeBSD driver for the NCR 53c500. Never say "never," I guess... Your opinion counts for much, but you're the only person I've heard from. Is there a consensus I should forget about the non-PCMCIA cases?

I'd suggest to keep it as simple as you can for the time beeing. If we ever find a user with a ISA or whatever variant he can split it out. And such a split would work a little different from what you did now.

Quoted 8 lines
Quoted 1 line

- the driver doesn't even try to deal with multiple HBAs

Guilty as charged. Functionally, there's nothing in the driver I submitted that wasn't in the original. Suggestions welcome... Which of the existing PCMCIA SCSI drivers do a proper job of handling multiple host adapters in your opinion? I'll try to adapt that code to fit this driver. If I have to "roll my own" from scratch, I'm probably in over my head.

It looks like nsp_cs at least tries to :-)

Quoted 10 lines
Quoted 2 lines

- your detection logic could be streamlined a little, e.g. the request/release resource mess

I'll see what I can do.

Although I touched on it above, by way of apology/explanation, the goal for the initial port was to replicate the functionality I already had in older kernel versions. It appears I faithfully replicated the deficiencies of the old driver as well :-). Again, thank you for the feedback.

Hey, you don't need to apologize. Anyt 2.6 driver is better than none and
your looks quite okay from the functional standpoint. We just need to have a little higher bars for new drivers as we already have lots of maintaince overhead for old and sloppy written drivers.

author
#4 lore raw

PATCH 1/1 sym53c500_cs PCMCIA SCSI driver (second round)

(Summary -- new version of sym53c500_cs driver attached.)

Quoted 3 lines · Christoph Hellwig

- the driver doesn't even try to deal with multiple HBAs

It looks like nsp_cs at least tries to :-)

I'm not sure that nsp_cs does much more than assign a value to the "unique_id" member of the scsi_host structure (base port), and I probably missed what I was looking for, but I can certainly do as much :-). Is there any way to test whether the driver code can support multiple HBAs short of having more than one?

Quoted 4 lines

Hey, you don't need to apologize. Anyt 2.6 driver is better than none and
your looks quite okay from the functional standpoint. We just need to have a little higher bars for new drivers as we already have lots of maintaince overhead for old and sloppy written drivers.

Thank you for the explanation: clearly I don't want to increase the maintenance burden on myself and/or anyone else.

Attached is the second attempt at a 2.6 PCMCIA driver for SCSI cards based on the Symbios 53c500 controller. The patch set was tested with (and applies cleanly to) 2.6.5. As requested, the driver source has been consolidated into a single file. All remnants of code that might have supported non-PCMCIA host adapters have been ripped out, which allowed for the requested streamlining of the detection logic: Card Services is doing most of the heavy lifting in that area anyway :-).

Signature · 4 lines
-----------------------------------------------------------------------
Bob Tracy                   WTO + WIPO = DMCA? http://www.anti-dmca.org
[email protected]
-----------------------------------------------------------------------
drivers/scsi/pcmcia/Kconfig renamed from drivers/scsi/pcmcia/Kconfig.orig +10 -0
@@ -69,4 +69,14 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called qlogic_cs.
 
+config PCMCIA_SYM53C500
+	tristate "Symbios 53c500 PCMCIA support"
+	depends on m
+	help
+	  Say Y here if you have a New Media Bus Toaster or other PCMCIA
+	  SCSI adapter based on the Symbios 53c500 controller.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called sym53c500_cs.
+
 endmenu
drivers/scsi/pcmcia/Makefile renamed from drivers/scsi/pcmcia/Makefile.orig +1 -0
@@ -6,6 +6,7 @@
 obj-$(CONFIG_PCMCIA_FDOMAIN)	+= fdomain_cs.o
 obj-$(CONFIG_PCMCIA_AHA152X)	+= aha152x_cs.o
 obj-$(CONFIG_PCMCIA_NINJA_SCSI)	+= nsp_cs.o
+obj-$(CONFIG_PCMCIA_SYM53C500)	+= sym53c500_cs.o
 
 aha152x_cs-objs	:= aha152x_stub.o aha152x_core.o
 fdomain_cs-objs	:= fdomain_stub.o fdomain_core.o
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +1150 -0

1,150 lines not on this page · raw message

Documentation/scsi/sym53c500_cs.txt renamed from Documentation/scsi/sym53c500_cs.txt.orig +17 -0
@@ -0,0 +1,17 @@
+The sym53c500_cs driver originated as an add-on to David Hinds' pcmcia-cs
+package, and was written by Tom Corner ([email protected]).  This rewrite
+addresses the following concerns:
+
+	(1) extensive kernel changes between 2.4 and 2.6.
+	(2) deprecated PCMCIA support outside the kernel.
+
+The Symbios Logic 53c500 chip was used in the "new" (circa 1997) version
+of the New Media Bus Toaster PCMCIA SCSI controller.  Presumably there are
+other products using this chip, but I've never laid eyes (much less hands)
+on one.
+
+Through the years, there have been a number of downloads of the pcmcia-cs
+version of this driver, and I guess it worked for those users.  It worked
+for Tom Corner, and it works for me.  Your mileage will probably vary.
+
+--Bob Tracy ([email protected])
Documentation/scsi/00-INDEX renamed from Documentation/scsi/00-INDEX.orig +2 -0
@@ -62,6 +62,8 @@
 	- info on API between SCSI layer and low level drivers
 st.txt
 	- info on scsi tape driver
+sym53c500_cs.txt
+	- info on PCMCIA driver for Symbios Logic 53c500 based adapters
 sym53c8xx_2.txt
 	- info on second generation driver for sym53c8xx based adapters
 tmscsim.txt
#5 lore raw

Re: [PATCH] sym53c500_cs PCMCIA SCSI driver (second round)

Quoted 5 lines · Bob Tracy

I'm not sure that nsp_cs does much more than assign a value to the "unique_id" member of the scsi_host structure (base port), and I probably missed what I was looking for, but I can certainly do as much :-). Is there any way to test whether the driver code can support multiple HBAs short of having more than one?

There's not real test. But a good indication is that you have all almost no global variables (except some debug switches) and all I/O address / state / etc in per-host instance data.

Quoted 8 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +8 -0
+#include <linux/module.h>
+#include <linux/errno.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/string.h>

drivers/scsi/pcmcia/sym53c500_cs.c line 72

Quoted 10 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +10 -0
+#include <linux/ioport.h>
+#include <linux/proc_fs.h>
+#include <linux/stat.h>
+#include <asm/io.h>
+#include <asm/dma.h>
+#include <asm/bitops.h>
+#include <asm/irq.h>
+#include <linux/major.h>
+#include <linux/blkdev.h>
+#include <linux/spinlock.h>

Please try to include all <asm/*> headers after <linux/*>. You should't need major.h and proc_fs.h at least.

Quoted 1 line

+#include <pcmcia/version.h>

A proper pcmcia driver shouldn't need this one.

drivers/scsi/pcmcia/sym53c500_cs.c line 88

Quoted 2 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +2 -0
+/* A useful macro... */
+#define MIN(a, b)	((a) > (b) ? (b) : (a))

The kernel already has min(), and it even does type-checking.

drivers/scsi/pcmcia/sym53c500_cs.c line 92

Quoted 3 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +3 -0
+#ifndef NULL
+#define NULL 0
+#endif

Shouldn't be needed.

drivers/scsi/pcmcia/sym53c500_cs.c line 102

Quoted 9 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +9 -0
+/* Function prototypes. */
+const char *SYM53C500_info(struct Scsi_Host *);
+int SYM53C500_queue(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *));
+int SYM53C500_abort(struct scsi_cmnd *);
+int SYM53C500_device_reset(struct scsi_cmnd *);
+int SYM53C500_bus_reset(struct scsi_cmnd *);
+int SYM53C500_host_reset(struct scsi_cmnd *);
+int SYM53C500_biosparm(struct scsi_device *, struct block_device *, sector_t, int *);
+int SYM53C500_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);

Everything in a scsi driver should be static. Also try to avoid prototypes for static functions whenever possible by ordering functions by their calling chain.

drivers/scsi/pcmcia/sym53c500_cs.c line 119

Quoted 3 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +3 -0
+#ifdef PCMCIA_DEBUG
+static int pc_debug = PCMCIA_DEBUG;
+MODULE_PARM(pc_debug, "i");

In 2.6 please use the type-chcking whizz-bang module_param instead of MODULE_PARAM.

Quoted 8 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +8 -0
+/*
+*  the following will set the monitor border color
+*  (useful to find where things crash or get stuck)
+*
+*  1 = blue
+*  2 = green
+*  3 = cyan
+*  4 = red

drivers/scsi/pcmcia/sym53c500_cs.c line 223

Quoted 10 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +10 -0
+*  5 = magenta
+*  6 = yellow
+*  7 = white
+*/
+
+#if SYM53C500_DEBUG
+#define rtrc(i) {inb(0x3da);outb(0x31,0x3c0);outb((i),0x3c0);}
+#else
+#define rtrc(i) {}
+#endif

Do you actually use this debug code? It's rather pc-specific..

drivers/scsi/pcmcia/sym53c500_cs.c line 232

Quoted 6 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +6 -0
+typedef struct scsi_info_t {
+	dev_link_t link;
+	dev_node_t node;
+	struct Scsi_Host *host;
+	unsigned short manf_id;
+} scsi_info_t;

Try to avoid typedefs if possible according to the Linux Kernel coding style. And yes, the pcmcia code isn't how it should be done, I know you only copied it ;-)

drivers/scsi/pcmcia/sym53c500_cs.c line 283

Quoted 7 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +7 -0
+static int port_base = 0;
+static int irq_level = -1; /* 0 is 'no irq', so use -1 for 'uninitialized'*/
+
+static int fast_pio = USE_FAST_PIO;
+
+static struct scsi_cmnd *current_SC;
+static char info_msg[256];

This is what I mean. To support more than one card these variables and some more would have to be in a per-host struct.

drivers/scsi/pcmcia/sym53c500_cs.c line 532

Quoted 1 line
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +1 -0
+	scsi_add_host(host, NULL);	/* XXX handle failure */

So handle the failure case :)

Quoted 6 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +6 -0
+	struct Scsi_Host *shost = info->host;
+
+	DEBUG(0, "SYM53C500_release(0x%p)\n", link);
+
+	/*
+	*  Interrupts getting hosed on card removal.  Try

drivers/scsi/pcmcia/sym53c500_cs.c line 572

Quoted 10 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +10 -0
+	*  the following code, mostly from qlogicfas.c.
+	*/
+	if (shost->irq)
+		free_irq(shost->irq, shost);
+	if (shost->dma_channel != 0xff)
+		free_dma(shost->dma_channel);
+	if (shost->io_port && shost->n_io_port)
+		release_region(shost->io_port, shost->n_io_port);
+
+	scsi_remove_host(shost);

You need to call scsi_remove_host as the first thing in this function.

drivers/scsi/pcmcia/sym53c500_cs.c line 635

Quoted 5 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +5 -0
+/*
+*  SYM53C500_proc_info is basically a stub function for now.  It
+*  wouldn't exist except for the fact there were /proc entries for
+*  this driver under 2.4 and earlier kernels, and the author (sole
+*  user?) expects to see them.

Well, please just kill it. ->proc_info is deprecated in 2.6.

drivers/scsi/pcmcia/sym53c500_cs.c line 860

Quoted 11 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +11 -0
+int
+SYM53C500_device_reset(struct scsi_cmnd *SCpnt)
+{
+	return FAILED;
+}
+
+int
+SYM53C500_bus_reset(struct scsi_cmnd *SCpnt)
+{
+	return FAILED;
+}

You don't need to implement these. If an EH method isn't implemented FAILED is the default return value.

drivers/scsi/pcmcia/sym53c500_cs.c line 893

Quoted 11 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +11 -0
+static irqreturn_t
+do_SYM53C500_intr(int irq, void *dev_id, struct pt_regs *regs)
+{
+	unsigned long flags;
+	struct Scsi_Host *dev = dev_id;
+
+	spin_lock_irqsave(dev->host_lock, flags);
+	SYM53C500_intr(irq, dev_id, regs);
+	spin_unlock_irqrestore(dev->host_lock, flags);
+	return IRQ_HANDLED;
+}

You should probably merged SYM53C500_intr with this one.

Quoted 5 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +5 -0
+	if (pio_status & 0x80) {
+		printk("SYM53C500: Warning: PIO error!\n");
+		current_SC->SCp.phase = idle;
+		current_SC->result = DID_ERROR << 16;
+		current_SC->scsi_done(current_SC);

drivers/scsi/pcmcia/sym53c500_cs.c line 944

Quoted 10 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +10 -0
+		return;
+	}
+
+	if (status & 0x20) {		/* Parity error */
+		printk("SYM53C500: Warning: parity error!\n");
+		current_SC->SCp.phase = idle;
+		current_SC->result = DID_PARITY << 16;
+		current_SC->scsi_done(current_SC);
+		return;
+	}

This screams for a goto error and the error handler in one place :)

drivers/scsi/pcmcia/sym53c500_cs.c line 1083

Quoted 4 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +4 -0
+	/* Control Register Set 0 */
+	TC_LSB = (port_base + 0x00);
+	TC_MSB = (port_base + 0x01);
+	SCSI_FIFO = (port_base + 0x02);

These variables are _really_ strange. In a normal Linux driver the names that are variables here (TC_LSB, etc..) would be defines to the numberical values you add to port_base and when you're actually using them you'd use shost->io_port + TC_LSB or whatever as the actual address.

drivers/scsi/pcmcia/sym53c500_cs.c line 1146

Quoted 8 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +8 -0
+static void __exit
+exit_sym53c500_cs(void)
+{
+	pcmcia_unregister_driver(&sym53c500_cs_driver);
+
+	/* XXX: this really needs to move into generic code... */
+	while (dev_list != NULL)
+		SYM53C500_detach(dev_list);

It's actually superflous for scsi drivers these days.

author
#6 lore raw

PATCH 1/1 sym53c500_cs PCMCIA SCSI driver (round 3 - the charm?)

Well, here's the latest attempt at a 2.6 driver for PCMCIA SCSI cards using the Symbios 53c500 controller. This includes (at least) "newer" versions of the New Media Bus Toaster (circa 1997). The attached patch set applies cleanly to 2.6.5.

In addition to all the concerns Christoph raised in response to the previous two submissions, there was an issue with the code for handling a CS_EVENT_CARD_RESET event: the event handler was calling the bus_reset function with a NULL scsi_cmnd argument. The potential problem was masked by the fact my bus_reset function was a trivial reimplementation of the default behavior in the absence of a bus_reset function. Folks using the qlogic_cs driver are hereby warned: if the event handler tries to process a CS_EVENT_CARD_RESET event (probably following a "resume"), qlogicfas_bus_reset() will be called with a NULL scsi_cmnd argument, and the next thing you'll see will be the "oops" resulting from a null pointer dereference. For what it's worth, someone besides me has noted this can happen: see the comment block above qlogicfas_bus_reset() in linux/drivers/scsi/qlogicfas.c.

Major differences between this version and prior ones:

(1) Support for multiple HBAs should now be in place. The only global host variable affects the PIO speed, and that's affected by a compile- time define.

(2) Although proc_info is officially obsolete in 2.6, I didn't delete the associated code: it can be enabled by defining PROC_INFO at compile time (for people like me who find it useful).

(3) Cleanup/consolidation of multiple functions, including deletion of code rendered superfluous by new 2.6 ways of doing things.

Barring any remaining issues (Christoph?), I think we're finally ready for prime time :-).

Signature · 4 lines
-----------------------------------------------------------------------
Bob Tracy                   WTO + WIPO = DMCA? http://www.anti-dmca.org
[email protected]
-----------------------------------------------------------------------
drivers/scsi/pcmcia/Kconfig renamed from drivers/scsi/pcmcia/Kconfig.orig +10 -0
@@ -69,4 +69,14 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called qlogic_cs.
 
+config PCMCIA_SYM53C500
+	tristate "Symbios 53c500 PCMCIA support"
+	depends on m
+	help
+	  Say Y here if you have a New Media Bus Toaster or other PCMCIA
+	  SCSI adapter based on the Symbios 53c500 controller.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called sym53c500_cs.
+
 endmenu
drivers/scsi/pcmcia/Makefile renamed from drivers/scsi/pcmcia/Makefile.orig +1 -0
@@ -6,6 +6,7 @@
 obj-$(CONFIG_PCMCIA_FDOMAIN)	+= fdomain_cs.o
 obj-$(CONFIG_PCMCIA_AHA152X)	+= aha152x_cs.o
 obj-$(CONFIG_PCMCIA_NINJA_SCSI)	+= nsp_cs.o
+obj-$(CONFIG_PCMCIA_SYM53C500)	+= sym53c500_cs.o
 
 aha152x_cs-objs	:= aha152x_stub.o aha152x_core.o
 fdomain_cs-objs	:= fdomain_stub.o fdomain_core.o
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +1094 -0

1,094 lines not on this page · raw message

Documentation/scsi/sym53c500_cs.txt renamed from Documentation/scsi/sym53c500_cs.txt.orig +23 -0
@@ -0,0 +1,23 @@
+The sym53c500_cs driver originated as an add-on to David Hinds' pcmcia-cs
+package, and was written by Tom Corner ([email protected]).  A rewrite was
+long overdue, and the current version addresses the following concerns:
+
+	(1) extensive kernel changes between 2.4 and 2.6.
+	(2) deprecated PCMCIA support outside the kernel.
+
+All the USE_BIOS code has been ripped out.  It was never used, and could
+not have worked anyway.  The USE_DMA code is likewise gone.  Many thanks
+to YOKOTA Hiroshi (nsp_cs driver) and David Hinds (qlogic_cs driver) for
+the code fragments I shamelessly adapted for this work.  Thanks also to
+Christoph Hellwig for his patient tutelage while I stumbled about.
+
+The Symbios Logic 53c500 chip was used in the "newer" (circa 1997) version
+of the New Media Bus Toaster PCMCIA SCSI controller.  Presumably there are
+other products using this chip, but I've never laid eyes (much less hands)
+on one.
+
+Through the years, there have been a number of downloads of the pcmcia-cs
+version of this driver, and I guess it worked for those users.  It worked
+for Tom Corner, and it works for me.  Your mileage will probably vary.
+
+--Bob Tracy ([email protected])
Documentation/scsi/00-INDEX renamed from Documentation/scsi/00-INDEX.orig +2 -0
@@ -62,6 +62,8 @@
 	- info on API between SCSI layer and low level drivers
 st.txt
 	- info on scsi tape driver
+sym53c500_cs.txt
+	- info on PCMCIA driver for Symbios Logic 53c500 based adapters
 sym53c8xx_2.txt
 	- info on second generation driver for sym53c8xx based adapters
 tmscsim.txt
#7 lore raw

Re: [PATCH] sym53c500_cs PCMCIA SCSI driver (round 3 - the charm?)

Quoted 4 lines · Bob Tracy

In addition to all the concerns Christoph raised in response to the previous two submissions, there was an issue with the code for handling a CS_EVENT_CARD_RESET event: the event handler was calling the bus_reset function with a NULL scsi_cmnd argument.

Hmm, so what happens if you're in the middle of a transaction, and you receive a CS_EVENT_CARD_RESET. What happens to the command in progress ?

Sure, the hardware is reset to a sane state, but what about the software state in the driver?

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
author
#8 lore raw

Re: [PATCH] sym53c500_cs PCMCIA SCSI driver (round 3 - the charm?)

Quoted 3 lines · Russell King

Hmm, so what happens if you're in the middle of a transaction, and you receive a CS_EVENT_CARD_RESET. What happens to the command in progress ?

Candidly, I don't know. A fair question to ask in return is, under what circumstances might a PCMCIA driver see a CS_EVENT_CARD_RESET?

None of the existing PCMCIA SCSI drivers I saw do anything other than reset the hardware: evidently the assumption is there's no command in progress at that point, or we don't care. The nsp_cs driver toggles a stop flag in the per-instance data to indicate the host is accepting I/O: the flag is set to block I/O upon receipt of a suspend, physical reset, or card removal event. The card reset code in the nsp_cs driver, as in mine, is a subset of (fall-through case for) the resume logic.

Given the above, I'm tempted to believe the mid and/or upper driver layers are handling the "command in progress" issue, but I haven't delved into that code deeply enough to know.

Signature · 4 lines
-----------------------------------------------------------------------
Bob Tracy                   WTO + WIPO = DMCA? http://www.anti-dmca.org
[email protected]
-----------------------------------------------------------------------
#9 lore raw

Re: [PATCH] sym53c500_cs PCMCIA SCSI driver (round 3 - the charm?)

Quoted 7 lines · Bob Tracy
Quoted 3 lines · Russell King

Hmm, so what happens if you're in the middle of a transaction, and you receive a CS_EVENT_CARD_RESET. What happens to the command in progress ?

Candidly, I don't know. A fair question to ask in return is, under what circumstances might a PCMCIA driver see a CS_EVENT_CARD_RESET?

When the user issues "cardctl reset"

Quoted 8 lines

None of the existing PCMCIA SCSI drivers I saw do anything other than reset the hardware: evidently the assumption is there's no command in progress at that point, or we don't care. The nsp_cs driver toggles a stop flag in the per-instance data to indicate the host is accepting I/O: the flag is set to block I/O upon receipt of a suspend, physical reset, or card removal event. The card reset code in the nsp_cs driver, as in mine, is a subset of (fall-through case for) the resume logic.

Quoted 5 lines

Given the above, I'm tempted to believe the mid and/or upper driver layers are handling the "command in progress" issue, but I haven't delved into that code deeply enough to know.

From the brief look I had, it didn't look like it - I suspect things

will go gaga if someone ever invoked "cardctl reset".

Signature · 4 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
                 2.6 Serial core
author
#10 lore raw

Re: [PATCH] sym53c500_cs PCMCIA SCSI driver (round 3 - the charm?)

(Driver attempt 4 posted to linux-scsi a few minutes ago.)

Quoted 10 lines · Russell King
Quoted 7 lines · Bob Tracy
Quoted 3 lines · Russell King

Hmm, so what happens if you're in the middle of a transaction, and you receive a CS_EVENT_CARD_RESET. What happens to the command in progress ?

Candidly, I don't know. A fair question to ask in return is, under what circumstances might a PCMCIA driver see a CS_EVENT_CARD_RESET?

When the user issues "cardctl reset"

Would it then be fair to characterize this action as either a self- inflicted gunshot wound or a desperate attempt to restore things to a sane state? I can see someone trying a reset if things got wedged in the middle of a critical transaction, and I guess the actions that could be taken by the low-level driver would properly depend on what can be assumed with respect to the mid and upper layers. In the case of the self-inflicted wound, the task at hand would be roughly equivalent to ensuring the integrity of a floppy diskette when the user ejects it from the drive in the middle of a write.

Quoted 3 lines

From the brief look I had, it didn't look like (the mid and upper driver layers were handling the "command in progress" issue) - I suspect things will go gaga if someone ever invoked "cardctl reset".

Ouch! I hate to be like the doctor that suggests if something hurts when you do it, then don't do it, but it sounds like the user is already hurting if he's reaching for the "card reset" hammer. For a sequential access device (magnetic tape and such), the user would probably end up having to restart the job anyway (read or write). For random access devices, I think the results would be minimally bad in the case of an interrupted read. If the user is in the middle of a write operation, it's probably fsck time (or enjoy your new coaster in the case of one-shot writable media). Mitigating factors? If things are truly wedged, the attached devices are probably in a pretty much quiescent state anyway, implying any damage caused by a reset would be minimal compared to what has already occurred.

Has this been discussed before? If so, I don't recall. Any ideas as far as what *should* be done (by the drivers at any level)? Resetting the host hardware is an obviously correct thing to do if there's anything to be done in response to the card reset event. The software state is a trickier matter: doing nothing might well be the best option.

Signature · 4 lines
-----------------------------------------------------------------------
Bob Tracy                   WTO + WIPO = DMCA? http://www.anti-dmca.org
[email protected]
-----------------------------------------------------------------------
#11 lore raw

Re: [PATCH] sym53c500_cs PCMCIA SCSI driver (round 3 - the charm?)

In reply to Bob Tracy
Quoted 2 lines · Bob Tracy

Barring any remaining issues (Christoph?), I think we're finally ready for prime time :-).

there's still a bunch of minor issues. If you don't have them cleaned up until James' next push to Linux I'd say include the current variant and fix it up later, else I'd say wait for the next revision.

drivers/scsi/pcmcia/sym53c500_cs.c line 47

Quoted 4 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +4 -0
+*  proc_info() is deprecated in 2.6.  Set this to 1 if you want to
+*  see the entries under /proc that were there in earlier kernels.
+*/
+#define PROC_INFO 1

please set this to 0 for submission. in fact I think it should really go away for submission. if you want it for personal use - fine. But a new 2.6 driver shouldn't implement ->proc_info anymore but rather use sysfs if nessecery.

Quoted 1 line

+#include <linux/stat.h>

I don't think you need this one at all.

Quoted 1 line

+#include <asm/bitops.h>

use linux/bitops.h instead.

drivers/scsi/pcmcia/sym53c500_cs.c line 97

Quoted 10 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +10 -0
+/* Static function prototypes: needed for scsi_host_template initializer. */
+
+static int SYM53C500_abort(struct scsi_cmnd *);
+static const char *SYM53C500_info(struct Scsi_Host *);
+#if PROC_INFO
+static int SYM53C500_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
+#endif
+static int SYM53C500_queue(struct scsi_cmnd *, void (*done)(struct scsi_cmnd *));
+static int SYM53C500_host_reset(struct scsi_cmnd *);
+static int SYM53C500_biosparm(struct scsi_device *, struct block_device *, sector_t, int *);

What speaks against removing this and declaring the host template after all these function but before the pcmcia interface code?

(sorry for not answering your previous mail on this, have been busy)

Quoted 1 line

+static dev_link_t *dev_list = NULL;

you don't need to initialize this to NULL, the compiler will do for you.

Quoted 5 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +5 -0
+	if (irq_level > 0) {
+		if (request_irq(irq_level, SYM53C500_intr, 0, "SYM53C500", host)) {
+			printk("SYM53C500: unable to allocate IRQ %d\n", irq_level);
+			goto err_free_scsi;
+		}

drivers/scsi/pcmcia/sym53c500_cs.c line 745

Quoted 10 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +10 -0
+		tpnt->can_queue = 1;
+		DEB(printk("SYM53C500: allocated IRQ %d\n", irq_level));
+	} else if (irq_level == 0) {
+		tpnt->can_queue = 0;
+		DEB(printk("SYM53C500: No interrupts detected\n"));
+		goto err_free_scsi;
+	} else {
+		DEB(printk("SYM53C500: Shouldn't get here!\n"));
+		goto err_free_scsi;
+	}

can_queue = 0 isn't valid anymore in 2.6.

drivers/scsi/pcmcia/sym53c500_cs.c line 1021

Quoted 6 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +6 -0
+static int
+SYM53C500_abort(struct scsi_cmnd *SCpnt)
+{
+	DEB(printk("SYM53C500_abort called\n"));
+	return FAILED;		/* Don't know how to abort */
+}

no need to implement it if it returns FAILED always.

drivers/scsi/pcmcia/sym53c500_cs.c line 1090

Quoted 12 lines
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +12 -0
+	/*
+	*  The standard comment seen at this point in almost
+	*  every low-level SCSI driver is:
+	*
+	*  XXX: this really needs to move into generic code...
+	*
+	*  In 2.6, it evidently has been: a debug printk() will
+	*  show dev_list to be NULL on entry into the while().
+	*
+	while (dev_list != NULL)
+		SYM53C500_detach(dev_list);
+	*/

I'd say just kill this..

author
#12 lore raw

PATCH 1/1 sym53c500_cs PCMCIA SCSI driver (round 4)

Fourth attempt at a 2.6 driver for PCMCIA SCSI cards using the Symbios 53c500 controller is attached.

Quoted 9 lines · Christoph Hellwig

Review

Quoted 4 lines
(quoted diff) +4 -0
+*  proc_info() is deprecated in 2.6.  Set this to 1 if you want to
+*  see the entries under /proc that were there in earlier kernels.
+*/
+#define PROC_INFO 1

please set this to 0 for submission. in fact I think it should really go away for submission. if you want it for personal use - fine. But a new 2.6 driver shouldn't implement ->proc_info anymore but rather use sysfs if nessecery.

I compromised... PROC_INFO is set to 0 for submission. I intended that to be the default, but obviously *I* still use the stuff under /proc.

Quoted 3 lines
Quoted 1 line

+#include <linux/stat.h>

I don't think you need this one at all.

Gone.

Quoted 3 lines
Quoted 1 line

+#include <asm/bitops.h>

use linux/bitops.h instead.

Done.

Quoted 4 lines
Quoted 1 line

+/* Static function prototypes: needed for scsi_host_template initializer. */

What speaks against removing this and declaring the host template after all these function but before the pcmcia interface code?

Done. Two reasons it wasn't accomplished sooner: (1) initially, I didn't see a way to avoid at least one forward declaration/prototype; and (2) beauty being in the eye of the beholder, I frankly thought having the host template declaration in the middle of the code was uglier than using the prototypes to place the template declaration where it was. Item (2) became a non-issue for me when I came to the realization the template placement is more aesthetically pleasing *without* the prototypes than it was *with* the prototypes :-).

Quoted 3 lines
Quoted 1 line

+static dev_link_t *dev_list = NULL;

you don't need to initialize this to NULL, the compiler will do for you.

<Homer_Simpson>Doh!</Homer_Simpson> Done.

Quoted 9 lines
Quoted 9 lines
(quoted diff) +9 -0
+	if (irq_level > 0) {
+		if (request_irq(irq_level, SYM53C500_intr, 0, "SYM53C500", host)) {
+			printk("SYM53C500: unable to allocate IRQ %d\n", irq_level);
+			goto err_free_scsi;
+		}
+		tpnt->can_queue = 1;
+		DEB(printk("SYM53C500: allocated IRQ %d\n", irq_level));
+	} else if (irq_level == 0) {
+		tpnt->can_queue = 0;
Quoted 8 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+		DEB(printk("SYM53C500: No interrupts detected\n"));
+		goto err_free_scsi;
+	} else {
+		DEB(printk("SYM53C500: Shouldn't get here!\n"));
+		goto err_free_scsi;
+	}

can_queue = 0 isn't valid anymore in 2.6.

Nod. Also eliminated the tpnt->can_queue assignment statements. In the case of irq_level > 0, the template initializer has already set that member to 1. Setting it to zero in the case of irq_level == 0 was a waste of object code bytes because we were on the error return path at that point anyway.

Quoted 3 lines
Quoted 1 line

+SYM53C500_abort(struct scsi_cmnd *SCpnt)

no need to implement it if it returns FAILED always.

Sorry... Missed that the last go-round.

Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+	*  XXX: this really needs to move into generic code...

I'd say just kill this..

Done.

Anything else? There's a dangling "unknown" with respect to what the low-level driver should do upon receipt of CS_EVENT_CARD_RESET: Russell King asked what happens to the command in progress. Based on what I think I saw in other PCMCIA SCSI drivers, should I care? Right now, I do pretty much what the other drivers do -- reset the host instance.

Signature · 4 lines
-----------------------------------------------------------------------
Bob Tracy                   WTO + WIPO = DMCA? http://www.anti-dmca.org
[email protected]
-----------------------------------------------------------------------
drivers/scsi/pcmcia/Kconfig renamed from drivers/scsi/pcmcia/Kconfig.orig +10 -0
@@ -69,4 +69,14 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called qlogic_cs.
 
+config PCMCIA_SYM53C500
+	tristate "Symbios 53c500 PCMCIA support"
+	depends on m
+	help
+	  Say Y here if you have a New Media Bus Toaster or other PCMCIA
+	  SCSI adapter based on the Symbios 53c500 controller.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called sym53c500_cs.
+
 endmenu
drivers/scsi/pcmcia/Makefile renamed from drivers/scsi/pcmcia/Makefile.orig +1 -0
@@ -6,6 +6,7 @@
 obj-$(CONFIG_PCMCIA_FDOMAIN)	+= fdomain_cs.o
 obj-$(CONFIG_PCMCIA_AHA152X)	+= aha152x_cs.o
 obj-$(CONFIG_PCMCIA_NINJA_SCSI)	+= nsp_cs.o
+obj-$(CONFIG_PCMCIA_SYM53C500)	+= sym53c500_cs.o
 
 aha152x_cs-objs	:= aha152x_stub.o aha152x_core.o
 fdomain_cs-objs	:= fdomain_stub.o fdomain_core.o
drivers/scsi/pcmcia/sym53c500_cs.c renamed from drivers/scsi/pcmcia/sym53c500_cs.c.orig +1061 -0

1,061 lines not on this page · raw message

Documentation/scsi/sym53c500_cs.txt renamed from Documentation/scsi/sym53c500_cs.txt.orig +23 -0
@@ -0,0 +1,23 @@
+The sym53c500_cs driver originated as an add-on to David Hinds' pcmcia-cs
+package, and was written by Tom Corner ([email protected]).  A rewrite was
+long overdue, and the current version addresses the following concerns:
+
+	(1) extensive kernel changes between 2.4 and 2.6.
+	(2) deprecated PCMCIA support outside the kernel.
+
+All the USE_BIOS code has been ripped out.  It was never used, and could
+not have worked anyway.  The USE_DMA code is likewise gone.  Many thanks
+to YOKOTA Hiroshi (nsp_cs driver) and David Hinds (qlogic_cs driver) for
+the code fragments I shamelessly adapted for this work.  Thanks also to
+Christoph Hellwig for his patient tutelage while I stumbled about.
+
+The Symbios Logic 53c500 chip was used in the "newer" (circa 1997) version
+of the New Media Bus Toaster PCMCIA SCSI controller.  Presumably there are
+other products using this chip, but I've never laid eyes (much less hands)
+on one.
+
+Through the years, there have been a number of downloads of the pcmcia-cs
+version of this driver, and I guess it worked for those users.  It worked
+for Tom Corner, and it works for me.  Your mileage will probably vary.
+
+--Bob Tracy ([email protected])
Documentation/scsi/00-INDEX renamed from Documentation/scsi/00-INDEX.orig +2 -0
@@ -62,6 +62,8 @@
 	- info on API between SCSI layer and low level drivers
 st.txt
 	- info on scsi tape driver
+sym53c500_cs.txt
+	- info on PCMCIA driver for Symbios Logic 53c500 based adapters
 sym53c8xx_2.txt
 	- info on second generation driver for sym53c8xx based adapters
 tmscsim.txt
#13 lore raw
In reply to Bob Tracy
Quoted 59 lines · Bob Tracy
Quoted 1 line · Christoph Hellwig

I've given it a short spin and here's a bunch of comments:

Thank you for taking the time and trouble to review it.

Quoted 1 line

- the split into three source files is supserflous, one file should do it

Given that the driver currently supports only PCMCIA implementations, I agree. My thinking was if someone comes up with a host adapter that isn't PCMCIA, the SYM53C500.c file is to the sym53c500_cs driver what the qlogicfas.c file is to the qlogic_cs driver, that is, core functions that could support multiple types of host adapters. The logic to handle the different types of adapters isn't there, and I don't know that it ever will be (else, it's probable that someone would have written the Linux driver long before now). However, after baring my ignorance to the world and saying I was unaware of non-PCMCIA implementations, I found a FreeBSD driver for the NCR 53c500. Never say "never," I guess... Your opinion counts for much, but you're the only person I've heard from. Is there a consensus I should forget about the non-PCMCIA cases?

Quoted 4 lines

- please don't use host.h or scsi.h from drivers/scsi/. The defintions not present in include/scsi/ are deprecated and shall not be used (the most prominent example in your driver are the Scsi_<Foo> typedefs that have been replaced by struct scsi_foo

I caught that in the coding style guidelines (and in the mentioned include files), and will fix for the next submission.

Quoted 1 line

- the driver doesn't even try to deal with multiple HBAs

Guilty as charged. Functionally, there's nothing in the driver I submitted that wasn't in the original. Suggestions welcome... Which of the existing PCMCIA SCSI drivers do a proper job of handling multiple host adapters in your opinion? I'll try to adapt that code to fit this driver. If I have to "roll my own" from scratch, I'm probably in over my head.

Quoted 2 lines

- your detection logic could be streamlined a little, e.g. the request/release resource mess

I'll see what I can do.

Although I touched on it above, by way of apology/explanation, the goal for the initial port was to replicate the functionality I already had in older kernel versions. It appears I faithfully replicated the deficiencies of the old driver as well :-). Again, thank you for the feedback.

Quoted 6 lines

Anyone else have input before I act on the recommendations I've been given? Unless I hear otherwise, I'll start work on the code consolidation and removal of dependencies on deprecated include files. The detection logic and handling multiple HBAs will take a bit more effort...

WRT the split of code... if there is some reason why there will never be another type of card then the split is unnessessary. But otherwise, you've done the work, and it matches the way other drivers were split, so why scrap it?

As you guessed I don't feel strongly one way or the other, just thought you could use a little support for having made the effort to design for the future.

Signature · 3 lines
   -bill davidsen ([email protected])
"The secret to procrastination is to put things off until the
 last possible moment - but no longer"  -me
author
#14 lore raw
Quoted 8 lines · Bill Davidsen

WRT the split of code... if there is some reason why there will never be another type of card then the split is unnessessary. But otherwise, you've done the work, and it matches the way other drivers were split, so why scrap it?

As you guessed I don't feel strongly one way or the other, just thought you could use a little support for having made the effort to design for the future.

You give me too much credit :-). I inherited the split design from the original author and simply preserved it. As far as maintaining the split design, the only evidence I've seen of non-PCMCIA cards using the Symbios/NCR 53c500 controller is the existence of a driver in the FreeBSD tree. In any event, I don't have the hardware to test anything other than the PCMCIA case, and if there's someone out there who needs support for the non-PCMCIA case, I expect the Linux driver would have been written before now. Christoph suggested in an earlier posting that the split to support other hardware would probably be accomplished differently these days anyway, so we (the community) probably haven't lost all that much by concentrating on producing a well-written PCMCIA-only driver.

I saved my first attempt at a 2.6 driver (in case someone wants to revisit the issue). Otherwise, although I appreciate your support, it's OBE. I'm waiting to hear back from Christoph on a few design issues (questions asked off-line) before submitting a third 2.6 driver.

The main issue I'm wrestling with at the moment is support for the improbable case of multiple HBAs... I agree in principle with the objective as long as I don't do something stupid that kills performance for the normal case of a single HBA. As I see it, there are essentially two approaches:

(1) Calculate all the needed hardware register offsets up front at HBA init time, and carry them as part of the per-instance data. This approach has a few things going for it -- the in-core memory requirement is essentially identical for the single HBA case, and dereferencing a structure pointer to get a register address is barely worse than accessing the equivalent global variable in the driver.

(2) Calculate a particular register offset each time that register is accessed, using something like shost->io_port + offset, which, it is claimed, is normal Linux driver practice. Although this approach is extremely attractive from the standpoint of code simplicity, I'm concerned about the arithmetic overhead. If it turns out most of the hardware register accesses occur during initialization, my concerns are pretty well meaningless. Obviously I need to look at this more closely.

You may safely assume I'm learning more about this than I originally anticipated :-).

Signature · 4 lines
-----------------------------------------------------------------------
Bob Tracy                   WTO + WIPO = DMCA? http://www.anti-dmca.org
[email protected]
-----------------------------------------------------------------------