Re: [RFC] [PATCH 1/2] blk request timeout handler patches

2007-10-05 Thread Jens Axboe
On Thu, Oct 04 2007, [EMAIL PROTECTED] wrote:
 Mike Christie's patches refreshed to 2.6.23-rc8-mm1.
 
 Signed-off-by: Mike Christie [EMAIL PROTECTED]
 Signed-off-by: Malahal Naineni [EMAIL PROTECTED]
 
 
 diff -r 3697367c6e4d block/ll_rw_blk.c
 --- a/block/ll_rw_blk.c   Thu Sep 27 00:12:13 2007 -0700
 +++ b/block/ll_rw_blk.c   Thu Sep 27 00:13:07 2007 -0700
 @@ -181,6 +181,19 @@ void blk_queue_softirq_done(struct reque
  
  EXPORT_SYMBOL(blk_queue_softirq_done);
  
 +void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout)
 +{
 + q-rq_timeout = timeout;
 +}
 +EXPORT_SYMBOL_GPL(blk_queue_rq_timeout);
 +
 +void blk_queue_rq_timed_out(struct request_queue *q, rq_timed_out_fn *fn)
 +{
 + q-rq_timed_out_fn = fn;
 +}
 +
 +EXPORT_SYMBOL_GPL(blk_queue_rq_timed_out);
 +
  /**
   * blk_queue_make_request - define an alternate make_request function for a 
 device
   * @q:  the request queue for the device to be affected
 @@ -243,7 +256,9 @@ static void rq_init(struct request_queue
  {
   INIT_LIST_HEAD(rq-queuelist);
   INIT_LIST_HEAD(rq-donelist);
 -
 + init_timer(rq-timer);
 +
 + rq-timeout = 0;
   rq-errors = 0;
   rq-bio = rq-biotail = NULL;
   INIT_HLIST_NODE(rq-hash);
 @@ -2305,6 +2320,7 @@ EXPORT_SYMBOL(blk_start_queueing);
   */
  void blk_requeue_request(struct request_queue *q, struct request *rq)
  {
 + blk_delete_timer(rq);
   blk_add_trace_rq(q, rq, BLK_TA_REQUEUE);
  
   if (blk_rq_tagged(rq))
 @@ -3647,8 +3663,121 @@ static struct notifier_block blk_cpu_not
  };
  
  /**
 + * blk_delete_timer - Delete/cancel timer for a given function.
 + * @req: request that we are canceling timer for
 + *
 + * Return value:
 + * 1 if we were able to detach the timer.  0 if we blew it, and the
 + * timer function has already started to run.
 + **/
 +int blk_delete_timer(struct request *req)
 +{
 + int rtn;
 +
 + if (!req-q-rq_timed_out_fn)
 + return 1;
 +
 + rtn = del_timer(req-timer);
 + req-timer.data = (unsigned long)NULL;
 + req-timer.function = NULL;
 +
 + return rtn;
 +}

Hmm, that looks fishy. What if the timer _just_ fired, yet it hasn't
retrieved -data yet?

 +
 +EXPORT_SYMBOL_GPL(blk_delete_timer);
 +
 +static void blk_rq_timed_out(struct request *req)
 +{
 + struct request_queue *q = req-q;
 +
 + switch (q-rq_timed_out_fn(req)) {
 + case BLK_EH_HANDLED:
 + __blk_complete_request(req);
 + return;
 + case BLK_EH_RESET_TIMER:
 + blk_add_timer(req);
 + return;
 + case BLK_EH_NOT_HANDLED:
 + /*
 +  * LLD handles this for now but in the future
 +  * we can send a request msg to abort the command
 +  * and we can move more of the generic scsi eh code to
 +  * the blk layer.
 +  */
 + return;
 + }
 +}
 +
 +/**
 + * blk_abort_req -- Request request recovery for the specified command
 + * req:  pointer to the request of interest
 + *
 + * This function requests that the block layer start recovery for the
 + * request by deleting the timer and calling the q's timeout function.
 + * LLDDs who implement their own error recovery MAY ignore the timeout
 + * event if they generated blk_abort_req.
 + */
 +void blk_abort_req(struct request *req)
 +{
 +if (!blk_delete_timer(req))
 +return;
 +blk_rq_timed_out(req);
 +}
 +
 +EXPORT_SYMBOL_GPL(blk_abort_req);
 +
 +/**
 + * blk_add_timer - Start timeout timer for a single request
 + * @req: request that is about to start running.
 + *
 + * Notes:
 + *Each request has its own timer, and as it is added to the queue, we
 + *set up the timer.  When the request completes, we cancel the timer.
 + **/
 +void blk_add_timer(struct request *req)
 +{
 + struct request_queue *q = req-q;
 +
 + /*
 +  * If the clock was already running for this command, then
 +  * first delete the timer.  The timer handling code gets rather
 +  * confused if we don't do this.
 +  */
 + if (req-timer.function)
 + del_timer(req-timer);
 +
 + req-timer.data = (unsigned long)req;
 + if (req-timeout)
 + req-timer.expires = jiffies + req-timeout;
 + else
 + req-timer.expires = jiffies + q-rq_timeout;
 + req-timer.function = (void (*)(unsigned long))blk_rq_timed_out;

Why the cast?

 +add_timer(req-timer);

You have space vs tab issues.

 +}

That's an ugly interface. I'd say it's a bug to call blk_add_timer()
with it already pending, so fix the API.

Apart from that, this has been a TODO item for me for some time. So
thanks for refreshing these, lets see if we can get them beat into
submission and agree on how it should work so we can take this forward.

-- 
Jens Axboe

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info 

Re: [RFC] [PATCH 1/2] blk request timeout handler patches

2007-10-05 Thread Jens Axboe

(resend, with proper CC - stupid mutt)

On Thu, Oct 04 2007, [EMAIL PROTECTED] wrote:
 Mike Christie's patches refreshed to 2.6.23-rc8-mm1.
 
 Signed-off-by: Mike Christie [EMAIL PROTECTED]
 Signed-off-by: Malahal Naineni [EMAIL PROTECTED]
 
 
 diff -r 3697367c6e4d block/ll_rw_blk.c
 --- a/block/ll_rw_blk.c   Thu Sep 27 00:12:13 2007 -0700
 +++ b/block/ll_rw_blk.c   Thu Sep 27 00:13:07 2007 -0700
 @@ -181,6 +181,19 @@ void blk_queue_softirq_done(struct reque
  
  EXPORT_SYMBOL(blk_queue_softirq_done);
  
 +void blk_queue_rq_timeout(struct request_queue *q, unsigned int timeout)
 +{
 + q-rq_timeout = timeout;
 +}
 +EXPORT_SYMBOL_GPL(blk_queue_rq_timeout);
 +
 +void blk_queue_rq_timed_out(struct request_queue *q, rq_timed_out_fn *fn)
 +{
 + q-rq_timed_out_fn = fn;
 +}
 +
 +EXPORT_SYMBOL_GPL(blk_queue_rq_timed_out);
 +
  /**
   * blk_queue_make_request - define an alternate make_request function for a 
 device
   * @q:  the request queue for the device to be affected
 @@ -243,7 +256,9 @@ static void rq_init(struct request_queue
  {
   INIT_LIST_HEAD(rq-queuelist);
   INIT_LIST_HEAD(rq-donelist);
 -
 + init_timer(rq-timer);
 +
 + rq-timeout = 0;
   rq-errors = 0;
   rq-bio = rq-biotail = NULL;
   INIT_HLIST_NODE(rq-hash);
 @@ -2305,6 +2320,7 @@ EXPORT_SYMBOL(blk_start_queueing);
   */
  void blk_requeue_request(struct request_queue *q, struct request *rq)
  {
 + blk_delete_timer(rq);
   blk_add_trace_rq(q, rq, BLK_TA_REQUEUE);
  
   if (blk_rq_tagged(rq))
 @@ -3647,8 +3663,121 @@ static struct notifier_block blk_cpu_not
  };
  
  /**
 + * blk_delete_timer - Delete/cancel timer for a given function.
 + * @req: request that we are canceling timer for
 + *
 + * Return value:
 + * 1 if we were able to detach the timer.  0 if we blew it, and the
 + * timer function has already started to run.
 + **/
 +int blk_delete_timer(struct request *req)
 +{
 + int rtn;
 +
 + if (!req-q-rq_timed_out_fn)
 + return 1;
 +
 + rtn = del_timer(req-timer);
 + req-timer.data = (unsigned long)NULL;
 + req-timer.function = NULL;
 +
 + return rtn;
 +}

Hmm, that looks fishy. What if the timer _just_ fired, yet it hasn't
retrieved -data yet?

 +
 +EXPORT_SYMBOL_GPL(blk_delete_timer);
 +
 +static void blk_rq_timed_out(struct request *req)
 +{
 + struct request_queue *q = req-q;
 +
 + switch (q-rq_timed_out_fn(req)) {
 + case BLK_EH_HANDLED:
 + __blk_complete_request(req);
 + return;
 + case BLK_EH_RESET_TIMER:
 + blk_add_timer(req);
 + return;
 + case BLK_EH_NOT_HANDLED:
 + /*
 +  * LLD handles this for now but in the future
 +  * we can send a request msg to abort the command
 +  * and we can move more of the generic scsi eh code to
 +  * the blk layer.
 +  */
 + return;
 + }
 +}
 +
 +/**
 + * blk_abort_req -- Request request recovery for the specified command
 + * req:  pointer to the request of interest
 + *
 + * This function requests that the block layer start recovery for the
 + * request by deleting the timer and calling the q's timeout function.
 + * LLDDs who implement their own error recovery MAY ignore the timeout
 + * event if they generated blk_abort_req.
 + */
 +void blk_abort_req(struct request *req)
 +{
 +if (!blk_delete_timer(req))
 +return;
 +blk_rq_timed_out(req);
 +}
 +
 +EXPORT_SYMBOL_GPL(blk_abort_req);
 +
 +/**
 + * blk_add_timer - Start timeout timer for a single request
 + * @req: request that is about to start running.
 + *
 + * Notes:
 + *Each request has its own timer, and as it is added to the queue, we
 + *set up the timer.  When the request completes, we cancel the timer.
 + **/
 +void blk_add_timer(struct request *req)
 +{
 + struct request_queue *q = req-q;
 +
 + /*
 +  * If the clock was already running for this command, then
 +  * first delete the timer.  The timer handling code gets rather
 +  * confused if we don't do this.
 +  */
 + if (req-timer.function)
 + del_timer(req-timer);
 +
 + req-timer.data = (unsigned long)req;
 + if (req-timeout)
 + req-timer.expires = jiffies + req-timeout;
 + else
 + req-timer.expires = jiffies + q-rq_timeout;
 + req-timer.function = (void (*)(unsigned long))blk_rq_timed_out;

Why the cast?

 +add_timer(req-timer);

You have space vs tab issues.

 +}

That's an ugly interface. I'd say it's a bug to call blk_add_timer()
with it already pending, so fix the API.

Apart from that, this has been a TODO item for me for some time. So
thanks for refreshing these, lets see if we can get them beat into
submission and agree on how it should work so we can take this forward.

-- 
Jens Axboe

-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message 

Re: [PATCH 21/21] advansys: Changes to work on parisc

2007-10-05 Thread Andrew Morton
On Tue,  2 Oct 2007 21:55:42 -0400
Matthew Wilcox [EMAIL PROTECTED] wrote:

 @@ -13428,9 +13428,9 @@ static int __devinit advansys_board_found(struct 
 Scsi_Host *shost,
   boardp-ioremap_addr = ioremap(pci_resource_start(pdev, 1),
  boardp-asc_n_io_port);
   if (!boardp-ioremap_addr) {
 - shost_printk(KERN_ERR, shost, ioremap(%x, %d) 
 + shost_printk(KERN_ERR, shost, ioremap(%lx, %d) 
   returned NULL\n,
 - pci_resource_start(pdev, 1),
 + (long)pci_resource_start(pdev, 1),
   boardp-asc_n_io_port);

This isn't right.  resource_size_t can be 64-bit so should be cast to
unsigned long long and printed with %llx.

If it is known that this driver will never encounter a 64-bit address here
then this optimisation should be accompanied by a comment at every place
where it is employed so that people do not copy the wrong code into other
drivers.

-
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 01/17] git-scsi-misc: arcmsr build fix

2007-10-05 Thread Andrew Morton
I sent seventeen patches and only one was applied.

Please either merge the others or give them a nack-with-reasons or specify
how they need to be altered.

Please do not just ignore them.  This creates additional ongoing
maintenance work for myself.

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 21/21] advansys: Changes to work on parisc

2007-10-05 Thread Matthew Wilcox
On Fri, Oct 05, 2007 at 12:03:55PM -0700, Andrew Morton wrote:
 This isn't right.  resource_size_t can be 64-bit so should be cast to
 unsigned long long and printed with %llx.

But it's a 32-bit BAR.

 If it is known that this driver will never encounter a 64-bit address here
 then this optimisation should be accompanied by a comment at every place
 where it is employed so that people do not copy the wrong code into other
 drivers.

Tell you what, I'll fix it properly when we have a better solution than
'cast resource_size_t to long long for printing'.

-- 
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


[PATCH] advansys: Fix bug in AdvLoadMicrocode

2007-10-05 Thread Matthew Wilcox
buf[i] can be up to 0xfd, so doubling it and assigning the result to an
unsigned char truncates the value.  Just use an unsigned int instead;
it's only a temporary.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/advansys.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/advansys.c b/drivers/scsi/advansys.c
index 9dd3952..bb3422b 100644
--- a/drivers/scsi/advansys.c
+++ b/drivers/scsi/advansys.c
@@ -6439,7 +6439,7 @@ static int AdvLoadMicrocode(AdvPortAddr iop_base, 
unsigned char *buf, int size,
i += 2;
len += 2;
} else {
-   unsigned char off = buf[i] * 2;
+   unsigned int off = buf[i] * 2;
unsigned short word = (buf[off + 1]  8) | buf[off];
AdvWriteWordAutoIncLram(iop_base, word);
len += 2;
-- 
1.5.3.2

-
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/17] sym53c8xx: PCI Error Recovery support

2007-10-05 Thread Matthew Wilcox
From: Linas Vepstas [EMAIL PROTECTED]

This patch adds the PCI error recovery callbacks to the Symbios SCSI device
driver.  It includes support for First Failure Data Capture.

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]

Assorted changes to initial patches, including returning IRQ_NONE from the
interrupt handler if the device is offline and re-using the eh_done completion
in the scsi error handler.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |  179 ++-
 drivers/scsi/sym53c8xx_2/sym_glue.h |3 +
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   25 -
 3 files changed, 200 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 6bc8789..fec9c9c 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -134,7 +134,7 @@ static struct scsi_transport_template 
*sym2_transport_template = NULL;
  *  Driver private area in the SCSI command structure.
  */
 struct sym_ucmd {  /* Override the SCSI pointer structure */
-   struct completion *eh_done; /* For error handling */
+   struct completion *eh_done; /* SCSI error handling */
 };
 
 #define SYM_UCMD_PTR(cmd)  ((struct sym_ucmd *)((cmd)-SCp))
@@ -556,6 +556,10 @@ static irqreturn_t sym53c8xx_intr(int irq, void *dev_id)
 {
struct sym_hcb *np = dev_id;
 
+   /* Avoid spinloop trying to handle interrupts on frozen device */
+   if (pci_channel_offline(np-s.device))
+   return IRQ_NONE;
+
if (DEBUG_FLAGS  DEBUG_TINY) printf_debug ([);
 
spin_lock(np-s.host-host_lock);
@@ -598,6 +602,7 @@ static int sym_eh_handler(int op, char *opname, struct 
scsi_cmnd *cmd)
struct sym_hcb *np = SYM_SOFTC_PTR(cmd);
struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd);
struct Scsi_Host *host = cmd-device-host;
+   struct pci_dev *pdev = np-s.device;
SYM_QUEHEAD *qp;
int cmd_queued = 0;
int sts = -1;
@@ -605,6 +610,38 @@ static int sym_eh_handler(int op, char *opname, struct 
scsi_cmnd *cmd)
 
dev_warn(cmd-device-sdev_gendev, %s operation started.\n, opname);
 
+   /* We may be in an error condition because the PCI bus
+* went down. In this case, we need to wait until the
+* PCI bus is reset, the card is reset, and only then
+* proceed with the scsi error recovery.  There's no
+* point in hurrying; take a leisurely wait.
+*/
+#define WAIT_FOR_PCI_RECOVERY  35
+   if (pci_channel_offline(pdev)) {
+   struct host_data *hostdata = shost_priv(host);
+   struct completion *io_reset;
+   int finished_reset = 0;
+   init_completion(eh_done);
+   spin_lock_irq(host-host_lock);
+   /* Make sure we didn't race */
+   if (pci_channel_offline(pdev)) {
+   if (!hostdata-io_reset)
+   hostdata-io_reset = eh_done;
+   io_reset = hostdata-io_reset;
+   } else {
+   io_reset = NULL;
+   }
+
+   if (!pci_channel_offline(pdev))
+   finished_reset = 1;
+   spin_unlock_irq(host-host_lock);
+   if (!finished_reset)
+   finished_reset = wait_for_completion_timeout(io_reset,
+   WAIT_FOR_PCI_RECOVERY*HZ);
+   if (!finished_reset)
+   return SCSI_FAILED;
+   }
+
spin_lock_irq(host-host_lock);
/* This one is queued in some place - to wait for completion */
FOR_EACH_QUEUED_ELEMENT(np-busy_ccbq, qp) {
@@ -630,7 +667,7 @@ static int sym_eh_handler(int op, char *opname, struct 
scsi_cmnd *cmd)
break;
case SYM_EH_HOST_RESET:
sym_reset_scsi_bus(np, 0);
-   sym_start_up (np, 1);
+   sym_start_up(np, 1);
sts = 0;
break;
default:
@@ -1435,7 +1472,7 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
/*
 *  Start the SCRIPTS.
 */
-   sym_start_up (np, 1);
+   sym_start_up(np, 1);
 
/*
 *  Start the timer daemon
@@ -1822,6 +1859,134 @@ static void __devexit sym2_remove(struct pci_dev *pdev)
attach_count--;
 }
 
+/**
+ * sym2_io_error_detected() - called when PCI error is detected
+ * @pdev: pointer to PCI device
+ * @state: current state of the PCI slot
+ */
+static pci_ers_result_t sym2_io_error_detected(struct pci_dev *pdev,
+ enum pci_channel_state state)
+{
+   /* If slot is permanently frozen, turn everything off */
+   if (state == pci_channel_io_perm_failure) {
+   sym2_remove(pdev);
+   return PCI_ERS_RESULT_DISCONNECT;
+   

[PATCH 15/17] sym53c8xx: Make interrupt handler capable of returning IRQ_NONE

2007-10-05 Thread Matthew Wilcox
Make sym_interrupt return an irqreturn_t instead of void, and take a
Scsi_Host instead of a sym_hcb.  Pass the Scsi_Host to the interrupt
handler instead of the sym_hcb.  Rename the host_data to sym_data.
Keep a pci_dev pointer in the sym_data.  Rename the Scsi_Host from
instance to shost.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |  107 +--
 drivers/scsi/sym53c8xx_2/sym_glue.h |6 +-
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   16 +++--
 drivers/scsi/sym53c8xx_2/sym_hipd.h |2 +-
 4 files changed, 66 insertions(+), 65 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index a82ed13..e515485 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -39,7 +39,6 @@
  */
 #include linux/ctype.h
 #include linux/init.h
-#include linux/interrupt.h
 #include linux/module.h
 #include linux/moduleparam.h
 #include linux/spinlock.h
@@ -549,21 +548,23 @@ static int sym53c8xx_queue_command(struct scsi_cmnd *cmd,
  */
 static irqreturn_t sym53c8xx_intr(int irq, void *dev_id)
 {
-   struct sym_hcb *np = dev_id;
+   struct Scsi_Host *shost = dev_id;
+   struct sym_data *sym_data = shost_priv(shost);
+   irqreturn_t result;
 
/* Avoid spinloop trying to handle interrupts on frozen device */
-   if (pci_channel_offline(np-s.device))
+   if (pci_channel_offline(sym_data-pdev))
return IRQ_NONE;
 
if (DEBUG_FLAGS  DEBUG_TINY) printf_debug ([);
 
-   spin_lock(np-s.host-host_lock);
-   sym_interrupt(np);
-   spin_unlock(np-s.host-host_lock);
+   spin_lock(shost-host_lock);
+   result = sym_interrupt(shost);
+   spin_unlock(shost-host_lock);
 
if (DEBUG_FLAGS  DEBUG_TINY) printf_debug (]\n);
 
-   return IRQ_HANDLED;
+   return result;
 }
 
 /*
@@ -613,22 +614,19 @@ static int sym_eh_handler(int op, char *opname, struct 
scsi_cmnd *cmd)
 */
 #define WAIT_FOR_PCI_RECOVERY  35
if (pci_channel_offline(pdev)) {
-   struct host_data *hostdata = shost_priv(host);
+   struct sym_data *sym_data = shost_priv(host);
struct completion *io_reset;
int finished_reset = 0;
init_completion(eh_done);
spin_lock_irq(host-host_lock);
/* Make sure we didn't race */
if (pci_channel_offline(pdev)) {
-   if (!hostdata-io_reset)
-   hostdata-io_reset = eh_done;
-   io_reset = hostdata-io_reset;
+   if (!sym_data-io_reset)
+   sym_data-io_reset = eh_done;
+   io_reset = sym_data-io_reset;
} else {
-   io_reset = NULL;
-   }
-
-   if (!pci_channel_offline(pdev))
finished_reset = 1;
+   }
spin_unlock_irq(host-host_lock);
if (!finished_reset)
finished_reset = wait_for_completion_timeout(io_reset,
@@ -1273,9 +1271,9 @@ static void sym_free_resources(struct sym_hcb *np, struct 
pci_dev *pdev)
 static struct Scsi_Host * __devinit sym_attach(struct scsi_host_template *tpnt,
int unit, struct sym_device *dev)
 {
-   struct host_data *host_data;
+   struct sym_data *sym_data;
struct sym_hcb *np = NULL;
-   struct Scsi_Host *instance = NULL;
+   struct Scsi_Host *shost;
struct pci_dev *pdev = dev-pdev;
unsigned long flags;
struct sym_fw *fw;
@@ -1289,15 +1287,12 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
 */
fw = sym_find_firmware(dev-chip);
if (!fw)
-   goto attach_failed;
+   return NULL;
 
-   /*
-*  Allocate host_data structure
-*/
-   instance = scsi_host_alloc(tpnt, sizeof(*host_data));
-   if (!instance)
-   goto attach_failed;
-   host_data = (struct host_data *) instance-hostdata;
+   shost = scsi_host_alloc(tpnt, sizeof(*sym_data));
+   if (!shost)
+   return NULL;
+   sym_data = shost_priv(shost);
 
/*
 *  Allocate immediately the host control block, 
@@ -1310,8 +1305,9 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
goto attach_failed;
np-s.device = pdev;
np-bus_dmat = pdev-dev; /* Result in 1 DMA pool per HBA */
-   host_data-ncb = np;
-   np-s.host = instance;
+   sym_data-ncb = np;
+   sym_data-pdev = pdev;
+   np-s.host = shost;
 
pci_set_drvdata(pdev, np);
 
@@ -1358,7 +1354,7 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
if (dev-ram_base)
np-ram_ba = (u32)dev-ram_base;
 
-   

[PATCH 14/17] sym53c8xx: Get rid of IRQ_FMT and IRQ_PRM

2007-10-05 Thread Matthew Wilcox
These macros aren't needed any more.  They used to be used for SPARC.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |   11 ---
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index e731618..a82ed13 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -54,9 +54,6 @@
 #define NAME53Csym53c
 #define NAME53C8XX sym53c8xx
 
-#define IRQ_FMT %d
-#define IRQ_PRM(x) (x)
-
 struct sym_driver_setup sym_driver_setup = SYM_LINUX_DRIVER_SETUP;
 unsigned int sym_debug_flags = 0;
 
@@ -1196,8 +1193,8 @@ static int sym_host_info(struct sym_hcb *np, char *ptr, 
off_t offset, int len)
copy_info(info, Chip  NAME53C %s, device id 0x%x, 
 revision id 0x%x\n, np-s.chip_name,
 np-s.device-device, np-s.device-revision);
-   copy_info(info, At PCI address %s, IRQ  IRQ_FMT \n,
-   pci_name(np-s.device), IRQ_PRM(np-s.device-irq));
+   copy_info(info, At PCI address %s, IRQ %d\n,
+pci_name(np-s.device), np-s.device-irq);
copy_info(info, Min. period factor %d, %s SCSI BUS%s\n,
 (int) (np-minsync_dt ? np-minsync_dt : np-minsync),
 np-maxwide ? Wide : Narrow,
@@ -1283,9 +1280,9 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
unsigned long flags;
struct sym_fw *fw;
 
-   printk(KERN_INFO sym%d: %s rev 0x%x at pci %s irq  IRQ_FMT \n,
+   printk(KERN_INFO sym%d: %s rev 0x%x at pci %s irq %d\n,
unit, dev-chip.name, pdev-revision, pci_name(pdev),
-   IRQ_PRM(pdev-irq));
+   pdev-irq);
 
/*
 *  Get the firmware for this chip.
-- 
1.4.4.2

-
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/17] sym53c8xx: Use pdev-revision

2007-10-05 Thread Matthew Wilcox
Auke missed the sym2 driver in his initial sweep.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_fw.c   |6 +++---
 drivers/scsi/sym53c8xx_2/sym_glue.c |   25 +
 drivers/scsi/sym53c8xx_2/sym_hipd.c |8 
 drivers/scsi/sym53c8xx_2/sym_hipd.h |1 -
 4 files changed, 16 insertions(+), 24 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_fw.c 
b/drivers/scsi/sym53c8xx_2/sym_fw.c
index 9916a2a..2be0ae1 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw.c
+++ b/drivers/scsi/sym53c8xx_2/sym_fw.c
@@ -206,13 +206,13 @@ sym_fw2_patch(struct sym_hcb *np)
 *  they are not desirable. See `sym_fw2.h' for more details.
 */
if (!(np-device_id == PCI_DEVICE_ID_LSI_53C1010_66 
- np-revision_id  0x1 
+ np-s.device-revision  0x1 
  np-pciclk_khz  6)) {
scripta0-datao_phase[0] = cpu_to_scr(SCR_NO_OP);
scripta0-datao_phase[1] = cpu_to_scr(0);
}
-   if (!(np-device_id == PCI_DEVICE_ID_LSI_53C1010_33 
- /* np-revision_id  0xff */ 1)) {
+   if (!(np-device_id == PCI_DEVICE_ID_LSI_53C1010_33 /* 
+ np-s.device-revision  0xff */)) {
scripta0-sel_done[0] = cpu_to_scr(SCR_NO_OP);
scripta0-sel_done[1] = cpu_to_scr(0);
}
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index fec9c9c..ef707a4 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1254,8 +1254,8 @@ static int sym_host_info(struct sym_hcb *np, char *ptr, 
off_t offset, int len)
info.pos= 0;
 
copy_info(info, Chip  NAME53C %s, device id 0x%x, 
-revision id 0x%x\n,
-np-s.chip_name, np-device_id, np-revision_id);
+revision id 0x%x\n, np-s.chip_name,
+np-device_id, np-s.device-revision);
copy_info(info, At PCI address %s, IRQ  IRQ_FMT \n,
pci_name(np-s.device), IRQ_PRM(np-s.device-irq));
copy_info(info, Min. period factor %d, %s SCSI BUS%s\n,
@@ -1368,10 +1368,9 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
unsigned long flags;
struct sym_fw *fw;
 
-   printk(KERN_INFO
-   sym%d: %s rev 0x%x at pci %s irq  IRQ_FMT \n,
-   unit, dev-chip.name, dev-chip.revision_id,
-   pci_name(pdev), IRQ_PRM(pdev-irq));
+   printk(KERN_INFO sym%d: %s rev 0x%x at pci %s irq  IRQ_FMT \n,
+   unit, dev-chip.name, pdev-revision, pci_name(pdev),
+   IRQ_PRM(pdev-irq));
 
/*
 *  Get the firmware for this chip.
@@ -1412,7 +1411,6 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
np-s.device= pdev;
np-s.unit  = unit;
np-device_id   = dev-chip.device_id;
-   np-revision_id = dev-chip.revision_id;
np-features= dev-chip.features;
np-clock_divn  = dev-chip.nr_divisor;
np-maxoffs = dev-chip.offset_max;
@@ -1500,7 +1498,7 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
instance-transportt= sym2_transport_template;
 
/* 53c896 rev 1 errata: DMA may not cross 16MB boundary */
-   if (pdev-device == PCI_DEVICE_ID_NCR_53C896  np-revision_id  2)
+   if (pdev-device == PCI_DEVICE_ID_NCR_53C896  pdev-revision  2)
instance-dma_boundary = 0xFF;
 
spin_unlock_irqrestore(instance-host_lock, flags);
@@ -1545,7 +1543,6 @@ static int __devinit sym_check_supported(struct 
sym_device *device)
 {
struct sym_chip *chip;
struct pci_dev *pdev = device-pdev;
-   u_char revision;
unsigned long io_port = pci_resource_start(pdev, 0);
int i;
 
@@ -1565,14 +1562,12 @@ static int __devinit sym_check_supported(struct 
sym_device *device)
 * to our device structure so we can make it match the actual device
 * and options.
 */
-   pci_read_config_byte(pdev, PCI_CLASS_REVISION, revision);
-   chip = sym_lookup_chip_table(pdev-device, revision);
+   chip = sym_lookup_chip_table(pdev-device, pdev-revision);
if (!chip) {
dev_info(pdev-dev, device not supported\n);
return -ENODEV;
}
memcpy(device-chip, chip, sizeof(device-chip));
-   device-chip.revision_id = revision;
 
return 0;
 }
@@ -1613,7 +1608,7 @@ static int __devinit sym_set_workarounds(struct 
sym_device *device)
 *  We must ensure the chip will use WRITE AND INVALIDATE.
 *  The revision number limit is for now arbitrary.
 */
-   if (pdev-device == PCI_DEVICE_ID_NCR_53C896  chip-revision_id  
0x4) {
+   if (pdev-device == PCI_DEVICE_ID_NCR_53C896  pdev-revision  0x4) {
chip-features  |= (FE_WRIE | 

[PATCH 6/17] sym53c8xx: Stop overriding scsi_done

2007-10-05 Thread Matthew Wilcox
Instead of telling the reset routine that the command completed from
sym_eh_done, do it from sym_xpt_done.  The 'to_do' element of the ucmd
is redundant -- it serves only to tell whether eh_done is valid or not,
and we can tell this by checking to see if it's NULL.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |   60 ++
 1 files changed, 18 insertions(+), 42 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 4d49a9b..6bc8789 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -134,8 +134,6 @@ static struct scsi_transport_template 
*sym2_transport_template = NULL;
  *  Driver private area in the SCSI command structure.
  */
 struct sym_ucmd {  /* Override the SCSI pointer structure */
-   unsigned char   to_do;  /* For error handling */
-   void (*old_done)(struct scsi_cmnd *);   /* For error handling */
struct completion *eh_done; /* For error handling */
 };
 
@@ -147,6 +145,12 @@ struct sym_ucmd {  /* Override the SCSI pointer 
structure */
  */
 void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd)
 {
+   struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd);
+   BUILD_BUG_ON(sizeof(struct scsi_pointer)  sizeof(struct sym_ucmd));
+
+   if (ucmd-eh_done)
+   complete(ucmd-eh_done);
+
scsi_dma_unmap(cmd);
cmd-scsi_done(cmd);
 }
@@ -586,26 +590,6 @@ static void sym53c8xx_timer(unsigned long npref)
 #define SYM_EH_HOST_RESET  3
 
 /*
- *  What we will do regarding the involved SCSI command.
- */
-#define SYM_EH_DO_IGNORE   0
-#define SYM_EH_DO_WAIT 2
-
-/*
- *  scsi_done() alias when error recovery is in progress.
- */
-static void sym_eh_done(struct scsi_cmnd *cmd)
-{
-   struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd);
-   BUILD_BUG_ON(sizeof(struct scsi_pointer)  sizeof(struct sym_ucmd));
-
-   cmd-scsi_done = ucmd-old_done;
-
-   if (ucmd-to_do == SYM_EH_DO_WAIT)
-   complete(ucmd-eh_done);
-}
-
-/*
  *  Generic method for our eh processing.
  *  The 'op' argument tells what we have to do.
  */
@@ -615,7 +599,7 @@ static int sym_eh_handler(int op, char *opname, struct 
scsi_cmnd *cmd)
struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd);
struct Scsi_Host *host = cmd-device-host;
SYM_QUEHEAD *qp;
-   int to_do = SYM_EH_DO_IGNORE;
+   int cmd_queued = 0;
int sts = -1;
struct completion eh_done;
 
@@ -626,19 +610,11 @@ static int sym_eh_handler(int op, char *opname, struct 
scsi_cmnd *cmd)
FOR_EACH_QUEUED_ELEMENT(np-busy_ccbq, qp) {
struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, 
link_ccbq);
if (cp-cmd == cmd) {
-   to_do = SYM_EH_DO_WAIT;
+   cmd_queued = 1;
break;
}
}
 
-   if (to_do == SYM_EH_DO_WAIT) {
-   init_completion(eh_done);
-   ucmd-old_done = cmd-scsi_done;
-   ucmd-eh_done = eh_done;
-   wmb();
-   cmd-scsi_done = sym_eh_done;
-   }
-
/* Try to proceed the operation we have been asked for */
sts = -1;
switch(op) {
@@ -662,21 +638,21 @@ static int sym_eh_handler(int op, char *opname, struct 
scsi_cmnd *cmd)
}
 
/* On error, restore everything and cross fingers :) */
-   if (sts) {
-   cmd-scsi_done = ucmd-old_done;
-   to_do = SYM_EH_DO_IGNORE;
-   }
-
-   ucmd-to_do = to_do;
-   spin_unlock_irq(host-host_lock);
+   if (sts)
+   cmd_queued = 0;
 
-   if (to_do == SYM_EH_DO_WAIT) {
+   if (cmd_queued) {
+   init_completion(eh_done);
+   ucmd-eh_done = eh_done;
+   spin_unlock_irq(host-host_lock);
if (!wait_for_completion_timeout(eh_done, 5*HZ)) {
-   ucmd-to_do = SYM_EH_DO_IGNORE;
-   wmb();
+   ucmd-eh_done = NULL;
sts = -2;
}
+   } else {
+   spin_unlock_irq(host-host_lock);
}
+
dev_warn(cmd-device-sdev_gendev, %s operation %s.\n, opname,
sts==0 ? complete :sts==-2 ? timed-out : failed);
return sts ? SCSI_FAILED : SCSI_SUCCESS;
-- 
1.4.4.2

-
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 5/17] sym53c8xx: Don't disable interrupts in the interrupt handler

2007-10-05 Thread Matthew Wilcox
Interrupts can't be re-entered, so it's sufficient to call spin_lock, not
spin_lock_irqsave().

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index d614a9c..4d49a9b 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -550,14 +550,13 @@ static int sym53c8xx_queue_command(struct scsi_cmnd *cmd,
  */
 static irqreturn_t sym53c8xx_intr(int irq, void *dev_id)
 {
-   unsigned long flags;
-   struct sym_hcb *np = (struct sym_hcb *)dev_id;
+   struct sym_hcb *np = dev_id;
 
if (DEBUG_FLAGS  DEBUG_TINY) printf_debug ([);
 
-   spin_lock_irqsave(np-s.host-host_lock, flags);
+   spin_lock(np-s.host-host_lock);
sym_interrupt(np);
-   spin_unlock_irqrestore(np-s.host-host_lock, flags);
+   spin_unlock(np-s.host-host_lock);
 
if (DEBUG_FLAGS  DEBUG_TINY) printf_debug (]\n);
 
-- 
1.4.4.2

-
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 4/17] sym53c8xx: Remove unnecessary check in queuecommand

2007-10-05 Thread Matthew Wilcox
The midlayer won't scan the host ID, so we don't need to check.
This is the only caller of sym_xpt_done2, so remove that too.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |   18 +-
 1 files changed, 1 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 924b5dd..d614a9c 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -151,13 +151,6 @@ void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd 
*cmd)
cmd-scsi_done(cmd);
 }
 
-static void sym_xpt_done2(struct sym_hcb *np, struct scsi_cmnd *cmd, int 
cam_status)
-{
-   sym_set_cam_status(cmd, cam_status);
-   sym_xpt_done(np, cmd);
-}
-
-
 /*
  *  Tell the SCSI layer about a BUS RESET.
  */
@@ -324,15 +317,6 @@ static int sym_queue_command(struct sym_hcb *np, struct 
scsi_cmnd *cmd)
int order;
 
/*
-*  Minimal checkings, so that we will not 
-*  go outside our tables.
-*/
-   if (sdev-id == np-myaddr) {
-   sym_xpt_done2(np, cmd, DID_NO_CONNECT);
-   return 0;
-   }
-
-   /*
 *  Retrieve the target descriptor.
 */
tp = np-target[sdev-id];
@@ -537,7 +521,7 @@ static int sym53c8xx_queue_command(struct scsi_cmnd *cmd,
struct sym_ucmd *ucp = SYM_UCMD_PTR(cmd);
int sts = 0;
 
-   cmd-scsi_done = done;
+   cmd-scsi_done = done;
memset(ucp, 0, sizeof(*ucp));
 
/*
-- 
1.4.4.2

-
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/17] sym53c8xx: Work around 53c896 erratum

2007-10-05 Thread Matthew Wilcox
Prevent DMA transfers from crossing the 16MB limit for early 53c896 chips.

From: Kai Makisara [EMAIL PROTECTED]
Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |4 
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 3db2232..d5455e3 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1531,6 +1531,10 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
BUG_ON(sym2_transport_template == NULL);
instance-transportt= sym2_transport_template;
 
+   /* 53c896 rev 1 errata: DMA may not cross 16MB boundary */
+   if (pdev-device == PCI_DEVICE_ID_NCR_53C896  np-revision_id  2)
+   instance-dma_boundary = 0xFF;
+
spin_unlock_irqrestore(instance-host_lock, flags);
 
return instance;
-- 
1.4.4.2

-
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 2/17] sym53c8xx: Use pci_dev irq number

2007-10-05 Thread Matthew Wilcox
Don't cache a private copy of the interrupt number

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |7 +++
 drivers/scsi/sym53c8xx_2/sym_glue.h |1 -
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index d5455e3..11e0a28 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1288,7 +1288,7 @@ static int sym_host_info(struct sym_hcb *np, char *ptr, 
off_t offset, int len)
 revision id 0x%x\n,
 np-s.chip_name, np-device_id, np-revision_id);
copy_info(info, At PCI address %s, IRQ  IRQ_FMT \n,
-   pci_name(np-s.device), IRQ_PRM(np-s.irq));
+   pci_name(np-s.device), IRQ_PRM(np-s.device-irq));
copy_info(info, Min. period factor %d, %s SCSI BUS%s\n,
 (int) (np-minsync_dt ? np-minsync_dt : np-minsync),
 np-maxwide ? Wide : Narrow,
@@ -1341,8 +1341,8 @@ static void sym_free_resources(struct sym_hcb *np, struct 
pci_dev *pdev)
/*
 *  Free O/S specific resources.
 */
-   if (np-s.irq)
-   free_irq(np-s.irq, np);
+   if (pdev-irq)
+   free_irq(pdev-irq, np);
if (np-s.ioaddr)
pci_iounmap(pdev, np-s.ioaddr);
if (np-s.ramaddr)
@@ -1491,7 +1491,6 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
sym_name(np), pdev-irq);
goto attach_failed;
}
-   np-s.irq = pdev-irq;
 
/*
 *  After SCSI devices have been opened, we cannot
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.h 
b/drivers/scsi/sym53c8xx_2/sym_glue.h
index 0f097ba..bea7bcc 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.h
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.h
@@ -184,7 +184,6 @@ struct sym_shcb {
void __iomem *  ioaddr; /* MMIO kernel io address   */
void __iomem *  ramaddr;/* RAM  kernel io address   */
u_short io_ws;  /* IO window size   */
-   int irq;/* IRQ number   */
 
struct timer_list timer;/* Timer handler link header*/
u_long  lasttime;
-- 
1.4.4.2

-
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 3/17] sym53c8xx: Remove data_mapping and data_mapped

2007-10-05 Thread Matthew Wilcox
Before all commands used sg, data_mapping and data_mapped were used to
distinguish whether the command had used map_single or map_sg.  Now all
commands are sg, so we can delete data_mapping, data_mapped and the
wrapper functions __unmap_scsi_data, __map_scsi_sg_data, unmap_scsi_data
and map_scsi_sg_data.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |   33 +++--
 1 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 11e0a28..924b5dd 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -134,8 +134,6 @@ static struct scsi_transport_template 
*sym2_transport_template = NULL;
  *  Driver private area in the SCSI command structure.
  */
 struct sym_ucmd {  /* Override the SCSI pointer structure */
-   dma_addr_t  data_mapping;
-   unsigned char   data_mapped;
unsigned char   to_do;  /* For error handling */
void (*old_done)(struct scsi_cmnd *);   /* For error handling */
struct completion *eh_done; /* For error handling */
@@ -144,37 +142,12 @@ struct sym_ucmd { /* Override the SCSI pointer 
structure */
 #define SYM_UCMD_PTR(cmd)  ((struct sym_ucmd *)((cmd)-SCp))
 #define SYM_SOFTC_PTR(cmd) sym_get_hcb(cmd-device-host)
 
-static void __unmap_scsi_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)
-{
-   if (SYM_UCMD_PTR(cmd)-data_mapped)
-   scsi_dma_unmap(cmd);
-
-   SYM_UCMD_PTR(cmd)-data_mapped = 0;
-}
-
-static int __map_scsi_sg_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)
-{
-   int use_sg;
-
-   use_sg = scsi_dma_map(cmd);
-   if (use_sg  0) {
-   SYM_UCMD_PTR(cmd)-data_mapped  = 2;
-   SYM_UCMD_PTR(cmd)-data_mapping = use_sg;
-   }
-
-   return use_sg;
-}
-
-#define unmap_scsi_data(np, cmd)   \
-   __unmap_scsi_data(np-s.device, cmd)
-#define map_scsi_sg_data(np, cmd)  \
-   __map_scsi_sg_data(np-s.device, cmd)
 /*
  *  Complete a pending CAM CCB.
  */
 void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd)
 {
-   unmap_scsi_data(np, cmd);
+   scsi_dma_unmap(cmd);
cmd-scsi_done(cmd);
 }
 
@@ -307,14 +280,14 @@ static int sym_scatter(struct sym_hcb *np, struct sym_ccb 
*cp, struct scsi_cmnd
 
cp-data_len = 0;
 
-   use_sg = map_scsi_sg_data(np, cmd);
+   use_sg = scsi_dma_map(cmd);
if (use_sg  0) {
struct scatterlist *sg;
struct sym_tcb *tp = np-target[cp-target];
struct sym_tblmove *data;
 
if (use_sg  SYM_CONF_MAX_SG) {
-   unmap_scsi_data(np, cmd);
+   scsi_dma_unmap(cmd);
return -1;
}
 
-- 
1.4.4.2

-
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 9/17] sym53c8xx: Remove -device_id

2007-10-05 Thread Matthew Wilcox
Following the same path as -revision_id, remove -device_id

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_fw.c|4 ++--
 drivers/scsi/sym53c8xx_2/sym_glue.c  |4 +---
 drivers/scsi/sym53c8xx_2/sym_glue.h  |1 -
 drivers/scsi/sym53c8xx_2/sym_hipd.c  |   16 
 drivers/scsi/sym53c8xx_2/sym_hipd.h  |1 -
 drivers/scsi/sym53c8xx_2/sym_nvram.c |2 +-
 6 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_fw.c 
b/drivers/scsi/sym53c8xx_2/sym_fw.c
index 2be0ae1..3d4db80 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw.c
+++ b/drivers/scsi/sym53c8xx_2/sym_fw.c
@@ -205,13 +205,13 @@ sym_fw2_patch(struct sym_hcb *np)
 *  Remove a couple of work-arounds specific to C1010 if 
 *  they are not desirable. See `sym_fw2.h' for more details.
 */
-   if (!(np-device_id == PCI_DEVICE_ID_LSI_53C1010_66 
+   if (!(np-s.device-device == PCI_DEVICE_ID_LSI_53C1010_66 
  np-s.device-revision  0x1 
  np-pciclk_khz  6)) {
scripta0-datao_phase[0] = cpu_to_scr(SCR_NO_OP);
scripta0-datao_phase[1] = cpu_to_scr(0);
}
-   if (!(np-device_id == PCI_DEVICE_ID_LSI_53C1010_33 /* 
+   if (!(np-s.device-device == PCI_DEVICE_ID_LSI_53C1010_33 /* 
  np-s.device-revision  0xff */)) {
scripta0-sel_done[0] = cpu_to_scr(SCR_NO_OP);
scripta0-sel_done[1] = cpu_to_scr(0);
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index ef707a4..357903f 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1255,7 +1255,7 @@ static int sym_host_info(struct sym_hcb *np, char *ptr, 
off_t offset, int len)
 
copy_info(info, Chip  NAME53C %s, device id 0x%x, 
 revision id 0x%x\n, np-s.chip_name,
-np-device_id, np-s.device-revision);
+np-s.device-device, np-s.device-revision);
copy_info(info, At PCI address %s, IRQ  IRQ_FMT \n,
pci_name(np-s.device), IRQ_PRM(np-s.device-irq));
copy_info(info, Min. period factor %d, %s SCSI BUS%s\n,
@@ -1410,7 +1410,6 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
np-verbose = sym_driver_setup.verbose;
np-s.device= pdev;
np-s.unit  = unit;
-   np-device_id   = dev-chip.device_id;
np-features= dev-chip.features;
np-clock_divn  = dev-chip.nr_divisor;
np-maxoffs = dev-chip.offset_max;
@@ -1528,7 +1527,6 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
 static void __devinit sym_get_nvram(struct sym_device *devp, struct sym_nvram 
*nvp)
 {
devp-nvram = nvp;
-   devp-device_id = devp-chip.device_id;
nvp-type = 0;
 
sym_read_nvram(devp, nvp);
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.h 
b/drivers/scsi/sym53c8xx_2/sym_glue.h
index d5ba5aa..b961f70 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.h
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.h
@@ -212,7 +212,6 @@ struct sym_device {
} s;
struct sym_chip chip;
struct sym_nvram *nvram;
-   u_short device_id;
u_char host_id;
 };
 
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c 
b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 9f4198c..5443394 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -804,7 +804,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, 
struct sym_hcb *np, stru
 *  In dual channel mode, contention occurs if internal cycles
 *  are used. Disable internal cycles.
 */
-   if (np-device_id == PCI_DEVICE_ID_LSI_53C1010_33 
+   if (np-s.device-device == PCI_DEVICE_ID_LSI_53C1010_33 
np-s.device-revision  0x1)
np-rv_ccntl0   |=  DILS;
 
@@ -828,9 +828,9 @@ static int sym_prepare_setting(struct Scsi_Host *shost, 
struct sym_hcb *np, stru
 *  this driver. The generic ncr driver that does not use 
 *  LOAD/STORE instructions does not need this work-around.
 */
-   if ((np-device_id == PCI_DEVICE_ID_NCR_53C810 
+   if ((np-s.device-device == PCI_DEVICE_ID_NCR_53C810 
 np-s.device-revision = 0x10  np-s.device-revision = 0x11) 
||
-   (np-device_id == PCI_DEVICE_ID_NCR_53C860 
+   (np-s.device-device == PCI_DEVICE_ID_NCR_53C860 
 np-s.device-revision = 0x1))
np-features = ~(FE_WRIE|FE_ERL|FE_ERMP);
 
@@ -897,7 +897,7 @@ static int sym_prepare_setting(struct Scsi_Host *shost, 
struct sym_hcb *np, stru
if ((SYM_SETUP_SCSI_LED || 
 (nvram-type == SYM_SYMBIOS_NVRAM ||
  (nvram-type == SYM_TEKRAM_NVRAM 
-  np-device_id == PCI_DEVICE_ID_NCR_53C895))) 
+  np-s.device-device == PCI_DEVICE_ID_NCR_53C895))) 
  

[PATCH 12/17] sym53c8xx: Simplify DAC DMA handling

2007-10-05 Thread Matthew Wilcox
By introducing the use_dac(), set_dac() and DMA_DAC_MASK macros, we can
eliminate a lot of ifdefs from the code.  We now rely on the compiler to
optimise away a few things that we'd formerly relied on the preprocessor
to do.  This makes sym_setup_bus_dma_mask() small enough to inline into
its only caller.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_fw.c   |2 +-
 drivers/scsi/sym53c8xx_2/sym_glue.c |   32 ++--
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   23 ---
 drivers/scsi/sym53c8xx_2/sym_hipd.h |   11 +++
 4 files changed, 26 insertions(+), 42 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_fw.c 
b/drivers/scsi/sym53c8xx_2/sym_fw.c
index 3d4db80..aa230d2 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw.c
+++ b/drivers/scsi/sym53c8xx_2/sym_fw.c
@@ -167,7 +167,7 @@ sym_fw2_patch(struct sym_hcb *np)
 *  Remove useless 64 bit DMA specific SCRIPTS, 
 *  when this feature is not available.
 */
-   if (!np-use_dac) {
+   if (!use_dac(np)) {
scripta0-is_dmap_dirty[0] = cpu_to_scr(SCR_NO_OP);
scripta0-is_dmap_dirty[1] = 0;
scripta0-is_dmap_dirty[2] = cpu_to_scr(SCR_NO_OP);
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 7717ab8..e5b2213 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1265,31 +1265,6 @@ static void sym_free_resources(struct sym_hcb *np, 
struct pci_dev *pdev)
 }
 
 /*
- *  Ask/tell the system about DMA addressing.
- */
-static int sym_setup_bus_dma_mask(struct sym_hcb *np)
-{
-#if SYM_CONF_DMA_ADDRESSING_MODE  0
-#if   SYM_CONF_DMA_ADDRESSING_MODE == 1
-#defineDMA_DAC_MASKDMA_40BIT_MASK
-#elif SYM_CONF_DMA_ADDRESSING_MODE == 2
-#defineDMA_DAC_MASKDMA_64BIT_MASK
-#endif
-   if ((np-features  FE_DAC) 
-   !pci_set_dma_mask(np-s.device, DMA_DAC_MASK)) {
-   np-use_dac = 1;
-   return 0;
-   }
-#endif
-
-   if (!pci_set_dma_mask(np-s.device, DMA_32BIT_MASK))
-   return 0;
-
-   printf_warning(%s: No suitable DMA available\n, sym_name(np));
-   return -1;
-}
-
-/*
  *  Host attach and initialisations.
  *
  *  Allocate host data and ncb structure.
@@ -1362,8 +1337,13 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
strlcpy(np-s.chip_name, dev-chip.name, sizeof(np-s.chip_name));
sprintf(np-s.inst_name, sym%d, np-s.unit);
 
-   if (sym_setup_bus_dma_mask(np))
+   if ((SYM_CONF_DMA_ADDRESSING_MODE  0)  (np-features  FE_DAC) 
+   !pci_set_dma_mask(np-s.device, DMA_DAC_MASK)) {
+   set_dac(np);
+   } else if (pci_set_dma_mask(np-s.device, DMA_32BIT_MASK)) {
+   printf_warning(%s: No suitable DMA available\n, sym_name(np));
goto attach_failed;
+   }
 
/*
 *  Try to map the controller chip to
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c 
b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 39f84bb..5d0d356 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -778,19 +778,12 @@ static int sym_prepare_setting(struct Scsi_Host *shost, 
struct sym_hcb *np, stru
 *  64 bit addressing  (895A/896/1010) ?
 */
if (np-features  FE_DAC) {
-#if   SYM_CONF_DMA_ADDRESSING_MODE == 0
-   np-rv_ccntl1   |= (DDAC);
-#elif SYM_CONF_DMA_ADDRESSING_MODE == 1
-   if (!np-use_dac)
-   np-rv_ccntl1   |= (DDAC);
-   else
-   np-rv_ccntl1   |= (XTIMOD | EXTIBMV);
-#elif SYM_CONF_DMA_ADDRESSING_MODE == 2
-   if (!np-use_dac)
-   np-rv_ccntl1   |= (DDAC);
-   else
-   np-rv_ccntl1   |= (0 | EXTIBMV);
-#endif
+   if (!use_dac(np))
+   np-rv_ccntl1 |= (DDAC);
+   else if (SYM_CONF_DMA_ADDRESSING_MODE == 1)
+   np-rv_ccntl1 |= (XTIMOD | EXTIBMV);
+   else if (SYM_CONF_DMA_ADDRESSING_MODE == 2)
+   np-rv_ccntl1 |= (0 | EXTIBMV);
}
 
/*
@@ -1322,7 +1315,7 @@ int sym_lookup_dmap(struct sym_hcb *np, u32 h, int s)
 {
int i;
 
-   if (!np-use_dac)
+   if (!use_dac(np))
goto weird;
 
/* Look up existing mappings */
@@ -1837,7 +1830,7 @@ void sym_start_up (struct sym_hcb *np, int reason)
 *  Set up scratch C and DRS IO registers to map the 32 bit 
 *  DMA address range our data structures are located in.
 */
-   if (np-use_dac) {
+   if (use_dac(np)) {
np-dmap_bah[0] = 0;/* ??? */
OUTL(np, nc_scrx[0], np-dmap_bah[0]);
OUTL(np, nc_drs, np-dmap_bah[0]);
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h 

[PATCH 16/17] sym53c8xx: Remove pci_dev pointer from sym_shcb

2007-10-05 Thread Matthew Wilcox
This structure is accessed by the device; the fewer Linux things in it,
the better.  Using the pci_dev pointer from the hostdata requires a lot
of changes:

 - Pass Scsi_Host to a lot of routines which currently take a sym_hcb.
 - Set the Scsi_Host as the pci drvdata (instead of the sym_hcb)

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_fw.c   |   16 --
 drivers/scsi/sym53c8xx_2/sym_fw.h   |2 +-
 drivers/scsi/sym53c8xx_2/sym_glue.c |   97 ++-
 drivers/scsi/sym53c8xx_2/sym_glue.h |5 +-
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   60 +-
 drivers/scsi/sym53c8xx_2/sym_hipd.h |4 +-
 6 files changed, 99 insertions(+), 85 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_fw.c 
b/drivers/scsi/sym53c8xx_2/sym_fw.c
index aa230d2..190770b 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw.c
+++ b/drivers/scsi/sym53c8xx_2/sym_fw.c
@@ -104,8 +104,9 @@ static struct sym_fwz_ofs sym_fw2z_ofs = {
  *  Patch routine for firmware #1.
  */
 static void
-sym_fw1_patch(struct sym_hcb *np)
+sym_fw1_patch(struct Scsi_Host *shost)
 {
+   struct sym_hcb *np = sym_get_hcb(shost);
struct sym_fw1a_scr *scripta0;
struct sym_fw1b_scr *scriptb0;
 
@@ -145,8 +146,11 @@ sym_fw1_patch(struct sym_hcb *np)
  *  Patch routine for firmware #2.
  */
 static void
-sym_fw2_patch(struct sym_hcb *np)
+sym_fw2_patch(struct Scsi_Host *shost)
 {
+   struct sym_data *sym_data = shost_priv(shost);
+   struct pci_dev *pdev = sym_data-pdev;
+   struct sym_hcb *np = sym_data-ncb;
struct sym_fw2a_scr *scripta0;
struct sym_fw2b_scr *scriptb0;
 
@@ -205,14 +209,14 @@ sym_fw2_patch(struct sym_hcb *np)
 *  Remove a couple of work-arounds specific to C1010 if 
 *  they are not desirable. See `sym_fw2.h' for more details.
 */
-   if (!(np-s.device-device == PCI_DEVICE_ID_LSI_53C1010_66 
- np-s.device-revision  0x1 
+   if (!(pdev-device == PCI_DEVICE_ID_LSI_53C1010_66 
+ pdev-revision  0x1 
  np-pciclk_khz  6)) {
scripta0-datao_phase[0] = cpu_to_scr(SCR_NO_OP);
scripta0-datao_phase[1] = cpu_to_scr(0);
}
-   if (!(np-s.device-device == PCI_DEVICE_ID_LSI_53C1010_33 /* 
- np-s.device-revision  0xff */)) {
+   if (!(pdev-device == PCI_DEVICE_ID_LSI_53C1010_33 /* 
+ pdev-revision  0xff */)) {
scripta0-sel_done[0] = cpu_to_scr(SCR_NO_OP);
scripta0-sel_done[1] = cpu_to_scr(0);
}
diff --git a/drivers/scsi/sym53c8xx_2/sym_fw.h 
b/drivers/scsi/sym53c8xx_2/sym_fw.h
index 66ec35b..ae7e0f9 100644
--- a/drivers/scsi/sym53c8xx_2/sym_fw.h
+++ b/drivers/scsi/sym53c8xx_2/sym_fw.h
@@ -143,7 +143,7 @@ struct sym_fw {
*z_ofs; /* Useful offsets in script Z   */
/* Setup and patch methods for this firmware */
void(*setup)(struct sym_hcb *, struct sym_fw *);
-   void(*patch)(struct sym_hcb *);
+   void(*patch)(struct Scsi_Host *);
 };
 
 /*
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index e515485..4c7b8a6 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -497,14 +497,16 @@ static void sym_timer(struct sym_hcb *np)
 /*
  *  PCI BUS error handler.
  */
-void sym_log_bus_error(struct sym_hcb *np)
+void sym_log_bus_error(struct Scsi_Host *shost)
 {
-   u_short pci_sts;
-   pci_read_config_word(np-s.device, PCI_STATUS, pci_sts);
+   struct sym_data *sym_data = shost_priv(shost);
+   struct pci_dev *pdev = sym_data-pdev;
+   unsigned short pci_sts;
+   pci_read_config_word(pdev, PCI_STATUS, pci_sts);
if (pci_sts  0xf900) {
-   pci_write_config_word(np-s.device, PCI_STATUS, pci_sts);
-   printf(%s: PCI STATUS = 0x%04x\n,
-   sym_name(np), pci_sts  0xf900);
+   pci_write_config_word(pdev, PCI_STATUS, pci_sts);
+   shost_printk(KERN_WARNING, shost,
+   PCI bus error: status = 0x%04x\n, pci_sts  0xf900);
}
 }
 
@@ -595,16 +597,17 @@ static void sym53c8xx_timer(unsigned long npref)
  */
 static int sym_eh_handler(int op, char *opname, struct scsi_cmnd *cmd)
 {
-   struct sym_hcb *np = SYM_SOFTC_PTR(cmd);
struct sym_ucmd *ucmd = SYM_UCMD_PTR(cmd);
-   struct Scsi_Host *host = cmd-device-host;
-   struct pci_dev *pdev = np-s.device;
+   struct Scsi_Host *shost = cmd-device-host;
+   struct sym_data *sym_data = shost_priv(shost);
+   struct pci_dev *pdev = sym_data-pdev;
+   struct sym_hcb *np = sym_data-ncb;
SYM_QUEHEAD *qp;
int cmd_queued = 0;
int sts = -1;
struct completion eh_done;
 
-   scmd_printk(KERN_WARNING, cmd, %s operation started.\n, opname);
+   scmd_printk(KERN_WARNING, cmd, %s operation started\n, opname);
 
   

[PATCH 11/17] sym53c8xx: Remove tag_ctrl module parameter

2007-10-05 Thread Matthew Wilcox
With sysfs making these options tunable at runtime, there's no
justification for keeping this horrendously complex specification
string around.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 Documentation/scsi/sym53c8xx_2.txt   |   21 +++
 drivers/scsi/sym53c8xx_2/sym53c8xx.h |1 -
 drivers/scsi/sym53c8xx_2/sym_glue.c  |   66 ++
 3 files changed, 8 insertions(+), 80 deletions(-)

diff --git a/Documentation/scsi/sym53c8xx_2.txt 
b/Documentation/scsi/sym53c8xx_2.txt
index 3d9f06b..49ea5c5 100644
--- a/Documentation/scsi/sym53c8xx_2.txt
+++ b/Documentation/scsi/sym53c8xx_2.txt
@@ -449,25 +449,14 @@ options as above.
 cmd_per_lun=#tags (#tags  1) tagged command queuing enabled
   #tags will be truncated to the max queued commands configuration parameter.
 
-10.2.2  Detailed control of tagged commands
-  This option allows you to specify a command queue depth for each device 
-  that supports tagged command queueing.
-  Example:
-  tag_ctrl=10/t2t3q16-t5q24/t1u2q32
-  will set devices queue depth as follow:
-  - controller #0 target #2 and target #3  - 16 commands,
-  - controller #0 target #5- 24 commands,
-  - controller #1 target #1 logical unit #2- 32 commands,
-  - all other logical units (all targets, all controllers) - 10 commands.
-
-10.2.3 Burst max
+10.2.2 Burst max
 burst=0burst disabled
 burst=255  get burst length from initial IO register settings.
 burst=#x   burst enabled (1#x burst transfers max)
   #x is an integer value which is log base 2 of the burst transfers max.
   By default the driver uses the maximum value supported by the chip.
 
-10.2.4 LED support
+10.2.3 LED support
 led=1  enable  LED support
 led=0  disable LED support
   Do not enable LED support if your scsi board does not use SDMS BIOS.
@@ -560,9 +549,9 @@ Previously, the sym2 driver accepted arguments of the form
sym53c8xx=tags:4,sync:10,debug:0x200
 
 As a result of the new module parameters, this is no longer available.
-Most of the options have remained the same, but tags has split into
-cmd_per_lun and tag_ctrl for its two different purposes.  The sample above
-would be specified as:
+Most of the options have remained the same, but tags has become
+cmd_per_lun to reflect its different purposes.  The sample above would
+be specified as:
modprobe sym53c8xx cmd_per_lun=4 sync=10 debug=0x200
 
 or on the kernel boot line as:
diff --git a/drivers/scsi/sym53c8xx_2/sym53c8xx.h 
b/drivers/scsi/sym53c8xx_2/sym53c8xx.h
index 7519728..62d29cf 100644
--- a/drivers/scsi/sym53c8xx_2/sym53c8xx.h
+++ b/drivers/scsi/sym53c8xx_2/sym53c8xx.h
@@ -127,7 +127,6 @@ struct sym_driver_setup {
u_char  settle_delay;
u_char  use_nvram;
u_long  excludes[8];
-   chartag_ctrl[100];
 };
 
 #define SYM_SETUP_MAX_TAG  sym_driver_setup.max_tag
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 6865d30..7717ab8 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -63,7 +63,6 @@ unsigned int sym_debug_flags = 0;
 static char *excl_string;
 static char *safe_string;
 module_param_named(cmd_per_lun, sym_driver_setup.max_tag, ushort, 0);
-module_param_string(tag_ctrl, sym_driver_setup.tag_ctrl, 100, 0);
 module_param_named(burst, sym_driver_setup.burst_order, byte, 0);
 module_param_named(led, sym_driver_setup.scsi_led, byte, 0);
 module_param_named(diff, sym_driver_setup.scsi_diff, byte, 0);
@@ -78,7 +77,6 @@ module_param_named(excl, excl_string, charp, 0);
 module_param_named(safe, safe_string, charp, 0);
 
 MODULE_PARM_DESC(cmd_per_lun, The maximum number of tags to use by default);
-MODULE_PARM_DESC(tag_ctrl, More detailed control over tags per LUN);
 MODULE_PARM_DESC(burst, Maximum burst.  0 to disable, 255 to read from 
registers);
 MODULE_PARM_DESC(led, Set to 1 to enable LED support);
 MODULE_PARM_DESC(diff, 0 for no differential mode, 1 for BIOS, 2 for always, 
3 for not GPIO3);
@@ -744,59 +742,6 @@ static void sym_tune_dev_queuing(struct sym_tcb *tp, int 
lun, u_short reqtags)
}
 }
 
-/*
- *  Linux select queue depths function
- */
-#define DEF_DEPTH  (sym_driver_setup.max_tag)
-#define ALL_TARGETS-2
-#define NO_TARGET  -1
-#define ALL_LUNS   -2
-#define NO_LUN -1
-
-static int device_queue_depth(struct sym_hcb *np, int target, int lun)
-{
-   int c, h, t, u, v;
-   char *p = sym_driver_setup.tag_ctrl;
-   char *ep;
-
-   h = -1;
-   t = NO_TARGET;
-   u = NO_LUN;
-   while ((c = *p++) != 0) {
-   v = simple_strtoul(p, ep, 0);
-   switch(c) {
-   case '/':
-   ++h;
-   t = ALL_TARGETS;
-   u = ALL_LUNS;
-   break;
-   case 't':
-  

[PATCH 17/17] sym53c8xx: Remove sym_xpt_async_sent_bdr

2007-10-05 Thread Matthew Wilcox
This function just printed a message to the user; move the print to its
only caller, and turn it into an starget_printk.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |8 
 drivers/scsi/sym53c8xx_2/sym_glue.h |1 -
 drivers/scsi/sym53c8xx_2/sym_hipd.c |3 ++-
 3 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 4c7b8a6..74300dd 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -163,14 +163,6 @@ void sym_xpt_async_bus_reset(struct sym_hcb *np)
 }
 
 /*
- *  Tell the SCSI layer about a BUS DEVICE RESET message sent.
- */
-void sym_xpt_async_sent_bdr(struct sym_hcb *np, int target)
-{
-   printf_notice(%s: TARGET %d has been reset.\n, sym_name(np), target);
-}
-
-/*
  *  Choose the more appropriate CAM status if 
  *  the IO encountered an extended error.
  */
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.h 
b/drivers/scsi/sym53c8xx_2/sym_glue.h
index e5bd0af..567fbe0 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.h
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.h
@@ -263,7 +263,6 @@ void sym_set_cam_result_error(struct sym_hcb *np, struct 
sym_ccb *cp, int resid)
 void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *ccb);
 #define sym_print_addr(cmd, arg...) dev_info(cmd-device-sdev_gendev , ## 
arg)
 void sym_xpt_async_bus_reset(struct sym_hcb *np);
-void sym_xpt_async_sent_bdr(struct sym_hcb *np, int target);
 int  sym_setup_data_and_start (struct sym_hcb *np, struct scsi_cmnd *csio, 
struct sym_ccb *cp);
 void sym_log_bus_error(struct Scsi_Host *);
 void sym_dump_registers(struct Scsi_Host *);
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c 
b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 3cf1209..463f119 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -3543,7 +3543,8 @@ static void sym_sir_task_recovery(struct sym_hcb *np, int 
num)
 *  If we sent a BDR, make upper layer aware of that.
 */
if (np-abrt_msg[0] == M_RESET)
-   sym_xpt_async_sent_bdr(np, target);
+   starget_printk(KERN_NOTICE, starget,
+   has been reset\n);
break;
}
 
-- 
1.4.4.2

-
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 13/17] sym53c8xx: Use scmd_printk where appropriate

2007-10-05 Thread Matthew Wilcox
If we have a scsi_cmnd, it gives the user more information than the
sym_name, and maybe the target.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |4 ++--
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   35 +--
 2 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index e5b2213..e731618 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -392,7 +392,7 @@ int sym_setup_data_and_start(struct sym_hcb *np, struct 
scsi_cmnd *cmd, struct s
 */
switch (dir) {
case DMA_BIDIRECTIONAL:
-   printk(%s: got DMA_BIDIRECTIONAL command, sym_name(np));
+   scmd_printk(KERN_INFO, cmd, got DMA_BIDIRECTIONAL command);
sym_set_cam_status(cmd, DID_ERROR);
goto out_abort;
case DMA_TO_DEVICE:
@@ -606,7 +606,7 @@ static int sym_eh_handler(int op, char *opname, struct 
scsi_cmnd *cmd)
int sts = -1;
struct completion eh_done;
 
-   dev_warn(cmd-device-sdev_gendev, %s operation started.\n, opname);
+   scmd_printk(KERN_WARNING, cmd, %s operation started.\n, opname);
 
/* We may be in an error condition because the PCI bus
 * went down. In this case, we need to wait until the
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c 
b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 5d0d356..13fd5b2 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -52,7 +52,7 @@
  *  Needed function prototypes.
  */
 static void sym_int_ma (struct sym_hcb *np);
-static void sym_int_sir (struct sym_hcb *np);
+static void sym_int_sir(struct sym_hcb *);
 static struct sym_ccb *sym_alloc_ccb(struct sym_hcb *np);
 static struct sym_ccb *sym_ccb_from_dsa(struct sym_hcb *np, u32 dsa);
 static void sym_alloc_lcb_tags (struct sym_hcb *np, u_char tn, u_char ln);
@@ -1522,7 +1522,8 @@ void sym_put_start_queue(struct sym_hcb *np, struct 
sym_ccb *cp)
np-squeueput = qidx;
 
if (DEBUG_FLAGS  DEBUG_QUEUE)
-   printf (%s: queuepos=%d.\n, sym_name (np), np-squeueput);
+   scmd_printk(KERN_DEBUG, cp-cmd, queuepos=%d\n,
+   np-squeueput);
 
/*
 *  Script processor may be waiting for reselect.
@@ -2852,7 +2853,7 @@ void sym_interrupt (struct sym_hcb *np)
!(dstat  (MDPE|BF|ABRT|IID))) {
if  (sist  PAR)sym_int_par (np, sist);
else if (sist  MA) sym_int_ma (np);
-   else if (dstat  SIR)   sym_int_sir (np);
+   else if (dstat  SIR)   sym_int_sir(np);
else if (dstat  SSI)   OUTONB_STD();
elsegoto unknown_int;
return;
@@ -4314,7 +4315,7 @@ static void sym_nego_rejected(struct sym_hcb *np, struct 
sym_tcb *tp, struct sym
 /*
  *  chip exception handler for programmed interrupts.
  */
-static void sym_int_sir (struct sym_hcb *np)
+static void sym_int_sir(struct sym_hcb *np)
 {
u_char  num = INB(np, nc_dsps);
u32 dsa = INL(np, nc_dsa);
@@ -4353,31 +4354,30 @@ static void sym_int_sir (struct sym_hcb *np)
return;
/*
 *  The device didn't go to MSG OUT phase after having 
-*  been selected with ATN. We donnot want to handle 
-*  that.
+*  been selected with ATN.  We do not want to handle that.
 */
case SIR_SEL_ATN_NO_MSG_OUT:
-   printf (%s:%d: No MSG OUT phase after selection with ATN.\n,
-   sym_name (np), target);
+   scmd_printk(KERN_WARNING, cp-cmd,
+   No MSG OUT phase after selection with ATN\n);
goto out_stuck;
/*
 *  The device didn't switch to MSG IN phase after 
-*  having reseleted the initiator.
+*  having reselected the initiator.
 */
case SIR_RESEL_NO_MSG_IN:
-   printf (%s:%d: No MSG IN phase after reselection.\n,
-   sym_name (np), target);
+   scmd_printk(KERN_WARNING, cp-cmd,
+   No MSG IN phase after reselection\n);
goto out_stuck;
/*
 *  After reselection, the device sent a message that wasn't 
 *  an IDENTIFY.
 */
case SIR_RESEL_NO_IDENTIFY:
-   printf (%s:%d: No IDENTIFY after reselection.\n,
-   sym_name (np), target);
+   scmd_printk(KERN_WARNING, cp-cmd,
+   No IDENTIFY after reselection\n);
goto out_stuck;
/*
-*  The device reselected a LUN we donnot know about.
+*  The device reselected a LUN we do not know about.
 */
case SIR_RESEL_BAD_LUN:

[PATCH 10/17] sym53c8xx: Remove io_ws, mmio_ws and ram_ws elements

2007-10-05 Thread Matthew Wilcox
These struct elements record info that is never needed

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |5 +
 drivers/scsi/sym53c8xx_2/sym_glue.h |1 -
 drivers/scsi/sym53c8xx_2/sym_hipd.c |7 ++-
 drivers/scsi/sym53c8xx_2/sym_hipd.h |3 ---
 4 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 357903f..6865d30 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1432,17 +1432,14 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
np-mmio_ba = (u32)dev-mmio_base;
np-s.ioaddr= dev-s.ioaddr;
np-s.ramaddr   = dev-s.ramaddr;
-   np-s.io_ws = (np-features  FE_IO256) ? 256 : 128;
 
/*
 *  Map on-chip RAM if present and supported.
 */
if (!(np-features  FE_RAM))
dev-ram_base = 0;
-   if (dev-ram_base) {
+   if (dev-ram_base)
np-ram_ba = (u32)dev-ram_base;
-   np-ram_ws = (np-features  FE_RAM8K) ? 8192 : 4096;
-   }
 
if (sym_hcb_attach(instance, fw, dev-nvram))
goto attach_failed;
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.h 
b/drivers/scsi/sym53c8xx_2/sym_glue.h
index b961f70..ab2de1c 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.h
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.h
@@ -184,7 +184,6 @@ struct sym_shcb {
 
void __iomem *  ioaddr; /* MMIO kernel io address   */
void __iomem *  ramaddr;/* RAM  kernel io address   */
-   u_short io_ws;  /* IO window size   */
 
struct timer_list timer;/* Timer handler link header*/
u_long  lasttime;
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c 
b/drivers/scsi/sym53c8xx_2/sym_hipd.c
index 5443394..39f84bb 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.c
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1910,7 +1910,7 @@ void sym_start_up (struct sym_hcb *np, int reason)
if (sym_verbose = 2)
printf(%s: Downloading SCSI SCRIPTS.\n, sym_name(np));
memcpy_toio(np-s.ramaddr, np-scripta0, np-scripta_sz);
-   if (np-ram_ws == 8192) {
+   if (np-features  FE_RAM8K) {
memcpy_toio(np-s.ramaddr + 4096, np-scriptb0, 
np-scriptb_sz);
phys = scr_to_cpu(np-scr_ram_seg);
OUTL(np, nc_mmws, phys);
@@ -5595,16 +5595,13 @@ int sym_hcb_attach(struct Scsi_Host *shost, struct 
sym_fw *fw, struct sym_nvram
np-scriptz_ba  = vtobus(np-scriptz0);
 
if (np-ram_ba) {
-   np-scripta_ba  = np-ram_ba;
+   np-scripta_ba = np-ram_ba;
if (np-features  FE_RAM8K) {
-   np-ram_ws = 8192;
np-scriptb_ba = np-scripta_ba + 4096;
 #if 0  /* May get useful for 64 BIT PCI addressing */
np-scr_ram_seg = cpu_to_scr(np-scripta_ba  32);
 #endif
}
-   else
-   np-ram_ws = 4096;
}
 
/*
diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h 
b/drivers/scsi/sym53c8xx_2/sym_hipd.h
index b8908e1..f76b27f 100644
--- a/drivers/scsi/sym53c8xx_2/sym_hipd.h
+++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h
@@ -883,10 +883,7 @@ struct sym_hcb {
 *  Physical bus addresses of the chip.
 */
u32 mmio_ba;/* MMIO 32 bit BUS address  */
-   int mmio_ws;/* MMIO Window size */
-
u32 ram_ba; /* RAM 32 bit BUS address   */
-   int ram_ws; /* RAM window size  */
 
/*
 *  SCRIPTS virtual and physical bus addresses.
-- 
1.4.4.2

-
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 21/21] advansys: Changes to work on parisc

2007-10-05 Thread Andrew Morton
On Fri, 5 Oct 2007 13:34:50 -0600
Matthew Wilcox [EMAIL PROTECTED] wrote:

 On Fri, Oct 05, 2007 at 12:03:55PM -0700, Andrew Morton wrote:
  This isn't right.  resource_size_t can be 64-bit so should be cast to
  unsigned long long and printed with %llx.
 
 But it's a 32-bit BAR.

Which gets stored in a 64-bit variable.

  If it is known that this driver will never encounter a 64-bit address here
  then this optimisation should be accompanied by a comment at every place
  where it is employed so that people do not copy the wrong code into other
  drivers.
 
 Tell you what, I'll fix it properly when we have a better solution than
 'cast resource_size_t to long long for printing'.

The code is wrong, that's all.  If people copy it, their printks will print
incorrect (ie: truncated) information on some platforms.

As I said, if the code is knowingly wrong then there should be a cautionary
comment at each known-to-be-wrong site.

-
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 01/17] git-scsi-misc: arcmsr build fix

2007-10-05 Thread James Bottomley
On Fri, 2007-10-05 at 12:07 -0700, Andrew Morton wrote:
 I sent seventeen patches and only one was applied.
 
 Please either merge the others or give them a nack-with-reasons or specify
 how they need to be altered.
 
 Please do not just ignore them.  This creates additional ongoing
 maintenance work for myself.

Actually, none were applied ... you just got a fortuitous match with one
of Matthew's advansys patches, like he said you would.  Yours are in the
queue behind the gdth patch set which is currently causing me merge
problems.  Once I get that sorted out, I'll likely apply all of yours
bar the ones I already replied about.

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 2/17] sym53c8xx: Use pci_dev irq number

2007-10-05 Thread Jeff Garzik

Matthew Wilcox wrote:

Don't cache a private copy of the interrupt number

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |7 +++
 drivers/scsi/sym53c8xx_2/sym_glue.h |1 -
 2 files changed, 3 insertions(+), 5 deletions(-)


ACK patches 1-2


-
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 3/17] sym53c8xx: Remove data_mapping and data_mapped

2007-10-05 Thread Jeff Garzik

Matthew Wilcox wrote:

Before all commands used sg, data_mapping and data_mapped were used to
distinguish whether the command had used map_single or map_sg.  Now all
commands are sg, so we can delete data_mapping, data_mapped and the
wrapper functions __unmap_scsi_data, __map_scsi_sg_data, unmap_scsi_data
and map_scsi_sg_data.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |   33 +++--
 1 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 11e0a28..924b5dd 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -134,8 +134,6 @@ static struct scsi_transport_template 
*sym2_transport_template = NULL;
  *  Driver private area in the SCSI command structure.
  */
 struct sym_ucmd {  /* Override the SCSI pointer structure */
-   dma_addr_t  data_mapping;
-   unsigned char   data_mapped;
unsigned char   to_do;  /* For error handling */
void (*old_done)(struct scsi_cmnd *);   /* For error handling */
struct completion *eh_done; /* For error handling */
@@ -144,37 +142,12 @@ struct sym_ucmd { /* Override the SCSI pointer 
structure */
 #define SYM_UCMD_PTR(cmd)  ((struct sym_ucmd *)((cmd)-SCp))
 #define SYM_SOFTC_PTR(cmd) sym_get_hcb(cmd-device-host)
 
-static void __unmap_scsi_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)

-{
-   if (SYM_UCMD_PTR(cmd)-data_mapped)
-   scsi_dma_unmap(cmd);
-
-   SYM_UCMD_PTR(cmd)-data_mapped = 0;
-}
-
-static int __map_scsi_sg_data(struct pci_dev *pdev, struct scsi_cmnd *cmd)
-{
-   int use_sg;
-
-   use_sg = scsi_dma_map(cmd);
-   if (use_sg  0) {
-   SYM_UCMD_PTR(cmd)-data_mapped  = 2;
-   SYM_UCMD_PTR(cmd)-data_mapping = use_sg;
-   }
-
-   return use_sg;
-}
-
-#define unmap_scsi_data(np, cmd)   \
-   __unmap_scsi_data(np-s.device, cmd)
-#define map_scsi_sg_data(np, cmd)  \
-   __map_scsi_sg_data(np-s.device, cmd)
 /*
  *  Complete a pending CAM CCB.
  */
 void sym_xpt_done(struct sym_hcb *np, struct scsi_cmnd *cmd)
 {
-   unmap_scsi_data(np, cmd);
+   scsi_dma_unmap(cmd);
cmd-scsi_done(cmd);
 }
 
@@ -307,14 +280,14 @@ static int sym_scatter(struct sym_hcb *np, struct sym_ccb *cp, struct scsi_cmnd
 
 	cp-data_len = 0;
 
-	use_sg = map_scsi_sg_data(np, cmd);

+   use_sg = scsi_dma_map(cmd);
if (use_sg  0) {
struct scatterlist *sg;
struct sym_tcb *tp = np-target[cp-target];
struct sym_tblmove *data;
 
 		if (use_sg  SYM_CONF_MAX_SG) {

-   unmap_scsi_data(np, cmd);
+   scsi_dma_unmap(cmd);
return -1;


check scsi_dma_map() for negative return value (failure)

ACK once that is done

-
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/17] sym53c8xx: PCI Error Recovery support

2007-10-05 Thread Jeff Garzik

Matthew Wilcox wrote:

From: Linas Vepstas [EMAIL PROTECTED]

This patch adds the PCI error recovery callbacks to the Symbios SCSI device
driver.  It includes support for First Failure Data Capture.

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]

Assorted changes to initial patches, including returning IRQ_NONE from the
interrupt handler if the device is offline and re-using the eh_done completion
in the scsi error handler.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |  179 ++-
 drivers/scsi/sym53c8xx_2/sym_glue.h |3 +
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   25 -
 3 files changed, 200 insertions(+), 7 deletions(-)


ACK patches 4-7


-
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/17] sym53c8xx: Remove io_ws, mmio_ws and ram_ws elements

2007-10-05 Thread Jeff Garzik

Matthew Wilcox wrote:

These struct elements record info that is never needed

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |5 +
 drivers/scsi/sym53c8xx_2/sym_glue.h |1 -
 drivers/scsi/sym53c8xx_2/sym_hipd.c |7 ++-
 drivers/scsi/sym53c8xx_2/sym_hipd.h |3 ---
 4 files changed, 3 insertions(+), 13 deletions(-)


ACK patches 8-10


-
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 11/17] sym53c8xx: Remove tag_ctrl module parameter

2007-10-05 Thread Jeff Garzik

Matthew Wilcox wrote:

With sysfs making these options tunable at runtime, there's no
justification for keeping this horrendously complex specification
string around.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 Documentation/scsi/sym53c8xx_2.txt   |   21 +++
 drivers/scsi/sym53c8xx_2/sym53c8xx.h |1 -
 drivers/scsi/sym53c8xx_2/sym_glue.c  |   66 ++
 3 files changed, 8 insertions(+), 80 deletions(-)


ACK presuming you are convinced this will not break anybody in the field


-
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/17] sym53c8xx: Use scmd_printk where appropriate

2007-10-05 Thread Jeff Garzik

Matthew Wilcox wrote:

If we have a scsi_cmnd, it gives the user more information than the
sym_name, and maybe the target.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |4 ++--
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   35 +--
 2 files changed, 19 insertions(+), 20 deletions(-)


ACK patches 12-13


-
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 14/17] sym53c8xx: Get rid of IRQ_FMT and IRQ_PRM

2007-10-05 Thread Jeff Garzik

Matthew Wilcox wrote:

@@ -1196,8 +1193,8 @@ static int sym_host_info(struct sym_hcb *np, char *ptr, 
off_t offset, int len)
copy_info(info, Chip  NAME53C %s, device id 0x%x, 
 revision id 0x%x\n, np-s.chip_name,
 np-s.device-device, np-s.device-revision);
-   copy_info(info, At PCI address %s, IRQ  IRQ_FMT \n,
-   pci_name(np-s.device), IRQ_PRM(np-s.device-irq));
+   copy_info(info, At PCI address %s, IRQ %d\n,
+pci_name(np-s.device), np-s.device-irq);
copy_info(info, Min. period factor %d, %s SCSI BUS%s\n,
 (int) (np-minsync_dt ? np-minsync_dt : np-minsync),
 np-maxwide ? Wide : Narrow,
@@ -1283,9 +1280,9 @@ static struct Scsi_Host * __devinit sym_attach(struct 
scsi_host_template *tpnt,
unsigned long flags;
struct sym_fw *fw;
 
-	printk(KERN_INFO sym%d: %s rev 0x%x at pci %s irq  IRQ_FMT \n,

+   printk(KERN_INFO sym%d: %s rev 0x%x at pci %s irq %d\n,
unit, dev-chip.name, pdev-revision, pci_name(pdev),
-   IRQ_PRM(pdev-irq));
+   pdev-irq);
 
 	/*

 *  Get the firmware for this chip.


NAK

The proper format string is '%u' because irq is unsigned

-
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 01/17] git-scsi-misc: arcmsr build fix

2007-10-05 Thread Andrew Morton
On Fri, 05 Oct 2007 16:49:22 -0400
James Bottomley [EMAIL PROTECTED] wrote:

 On Fri, 2007-10-05 at 12:07 -0700, Andrew Morton wrote:
  I sent seventeen patches and only one was applied.
  
  Please either merge the others or give them a nack-with-reasons or specify
  how they need to be altered.
  
  Please do not just ignore them.  This creates additional ongoing
  maintenance work for myself.
 
 Actually, none were applied ...

ok, mpt-fusion-shut-up-uninitialized-variable.patch arrive in your tree via
some other route and confused me.

 you just got a fortuitous match with one
 of Matthew's advansys patches, like he said you would.  Yours are in the
 queue behind the gdth patch set which is currently causing me merge
 problems.  Once I get that sorted out, I'll likely apply all of yours
 bar the ones I already replied about.

OK, thanks.

wrt the ones you already replied about: I'm unsure which those are so can
you please re-reply?  I'd prefer to drop marginal stuff rather than having
it hang around for ever.

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 15/17] sym53c8xx: Make interrupt handler capable of returning IRQ_NONE

2007-10-05 Thread Jeff Garzik

Matthew Wilcox wrote:

Make sym_interrupt return an irqreturn_t instead of void, and take a
Scsi_Host instead of a sym_hcb.  Pass the Scsi_Host to the interrupt
handler instead of the sym_hcb.  Rename the host_data to sym_data.
Keep a pci_dev pointer in the sym_data.  Rename the Scsi_Host from
instance to shost.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]


ACK

Additionally, consider checking for istat==0x and returning 
IRQ_NONE, like most other drivers.  This handles the window during 
hot-unplug where you wind up reading a hardware register after the 
hardware is gone, but before the driver has been notified of unplug. 
The normal behavior of hardware for this case is to return all 1's upon 
PCI device fault/unplug.


Presuming you don't have fancy-shmancy PCI error reporting hw :)



-
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 16/17] sym53c8xx: Remove pci_dev pointer from sym_shcb

2007-10-05 Thread Jeff Garzik

Matthew Wilcox wrote:

This structure is accessed by the device; the fewer Linux things in it,
the better.  Using the pci_dev pointer from the hostdata requires a lot
of changes:

 - Pass Scsi_Host to a lot of routines which currently take a sym_hcb.
 - Set the Scsi_Host as the pci drvdata (instead of the sym_hcb)

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]


Obviously this is a judgement call on your part... but did you at least 
consider passing sym_hcb for all cases instead?


This is a common driver decisions, and many authors choose to store a 
pointer to the kernel struct (Scsi_Host in this case) in their adapter 
private structure, since it is often _far_ more common to pass the 
driver-private struct in arguments.


It doesn't make much sense to do the additional indirection IFF the 
majority of the routine actually want the driver-private structure.


I ACK the patch either way...


-
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 17/17] sym53c8xx: Remove sym_xpt_async_sent_bdr

2007-10-05 Thread Jeff Garzik

Matthew Wilcox wrote:

This function just printed a message to the user; move the print to its
only caller, and turn it into an starget_printk.

Signed-off-by: Matthew Wilcox [EMAIL PROTECTED]
---
 drivers/scsi/sym53c8xx_2/sym_glue.c |8 
 drivers/scsi/sym53c8xx_2/sym_glue.h |1 -
 drivers/scsi/sym53c8xx_2/sym_hipd.c |3 ++-
 3 files changed, 2 insertions(+), 10 deletions(-)


ACK


-
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 01/17] git-scsi-misc: arcmsr build fix

2007-10-05 Thread James Bottomley
On Fri, 2007-10-05 at 14:04 -0700, Andrew Morton wrote:
 On Fri, 05 Oct 2007 16:49:22 -0400
 James Bottomley [EMAIL PROTECTED] wrote:
 
  On Fri, 2007-10-05 at 12:07 -0700, Andrew Morton wrote:
   I sent seventeen patches and only one was applied.
   
   Please either merge the others or give them a nack-with-reasons or specify
   how they need to be altered.
   
   Please do not just ignore them.  This creates additional ongoing
   maintenance work for myself.
  
  Actually, none were applied ...
 
 ok, mpt-fusion-shut-up-uninitialized-variable.patch arrive in your tree via
 some other route and confused me.
 
  you just got a fortuitous match with one
  of Matthew's advansys patches, like he said you would.  Yours are in the
  queue behind the gdth patch set which is currently causing me merge
  problems.  Once I get that sorted out, I'll likely apply all of yours
  bar the ones I already replied about.
 
 OK, thanks.
 
 wrt the ones you already replied about: I'm unsure which those are so can
 you please re-reply?  I'd prefer to drop marginal stuff rather than having
 it hang around for ever.

It was just the aic7xxx one (8/17).  I'll resend.

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 08/17] Fix a potential NULL pointer deref in the aic7xxx, ahc_print_register() function

2007-10-05 Thread James Bottomley
On Tue, 2007-10-02 at 14:38 -0700, [EMAIL PROTECTED] wrote:
 From: Jesper Juhl [EMAIL PROTECTED]
 
 The Coverity checker noticed that we have a potential NULL pointer
 deref in drivers/scsi/aic7xxx/aic7xxx_core.c::ahc_print_register().
 This patch handles it by adding the same test against NULL that is
 used elsewhere in the same function.
 
 Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
 Signed-off-by: Andrew Morton [EMAIL PROTECTED]

No.  Reasons formerly given here:

http://marc.info/?l=linux-scsim=118632919511846w=2

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: generating a Linux WWN?

2007-10-05 Thread James Bottomley
On Wed, 2007-10-03 at 15:17 -0700, David Miller wrote:
 From: Luben Tuikov [EMAIL PROTECTED]
 Date: Wed, 3 Oct 2007 15:08:48 -0700 (PDT)
 
  Your want to get their card working way of view is very
  simplistic to justify generating and assigning SAS WWN in the kernel.
  This is the job of the manufacturer/packager, not the host OS.
 
 When you are thousands of miles away from the data center and lose all
 of your storage and therefore can't boot correctly because the WWN
 info is corrupted, you won't have this unbelievably fascist attitude
 about this problem.
 
 Give people an _OPTION_!
 
 This is about as anti-social as when the Intel folks refused to
 themselves put in a driver option to try to use an eepro100 card even
 if the EEPROM was corrupted and had a bad checksum.
 
 For the person who hits this, it's a big issue to have a way to still
 try to bring things up.
 
 If you don't provide this, you want people to suffer more than
 necessary when something goes wrong, and that by definition makes you
 an asshole.

The tenor of this debate is becoming slightly heated, so it needs to
cool down a notch.

For the record, what the current in-kernel aic94xx driver does for this
case is allow a parameter override to specify the WWN in the case where
the card burned in one has gone missing or is corrupt.  I think this is
the correctly balanced approach to the problem.

For the record, I pretty much agree completely with Luben's position on
this:  I want to allow the user a method to correct any problem (i.e.
supply a WWN override).  However, I also want them to think about the
issue before they do this.  What I really don't want is the driver
silently correcting what it thinks to be a defective WWN and generating
its own replacement because that's a recipe for disaster on a SAN (SANs
are a lot less robust than networks to duplicate MAC addresses: because
of the way expander routing is done, you can possibly collapse the
entire SAN with duplicate WWNs).

So, the procedure for a SAS card should be:

 1. Obtain the WWN from a device specific storage method (like
flash)
 2. Replace this with a passed in command line parameter if one
exists
 3. refuse to attach if there's still no valid WWN and give an
explicit method saying what the problem is (and possibly how to
fix it)

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: generating a Linux WWN?

2007-10-05 Thread James Bottomley
On Fri, 2007-10-05 at 15:11 -0700, David Miller wrote:
 From: James Bottomley [EMAIL PROTECTED]
 Date: Fri, 05 Oct 2007 18:09:06 -0400
 
  For the record, what the current in-kernel aic94xx driver does for this
  case is allow a parameter override to specify the WWN in the case where
  the card burned in one has gone missing or is corrupt.  I think this is
  the correctly balanced approach to the problem.
 
 Let's then provide a global and consistent knob for the user to set in
 this situation, instead of a different one per-driver.

Agreed; we can shift the parameter to the transport class so it's
consistent for all SAS drivers

 auto_wwn=1 or somthing like that

I'd far prefer

override_wwn = fully specific WWN

since I assume auto_wwn means get the kernel to generate one?

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: generating a Linux WWN?

2007-10-05 Thread David Miller
From: James Bottomley [EMAIL PROTECTED]
Date: Fri, 05 Oct 2007 18:14:48 -0400

 On Fri, 2007-10-05 at 15:11 -0700, David Miller wrote:
  auto_wwn=1 or somthing like that
 
 I'd far prefer
 
 override_wwn = fully specific WWN
 
 since I assume auto_wwn means get the kernel to generate one?

I think providing both possibilities (kernel auto-generated and user
specified) is appropriate.
-
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 08/17] Fix a potential NULL pointer deref in the aic7xxx, ahc_print_register() function

2007-10-05 Thread Jesper Juhl
On 05/10/2007, James Bottomley [EMAIL PROTECTED] wrote:
 On Tue, 2007-10-02 at 14:38 -0700, [EMAIL PROTECTED] wrote:
  From: Jesper Juhl [EMAIL PROTECTED]
 
  The Coverity checker noticed that we have a potential NULL pointer
  deref in drivers/scsi/aic7xxx/aic7xxx_core.c::ahc_print_register().
  This patch handles it by adding the same test against NULL that is
  used elsewhere in the same function.
 
  Signed-off-by: Jesper Juhl [EMAIL PROTECTED]
  Signed-off-by: Andrew Morton [EMAIL PROTECTED]

 No.  Reasons formerly given here:

 http://marc.info/?l=linux-scsim=118632919511846w=2


The reasons that patch sticks around was given by Andrew in a mail
send to me, you and Justin Gibbs on Aug 8.

My reply to that mail (including Andrew's original) is below, but you
should be able to also find it in your own archives.

Basically Andrew said:
That's the sort of patch I keep around to prevent the issue from
getting swept under the table.  This usually results in me sitting on
the sorry thing for literally years :(

---[ quote from old email - start ]---
   from Jesper Juhl [EMAIL PROTECTED]
   to  Andrew Morton [EMAIL PROTECTED]   
   cc  
   James Bottomley [EMAIL PROTECTED],
 Justin T. Gibbs [EMAIL PROTECTED]   
   date8 Aug 2007 00:43
   subject Re: + 
 avoid-a-small-unlikely-memory-leak-in-proc_read_escd.patch added to  -mm 
 tree
   mailed-by   gmail.com   
 On 08/08/07, Andrew Morton [EMAIL PROTECTED] wrote:
  On Wed, 8 Aug 2007 00:26:43 +0200
  Jesper Juhl [EMAIL PROTECTED] wrote:
 
   This reply was meant for
  
The patch titled
Fix a potential NULL pointer deref in the aic7xxx, 
ahc_print_register() function
has been added to the -mm tree.  Its filename is

fix-a-potential-null-pointer-deref-in-the-aic7xxx-ahc_print_register-function.patch
   
 
  That's the sort of patch I keep around to prevent the issue from getting
  swept under the table.  This usually results in me sitting on the sorry
  thing for literally years :(
 
 Ok, in that case you may want to keep it around in -mm despite James'
 objections - I'll leave that up to you. But it probably shouldn't move
 towards mainline...

  Feel free to send a replacement patch which gets us closer to the real fix.
  Remove all the NULL tests, maybe.
 
 I don't have a good idea on how to solve this better at the moment.
 But if I come up with something I'll be sure to send it to you and
 James.

---[ quote from old email - end ]---


-- 
Jesper Juhl [EMAIL PROTECTED]
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please  http://www.expita.com/nomime.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


Re: generating a Linux WWN?

2007-10-05 Thread Jeff Garzik

David Miller wrote:

I think providing both possibilities (kernel auto-generated and user
specified) is appropriate.


And that's been my plan from day one...  which is remarkably a lot like 
the behavior of several net drivers.  :)


* attempt to read WWN during module load
* admin may optionally choose to manually specify OR auto-generate a WWN
* fail, if no WWN [stating the obvious]

Regards,

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: generating a Linux WWN?

2007-10-05 Thread David Miller
From: Jeff Garzik [EMAIL PROTECTED]
Date: Fri, 05 Oct 2007 18:41:40 -0400

 And that's been my plan from day one...  which is remarkably a lot like 
 the behavior of several net drivers.  :)
 
 * attempt to read WWN during module load
 * admin may optionally choose to manually specify OR auto-generate a WWN
 * fail, if no WWN [stating the obvious]

And like with networking cases, we have situations where a platform
might be able to assist.

There are several systems that provide a system MAC address
to use when you can't obtain one for a specific device.  This
valus is provided via a firmware property.

Similarly, we could ask an interface that goes to platform to
ask them for a WWN.

We have code which does this in some of the qlogic FC drivers
already.

-
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: generating a Linux WWN?

2007-10-05 Thread Jeff Garzik

David Miller wrote:

From: Jeff Garzik [EMAIL PROTECTED]
Date: Fri, 05 Oct 2007 18:41:40 -0400

And that's been my plan from day one...  which is remarkably a lot like 
the behavior of several net drivers.  :)


* attempt to read WWN during module load
* admin may optionally choose to manually specify OR auto-generate a WWN
* fail, if no WWN [stating the obvious]


And like with networking cases, we have situations where a platform
might be able to assist.

There are several systems that provide a system MAC address
to use when you can't obtain one for a specific device.  This
valus is provided via a firmware property.

Similarly, we could ask an interface that goes to platform to
ask them for a WWN.


Good point -- I bet I will run into this when I get a Broadcom HT-1100 
test system, which is the on-board version of the board supported by my 
new 'broadsas' driver.


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