Re: kdump detection in SCSI drivers

2007-09-20 Thread Pavel Machek
> Hi,
> 
> Is there a standard way for drivers (RAID) to detect if the current
> kernel is running in kdump mode? We would like to adjust driver behavior
> dynamically when kdump is active by scaling down resources.

Perhaps you should be automatically using little resources when little
memory is available, or something? 

With upcomping kjump patches, it is more "interesting" than kdump
vs. no kdump.
Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] use default attributes for scsi_host

2007-09-20 Thread Hannes Reinecke
This patch removes the unused sysfs attribute overwriting logic for
most of the attributes, and plugs them into the driver core default
attribute creation.
 
Signed-off-by: Hannes Reinecke <[EMAIL PROTECTED]>
Signed-off-by: Kay Sievers <[EMAIL PROTECTED]>
---
 hosts.c  |1 
 scsi_priv.h  |1 
 scsi_sysfs.c |   88 +++
 3 files changed, 31 insertions(+), 59 deletions(-)

--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -387,7 +387,8 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template 
*sht, int privsize)
shost->shost_classdev.class = &shost_class;
snprintf(shost->shost_classdev.class_id, BUS_ID_SIZE, "host%d",
  shost->host_no);
+   shost->shost_classdev.groups = scsi_sysfs_shost_attr_groups;
 
shost->ehandler = kthread_run(scsi_error_handler, shost,
"scsi_eh_%d", shost->host_no);
--- a/drivers/scsi/scsi_priv.h
+++ b/drivers/scsi/scsi_priv.h
@@ -117,7 +117,8 @@ extern struct scsi_transport_template 
blank_transport_template;
 extern void __scsi_remove_device(struct scsi_device *);
 
 extern struct bus_type scsi_bus_type;
+extern struct attribute_group *scsi_sysfs_shost_attr_groups[];
 
 /* scsi_netlink.c */
 #ifdef CONFIG_SCSI_NETLINK
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -200,16 +200,24 @@ shost_rd_attr(sg_tablesize, "%hu\n");
 shost_rd_attr(unchecked_isa_dma, "%d\n");
 shost_rd_attr2(proc_name, hostt->proc_name, "%s\n");
 
-static struct class_device_attribute *scsi_sysfs_shost_attrs[] = {
-   &class_device_attr_unique_id,
-   &class_device_attr_host_busy,
-   &class_device_attr_cmd_per_lun,
-   &class_device_attr_can_queue,
-   &class_device_attr_sg_tablesize,
-   &class_device_attr_unchecked_isa_dma,
-   &class_device_attr_proc_name,
-   &class_device_attr_scan,
-   &class_device_attr_state,
+static struct attribute *scsi_shost_attrs[] = {
+   &class_device_attr_unique_id.attr,
+   &class_device_attr_host_busy.attr,
+   &class_device_attr_cmd_per_lun.attr,
+   &class_device_attr_can_queue.attr,
+   &class_device_attr_sg_tablesize.attr,
+   &class_device_attr_unchecked_isa_dma.attr,
+   &class_device_attr_proc_name.attr,
+   &class_device_attr_scan.attr,
+   NULL
+};
+
+struct attribute_group scsi_shost_attr_group = {
+   .attrs =scsi_shost_attrs,
+};
+
+struct attribute_group *scsi_sysfs_shost_attr_groups[] = {
+   &scsi_shost_attr_group,
NULL
 };
 
@@ -867,44 +875,6 @@ int scsi_register_interface(struct class_interface *intf)
 }
 EXPORT_SYMBOL(scsi_register_interface);
 
-
-static struct class_device_attribute *class_attr_overridden(
-   struct class_device_attribute **attrs,
-   struct class_device_attribute *attr)
-{
-   int i;
-
-   if (!attrs)
-   return NULL;
-   for (i = 0; attrs[i]; i++)
-   if (!strcmp(attrs[i]->attr.name, attr->attr.name))
-   return attrs[i];
-   return NULL;
-}
-
-static int class_attr_add(struct class_device *classdev,
-   struct class_device_attribute *attr)
-{
-   struct class_device_attribute *base_attr;
-
-   /*
-* Spare the caller from having to copy things it's not interested in.
-*/
-   base_attr = class_attr_overridden(scsi_sysfs_shost_attrs, attr);
-   if (base_attr) {
-   /* extend permissions */
-   attr->attr.mode |= base_attr->attr.mode;
-
-   /* override null show/store with default */
-   if (!attr->show)
-   attr->show = base_attr->show;
-   if (!attr->store)
-   attr->store = base_attr->store;
-   }
-
-   return class_device_create_file(classdev, attr);
-}
-
 /**
  * scsi_sysfs_add_host - add scsi host to subsystem
  * @shost: scsi host struct to add to subsystem
@@ -912,25 +882,25 @@ static int class_attr_add(struct class_device *classdev,
  **/
 int scsi_sysfs_add_host(struct Scsi_Host *shost)
 {
-   int error, i;
+   int error, i, state_overridden = 0;
 
+   /* add host specific attributes */
if (shost->hostt->shost_attrs) {
for (i = 0; shost->hostt->shost_attrs[i]; i++) {
-   error = class_attr_add(&shost->shost_classdev,
+   /* Some FC driver define their own 'state' attribute */
+   if 
(!strcmp(shost->hostt->shost_attrs[i]->attr.name,"state"))
+   state_overridden = 1;
+   error = class_device_create_file(&shost->shost_classdev,
shost->hostt->shost_attrs[i]);
if (error)
return error;
}
}
-
-   for (i = 0; scsi_sysfs_shost_attrs[i]; i++) {
-   if (!class_attr_overridden

[PATCH 2/3] add scsi_host and scsi_target to scsi_bus

2007-09-20 Thread Hannes Reinecke
This patch implements scsi_host and scsi_target device types and
adds both to the scsi_bus.

Signed-off-by: Kay Sievers <[EMAIL PROTECTED]>
Signed-off-by: Hannes Reinecke <[EMAIL PROTECTED]>
---
 drivers/scsi/hosts.c  |   12 ++--
 drivers/scsi/scsi_proc.c  |7 ++-
 drivers/scsi/scsi_scan.c  |   14 ++
 drivers/scsi/scsi_sysfs.c |   29 -
 4 files changed, 50 insertions(+), 12 deletions(-)

--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -279,6 +279,11 @@ static void scsi_host_dev_release(struct
kfree(shost);
 }
 
+struct device_type scsi_host_type = {
+   .name = "scsi_host",
+   .release =  scsi_host_dev_release,
+};
+
 /**
  * scsi_host_alloc - register a scsi host adapter instance.
  * @sht:   pointer to scsi host template
@@ -372,7 +377,10 @@ struct Scsi_Host *scsi_host_alloc(struct
device_initialize(&shost->shost_gendev);
snprintf(shost->shost_gendev.bus_id, BUS_ID_SIZE, "host%d",
shost->host_no);
-   shost->shost_gendev.release = scsi_host_dev_release;
+#ifndef CONFIG_SYSFS_DEPRECATED
+   shost->shost_gendev.bus = &scsi_bus_type;
+#endif
+   shost->shost_gendev.type = &scsi_host_type;
 
class_device_initialize(&shost->shost_classdev);
shost->shost_classdev.dev = &shost->shost_gendev;
@@ -484,7 +492,7 @@ void scsi_exit_hosts(void)
 
 int scsi_is_host_device(const struct device *dev)
 {
-   return dev->release == scsi_host_dev_release;
+   return dev->type == &scsi_host_type;
 }
 EXPORT_SYMBOL(scsi_is_host_device);
 
--- a/drivers/scsi/scsi_proc.c
+++ b/drivers/scsi/scsi_proc.c
@@ -146,10 +146,14 @@ void scsi_proc_host_rm(struct Scsi_Host 
 
 static int proc_print_scsidevice(struct device *dev, void *data)
 {
-   struct scsi_device *sdev = to_scsi_device(dev);
+   struct scsi_device *sdev;
struct seq_file *s = data;
int i;
 
+   if (!scsi_is_sdev_device(dev))
+   goto out;
+
+   sdev = to_scsi_device(dev);
seq_printf(s,
"Host: scsi%d Channel: %02d Id: %02d Lun: %02d\n  Vendor: ",
sdev->host->host_no, sdev->channel, sdev->id, sdev->lun);
@@ -186,6 +190,7 @@ static int proc_print_scsidevice(struct 
else
seq_printf(s, "\n");
 
+out:
return 0;
 }
 
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -332,9 +332,14 @@ static void scsi_target_dev_release(stru
put_device(parent);
 }
 
+struct device_type scsi_target_type = {
+   .name = "scsi_target",
+   .release =  scsi_target_dev_release,
+};
+
 int scsi_is_target_device(const struct device *dev)
 {
-   return dev->release == scsi_target_dev_release;
+   return dev->type == &scsi_target_type;
 }
 EXPORT_SYMBOL(scsi_is_target_device);
 
@@ -392,9 +397,12 @@ static struct scsi_target *scsi_alloc_ta
device_initialize(dev);
starget->reap_ref = 1;
dev->parent = get_device(parent);
-   dev->release = scsi_target_dev_release;
sprintf(dev->bus_id, "target%d:%d:%d",
shost->host_no, channel, id);
+#ifndef CONFIG_SYSFS_DEPRECATED
+   dev->bus = &scsi_bus_type;
+#endif
+   dev->type = &scsi_target_type;
starget->id = id;
starget->channel = channel;
INIT_LIST_HEAD(&starget->siblings);
@@ -468,8 +476,6 @@ static void scsi_target_reap_usercontext
 {
struct scsi_target *starget =
container_of(work, struct scsi_target, ew.work);
-   struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
-   unsigned long flags;
 
transport_remove_device(&starget->dev);
device_del(&starget->dev);
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -21,6 +21,8 @@
 #include "scsi_priv.h"
 #include "scsi_logging.h"
 
+static struct device_type scsi_dev_type;
+
 static const struct {
enum scsi_device_state  value;
char*name;
@@ -271,7 +273,12 @@ static struct class sdev_class = {
 /* all probing is done in the individual ->probe routines */
 static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
 {
-   struct scsi_device *sdp = to_scsi_device(dev);
+   struct scsi_device *sdp;
+
+   if (dev->type != &scsi_dev_type)
+   return 0;
+
+   sdp = to_scsi_device(dev);
if (sdp->no_uld_attach)
return 0;
return (sdp->inq_periph_qual == SCSI_INQ_PQ_CON)? 1: 0;
@@ -287,10 +294,16 @@ static int scsi_bus_uevent(struct device
 
 static int scsi_bus_suspend(struct device * dev, pm_message_t state)
 {
-   struct device_driver *drv = dev->driver;
-   struct scsi_device *sdev = to_scsi_device(dev);
+   struct device_driver *drv;
+   struct scsi_device *sdev;
int err;
 
+   if (dev->type != &scsi_dev_type)
+   return 0;
+
+   drv = dev->driver;
+   sdev = to_scsi_device(dev);
+

[PATCH 1/3] switch sdev sysfs attributes to default attributes

2007-09-20 Thread Hannes Reinecke
With the current target allocation code a target is registered
with sysfs for each possible target; it will be deleted again
if no useable LUN on this target is found. This results in a
lot of 'target add/target remove' uevents.

This patch reworks the target allocation code so that only
uevents for existing targets are sent. The sysfs registration
is split off from the existing scsi_target_alloc() into a
in a new scsi_add_target() function, which should be called
whenever an existing target is found.

Signed-off-by: Hannes Reinecke <[EMAIL PROTECTED]>
Signed-off-by: Kay Sievers <[EMAIL PROTECTED]>
---
 drivers/scsi/scsi_scan.c   |   73 +
 include/scsi/scsi_device.h |3 +
 2 files changed, 50 insertions(+), 26 deletions(-)

--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -319,7 +319,15 @@ static void scsi_target_dev_release(stru
 {
struct device *parent = dev->parent;
struct scsi_target *starget = to_scsi_target(dev);
+   struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
+   unsigned long flags;
 
+   transport_destroy_device(&starget->dev);
+   spin_lock_irqsave(shost->host_lock, flags);
+   if (shost->hostt->target_destroy)
+   shost->hostt->target_destroy(starget);
+   list_del_init(&starget->siblings);
+   spin_unlock_irqrestore(shost->host_lock, flags);
kfree(starget);
put_device(parent);
 }
@@ -391,7 +399,7 @@ static struct scsi_target *scsi_alloc_ta
starget->channel = channel;
INIT_LIST_HEAD(&starget->siblings);
INIT_LIST_HEAD(&starget->devices);
-   starget->state = STARGET_RUNNING;
+   starget->state = STARGET_CREATED;
starget->scsi_level = SCSI_2;
  retry:
spin_lock_irqsave(shost->host_lock, flags);
@@ -404,18 +412,6 @@ static struct scsi_target *scsi_alloc_ta
spin_unlock_irqrestore(shost->host_lock, flags);
/* allocate and add */
transport_setup_device(dev);
-   error = device_add(dev);
-   if (error) {
-   dev_err(dev, "target device_add failed, error %d\n", error);
-   spin_lock_irqsave(shost->host_lock, flags);
-   list_del_init(&starget->siblings);
-   spin_unlock_irqrestore(shost->host_lock, flags);
-   transport_destroy_device(dev);
-   put_device(parent);
-   kfree(starget);
-   return NULL;
-   }
-   transport_add_device(dev);
if (shost->hostt->target_alloc) {
error = shost->hostt->target_alloc(starget);
 
@@ -423,13 +419,15 @@ static struct scsi_target *scsi_alloc_ta
dev_printk(KERN_ERR, dev, "target allocation failed, 
error %d\n", error);
/* don't want scsi_target_reap to do the final
 * put because it will be under the host lock */
-   get_device(dev);
-   scsi_target_reap(starget);
-   put_device(dev);
+   spin_lock_irqsave(shost->host_lock, flags);
+   list_del_init(&starget->siblings);
+   spin_unlock_irqrestore(shost->host_lock, flags);
+   transport_destroy_device(dev);
+   put_device(parent);
+   kfree(starget);
return NULL;
}
}
-   get_device(dev);
 
return starget;
 
@@ -448,6 +446,24 @@ static struct scsi_target *scsi_alloc_ta
goto retry;
 }
 
+static int scsi_add_target(struct scsi_target *starget)
+{
+   int error;
+
+   error = device_add(&starget->dev);
+   if (error) {
+   dev_err(&starget->dev, "target device_add failed, error %d\n", 
error);
+   get_device(&starget->dev);
+   scsi_target_reap(starget);
+   put_device(&starget->dev);
+   return error;
+   }
+   transport_add_device(&starget->dev);
+   starget->state = STARGET_RUNNING;
+
+   return 0;
+}
+
 static void scsi_target_reap_usercontext(struct work_struct *work)
 {
struct scsi_target *starget =
@@ -457,12 +473,6 @@ static void scsi_target_reap_usercontext
 
transport_remove_device(&starget->dev);
device_del(&starget->dev);
-   transport_destroy_device(&starget->dev);
-   spin_lock_irqsave(shost->host_lock, flags);
-   if (shost->hostt->target_destroy)
-   shost->hostt->target_destroy(starget);
-   list_del_init(&starget->siblings);
-   spin_unlock_irqrestore(shost->host_lock, flags);
put_device(&starget->dev);
 }
 
@@ -483,7 +493,12 @@ void scsi_target_reap(struct scsi_target
spin_lock_irqsave(shost->host_lock, flags);
 
if (--starget->reap_ref == 0 && list_empty(&starget->devices)) {
-   BUG_ON(starget->state == STARGET_DEL);
+   if (starget->state == STARGE

[PATCH 0/3] Update sysfs registration

2007-09-20 Thread Hannes Reinecke
Hi James,

these patches are a follow-up to the earlier patch from Kay Sievers named
"[SCSI] switch sdev sysfs attributes to default attributes".
It consists of three parts:

- PATCH 1/3: Rework scsi target allocation so that uevents will only
  be sent for existing targets
- PATCH 2/3: Add scsi_bus type to scsi_target and scsi_host, so they
  will show up in the scsi bus device listing.
- PATCH 3/3: switch scsi_host sysfs attributes to default attributes

Please apply.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke   zSeries & Storage
[EMAIL PROTECTED] +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)
-
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


aic79xx problems

2007-09-20 Thread Stefan Boresch
I am trying to set up a server with an onboard Super Micro AIC 7902B
U320 controller under the latest Ubuntu version(s), i.e., using the
respective Ubuntu supplied kernels (2.6.20 based for "feisty" and 2.6.22 based
for "gutsy"). However, so far all kernels
based on 2.6.x, x greater or equal to 20 hang/crash when inserting the
aic79xx module. Earlier kernels from various distributions,
e.g. 2.6.15 (ubuntu dapper), 2.6.18 (opensuse 10.2), 2.6.18 (debian
unstable install kernel) work, but the discs are only running at a
fraction of the theoretical performance (see below).

I fully understand that it's not the job of the developers to take
care of users of the various distributions, but I guess if there are
experts to be found who have "been there, done this", then this is the
place to ask. I am perfectly happy to try to boot the machine with a
standard, self-compiled Linux 2.6.2x kernel, but would appreciate
hints as to what version plus which patches (if any) to use.

So, if anyone is willing to take a look, here are some facts (again,
please let me know whatever other info you need!). I have put the output of
lspci, dmesg and cat /proc/scsi/aic79xx/0 of the system running a
default Ubuntu dapper installation (2.6.15 based kernel) on
 
http://www.mdy.univie.ac.at/de/people/boresch/privat/dapper.lspci.output
http://www.mdy.univie.ac.at/de/people/boresch/privat/dapper.dmesg.output
http://www.mdy.univie.ac.at/de/people/boresch/privat/dapper.proc_aic79xx.output

respectively.

Hardware:

* Supermicro H8DAR-8 motherboard with two dual-core Opterons
* Two Seagate Cheetahs (ST373207LC) attached to the onboard Super
  Micro (Adaptec) AIC 7902B U320 controller
* There is also a LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT
  Dual Ultra320 SCSI (rev 08) controller, to which an external RAID is
  connected. This part of the system seems to be working flawlessly!!

The problem(s):

With the kernels 2.6.x (x < 20) I have tried so far the system boots,
but there are many warnings during the boot when loading the aic79xx
controller and the result to me seems nowhere near the speed which the
disks should be capable of.

E.g., for the first SCSI disk from /proc/scsi/aic79xx/0

Target 0 Negotiation Settings
User: 320.000MB/s transfers (160.000MHz RDSTRM|DT|IU|RTI|QAS, 16bit)
Goal: 40.000MB/s transfers (40.000MHz)
Curr: 40.000MB/s transfers (40.000MHz)
Channel A Target 0 Lun 0 Settings
Commands Queued 3039
Commands Active 0
Command Openings 32
Max Tagged Openings 32
Device Queue Frozen Count 0

The User: entries correspond to what is set in the SCSI BIOS (Adaptec,
version 4.30), and which, according to the vendor of the box
(transtec) is correct.

I could live with all this if kernels 2.6.2x I have tried would not
simply crash.  When the aic79xx module loads, I get again endless

>> Dump Card State Begins <

listings, but the warnings / error messages get more and more severe
until the system hangs.

At this point I am really unexperienced and have no clue how I could
capture these pages of messages. Again, I am happy to dig in but don't
quite know where to start.

According to Seagate Tools the disks themselves are fine.

I can easily dig out all the source from which the various Ubuntu kernels
are compiled; in fact, i have stared at them, and my feeling is that
this may be less an issue with the low level driver itself (which claims to
be version 3.0 in all cases) but with the
surrounding SCSI subsystem ...

Many thanks in advance,

Stefan

-- 
Stefan Boresch
Institute for Computational Biological Chemistry
University of Vienna, Waehringerstr. 17   A-1090 Vienna, Austria
Phone: -43-1-427752715Fax:   -43-1-427752790
-
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: aic79xx problems

2007-09-20 Thread James Bottomley
On Thu, 2007-09-20 at 15:04 +0200, Stefan Boresch wrote:
> So, if anyone is willing to take a look, here are some facts (again,
> please let me know whatever other info you need!). I have put the output of
> lspci, dmesg and cat /proc/scsi/aic79xx/0 of the system running a
> default Ubuntu dapper installation (2.6.15 based kernel) on
>  
> http://www.mdy.univie.ac.at/de/people/boresch/privat/dapper.lspci.output
> http://www.mdy.univie.ac.at/de/people/boresch/privat/dapper.dmesg.output

This gives you your answer:

> [  104.075410]  target0:0:1: Wide Transfers Fail

That's a hardware or cabling issue.

> http://www.mdy.univie.ac.at/de/people/boresch/privat/dapper.proc_aic79xx.output
> 
> respectively.
> 
> Hardware:
> 
> * Supermicro H8DAR-8 motherboard with two dual-core Opterons
> * Two Seagate Cheetahs (ST373207LC) attached to the onboard Super
>   Micro (Adaptec) AIC 7902B U320 controller
> * There is also a LSI Logic / Symbios Logic 53c1030 PCI-X Fusion-MPT
>   Dual Ultra320 SCSI (rev 08) controller, to which an external RAID is
>   connected. This part of the system seems to be working flawlessly!!
> 
> The problem(s):
> 
> With the kernels 2.6.x (x < 20) I have tried so far the system boots,
> but there are many warnings during the boot when loading the aic79xx
> controller and the result to me seems nowhere near the speed which the
> disks should be capable of.

Wide transfers are required by the spec for periods lower than 25ns so
the driver in all cases does the very best it can for you until you can
fix the hardware problem.

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


[PATCH] dtc: Fix typo

2007-09-20 Thread Alan Cox
Signed-off-by: Alan Cox <[EMAIL PROTECTED]>

(and pointed out by several people)

diff -u --exclude-from /usr/src/exclude --new-file --recursive 
linux.vanilla-2.6.23rc6-mm1/drivers/scsi/dtc.c 
linux-2.6.23rc6-mm1/drivers/scsi/dtc.c
--- linux.vanilla-2.6.23rc6-mm1/drivers/scsi/dtc.c  2007-09-18 
15:32:56.0 +0100
+++ linux-2.6.23rc6-mm1/drivers/scsi/dtc.c  2007-09-18 16:26:56.0 
+0100
@@ -242,7 +242,7 @@
if (check_signature(base + 
signatures[sig].offset, signatures[sig].string, 
strlen(signatures[sig].string))) {
addr = 
bases[current_base].address;
 #if (DTCDEBUG & DTCDEBUG_INIT)
-   printk(KERB_DEBUG "scsi-dtc : 
detected board.\n");
+   printk(KERN_DEBUG "scsi-dtc : 
detected board.\n");
 #endif
goto found;
}
-
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] eata_pio: Clean up proc handling, bracketing and use cpu_relax()

2007-09-20 Thread Alan Cox
So its ancient, its crap, but it kept showing up in my scans for stuff
that wanted fixing...

- Redo the proc code to be far cleaner
- Clean various return (0) type constructs
- Use cpu_relax()

The various waits ought to time out but thats another issue and probably
not worth solving.

Signed-off-by: Alan Cox <[EMAIL PROTECTED]>

diff -u --exclude-from /usr/src/exclude --new-file --recursive 
linux.vanilla-2.6.23rc6-mm1/drivers/scsi/eata_pio.c 
linux-2.6.23rc6-mm1/drivers/scsi/eata_pio.c
--- linux.vanilla-2.6.23rc6-mm1/drivers/scsi/eata_pio.c 2007-09-18 
15:14:00.0 +0100
+++ linux-2.6.23rc6-mm1/drivers/scsi/eata_pio.c 2007-09-18 16:27:03.0 
+0100
@@ -107,59 +107,44 @@
 static int eata_pio_proc_info(struct Scsi_Host *shost, char *buffer, char 
**start, off_t offset,
  int length, int rw)
 {
-static u8 buff[512];
-int size, len = 0;
-off_t begin = 0, pos = 0;
-
-if (rw)
-   return -ENOSYS;
-if (offset == 0)
-   memset(buff, 0, sizeof(buff));
+   int len = 0;
+   off_t begin = 0, pos = 0;
+
+   if (rw)
+   return -ENOSYS;
 
-size = sprintf(buffer+len, "EATA (Extended Attachment) PIO driver version: 
"
+   len += sprintf(buffer+len, "EATA (Extended Attachment) PIO driver 
version: "
   "%d.%d%s\n",VER_MAJOR, VER_MINOR, VER_SUB);
-len += size; pos = begin + len;
-size = sprintf(buffer + len, "queued commands: %10ld\n"
+   len += sprintf(buffer + len, "queued commands: %10ld\n"
   "processed interrupts:%10ld\n", queue_counter, int_counter);
-len += size; pos = begin + len;
-
-size = sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n",
+   len += sprintf(buffer + len, "\nscsi%-2d: HBA %.10s\n",
   shost->host_no, SD(shost)->name);
-len += size; 
-pos = begin + len;
-size = sprintf(buffer + len, "Firmware revision: v%s\n", 
+   len += sprintf(buffer + len, "Firmware revision: v%s\n", 
   SD(shost)->revision);
-len += size;
-pos = begin + len;
-size = sprintf(buffer + len, "IO: PIO\n");
-len += size; 
-pos = begin + len;
-size = sprintf(buffer + len, "Base IO : %#.4x\n", (u32) shost->base);
-len += size; 
-pos = begin + len;
-size = sprintf(buffer + len, "Host Bus: %s\n", 
+   len += sprintf(buffer + len, "IO: PIO\n");
+   len += sprintf(buffer + len, "Base IO : %#.4x\n", (u32) shost->base);
+   len += sprintf(buffer + len, "Host Bus: %s\n", 
   (SD(shost)->bustype == 'P')?"PCI ":
   (SD(shost)->bustype == 'E')?"EISA":"ISA ");
 
-len += size; 
-pos = begin + len;
+   pos = begin + len;
 
-if (pos < offset) {
-   len = 0;
-   begin = pos;
-}
-if (pos > offset + length)
-   goto stop_output;
+   if (pos < offset) {
+   len = 0;
+   begin = pos;
+   }
+   if (pos > offset + length)
+   goto stop_output;
 
- stop_output:
-DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, len));
-*start=buffer+(offset-begin);   /* Start of wanted data */
-len-=(offset-begin);/* Start slop */
-if(len>length)
-   len = length;   /* Ending slop */
-DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, len));
+stop_output:
+   DBG(DBG_PROC, printk("2pos: %ld offset: %ld len: %d\n", pos, offset, 
len));
+   *start = buffer + (offset - begin);   /* Start of wanted data */
+   len -= (offset - begin);/* Start slop */
+   if (len > length)
+   len = length;   /* Ending slop */
+   DBG(DBG_PROC, printk("3pos: %ld offset: %ld len: %d\n", pos, offset, 
len));
 
-return (len); 
+   return len;
 }
 
 static int eata_pio_release(struct Scsi_Host *sh)
@@ -438,7 +423,7 @@
"returning DID_BUS_BUSY, done.\n", cmd->pid);
done(cmd);
cp->status = FREE;
-   return (0);
+   return 0;
}
/* FIXME: timeout */
while (!(inb(base + HA_RSTATUS) & HA_SDRQ))
@@ -452,7 +437,7 @@
"Queued base %#.4lx pid: %ld "
"slot %d irq %d\n", sh->base, cmd->pid, y, sh->irq));
 
-   return (0);
+   return 0;
 }
 
 static int eata_pio_abort(struct scsi_cmnd *cmd)
@@ -589,23 +574,28 @@
cp.cp_cdb[5] = 0;
 
if (eata_pio_send_command(base, EATA_CMD_PIO_SEND_CP))
-   return (NULL);
-   while (!(inb(base + HA_RSTATUS) & HA_SDRQ));
+   return NULL;
+
+   while (!(inb(base + HA_RSTATUS) & HA_SDRQ))
+   cpu_relax();
+
outsw(base + HA_RDATA, &cp, cplen);
outb(EATA_CMD_PIO_TRUNC, base + HA_WCOMMAND);
for (z = 0; z < cppadlen; z++)
outw(0, base + HA_RDATA);
 
-   while (inb(base + HA_RSTATUS) & HA_SBUSY);
+   whil

Re: aic79xx problems

2007-09-20 Thread James Bottomley
On Thu, 2007-09-20 at 15:04 +0200, Stefan Boresch wrote:
> I could live with all this if kernels 2.6.2x I have tried would not
> simply crash.  When the aic79xx module loads, I get again endless
> 
> >> Dump Card State Begins <
> 
> listings, but the warnings / error messages get more and more severe
> until the system hangs.


This shouldn't be happening; we should get the same behaviour as the old
kernels (lots of scary warnings and problems but then turn off wide and
continue on).  Investigating this, unfortunately, is going to be a real
pain.  However, I think I can cut a cable to simulate your problem.

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: aic79xx problems

2007-09-20 Thread Stefan Boresch
Thank you for both your replies.

On Thu, Sep 20, 2007 at 09:15:51AM -0500, James Bottomley wrote:
> On Thu, 2007-09-20 at 15:04 +0200, Stefan Boresch wrote:
> > I could live with all this if kernels 2.6.2x I have tried would not
> > simply crash.  When the aic79xx module loads, I get again endless
> > 
> > >> Dump Card State Begins <
> > 
> > listings, but the warnings / error messages get more and more severe
> > until the system hangs.
> 
> 
> This shouldn't be happening; we should get the same behaviour as the old
> kernels (lots of scary warnings and problems but then turn off wide and
> continue on).  Investigating this, unfortunately, is going to be a real
> pain.  However, I think I can cut a cable to simulate your problem.
> 
> 

I guess I'll "attack" the hardware angle by harassing the vendor (who
so far was completely "sure" that it "must" be a driver issue). My
problem is that this SCSI only system is really a "stray dog" in my
zoo, so I have no replacement cables / parts whatsoever, i.e., it will
take a while for them to get these to me.

So, since I seem to have a slightly broken machine at hand, let me
know whether I can try/test anything to fix the issues the newer
kernels might have.

In any case, already many thanks for your quick reply!

Stefan

-- 
Stefan Boresch
Institute for Computational Biological Chemistry
University of Vienna, Waehringerstr. 17   A-1090 Vienna, Austria
Phone: -43-1-427752715Fax:   -43-1-427752790
-
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: aic79xx problems

2007-09-20 Thread James Bottomley
On Thu, 2007-09-20 at 16:34 +0200, Stefan Boresch wrote:
> So, since I seem to have a slightly broken machine at hand, let me
> know whether I can try/test anything to fix the issues the newer
> kernels might have.

It will take me a while to set up the configuration, so the dmesg from
the failing 2.6.2x might be helpful, just in case it's an obvious
problem that doesn't need debugging (small chance, but still possible).

Thanks,

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: aic79xx problems

2007-09-20 Thread Stefan Boresch

On Thu, Sep 20, 2007 at 09:41:14AM -0500, James Bottomley wrote:
> On Thu, 2007-09-20 at 16:34 +0200, Stefan Boresch wrote:
> > So, since I seem to have a slightly broken machine at hand, let me
> > know whether I can try/test anything to fix the issues the newer
> > kernels might have.
> 
> It will take me a while to set up the configuration, so the dmesg from
> the failing 2.6.2x might be helpful, just in case it's an obvious
> problem that doesn't need debugging (small chance, but still possible).
> 

I will try, but a very dumb question first. If I have a kernel that
crashes because of a disk problem ..., how do I get to save the output?
(Never worked with a serial console, but there might be a first time
for everything ...) But maybe there is an obvious solution that I overlook?

Or should I just try to watch and look for certain messages (ordering of
messages), which given the huge amount of output seems a bit daunting ...

Best regards,

Stefan

-- 
Stefan Boresch
Institute for Computational Biological Chemistry
University of Vienna, Waehringerstr. 17   A-1090 Vienna, Austria
Phone: -43-1-427752715Fax:   -43-1-427752790
-
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: LSI Logic 40919o fibre channel: scsi works ip not

2007-09-20 Thread Mario Giammarco
Il Monday 05 March 2007 20:46:10 Shirron, Stephen ha scritto:
> The code should look like this, in mpt_lan_post_receive_buckets():
>
>   goto out;
>   }
>   pRecvReq = (LANReceivePostRequest_t *) mf;
>
>   i = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
>   mpt_dev->RequestNB[i] = 0;
>
>   count = buckets;
>   if (count > max)
>   count = max;
>
> If you send me mptlan.c, I will edit it for you.  Then there cannot
> be a mistake.
>
> stephen
>
> -Original Message-
> From: Mario Giammarco [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 05, 2007 2:39 PM
> To: Shirron, Stephen
> Cc: Mario Giammarco; Hickerson, Roger
> Subject: Re: LSI Logic 40919o fibre channel: scsi works ip not
>
> Sorry for delay replying. I have seen kernel 2.6.18 and 2.6.20 source
> and these lines are missinig:
>
>i = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
> mpt_dev->RequestNB[i] = 0;
>
> I do not understand where to put them. Perhaps inside the for loop (i
> is the loop variable...) but I do not understand if I can choose a
> random point or I have to put it in a specific place.
>
> Thanks again for interest!
>
>
> 2007/2/16, Shirron, Stephen <[EMAIL PROTECTED]>:
> Mario,
>
> There appears to be a bug in the driver.
>
> Go to mpt_lan_post_receive_buckets(), in mptlan.c.  Find:
>
> mf = mpt_get_msg_frame(LanCtx, mpt_dev);
>
> Later find:
>
> pRecvReq = (LANReceivePostRequest_t *) mf;
>
> Below that, should be:
>
> i = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
> mpt_dev->RequestNB[i] = 0;
>
> The above two lines of code are present in some versions of mptctl.c
> (the 2.06.xx versions and 3.02.xx versions) but are missing from some
> others (3.03.xx, 3.04.xx, and 4.00.xx).
>
> If you can add those two lines of code, rebuild mptctl.ko, and retest,
> I believe that should take care of your reported problems.
>
> Let me know, please.
>
> stephen


Hello,
month ago I replied to you saying that this patch solved my bug.

Today I am trying kernel 2.6.22 and I see that it does not contain yet the 
patch.

Can you please put the patch in official driver?

Thank you very much!

Mario Giammarco
-
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: kdump detection in SCSI drivers

2007-09-20 Thread Mukker, Atul
How do we "know" when little memory is available?

Other suggestion which came about was to parse the kernel command line
and look for "elfcorehdr=". Is this ok? Is kernel command line visible
to the SCSI drivers?

Thanks
-Atul

-Original Message-
From: Pavel Machek [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 20, 2007 6:43 AM
To: Mukker, Atul
Cc: Linux-scsi@vger.kernel.org; [EMAIL PROTECTED]
Subject: Re: kdump detection in SCSI drivers

> Hi,
> 
> Is there a standard way for drivers (RAID) to detect if the current
> kernel is running in kdump mode? We would like to adjust driver
behavior
> dynamically when kdump is active by scaling down resources.

Perhaps you should be automatically using little resources when little
memory is available, or something? 

With upcomping kjump patches, it is more "interesting" than kdump
vs. no kdump.

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures)
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.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: LSI Logic 40919o fibre channel: scsi works ip not

2007-09-20 Thread Shirron, Stephen
Hi Mario,

Our internal driver kits have been fixed, but there has been a
delay in pushing this fix (along with other required changes)
out to kernel.org.  We are anticipating that the fix for this
issue will show up in kernel 2.6.24 (2.6.23 is essentially
closed).

stephen 

-Original Message-
From: Mario Giammarco [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 20, 2007 11:34 AM
To: Shirron, Stephen
Cc: Mario Giammarco; Hickerson, Roger; linux-scsi@vger.kernel.org
Subject: Re: LSI Logic 40919o fibre channel: scsi works ip not

Il Monday 05 March 2007 20:46:10 Shirron, Stephen ha scritto:
> The code should look like this, in mpt_lan_post_receive_buckets():
>
>   goto out;
>   }
>   pRecvReq = (LANReceivePostRequest_t *) mf;
>
>   i = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
>   mpt_dev->RequestNB[i] = 0;
>
>   count = buckets;
>   if (count > max)
>   count = max;
>
> If you send me mptlan.c, I will edit it for you.  Then there cannot
> be a mistake.
>
> stephen
>
> -Original Message-
> From: Mario Giammarco [mailto:[EMAIL PROTECTED]
> Sent: Monday, March 05, 2007 2:39 PM
> To: Shirron, Stephen
> Cc: Mario Giammarco; Hickerson, Roger
> Subject: Re: LSI Logic 40919o fibre channel: scsi works ip not
>
> Sorry for delay replying. I have seen kernel 2.6.18 and 2.6.20 source
> and these lines are missinig:
>
>i = le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
> mpt_dev->RequestNB[i] = 0;
>
> I do not understand where to put them. Perhaps inside the for loop (i
> is the loop variable...) but I do not understand if I can choose a
> random point or I have to put it in a specific place.
>
> Thanks again for interest!
>
>
> 2007/2/16, Shirron, Stephen <[EMAIL PROTECTED]>:
> Mario,
>
> There appears to be a bug in the driver.
>
> Go to mpt_lan_post_receive_buckets(), in mptlan.c.  Find:
>
> mf = mpt_get_msg_frame(LanCtx, mpt_dev);
>
> Later find:
>
> pRecvReq = (LANReceivePostRequest_t *) mf;
>
> Below that, should be:
>
> i =
le16_to_cpu(mf->u.frame.hwhdr.msgctxu.fld.req_idx);
> mpt_dev->RequestNB[i] = 0;
>
> The above two lines of code are present in some versions of mptctl.c
> (the 2.06.xx versions and 3.02.xx versions) but are missing from some
> others (3.03.xx, 3.04.xx, and 4.00.xx).
>
> If you can add those two lines of code, rebuild mptctl.ko, and retest,
> I believe that should take care of your reported problems.
>
> Let me know, please.
>
> stephen


Hello,
month ago I replied to you saying that this patch solved my bug.

Today I am trying kernel 2.6.22 and I see that it does not contain yet
the 
patch.

Can you please put the patch in official driver?

Thank you very much!

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


Re: [PATCH] aic94xx: fix smartctl utility problem

2007-09-20 Thread Douglas Gilbert
James Bottomley wrote:
> On Sun, 2007-09-16 at 19:01 -0400, Douglas Gilbert wrote:
>> James Bottomley wrote:
>>> On Sat, 2007-09-15 at 12:05 -0500, James Bottomley wrote:
 On Fri, 2007-09-14 at 10:58 -0700, Gilbert Wu wrote:
> Fixed the problem that "smartctl -a /dev/some_sata_disk -d ata"  does
> not work on SATA device. ( The smartctl v5.38 does need "-d ata"
> option.)
>   The aic94xx need to return ATA output register for all ATA commands
> except ATA Read/Write commands.
>   The aic94xx also mark out the DRQ bit from status register which is
> treated as AC_ERR_HSM (host state machine violation) error by top layer
> if it set to one.
>  The firmware of aic94xx chip handle all ATA handshaking, data transfer
> and return ATA output register which is sent by the device.  So the DRQ
> bit may not reflect the last state of device when the command finished
> and it is no meaning for the caller.
>
> Signed-off-by: Gilbert Wu <[EMAIL PROTECTED]>
 I'm afraid this can't go in.  It has a bad effect on my expander remote
 ATAPI device:
>>> OK, found the root cause: your CSMI_TASK flag is getting set on all
>>> packet commands.  I can think of two fixes: either smartctl should never
>>> be used on ATAPI devices (reasonable, since smart is a disc protocol),
>> Feature code 101h in MMC seems to sink your argument for
>> cd/dvd drives.
> 
> I was more thinking that smartctl is a pure ATA type thing (The problem
> which the flag is set for is to allow smartctl to muck with ATA
> commands)... the MMC devices supporting smart features report this via
> the informational exceptions mode page to conform to the MMC command
> set.  So, when smartctl does SCSI transports, they'll go via a packet
> command anyway.

I'm not sure what you mean by "smartctl is a pure ATA type
thing". smartctl is hybrid ATA and SCSI "type of thing"
(as is smartd). And I'm the maintainer of the SCSI part.

Life used to be simple in linux: a device name like "/dev/hd*"
would be sent ATA commands to fetch SMART information
while a device name like "dev/sd*" (or "/dev/*st*") would
be sent SCSI commands to fetch SMART information.

Trying to guess the preferred command set of a device based
on its device name (or initiator transport) is lame and
getting lamer. If SAT was fully implemented, smartctl
wouldn't have to worry when it detected an ATA device, as
SAT defines the correct translations for the SCSI commands
associated with SMART (e.g. self test results log page).

In the real world, SAT "compliance" usually means that the
SCSI ATA PASS-THROUGH(16) command is supported. So the
approach of smartctl is to start using SCSI commands (i.e.
an INQUIRY) and if SAT is detected, switch to ATA commands
tunnelled through the SCSI ATA PASS-THROUGH(16).

Note that the SCSI ATA PASS-THROUGH(16) command support may
be needed to detect and change the logical unit's transport
level characteristics but that is not really a concern of
smartmontools.


As for the MMC reference, I was countering your "smart is a
disc protocol" observation. smartmontools doesn't need to
send ATA commands (if it supported SMART for cd/dvd drives)
to cd/dvd drives.
Some other apps (e.g. hdparm) may want to send an ATA SET
FEATURES command tunnelled via an SCSI ATA PASS-THROUGH(16)
command to a cd/dvd drive connected, for example, to a
SAS expander.

>> Also tape drives may support SMART and if they do,
>> smartmontools can access the associated data. And tape
>> drives may be on an ATAPI transport.
> 
> That's probably via the same mechanism, isn't it?

Yes, apart from the fact (until recent kernels) that such
an ATAPI tape device would appear with a device name like
"/dev/hdc". That further confuses the "guess which command
set the device would like to use" game.

Doug Gilbert


-
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 0/19] qla2xxx: Driver update [8.02.00-k4].

2007-09-20 Thread Andrew Vasquez
This patchset updates the qla2xxx driver to 8.02.00-k4

 drivers/scsi/qla2xxx/qla_attr.c|  200 +++--
 drivers/scsi/qla2xxx/qla_dbg.c | 1846 +++-
 drivers/scsi/qla2xxx/qla_dbg.h |2 +
 drivers/scsi/qla2xxx/qla_def.h |   15 +-
 drivers/scsi/qla2xxx/qla_fw.h  |6 +-
 drivers/scsi/qla2xxx/qla_gbl.h |9 +-
 drivers/scsi/qla2xxx/qla_gs.c  |6 +-
 drivers/scsi/qla2xxx/qla_init.c|   26 +-
 drivers/scsi/qla2xxx/qla_iocb.c|4 +-
 drivers/scsi/qla2xxx/qla_isr.c |   88 ++-
 drivers/scsi/qla2xxx/qla_mbx.c |   62 ++-
 drivers/scsi/qla2xxx/qla_mid.c |   40 +-
 drivers/scsi/qla2xxx/qla_os.c  |  140 +++-
 drivers/scsi/qla2xxx/qla_sup.c |  221 --
 drivers/scsi/qla2xxx/qla_version.h |2 +-
 15 files changed, 1189 insertions(+), 1478 deletions(-)

here's the commits:

- Collapse and simplify ISP2XXX firmware dump routines.
- Add flash burst-read/write support.
- Limit iIDMA speed adjustments.
- Allow region-based flash-part accesses.
- Add PCI error recovery support.
- Query additional RISC information during a pause.
- Correct staging of RISC while attempting to pause.
- Query additional RISC registers during ISP25XX firmware dump.
- Correct infinite-login-retry issue.
- Set correct attribute count during FDMI RPA.
- Use the correct pointer-address during NVRAM writes.
- Retrieve max-NPIV support capabilities from FW.
- Remove unused member (list) from srb_t structure.
- Use shost_priv().
- Cleanup several 'sparse' warnings.
- Sparse cleanups in qla_mid.c
- Clear options-flags while staging firmware-execution.
- Rework MSI-X handlers.
- Update version number to 8.02.00-k4.

Regards,
Andrew Vasquez
QLogic Corporation
-
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 17/19] qla2xxx: Clear options-flags while staging firmware-execution.

2007-09-20 Thread Andrew Vasquez
Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_mbx.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index ec48871..c53ec67 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -391,7 +391,8 @@ qla2x00_execute_fw(scsi_qla_host_t *ha, uint32_t risc_addr)
mcp->mb[1] = MSW(risc_addr);
mcp->mb[2] = LSW(risc_addr);
mcp->mb[3] = 0;
-   mcp->out_mb |= MBX_3|MBX_2|MBX_1;
+   mcp->mb[4] = 0;
+   mcp->out_mb |= MBX_4|MBX_3|MBX_2|MBX_1;
mcp->in_mb |= MBX_1;
} else {
mcp->mb[1] = LSW(risc_addr);
-- 
1.5.3.2.80.g077d6f

-
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 03/19] qla2xxx: Limit iIDMA speed adjustments.

2007-09-20 Thread Andrew Vasquez
Do not adjust the iIDMA speed on ports which have a faster
link-speed than the HBA itself.

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_init.c |   10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 083997c..45da947 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -2126,15 +2126,9 @@ qla2x00_iidma_fcport(scsi_qla_host_t *ha, fc_port_t 
*fcport)
if (!IS_IIDMA_CAPABLE(ha))
return;
 
-   if (fcport->fp_speed == PORT_SPEED_UNKNOWN) {
-   DEBUG2(printk("scsi(%ld): %02x%02x%02x%02x%02x%02x%02x%02x -- "
-   "unsupported FM port operating speed.\n",
-   ha->host_no, fcport->port_name[0], fcport->port_name[1],
-   fcport->port_name[2], fcport->port_name[3],
-   fcport->port_name[4], fcport->port_name[5],
-   fcport->port_name[6], fcport->port_name[7]));
+   if (fcport->fp_speed == PORT_SPEED_UNKNOWN ||
+   fcport->fp_speed > ha->link_data_rate)
return;
-   }
 
rval = qla2x00_set_idma_speed(ha, fcport->loop_id, fcport->fp_speed,
mb);
-- 
1.5.3.2.80.g077d6f

-
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 18/19] qla2xxx: Rework MSI-X handlers.

2007-09-20 Thread Andrew Vasquez
Since MSI-X vectors do not require a clearing "handshake" from
the system perspective, and the registered handler will not be
called more than once for one occurrence of receipt of a vector,
there is no requirement to flush the risc register write clearing
the interrupt condition in the risc. Also, since the msi-x
registered handlers are optimised for a particular vector, it is
preferable to handle the one vector received per invocation of
the handler.

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_isr.c |7 ++-
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index f61c2fe..c4768c4 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -1679,7 +1679,6 @@ qla24xx_msix_rsp_q(int irq, void *dev_id)
qla24xx_process_response_queue(ha);
 
WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT);
-   RD_REG_DWORD_RELAXED(®->hccr);
 
spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
@@ -1693,7 +1692,6 @@ qla24xx_msix_default(int irq, void *dev_id)
struct device_reg_24xx __iomem *reg;
int status;
unsigned long   flags;
-   unsigned long   iter;
uint32_tstat;
uint32_thccr;
uint16_tmb[4];
@@ -1703,7 +1701,7 @@ qla24xx_msix_default(int irq, void *dev_id)
status = 0;
 
spin_lock_irqsave(&ha->hardware_lock, flags);
-   for (iter = 50; iter--; ) {
+   do {
stat = RD_REG_DWORD(®->host_status);
if (stat & HSRX_RISC_PAUSED) {
if (pci_channel_offline(ha->pdev))
@@ -1748,8 +1746,7 @@ qla24xx_msix_default(int irq, void *dev_id)
break;
}
WRT_REG_DWORD(®->hccr, HCCRX_CLR_RISC_INT);
-   RD_REG_DWORD_RELAXED(®->hccr);
-   }
+   } while (0);
spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
-- 
1.5.3.2.80.g077d6f

-
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 02/19] qla2xxx: Add flash burst-read/write support.

2007-09-20 Thread Andrew Vasquez
Newer ISPs support a mechanism to read and write flash-memory via
the firmware LOAD/DUMP memory mailbox command routines.  When
supported, utilizing these mechanisms significantly reduces
overall access times.

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_gbl.h |5 +
 drivers/scsi/qla2xxx/qla_mbx.c |   48 +
 drivers/scsi/qla2xxx/qla_os.c  |2 +-
 drivers/scsi/qla2xxx/qla_sup.c |  221 ++--
 4 files changed, 220 insertions(+), 56 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index aa1e411..e8122e8 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -134,6 +134,9 @@ extern int
 qla2x00_load_ram(scsi_qla_host_t *, dma_addr_t, uint32_t, uint32_t);
 
 extern int
+qla2x00_dump_ram(scsi_qla_host_t *, dma_addr_t, uint32_t, uint32_t);
+
+extern int
 qla2x00_execute_fw(scsi_qla_host_t *, uint32_t);
 
 extern void
@@ -302,6 +305,8 @@ extern uint8_t *qla24xx_read_optrom_data(struct 
scsi_qla_host *, uint8_t *,
 uint32_t, uint32_t);
 extern int qla24xx_write_optrom_data(struct scsi_qla_host *, uint8_t *,
 uint32_t, uint32_t);
+extern uint8_t *qla25xx_read_optrom_data(struct scsi_qla_host *, uint8_t *,
+uint32_t, uint32_t);
 
 extern int qla2x00_get_flash_version(scsi_qla_host_t *, void *);
 extern int qla24xx_get_flash_version(scsi_qla_host_t *, void *);
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index d3746ec..e4f4b1f 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -2980,3 +2980,51 @@ qla2x00_send_change_request(scsi_qla_host_t *ha, 
uint16_t format,
 
return rval;
 }
+
+int
+qla2x00_dump_ram(scsi_qla_host_t *ha, dma_addr_t req_dma, uint32_t addr,
+uint32_t size)
+{
+   int rval;
+   mbx_cmd_t mc;
+   mbx_cmd_t *mcp = &mc;
+
+   DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
+
+   if (MSW(addr) || IS_FWI2_CAPABLE(ha)) {
+   mcp->mb[0] = MBC_DUMP_RISC_RAM_EXTENDED;
+   mcp->mb[8] = MSW(addr);
+   mcp->out_mb = MBX_8|MBX_0;
+   } else {
+   mcp->mb[0] = MBC_DUMP_RISC_RAM;
+   mcp->out_mb = MBX_0;
+   }
+   mcp->mb[1] = LSW(addr);
+   mcp->mb[2] = MSW(req_dma);
+   mcp->mb[3] = LSW(req_dma);
+   mcp->mb[6] = MSW(MSD(req_dma));
+   mcp->mb[7] = LSW(MSD(req_dma));
+   mcp->out_mb |= MBX_7|MBX_6|MBX_3|MBX_2|MBX_1;
+   if (IS_FWI2_CAPABLE(ha)) {
+   mcp->mb[4] = MSW(size);
+   mcp->mb[5] = LSW(size);
+   mcp->out_mb |= MBX_5|MBX_4;
+   } else {
+   mcp->mb[4] = LSW(size);
+   mcp->out_mb |= MBX_4;
+   }
+
+   mcp->in_mb = MBX_0;
+   mcp->tov = 30;
+   mcp->flags = 0;
+   rval = qla2x00_mailbox_command(ha, mcp);
+
+   if (rval != QLA_SUCCESS) {
+   DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x.\n", __func__,
+   ha->host_no, rval, mcp->mb[0]));
+   } else {
+   DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
+   }
+
+   return rval;
+}
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index acca898..2a03400 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1384,7 +1384,7 @@ static struct isp_operations qla25xx_isp_ops = {
.beacon_on  = qla24xx_beacon_on,
.beacon_off = qla24xx_beacon_off,
.beacon_blink   = qla24xx_beacon_blink,
-   .read_optrom= qla24xx_read_optrom_data,
+   .read_optrom= qla25xx_read_optrom_data,
.write_optrom   = qla24xx_write_optrom_data,
.get_flash_version  = qla24xx_get_flash_version,
 };
diff --git a/drivers/scsi/qla2xxx/qla_sup.c b/drivers/scsi/qla2xxx/qla_sup.c
index a925a3f..ad3d1de 100644
--- a/drivers/scsi/qla2xxx/qla_sup.c
+++ b/drivers/scsi/qla2xxx/qla_sup.c
@@ -425,6 +425,9 @@ qla2x00_set_nvram_protection(scsi_qla_host_t *ha, int stat)
 /* Flash Manipulation Routines   */
 /*/
 
+#define OPTROM_BURST_SIZE  0x1000
+#define OPTROM_BURST_DWORDS(OPTROM_BURST_SIZE / 4)
+
 static inline uint32_t
 flash_conf_to_access_addr(uint32_t faddr)
 {
@@ -544,41 +547,59 @@ qla24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t 
*dwptr, uint32_t faddr,
 uint32_t dwords)
 {
int ret;
-   uint32_t liter;
-   uint32_t sec_mask, rest_addr, conf_addr, sec_end_mask;
+   uint32_t liter, miter;
+   uint32_t sec_mask, rest_addr, conf_addr;
uint32_t fdata, findex ;
uint8_t man_id, flash_id;
struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
+   dma_addr_t optrom_dma;
+   void *optrom = NULL;
+   uint32_t *s, *d;
 
ret = 

[PATCH 19/19] qla2xxx: Update version number to 8.02.00-k4.

2007-09-20 Thread Andrew Vasquez
Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_version.h |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_version.h 
b/drivers/scsi/qla2xxx/qla_version.h
index 18095b9..2d551a3 100644
--- a/drivers/scsi/qla2xxx/qla_version.h
+++ b/drivers/scsi/qla2xxx/qla_version.h
@@ -7,7 +7,7 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION  "8.02.00-k3"
+#define QLA2XXX_VERSION  "8.02.00-k4"
 
 #define QLA_DRIVER_MAJOR_VER   8
 #define QLA_DRIVER_MINOR_VER   2
-- 
1.5.3.2.80.g077d6f

-
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 04/19] qla2xxx: Allow region-based flash-part accesses.

2007-09-20 Thread Andrew Vasquez
From: Joe Carnuccio <[EMAIL PROTECTED]>

Additional cleanups and
Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_attr.c |  108 ---
 drivers/scsi/qla2xxx/qla_def.h  |2 +
 drivers/scsi/qla2xxx/qla_fw.h   |2 +
 drivers/scsi/qla2xxx/qla_sup.c  |4 +-
 4 files changed, 96 insertions(+), 20 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 0f2a9f5..8e7e00c 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -175,10 +175,10 @@ qla2x00_sysfs_read_optrom(struct kobject *kobj,
 
if (ha->optrom_state != QLA_SREADING)
return 0;
-   if (off > ha->optrom_size)
+   if (off > ha->optrom_region_size)
return 0;
-   if (off + count > ha->optrom_size)
-   count = ha->optrom_size - off;
+   if (off + count > ha->optrom_region_size)
+   count = ha->optrom_region_size - off;
 
memcpy(buf, &ha->optrom_buffer[off], count);
 
@@ -195,10 +195,10 @@ qla2x00_sysfs_write_optrom(struct kobject *kobj,
 
if (ha->optrom_state != QLA_SWRITING)
return -EINVAL;
-   if (off > ha->optrom_size)
+   if (off > ha->optrom_region_size)
return -ERANGE;
-   if (off + count > ha->optrom_size)
-   count = ha->optrom_size - off;
+   if (off + count > ha->optrom_region_size)
+   count = ha->optrom_region_size - off;
 
memcpy(&ha->optrom_buffer[off], buf, count);
 
@@ -222,12 +222,16 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
 {
struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
struct device, kobj)));
-   int val;
+   uint32_t start = 0;
+   uint32_t size = ha->optrom_size;
+   int val, valid;
 
if (off)
return 0;
 
-   if (sscanf(buf, "%d", &val) != 1)
+   if (sscanf(buf, "%d:%x:%x", &val, &start, &size) < 1)
+   return -EINVAL;
+   if (start > ha->optrom_size)
return -EINVAL;
 
switch (val) {
@@ -237,6 +241,11 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
break;
 
ha->optrom_state = QLA_SWAITING;
+
+   DEBUG2(qla_printk(KERN_INFO, ha,
+   "Freeing flash region allocation -- 0x%x bytes.\n",
+   ha->optrom_region_size));
+
vfree(ha->optrom_buffer);
ha->optrom_buffer = NULL;
break;
@@ -244,44 +253,107 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
if (ha->optrom_state != QLA_SWAITING)
break;
 
+   if (start & 0xfff) {
+   qla_printk(KERN_WARNING, ha,
+   "Invalid start region 0x%x/0x%x.\n", start, size);
+   return -EINVAL;
+   }
+
+   ha->optrom_region_start = start;
+   ha->optrom_region_size = start + size > ha->optrom_size ?
+   ha->optrom_size - start : size;
+
ha->optrom_state = QLA_SREADING;
-   ha->optrom_buffer = (uint8_t *)vmalloc(ha->optrom_size);
+   ha->optrom_buffer = vmalloc(ha->optrom_region_size);
if (ha->optrom_buffer == NULL) {
qla_printk(KERN_WARNING, ha,
"Unable to allocate memory for optrom retrieval "
-   "(%x).\n", ha->optrom_size);
+   "(%x).\n", ha->optrom_region_size);
 
ha->optrom_state = QLA_SWAITING;
return count;
}
 
-   memset(ha->optrom_buffer, 0, ha->optrom_size);
-   ha->isp_ops->read_optrom(ha, ha->optrom_buffer, 0,
-   ha->optrom_size);
+   DEBUG2(qla_printk(KERN_INFO, ha,
+   "Reading flash region -- 0x%x/0x%x.\n",
+   ha->optrom_region_start, ha->optrom_region_size));
+
+   memset(ha->optrom_buffer, 0, ha->optrom_region_size);
+   ha->isp_ops->read_optrom(ha, ha->optrom_buffer,
+   ha->optrom_region_start, ha->optrom_region_size);
break;
case 2:
if (ha->optrom_state != QLA_SWAITING)
break;
 
+   /*
+* We need to be more restrictive on which FLASH regions are
+* allowed to be updated via user-space.  Regions accessible
+* via this method include:
+*
+* ISP21xx/ISP22xx/ISP23xx type boards:
+*
+*  0x00 -> 0x02 -- Boot code.
+*
+* ISP2322/ISP24xx type boards:
+*
+*  0x00 -> 0x07 -- Boot code.
+*  0x08 -> 0x0

[PATCH 05/19] qla2xxx: Add PCI error recovery support.

2007-09-20 Thread Andrew Vasquez
From: Seokmann Ju <[EMAIL PROTECTED]>

Additional cleanups and
Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_def.h |1 +
 drivers/scsi/qla2xxx/qla_isr.c |   28 +-
 drivers/scsi/qla2xxx/qla_os.c  |  114 
 3 files changed, 142 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index e1e3428..75ab898 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index eecae99..dcfb24b 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -34,6 +34,7 @@ qla2100_intr_handler(int irq, void *dev_id)
int status;
unsigned long   flags;
unsigned long   iter;
+   uint16_thccr;
uint16_tmb[4];
 
ha = (scsi_qla_host_t *) dev_id;
@@ -48,7 +49,23 @@ qla2100_intr_handler(int irq, void *dev_id)
 
spin_lock_irqsave(&ha->hardware_lock, flags);
for (iter = 50; iter--; ) {
-   if ((RD_REG_WORD(®->istatus) & ISR_RISC_INT) == 0)
+   hccr = RD_REG_WORD(®->hccr);
+   if (hccr & HCCR_RISC_PAUSE) {
+   if (pci_channel_offline(ha->pdev))
+   break;
+
+   /*
+* Issue a "HARD" reset in order for the RISC interrupt
+* bit to be cleared.  Schedule a big hammmer to get
+* out of the RISC PAUSED state.
+*/
+   WRT_REG_WORD(®->hccr, HCCR_RESET_RISC);
+   RD_REG_WORD(®->hccr);
+
+   ha->isp_ops->fw_dump(ha, 1);
+   set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
+   break;
+   } else if ((RD_REG_WORD(®->istatus) & ISR_RISC_INT) == 0)
break;
 
if (RD_REG_WORD(®->semaphore) & BIT_0) {
@@ -127,6 +144,9 @@ qla2300_intr_handler(int irq, void *dev_id)
for (iter = 50; iter--; ) {
stat = RD_REG_DWORD(®->u.isp2300.host_status);
if (stat & HSR_RISC_PAUSED) {
+   if (pci_channel_offline(ha->pdev))
+   break;
+
hccr = RD_REG_WORD(®->hccr);
if (hccr & (BIT_15 | BIT_13 | BIT_11 | BIT_8))
qla_printk(KERN_INFO, ha, "Parity error -- "
@@ -1499,6 +1519,9 @@ qla24xx_intr_handler(int irq, void *dev_id)
for (iter = 50; iter--; ) {
stat = RD_REG_DWORD(®->host_status);
if (stat & HSRX_RISC_PAUSED) {
+   if (pci_channel_offline(ha->pdev))
+   break;
+
hccr = RD_REG_DWORD(®->hccr);
 
qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, "
@@ -1633,6 +1656,9 @@ qla24xx_msix_default(int irq, void *dev_id)
for (iter = 50; iter--; ) {
stat = RD_REG_DWORD(®->host_status);
if (stat & HSRX_RISC_PAUSED) {
+   if (pci_channel_offline(ha->pdev))
+   break;
+
hccr = RD_REG_DWORD(®->hccr);
 
qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, "
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 2a03400..a8ab2d3 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -385,6 +385,11 @@ qla2x00_queuecommand(struct scsi_cmnd *cmd, void 
(*done)(struct scsi_cmnd *))
srb_t *sp;
int rval;
 
+   if (unlikely(pci_channel_offline(ha->pdev))) {
+   cmd->result = DID_REQUEUE << 16;
+   goto qc_fail_command;
+   }
+
rval = fc_remote_port_chkready(rport);
if (rval) {
cmd->result = rval;
@@ -447,6 +452,11 @@ qla24xx_queuecommand(struct scsi_cmnd *cmd, void 
(*done)(struct scsi_cmnd *))
int rval;
scsi_qla_host_t *pha = to_qla_parent(ha);
 
+   if (unlikely(pci_channel_offline(ha->pdev))) {
+   cmd->result = DID_REQUEUE << 16;
+   goto qc24_fail_command;
+   }
+
rval = fc_remote_port_chkready(rport);
if (rval) {
cmd->result = rval;
@@ -1571,6 +1581,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct 
pci_device_id *id)
if (pci_enable_device(pdev))
goto probe_out;
 
+   if (pci_find_aer_capability(pdev))
+   if (pci_enable_pcie_error_reporting(pdev))
+   goto probe_out;
+
sht = &qla2x00_driver_template;
if (pdev->device == PCI_DEVICE_ID_QLOGIC_ISP2422 ||
pdev->device == PCI_DEVICE_ID_QLOGIC_

[PATCH 06/19] qla2xxx: Query additional RISC information during a pause.

2007-09-20 Thread Andrew Vasquez
Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_fw.h  |4 ++-
 drivers/scsi/qla2xxx/qla_isr.c |   53 
 2 files changed, 56 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index d5344d7..db63386 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -942,7 +942,9 @@ struct device_reg_24xx {
uint16_t mailbox31;
 
uint32_t iobase_window;
-   uint32_t unused_4[8];   /* Gap. */
+   uint32_t unused_4;  /* Gap. */
+   uint32_t iobase_c8;
+   uint32_t unused_4_1[6]; /* Gap. */
uint32_t iobase_q;
uint32_t unused_5[2];   /* Gap. */
uint32_t iobase_select;
diff --git a/drivers/scsi/qla2xxx/qla_isr.c b/drivers/scsi/qla2xxx/qla_isr.c
index dcfb24b..f61c2fe 100644
--- a/drivers/scsi/qla2xxx/qla_isr.c
+++ b/drivers/scsi/qla2xxx/qla_isr.c
@@ -6,6 +6,7 @@
  */
 #include "qla_def.h"
 
+#include 
 #include 
 
 static void qla2x00_mbx_completion(scsi_qla_host_t *, uint16_t);
@@ -1484,6 +1485,52 @@ qla24xx_process_response_queue(struct scsi_qla_host *ha)
WRT_REG_DWORD(®->rsp_q_out, ha->rsp_ring_index);
 }
 
+static void
+qla2xxx_check_risc_status(scsi_qla_host_t *ha)
+{
+   int rval;
+   uint32_t cnt;
+   struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
+
+   if (!IS_QLA25XX(ha))
+   return;
+
+   rval = QLA_SUCCESS;
+   WRT_REG_DWORD(®->iobase_addr, 0x7C00);
+   RD_REG_DWORD(®->iobase_addr);
+   WRT_REG_DWORD(®->iobase_window, 0x0001);
+   for (cnt = 1; (RD_REG_DWORD(®->iobase_window) & BIT_0) == 0 &&
+   rval == QLA_SUCCESS; cnt--) {
+   if (cnt) {
+   WRT_REG_DWORD(®->iobase_window, 0x0001);
+   udelay(10);
+   } else
+   rval = QLA_FUNCTION_TIMEOUT;
+   }
+   if (rval == QLA_SUCCESS)
+   goto next_test;
+
+   WRT_REG_DWORD(®->iobase_window, 0x0003);
+   for (cnt = 100; (RD_REG_DWORD(®->iobase_window) & BIT_0) == 0 &&
+   rval == QLA_SUCCESS; cnt--) {
+   if (cnt) {
+   WRT_REG_DWORD(®->iobase_window, 0x0003);
+   udelay(10);
+   } else
+   rval = QLA_FUNCTION_TIMEOUT;
+   }
+   if (rval != QLA_SUCCESS)
+   goto done;
+
+next_test:
+   if (RD_REG_DWORD(®->iobase_c8) & BIT_3)
+   qla_printk(KERN_INFO, ha, "Additional code -- 0x55AA.\n");
+
+done:
+   WRT_REG_DWORD(®->iobase_window, 0x);
+   RD_REG_DWORD(®->iobase_window);
+}
+
 /**
  * qla24xx_intr_handler() - Process interrupts for the ISP23xx and ISP63xx.
  * @irq:
@@ -1526,6 +1573,9 @@ qla24xx_intr_handler(int irq, void *dev_id)
 
qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, "
"Dumping firmware!\n", hccr);
+
+   qla2xxx_check_risc_status(ha);
+
ha->isp_ops->fw_dump(ha, 1);
set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
break;
@@ -1663,6 +1713,9 @@ qla24xx_msix_default(int irq, void *dev_id)
 
qla_printk(KERN_INFO, ha, "RISC paused -- HCCR=%x, "
"Dumping firmware!\n", hccr);
+
+   qla2xxx_check_risc_status(ha);
+
ha->isp_ops->fw_dump(ha, 1);
set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
break;
-- 
1.5.3.2.80.g077d6f

-
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 07/19] qla2xxx: Correct staging of RISC while attempting to pause.

2007-09-20 Thread Andrew Vasquez
There's no need to reset the RISC prior to pausing.

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_dbg.c |   23 ++-
 1 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index b52fa89..2defe0c 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -172,19 +172,16 @@ qla24xx_pause_risc(struct device_reg_24xx __iomem *reg)
int rval = QLA_SUCCESS;
uint32_t cnt;
 
-   if ((RD_REG_DWORD(®->hccr) & HCCRX_RISC_PAUSE) == 0) {
-   WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_RESET |
-   HCCRX_CLR_HOST_INT);
-   RD_REG_DWORD(®->hccr);   /* PCI Posting. */
-   WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_PAUSE);
-   for (cnt = 3;
-   (RD_REG_DWORD(®->hccr) & HCCRX_RISC_PAUSE) == 0 &&
-   rval == QLA_SUCCESS; cnt--) {
-   if (cnt)
-   udelay(100);
-   else
-   rval = QLA_FUNCTION_TIMEOUT;
-   }
+   if (RD_REG_DWORD(®->hccr) & HCCRX_RISC_PAUSE)
+   return rval;
+
+   WRT_REG_DWORD(®->hccr, HCCRX_SET_RISC_PAUSE);
+   for (cnt = 3; (RD_REG_DWORD(®->hccr) & HCCRX_RISC_PAUSE) == 0 &&
+   rval == QLA_SUCCESS; cnt--) {
+   if (cnt)
+   udelay(100);
+   else
+   rval = QLA_FUNCTION_TIMEOUT;
}
 
return rval;
-- 
1.5.3.2.80.g077d6f

-
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 08/19] qla2xxx: Query additional RISC registers during ISP25XX firmware dump.

2007-09-20 Thread Andrew Vasquez
Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_dbg.c |   18 ++
 drivers/scsi/qla2xxx/qla_dbg.h |2 ++
 drivers/scsi/qla2xxx/qla_fw.h  |2 +-
 3 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_dbg.c b/drivers/scsi/qla2xxx/qla_dbg.c
index 2defe0c..ca7f70d 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.c
+++ b/drivers/scsi/qla2xxx/qla_dbg.c
@@ -1072,6 +1072,7 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
}
fw = &ha->fw_dump->isp.isp25;
qla2xxx_prep_dump(ha, ha->fw_dump);
+   ha->fw_dump->version = __constant_htonl(2);
 
fw->host_status = htonl(RD_REG_DWORD(®->host_status));
 
@@ -1080,6 +1081,23 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
if (rval != QLA_SUCCESS)
goto qla25xx_fw_dump_failed_0;
 
+   /* Host/Risc registers. */
+   iter_reg = fw->host_risc_reg;
+   iter_reg = qla24xx_read_window(reg, 0x7000, 16, iter_reg);
+   qla24xx_read_window(reg, 0x7010, 16, iter_reg);
+
+   /* PCIe registers. */
+   WRT_REG_DWORD(®->iobase_addr, 0x7C00);
+   RD_REG_DWORD(®->iobase_addr);
+   WRT_REG_DWORD(®->iobase_window, 0x01);
+   dmp_reg = ®->iobase_c4;
+   fw->pcie_regs[0] = htonl(RD_REG_DWORD(dmp_reg++));
+   fw->pcie_regs[1] = htonl(RD_REG_DWORD(dmp_reg++));
+   fw->pcie_regs[2] = htonl(RD_REG_DWORD(dmp_reg));
+   fw->pcie_regs[3] = htonl(RD_REG_DWORD(®->iobase_window));
+   WRT_REG_DWORD(®->iobase_window, 0x00);
+   RD_REG_DWORD(®->iobase_window);
+
/* Host interface registers. */
dmp_reg = ®->flash_addr;
for (cnt = 0; cnt < sizeof(fw->host_reg) / 4; cnt++)
diff --git a/drivers/scsi/qla2xxx/qla_dbg.h b/drivers/scsi/qla2xxx/qla_dbg.h
index cca4b0d..a50ecf0 100644
--- a/drivers/scsi/qla2xxx/qla_dbg.h
+++ b/drivers/scsi/qla2xxx/qla_dbg.h
@@ -215,6 +215,8 @@ struct qla24xx_fw_dump {
 
 struct qla25xx_fw_dump {
uint32_t host_status;
+   uint32_t host_risc_reg[32];
+   uint32_t pcie_regs[4];
uint32_t host_reg[32];
uint32_t shadow_reg[11];
uint32_t risc_io_reg;
diff --git a/drivers/scsi/qla2xxx/qla_fw.h b/drivers/scsi/qla2xxx/qla_fw.h
index db63386..25364b1 100644
--- a/drivers/scsi/qla2xxx/qla_fw.h
+++ b/drivers/scsi/qla2xxx/qla_fw.h
@@ -942,7 +942,7 @@ struct device_reg_24xx {
uint16_t mailbox31;
 
uint32_t iobase_window;
-   uint32_t unused_4;  /* Gap. */
+   uint32_t iobase_c4;
uint32_t iobase_c8;
uint32_t unused_4_1[6]; /* Gap. */
uint32_t iobase_q;
-- 
1.5.3.2.80.g077d6f

-
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 09/19] qla2xxx: Correct infinite-login-retry issue.

2007-09-20 Thread Andrew Vasquez
From: Ravi Anand <[EMAIL PROTECTED]>

Where the DPC logic would get jammed into continuously
reloging-into a port.

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_os.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index a8ab2d3..4314f94 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -2437,7 +2437,6 @@ qla2x00_do_dpc(void *data)
if (atomic_read(&fcport->state) != FCS_ONLINE &&
fcport->login_retry) {
 
-   fcport->login_retry--;
if (fcport->flags & FCF_FABRIC_DEVICE) {
if (fcport->flags &
FCF_TAPE_PRESENT)
@@ -2453,6 +2452,7 @@ qla2x00_do_dpc(void *data)
qla2x00_local_device_login(
ha, fcport);
 
+   fcport->login_retry--;
if (status == QLA_SUCCESS) {
fcport->old_loop_id = 
fcport->loop_id;
 
@@ -2470,6 +2470,8 @@ qla2x00_do_dpc(void *data)
} else {
fcport->login_retry = 0;
}
+   if (fcport->login_retry == 0)
+   fcport->loop_id = FC_NO_LOOP_ID;
}
if (test_bit(LOOP_RESYNC_NEEDED, 
&ha->dpc_flags))
break;
-- 
1.5.3.2.80.g077d6f

-
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 10/19] qla2xxx: Set correct attribute count during FDMI RPA.

2007-09-20 Thread Andrew Vasquez
Also remove legacy '/proc' name during OS_DEVICE_NAME
registration.

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_def.h |2 +-
 drivers/scsi/qla2xxx/qla_gs.c  |6 --
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 75ab898..511e3cd 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1705,7 +1705,7 @@ struct ct_fdmi_hba_attributes {
 /*
  * Port attribute types.
  */
-#define FDMI_PORT_ATTR_COUNT   5
+#define FDMI_PORT_ATTR_COUNT   6
 #define FDMI_PORT_FC4_TYPES1
 #define FDMI_PORT_SUPPORT_SPEED2
 #define FDMI_PORT_CURRENT_SPEED3
diff --git a/drivers/scsi/qla2xxx/qla_gs.c b/drivers/scsi/qla2xxx/qla_gs.c
index a7e2358..eb0784c 100644
--- a/drivers/scsi/qla2xxx/qla_gs.c
+++ b/drivers/scsi/qla2xxx/qla_gs.c
@@ -1517,7 +1517,7 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *ha)
 
/* Attributes */
ct_req->req.rpa.attrs.count =
-   __constant_cpu_to_be32(FDMI_PORT_ATTR_COUNT);
+   __constant_cpu_to_be32(FDMI_PORT_ATTR_COUNT - 1);
entries = ct_req->req.rpa.port_name;
 
/* FC4 types. */
@@ -1600,7 +1600,7 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *ha)
/* OS device name. */
eiter = (struct ct_fdmi_port_attr *) (entries + size);
eiter->type = __constant_cpu_to_be16(FDMI_PORT_OS_DEVICE_NAME);
-   sprintf(eiter->a.os_dev_name, "/proc/scsi/qla2xxx/%ld", ha->host_no);
+   strcpy(eiter->a.os_dev_name, QLA2XXX_DRIVER_NAME);
alen = strlen(eiter->a.os_dev_name);
alen += (alen & 3) ? (4 - (alen & 3)) : 4;
eiter->len = cpu_to_be16(4 + alen);
@@ -1611,6 +1611,8 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *ha)
 
/* Hostname. */
if (strlen(fc_host_system_hostname(ha->host))) {
+   ct_req->req.rpa.attrs.count =
+   __constant_cpu_to_be32(FDMI_PORT_ATTR_COUNT);
eiter = (struct ct_fdmi_port_attr *) (entries + size);
eiter->type = __constant_cpu_to_be16(FDMI_PORT_HOST_NAME);
snprintf(eiter->a.host_name, sizeof(eiter->a.host_name),
-- 
1.5.3.2.80.g077d6f

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


[PATCH 11/19] qla2xxx: Use the correct pointer-address during NVRAM writes.

2007-09-20 Thread Andrew Vasquez
Original code, incorrectly passed the address-of a pointer rather
than the pointer value itself.

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_attr.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 8e7e00c..445d583 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -146,7 +146,7 @@ qla2x00_sysfs_write_nvram(struct kobject *kobj,
/* Write NVRAM. */
spin_lock_irqsave(&ha->hardware_lock, flags);
ha->isp_ops->write_nvram(ha, (uint8_t *)buf, ha->nvram_base, count);
-   ha->isp_ops->read_nvram(ha, (uint8_t *)&ha->nvram, ha->nvram_base,
+   ha->isp_ops->read_nvram(ha, (uint8_t *)ha->nvram, ha->nvram_base,
count);
spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
-- 
1.5.3.2.80.g077d6f

-
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 16/19] qla2xxx: Sparse cleanups in qla_mid.c

2007-09-20 Thread Andrew Vasquez
Make several needlessly global functions static:
- qla2x00_mark_vp_devices_dead()
- qla24xx_configure_vp()

Remove unused function qla24xx_modify_vport().

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_mid.c |   34 ++
 1 files changed, 2 insertions(+), 32 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index 1a2cdcd..821ee74 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -104,7 +104,7 @@ qla24xx_find_vhost_by_name(scsi_qla_host_t *ha, uint8_t 
*port_name)
  *
  * Context:
  */
-void
+static void
 qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha)
 {
fc_port_t *fcport;
@@ -179,37 +179,7 @@ enable_failed:
return 1;
 }
 
-/**
- * qla24xx_modify_vport() -  Modifies the virtual fabric port's configuration
- * @ha: HA context
- * @vp: pointer to buffer of virtual port parameters.
- * @ret_code: return error code:
- *
- * Returns the virtual port id, or MAX_VSAN_ID, if couldn't create.
- */
-uint32_t
-qla24xx_modify_vhba(scsi_qla_host_t *ha, vport_params_t *vp, uint32_t *vp_id)
-{
-   scsi_qla_host_t *vha;
-
-   vha = qla24xx_find_vhost_by_name(ha, vp->port_name);
-   if (!vha) {
-   *vp_id = MAX_NUM_VPORT_LOOP;
-   return VP_RET_CODE_WWPN;
-   }
-
-   if (qla24xx_enable_vp(vha)) {
-   scsi_host_put(vha->host);
-   qla2x00_mem_free(vha);
-   *vp_id = MAX_NUM_VPORT_LOOP;
-   return VP_RET_CODE_RESOURCES;
-   }
-
-   *vp_id = vha->vp_idx;
-   return VP_RET_CODE_OK;
-}
-
-void
+static void
 qla24xx_configure_vp(scsi_qla_host_t *vha)
 {
struct fc_vport *fc_vport;
-- 
1.5.3.2.80.g077d6f

-
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 15/19] qla2xxx: Cleanup several 'sparse' warnings.

2007-09-20 Thread Andrew Vasquez
Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_iocb.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 3a5e78c..7f6a89b 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -308,7 +308,7 @@ qla2x00_start_scsi(srb_t *sp)
handle++;
if (handle == MAX_OUTSTANDING_COMMANDS)
handle = 1;
-   if (ha->outstanding_cmds[handle] == 0)
+   if (!ha->outstanding_cmds[handle])
break;
}
if (index == MAX_OUTSTANDING_COMMANDS)
@@ -711,7 +711,7 @@ qla24xx_start_scsi(srb_t *sp)
handle++;
if (handle == MAX_OUTSTANDING_COMMANDS)
handle = 1;
-   if (ha->outstanding_cmds[handle] == 0)
+   if (!ha->outstanding_cmds[handle])
break;
}
if (index == MAX_OUTSTANDING_COMMANDS)
-- 
1.5.3.2.80.g077d6f

-
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/19] qla2xxx: Remove unused member (list) from srb_t structure.

2007-09-20 Thread Andrew Vasquez
This change reduces by as much as 16% the memory footprint for
each allocated sbr_t structure requested from the mempool.

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_def.h |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 1396f4d..b928e31 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -185,8 +185,6 @@
  * SCSI Request Block
  */
 typedef struct srb {
-   struct list_head list;
-
struct scsi_qla_host *ha;   /* HA the SP is queued on */
struct fc_port *fcport;
 
-- 
1.5.3.2.80.g077d6f

-
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 12/19] qla2xxx: Retrieve max-NPIV support capabilities from FW.

2007-09-20 Thread Andrew Vasquez
From: Seokmann Ju <[EMAIL PROTECTED]>

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_attr.c |2 +-
 drivers/scsi/qla2xxx/qla_def.h  |2 +-
 drivers/scsi/qla2xxx/qla_gbl.h  |4 ++--
 drivers/scsi/qla2xxx/qla_init.c |   16 +++-
 drivers/scsi/qla2xxx/qla_mbx.c  |   11 +++
 5 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index 445d583..c90dc59 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -1250,6 +1250,6 @@ qla2x00_init_host_attr(scsi_qla_host_t *ha)
fc_host_node_name(ha->host) = wwn_to_u64(ha->node_name);
fc_host_port_name(ha->host) = wwn_to_u64(ha->port_name);
fc_host_supported_classes(ha->host) = FC_COS_CLASS3;
-   fc_host_max_npiv_vports(ha->host) = MAX_NUM_VPORT_FABRIC;
+   fc_host_max_npiv_vports(ha->host) = ha->max_npiv_vports;;
fc_host_npiv_vports_inuse(ha->host) = ha->cur_vport_count;
 }
diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index 511e3cd..1396f4d 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -2534,7 +2534,7 @@ typedef struct scsi_qla_host {
 #define VP_ERR_FAB_NORESOURCES 3
 #define VP_ERR_FAB_LOGOUT  4
 #define VP_ERR_ADAP_NORESOURCES5
-   int max_npiv_vports;/* 63 or 125 per topoloty */
+   uint16_tmax_npiv_vports;/* 63 or 125 per topoloty */
int cur_vport_count;
 } scsi_qla_host_t;
 
diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h
index e8122e8..09cb2a9 100644
--- a/drivers/scsi/qla2xxx/qla_gbl.h
+++ b/drivers/scsi/qla2xxx/qla_gbl.h
@@ -215,8 +215,8 @@ extern int
 qla2x00_get_id_list(scsi_qla_host_t *, void *, dma_addr_t, uint16_t *);
 
 extern int
-qla2x00_get_resource_cnts(scsi_qla_host_t *, uint16_t *, uint16_t *, uint16_t 
*,
-uint16_t *);
+qla2x00_get_resource_cnts(scsi_qla_host_t *, uint16_t *, uint16_t *,
+uint16_t *, uint16_t *, uint16_t *);
 
 extern int
 qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map);
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 45da947..191dafd 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -849,7 +849,8 @@ qla2x00_resize_request_q(scsi_qla_host_t *ha)
return;
 
/* Retrieve IOCB counts available to the firmware. */
-   rval = qla2x00_get_resource_cnts(ha, NULL, NULL, NULL, &fw_iocb_cnt);
+   rval = qla2x00_get_resource_cnts(ha, NULL, NULL, NULL, &fw_iocb_cnt,
+   &ha->max_npiv_vports);
if (rval)
return;
/* No point in continuing if current settings are sufficient. */
@@ -916,9 +917,15 @@ qla2x00_setup_chip(scsi_qla_host_t *ha)
&ha->fw_attributes, &ha->fw_memory_size);
qla2x00_resize_request_q(ha);
ha->flags.npiv_supported = 0;
-   if (IS_QLA24XX(ha) &&
-   (ha->fw_attributes & BIT_2))
+   if ((IS_QLA24XX(ha) || IS_QLA25XX(ha)) &&
+   (ha->fw_attributes & BIT_2)) {
ha->flags.npiv_supported = 1;
+   if ((!ha->max_npiv_vports) ||
+   ((ha->max_npiv_vports + 1) %
+   MAX_MULTI_ID_FABRIC))
+   ha->max_npiv_vports =
+   MAX_NUM_VPORT_FABRIC;
+   }
 
if (ql2xallocfwdump)
qla2x00_alloc_fw_dump(ha);
@@ -1155,8 +1162,7 @@ qla2x00_init_rings(scsi_qla_host_t *ha)
 
DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no));
 
-   mid_init_cb->count = MAX_NUM_VPORT_FABRIC;
-   ha->max_npiv_vports = MAX_NUM_VPORT_FABRIC;
+   mid_init_cb->count = ha->max_npiv_vports;
 
rval = qla2x00_init_firmware(ha, ha->init_cb_size);
if (rval) {
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index e4f4b1f..ec48871 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -1919,7 +1919,8 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, 
dma_addr_t id_list_dma,
  */
 int
 qla2x00_get_resource_cnts(scsi_qla_host_t *ha, uint16_t *cur_xchg_cnt,
-uint16_t *orig_xchg_cnt, uint16_t *cur_iocb_cnt, uint16_t *orig_iocb_cnt)
+uint16_t *orig_xchg_cnt, uint16_t *cur_iocb_cnt,
+uint16_t *orig_iocb_cnt, uint16_t *max_npiv_vports)
 {
int rval;
mbx_cmd_t mc;
@@ -1929,7 +1930,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *ha, uint16_t 
*cur_xchg_cnt,
 

[PATCH 14/19] qla2xxx: Use shost_priv().

2007-09-20 Thread Andrew Vasquez
Drop usage of legacy to_qla_host() macro.

Signed-off-by: Andrew Vasquez <[EMAIL PROTECTED]>
---
 drivers/scsi/qla2xxx/qla_attr.c |   88 +++---
 drivers/scsi/qla2xxx/qla_dbg.c  |2 +-
 drivers/scsi/qla2xxx/qla_def.h  |2 -
 drivers/scsi/qla2xxx/qla_mid.c  |6 +-
 drivers/scsi/qla2xxx/qla_os.c   |   20 
 5 files changed, 58 insertions(+), 60 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index c90dc59..05fa779 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -18,7 +18,7 @@ qla2x00_sysfs_read_fw_dump(struct kobject *kobj,
   struct bin_attribute *bin_attr,
   char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
char *rbuf = (char *)ha->fw_dump;
 
@@ -39,7 +39,7 @@ qla2x00_sysfs_write_fw_dump(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
int reading;
 
@@ -89,7 +89,7 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj,
 struct bin_attribute *bin_attr,
 char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
int size = ha->nvram_size;
char*nvram_cache = ha->nvram;
@@ -112,7 +112,7 @@ qla2x00_sysfs_write_nvram(struct kobject *kobj,
  struct bin_attribute *bin_attr,
  char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
unsigned long   flags;
uint16_tcnt;
@@ -170,7 +170,7 @@ qla2x00_sysfs_read_optrom(struct kobject *kobj,
  struct bin_attribute *bin_attr,
  char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
 
if (ha->optrom_state != QLA_SREADING)
@@ -190,7 +190,7 @@ qla2x00_sysfs_write_optrom(struct kobject *kobj,
   struct bin_attribute *bin_attr,
   char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
 
if (ha->optrom_state != QLA_SWRITING)
@@ -220,7 +220,7 @@ qla2x00_sysfs_write_optrom_ctl(struct kobject *kobj,
   struct bin_attribute *bin_attr,
   char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
uint32_t start = 0;
uint32_t size = ha->optrom_size;
@@ -372,7 +372,7 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj,
   struct bin_attribute *bin_attr,
   char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
int   size = ha->vpd_size;
char  *vpd_cache = ha->vpd;
@@ -395,7 +395,7 @@ qla2x00_sysfs_write_vpd(struct kobject *kobj,
struct bin_attribute *bin_attr,
char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
unsigned long flags;
 
@@ -426,7 +426,7 @@ qla2x00_sysfs_read_sfp(struct kobject *kobj,
   struct bin_attribute *bin_attr,
   char *buf, loff_t off, size_t count)
 {
-   struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
+   struct scsi_qla_host *ha = shost_priv(dev_to_shost(container_of(kobj,
struct device, kobj)));
uint16_t iter, addr, offset;
int rval;
@@

[PATCH] mptbase: Reset ioc initiator during PCI resume

2007-09-20 Thread Darrick J. Wong
It appears that the LSI SAS 1064E chip needs to be reset after a
suspend/resume cycle before the driver attempts further communications with
the chip.  Without this patch, resuming the chip results in this error
message being printed repeatedly and no more disk I/O.

mptbase: ioc0: ERROR - Invalid IOC facts reply, msgLength=0 offsetof=6!

So far it seems to fix suspend/resume on all the MPT Fusion cards I have
(SAS and U320 SCSI) but since I don't know the internals of that chip I
can't say for sure if this is a proper fix.

Signed-off-by: Darrick J. Wong <[EMAIL PROTECTED]>
---

 drivers/message/fusion/mptbase.c |8 +++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 414c109..97895bd 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1772,6 +1772,12 @@ mpt_resume(struct pci_dev *pdev)
(mpt_GetIocState(ioc, 1) >> MPI_IOC_STATE_SHIFT),
CHIPREG_READ32(&ioc->chip->Doorbell));
 
+   /* put ioc into READY_STATE */
+   if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) {
+   printk(MYIOC_s_ERR_FMT
+   "pci-resume:  IOC msg unit reset failed!\n", ioc->name);
+   }
+
/* bring ioc to operational state */
if ((recovery_state = mpt_do_ioc_recovery(ioc,
MPT_HOSTEVENT_IOC_RECOVER, CAN_SLEEP)) != 0) {
-
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 ver2 1/2] libata-scsi: Remove !use_sg code paths

2007-09-20 Thread Jeff Garzik

Boaz Harrosh wrote:

 This is a minimal patch needed to remove use of !use_sg
 but it is not a complete clean up of the !use_sg paths.
 Libata-core still has the qc->flags & ATA_QCFLAG_SG
 and !qc->n_elem code paths. Perhaps an ata maintainer
 would have a go at it.

 - TODO: further cleanup of qc->flags & ATA_QCFLAG_SG
   and !qc->n_elem code paths in libata-core
 - TODO: Use scsi_dma_{map,unmap} where applicable.
---
 drivers/ata/libata-scsi.c |   31 +--
 1 files changed, 9 insertions(+), 22 deletions(-)


applied 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


[PATCH] Clean up IOC reset code to obey coding style

2007-09-20 Thread Darrick J. Wong
Randy Dunlap scolded me for introducing poorly styled code.  Since it
was a copy-and-paste block from mpt_suspend(), fix both.

Signed-off-by: Darrick J. Wong <[EMAIL PROTECTED]>
---

 drivers/message/fusion/mptbase.c |6 ++
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 40b8b41..2952a54 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -1721,10 +1721,9 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state)
pci_save_state(pdev);
 
/* put ioc into READY_STATE */
-   if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) {
+   if (SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP))
printk(MYIOC_s_ERR_FMT
"pci-suspend:  IOC msg unit reset failed!\n", ioc->name);
-   }
 
/* disable interrupts */
CHIPREG_WRITE32(&ioc->chip->IntMask, 0x);
@@ -1773,10 +1772,9 @@ mpt_resume(struct pci_dev *pdev)
CHIPREG_READ32(&ioc->chip->Doorbell));
 
/* put ioc into READY_STATE */
-   if(SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP)) {
+   if (SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, CAN_SLEEP))
printk(MYIOC_s_ERR_FMT
"pci-resume:  IOC msg unit reset failed!\n", ioc->name);
-   }
 
/* bring ioc to operational state */
if ((recovery_state = mpt_do_ioc_recovery(ioc,
-
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] aic7xxx driver. Restrict DMA to 32bit for 29320LPE Adaptec SCSI controller

2007-09-20 Thread Anil K. Ravindranath
Hi,

We have not heard any comments or inputs on this patch. 

With regards,
  Anil

On Sat, 2007-06-30 at 05:45 -0700, Anil K. Ravindranath wrote:
> Subject: [PATCH] aic7xxx driver. Restrict DMA to 32bit for 29320LPE
> Adaptec SCSI controller
> 
> Contribution:
> 
> Anil Ravindranath <[EMAIL PROTECTED]>
> 
> Issue:
> 
> Data Bursts that cross from 32- to 64-Bit address space have incorrect
> address for 29320LPE. This leads to potential data corruption.
> 
> Fix:
> 
> Restrict DMA to 32bit so that it does not cross 4GB boundary.
> 
> Change Log:
> 
> Restrict DMA to 32bit for 29320LPE so that it does not cross 4GB
> boundary
> 
> Patch: apply to scsi-misc-2.6.git development tree
> 
> Signed off By:  Anil Ravindranath <[EMAIL PROTECTED]>
> 
> diff -urN a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
> b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c
> --- a/drivers/scsi/aic7xxx/aic79xx_osm_pci.c2007-06-30
> 05:24:08.0 -0700
> +++ b/drivers/scsi/aic7xxx/aic79xx_osm_pci.c2007-06-30
> 05:25:40.0 -0700
> @@ -161,7 +161,10 @@
> }
> pci_set_master(pdev);
> 
> -   if (sizeof(dma_addr_t) > 4) {
> +   /*
> +* Restrict DMA to 32bit for 29320LPE
> +*/
> +   if ((sizeof(dma_addr_t) > 4) && (entry->full_id !=
> ID_AHA_29320LPE)) {
> const u64 required_mask = dma_get_required_mask(dev);
> 
> if (required_mask > DMA_39BIT_MASK &&
> 
> 
> 
> diffstat output:
> 
> aic79xx_osm_pci.c |5 -
>  1 files changed, 4 insertions(+), 1 deletion(-)
> 
> With regards,
>   Anil
-
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] aic7xxx driver. Restrict DMA to 32bit for 29320LPE Adaptec SCSI controller

2007-09-20 Thread James Bottomley
On Thu, 2007-09-20 at 08:08 -0700, Anil K. Ravindranath wrote:
> Hi,
> 
> We have not heard any comments or inputs on this patch. 
> 
> With regards,
>   Anil
> 
> On Sat, 2007-06-30 at 05:45 -0700, Anil K. Ravindranath wrote:
> > Subject: [PATCH] aic7xxx driver. Restrict DMA to 32bit for 29320LPE
> > Adaptec SCSI controller
> > 
> > Contribution:
> > 
> > Anil Ravindranath <[EMAIL PROTECTED]>
> > 
> > Issue:
> > 
> > Data Bursts that cross from 32- to 64-Bit address space have incorrect
> > address for 29320LPE. This leads to potential data corruption.

Where do you think you see this happening?  The block layer has a
dma_boundary parameter (basically a mask which it refuses to allow dma
to cross).  By default this is set to 4GB (because a lot of PCI cards
have difficulty going from non-DAC to DAC).  The aic79xx driver does
nothing to alter this, so you shouldn't be seeing any DMA segments
crossing the 4GB boundary.

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: aic79xx problems

2007-09-20 Thread Julian Calaby
On 9/21/07, Stefan Boresch <[EMAIL PROTECTED]> wrote:
>
> I will try, but a very dumb question first. If I have a kernel that
> crashes because of a disk problem ..., how do I get to save the output?
> (Never worked with a serial console, but there might be a first time
> for everything ...) But maybe there is an obvious solution that I overlook?
>
> Or should I just try to watch and look for certain messages (ordering of
> messages), which given the huge amount of output seems a bit daunting ...

Ok, in response to your dumb question, an answer from another dumb user: (me)

Firstly, serial consoles aren't that difficult to set up - all you
need is a null modem cable and suitable software on the other end.
Then ensure that it's built in and pass "console=ttyS0" (or
"console=ttyS1" if you're using serial port #2) when you boot.

There is a network console - but I'm not sure whether that is useful
for boot messages.

Hope that helps =)

--

Julian Calaby

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