Re: [PATCH] aic94xx: fix SMP request DMA direction

2007-09-30 Thread Darrick J. Wong
On Sat, Sep 29, 2007 at 02:25:33AM -0400, Jeff Garzik wrote:
 Muli Ben-Yehuda wrote:
 On Fri, Sep 28, 2007 at 04:55:34PM -0700, Darrick J. Wong wrote:
 On Thu, Sep 27, 2007 at 10:33:41PM -0400, Jeff Garzik wrote:
 Unless I'm missing something, the SMP request goes /to/ the PCI device 
 :)

 Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
 ACK; builds ok and SMP commands seem to work ok (not that they
 didn't before).
 Could this explain some weirdness we were seeing with aic94xx and
 Calgary/CalIOC2 enabled, or are SMP commands not likely to be used in
 normal operation? We map the IOMMU entries differently for FROMDEVICE
 (RW) and TODEVICE(RO).

 SMP == scsi management == not used during normal data transfer.

 It could certainly explain flakiness if you have expanders, though

Actually, SMP commands are used during device discovery to find things
attached to expanders, so it seems likely that it blows up almost
immediately after loading the module symptoms are a result of this bug.

That said, the bug that Jeff fixed resulted in extra permissions (+w)
being set for the SMP request buffer, so that's probably why I've never
seen any problems manifesting on x260/x3800 systems.

(Unless the CalIOC2 has a write only mode?)

--D
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] aic94xx: fix SMP request DMA direction

2007-09-30 Thread Muli Ben-Yehuda
On Sun, Sep 30, 2007 at 12:13:55AM -0700, Darrick J. Wong wrote:

 Actually, SMP commands are used during device discovery to find
 things attached to expanders, so it seems likely that it blows up
 almost immediately after loading the module symptoms are a result
 of this bug.
 
 That said, the bug that Jeff fixed resulted in extra permissions
 (+w) being set for the SMP request buffer, so that's probably why
 I've never seen any problems manifesting on x260/x3800 systems.
 
 (Unless the CalIOC2 has a write only mode?)

It does (you can turn on each of the R and W bits in the TCE entry
seperately) but we don't make use of it - we set it to either none, RO
or RW.

Cheers,
Muli
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/5] qla2xxx: add target mode support

2007-09-30 Thread Seokmann Ju
FUJITA Tomonori wrote:
 On Thu, 27 Sep 2007 07:34:52 -0700
 Seokmann Ju [EMAIL PROTECTED] wrote:
 
 FUJITA Tomonori wrote:
 On Fri, 21 Sep 2007 07:34:18 -0700
 Seokmann Ju [EMAIL PROTECTED] wrote:

 Andrew Vasquez wrote:
 On Sat, 01 Sep 2007, FUJITA Tomonori wrote:

 This adds target mode support to qla2xxx.

 With set ql2enable_target_mode module parameter to 1, the driver runs
 in target mode. By default, ql2enable_target_mode is set to 0, and the
 driver should work in initiator mode as before.

 The driver could support dual-mode in the future but it doesn't at the
 moment (we need to add dual-mode support tgt first).

 It is based on scst qla2xxx target mode driver. Mike converted the
 driver to use tgt long ago. I changed it to use the latest (mainline)
 version of qla2xxx driver and tgt, and also converted it to use fc
 transport class.
 Thanks for doing this.  Some initial comments before a full review is
 complete, As was seen from the initiator updates needed for 24xx
 support, there are comparable changes needed in the area of
 target-mode support for 4gb and 8gb parts.  Also, which ISPs and
 firmwares were exercised with this code?
 The patch is still under reviewing and will get done, soon.
 Great, thinks!
 One more question on typical testing setup.
 I wonder how should I setup the testing environment esp., for the
 target-mode.
 
 Sorry, I should have explained it with the patch.

 Probabaly, you need to compile scsi-misc with the qla2xxx target patch
 and the user-space target code.
Thank you, I will make it.

 1. scsi-misc + the qla2xxx target patch
Just for the future references, should I expect same effect from following 
repository?
git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-target.git

 CONFIG_SCSI_TGT=m
 CONFIG_SCSI_FC_ATTRS=m
 CONFIG_SCSI_FC_TGT_ATTRS=y
 CONFIG_SCSI_QLA_FC=m
 CONFIG_SCSI_QLA_FC_TGT=y
 
 2. the user-space target code
 
 git://git.kernel.org/pub/scm/linux/kernel/git/tomo/tgt.git
 
 rouen:~/git/tgt/usr$ make FCP=1 KERNELSRC=/home/fujita/git/scsi-misc-2.6
 
 
 Starting the fc target mode is not so simple now (Mike and I know that
 we need to fix it...).
 
 1. load scsi_tgt.ko
 
 2. start the user-space daemon
 
 Here's a simple example.
 
 ./tgt/usr/tgtd
 ./tgt/usr/tgtadm --lld fc --mode target --op new --tid 1 --targetname volume1
 ./tgt/usr/tgtadm --lld fc --mode logicalunit --op new --tid 1 --lun 1 -b 
 /var/tmp/lun1
 ./tgt/usr/tgtadm --lld fc --mode target --op bind --tid 1 --host 2
 
 You use a /var/tmp/lun1 file as #1 logical unit. The host number must
 be equal to qla2xxx scsi host number (when you load qla2xxx module).
 
 Then load scsi_transport_fc.ko and qla2xxx.ko (please don't forget
 ql2enable_target_mode=1 option).
 
 You can make sure everything is fine by the following command:
 
 luce:/home/fujita# cat /sys/class/scsi_host/host2/model_name
 QLA2340
 luce:/home/fujita# cat /sys/class/scsi_host/host2/active_mode
 Target
 
 luce:/home/fujita# ./tgt/usr/tgtadm --lld fc --mode target --op show
 Target 1: volume1
 System information:
 Driver: fc
 Status: running
 I_T nexus information:
 LUN information:
 LUN: 0
 Type: controller
 SCSI ID: deadbeaf1:0
 SCSI SN: beaf10
 Size: 0
 Online: No
 Poweron/Reset: Yes
 Removable media: No
 Backing store: No backing store
 LUN: 1
 Type: disk
 SCSI ID: deadbeaf1:1
 SCSI SN: beaf11
 Size: 1G
 Online: Yes
 Poweron/Reset: No
 Removable media: No
 Backing store: /var/tmp/lun1
 ACL information:
 
 
 
 If you have, could you share the details of the layout of the
 environment that you have had used for the feature verification?
 
 I use two hosts with qla23xx and a host with lpfc, which are connected
 via Brocade SilkWorm. One of qla23xx host runs in target mode. Another
 qla23xx host and the lpfc host can connect to the qla23xx target host.
 
 
 Here's lsscsi output in the lpfc host. The qla23xx target host gives
 [13:0:0:0] and [13:0:0:1] (yeah, I know, IET vendor name is strange).
 
 lily:/home/fujita# lsscsi
 [0:0:0:0]diskServeRA  Drive 1  V1.0  /dev/sda
 [0:0:1:0]diskServeRA  Drive 2  V1.0  /dev/sdb
 [0:1:0:0]diskIBM-ESXS GNA300C3ESTT0Z N BH0G  -
 [0:1:1:0]diskIBM-ESXS GNA300C3ESTT0Z N BH0G  -
 [0:3:0:0]enclosu IBM  SAS SES-2 DEVICE 1.06  -
 [13:0:0:0]   storage IET  Controller   0001  -
 [13:0:0:1]   diskIET  VIRTUAL-DISK 0001  /dev/sdc
 [13:0:1:0]   diskIBM  1814  FAStT  2916  /dev/sdd
 [13:0:1:1]   diskIBM  1814  FAStT  2916  /dev/sde
 [13:0:1:31]  diskIBM  Universal Xport  2916  -
 [13:0:2:0]   diskIBM  1814  FAStT  2916  /dev/sdf
 [13:0:2:1]   diskIBM  1814  FAStT  2916  /dev/sdg
 [13:0:2:31]  diskIBM  Universal Xport  2916  -

Re: [PATCH 4/5] qla2xxx: add target mode support

2007-09-30 Thread FUJITA Tomonori
On Sun, 30 Sep 2007 03:57:07 -0700
Seokmann Ju [EMAIL PROTECTED] wrote:

 FUJITA Tomonori wrote:
  On Thu, 27 Sep 2007 07:34:52 -0700
  Seokmann Ju [EMAIL PROTECTED] wrote:
  
  FUJITA Tomonori wrote:
  On Fri, 21 Sep 2007 07:34:18 -0700
  Seokmann Ju [EMAIL PROTECTED] wrote:
 
  Andrew Vasquez wrote:
  On Sat, 01 Sep 2007, FUJITA Tomonori wrote:
 
  This adds target mode support to qla2xxx.
 
  With set ql2enable_target_mode module parameter to 1, the driver runs
  in target mode. By default, ql2enable_target_mode is set to 0, and the
  driver should work in initiator mode as before.
 
  The driver could support dual-mode in the future but it doesn't at the
  moment (we need to add dual-mode support tgt first).
 
  It is based on scst qla2xxx target mode driver. Mike converted the
  driver to use tgt long ago. I changed it to use the latest (mainline)
  version of qla2xxx driver and tgt, and also converted it to use fc
  transport class.
  Thanks for doing this.  Some initial comments before a full review is
  complete, As was seen from the initiator updates needed for 24xx
  support, there are comparable changes needed in the area of
  target-mode support for 4gb and 8gb parts.  Also, which ISPs and
  firmwares were exercised with this code?
  The patch is still under reviewing and will get done, soon.
  Great, thinks!
  One more question on typical testing setup.
  I wonder how should I setup the testing environment esp., for the
  target-mode.
  
  Sorry, I should have explained it with the patch.
 
  Probabaly, you need to compile scsi-misc with the qla2xxx target patch
  and the user-space target code.
 Thank you, I will make it.
 
  1. scsi-misc + the qla2xxx target patch
 Just for the future references, should I expect same effect from following 
 repository?
 git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-target.git

Yup, but note that sometimes the tree isn't based on the latest
scsi-misc.

Thanks,
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] x86-64: pci-gart iommu sg chaining zeroes wrong sg.

2007-09-30 Thread Benny Halevy
On Sep 27, 2007, 18:46 +0200, FUJITA Tomonori [EMAIL PROTECTED] wrote:
 On Fri, 28 Sep 2007 01:38:27 +0900
 FUJITA Tomonori [EMAIL PROTECTED] wrote:
 
 This patch is for Jens' block tree (sg chaining branch).

 I don't have the hardware but this looks like a bug.

 ---
 From: FUJITA Tomonori [EMAIL PROTECTED]
 Subject: [PATCH] x86-64: pci-gart iommu sg chaining zeroes a wrong sg's 
 dma_length

 Needs to zero the end of the list.

 Signed-off-by: FUJITA Tomonori [EMAIL PROTECTED]
 ---
  arch/x86_64/kernel/pci-gart.c |3 ++-
  1 files changed, 2 insertions(+), 1 deletions(-)

 diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
 index 27b7db4..a4151a7 100644
 --- a/arch/x86_64/kernel/pci-gart.c
 +++ b/arch/x86_64/kernel/pci-gart.c
 @@ -425,9 +425,10 @@ int gart_map_sg(struct device *dev, struct scatterlist 
 *sg, int nents, int dir)
  if (dma_map_cont(start_sg, i - start, sgmap, pages, need)  0)
  goto error;
  out++;
 +sgmap = sg_next(sgmap);
  flush_gart();
  if (out  nents)
 -ps-dma_length = 0;
 +sgmap-dma_length = 0;
  return out;
 
 Sorry, it should be:
 
 
 diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
 index 27b7db4..cfcc84e 100644
 --- a/arch/x86_64/kernel/pci-gart.c
 +++ b/arch/x86_64/kernel/pci-gart.c
 @@ -426,8 +426,10 @@ int gart_map_sg(struct device *dev, struct scatterlist 
 *sg, int nents, int dir)
   goto error;
   out++;
   flush_gart();
 - if (out  nents)
 - ps-dma_length = 0;
 + if (out  nents) {
 + sgmap = sg_next(sgmap);
 + sgmap-dma_length = 0;
 + }

looks correct to me.
ps points at the previous scanned sg entry while you want to zero out
dma_length at the entry immediately following the last entry mapped
(if (out  nents))

the original code before 62296749bd421904dace1e6b0fc3c4538aac7111 was:
-   if (out  nents) 
-   sg[out].dma_length = 0; 

Benny

   return out;
  
  error:
 -
 To unsubscribe from this list: send the line unsubscribe linux-scsi in
 the body of a message to [EMAIL PROTECTED]
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] aic94xx: fix SSP IU status print-out

2007-09-30 Thread Jeff Garzik

The SSP response DPRINTK in asd_get_response_tasklet() was printing
a hardcoded status result, rather than the status from the SSP
response IU.

Arguably, this should not be a DPRINTK either, since the admin might
want to know about this.

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/scsi/aic94xx/aic94xx_task.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/aic94xx/aic94xx_task.c 
b/drivers/scsi/aic94xx/aic94xx_task.c
index ab13824..f2b23e0 100644
--- a/drivers/scsi/aic94xx/aic94xx_task.c
+++ b/drivers/scsi/aic94xx/aic94xx_task.c
@@ -207,7 +207,7 @@ static void asd_get_response_tasklet(struct asd_ascb *ascb,
stat(0x%x) is not CHECK_CONDITION
\n,
SAS_ADDR(task-dev-sas_addr),
-   ts-stat);
+   iu-status);
}
}
}  else {
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] SCSI: export sas_hash_addr()

2007-09-30 Thread James Bottomley
On Thu, 2007-09-27 at 21:01 -0400, Jeff Garzik wrote:
 James Bottomley wrote:
  On Wed, 2007-09-26 at 03:35 -0400, Jeff Garzik wrote:
  sas_hash_addr() is the spec-defined standard hashing function.  Make it
  available to drivers that need it.
  
  I'm not opposed in principle to exporting this, but I have a hard time
  understanding why a driver would need it.
  
  The hashed address is a property of the constructed SAS frames, which is
  done in libsas.  The driver shouldn't really be calculating its own hash
  instead of using what libsas provides ... or is this because the hashed
  self address isn't calculated by the HBA so it needs to be programmed or
  something?
 
 It is needed to build the SSP frame header.
 
 If there is common code that does that, I will definitely use that, but 
 do not see any such code.

The way you're supposed to build the frame header is in
lldd_execute_task().  Here, if you need the hashed address of the
destination, you copy it out of the domain_device (dev field of struct
sas_task).

James


-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] SCSI: export sas_hash_addr()

2007-09-30 Thread Jeff Garzik

James Bottomley wrote:

On Thu, 2007-09-27 at 21:01 -0400, Jeff Garzik wrote:

James Bottomley wrote:

On Wed, 2007-09-26 at 03:35 -0400, Jeff Garzik wrote:

sas_hash_addr() is the spec-defined standard hashing function.  Make it
available to drivers that need it.

I'm not opposed in principle to exporting this, but I have a hard time
understanding why a driver would need it.

The hashed address is a property of the constructed SAS frames, which is
done in libsas.  The driver shouldn't really be calculating its own hash
instead of using what libsas provides ... or is this because the hashed
self address isn't calculated by the HBA so it needs to be programmed or
something?

It is needed to build the SSP frame header.

If there is common code that does that, I will definitely use that, but 
do not see any such code.


The way you're supposed to build the frame header is in
lldd_execute_task().  Here, if you need the hashed address of the
destination, you copy it out of the domain_device (dev field of struct
sas_task).


That's the destination.  I need it for the source.

Jeff



-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] SCSI: export sas_hash_addr()

2007-09-30 Thread Jeff Garzik

Jeff Garzik wrote:

James Bottomley wrote:

On Thu, 2007-09-27 at 21:01 -0400, Jeff Garzik wrote:

James Bottomley wrote:

On Wed, 2007-09-26 at 03:35 -0400, Jeff Garzik wrote:
sas_hash_addr() is the spec-defined standard hashing function.  
Make it

available to drivers that need it.

I'm not opposed in principle to exporting this, but I have a hard time
understanding why a driver would need it.

The hashed address is a property of the constructed SAS frames, 
which is
done in libsas.  The driver shouldn't really be calculating its own 
hash

instead of using what libsas provides ... or is this because the hashed
self address isn't calculated by the HBA so it needs to be 
programmed or

something?

It is needed to build the SSP frame header.

If there is common code that does that, I will definitely use that, 
but do not see any such code.


The way you're supposed to build the frame header is in
lldd_execute_task().  Here, if you need the hashed address of the
destination, you copy it out of the domain_device (dev field of struct
sas_task).


That's the destination.  I need it for the source.


Nevermind, I found it elsewhere.  You can drop this patch.

Jeff



-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] SCSI: export sas_hash_addr()

2007-09-30 Thread James Bottomley
On Sun, 2007-09-30 at 13:44 -0400, Jeff Garzik wrote:
 James Bottomley wrote:
  On Thu, 2007-09-27 at 21:01 -0400, Jeff Garzik wrote:
  James Bottomley wrote:
  On Wed, 2007-09-26 at 03:35 -0400, Jeff Garzik wrote:
  sas_hash_addr() is the spec-defined standard hashing function.  Make it
  available to drivers that need it.
  I'm not opposed in principle to exporting this, but I have a hard time
  understanding why a driver would need it.
 
  The hashed address is a property of the constructed SAS frames, which is
  done in libsas.  The driver shouldn't really be calculating its own hash
  instead of using what libsas provides ... or is this because the hashed
  self address isn't calculated by the HBA so it needs to be programmed or
  something?
  It is needed to build the SSP frame header.
 
  If there is common code that does that, I will definitely use that, but 
  do not see any such code.
  
  The way you're supposed to build the frame header is in
  lldd_execute_task().  Here, if you need the hashed address of the
  destination, you copy it out of the domain_device (dev field of struct
  sas_task).
 
 That's the destination.  I need it for the source.

The source should come from dev-port-ha-hashed_sas_addr ...
traditionally it's just your sas_ha_struct that you passed into
sas_register_ha.  The register function fills in the hashed address and
you can pick it out again.

James


-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC 0/16] gdth combined patchset call for testers

2007-09-30 Thread Boaz Harrosh
Hi!

following is an attempted at unified patchset for the gdth driver.

They try to incorporate floating patches to gdth from:
Christoph Hellwig
Jeff Garzik
Matthew Wilcox
and Me Boaz Harrosh

They are done in the mindset of likelihood of inducing breakage,
hence the need for testers. Christoph  Jeff please review for any
obvious easy-to-catch bugs.

Some short explanations:
[1/16] gdth: split out isa probing - Christoph Hellwig
[2/16] gdth: split out eisa probing - Christoph Hellwig
[3/16] gdth: split out pci probing - Christoph Hellwig
  These three are from Christoph and where ACKed by
  Jeff at the time.

[4/16] gdth: Remove 2.4.x support, in-kernel changelog - Jeff Garzik
  Same but partial work was done both by Christoph and Matthew.

[5/16] gdth: kill gdth_{read,write}[bwl] wrappers - Jeff Garzik
[6/16] Reorder scsi_host_template intitializers
[7/16] gdth: make some virt ctrlr code common
  These 3 are from Jeff's patchset 6  7 where the same patch

[8/16] gdth: Remove virt hosts - Christoph  Boaz
  Here we need an executive decision! The issue is as stated by Christoph:

The virt_ctr option allows to register a new scsi_host for each bus
on the raid controller.  This non-default option makes no sense with
the current scsi code and prevents cleaning up the host registration,
so remove it.

  I agree. This is just exactly the same as done buy scsi-ml scans but only
  more resource consuming. Unless I'm totally missing something, perhaps it is
  just a leftover from old kernels.

  But if it is decided that this virt_ctr fixture is absolutely needed than
  I have a patch for re-enabling it at: after the patchset, done in a 
different
  way. Because for now it prevents the cleanups I need.

  Also this patch can Just be merged with [7/16] but I wanted it separate in 
the 
  case we decide for virt_ctr fixture return.

[9/16] gdth: clean up host private data - Christoph  Boaz
  This is based on the same patch from Christoph, but taken one step
  farther, by just passing the ha pointer everywhere instead of hanum.
  Christoph please acknowledge your signed-of-by on this patch.

[10/16] gdth: gdth_get_status() return pointer to host not its index - Boaz
  This logically belongs to [9/16] but is separated for reviewing and 
bisect-ability
  As it is a sensitive matter.

[11/16] gdth: switch to modern scsi host registration - Christoph
  Christoph what is missing from here is the remove of the deprecated 
  pci_find_device() call. Can I Just use pci_get_device() of the same signature
  or do I need to call some other pci_ members after that?

[12/16] gdth: Remove gdth_ctr_tab[] - Boaz
  I took Christoph's cleanup one step farther and got read of the statically
  allocated gdth_ctr_tab[]. In it's place I use the new link-list introduced
  by the [11/16] patch.

[13/16] gdth: Make one abuse of scsi_cmnd less obvious - Matthew Wilcox
  This is the first patch sent by Matthew Wilcox, rebased to all above
  patches. Matthew, thanks, it saved me from a much uglier hack I had
  with regard to per-command-private-data.

[14/16] gdth: Setup proper per-command private data - Boaz
[15/16] gdth: Move members from SCp to gdth_cmndinfo, stage 2 - Boaz
  These two move me much closer to the agenda I had in all this,
  which is: gdth diss-abuse of of scsi_cmnd IO members.
  With these patches I also conform to Matthew's second patch:
  gdth: Stop abusing -done for internal commands

[16/16] gdth: !use_sg cleanup and use of scsi accessors
  And finally this one.


Boaz

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/16] gdth: split out isa probing

2007-09-30 Thread Boaz Harrosh

(note: this is ontop of Jeff's pci cleanup patch)

Split out isa probing into a helper of it's own.  Error handling is
cleaned up, but errors are not propagated yet.  Also enclose the isa
probe under the proper CONFIG_ISA symbol instead of the !IA64 hack.

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |  281 ---
 1 files changed, 154 insertions(+), 127 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index b20c188..9f82c01 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -476,6 +476,9 @@ static void gdth_flush(int hanum);
 static int gdth_halt(struct notifier_block *nb, ulong event, void *buf);
 static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *));
 static void gdth_scsi_done(struct scsi_cmnd *scp);
+#ifdef CONFIG_ISA
+static int gdth_isa_probe_one(struct scsi_host_template *, ulong32);
+#endif
 
 #ifdef DEBUG_GDTH
 static unchar   DebugState = DEBUG_GDTH;
@@ -4277,6 +4280,7 @@ int __init option_setup(char *str)
 return 1;
 }
 
+
 #if LINUX_VERSION_CODE = KERNEL_VERSION(2,6,0)
 static int __init gdth_detect(struct scsi_host_template *shtp)
 #else
@@ -4323,135 +4327,15 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
 /* As default we do not probe for EISA or ISA controllers */
 if (probe_eisa_isa) {
 /* scanning for controllers, at first: ISA controller */
-for (isa_bios=0xc8000UL; isa_bios=0xd8000UL; isa_bios+=0x8000UL) {
-dma_addr_t scratch_dma_handle;
-scratch_dma_handle = 0;
-
-if (gdth_ctr_count = MAXHA) 
-break;
-if (gdth_search_isa(isa_bios)) {/* controller found */
-shp = scsi_register(shtp,sizeof(gdth_ext_str));
-if (shp == NULL)
-continue;  
-
-ha = HADATA(shp);
-if (!gdth_init_isa(isa_bios,ha)) {
-scsi_unregister(shp);
-continue;
-}
-#ifdef __ia64__
+#ifdef CONFIG_ISA
+for (isa_bios = 0xc8000UL; isa_bios = 0xd8000UL;
+ isa_bios += 0x8000UL) {
+if (gdth_ctr_count = MAXHA)
 break;
-#else
-/* controller found and initialized */
-printk(Configuring GDT-ISA HA at BIOS 0x%05X IRQ %u DRQ %u\n,
-   isa_bios,ha-irq,ha-drq);
-
-if 
(request_irq(ha-irq,gdth_interrupt,IRQF_DISABLED,gdth,ha)) {
-printk(GDT-ISA: Unable to allocate IRQ\n);
-scsi_unregister(shp);
-continue;
-}
-if (request_dma(ha-drq,gdth)) {
-printk(GDT-ISA: Unable to allocate DMA channel\n);
-free_irq(ha-irq,ha);
-scsi_unregister(shp);
-continue;
-}
-set_dma_mode(ha-drq,DMA_MODE_CASCADE);
-enable_dma(ha-drq);
-shp-unchecked_isa_dma = 1;
-shp-irq = ha-irq;
-shp-dma_channel = ha-drq;
-hanum = gdth_ctr_count; 
-gdth_ctr_tab[gdth_ctr_count++] = shp;
-gdth_ctr_vtab[gdth_ctr_vcount++] = shp;
-
-NUMDATA(shp)-hanum = (ushort)hanum;
-NUMDATA(shp)-busnum= 0;
-
-ha-pccb = CMDDATA(shp);
-ha-ccb_phys = 0L;
-ha-pdev = NULL;
-ha-pscratch = pci_alloc_consistent(ha-pdev, GDTH_SCRATCH, 
-scratch_dma_handle);
-ha-scratch_phys = scratch_dma_handle;
-ha-pmsg = pci_alloc_consistent(ha-pdev, 
sizeof(gdth_msg_str), 
-scratch_dma_handle);
-ha-msg_phys = scratch_dma_handle;
-#ifdef INT_COAL
-ha-coal_stat = (gdth_coal_status *)
-pci_alloc_consistent(ha-pdev, sizeof(gdth_coal_status) *
-MAXOFFSETS, scratch_dma_handle);
-ha-coal_stat_phys = scratch_dma_handle;
-#endif
-
-ha-scratch_busy = FALSE;
-ha-req_first = NULL;
-ha-tid_cnt = MAX_HDRIVES;
-if (max_ids  0  max_ids  ha-tid_cnt)
-ha-tid_cnt = max_ids;
-for (i=0; iGDTH_MAXCMDS; ++i)
-ha-cmd_tab[i].cmnd = UNUSED_CMND;
-ha-scan_mode = rescan ? 0x10 : 0;
-
-if (ha-pscratch == NULL || ha-pmsg == NULL || 
-!gdth_search_drives(hanum)) {
-printk(GDT-ISA: Error during device scan\n);
---gdth_ctr_count;
---gdth_ctr_vcount;
-
-#ifdef INT_COAL
-if (ha-coal_stat)
-pci_free_consistent(ha-pdev, sizeof(gdth_coal_status) 
*
-  

[PATCH 2/16] gdth: split out eisa probing

2007-09-30 Thread Boaz Harrosh

Split eisa probing into it's own helper, and do proper error unwinding.
Protect EISA probind by the proper CONFIG_EISA symbol.

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |  270 ---
 1 files changed, 150 insertions(+), 120 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 9f82c01..5240acd 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -479,6 +479,9 @@ static void gdth_scsi_done(struct scsi_cmnd *scp);
 #ifdef CONFIG_ISA
 static int gdth_isa_probe_one(struct scsi_host_template *, ulong32);
 #endif
+#ifdef CONFIG_EISA
+static int gdth_eisa_probe_one(struct scsi_host_template *, ushort);
+#endif
 
 #ifdef DEBUG_GDTH
 static unchar   DebugState = DEBUG_GDTH;
@@ -4335,129 +4338,14 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
 gdth_isa_probe_one(shtp, isa_bios);
 }
 #endif
-
-for (eisa_slot=0x1000; eisa_slot=0x8000; eisa_slot+=0x1000) {
-dma_addr_t scratch_dma_handle;
-scratch_dma_handle = 0;
-
-if (gdth_ctr_count = MAXHA) 
+#ifdef CONFIG_EISA
+for (eisa_slot = 0x1000; eisa_slot = 0x8000; eisa_slot += 0x1000) {
+if (gdth_ctr_count = MAXHA)
 break;
-if (gdth_search_eisa(eisa_slot)) {  /* controller found */
-shp = scsi_register(shtp,sizeof(gdth_ext_str));
-if (shp == NULL)
-continue;  
-
-ha = HADATA(shp);
-if (!gdth_init_eisa(eisa_slot,ha)) {
-scsi_unregister(shp);
-continue;
-}
-/* controller found and initialized */
-printk(Configuring GDT-EISA HA at Slot %d IRQ %u\n,
-   eisa_slot12,ha-irq);
-
-if 
(request_irq(ha-irq,gdth_interrupt,IRQF_DISABLED,gdth,ha)) {
-printk(GDT-EISA: Unable to allocate IRQ\n);
-scsi_unregister(shp);
-continue;
-}
-shp-unchecked_isa_dma = 0;
-shp-irq = ha-irq;
-shp-dma_channel = 0xff;
-hanum = gdth_ctr_count;
-gdth_ctr_tab[gdth_ctr_count++] = shp;
-gdth_ctr_vtab[gdth_ctr_vcount++] = shp;
-
-NUMDATA(shp)-hanum = (ushort)hanum;
-NUMDATA(shp)-busnum= 0;
-TRACE2((EISA detect Bus 0: hanum %d\n,
-NUMDATA(shp)-hanum));
-
-ha-pccb = CMDDATA(shp);
-ha-ccb_phys = 0L; 
-
-ha-pdev = NULL;
-ha-pscratch = pci_alloc_consistent(ha-pdev, GDTH_SCRATCH, 
-scratch_dma_handle);
-ha-scratch_phys = scratch_dma_handle;
-ha-pmsg = pci_alloc_consistent(ha-pdev, 
sizeof(gdth_msg_str), 
-scratch_dma_handle);
-ha-msg_phys = scratch_dma_handle;
-#ifdef INT_COAL
-ha-coal_stat = (gdth_coal_status *)
-pci_alloc_consistent(ha-pdev, sizeof(gdth_coal_status) *
- MAXOFFSETS, scratch_dma_handle);
-ha-coal_stat_phys = scratch_dma_handle;
-#endif
-ha-ccb_phys = 
-pci_map_single(ha-pdev,ha-pccb,
-   sizeof(gdth_cmd_str),PCI_DMA_BIDIRECTIONAL);
-ha-scratch_busy = FALSE;
-ha-req_first = NULL;
-ha-tid_cnt = MAX_HDRIVES;
-if (max_ids  0  max_ids  ha-tid_cnt)
-ha-tid_cnt = max_ids;
-for (i=0; iGDTH_MAXCMDS; ++i)
-ha-cmd_tab[i].cmnd = UNUSED_CMND;
-ha-scan_mode = rescan ? 0x10 : 0;
-
-if (ha-pscratch == NULL || ha-pmsg == NULL || 
-!gdth_search_drives(hanum)) {
-printk(GDT-EISA: Error during device scan\n);
---gdth_ctr_count;
---gdth_ctr_vcount;
-#ifdef INT_COAL
-if (ha-coal_stat)
-pci_free_consistent(ha-pdev, sizeof(gdth_coal_status) 
*
-MAXOFFSETS, ha-coal_stat,
-ha-coal_stat_phys);
-#endif
-if (ha-pscratch)
-pci_free_consistent(ha-pdev, GDTH_SCRATCH, 
-ha-pscratch, ha-scratch_phys);
-if (ha-pmsg)
-pci_free_consistent(ha-pdev, sizeof(gdth_msg_str), 
-ha-pmsg, ha-msg_phys);
-if (ha-ccb_phys)
-pci_unmap_single(ha-pdev,ha-ccb_phys,
-

[PATCH 3/16] gdth: split out pci probing

2007-09-30 Thread Boaz Harrosh

Split out per-device pci probing and put it under proper CONFIG_PCI.

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |  287 +++---
 1 files changed, 155 insertions(+), 132 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 5240acd..882479b 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -482,6 +482,9 @@ static int gdth_isa_probe_one(struct scsi_host_template *, 
ulong32);
 #ifdef CONFIG_EISA
 static int gdth_eisa_probe_one(struct scsi_host_template *, ushort);
 #endif
+#ifdef CONFIG_PCI
+static int gdth_pci_probe_one(struct scsi_host_template *, gdth_pci_str *, 
int);
+#endif
 
 #ifdef DEBUG_GDTH
 static unchar   DebugState = DEBUG_GDTH;
@@ -4290,12 +4293,10 @@ static int __init gdth_detect(struct scsi_host_template 
*shtp)
 static int __init gdth_detect(Scsi_Host_Template *shtp)
 #endif
 {
-struct Scsi_Host *shp;
 gdth_pci_str pcistr[MAXHA];
-gdth_ha_str *ha;
 ulong32 isa_bios;
 ushort eisa_slot;
-int i,hanum,cnt,ctr,err;
+int cnt,ctr;
 unchar b;
 
  
@@ -4347,143 +4348,17 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
 }
 #endif
 
+#ifdef CONFIG_PCI
 /* scanning for PCI controllers */
 cnt = gdth_search_pci(pcistr);
 printk(GDT-HA: Found %d PCI Storage RAID Controllers\n,cnt);
 gdth_sort_pci(pcistr,cnt);
 for (ctr = 0; ctr  cnt; ++ctr) {
-dma_addr_t scratch_dma_handle;
-scratch_dma_handle = 0;
-
 if (gdth_ctr_count = MAXHA)
 break;
-shp = scsi_register(shtp,sizeof(gdth_ext_str));
-if (shp == NULL)
-continue;  
-
-ha = HADATA(shp);
-if (!gdth_init_pci(pcistr[ctr],ha)) {
-scsi_unregister(shp);
-continue;
-}
-/* controller found and initialized */
-printk(Configuring GDT-PCI HA at %d/%d IRQ %u\n,
-   pcistr[ctr].pdev-bus-number,
-  PCI_SLOT(pcistr[ctr].pdev-devfn), ha-irq);
-
-if (request_irq(ha-irq, gdth_interrupt,
-IRQF_DISABLED|IRQF_SHARED, gdth, ha))
-{
-printk(GDT-PCI: Unable to allocate IRQ\n);
-scsi_unregister(shp);
-continue;
-}
-shp-unchecked_isa_dma = 0;
-shp-irq = ha-irq;
-shp-dma_channel = 0xff;
-hanum = gdth_ctr_count;
-gdth_ctr_tab[gdth_ctr_count++] = shp;
-gdth_ctr_vtab[gdth_ctr_vcount++] = shp;
-
-NUMDATA(shp)-hanum = (ushort)hanum;
-NUMDATA(shp)-busnum= 0;
-
-ha-pccb = CMDDATA(shp);
-ha-ccb_phys = 0L;
-
-ha-pscratch = pci_alloc_consistent(ha-pdev, GDTH_SCRATCH, 
-scratch_dma_handle);
-ha-scratch_phys = scratch_dma_handle;
-ha-pmsg = pci_alloc_consistent(ha-pdev, sizeof(gdth_msg_str), 
-scratch_dma_handle);
-ha-msg_phys = scratch_dma_handle;
-#ifdef INT_COAL
-ha-coal_stat = (gdth_coal_status *)
-pci_alloc_consistent(ha-pdev, sizeof(gdth_coal_status) *
- MAXOFFSETS, scratch_dma_handle);
-ha-coal_stat_phys = scratch_dma_handle;
-#endif
-ha-scratch_busy = FALSE;
-ha-req_first = NULL;
-ha-tid_cnt = pcistr[ctr].pdev-device = 0x200 ? MAXID : MAX_HDRIVES;
-if (max_ids  0  max_ids  ha-tid_cnt)
-ha-tid_cnt = max_ids;
-for (i=0; iGDTH_MAXCMDS; ++i)
-ha-cmd_tab[i].cmnd = UNUSED_CMND;
-ha-scan_mode = rescan ? 0x10 : 0;
-
-err = FALSE;
-if (ha-pscratch == NULL || ha-pmsg == NULL || 
-!gdth_search_drives(hanum)) {
-err = TRUE;
-} else {
-if (hdr_channel  0 || hdr_channel  ha-bus_cnt)
-hdr_channel = ha-bus_cnt;
-ha-virt_bus = hdr_channel;
-
-
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,6,0)
-scsi_set_pci_device(shp, pcistr[ctr].pdev);
-#endif
-if (!(ha-cache_feat  ha-raw_feat  ha-screen_feat GDT_64BIT)||
-/* 64-bit DMA only supported from FW = x.43 */
-(!ha-dma64_support)) {
-if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) {
-printk(KERN_WARNING GDT-PCI %d: Unable to set 32-bit 
DMA\n, hanum);
-err = TRUE;
-}
-} else {
-shp-max_cmd_len = 16;
-if (!pci_set_dma_mask(pcistr[ctr].pdev, DMA_64BIT_MASK)) {
-printk(GDT-PCI %d: 64-bit DMA enabled\n, hanum);
-} else if (pci_set_dma_mask(pcistr[ctr].pdev, DMA_32BIT_MASK)) 
{
-printk(KERN_WARNING GDT-PCI %d: Unable to set 64/32-bit 
DMA\n, hanum);
-err = TRUE;
-}
-}
-}
-
-if (err) {
-printk(GDT-PCI %d: Error during device scan\n, hanum);
-

[PATCH 4/16] gdth: Remove 2.4.x support, in-kernel changelog

2007-09-30 Thread Boaz Harrosh

  * Remove in-source changelog.  It's archived permanently in git and
various kernel archives, and changelogs should exist purely in git.

  * Remove 2.4.x kernel support.  It is an active obstacle to
modernizing this driver, at this point.  This includes killing
gdth_kcompat.h which is 100% redundant in modern kernels.

  Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |  396 +--
 drivers/scsi/gdth.h |1 -
 drivers/scsi/gdth_kcompat.h |   31 
 drivers/scsi/gdth_proc.c|   27 ---
 4 files changed, 2 insertions(+), 453 deletions(-)
 delete mode 100644 drivers/scsi/gdth_kcompat.h

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 882479b..d0b2530 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -27,280 +27,8 @@
  * along with this kernel; if not, write to the Free Software   *
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.*
  *  *
- * Linux kernel 2.4.x, 2.6.x supported  *
+ * Linux kernel 2.6.x supported
*
  *  *
- * $Log: gdth.c,v $
- * Revision 1.74  2006/04/10 13:44:47  achim
- * Community changes for 2.6.x
- * Kernel 2.2.x no longer supported
- * scsi_request interface removed, thanks to Christoph Hellwig
- *
- * Revision 1.73  2004/03/31 13:33:03  achim
- * Special command 0xfd implemented to detect 64-bit DMA support
- *
- * Revision 1.72  2004/03/17 08:56:04  achim
- * 64-bit DMA only enabled if FW = x.43
- *
- * Revision 1.71  2004/03/05 15:51:29  achim
- * Screen service: separate message buffer, bugfixes
- *
- * Revision 1.70  2004/02/27 12:19:07  achim
- * Bugfix: Reset bit in config (0xfe) call removed
- *
- * Revision 1.69  2004/02/20 09:50:24  achim
- * Compatibility changes for kernels  2.4.20
- * Bugfix screen service command size
- * pci_set_dma_mask() error handling added
- *
- * Revision 1.68  2004/02/19 15:46:54  achim
- * 64-bit DMA bugfixes
- * Drive size bugfix for drives  1TB
- *
- * Revision 1.67  2004/01/14 13:11:57  achim
- * Tool access over /proc no longer supported
- * Bugfixes IOCTLs
- *
- * Revision 1.66  2003/12/19 15:04:06  achim
- * Bugfixes support for drives  2TB
- *
- * Revision 1.65  2003/12/15 11:21:56  achim
- * 64-bit DMA support added
- * Support for drives  2 TB implemented
- * Kernels 2.2.x, 2.4.x, 2.6.x supported
- *
- * Revision 1.64  2003/09/17 08:30:26  achim
- * EISA/ISA controller scan disabled
- * Command line switch probe_eisa_isa added
- *
- * Revision 1.63  2003/07/12 14:01:00  Daniele Bellucci [EMAIL PROTECTED]
- * Minor cleanups in gdth_ioctl.
- *
- * Revision 1.62  2003/02/27 15:01:59  achim
- * Dynamic DMA mapping implemented
- * New (character device) IOCTL interface added
- * Other controller related changes made
- *
- * Revision 1.61  2002/11/08 13:09:52  boji
- * Added support for XSCALE based RAID Controllers
- * Fixed SCREENSERVICE initialization in SMP cases
- * Added checks for gdth_polling before GDTH_HA_LOCK
- *
- * Revision 1.60  2002/02/05 09:35:22  achim
- * MODULE_LICENSE only if kernel = 2.4.11
- *
- * Revision 1.59  2002/01/30 09:46:33  achim
- * Small changes
- *
- * Revision 1.58  2002/01/29 15:30:02  achim
- * Set default value of shared_access to Y
- * New status S_CACHE_RESERV for clustering added
- *
- * Revision 1.57  2001/08/21 11:16:35  achim
- * Bugfix free_irq()
- *
- * Revision 1.56  2001/08/09 11:19:39  achim
- * Scsi_Host_Template changes
- *
- * Revision 1.55  2001/08/09 10:11:28  achim
- * Command HOST_UNFREEZE_IO before cache service init.
- *
- * Revision 1.54  2001/07/20 13:48:12  achim
- * Expand: gdth_analyse_hdrive() removed
- *
- * Revision 1.53  2001/07/17 09:52:49  achim
- * Small OEM related change
- *
- * Revision 1.52  2001/06/19 15:06:20  achim
- * New host command GDT_UNFREEZE_IO added
- *
- * Revision 1.51  2001/05/22 06:42:37  achim
- * PCI: Subdevice ID added
- *
- * Revision 1.50  2001/05/17 13:42:16  achim
- * Support for Intel Storage RAID Controllers added
- *
- * Revision 1.50  2001/05/17 12:12:34  achim
- * Support for Intel Storage RAID Controllers added
- *
- * Revision 1.49  2001/03/15 15:07:17  achim
- * New __setup interface for boot command line options added
- *
- * Revision 1.48  2001/02/06 12:36:28  achim
- * Bugfix Cluster protocol
- *
- * Revision 1.47  2001/01/10 14:42:06  achim
- * New switch shared_access added
- *
- * Revision 1.46  2001/01/09 08:11:35  achim
- * gdth_command() removed
- * meaning of Scsi_Pointer members changed
- *
- * Revision 1.45  2000/11/16 12:02:24  achim
- * Changes for kernel 2.4
- *
- * Revision 1.44  2000/10/11 08:44:10  achim
- * Clustering changes: New flag media_changed added
- *
- * Revision 1.43  2000/09/20 12:59:01  achim
- * DPMEM remap functions for all PCI controller types 

[PATCH 5/16] gdth: kill gdth_{read,write}[bwl] wrappers

2007-09-30 Thread Boaz Harrosh

  They are direct equivalents to {read,write}[bwl].

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |  313 +--
 1 files changed, 153 insertions(+), 160 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index d0b2530..c911ebc 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -303,13 +303,6 @@ static struct timer_list gdth_timer;
 
 #define BUS_L2P(a,b)((b)(a)-virt_bus ? (b-1):(b))
 
-#define gdth_readb(addr)readb(addr)
-#define gdth_readw(addr)readw(addr)
-#define gdth_readl(addr)readl(addr)
-#define gdth_writeb(b,addr) writeb((b),(addr))
-#define gdth_writew(b,addr) writew((b),(addr))
-#define gdth_writel(b,addr) writel((b),(addr))
-
 static unchar   gdth_drq_tab[4] = {5,6,7,7};/* DRQ table */
 static unchar   gdth_irq_tab[6] = {0,10,11,12,14,0};/* IRQ table */
 static unchar   gdth_polling;   /* polling if TRUE */
@@ -515,7 +508,7 @@ static int __init gdth_search_isa(ulong32 bios_adr)
 
 TRACE((gdth_search_isa() bios adr. %x\n,bios_adr));
 if ((addr = ioremap(bios_adr+BIOS_ID_OFFS, sizeof(ulong32))) != NULL) {
-id = gdth_readl(addr);
+id = readl(addr);
 iounmap(addr);
 if (id == GDT2_ID)  /* GDT2000 */
 return 1;
@@ -749,22 +742,22 @@ static int __init gdth_init_isa(ulong32 
bios_adr,gdth_ha_str *ha)
 return 0;
 }
 dp2_ptr = ha-brd;
-gdth_writeb(1, dp2_ptr-io.memlock); /* switch off write protection */
+writeb(1, dp2_ptr-io.memlock); /* switch off write protection */
 /* reset interface area */
 memset_io(dp2_ptr-u, 0, sizeof(dp2_ptr-u));
-if (gdth_readl(dp2_ptr-u) != 0) {
+if (readl(dp2_ptr-u) != 0) {
 printk(GDT-ISA: Initialization error (DPMEM write error)\n);
 iounmap(ha-brd);
 return 0;
 }
 
 /* disable board interrupts, read DRQ and IRQ */
-gdth_writeb(0xff, dp2_ptr-io.irqdel);
-gdth_writeb(0x00, dp2_ptr-io.irqen);
-gdth_writeb(0x00, dp2_ptr-u.ic.S_Status);
-gdth_writeb(0x00, dp2_ptr-u.ic.Cmd_Index);
+writeb(0xff, dp2_ptr-io.irqdel);
+writeb(0x00, dp2_ptr-io.irqen);
+writeb(0x00, dp2_ptr-u.ic.S_Status);
+writeb(0x00, dp2_ptr-u.ic.Cmd_Index);
 
-irq_drq = gdth_readb(dp2_ptr-io.rq);
+irq_drq = readb(dp2_ptr-io.rq);
 for (i=0; i3; ++i) {
 if ((irq_drq  1)==0)
 break;
@@ -772,7 +765,7 @@ static int __init gdth_init_isa(ulong32 
bios_adr,gdth_ha_str *ha)
 }
 ha-drq = gdth_drq_tab[i];
 
-irq_drq = gdth_readb(dp2_ptr-io.rq)  3;
+irq_drq = readb(dp2_ptr-io.rq)  3;
 for (i=1; i5; ++i) {
 if ((irq_drq  1)==0)
 break;
@@ -781,12 +774,12 @@ static int __init gdth_init_isa(ulong32 
bios_adr,gdth_ha_str *ha)
 ha-irq = gdth_irq_tab[i];
 
 /* deinitialize services */
-gdth_writel(bios_adr, dp2_ptr-u.ic.S_Info[0]);
-gdth_writeb(0xff, dp2_ptr-u.ic.S_Cmd_Indx);
-gdth_writeb(0, dp2_ptr-io.event);
+writel(bios_adr, dp2_ptr-u.ic.S_Info[0]);
+writeb(0xff, dp2_ptr-u.ic.S_Cmd_Indx);
+writeb(0, dp2_ptr-io.event);
 retries = INIT_RETRIES;
 gdth_delay(20);
-while (gdth_readb(dp2_ptr-u.ic.S_Status) != 0xff) {
+while (readb(dp2_ptr-u.ic.S_Status) != 0xff) {
 if (--retries == 0) {
 printk(GDT-ISA: Initialization error (DEINIT failed)\n);
 iounmap(ha-brd);
@@ -794,9 +787,9 @@ static int __init gdth_init_isa(ulong32 
bios_adr,gdth_ha_str *ha)
 }
 gdth_delay(1);
 }
-prot_ver = (unchar)gdth_readl(dp2_ptr-u.ic.S_Info[0]);
-gdth_writeb(0, dp2_ptr-u.ic.Status);
-gdth_writeb(0xff, dp2_ptr-io.irqdel);
+prot_ver = (unchar)readl(dp2_ptr-u.ic.S_Info[0]);
+writeb(0, dp2_ptr-u.ic.Status);
+writeb(0xff, dp2_ptr-io.irqdel);
 if (prot_ver != PROTOCOL_VERSION) {
 printk(GDT-ISA: Illegal protocol version\n);
 iounmap(ha-brd);
@@ -810,15 +803,15 @@ static int __init gdth_init_isa(ulong32 
bios_adr,gdth_ha_str *ha)
 ha-brd_phys = bios_adr  4;
 
 /* special request to controller BIOS */
-gdth_writel(0x00, dp2_ptr-u.ic.S_Info[0]);
-gdth_writel(0x00, dp2_ptr-u.ic.S_Info[1]);
-gdth_writel(0x01, dp2_ptr-u.ic.S_Info[2]);
-gdth_writel(0x00, dp2_ptr-u.ic.S_Info[3]);
-gdth_writeb(0xfe, dp2_ptr-u.ic.S_Cmd_Indx);
-gdth_writeb(0, dp2_ptr-io.event);
+writel(0x00, dp2_ptr-u.ic.S_Info[0]);
+writel(0x00, dp2_ptr-u.ic.S_Info[1]);
+writel(0x01, dp2_ptr-u.ic.S_Info[2]);
+writel(0x00, dp2_ptr-u.ic.S_Info[3]);
+writeb(0xfe, dp2_ptr-u.ic.S_Cmd_Indx);
+writeb(0, dp2_ptr-io.event);
 retries = INIT_RETRIES;
 gdth_delay(20);
-while (gdth_readb(dp2_ptr-u.ic.S_Status) != 0xfe) {
+while (readb(dp2_ptr-u.ic.S_Status) != 0xfe) {
 if (--retries == 0) {
 printk(GDT-ISA: Initialization error\n);
 iounmap(ha-brd);

[PATCH 6/16] Reorder scsi_host_template intitializers

2007-09-30 Thread Boaz Harrosh

  * shuffle scsi_host_template members such that they appear in the
order in which they are defined in the header.  this makes is easier
to verify when initializers are missing members.

  Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
  Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index c911ebc..4fa6609 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -4898,17 +4898,17 @@ static int gdth_slave_configure(struct scsi_device 
*sdev)
 }
 
 static struct scsi_host_template driver_template = {
-.proc_name  = gdth, 
-.proc_info  = gdth_proc_info,
 .name   = GDT SCSI Disk Array Controller,
 .detect = gdth_detect, 
 .release= gdth_release,
 .info   = gdth_info, 
 .queuecommand   = gdth_queuecommand,
 .eh_bus_reset_handler   = gdth_eh_bus_reset,
+.slave_configure= gdth_slave_configure,
 .bios_param = gdth_bios_param,
+.proc_info  = gdth_proc_info,
+.proc_name  = gdth,
 .can_queue  = GDTH_MAXCMDS,
-.slave_configure= gdth_slave_configure,
 .this_id= -1,
 .sg_tablesize   = GDTH_MAXSG,
 .cmd_per_lun= GDTH_MAXC_P_L,
-- 
1.5.3.1


-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 7/16] gdth: make some virt ctrlr code common

2007-09-30 Thread Boaz Harrosh

  * New function gdth_register_virt() replaces the three
basically-duplicate copies of virtual controller registration.

  Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
  Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |   80 ++-
 1 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 4fa6609..b31c5eb 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -3925,6 +3925,44 @@ int __init option_setup(char *str)
 return 1;
 }
 
+static int __init gdth_register_virt(struct scsi_host_template *shtp,
+gdth_ha_str *ha, int hanum,
+struct device *dev, bool isa_dma)
+{
+   struct Scsi_Host *shp;
+   unchar b;
+   int done = 0;
+
+   if (!virt_ctr)
+   return 0;
+
+   virt_ctr = 1;
+
+   /* register addit. SCSI channels as virtual controllers */
+   for (b = 1; b  ha-bus_cnt + 1; ++b) {
+   shp = scsi_register(shtp, sizeof(gdth_num_str));
+
+   if (isa_dma) {
+   shp-unchecked_isa_dma = 1;
+   shp-dma_channel = ha-drq;
+   } else {
+   shp-unchecked_isa_dma = 0;
+   shp-dma_channel = 0xff;
+   }
+
+   shp-irq = ha-irq;
+
+   gdth_push_vshp(shp);
+
+   NUMDATA(shp)-hanum = (ushort)hanum;
+   NUMDATA(shp)-busnum = b;
+
+   done++;
+   }
+
+   return done ? 0 : -ENODEV;
+}
+
 
 static int __init gdth_detect(struct scsi_host_template *shtp)
 {
@@ -5017,19 +5055,7 @@ static int gdth_isa_probe_one(struct scsi_host_template 
*shtp, ulong32 isa_bios)
shp-max_id  = ha-tid_cnt;
shp-max_lun = MAXLUN;
shp-max_channel = virt_ctr ? 0 : ha-bus_cnt;
-   if (virt_ctr) {
-   virt_ctr = 1;
-   /* register addit. SCSI channels as virtual controllers */
-   for (b = 1; b  ha-bus_cnt + 1; ++b) {
-   shp = scsi_register(shtp,sizeof(gdth_num_str));
-   shp-unchecked_isa_dma = 1;
-   shp-irq = ha-irq;
-   shp-dma_channel = ha-drq;
-   gdth_ctr_vtab[gdth_ctr_vcount++] = shp;
-   NUMDATA(shp)-hanum = (ushort)hanum;
-   NUMDATA(shp)-busnum = b;
-   }
-   }
+   gdth_register_virt(shtp, ha, hanum, NULL, true);
 
spin_lock_init(ha-smp_lock);
gdth_enable_int(hanum);
@@ -5159,19 +5185,7 @@ static int gdth_eisa_probe_one(struct scsi_host_template 
*shtp,
shp-max_id  = ha-tid_cnt;
shp-max_lun = MAXLUN;
shp-max_channel = virt_ctr ? 0 : ha-bus_cnt;
-   if (virt_ctr) {
-   virt_ctr = 1;
-   /* register addit. SCSI channels as virtual controllers */
-   for (b = 1; b  ha-bus_cnt + 1; ++b) {
-   shp = scsi_register(shtp,sizeof(gdth_num_str));
-   shp-unchecked_isa_dma = 0;
-   shp-irq = ha-irq;
-   shp-dma_channel = 0xff;
-   gdth_ctr_vtab[gdth_ctr_vcount++] = shp;
-   NUMDATA(shp)-hanum = (ushort)hanum;
-   NUMDATA(shp)-busnum = b;
-   }
-   }
+   gdth_register_virt(shtp, ha, hanum, NULL, false);
 
spin_lock_init(ha-smp_lock);
gdth_enable_int(hanum);
@@ -5310,19 +5324,7 @@ static int gdth_pci_probe_one(struct scsi_host_template 
*shtp,
shp-max_id  = ha-tid_cnt;
shp-max_lun = MAXLUN;
shp-max_channel = virt_ctr ? 0 : ha-bus_cnt;
-   if (virt_ctr) {
-   virt_ctr = 1;
-   /* register addit. SCSI channels as virtual controllers */
-   for (b = 1; b  ha-bus_cnt + 1; ++b) {
-   shp = scsi_register(shtp,sizeof(gdth_num_str));
-   shp-unchecked_isa_dma = 0;
-   shp-irq = ha-irq;
-   shp-dma_channel = 0xff;
-   gdth_ctr_vtab[gdth_ctr_vcount++] = shp;
-   NUMDATA(shp)-hanum = (ushort)hanum;
-   NUMDATA(shp)-busnum = b;
-   }
-   }
+   gdth_register_virt(shtp, ha, hanum, pcistr[ctr].pdev-dev, false);
 
spin_lock_init(ha-smp_lock);
gdth_enable_int(hanum);
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 8/16] gdth: Remove virt hosts

2007-09-30 Thread Boaz Harrosh

The virt_ctr option allows to register a new scsi_host for each bus
on the raid controller.  This non-default option makes no sense with
the current scsi code and prevents cleaning up the host registration,
so remove it.

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]

---
 drivers/scsi/gdth.c  |   90 ++---
 drivers/scsi/gdth_proc.c |   28 ++-
 drivers/scsi/gdth_proc.h |4 +-
 3 files changed, 25 insertions(+), 97 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index b31c5eb..4cda6a6 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -56,8 +56,6 @@
  * max_ids:xx - target ID count per channel (1..MAXID)
  * rescan:Y rescan all channels/IDs 
  * rescan:N use all devices found until now
- * virt_ctr:Y   map every channel to a virtual controller 
- * virt_ctr:N   use multi channel support 
  * hdr_channel:xx - number of virtual bus for host drives
  * shared_access:Y  disable driver reserve/release protocol to 
  *  access a shared resource from several nodes, 
@@ -69,7 +67,7 @@
  * force_dma32:Nuse 64 bit DMA mode, if supported
  *
  * The default values are: gdth=disable:N,reserve_mode:1,reverse_scan:N,
- *  max_ids:127,rescan:N,virt_ctr:N,hdr_channel:0,
+ *  max_ids:127,rescan:N,hdr_channel:0,
  *  shared_access:Y,probe_eisa_isa:N,force_dma32:N.
  * Here is another example: gdth=reserve_list:0,1,2,0,0,1,3,0,rescan:Y.
  * 
@@ -80,7 +78,7 @@
  * '1' in place of 'Y' and '0' in place of 'N'.
  * 
  * Default: modprobe gdth disable=0 reserve_mode=1 reverse_scan=0
- *   max_ids=127 rescan=0 virt_ctr=0 hdr_channel=0 shared_access=0 
+ *   max_ids=127 rescan=0 hdr_channel=0 shared_access=0
  *   probe_eisa_isa=0 force_dma32=0
  * The other example: modprobe gdth reserve_list=0,1,2,0,0,1,3,0 rescan=1.
  */
@@ -309,10 +307,8 @@ static unchar   gdth_polling;   /* 
polling if TRUE */
 static unchar   gdth_from_wait  = FALSE;/* gdth_wait() */
 static int  wait_index,wait_hanum;  /* gdth_wait() */
 static int  gdth_ctr_count  = 0;/* controller count */
-static int  gdth_ctr_vcount = 0;/* virt. ctr. count */
 static int  gdth_ctr_released = 0;  /* gdth_release() */
 static struct Scsi_Host *gdth_ctr_tab[MAXHA];   /* controller table */
-static struct Scsi_Host *gdth_ctr_vtab[MAXHA*MAXBUS];   /* virt. ctr. table */
 static unchar   gdth_write_through = FALSE; /* write through */
 static gdth_evt_str ebuffer[MAX_EVENTS];/* event buffer */
 static int elastidx;
@@ -364,8 +360,6 @@ static int hdr_channel = 0;
 static int max_ids = MAXID;
 /* rescan all IDs */
 static int rescan = 0;
-/* map channels to virtual controllers */
-static int virt_ctr = 0;
 /* shared access */
 static int shared_access = 1;
 /* enable support for EISA and ISA controllers */
@@ -382,7 +376,6 @@ module_param(reverse_scan, int, 0);
 module_param(hdr_channel, int, 0);
 module_param(max_ids, int, 0);
 module_param(rescan, int, 0);
-module_param(virt_ctr, int, 0);
 module_param(shared_access, int, 0);
 module_param(probe_eisa_isa, int, 0);
 module_param(force_dma32, int, 0);
@@ -2012,7 +2005,7 @@ static void gdth_putq(int hanum,Scsi_Cmnd *scp,unchar 
priority)
 
 if (scp-done != gdth_scsi_done) {
 scp-SCp.this_residual = (int)priority;
-b = virt_ctr ? NUMDATA(scp-device-host)-busnum:scp-device-channel;
+b = scp-device-channel;
 t = scp-device-id;
 if (priority = DEFAULT_PRI) {
 if ((b != ha-virt_bus  ha-raw[BUS_L2P(ha,b)].lock) ||
@@ -2074,8 +2067,7 @@ static void gdth_next(int hanum)
 if (nscp != pscp  nscp != (Scsi_Cmnd *)pscp-SCp.ptr)
 pscp = (Scsi_Cmnd *)pscp-SCp.ptr;
 if (nscp-done != gdth_scsi_done) {
-b = virt_ctr ?
-NUMDATA(nscp-device-host)-busnum : nscp-device-channel;
+b = nscp-device-channel;
 t = nscp-device-id;
 l = nscp-device-lun;
 if (nscp-SCp.this_residual = DEFAULT_PRI) {
@@ -3391,7 +3383,7 @@ static int gdth_sync_event(int hanum,int service,unchar 
index,Scsi_Cmnd *scp)
 printk(\n);
 
 } else {
-b = virt_ctr ? NUMDATA(scp-device-host)-busnum : 
scp-device-channel;
+b = scp-device-channel;
 t = scp-device-id;
 if (scp-SCp.sent_command == -1  b != ha-virt_bus) {
 ha-raw[BUS_L2P(ha,b)].io_cnt[t]--;
@@ -3877,8 +3869,6 @@ static void __init internal_setup(char *str,int *ints)
 max_ids = val;
 else if (!strncmp(argv, rescan:, 7))
 rescan = 

[PATCH 10/16] gdth: gdth_get_status() return pointer to host not its index

2007-09-30 Thread Boaz Harrosh

  - Return the interrupting host and not it's index.
NULL if intr is not by gdth.
  - fix calling site

  FIXME:
   Why are we looping on all cards? the passed dev_id
   can be used for pinpointing the exact interrupting
   card. The kernel is already looping on all sharing
   cards so this code makes it O(n^2).
   What is that polling mode? can we pass dev_id to
   gdth_get_status() and do a poll only if dev_id is
   NULL?

Signed-off-by Boaz Harrosh [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |   26 +++---
 1 files changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 6fa7e27..b08bea3 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -171,7 +171,7 @@ static int gdth_init_isa(ulong32 bios_adr,gdth_ha_str *ha);
 static int gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha);
 
 static void gdth_enable_int(gdth_ha_str *ha);
-static int gdth_get_status(unchar *pIStatus,int irq);
+static gdth_ha_str *gdth_get_status(unchar *pIStatus, int irq);
 static int gdth_test_busy(gdth_ha_str *ha);
 static int gdth_get_cmd_index(gdth_ha_str *ha);
 static void gdth_release_event(gdth_ha_str *ha);
@@ -1240,17 +1240,15 @@ static void __init gdth_enable_int(gdth_ha_str *ha)
 }
 
 
-static int gdth_get_status(unchar *pIStatus,int irq)
+static gdth_ha_str *gdth_get_status(unchar *pIStatus, int irq)
 {
 register gdth_ha_str *ha;
-int i;
 
 TRACE((gdth_get_status() irq %d ctr_count %d\n,
irq,gdth_ctr_count));
 
 *pIStatus = 0;
-for (i=0; igdth_ctr_count; ++i) {
-ha = shost_priv(gdth_ctr_tab[i]);
+list_for_each_entry(ha, gdth_instances, list) {
 if (ha-irq != (unchar)irq) /* check IRQ */
 continue;
 if (ha-type == GDT_EISA)
@@ -1268,12 +1266,11 @@ static int gdth_get_status(unchar *pIStatus,int irq)
 readb(((gdt6m_dpram_str __iomem *)ha-brd)-i960r.edoor_reg);

 if (*pIStatus)  
-return i;   /* board found */
+return ha;   /* board found */
 }
-return -1;
+return NULL;
 }
- 
-
+
 static int gdth_test_busy(gdth_ha_str *ha)
 {
 register int gdtsema0 = 0;
@@ -3012,7 +3009,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id)
 gdt6_dpram_str __iomem *dp6_ptr;
 gdt2_dpram_str __iomem *dp2_ptr;
 Scsi_Cmnd *scp;
-int hanum, rval, i;
+int rval, i;
 unchar IStatus;
 ushort Service;
 ulong flags = 0;
@@ -3037,13 +3034,12 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id)
 wait_index = 0;
 
 /* search controller */
-if ((hanum = gdth_get_status(IStatus,irq)) == -1) {
+if ((ha = gdth_get_status(IStatus,irq)) == NULL) {
 /* spurious interrupt */
 if (!gdth_polling)
 spin_unlock_irqrestore(ha2-smp_lock, flags);
 return IRQ_HANDLED;
 }
-ha = shost_priv(gdth_ctr_tab[hanum]);
 
 #ifdef GDTH_STATISTICS
 ++act_ints;
@@ -3183,7 +3179,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id)
IStatus,ha-status,ha-info));
 
 if (gdth_from_wait) {
-wait_hanum = hanum;
+wait_hanum = ha-hanum;
 wait_index = (int)IStatus;
 }
 
@@ -3199,7 +3195,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id)
 if (IStatus == SPEZINDEX) {
 TRACE2((Service unknown or not initialized !\n));
 ha-dvr.size = sizeof(ha-dvr.eu.driver);
-ha-dvr.eu.driver.ionode = hanum;
+ha-dvr.eu.driver.ionode = ha-hanum;
 gdth_store_event(ha, ES_DRIVER, 4, ha-dvr);
 if (!gdth_polling)
 spin_unlock_irqrestore(ha2-smp_lock, flags);
@@ -3211,7 +3207,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id)
 if (scp == UNUSED_CMND) {
 TRACE2((gdth_interrupt() index to unused command 
(%d)\n,IStatus));
 ha-dvr.size = sizeof(ha-dvr.eu.driver);
-ha-dvr.eu.driver.ionode = hanum;
+ha-dvr.eu.driver.ionode = ha-hanum;
 ha-dvr.eu.driver.index = IStatus;
 gdth_store_event(ha, ES_DRIVER, 1, ha-dvr);
 if (!gdth_polling)
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 11/16] gdth: switch to modern scsi host registration

2007-09-30 Thread Boaz Harrosh

  - Use scsi_add_host and friends and track instances ourselves. And
generally modernize the driver's structure.

  - TODO: Next we can remove the controller table
  - TODO: Fix use of deprecated pci_find_device()

Signed-off-by: Christoph Hellwig [EMAIL PROTECTED]
Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |  314 +--
 drivers/scsi/gdth.h |1 +
 2 files changed, 153 insertions(+), 162 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index b08bea3..986bfaf 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -119,6 +119,7 @@
 #include linux/time.h
 #include linux/timer.h
 #include linux/dma-mapping.h
+#include linux/list.h
 
 #ifdef GDTH_RTC
 #include linux/mc146818rtc.h
@@ -192,15 +193,6 @@ static void gdth_flush(gdth_ha_str *ha);
 static int gdth_halt(struct notifier_block *nb, ulong event, void *buf);
 static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *));
 static void gdth_scsi_done(struct scsi_cmnd *scp);
-#ifdef CONFIG_ISA
-static int gdth_isa_probe_one(struct scsi_host_template *, ulong32);
-#endif
-#ifdef CONFIG_EISA
-static int gdth_eisa_probe_one(struct scsi_host_template *, ushort);
-#endif
-#ifdef CONFIG_PCI
-static int gdth_pci_probe_one(struct scsi_host_template *, gdth_pci_str *, 
int);
-#endif
 
 #ifdef DEBUG_GDTH
 static unchar   DebugState = DEBUG_GDTH;
@@ -304,8 +296,8 @@ static unchar   gdth_polling;   /* 
polling if TRUE */
 static unchar   gdth_from_wait  = FALSE;/* gdth_wait() */
 static int  wait_index,wait_hanum;  /* gdth_wait() */
 static int  gdth_ctr_count  = 0;/* controller count */
-static int  gdth_ctr_released = 0;  /* gdth_release() */
 static struct Scsi_Host *gdth_ctr_tab[MAXHA];   /* controller table */
+static LIST_HEAD(gdth_instances);
 static unchar   gdth_write_through = FALSE; /* write through */
 static gdth_evt_str ebuffer[MAX_EVENTS];/* event buffer */
 static int elastidx;
@@ -3869,143 +3861,6 @@ int __init option_setup(char *str)
 return 1;
 }
 
-static int __init gdth_detect(struct scsi_host_template *shtp)
-{
-gdth_pci_str pcistr[MAXHA];
-ulong32 isa_bios;
-ushort eisa_slot;
-int cnt,ctr;
-unchar b;
-
- 
-#ifdef DEBUG_GDTH
-printk(GDT: This driver contains debugging information !! Trace level = 
%d\n,
-DebugState);
-printk( Destination of debugging information: );
-#ifdef __SERIAL__
-#ifdef __COM2__
-printk(Serial port COM2\n);
-#else
-printk(Serial port COM1\n);
-#endif
-#else
-printk(Console\n);
-#endif
-gdth_delay(3000);
-#endif
-
-TRACE((gdth_detect()\n));
-
-if (disable) {
-printk(GDT-HA: Controller driver disabled from command line !\n);
-return 0;
-}
-
-printk(GDT-HA: Storage RAID Controller Driver. Version: 
%s\n,GDTH_VERSION_STR);
-/* initializations */
-gdth_polling = TRUE; b = 0;
-gdth_clear_events();
-
-/* As default we do not probe for EISA or ISA controllers */
-if (probe_eisa_isa) {
-/* scanning for controllers, at first: ISA controller */
-#ifdef CONFIG_ISA
-for (isa_bios = 0xc8000UL; isa_bios = 0xd8000UL;
- isa_bios += 0x8000UL) {
-if (gdth_ctr_count = MAXHA)
-break;
-gdth_isa_probe_one(shtp, isa_bios);
-}
-#endif
-#ifdef CONFIG_EISA
-for (eisa_slot = 0x1000; eisa_slot = 0x8000; eisa_slot += 0x1000) {
-if (gdth_ctr_count = MAXHA)
-break;
-gdth_eisa_probe_one(shtp, eisa_slot);
-}
-}
-#endif
-
-#ifdef CONFIG_PCI
-/* scanning for PCI controllers */
-cnt = gdth_search_pci(pcistr);
-printk(GDT-HA: Found %d PCI Storage RAID Controllers\n,cnt);
-gdth_sort_pci(pcistr,cnt);
-for (ctr = 0; ctr  cnt; ++ctr) {
-if (gdth_ctr_count = MAXHA)
-break;
-gdth_pci_probe_one(shtp, pcistr, ctr);
-}
-#endif
-
-TRACE2((gdth_detect() %d controller detected\n,gdth_ctr_count));
-if (gdth_ctr_count  0) {
-#ifdef GDTH_STATISTICS
-TRACE2((gdth_detect(): Initializing timer !\n));
-init_timer(gdth_timer);
-gdth_timer.expires = jiffies + HZ;
-gdth_timer.data = 0L;
-gdth_timer.function = gdth_timeout;
-add_timer(gdth_timer);
-#endif
-major = register_chrdev(0,gdth,gdth_fops);
-notifier_disabled = 0;
-register_reboot_notifier(gdth_notifier);
-}
-gdth_polling = FALSE;
-return gdth_ctr_count;
-}
-
-static int gdth_release(struct Scsi_Host *shp)
-{
-gdth_ha_str *ha = shost_priv(shp);
-
-TRACE2((gdth_release()\n));
-if (ha-sdev) {
-scsi_free_host_dev(ha-sdev);
-ha-sdev = NULL;
-}
-gdth_flush(ha);
-
-if (shp-irq) {
-free_irq(shp-irq,ha);
-

[PATCH 12/16] gdth: Remove gdth_ctr_tab[]

2007-09-30 Thread Boaz Harrosh

  - Places like Initialization and Reset that Just loop on all devices can
use the link list with the list_for_each_entry macro.
But the io_ctrl from user mode now suffers performance-wise because
code has to do a sequential search for the requested host number.
I have isolated this search in a gdth_find_ha(int hanum) member
for future enhancement if needed.

Signed-off-by Boaz Harrosh [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |  109 ---
 1 files changed, 51 insertions(+), 58 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 986bfaf..0ae330d 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -296,8 +296,7 @@ static unchar   gdth_polling;   /* 
polling if TRUE */
 static unchar   gdth_from_wait  = FALSE;/* gdth_wait() */
 static int  wait_index,wait_hanum;  /* gdth_wait() */
 static int  gdth_ctr_count  = 0;/* controller count */
-static struct Scsi_Host *gdth_ctr_tab[MAXHA];   /* controller table */
-static LIST_HEAD(gdth_instances);
+static LIST_HEAD(gdth_instances);   /* controller list */
 static unchar   gdth_write_through = FALSE; /* write through */
 static gdth_evt_str ebuffer[MAX_EVENTS];/* event buffer */
 static int elastidx;
@@ -387,6 +386,17 @@ static struct notifier_block gdth_notifier = {
 };
 static int notifier_disabled = 0;
 
+static gdth_ha_str *gdth_find_ha(int hanum)
+{
+   gdth_ha_str *ha;
+
+   list_for_each_entry(ha, gdth_instances, list)
+   if (hanum == ha-hanum)
+   return ha;
+
+   return NULL;
+}
+
 static void gdth_delay(int milliseconds)
 {
 if (milliseconds == 0) {
@@ -3752,7 +3762,7 @@ static void gdth_timeout(ulong data)
 gdth_ha_str *ha;
 ulong flags;
 
-ha = shost_priv(gdth_ctr_tab[0]);
+ha = list_first_entry(gdth_instances, gdth_ha_str, list);
 spin_lock_irqsave(ha-smp_lock, flags);
 
 for (act_stats=0,i=0; iGDTH_MAXCMDS; ++i) 
@@ -4011,12 +4021,10 @@ static int gdth_queuecommand(Scsi_Cmnd *scp,void 
(*done)(Scsi_Cmnd *))
 static int gdth_open(struct inode *inode, struct file *filep)
 {
 gdth_ha_str *ha;
-int i;
 
-for (i = 0; i  gdth_ctr_count; i++) {
-ha = shost_priv(gdth_ctr_tab[i]);
+list_for_each_entry(ha, gdth_instances, list) {
 if (!ha-sdev)
-ha-sdev = scsi_get_host_dev(gdth_ctr_tab[i]);
+ha-sdev = scsi_get_host_dev(ha-shost);
 }
 
 TRACE((gdth_open()\n));
@@ -4035,10 +4043,11 @@ static int ioc_event(void __user *arg)
 gdth_ha_str *ha;
 ulong flags;
 
-if (copy_from_user(evt, arg, sizeof(gdth_ioctl_event)) ||
-evt.ionode = gdth_ctr_count)
+if (copy_from_user(evt, arg, sizeof(gdth_ioctl_event)))
+return -EFAULT;
+ha = gdth_find_ha(evt.ionode);
+if (!ha)
 return -EFAULT;
-ha = shost_priv(gdth_ctr_tab[evt.ionode]);
 
 if (evt.erase == 0xff) {
 if (evt.event.event_source == ES_TEST)
@@ -4072,11 +4081,12 @@ static int ioc_lockdrv(void __user *arg)
 ulong flags;
 gdth_ha_str *ha;
 
-if (copy_from_user(ldrv, arg, sizeof(gdth_ioctl_lockdrv)) ||
-ldrv.ionode = gdth_ctr_count)
+if (copy_from_user(ldrv, arg, sizeof(gdth_ioctl_lockdrv)))
 return -EFAULT;
-ha = shost_priv(gdth_ctr_tab[ldrv.ionode]);
- 
+ha = gdth_find_ha(ldrv.ionode);
+if (!ha)
+return -EFAULT;
+
 for (i = 0; i  ldrv.drive_cnt  i  MAX_HDRIVES; ++i) {
 j = ldrv.drives[i];
 if (j = MAX_HDRIVES || !ha-hdr[j].present)
@@ -4106,9 +4116,11 @@ static int ioc_resetdrv(void __user *arg, char *cmnd)
 int rval;
 
 if (copy_from_user(res, arg, sizeof(gdth_ioctl_reset)) ||
-res.ionode = gdth_ctr_count || res.number = MAX_HDRIVES)
+res.number = MAX_HDRIVES)
+return -EFAULT;
+ha = gdth_find_ha(res.ionode);
+if (!ha)
 return -EFAULT;
-ha = shost_priv(gdth_ctr_tab[res.ionode]);
 
 if (!ha-hdr[res.number].present)
 return 0;
@@ -4137,11 +4149,12 @@ static int ioc_general(void __user *arg, char *cmnd)
 ulong64 paddr; 
 gdth_ha_str *ha;
 int rval;
-
-if (copy_from_user(gen, arg, sizeof(gdth_ioctl_general)) ||
-gen.ionode = gdth_ctr_count)
+
+if (copy_from_user(gen, arg, sizeof(gdth_ioctl_general)))
+return -EFAULT;
+ha = gdth_find_ha(gen.ionode);
+if (!ha)
 return -EFAULT;
-ha = shost_priv(gdth_ctr_tab[gen.ionode]);
 if (gen.data_len + gen.sense_len != 0) {
 if (!(buf = gdth_ioctl_alloc(ha, gen.data_len + gen.sense_len,
  FALSE, paddr)))
@@ -4261,11 +4274,10 @@ static int ioc_hdrlist(void __user *arg, char *cmnd)
 goto free_fail;
 
 if (copy_from_user(rsc, arg, sizeof(gdth_ioctl_rescan)) ||
-rsc-ionode = gdth_ctr_count) {
+ 

[PATCH 13/16] gdth: Make one abuse of scsi_cmnd less obvious

2007-09-30 Thread Boaz Harrosh

  Rather than having internal commands abuse scsi_done to call
  gdth_scsi_done, have all the places that use to call scsi_done directly
  call gdth_scsi_done, which now checks whether the command was internal,
  and calls scsi_done if not.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Boaz Harrosh [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |   33 ++---
 1 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 0ae330d..01155f8 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -408,10 +408,12 @@ static void gdth_delay(int milliseconds)
 
 static void gdth_scsi_done(struct scsi_cmnd *scp)
 {
-TRACE2((gdth_scsi_done()\n));
+   TRACE2((gdth_scsi_done()\n));
 
-if (scp-request)
-complete((struct completion *)scp-request);
+   if (scp-done == gdth_scsi_done)
+   complete((struct completion *)scp-request);
+   else
+   scp-scsi_done(scp);
 }
 
 int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd,
@@ -433,8 +435,8 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str 
*gdtcmd, char *cmnd,
 scp-cmd_len = 12;
 memcpy(scp-cmnd, cmnd, 12);
 scp-SCp.this_residual = IOCTL_PRI;   /* priority */
-scp-done = gdth_scsi_done; /* some fn. test this */
-gdth_queuecommand(scp, gdth_scsi_done);
+scp-done = gdth_scsi_done;
+gdth_queuecommand(scp, NULL);
 wait_for_completion(wait);
 
 rval = scp-SCp.Status;
@@ -2122,7 +2124,7 @@ static void gdth_next(gdth_ha_str *ha)
 if (!nscp-SCp.have_data_in)
 nscp-SCp.have_data_in++;
 else
-nscp-scsi_done(nscp);
+gdth_scsi_done(nscp);
 }
 } else if (nscp-done == gdth_scsi_done) {
 if (!(cmd_index=gdth_special_cmd(ha, nscp)))
@@ -2141,7 +2143,7 @@ static void gdth_next(gdth_ha_str *ha)
 if (!nscp-SCp.have_data_in)
 nscp-SCp.have_data_in++;
 else
-nscp-scsi_done(nscp);
+gdth_scsi_done(nscp);
 } else {
 switch (nscp-cmnd[0]) {
   case TEST_UNIT_READY:
@@ -2167,9 +2169,9 @@ static void gdth_next(gdth_ha_str *ha)
 if (!nscp-SCp.have_data_in)
 nscp-SCp.have_data_in++;
 else
-nscp-scsi_done(nscp);
+gdth_scsi_done(nscp);
 } else if (gdth_internal_cache_cmd(ha, nscp))
-nscp-scsi_done(nscp);
+gdth_scsi_done(nscp);
 break;
 
   case ALLOW_MEDIUM_REMOVAL:
@@ -2183,7 +2185,7 @@ static void gdth_next(gdth_ha_str *ha)
 if (!nscp-SCp.have_data_in)
 nscp-SCp.have_data_in++;
 else
-nscp-scsi_done(nscp);
+gdth_scsi_done(nscp);
 } else {
 nscp-cmnd[3] = (ha-hdr[t].devtype1) ? 1:0;
 TRACE((Prevent/allow r. %d rem. drive %d\n,
@@ -2219,7 +2221,7 @@ static void gdth_next(gdth_ha_str *ha)
 if (!nscp-SCp.have_data_in)
 nscp-SCp.have_data_in++;
 else
-nscp-scsi_done(nscp);
+gdth_scsi_done(nscp);
 } else if (!(cmd_index=gdth_fill_cache_cmd(ha, nscp, t)))
 this_cmd = FALSE;
 break;
@@ -2234,7 +2236,7 @@ static void gdth_next(gdth_ha_str *ha)
 if (!nscp-SCp.have_data_in)
 nscp-SCp.have_data_in++;
 else
-nscp-scsi_done(nscp);
+gdth_scsi_done(nscp);
 break;
 }
 }
@@ -3230,7 +3232,7 @@ static irqreturn_t gdth_interrupt(int irq,void *dev_id)
 if (rval == 2) {
 gdth_putq(ha, scp,scp-SCp.this_residual);
 } else if (rval == 1) {
-scp-scsi_done(scp);
+gdth_scsi_done(scp);
 }
 
 #ifdef INT_COAL
@@ -3988,14 +3990,15 @@ static int gdth_bios_param(struct scsi_device 
*sdev,struct block_device *bdev,se
 }
 
 
-static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *))
+static int gdth_queuecommand(struct scsi_cmnd *scp,
+   void (*done)(struct scsi_cmnd *))
 {
 gdth_ha_str *ha = shost_priv(scp-device-host);
 int priority;
 
 TRACE((gdth_queuecommand() cmd 0x%x\n, scp-cmnd[0]));
 
-scp-scsi_done = (void *)done;
+scp-scsi_done = done;
 scp-SCp.have_data_in = 1;
 scp-SCp.phase = -1;
 scp-SCp.sent_command = -1;
-- 
1.5.3.1


-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 14/16] gdth: Setup proper per-command private data

2007-09-30 Thread Boaz Harrosh

  - scsi_cmnd and specifically -SCp of, where heavily abused
with internal meaning members and flags. So introduce a new
struct gdth_cmndinfo, put it on -host_scribble and define a
gdth_cmnd_priv() accessor to retrieve it from a scsi_cmnd.

  - The structure now holds two members:
internal_command - replaces the scp-done == gdth_scsi_done croft.
sense_paddr - which was a 64-bit spanning on 2 32-bit members of SCp.
More overloaded members from SCp and scsi_cmnd will be moved in a later
patch (For easy review).

  - Split up gdth_queuecommand to an additional internal_function. The later
is the one called by gdth_execute(). This will be more evident later in
the scsi accessors patch, but it also facilitates in the differentiation
between internal_command and external. And the setup of gdth_cmndinfo of
each command.

  Matthew: scp-done is no longer used anywhere in this driver.

Signed-off-by Boaz Harrosh [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c  |  108 -
 drivers/scsi/gdth.h  |   10 
 drivers/scsi/gdth_proc.c |6 ++-
 3 files changed, 91 insertions(+), 33 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 01155f8..860753b 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -86,8 +86,8 @@
 /* The meaning of the Scsi_Pointer members in this driver is as follows:
  * ptr: Chaining
  * this_residual:   Command priority
- * buffer:  phys. DMA sense buffer 
- * dma_handle:  phys. DMA buffer (kernel = 2.4.0)
+ * buffer:  unused
+ * dma_handle:  will drop in !use_sg patch.
  * buffers_residual:Timeout value
  * Status:  Command status (gdth_do_cmd()), DMA mem. mappings
  * Message: Additional info (gdth_do_cmd()), DMA direction
@@ -192,6 +192,8 @@ static int gdth_ioctl(struct inode *inode, struct file 
*filep,
 static void gdth_flush(gdth_ha_str *ha);
 static int gdth_halt(struct notifier_block *nb, ulong event, void *buf);
 static int gdth_queuecommand(Scsi_Cmnd *scp,void (*done)(Scsi_Cmnd *));
+static int __gdth_queuecommand(gdth_ha_str *ha, struct scsi_cmnd *scp,
+   struct gdth_cmndinfo *cmndinfo);
 static void gdth_scsi_done(struct scsi_cmnd *scp);
 
 #ifdef DEBUG_GDTH
@@ -397,6 +399,34 @@ static gdth_ha_str *gdth_find_ha(int hanum)
return NULL;
 }
 
+static struct gdth_cmndinfo *gdth_get_cmndinfo(gdth_ha_str *ha)
+{
+   struct gdth_cmndinfo *priv = NULL;
+   ulong flags;
+   int i;
+
+   spin_lock_irqsave(ha-smp_lock, flags);
+
+   for (i=0; iGDTH_MAXCMDS; ++i) {
+   if (ha-cmndinfo[i].index == 0) {
+   priv = ha-cmndinfo[i];
+   priv-index = i;
+   memset(priv, 0, sizeof(*priv));
+   break;
+   }
+   }
+
+   spin_unlock_irqrestore(ha-smp_lock, flags);
+
+   return priv;
+}
+
+static void gdth_put_cmndinfo(struct gdth_cmndinfo *priv)
+{
+   BUG_ON(!priv);
+   priv-index = 0;
+}
+
 static void gdth_delay(int milliseconds)
 {
 if (milliseconds == 0) {
@@ -408,9 +438,15 @@ static void gdth_delay(int milliseconds)
 
 static void gdth_scsi_done(struct scsi_cmnd *scp)
 {
+   struct gdth_cmndinfo *priv = gdth_cmnd_priv(scp);
+   int internal_command = priv-internal_command;
+
TRACE2((gdth_scsi_done()\n));
 
-   if (scp-done == gdth_scsi_done)
+   gdth_put_cmndinfo(priv);
+   scp-host_scribble = NULL;
+
+   if (internal_command)
complete((struct completion *)scp-request);
else
scp-scsi_done(scp);
@@ -419,7 +455,9 @@ static void gdth_scsi_done(struct scsi_cmnd *scp)
 int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str *gdtcmd, char *cmnd,
int timeout, u32 *info)
 {
+gdth_ha_str *ha = shost_priv(sdev-host);
 Scsi_Cmnd *scp;
+struct gdth_cmndinfo cmndinfo;
 DECLARE_COMPLETION_ONSTACK(wait);
 int rval;
 
@@ -428,6 +466,8 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str 
*gdtcmd, char *cmnd,
 return -ENOMEM;
 
 scp-device = sdev;
+memset(cmndinfo, 0, sizeof(cmndinfo));
+
 /* use request field to save the ptr. to completion struct. */
 scp-request = (struct request *)wait;
 scp-timeout_per_command = timeout*HZ;
@@ -435,8 +475,11 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str 
*gdtcmd, char *cmnd,
 scp-cmd_len = 12;
 memcpy(scp-cmnd, cmnd, 12);
 scp-SCp.this_residual = IOCTL_PRI;   /* priority */
-scp-done = gdth_scsi_done;
-gdth_queuecommand(scp, NULL);
+cmndinfo.internal_command = 1;
+
+TRACE((__gdth_execute() cmd 0x%x\n, scp-cmnd[0]));
+__gdth_queuecommand(ha, scp, cmndinfo);
+
 wait_for_completion(wait);
 
 rval = scp-SCp.Status;
@@ -1969,6 +2012,7 @@ static int 

[PATCH 15/16] gdth: Move members from SCp to gdth_cmndinfo, stage 2

2007-09-30 Thread Boaz Harrosh

  - Cleanup the rest of the scsi_cmnd-SCp members and move them
to gdth_cmndinfo:
SCp.this_residual= priority
SCp.buffers_residual = timeout
SCp.Status   = status and dma_dir
SCp.Message  = info
SCp.have_data_in = volatile wait_for_completion
SCp.sent_command = OpCode
SCp.phase= phase

  - Two more members will be naturally removed in the !use_sg cleanup

  TODO: What is the meaning of gdth_cmndinfo.phase? (rhetorically)

Signed-off-by Boaz Harrosh [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c  |  177 +++--
 drivers/scsi/gdth.h  |8 ++
 drivers/scsi/gdth_proc.c |   10 ++-
 3 files changed, 104 insertions(+), 91 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 860753b..c712794 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -85,15 +85,15 @@
 
 /* The meaning of the Scsi_Pointer members in this driver is as follows:
  * ptr: Chaining
- * this_residual:   Command priority
+ * this_residual:   unused
  * buffer:  unused
  * dma_handle:  will drop in !use_sg patch.
- * buffers_residual:Timeout value
- * Status:  Command status (gdth_do_cmd()), DMA mem. mappings
- * Message: Additional info (gdth_do_cmd()), DMA direction
- * have_data_in:Flag for gdth_wait_completion()
- * sent_command:Opcode special command
- * phase:   Service/parameter/return code special command
+ * buffers_residual:unused
+ * Status:  DMA mem. mappings (FIXME: drop in !use_sg patch.)
+ * Message: unused
+ * have_data_in:unused
+ * sent_command:unused
+ * phase:   unused
  */
 
 
@@ -474,7 +474,7 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str 
*gdtcmd, char *cmnd,
 scp-request_buffer = gdtcmd;
 scp-cmd_len = 12;
 memcpy(scp-cmnd, cmnd, 12);
-scp-SCp.this_residual = IOCTL_PRI;   /* priority */
+cmndinfo.priority = IOCTL_PRI;
 cmndinfo.internal_command = 1;
 
 TRACE((__gdth_execute() cmd 0x%x\n, scp-cmnd[0]));
@@ -482,9 +482,9 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str 
*gdtcmd, char *cmnd,
 
 wait_for_completion(wait);
 
-rval = scp-SCp.Status;
+rval = cmndinfo.status;
 if (info)
-*info = scp-SCp.Message;
+*info = cmndinfo.info;
 kfree(scp);
 return rval;
 }
@@ -2022,14 +2022,14 @@ static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, 
unchar priority)
 spin_lock_irqsave(ha-smp_lock, flags);
 
 if (!cmndinfo-internal_command) {
-scp-SCp.this_residual = (int)priority;
+cmndinfo-priority = priority;
 b = scp-device-channel;
 t = scp-device-id;
 if (priority = DEFAULT_PRI) {
 if ((b != ha-virt_bus  ha-raw[BUS_L2P(ha,b)].lock) ||
 (b==ha-virt_bus  tMAX_HDRIVES  ha-hdr[t].lock)) {
 TRACE2((gdth_putq(): locked IO -update_timeout()\n));
-scp-SCp.buffers_residual = gdth_update_timeout(scp, 0);
+cmndinfo-timeout = gdth_update_timeout(scp, 0);
 }
 }
 }
@@ -2041,7 +2041,7 @@ static void gdth_putq(gdth_ha_str *ha, Scsi_Cmnd *scp, 
unchar priority)
 pscp = ha-req_first;
 nscp = (Scsi_Cmnd *)pscp-SCp.ptr;
 /* priority: 0-highest,..,0xff-lowest */
-while (nscp  (unchar)nscp-SCp.this_residual = priority) {
+while (nscp  gdth_cmnd_priv(nscp)-priority = priority) {
 pscp = nscp;
 nscp = (Scsi_Cmnd *)pscp-SCp.ptr;
 }
@@ -2080,13 +2080,14 @@ static void gdth_next(gdth_ha_str *ha)
 cmd_index = 0;
 
 for (nscp = pscp = ha-req_first; nscp; nscp = (Scsi_Cmnd *)nscp-SCp.ptr) 
{
+struct gdth_cmndinfo *nscp_cmndinfo = gdth_cmnd_priv(nscp);
 if (nscp != pscp  nscp != (Scsi_Cmnd *)pscp-SCp.ptr)
 pscp = (Scsi_Cmnd *)pscp-SCp.ptr;
-if (!gdth_cmnd_priv(nscp)-internal_command) {
+if (!nscp_cmndinfo-internal_command) {
 b = nscp-device-channel;
 t = nscp-device-id;
 l = nscp-device-lun;
-if (nscp-SCp.this_residual = DEFAULT_PRI) {
+if (nscp_cmndinfo-priority = DEFAULT_PRI) {
 if ((b != ha-virt_bus  ha-raw[BUS_L2P(ha,b)].lock) ||
 (b == ha-virt_bus  t  MAX_HDRIVES  ha-hdr[t].lock))
 continue;
@@ -2107,9 +2108,9 @@ static void gdth_next(gdth_ha_str *ha)
 firsttime = FALSE;
 }
 
-if (!gdth_cmnd_priv(nscp)-internal_command) {
-if (nscp-SCp.phase == -1) {
-nscp-SCp.phase = CACHESERVICE;   /* default: cache svc. 
*/ 
+if (!nscp_cmndinfo-internal_command) {
+if (nscp_cmndinfo-phase == -1) {
+nscp_cmndinfo-phase = CACHESERVICE;   /* 

[PATCH 16/16] gdth: !use_sg cleanup and use of scsi accessors

2007-09-30 Thread Boaz Harrosh

  gdth_execute() will issue an internal, none scsi-standard commands
  onto __gdth_queuecommand(). Since it is not recommended to set
  struct scsi_cmnd IO members in llds, gdth now uses internal IO
  members for IO. In the case of gdth_execute() these members will be
  set properly. In case the command was issued from scsi-ml
  (by gdth_queuecommand) they will be set from scsi IO accessors.

  * define gdth IO accessors and use them throughout the driver.
  * use an sg-of-one in gdth_execute() and fix gdth_special_cmd()
accordingly.
  * Clean the not use_sg code path and company

Signed-off-by Boaz Harrosh [EMAIL PROTECTED]
---
 drivers/scsi/gdth.c |  227 ---
 drivers/scsi/gdth.h |7 --
 2 files changed, 108 insertions(+), 126 deletions(-)

diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index c712794..0743a22 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -85,11 +85,11 @@
 
 /* The meaning of the Scsi_Pointer members in this driver is as follows:
  * ptr: Chaining
- * this_residual:   unused
- * buffer:  unused
- * dma_handle:  will drop in !use_sg patch.
- * buffers_residual:unused
- * Status:  DMA mem. mappings (FIXME: drop in !use_sg patch.)
+ * this_residual:   gdth_bufflen
+ * buffer:  gdth_sglist
+ * dma_handle:  unused
+ * buffers_residual:gdth_sg_count
+ * Status:  unused
  * Message: unused
  * have_data_in:unused
  * sent_command:unused
@@ -132,6 +132,7 @@
 #include asm/uaccess.h
 #include linux/spinlock.h
 #include linux/blkdev.h
+#include linux/scatterlist.h
 
 #include scsi.h
 #include scsi/scsi_host.h
@@ -157,7 +158,7 @@ static void gdth_readapp_event(gdth_ha_str *ha, unchar 
application,
 static void gdth_clear_events(void);
 
 static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
-char *buffer,ushort count);
+char *buffer, ushort count, int to_buffer);
 static int gdth_internal_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp);
 static int gdth_fill_cache_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, ushort hdrive);
 
@@ -379,6 +380,47 @@ static const struct file_operations gdth_fops = {
 .release = gdth_close,
 };
 
+/*
+ * gdth scsi_command access wrappers.
+ *   below 6 functions are used throughout the driver to access scsi_command's
+ *   io parameters. The reason we do not use the regular accessors from
+ *   scsi_cmnd.h is because of gdth_execute(). Since it is unrecommended for
+ *   llds to directly set scsi_cmnd's IO members. This driver will use SCp
+ *   members for IO parameters, and will copy scsi_cmnd's members to Scp
+ *   members in queuecommand. For internal commands through gdth_execute()
+ *   SCp's members will be set directly.
+ */
+static inline unsigned gdth_bufflen(struct scsi_cmnd *cmd)
+{
+   return (unsigned)cmd-SCp.this_residual;
+}
+
+static inline void gdth_set_bufflen(struct scsi_cmnd *cmd, unsigned bufflen)
+{
+   cmd-SCp.this_residual = bufflen;
+}
+
+static inline unsigned gdth_sg_count(struct scsi_cmnd *cmd)
+{
+   return (unsigned)cmd-SCp.buffers_residual;
+}
+
+static inline void gdth_set_sg_count(struct scsi_cmnd *cmd, unsigned sg_count)
+{
+   cmd-SCp.buffers_residual = sg_count;
+}
+
+static inline struct scatterlist *gdth_sglist(struct scsi_cmnd *cmd)
+{
+   return cmd-SCp.buffer;
+}
+
+static inline void gdth_set_sglist(struct scsi_cmnd *cmd,
+   struct scatterlist *sglist)
+{
+   cmd-SCp.buffer = sglist;
+}
+
 #include gdth_proc.h
 #include gdth_proc.c
 
@@ -458,6 +500,7 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str 
*gdtcmd, char *cmnd,
 gdth_ha_str *ha = shost_priv(sdev-host);
 Scsi_Cmnd *scp;
 struct gdth_cmndinfo cmndinfo;
+struct scatterlist one_sg;
 DECLARE_COMPLETION_ONSTACK(wait);
 int rval;
 
@@ -471,7 +514,9 @@ int __gdth_execute(struct scsi_device *sdev, gdth_cmd_str 
*gdtcmd, char *cmnd,
 /* use request field to save the ptr. to completion struct. */
 scp-request = (struct request *)wait;
 scp-timeout_per_command = timeout*HZ;
-scp-request_buffer = gdtcmd;
+sg_init_one(one_sg, gdtcmd, sizeof(*gdtcmd));
+gdth_set_sglist(scp, one_sg);
+gdth_set_bufflen(scp, sizeof(*gdtcmd));
 scp-cmd_len = 12;
 memcpy(scp-cmnd, cmnd, 12);
 cmndinfo.priority = IOCTL_PRI;
@@ -2309,24 +2354,28 @@ static void gdth_next(gdth_ha_str *ha)
ha-hanum, cmd_index);
 }
 }
-   
+
+/*
+ * gdth_copy_internal_data() - copy to/from a buffer onto a scsi_cmnd's
+ * buffers, kmap_atomic() as needed.
+ */
 static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
-char *buffer,ushort count)
+char *buffer, 

Re: [RFC 0/16] gdth combined patchset call for testers

2007-09-30 Thread Jeff Garzik

Boaz Harrosh wrote:

[8/16] gdth: Remove virt hosts - Christoph  Boaz
  Here we need an executive decision! The issue is as stated by Christoph:

The virt_ctr option allows to register a new scsi_host for each bus
on the raid controller.  This non-default option makes no sense with
the current scsi code and prevents cleaning up the host registration,
so remove it.

  I agree. This is just exactly the same as done buy scsi-ml scans but only
  more resource consuming. Unless I'm totally missing something, perhaps it is
  just a leftover from old kernels.

  But if it is decided that this virt_ctr fixture is absolutely needed than
  I have a patch for re-enabling it at: after the patchset, done in a 
different
  way. Because for now it prevents the cleanups I need.

  Also this patch can Just be merged with [7/16] but I wanted it separate in the 
  case we decide for virt_ctr fixture return.



I definitely agree too (that virt_ctr should go away).

My only worry is that this breaks somebody in the field.  Given that it 
is apparently a non-default option, I think that worry can be overlooked.


Jeff


-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 0/16] gdth combined patchset call for testers

2007-09-30 Thread Jeff Garzik

Boaz Harrosh wrote:

[11/16] gdth: switch to modern scsi host registration - Christoph
  Christoph what is missing from here is the remove of the deprecated 
  pci_find_device() call. Can I Just use pci_get_device() of the same signature

  or do I need to call some other pci_ members after that?



The driver needs to be converted to the new hotplug APIs.

The main pre-reqs are accomplished by your patches: the driver is using 
the modern scsi hotplug API, and uses pointers for the adapter struct 
rather than indices.


The final pre-req -- if your patches do not do this already -- is to 
completely eliminate any global driver arrays, and make sure all 
structures are allocated on a per-HBA basis.


Once this is done, conversion to ISA/EISA/PCI hotplug API is pretty 
straightforward.  Each of those three bus APIs are the same: 
per-instance probe and remove functions, and (for PCI and sometimes 
EISA) an id table.  This is the reason why the ISA/EISA/PCI codes were 
split out into separate functions, to prepare for this conversion.


Jeff


-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 7/16] gdth: make some virt ctrlr code common

2007-09-30 Thread Christoph Hellwig
On Sun, Sep 30, 2007 at 10:01:56PM +0200, Boaz Harrosh wrote:
 
   * New function gdth_register_virt() replaces the three
 basically-duplicate copies of virtual controller registration.

I think we can just kill this one if 8/16 goes in..

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 9/16] gdth: clean up host private data

2007-09-30 Thread Christoph Hellwig
On Sun, Sep 30, 2007 at 10:06:39PM +0200, Boaz Harrosh wrote:
 
   - Get rid of all the indirection in the Scsi_Host private data and always
 put the gdth_ha_str directly into it.
 
   - Change all internal functions prototype to recieve an gdth_ha_str *ha
 pointer directlly and kill all that redundent access to the 
 gdth_ctr_tab[]
 controller-table.

I somewhere had a patch to do that item 2 as a separate patch.  But it's
fine with me to have it as one if that makes it easier for you.

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 10/16] gdth: gdth_get_status() return pointer to host not its index

2007-09-30 Thread Christoph Hellwig
On Sun, Sep 30, 2007 at 10:09:20PM +0200, Boaz Harrosh wrote:
 
   - Return the interrupting host and not it's index.
 NULL if intr is not by gdth.
   - fix calling site
 
   FIXME:
Why are we looping on all cards? the passed dev_id
can be used for pinpointing the exact interrupting
card. The kernel is already looping on all sharing
cards so this code makes it O(n^2).

This is just pre-historic code that makes no sense whatover in a modern
kernel.  I'd much prefer to stop doing this and use dev_id properly.

What is that polling mode? can we pass dev_id to
gdth_get_status() and do a poll only if dev_id is
NULL?

Just loop over all host adapters in gdth_wait instead and pass in the
ha pointer.

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 0/16] gdth combined patchset call for testers

2007-09-30 Thread Jeff Garzik
BTW, when reposting the patches of others, its nice to add a From: 
header to the very first line of the email body.  Andrew does that a 
lot, and the git tools are aware of this convention.


Also, hey, if you like our patches, I think you should add your own 
Signed-off-by line (assuming/hoping you reviewed it).


Jeff



-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/16] gdth: Make one abuse of scsi_cmnd less obvious

2007-09-30 Thread Christoph Hellwig
On Sun, Sep 30, 2007 at 10:13:27PM +0200, Boaz Harrosh wrote:
 
   Rather than having internal commands abuse scsi_done to call
   gdth_scsi_done, have all the places that use to call scsi_done directly
   call gdth_scsi_done, which now checks whether the command was internal,
   and calls scsi_done if not.

I think it would be better if your whole patch series goes ontop of
willy's -done removal series instead.  I really hope we can get that
one into scsi-misc ASAP.

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 0/16] gdth combined patchset call for testers

2007-09-30 Thread Christoph Hellwig
On Sun, Sep 30, 2007 at 09:44:12PM +0200, Boaz Harrosh wrote:
 Some short explanations:
 [1/16] gdth: split out isa probing - Christoph Hellwig
 [2/16] gdth: split out eisa probing - Christoph Hellwig
 [3/16] gdth: split out pci probing - Christoph Hellwig
   These three are from Christoph and where ACKed by
   Jeff at the time.
 
 [4/16] gdth: Remove 2.4.x support, in-kernel changelog - Jeff Garzik
   Same but partial work was done both by Christoph and Matthew.
 
 [5/16] gdth: kill gdth_{read,write}[bwl] wrappers - Jeff Garzik
 [6/16] Reorder scsi_host_template intitializers
 [7/16] gdth: make some virt ctrlr code common
   These 3 are from Jeff's patchset 6  7 where the same patch

I think up to here their obvious candidates to put into scsi-misc ASAP
once we can get an ACK from Achim.

 [8/16] gdth: Remove virt hosts - Christoph  Boaz
   Here we need an executive decision! The issue is as stated by Christoph:
 
 The virt_ctr option allows to register a new scsi_host for each bus
 on the raid controller.  This non-default option makes no sense with
 the current scsi code and prevents cleaning up the host registration,
 so remove it.
 
   I agree. This is just exactly the same as done buy scsi-ml scans but only
   more resource consuming. Unless I'm totally missing something, perhaps it is
   just a leftover from old kernels.
 
   But if it is decided that this virt_ctr fixture is absolutely needed than
   I have a patch for re-enabling it at: after the patchset, done in a 
 different
   way. Because for now it prevents the cleanups I need.
 
   Also this patch can Just be merged with [7/16] but I wanted it separate in 
 the 
   case we decide for virt_ctr fixture return.

I think we want to put this in, but maybe keep the modular paramter for
now and print a big warning if anyone actually specifies it.

Achim, do you have any opinion on this?

 [9/16] gdth: clean up host private data - Christoph  Boaz
   This is based on the same patch from Christoph, but taken one step
   farther, by just passing the ha pointer everywhere instead of hanum.
   Christoph please acknowledge your signed-of-by on this patch.

Sure, feel free to add it.

 
 [10/16] gdth: gdth_get_status() return pointer to host not its index - Boaz
   This logically belongs to [9/16] but is separated for reviewing and 
 bisect-ability
   As it is a sensitive matter.

As I mentioned in my reply to the patch I'd prefer to just use dev_id
directly like any modern driver.

 [11/16] gdth: switch to modern scsi host registration - Christoph
   Christoph what is missing from here is the remove of the deprecated 
   pci_find_device() call. Can I Just use pci_get_device() of the same 
 signature
   or do I need to call some other pci_ members after that?

if you use pci_get_device you need to call pci_put device to drop a reference
when you're done with the device (or in a failure path).

 [12/16] gdth: Remove gdth_ctr_tab[] - Boaz
   I took Christoph's cleanup one step farther and got read of the statically
   allocated gdth_ctr_tab[]. In it's place I use the new link-list introduced
   by the [11/16] patch.

Looks good.  But we'll need some proper locking for this list once we
start supporting pci hotplug.

 [13/16] gdth: Make one abuse of scsi_cmnd less obvious - Matthew Wilcox
   This is the first patch sent by Matthew Wilcox, rebased to all above
   patches. Matthew, thanks, it saved me from a much uglier hack I had
   with regard to per-command-private-data.
 
 [14/16] gdth: Setup proper per-command private data - Boaz
 [15/16] gdth: Move members from SCp to gdth_cmndinfo, stage 2 - Boaz
   These two move me much closer to the agenda I had in all this,
   which is: gdth diss-abuse of of scsi_cmnd IO members.
   With these patches I also conform to Matthew's second patch:
   gdth: Stop abusing -done for internal commands
 
 [16/16] gdth: !use_sg cleanup and use of scsi accessors
   And finally this one.

I'll look at these four patches later on, I'm a bit too tired to follow
it right now, sorry.


Thanks a lot again for doing all the work on this driver!
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 0/16] gdth combined patchset call for testers

2007-09-30 Thread Christoph Hellwig
On Sun, Sep 30, 2007 at 05:07:53PM -0400, Jeff Garzik wrote:
 The driver needs to be converted to the new hotplug APIs.
 
 The main pre-reqs are accomplished by your patches: the driver is using 
 the modern scsi hotplug API, and uses pointers for the adapter struct 
 rather than indices.
 
 The final pre-req -- if your patches do not do this already -- is to 
 completely eliminate any global driver arrays, and make sure all 
 structures are allocated on a per-HBA basis.
 
 Once this is done, conversion to ISA/EISA/PCI hotplug API is pretty 
 straightforward.  Each of those three bus APIs are the same: 
 per-instance probe and remove functions, and (for PCI and sometimes 
 EISA) an id table.  This is the reason why the ISA/EISA/PCI codes were 
 split out into separate functions, to prepare for this conversion.

I think we're nicely prepared for that conversion, we'll only need to
add proper locking for the list of instance.

The big problem with the pci_driver conversion is that lack of device
ids in the driver.  A few years ago I sent Achim a mail to ask if there's
a definitive list of used PCI ids, but didn't get an answer - maybe
the mail bounced.  If we can't get this list we'd have to add something
like 500 PCI ids from the ranges currently probed, which seems rather
odd.  gdth.h has various PCI_DEVICE_ID_ defines, maybe those are the
supported ones?

For eisa we'll probably have the same issue.
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 0/16] gdth combined patchset call for testers

2007-09-30 Thread Jeff Garzik

Christoph Hellwig wrote:

The big problem with the pci_driver conversion is that lack of device
ids in the driver.  A few years ago I sent Achim a mail to ask if there's
a definitive list of used PCI ids, but didn't get an answer - maybe
the mail bounced.  If we can't get this list we'd have to add something
like 500 PCI ids from the ranges currently probed, which seems rather
odd.  gdth.h has various PCI_DEVICE_ID_ defines, maybe those are the
supported ones?


Well, gdth.c is the only user of PCI_VENDOR_ID_VORTEX (ditto for vendor 
id 0x1119).  Thus, gdth_search_pci() has all the info you need.


Put all the specific entries first in the PCI table.  Then for the loop 
entries, use (PCI_VENDOR_ID_VORTEX,PCI_ANY_ID) for the final entry and 
disambiguate in the code itself.


If/when we get more specific information, it is then trivial to plug in.

Until such time, we are no worse off than we are now.

Jeff


-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC 0/16] gdth combined patchset call for testers

2007-09-30 Thread Jeff Garzik

The patchset looks pretty good to me, overall.

Thanks for pulling all this stuff together!

Jeff



-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 13/16] gdth: Make one abuse of scsi_cmnd less obvious

2007-09-30 Thread Matthew Wilcox
On Sun, Sep 30, 2007 at 10:28:13PM +0100, Christoph Hellwig wrote:
 I think it would be better if your whole patch series goes ontop of
 willy's -done removal series instead.  I really hope we can get that
 one into scsi-misc ASAP.

Actually, I think if Boaz simply flips this patch to be after his next
one (or merges them ...), there's no real dependency on the -done
removal.

-- 
Intel are signing my paycheques ... these opinions are still mine
Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step.
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: slave_configure for qlogicpti

2007-09-30 Thread David Miller
From: Matthew Wilcox [EMAIL PROTECTED]
Date: Wed, 19 Sep 2007 06:46:37 -0600

 
 I haven't even compile-tested this.  But look how much ugly code it
 deletes if it works!

It compiles :-)  You deleted the only uses of scsi_rbuf_{get,put}()
so you can kill those off too.

I don't have the time to setup things for testing this patch on
the qlogicpti hardware I have, but with the scsi_rbuf_{get,put}()
deletion added to the patch I would really like to see this go
into 2.6.24 anyways.

If things explode I'll pick up the pieces.

Acked-by: David S. Miller [EMAIL PROTECTED]
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: slave_configure for qlogicpti

2007-09-30 Thread Jeff Garzik

David Miller wrote:

It compiles :-)  You deleted the only uses of scsi_rbuf_{get,put}()
so you can kill those off too.



Seeing as how they are exact duplicates of libata's 
ata_scsi_rbuf_{get,put}, I wonder how they got there in the first place 
(rather than becoming common code), and I wonder how many more copies 
are floating out there...


Jeff


-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: slave_configure for qlogicpti

2007-09-30 Thread David Miller
From: Jeff Garzik [EMAIL PROTECTED]
Date: Sun, 30 Sep 2007 20:52:45 -0400

 David Miller wrote:
  It compiles :-)  You deleted the only uses of scsi_rbuf_{get,put}()
  so you can kill those off too.
 
 
 Seeing as how they are exact duplicates of libata's 
 ata_scsi_rbuf_{get,put}, I wonder how they got there in the first place 
 (rather than becoming common code), and I wonder how many more copies 
 are floating out there...

I bet: 1) they were common code in scsi_lib.c 2) qlogicpti and libata
became the only remaining users so 3) they got copied to those
two users verbatim anticipating that the qlogicpti usage would
eventually be deleted.

Interested parties can search the tree history to determine for
suer :-)

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] Update Documentation/scsi/00-INDEX

2007-09-30 Thread Rob Landley
From: Rob Landley [EMAIL PROTECTED]

Update Documentation/scsi/00-INDEX to match current files.

Signed-off-by: Rob Landley [EMAIL PROTECTED]
---

 Documentation/scsi/00-INDEX |   34 +++---
 1 file changed, 31 insertions(+), 3 deletions(-)

diff -r f4ca99897c12 Documentation/scsi/00-INDEX
--- a/Documentation/scsi/00-INDEX   Sat Sep 29 10:00:15 2007 -0700
+++ b/Documentation/scsi/00-INDEX   Sun Sep 30 23:21:01 2007 -0500
@@ -2,14 +2,20 @@ 00-INDEX
- this file
 53c700.txt
- info on driver for 53c700 based adapters
-AM53C974.txt
-   - info on driver for AM53c974 based adapters
 BusLogic.txt
- info on driver for adapters with BusLogic chips
-ChangeLog
+ChangeLog.1992-1997
- Changes to scsi files, if not listed elsewhere
+ChangeLog.arcmsr
+   - Changes to driver for ARECA's SATA RAID controller cards
 ChangeLog.ips
- IBM ServeRAID driver Changelog
+ChangeLog.lpfc
+   - Changes to lpfc driver
+ChangeLog.megaraid
+   - Changes to LSI megaraid controller.
+ChangeLog.megaraid_sas
+   - Changes to serial attached scsi version of LSI megaraid controller.
 ChangeLog.ncr53c8xx
- Changes to ncr53c8xx driver
 ChangeLog.sym53c8xx
@@ -20,26 +26,44 @@ FlashPoint.txt
- info on driver for BusLogic FlashPoint adapters
 LICENSE.FlashPoint
- Licence of the Flashpoint driver
+LICENSE.qla2xxx
+   - License for QLogic Linux Fibre Channel HBA Driver firmware.
 Mylex.txt
- info on driver for Mylex adapters
 NinjaSCSI.txt
- info on WorkBiT NinjaSCSI-32/32Bi driver
+aacraid.txt
+   - Driver supporting Adaptec RAID controllers
 aha152x.txt
- info on driver for Adaptec AHA152x based adapters
+aic79xx.txt
+   - Adaptec Ultra320 SCSI host adapters
 aic7xxx.txt
- info on driver for Adaptec controllers
 aic7xxx_old.txt
- info on driver for Adaptec controllers, old generation
+arcmsr_spec.txt
+   - ARECA FIRMWARE SPEC (for IOP331 adapter)
+dc395x.txt
+   - README file for the dc395x SCSI driver
 dpti.txt
- info on driver for DPT SmartRAID and Adaptec I2O RAID based adapters
 dtc3x80.txt
- info on driver for DTC 2x80 based adapters
 g_NCR5380.txt
- info on driver for NCR5380 and NCR53c400 based adapters
+hptiop.txt
+   - HIGHPOINT ROCKETRAID 3xxx RAID DRIVER
 ibmmca.txt
- info on driver for IBM adapters with MCA bus
 in2000.txt
- info on in2000 driver
+libsas.txt
+   - Serial Attached SCSI management layer.
+lpfc.txt
+   - LPFC driver release notes
+megaraid.txt
+   - Common Management Module, shared code handling ioctls for LSI drivers
 ncr53c7xx.txt
- info on driver for NCR53c7xx based adapters
 ncr53c8xx.txt
@@ -50,6 +74,8 @@ ppa.txt
- info on driver for IOmega zip drive
 qlogicfas.txt
- info on driver for QLogic FASxxx based adapters
+scsi-changer.txt
+   - README for the SCSI media changer driver
 scsi-generic.txt
- info on the sg driver for generic (non-disk/CD/tape) SCSI devices.
 scsi.txt
@@ -58,6 +84,8 @@ scsi_mid_low_api.txt
- info on API between SCSI layer and low level drivers
 scsi_eh.txt
- info on SCSI midlayer error handling infrastructure
+scsi_fc_transport.txt
+   - SCSI Fiber Channel Tansport
 st.txt
- info on scsi tape driver
 sym53c500_cs.txt

-- 
One of my most productive days was throwing away 1000 lines of code.
  - Ken Thompson.
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html