[PATCH 1/9] Add scsi_destroy_device()

2007-05-23 Thread Hannes Reinecke

This patchs adds a new helper scsi_destroy_device(). It will transition
and sdev into the 'SDEV_DEL' state.

Signed-off-by: Hannes Reinecke [EMAIL PROTECTED]
---
 drivers/scsi/scsi_scan.c   |3 +--
 include/scsi/scsi_device.h |6 ++
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index a67f315..4874bdd 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -921,8 +921,7 @@ static inline void scsi_destroy_sdev(str
scsi_device_set_state(sdev, SDEV_DEL);
if (sdev-host-hostt-slave_destroy)
sdev-host-hostt-slave_destroy(sdev);
-   transport_destroy_device(sdev-sdev_gendev);
-   put_device(sdev-sdev_gendev);
+   scsi_destroy_device(sdev);
 }
 
 #ifdef CONFIG_SCSI_LOGGING
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 2f3c5b8..dad55d2 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -322,6 +322,12 @@ static inline unsigned int sdev_id(struc
 #define scmd_id(scmd) sdev_id((scmd)-device)
 #define scmd_channel(scmd) sdev_channel((scmd)-device)
 
+static inline void scsi_destroy_device(struct scsi_device *sdev)
+{
+   scsi_device_set_state(sdev, SDEV_DEL);
+   put_device(sdev-sdev_gendev);
+}
+
 static inline int scsi_device_online(struct scsi_device *sdev)
 {
return sdev-sdev_state != SDEV_OFFLINE;
-- 
1.4.3.4

-
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/9] Remove stale put_device() from scsi_sysfs_add_sdev()

2007-05-23 Thread Hannes Reinecke

In one obscure error path someone decided to do a put_device()
on the sdev parent.
As this is the only reference to it I don't thing it makes much sense.
Remove it.

Signed-off-by: Hannes Reinecke [EMAIL PROTECTED]
---
 drivers/scsi/scsi_sysfs.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index 2df7108..c81c326 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -739,7 +739,6 @@ int scsi_sysfs_add_sdev(struct scsi_devi
 
error = device_add(sdev-sdev_gendev);
if (error) {
-   put_device(sdev-sdev_gendev.parent);
sdev_printk(KERN_INFO, sdev,
failed to add device (error %d)\n, error);
return error;
-- 
1.4.3.4

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


[PATCH 4/9] Free sdev class device from release function

2007-05-23 Thread Hannes Reinecke

For a clean teardown of a sdev the class device should
really be freed from the sdev's release function.
This way we don't have to worry about refcounting the
class device structures itself.
And the functions are now better aligned with the sdev
state model; _scsi_remove_device() transitions the sdev
from RUNNING to CANCEL, and scsi_destroy_device() from
CANCEL to DEL.

Signed-off-by: Hannes Reinecke [EMAIL PROTECTED]
---
 drivers/scsi/scsi_scan.c  |   13 ++---
 drivers/scsi/scsi_sysfs.c |   34 --
 2 files changed, 22 insertions(+), 25 deletions(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 4874bdd..e967705 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -298,8 +298,7 @@ static struct scsi_device *scsi_alloc_sd
return sdev;
 
 out_device_destroy:
-   transport_destroy_device(sdev-sdev_gendev);
-   put_device(sdev-sdev_gendev);
+   scsi_destroy_device(sdev);
 out:
if (display_failure_msg)
printk(ALLOC_FAILURE_MSG, __FUNCTION__);
@@ -1095,11 +1094,12 @@ static int scsi_probe_and_add_lun(struct
*sdevp = sdev;
} else {
__scsi_remove_device(sdev);
+   scsi_destroy_device(sdev);
res = SCSI_SCAN_NO_RESPONSE;
}
}
} else
-   scsi_destroy_sdev(sdev);
+   scsi_destroy_device(sdev);
  out:
return res;
 }
@@ -1453,7 +1453,7 @@ static int scsi_report_lun_scan(struct s
/*
 * the sdev we used didn't appear in the report luns scan
 */
-   scsi_destroy_sdev(sdev);
+   scsi_destroy_device(sdev);
return ret;
 }
 
@@ -1662,8 +1662,7 @@ static void scsi_sysfs_add_devices(struc
 {
struct scsi_device *sdev;
shost_for_each_device(sdev, shost) {
-   if (scsi_sysfs_add_sdev(sdev) != 0)
-   scsi_destroy_sdev(sdev);
+   scsi_sysfs_add_sdev(sdev);
}
 }
 
@@ -1877,7 +1876,7 @@ void scsi_free_host_dev(struct scsi_devi
 {
BUG_ON(sdev-id != sdev-host-this_id);
 
-   scsi_destroy_sdev(sdev);
+   scsi_destroy_device(sdev);
 }
 EXPORT_SYMBOL(scsi_free_host_dev);
 
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index c81c326..65b46e0 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -215,7 +215,6 @@ static void scsi_device_cls_release(stru
struct scsi_device *sdev;
 
sdev = class_to_sdev(class_dev);
-   put_device(sdev-sdev_gendev);
 }
 
 static void scsi_device_dev_release_usercontext(struct work_struct *work)
@@ -230,6 +229,11 @@ static void scsi_device_dev_release_user
parent = sdev-sdev_gendev.parent;
starget = to_scsi_target(parent);
 
+   if (sdev-host-hostt-slave_destroy)
+   sdev-host-hostt-slave_destroy(sdev);
+   transport_destroy_device(sdev-sdev_gendev);
+   class_device_put(sdev-sdev_classdev);
+
spin_lock_irqsave(sdev-host-host_lock, flags);
starget-reap_ref++;
list_del(sdev-siblings);
@@ -741,17 +745,20 @@ int scsi_sysfs_add_sdev(struct scsi_devi
if (error) {
sdev_printk(KERN_INFO, sdev,
failed to add device (error %d)\n, error);
+   scsi_device_set_state(sdev, SDEV_DEL);
return error;
}
error = class_device_add(sdev-sdev_classdev);
if (error) {
sdev_printk(KERN_INFO, sdev,
failed to add class device (error %d)\n, error);
-   goto clean_device;
+   scsi_device_set_state(sdev, SDEV_DEL);
+   device_del(sdev-sdev_gendev);
+   return error;
}
 
/* take a reference for the sdev_classdev; this is
-* released by the sdev_class .release */
+* released in scsi_remove_device() */
get_device(sdev-sdev_gendev);
if (sdev-host-hostt-sdev_attrs) {
for (i = 0; sdev-host-hostt-sdev_attrs[i]; i++) {
@@ -759,6 +766,7 @@ int scsi_sysfs_add_sdev(struct scsi_devi
sdev-host-hostt-sdev_attrs[i]);
if (error) {
__scsi_remove_device(sdev);
+   scsi_destroy_device(sdev);
goto out;
}
}
@@ -773,6 +781,7 @@ int scsi_sysfs_add_sdev(struct scsi_devi
error = device_create_file(sdev-sdev_gendev, attr);
if (error) {
__scsi_remove_device(sdev);
+   scsi_destroy_device(sdev);
goto out;
}
}
@@ 

[PATCH 5/9] Fixup LLDDs to check for valid hostdata pointer

2007-05-23 Thread Hannes Reinecke

slave_destory() is now called asynchronously, hence we have to
check if the -hostdata pointer is valid before accessing it.
Fixup all LLDDs to verify the hostdata pointer.

Signed-off-by: Hannes Reinecke [EMAIL PROTECTED]
---
 drivers/message/fusion/mptscsih.c   |2 ++
 drivers/s390/scsi/zfcp_scsi.c   |3 ---
 drivers/scsi/53c700.c   |6 --
 drivers/scsi/aic7xxx_old.c  |8 +---
 drivers/scsi/esp_scsi.c |6 --
 drivers/scsi/sym53c8xx_2/sym_glue.c |2 ++
 6 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/drivers/message/fusion/mptscsih.c 
b/drivers/message/fusion/mptscsih.c
index fa0f776..2907489 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -2314,6 +2314,8 @@ mptscsih_slave_destroy(struct scsi_devic
starget = scsi_target(sdev);
vtarget = starget-hostdata;
vdevice = sdev-hostdata;
+   if (!vdevice)
+   return;
 
mptscsih_search_running_cmds(hd, vdevice);
vtarget-num_luns--;
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 16e2d64..bae2093 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -189,9 +189,6 @@ static void zfcp_scsi_slave_destroy(stru
unit-device = NULL;
zfcp_erp_unit_failed(unit);
zfcp_unit_put(unit);
-   } else {
-   ZFCP_LOG_NORMAL(bug: no unit associated with SCSI device at 
-   address %p\n, sdpnt);
}
 }
 
diff --git a/drivers/scsi/53c700.c b/drivers/scsi/53c700.c
index cb02656..50a5d92 100644
--- a/drivers/scsi/53c700.c
+++ b/drivers/scsi/53c700.c
@@ -2103,8 +2103,10 @@ NCR_700_slave_configure(struct scsi_devi
 STATIC void
 NCR_700_slave_destroy(struct scsi_device *SDp)
 {
-   kfree(SDp-hostdata);
-   SDp-hostdata = NULL;
+   if (SDp-hostdata) {
+   kfree(SDp-hostdata);
+   SDp-hostdata = NULL;
+   }
 }
 
 static int
diff --git a/drivers/scsi/aic7xxx_old.c b/drivers/scsi/aic7xxx_old.c
index a988d5a..fcc0dfa 100644
--- a/drivers/scsi/aic7xxx_old.c
+++ b/drivers/scsi/aic7xxx_old.c
@@ -6733,9 +6733,11 @@ aic7xxx_slave_destroy(struct scsi_device
 {
   struct aic_dev_data *aic_dev = SDptr-hostdata;
 
-  list_del(aic_dev-list);
-  SDptr-hostdata = NULL;
-  kfree(aic_dev);
+  if (aic_dev) {
+list_del(aic_dev-list);
+SDptr-hostdata = NULL;
+kfree(aic_dev);
+  }
   return;
 }
 
diff --git a/drivers/scsi/esp_scsi.c b/drivers/scsi/esp_scsi.c
index ec71061..b32595f 100644
--- a/drivers/scsi/esp_scsi.c
+++ b/drivers/scsi/esp_scsi.c
@@ -2416,8 +2416,10 @@ static void esp_slave_destroy(struct scs
 {
struct esp_lun_data *lp = dev-hostdata;
 
-   kfree(lp);
-   dev-hostdata = NULL;
+   if (dev-hostdata) {
+   kfree(lp);
+   dev-hostdata = NULL;
+   }
 }
 
 static int esp_eh_abort_handler(struct scsi_cmnd *cmd)
diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c 
b/drivers/scsi/sym53c8xx_2/sym_glue.c
index 4d78c7e..bba2df1 100644
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c
+++ b/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -983,6 +983,8 @@ static void sym53c8xx_slave_destroy(stru
struct sym_hcb *np = sym_get_hcb(sdev-host);
struct sym_lcb *lp = sym_lp(np-target[sdev-id], sdev-lun);
 
+   if (!lp)
+   return;
if (lp-itlq_tbl)
sym_mfree_dma(lp-itlq_tbl, SYM_CONF_MAX_TASK * 4, ITLQ_TBL);
kfree(lp-cb_tags);
-- 
1.4.3.4

-
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 6/9] Implement scsi_configure_device()

2007-05-23 Thread Hannes Reinecke

This patch implements the function scsi_configure_device(). This function
elevates an sdev into SDEV_RUNNING and configures it properly so that
I/O is possible on the device.

Signed-off-by: Hannes Reinecke [EMAIL PROTECTED]
---
 drivers/scsi/scsi_scan.c |   62 -
 1 files changed, 44 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index e967705..82fad00 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -692,6 +692,37 @@ static int scsi_probe_lun(struct scsi_de
 }
 
 /**
+ * scsi_configure_device - configure a scsi_device
+ * @sdev:  The scsi_device to configure
+ *
+ * Description:
+ *Configure an existing scsi_device. This function
+ *elevates a scsi_device from state SDEV_CREATED or
+ *SDEV_DEL into SDEV_RUNNING.
+ *
+ * Return:
+ *0  On Success
+ *0 On failure.
+ *
+ **/
+int scsi_configure_device(struct scsi_device *sdev)
+{
+   int ret = 0;
+
+   /* set the device running here so that slave configure
+* may do I/O */
+   if (scsi_device_set_state(sdev, SDEV_RUNNING) != 0)
+   return -ENXIO;
+
+   transport_configure_device(sdev-sdev_gendev);
+
+   if (sdev-host-hostt-slave_configure)
+   ret = sdev-host-hostt-slave_configure(sdev);
+
+   return ret;
+}
+
+/**
  * scsi_add_lun - allocate and fully initialze a scsi_device
  * @sdevscan:  holds information to be stored in the new scsi_device
  * @sdevnew:   store the address of the newly allocated scsi_device
@@ -711,6 +742,8 @@ static int scsi_probe_lun(struct scsi_de
 static int scsi_add_lun(struct scsi_device *sdev, unsigned char *inq_result,
int *bflags, int async)
 {
+   int ret;
+
/*
 * XXX do not save the inquiry, since it can change underneath us,
 * save just vendor/model/rev.
@@ -874,10 +907,6 @@ static int scsi_add_lun(struct scsi_devi
if (*bflags  BLIST_USE_10_BYTE_MS)
sdev-use_10_for_ms = 1;
 
-   /* set the device running here so that slave configure
-* may do I/O */
-   scsi_device_set_state(sdev, SDEV_RUNNING);
-
if (*bflags  BLIST_MS_192_BYTES_FOR_3F)
sdev-use_192_bytes_for_3f = 1;
 
@@ -887,21 +916,18 @@ static int scsi_add_lun(struct scsi_devi
if (*bflags  BLIST_RETRY_HWERROR)
sdev-retry_hwerror = 1;
 
-   transport_configure_device(sdev-sdev_gendev);
-
-   if (sdev-host-hostt-slave_configure) {
-   int ret = sdev-host-hostt-slave_configure(sdev);
-   if (ret) {
-   /*
-* if LLDD reports slave not present, don't clutter
-* console with alloc failure messages
-*/
-   if (ret != -ENXIO) {
-   sdev_printk(KERN_ERR, sdev,
-   failed to configure device\n);
-   }
-   return SCSI_SCAN_NO_RESPONSE;
+   ret = scsi_configure_device(sdev);
+   if (ret) {
+   /*
+* if LLDD reports slave not present, don't clutter
+* console with alloc failure messages
+*/
+   if (ret != -ENXIO) {
+   sdev_printk(KERN_ERR, sdev,
+   failed to configure device\n);
}
+   scsi_destroy_device(sdev);
+   return SCSI_SCAN_NO_RESPONSE;
}
 
/*
-- 
1.4.3.4

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


[PATCH 7/9] Remove obsolete scsi_destroy_sdev() function

2007-05-23 Thread Hannes Reinecke

scsi_destroy_sdev() is now obsolete. Delete it.

Signed-off-by: Hannes Reinecke [EMAIL PROTECTED]
---
 drivers/scsi/scsi_scan.c |8 
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 82fad00..2653015 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -941,14 +941,6 @@ static int scsi_add_lun(struct scsi_devi
return SCSI_SCAN_LUN_PRESENT;
 }
 
-static inline void scsi_destroy_sdev(struct scsi_device *sdev)
-{
-   scsi_device_set_state(sdev, SDEV_DEL);
-   if (sdev-host-hostt-slave_destroy)
-   sdev-host-hostt-slave_destroy(sdev);
-   scsi_destroy_device(sdev);
-}
-
 #ifdef CONFIG_SCSI_LOGGING
 /** 
  * scsi_inq_str - print INQUIRY data from min to max index,
-- 
1.4.3.4

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


[PATCH 8/9] Implement scsi_resurrect_device()

2007-05-23 Thread Hannes Reinecke

This is the main part. This patch implements a function
scsi_resurrect_device() which puts a sdev in state SDEV_CANCEL
back into SDEV_RUNNING.
So during scan any device in state SDEV_DEL (ie waiting to be
deleted) will be put back into SDEV_RUNNING and normal scanning
can continue on these devices. Of course there is a high likelyhood
that the device will drop back into SDEV_DEL afterwards, but it is
perfectly useable during the scan operation.
For this to work I actually had to modify the allowed state
transitions, as it's now perfectly possible to move back from
SDEV_DEL into SDEV_CANCEL.

Signed-off-by: Hannes Reinecke [EMAIL PROTECTED]
---
 drivers/scsi/scsi.c  |3 ++
 drivers/scsi/scsi_lib.c  |2 +
 drivers/scsi/scsi_scan.c |   52 +-
 3 files changed, 56 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 4c1e313..11f0f0d 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -950,6 +950,9 @@ struct scsi_device *scsi_device_lookup_b
 
spin_lock_irqsave(shost-host_lock, flags);
sdev = __scsi_device_lookup_by_target(starget, lun);
+   /* This triggers a resurrection of the sdev */
+   if (sdev  sdev-sdev_state == SDEV_DEL)
+   scsi_device_set_state(sdev, SDEV_CANCEL);
if (sdev  scsi_device_get(sdev))
sdev = NULL;
spin_unlock_irqrestore(shost-host_lock, flags);
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 1f5a07b..4288572 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1945,6 +1945,7 @@ scsi_device_set_state(struct scsi_device
case SDEV_OFFLINE:
case SDEV_QUIESCE:
case SDEV_BLOCK:
+   case SDEV_CANCEL:
break;
default:
goto illegal;
@@ -1990,6 +1991,7 @@ scsi_device_set_state(struct scsi_device
case SDEV_QUIESCE:
case SDEV_OFFLINE:
case SDEV_BLOCK:
+   case SDEV_DEL:
break;
default:
goto illegal;
diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
index 2653015..75b8a78 100644
--- a/drivers/scsi/scsi_scan.c
+++ b/drivers/scsi/scsi_scan.c
@@ -698,7 +698,7 @@ static int scsi_probe_lun(struct scsi_de
  * Description:
  *Configure an existing scsi_device. This function
  *elevates a scsi_device from state SDEV_CREATED or
- *SDEV_DEL into SDEV_RUNNING.
+ *SDEV_CANCEL into SDEV_RUNNING.
  *
  * Return:
  *0  On Success
@@ -723,6 +723,49 @@ int scsi_configure_device(struct scsi_de
 }
 
 /**
+ * scsi_resurrect_device - resurrect a deleted scsi_device
+ * @sdev:  The scsi_device to resurrect
+ *
+ * Description:
+ *Elevate a deleted scsi_device back to SDEV_RUNNING.
+ *A deleted scsi_device (ie in state SDEV_DEL) is only
+ *deleted from the internal list when the -release
+ *function of the corresponding kobj structure is called.
+ *Until that time it will stay visible to the host.
+ *Whenever a scan has been initiated we thus have to
+ *put this device back to SDEV_RUNNING and proceed
+ *as with normal sdevs. It might be dropping back to
+ *SDEV_DEL after scanning is completed, but is perfectly
+ *useable during that time.
+ *
+ * Return:
+ *0  On Success
+ *0 On failure.
+ *
+ **/
+int scsi_resurrect_device(struct scsi_device *sdev)
+{
+   int ret = 0;
+
+   /* Ignore devices not in state SDEV_CANCEL */
+   if (sdev-sdev_state != SDEV_CANCEL)
+   return 0;
+
+   ret = scsi_configure_device(sdev);
+   if (ret) {
+   scsi_destroy_device(sdev);
+   return ret;
+   }
+
+   /*
+* Ok, the device is now all set up, we can
+* register it and tell the rest of the kernel
+* about it.
+*/
+   return scsi_sysfs_add_sdev(sdev);
+}
+
+/**
  * scsi_add_lun - allocate and fully initialze a scsi_device
  * @sdevscan:  holds information to be stored in the new scsi_device
  * @sdevnew:   store the address of the newly allocated scsi_device
@@ -1002,6 +1045,10 @@ static int scsi_probe_and_add_lun(struct
 */
sdev = scsi_device_lookup_by_target(starget, lun);
if (sdev) {
+   if (scsi_resurrect_device(sdev)) {
+   scsi_device_put(sdev);
+   return SCSI_SCAN_NO_RESPONSE;
+   }
if (rescan || sdev-sdev_state != SDEV_CREATED) {
SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO
scsi scan: device exists on %s\n,
@@ -1319,6 +1366,9 @@ static int scsi_report_lun_scan(struct s
return 0;
if (scsi_device_get(sdev))
return 0;
+   } else if (scsi_resurrect_device(sdev)) {
+   

Re: [Stgt-devel] Question about the basic concept of SCSI layer and Block layer

2007-05-23 Thread Ming Zhang
On Wed, 2007-05-23 at 21:55 +0800, jidong xiao wrote:
 Hi,All,
   I have a question, what's the relationship between SCSI layer and
 Block layer?I remember initially there are three types of device
 drivers, say, char device driver, block device driver, network device
 driver, so there is a directory drivers/block,but recent years,most
 part of the code for block devices have been moved out of the
 directory drivers/block, but there is still a block I/O layer, so I am
 wondering what's the relationship between Block layer and other
 subsystem, like how to connect block layer and filesystem(VFS or the
 actually file system), how to bridge it with scsi layer, for example,
 the scsi disk driver, sd.o. Who can please kindly explain this for me,
 thank you very much!


u had better send these questions to kernel newbie or scsi list. the
other 2 you included are not related at all.

 
 Best Regards
 Jason
 ___
 Stgt-devel mailing list
 [EMAIL PROTECTED]
 https://lists.berlios.de/mailman/listinfo/stgt-devel

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


Re: [PATCH] [scsi] Remove __GFP_DMA

2007-05-23 Thread James Bottomley
On Wed, 2007-05-23 at 10:41 +0800, Aubrey Li wrote:
 On 5/23/07, Christoph Lameter [EMAIL PROTECTED] wrote:
  On Mon, 21 May 2007, Bernhard Walle wrote:
 
   [PATCH] [scsi] Remove __GFP_DMA
  
   After 821de3a27bf33f11ec878562577c586cd5f83c64, it's not necessary to 
   alloate a
   DMA buffer any more in sd.c.
  
   Signed-off-by: Bernhard Walle [EMAIL PROTECTED]
 
  Great that avoids a DMA kmalloc slab. Any other GFP_DMAs left in the scsi
  layer?
 
  Acked-by: Christoph Lameter [EMAIL PROTECTED]
 
 Yes, here is another patch

I'll defer to Mark on this one.  However, please remember that you can't
just blindly remove GFP_DMA ... there are some cards which require it.

Aacraid is one example ... it has a set of cards that can only DMA to 31
bits.  For them, the GFP_DMA is necessary:  The allocation in question
is a scatterlist, which must be within the device DMA mask.

James


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


Re: [patch 14/28] scsi: fix CONFIG_SCSI_WAIT_SCAN=m

2007-05-23 Thread Hugh Dickins
Regression still outstanding: ping?

On Fri, 18 May 2007, Hugh Dickins wrote:
 On Fri, 11 May 2007, Hugh Dickins wrote:
  On Thu, 10 May 2007, [EMAIL PROTECTED] wrote:
   From: Hugh Dickins [EMAIL PROTECTED]
   
   CONFIG_MODULES=y
   CONFIG_SCSI=y
   CONFIG_SCSI_SCAN_ASYNC=y
   CONFIG_SCSI_WAIT_SCAN=m
   
   2.6.21-rc5-mm2 VFS panics unable to find my root on /dev/sda2, but boots
   okay if I change drivers/scsi/Kconfig to default y instead of default 
   m
   for SCSI_WAIT_SCAN.
   
   Make sure there's a late_initcall to scsi_complete_async_scans when it's
   built in, so a monolithic SCSI_SCAN_ASYNC kernel can rely on the scans
   being completed before trying to mount root, even if they're slow.
  
  Thanks for sending this through to James again, Andrew.
  I'd been gearing up to report it to the regression police:
  it's certainly still a problem in 2.6.21-git.
 
 And still a problem in 2.6.22-rc1-git7.
 
 Any further news on this regression since 2.6.21?  I was hoping that
 a fix for 2.6.22-rc2 would emerge in the course of the Asynchronous
 scsi scanning thread, but that doesn't appear to be heading in any
 useful direction.
 
 It wouldn't be a problem for me to undo my CONFIG_SCSI_SCAN_ASYNC=y,
 but it would still be a little regressive.
 
 I thought a late_initcall was guaranteed to be called after
 all the potential-root scsi scans had been started; but admit I'm
 ignorant of both initcall sequencing and scsi probing.  Would a
 late_initcall_sync or a rootfs_initcall be more to the point?
 
 But ignore my gropings, I'd rather be testing what you believe
 to be the right fix.
 
 Thanks,
 Hugh
 
  
   
   [EMAIL PROTECTED]: build fixes]
   Signed-off-by: Hugh Dickins [EMAIL PROTECTED]
   Cc: James Bottomley [EMAIL PROTECTED]
   ---
   James sayeth This isn't the right fix ...  this has to be invoked last 
   in the
   call sequence ...  I can't see another way of doing this except yet 
   another
   file added as a final component to the link.
  
  I didn't reply to James' mail at the time, hoping the right fix was
  about to follow.  I don't see what's wrong with the late_initcall myself.
  
  Hugh
  
   Signed-off-by: Andrew Morton [EMAIL PROTECTED]
   ---
   
drivers/scsi/scsi_scan.c |9 +
1 file changed, 9 insertions(+)
   
   diff -puN drivers/scsi/scsi_scan.c~scsi-fix-config_scsi_wait_scan=m 
   drivers/scsi/scsi_scan.c
   --- a/drivers/scsi/scsi_scan.c~scsi-fix-config_scsi_wait_scan=m
   +++ a/drivers/scsi/scsi_scan.c
   @@ -184,6 +184,15 @@ int scsi_complete_async_scans(void)
/* Only exported for the benefit of scsi_wait_scan */
EXPORT_SYMBOL_GPL(scsi_complete_async_scans);

   +#ifndef MODULE
   +/*
   + * For async scanning we need to wait for all the scans to complete 
   before
   + * trying to mount the root fs.  Otherwise non-modular drivers may not 
   be ready
   + * yet.
   + */
   +late_initcall(scsi_complete_async_scans);
   +#endif
   +
/**
 * scsi_unlock_floptical - unlock device via a special MODE SENSE command
 * @sdev:scsi device to send command to
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [scsi] Remove __GFP_DMA

2007-05-23 Thread James Bottomley
On Wed, 2007-05-23 at 11:55 -0400, Robert P. J. Day wrote:
 On Wed, 23 May 2007, James Bottomley wrote:
 
  I'll defer to Mark on this one.  However, please remember that you
  can't just blindly remove GFP_DMA ... there are some cards which
  require it.
 
  Aacraid is one example ... it has a set of cards that can only DMA
  to 31 bits.  For them, the GFP_DMA is necessary:  The allocation in
  question is a scatterlist, which must be within the device DMA mask.
 
 a question i asked a while back, and still haven't seen an answer for
 -- given this in include/linux/gfp.h:
 
   #define GFP_DMA __GFP_DMA
 
 is there a qualitative difference between these two macros?  is there
 *supposed* to be?  if there isn't, one would think that just one
 variation would be sufficient.

__GFP_ are the raw GFP flags ... the GFP_ are combinations of the flags
with predefined meanings.  There's no convention that you have to use
one form or the other when making combinations of the allocation flags.
Historically that's lead to things like

GFP_ATOMIC | __GFP_DMA (indicating additional DMA zone to the usual
atomic flags)

and

GFP_ATOMIC | GFP_DMA (indicating same thing, but with the defined flags)

You can argue that GFP_DMA has a pretty bogus GFP meaning and should
never appear on its own, which, to my mind makes the former usage
preferable.  However, GFP_DMA has been in linux since pretty much the
dawn of ISA drivers, so I think it's conventionally well understood.

James


James


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


Re: [patch 5/7] genhd: send async notification on media change

2007-05-23 Thread Kristen Carlson Accardi
On Tue, 22 May 2007 14:12:11 -0700
Andrew Morton [EMAIL PROTECTED] wrote:

 On Wed, 9 May 2007 16:38:35 -0700
 Kristen Carlson Accardi [EMAIL PROTECTED] wrote:
 
  Send an uevent to user space to indicate that a media change event has 
  occurred.
  
  Signed-off-by: Kristen Carlson Accardi [EMAIL PROTECTED]
  
  Index: 2.6-git/block/genhd.c
  ===
  --- 2.6-git.orig/block/genhd.c
  +++ 2.6-git/block/genhd.c
  @@ -643,6 +643,27 @@ struct seq_operations diskstats_op = {
  .show   = diskstats_show
   };
   
  +static void media_change_notify_thread(struct work_struct *work)
  +{
  +   struct gendisk *gd = container_of(work, struct gendisk, async_notify);
  +   char event[] = MEDIA_CHANGE=1;
  +   char *envp[] = { event, NULL };
  +
  +   /*
  +* set enviroment vars to indicate which event this is for
  +* so that user space will know to go check the media status.
  +*/
  +   kobject_uevent_env(gd-kobj, KOBJ_CHANGE, envp);
  +   put_device(gd-driverfs_dev);
  +}
  +
  +void genhd_media_change_notify(struct gendisk *disk)
  +{
  +   get_device(disk-driverfs_dev);
  +   schedule_work(disk-async_notify);
  +}
  +EXPORT_SYMBOL_GPL(genhd_media_change_notify);
  +
   struct gendisk *alloc_disk(int minors)
   {
  return alloc_disk_node(minors, -1);
  @@ -672,6 +693,8 @@ struct gendisk *alloc_disk_node(int mino
  kobj_set_kset_s(disk,block_subsys);
  kobject_init(disk-kobj);
  rand_initialize_disk(disk);
  +   INIT_WORK(disk-async_notify,
  +   media_change_notify_thread);
  }
  return disk;
 
 Why does this do a schedule_work() rather than calling kobject_uevent_env()
 directly?
 

Because it is called at Interrupt time.

Kristen
-
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] Un-remove aacraid devices

2007-05-23 Thread Salyzyn, Mark
NAK

This will break all our management applications, and will not allow us to 
manipulate the array configurations from within Linux. This will also break 
online expansion of capacity.

This flag has been set from the beginning to allow partition tables, capacity 
and device locking to be changed without requiring an intervening reboot or 
needing the device to be taken offline. Fixed disk result in these pieces of 
information being cached.

Sincerely -- Mark Salyzyn

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hannes Reinecke
Sent: Wednesday, May 23, 2007 8:51 AM
To: Salyzyn, Mark
Cc: SCSI Mailing List
Subject: [PATCH] Un-remove aacraid devices

Hi Mark,

for some weird reason the aacraid driver insists on presenting all disks
as 'removable' devices. This is gross hackery and causes userspace tools
to not identify these devices as fixed disks, which most evidently they are.

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


RE: [PATCH] Un-remove aacraid devices

2007-05-23 Thread James Bottomley
On Wed, 2007-05-23 at 12:35 -0400, Salyzyn, Mark wrote:
 NAK
 
 This will break all our management applications, and will not allow us to 
 manipulate the array configurations from within Linux. This will also break 
 online expansion of capacity.
 
 This flag has been set from the beginning to allow partition tables, capacity 
 and device locking to be changed without requiring an intervening reboot or 
 needing the device to be taken offline. Fixed disk result in these pieces of 
 information being cached.

I thought this problem had been solved since at least 2000 (when
LifeKeeper ran into the same issue) by sending the BLKRRPART ioctl to
the device ... whether removable or not, this forces a reread of all the
vital information (always providing nothing has the nodes open, of
course, we can't physically yank the information out of applications
using it).

If there's something BLKRRPART isn't doing we can probably fix it ...
that's certainly better than lying to the kernel about the devices.

James


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


Re: [PATCH] Un-remove aacraid devices

2007-05-23 Thread Michael Tokarev
Salyzyn, Mark wrote:
 NAK
 
 This will break all our management applications, and will not allow us to 
 manipulate the array configurations from within Linux. This will also break 
 online expansion of capacity.
 
 This flag has been set from the beginning to allow partition tables, capacity 
 and device locking to be changed without requiring an intervening reboot or 
 needing the device to be taken offline. Fixed disk result in these pieces of 
 information being cached.

I think I've seen this very discussion before.

It looks like kernel needs to distinguish things like removable
media (truely removable - CDRoms etc) and some dynamic things
like in this case (like with any raid array really), with iSCSI
devices and so on.

Currently, 'removable' is handy at detecting devices which should
be handed to 'cdrom' or 'floppy' group (i think it was the cause
of previous incarnation of this discussion).

Right now, both ways are causing problems here or there.  Removable
is bad because it confuses regular linux tools, while !removable
breaks configurability of arrays.

/mjt
-
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] Un-remove aacraid devices

2007-05-23 Thread Salyzyn, Mark
The applications may issue the start of an expansion, but then
disappear. The Firmware is responsible for completing the job with the
help of the driver. We issue a scsi_rescan_device when the job is
completed, removable bit set turns off the capacity  partition table
caching.

We would need a similar exported kernel interface for the aacraid driver
to call after we receive the scan requests via the event (AIF) stream
from the Firmware. I can not propose adding a flag to
scsi_rescan_device, as that would change an interface, so a new call
scsi_rescan_device_blkrrpart?

We have external RAID enclosures that report they are removable devices
so that they may also transition through expansion. It is merely half a
lie; it does indicate that the media can change ;-}

-- Mark

-Original Message-
From: James Bottomley [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 23, 2007 1:07 PM
To: Salyzyn, Mark
Cc: Hannes Reinecke; SCSI Mailing List
Subject: RE: [PATCH] Un-remove aacraid devices

On Wed, 2007-05-23 at 12:35 -0400, Salyzyn, Mark wrote:
 NAK
 
 This will break all our management applications, and will not allow us
to manipulate the array configurations from within Linux. This will also
break online expansion of capacity.
 
 This flag has been set from the beginning to allow partition tables,
capacity and device locking to be changed without requiring an
intervening reboot or needing the device to be taken offline. Fixed disk
result in these pieces of information being cached.

I thought this problem had been solved since at least 2000 (when
LifeKeeper ran into the same issue) by sending the BLKRRPART ioctl to
the device ... whether removable or not, this forces a reread of all the
vital information (always providing nothing has the nodes open, of
course, we can't physically yank the information out of applications
using it).

If there's something BLKRRPART isn't doing we can probably fix it ...
that's certainly better than lying to the kernel about the devices.

James


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


RE: [PATCH] Un-remove aacraid devices

2007-05-23 Thread Salyzyn, Mark
Another note, the old old aacraid driver used to report removable device
in the inquiry. We found we could mitigate the devices report somewhat
by reporting a fixed dfisk inquiry, but turning on the removable bit for
the scsi device after the scan but before attachment by setting this in
the read capacity call. This hack showed the applications that we were a
fixed disk, but the OS responded as if we were a removable.

Hannes, which user space tools are having troubles with the removable
device designation?

-- Mark

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Salyzyn, Mark
Sent: Wednesday, May 23, 2007 1:17 PM
To: James Bottomley
Cc: Hannes Reinecke; SCSI Mailing List
Subject: RE: [PATCH] Un-remove aacraid devices

The applications may issue the start of an expansion, but then
disappear. The Firmware is responsible for completing the job with the
help of the driver. We issue a scsi_rescan_device when the job is
completed, removable bit set turns off the capacity  partition table
caching.

We would need a similar exported kernel interface for the aacraid driver
to call after we receive the scan requests via the event (AIF) stream
from the Firmware. I can not propose adding a flag to
scsi_rescan_device, as that would change an interface, so a new call
scsi_rescan_device_blkrrpart?

We have external RAID enclosures that report they are removable devices
so that they may also transition through expansion. It is merely half a
lie; it does indicate that the media can change ;-}

-- Mark

-Original Message-
From: James Bottomley [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 23, 2007 1:07 PM
To: Salyzyn, Mark
Cc: Hannes Reinecke; SCSI Mailing List
Subject: RE: [PATCH] Un-remove aacraid devices

On Wed, 2007-05-23 at 12:35 -0400, Salyzyn, Mark wrote:
 NAK
 
 This will break all our management applications, and will not allow us
to manipulate the array configurations from within Linux. This will also
break online expansion of capacity.
 
 This flag has been set from the beginning to allow partition tables,
capacity and device locking to be changed without requiring an
intervening reboot or needing the device to be taken offline. Fixed disk
result in these pieces of information being cached.

I thought this problem had been solved since at least 2000 (when
LifeKeeper ran into the same issue) by sending the BLKRRPART ioctl to
the device ... whether removable or not, this forces a reread of all the
vital information (always providing nothing has the nodes open, of
course, we can't physically yank the information out of applications
using it).

If there's something BLKRRPART isn't doing we can probably fix it ...
that's certainly better than lying to the kernel about the devices.

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
-
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 5/7] genhd: send async notification on media change

2007-05-23 Thread Kristen Carlson Accardi
On Wed, 23 May 2007 12:03:55 -0500
James Bottomley [EMAIL PROTECTED] wrote:

 On Wed, 2007-05-23 at 09:31 -0700, Kristen Carlson Accardi wrote:
  On Tue, 22 May 2007 14:12:11 -0700
  Andrew Morton [EMAIL PROTECTED] wrote:
  
   On Wed, 9 May 2007 16:38:35 -0700
   Kristen Carlson Accardi [EMAIL PROTECTED] wrote:
   
Send an uevent to user space to indicate that a media change event has 
occurred.

Signed-off-by: Kristen Carlson Accardi [EMAIL PROTECTED]

Index: 2.6-git/block/genhd.c
===
--- 2.6-git.orig/block/genhd.c
+++ 2.6-git/block/genhd.c
@@ -643,6 +643,27 @@ struct seq_operations diskstats_op = {
.show   = diskstats_show
 };
 
+static void media_change_notify_thread(struct work_struct *work)
+{
+   struct gendisk *gd = container_of(work, struct gendisk, 
async_notify);
+   char event[] = MEDIA_CHANGE=1;
+   char *envp[] = { event, NULL };
+
+   /*
+* set enviroment vars to indicate which event this is for
+* so that user space will know to go check the media status.
+*/
+   kobject_uevent_env(gd-kobj, KOBJ_CHANGE, envp);
+   put_device(gd-driverfs_dev);
+}
+
+void genhd_media_change_notify(struct gendisk *disk)
+{
+   get_device(disk-driverfs_dev);
+   schedule_work(disk-async_notify);
+}
+EXPORT_SYMBOL_GPL(genhd_media_change_notify);
+
 struct gendisk *alloc_disk(int minors)
 {
return alloc_disk_node(minors, -1);
@@ -672,6 +693,8 @@ struct gendisk *alloc_disk_node(int mino
kobj_set_kset_s(disk,block_subsys);
kobject_init(disk-kobj);
rand_initialize_disk(disk);
+   INIT_WORK(disk-async_notify,
+   media_change_notify_thread);
}
return disk;
   
   Why does this do a schedule_work() rather than calling 
   kobject_uevent_env()
   directly?
   
  
  Because it is called at Interrupt time.
 
 It better not be ... there's two GFP_KERNEL allocations just above this
 line in the file.
 
 James
 

Where?  We are talking about the call to genhd_media_change_notify().
the calling path is this:
ahci_host_intr()-ata_scsi_media_change_notify()-genhd_media_change_notify().

I don't see the allocations - are they hidden somewhere?

thanks,
Kristen
 
-
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 5/7] genhd: send async notification on media change

2007-05-23 Thread James Bottomley
On Wed, 2007-05-23 at 11:26 -0700, Kristen Carlson Accardi wrote:
 On Wed, 23 May 2007 12:03:55 -0500
 James Bottomley [EMAIL PROTECTED] wrote:
 
  On Wed, 2007-05-23 at 09:31 -0700, Kristen Carlson Accardi wrote:
   On Tue, 22 May 2007 14:12:11 -0700
   Andrew Morton [EMAIL PROTECTED] wrote:
   
On Wed, 9 May 2007 16:38:35 -0700
Kristen Carlson Accardi [EMAIL PROTECTED] wrote:

 Send an uevent to user space to indicate that a media change event 
 has occurred.
 
 Signed-off-by: Kristen Carlson Accardi [EMAIL PROTECTED]
 
 Index: 2.6-git/block/genhd.c
 ===
 --- 2.6-git.orig/block/genhd.c
 +++ 2.6-git/block/genhd.c
 @@ -643,6 +643,27 @@ struct seq_operations diskstats_op = {
   .show   = diskstats_show
  };
  
 +static void media_change_notify_thread(struct work_struct *work)
 +{
 + struct gendisk *gd = container_of(work, struct gendisk, 
 async_notify);
 + char event[] = MEDIA_CHANGE=1;
 + char *envp[] = { event, NULL };
 +
 + /*
 +  * set enviroment vars to indicate which event this is for
 +  * so that user space will know to go check the media status.
 +  */
 + kobject_uevent_env(gd-kobj, KOBJ_CHANGE, envp);
 + put_device(gd-driverfs_dev);
 +}
 +
 +void genhd_media_change_notify(struct gendisk *disk)
 +{
 + get_device(disk-driverfs_dev);
 + schedule_work(disk-async_notify);
 +}
 +EXPORT_SYMBOL_GPL(genhd_media_change_notify);
 +
  struct gendisk *alloc_disk(int minors)
  {
   return alloc_disk_node(minors, -1);
 @@ -672,6 +693,8 @@ struct gendisk *alloc_disk_node(int mino
   kobj_set_kset_s(disk,block_subsys);
   kobject_init(disk-kobj);
   rand_initialize_disk(disk);
 + INIT_WORK(disk-async_notify,
 + media_change_notify_thread);
   }
   return disk;

Why does this do a schedule_work() rather than calling 
kobject_uevent_env()
directly?

   
   Because it is called at Interrupt time.
  
  It better not be ... there's two GFP_KERNEL allocations just above this
  line in the file.
  
  James
  
 
 Where?  We are talking about the call to genhd_media_change_notify().
 the calling path is this:
 ahci_host_intr()-ata_scsi_media_change_notify()-genhd_media_change_notify().
 
 I don't see the allocations - are they hidden somewhere?

Sorry, I thought you were saying alloc_disk_node() could be called from
interrupt context.

gets back on ball

If you just want to invoke guaranteed user context from a place in the
code which *may* be called from interrupt, then
execute_in_process_context() might be a better way of doing it ... at
least it avoids setting up a workqueue where none is needed.

James


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


RE: [PATCH] [scsi] Remove __GFP_DMA

2007-05-23 Thread Salyzyn, Mark
The 31 bit limit for some of these cards is a problem, we currently only
do __GFP_DMA for bounce buffer sg elements allocated for user supplied
references in ioctls.

I figure we should be using pci_alloc_consistent calls for these
allocations to more accurately acquire memory within the 31 bit limit if
necessary, we could switch to these to remove the need for the __GFP_DMA
flag in the aacraid driver?

-- Mark

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of James Bottomley
Sent: Wednesday, May 23, 2007 11:18 AM
To: Aubrey Li
Cc: Christoph Lameter; Bernhard Walle; linux-scsi@vger.kernel.org;
Andrew Morton; [EMAIL PROTECTED]
Subject: Re: [PATCH] [scsi] Remove __GFP_DMA

On Wed, 2007-05-23 at 10:41 +0800, Aubrey Li wrote:
 On 5/23/07, Christoph Lameter [EMAIL PROTECTED] wrote:
  On Mon, 21 May 2007, Bernhard Walle wrote:
 
   [PATCH] [scsi] Remove __GFP_DMA
  
   After 821de3a27bf33f11ec878562577c586cd5f83c64, it's not necessary
to alloate a
   DMA buffer any more in sd.c.
  
   Signed-off-by: Bernhard Walle [EMAIL PROTECTED]
 
  Great that avoids a DMA kmalloc slab. Any other GFP_DMAs left in the
scsi
  layer?
 
  Acked-by: Christoph Lameter [EMAIL PROTECTED]
 
 Yes, here is another patch

I'll defer to Mark on this one.  However, please remember that you can't
just blindly remove GFP_DMA ... there are some cards which require it.

Aacraid is one example ... it has a set of cards that can only DMA to 31
bits.  For them, the GFP_DMA is necessary:  The allocation in question
is a scatterlist, which must be within the device DMA mask.

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


Re: [PATCH] [scsi] Remove __GFP_DMA

2007-05-23 Thread Alan Cox
On Wed, 23 May 2007 15:17:08 -0400
Salyzyn, Mark [EMAIL PROTECTED] wrote:

 The 31 bit limit for some of these cards is a problem, we currently only
 do __GFP_DMA for bounce buffer sg elements allocated for user supplied
 references in ioctls.
 
 I figure we should be using pci_alloc_consistent calls for these
 allocations to more accurately acquire memory within the 31 bit limit if
 necessary, we could switch to these to remove the need for the __GFP_DMA
 flag in the aacraid driver?

That didn't used to work right on the AMD boards when I tried it last as
we ended up with a buffer that was mapped by the IOMMU for some reason
and that was not below 2GB.

-
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 5/7] genhd: send async notification on media change

2007-05-23 Thread Kristen Carlson Accardi
On Wed, 23 May 2007 13:51:51 -0500
James Bottomley [EMAIL PROTECTED] wrote:

 On Wed, 2007-05-23 at 11:26 -0700, Kristen Carlson Accardi wrote:
  On Wed, 23 May 2007 12:03:55 -0500
  James Bottomley [EMAIL PROTECTED] wrote:
  
   On Wed, 2007-05-23 at 09:31 -0700, Kristen Carlson Accardi wrote:
On Tue, 22 May 2007 14:12:11 -0700
Andrew Morton [EMAIL PROTECTED] wrote:

 On Wed, 9 May 2007 16:38:35 -0700
 Kristen Carlson Accardi [EMAIL PROTECTED] wrote:
 
  Send an uevent to user space to indicate that a media change event 
  has occurred.
  
  Signed-off-by: Kristen Carlson Accardi [EMAIL PROTECTED]
  
  Index: 2.6-git/block/genhd.c
  ===
  --- 2.6-git.orig/block/genhd.c
  +++ 2.6-git/block/genhd.c
  @@ -643,6 +643,27 @@ struct seq_operations diskstats_op = {
  .show   = diskstats_show
   };
   
  +static void media_change_notify_thread(struct work_struct *work)
  +{
  +   struct gendisk *gd = container_of(work, struct gendisk, 
  async_notify);
  +   char event[] = MEDIA_CHANGE=1;
  +   char *envp[] = { event, NULL };
  +
  +   /*
  +* set enviroment vars to indicate which event this is for
  +* so that user space will know to go check the media status.
  +*/
  +   kobject_uevent_env(gd-kobj, KOBJ_CHANGE, envp);
  +   put_device(gd-driverfs_dev);
  +}
  +
  +void genhd_media_change_notify(struct gendisk *disk)
  +{
  +   get_device(disk-driverfs_dev);
  +   schedule_work(disk-async_notify);
  +}
  +EXPORT_SYMBOL_GPL(genhd_media_change_notify);
  +
   struct gendisk *alloc_disk(int minors)
   {
  return alloc_disk_node(minors, -1);
  @@ -672,6 +693,8 @@ struct gendisk *alloc_disk_node(int mino
  kobj_set_kset_s(disk,block_subsys);
  kobject_init(disk-kobj);
  rand_initialize_disk(disk);
  +   INIT_WORK(disk-async_notify,
  +   media_change_notify_thread);
  }
  return disk;
 
 Why does this do a schedule_work() rather than calling 
 kobject_uevent_env()
 directly?
 

Because it is called at Interrupt time.
   
   It better not be ... there's two GFP_KERNEL allocations just above this
   line in the file.
   
   James
   
  
  Where?  We are talking about the call to genhd_media_change_notify().
  the calling path is this:
  ahci_host_intr()-ata_scsi_media_change_notify()-genhd_media_change_notify().
  
  I don't see the allocations - are they hidden somewhere?
 
 Sorry, I thought you were saying alloc_disk_node() could be called from
 interrupt context.
 
 gets back on ball
 
 If you just want to invoke guaranteed user context from a place in the
 code which *may* be called from interrupt, then
 execute_in_process_context() might be a better way of doing it ... at
 least it avoids setting up a workqueue where none is needed.
 
 James
 

That is good to know - although in this particular case we are guaranteed
to always be called from interrupt context since our uevent needs to be
sent in response to an Interrupt received from the disk, so it wouldn't
buy us anything.

Kristen
-
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: SMART support for SATA drives in SAS enclosures

2007-05-23 Thread Douglas Gilbert
Pim Zandbergen wrote:
 Is SMART support available for SATA drives in SAS enclosures?
 
 I'm testing this setup
 
 LSI Logic SAS3800X PCI-X SAS controller (mptsas driver)
 Promise V-Trak J300S SAS/SATA enclosure/expander
 12x Seagate ST3500630NS
 Linux kernel 2.6.21.1 x86_64
 smartmontools-5.37-1.1.fc6 from Fedora Core 6
 
 smartctl -i -d sat /dev/sdc gives me
 
 Smartctl: Device Read Identity Failed

I presume /dev/sdc is an actual disk rather than a
RAID device made up of several disks. The SAT standard
(and smartmontools) don't have a general way of
addressing individual disks behind RAID infrastructure.

For recent versions of smartmontools version 5.37 and
MPT Fusion SAS HBAs this should work if /dev/sdc is
a SATA disk. Your HBA may need a firmware upgrade.


You might fetch sg3_utils version 1.24 and try:
  sg_sat_identify /dev/sdc
That needs to work before smartctl has a hope.

 Same with -d ata.
 
 If I treat the disk as SCSI (-d scsi), the command
 will not fail, but wil only retrieve the serial number.

With MPT Fusion SAS hardware (that I have seen) the SAT
layer is in the HBA firmware. Only later versions of the
firmware support the SCSI ATA PASS-THROUGH command.

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


RE: Sg_ses question

2007-05-23 Thread Haefliger, Juerg
 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Douglas Gilbert
 Sent: Tuesday, May 22, 2007 1:29 PM
 To: Haefliger, Juerg
 Cc: linux-scsi@vger.kernel.org
 Subject: Re: Sg_ses question
 
 Haefliger, Juerg wrote:
  Hi,
  
  Not sure if this is the right list for my question but I 
 couldn't find 
  a more suitable place to ask it.
  
  I'm trying to set the locator light of a disk in a SAS 
 enclosure using 
  sg_ses but I'm not getting anywhere. I'm dumping the 
 enclosure status 
  diagnostic page using 'sg_ses --page=2 --raw /dev/sgXX  page' and 
  then set the SELECT and RQST IDENT bits of the array device 
 element in 
  question and write it back doing 'sg_ses --control --page=2 
 --data=- 
  /dev/sgXX  tmp'. The command completes without error but 
  unfortunately, nothing happens. When I read the page back, 
 the IDENT 
  bit is still cleared and the light on the enclosure remains 
 turned off.
  
  Am I doing something wrong or am I missing something? Can't I use 
  sg_ses to achieve this?
 
 The procedure looks correct. I haven't had any (other) 
 reports of sg_ses not working lately. The only suggestion I 
 can make is to ask if you have selected the element control 
 rather than the overall control.

Hmm... Just tried it again and now it works. I don't think I did
something different than before...

Thanks
...juerg

 
 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
 
-
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 06/25] drivers/scsi/wd33c93.c: cleanups

2007-05-23 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

- #include asm/irq.h for getting the prototypes of {dis,en}able_irq()

- make the needlessly global wd33c93_setup() static

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/wd33c93.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -puN drivers/scsi/wd33c93.c~drivers-scsi-wd33c93c-cleanups 
drivers/scsi/wd33c93.c
--- a/drivers/scsi/wd33c93.c~drivers-scsi-wd33c93c-cleanups
+++ a/drivers/scsi/wd33c93.c
@@ -89,6 +89,8 @@
 #include scsi/scsi_device.h
 #include scsi/scsi_host.h
 
+#include asm/irq.h
+
 #include wd33c93.h
 
 #define optimum_sx_per(hostdata) (hostdata)-sx_table[1].period_ns
@@ -1762,7 +1764,7 @@ static char setup_buffer[SETUP_BUFFER_SI
 static char setup_used[MAX_SETUP_ARGS];
 static int done_setup = 0;
 
-int
+static int
 wd33c93_setup(char *str)
 {
int i;
_
-
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/25] fdomain.c: get rid of unused stuff

2007-05-23 Thread akpm
From: Parag Warudkar [EMAIL PROTECTED]

fdomain.c uses the below stuff only if PCMCIA is not defined.  This causes
unused variables to be defined when PCMCIA is not defined.  Wrap variables
and functions around #ifndef PCMCIA appropriately to avoid this.

4 less compiler warnings.

Signed-off-by: Parag Warudkar [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/fdomain.c |5 -
 1 files changed, 4 insertions(+), 1 deletion(-)

diff -puN drivers/scsi/fdomain.c~fdomainc-get-rid-of-unused-stuff 
drivers/scsi/fdomain.c
--- a/drivers/scsi/fdomain.c~fdomainc-get-rid-of-unused-stuff
+++ a/drivers/scsi/fdomain.c
@@ -410,6 +410,7 @@ static irqreturn_t   do_fdomain_16x0
 static char * fdomain = NULL;
 module_param(fdomain, charp, 0);
 
+#ifndef PCMCIA
 static unsigned long addresses[] = {
0xc8000,
0xca000,
@@ -502,6 +503,7 @@ static struct signature {
 };
 
 #define SIGNATURE_COUNT ARRAY_SIZE(signatures)
+#endif /* ifndef PCMCIA */
 
 static void print_banner( struct Scsi_Host *shpnt )
 {
@@ -646,7 +648,7 @@ static int fdomain_test_loopback( void )
Sometimes it is possible to use the computer's BIOS setup screen to
configure a PCI system so that one of these IRQs will be used by the
Future Domain card. */
-
+#ifndef PCMCIA
 static int fdomain_get_irq( int base )
 {
int options = inb(base + Configuration1);
@@ -664,6 +666,7 @@ static int fdomain_get_irq( int base )
return 0;
return ints[(options  0x0e)  1];
 }
+#endif
 
 static int fdomain_isa_detect( int *irq, int *iobase )
 {
_
-
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/25] scsi: cover up bugs^W^W^WFix up compiler warnings in megaraid driver

2007-05-23 Thread akpm
From: Martin Bligh [EMAIL PROTECTED]

Fix up compiler warnings in megaraid driver

[EMAIL PROTECTED]: build fix]
Signed-off-by: Martin J. Bligh [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/megaraid.c |   22 +-
 1 files changed, 13 insertions(+), 9 deletions(-)

diff -puN 
drivers/scsi/megaraid.c~scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver
 drivers/scsi/megaraid.c
--- 
a/drivers/scsi/megaraid.c~scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver
+++ a/drivers/scsi/megaraid.c
@@ -73,10 +73,14 @@ static unsigned short int max_mbox_busy_
 module_param(max_mbox_busy_wait, ushort, 0);
 MODULE_PARM_DESC(max_mbox_busy_wait, Maximum wait for mailbox in microseconds 
if busy (default=MBOX_BUSY_WAIT=10));
 
-#define RDINDOOR(adapter)  readl((adapter)-mmio_base + 0x20)
-#define RDOUTDOOR(adapter) readl((adapter)-mmio_base + 0x2C)
-#define WRINDOOR(adapter,value) writel(value, (adapter)-mmio_base + 
0x20)
-#define WROUTDOOR(adapter,value) writel(value, (adapter)-mmio_base + 0x2C)
+#define RDINDOOR(adapter)  readl((volatile void __iomem *) \
+   (adapter)-base + 0x20)
+#define RDOUTDOOR(adapter) readl((volatile void __iomem *) \
+   (adapter)-base + 0x2C)
+#define WRINDOOR(adapter,value)writel(value, (volatile void 
__iomem *)\
+   (adapter)-base + 0x20)
+#define WROUTDOOR(adapter,value)   writel(value, (volatile void __iomem *)\
+   (adapter)-base + 0x2C)
 
 /*
  * Global variables
@@ -3571,7 +3575,7 @@ megadev_ioctl(struct inode *inode, struc
/*
 * The user passthru structure
 */
-   upthru = (mega_passthru __user *)MBOX(uioc)-xferaddr;
+   upthru = (mega_passthru __user *)(unsigned 
long)MBOX(uioc)-xferaddr;
 
/*
 * Copy in the user passthru here.
@@ -3623,7 +3627,7 @@ megadev_ioctl(struct inode *inode, struc
/*
 * Get the user data
 */
-   if( copy_from_user(data, (char __user 
*)uxferaddr,
+   if( copy_from_user(data, (char __user 
*)(unsigned long) uxferaddr,
pthru-dataxferlen) ) {
rval = (-EFAULT);
goto freemem_and_return;
@@ -3649,7 +3653,7 @@ megadev_ioctl(struct inode *inode, struc
 * Is data going up-stream
 */
if( pthru-dataxferlen  (uioc.flags  UIOC_RD) ) {
-   if( copy_to_user((char __user *)uxferaddr, data,
+   if( copy_to_user((char __user *)(unsigned long) 
uxferaddr, data,
pthru-dataxferlen) ) {
rval = (-EFAULT);
}
@@ -3702,7 +3706,7 @@ freemem_and_return:
/*
 * Get the user data
 */
-   if( copy_from_user(data, (char __user 
*)uxferaddr,
+   if( copy_from_user(data, (char __user 
*)(unsigned long) uxferaddr,
uioc.xferlen) ) {
 
pci_free_consistent(pdev,
@@ -3742,7 +3746,7 @@ freemem_and_return:
 * Is data going up-stream
 */
if( uioc.xferlen  (uioc.flags  UIOC_RD) ) {
-   if( copy_to_user((char __user *)uxferaddr, data,
+   if( copy_to_user((char __user *)(unsigned long) 
uxferaddr, data,
uioc.xferlen) ) {
 
rval = (-EFAULT);
_
-
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/25] drivers/scsi/advansys.c: cleanups

2007-05-23 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

- remove the unneeded advansys.h
- remove the unused advansys_setup()
- make needlessly global functions static

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/advansys.c |  101 +++---
 drivers/scsi/advansys.h |   36 -
 2 files changed, 8 insertions(+), 129 deletions(-)

diff -puN drivers/scsi/advansys.c~drivers-scsi-advansysc-cleanups 
drivers/scsi/advansys.c
--- a/drivers/scsi/advansys.c~drivers-scsi-advansysc-cleanups
+++ a/drivers/scsi/advansys.c
@@ -798,7 +798,6 @@
 #include scsi/scsi_tcq.h
 #include scsi/scsi.h
 #include scsi/scsi_host.h
-#include advansys.h
 #ifdef CONFIG_PCI
 #include linux/pci.h
 #endif /* CONFIG_PCI */
@@ -2014,7 +2013,7 @@ STATIC int   AscSgListToQueue(int);
 STATIC void  AscEnableIsaDma(uchar);
 #endif /* CONFIG_ISA */
 STATIC ASC_DCNT  AscGetMaxDmaCount(ushort);
-
+static const char *advansys_info(struct Scsi_Host *shp);
 
 /*
  * --- Adv Library Constants and Macros
@@ -3970,10 +3969,6 @@ STATIC ushort asc_bus[ASC_NUM_BUS] __ini
 ASC_IS_PCI,
 };
 
-/*
- * Used with the LILO 'advansys' option to eliminate or
- * limit I/O port probing at boot time, cf. advansys_setup().
- */
 STATIC int asc_iopflag = ASC_FALSE;
 STATIC int asc_ioport[ASC_NUM_IOPORT_PROBE] = { 0, 0, 0, 0 };
 
@@ -4055,10 +4050,6 @@ STATIC void asc_prt_hex(char *f,
 #endif /* ADVANSYS_DEBUG */
 
 
-/*
- * --- Linux 'struct scsi_host_template' and advansys_setup() Functions
- */
-
 #ifdef CONFIG_PROC_FS
 /*
  * advansys_proc_info() - /proc/scsi/advansys/[0-(ASC_NUM_BOARD_SUPPORTED-1)]
@@ -4080,7 +4071,7 @@ STATIC void asc_prt_hex(char *f,
  * if 'prtbuf' is too small it will not be overwritten. Instead the
  * user just won't get all the available statistics.
  */
-int
+static int
 advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
off_t offset, int length, int inout)
 {
@@ -4296,7 +4287,7 @@ advansys_proc_info(struct Scsi_Host *sho
  * it must not call SCSI mid-level functions including scsi_malloc()
  * and scsi_free().
  */
-int __init
+static int __init
 advansys_detect(struct scsi_host_template *tpnt)
 {
 static int  detect_called = ASC_FALSE;
@@ -5428,7 +5419,7 @@ advansys_detect(struct scsi_host_templat
  *
  * Release resources allocated for a single AdvanSys adapter.
  */
-int
+static int
 advansys_release(struct Scsi_Host *shp)
 {
 asc_board_t*boardp;
@@ -5475,7 +5466,7 @@ advansys_release(struct Scsi_Host *shp)
  * Note: The information line should not exceed ASC_INFO_SIZE bytes,
  * otherwise the static 'info' array will be overrun.
  */
-const char *
+static const char *
 advansys_info(struct Scsi_Host *shp)
 {
 static char info[ASC_INFO_SIZE];
@@ -5568,7 +5559,7 @@ advansys_info(struct Scsi_Host *shp)
  * This function always returns 0. Command return status is saved
  * in the 'scp' result field.
  */
-int
+static int
 advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
 {
 struct Scsi_Host*shp;
@@ -5656,7 +5647,7 @@ advansys_queuecommand(struct scsi_cmnd *
  * sleeping is allowed and no locking other than for host structures is
  * required. Returns SUCCESS or FAILED.
  */
-int
+static int
 advansys_reset(struct scsi_cmnd *scp)
 {
 struct Scsi_Host *shp;
@@ -5841,7 +5832,7 @@ advansys_reset(struct scsi_cmnd *scp)
  * ip[1]: sectors
  * ip[2]: cylinders
  */
-int
+static int
 advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev,
sector_t capacity, int ip[])
 {
@@ -5875,82 +5866,6 @@ advansys_biosparam(struct scsi_device *s
 }
 
 /*
- * advansys_setup()
- *
- * This function is called from init/main.c at boot time.
- * It it passed LILO parameters that can be set from the
- * LILO command line or in /etc/lilo.conf.
- *
- * It is used by the AdvanSys driver to either disable I/O
- * port scanning or to limit scanning to 1 - 4 I/O ports.
- * Regardless of the option setting EISA and PCI boards
- * will still be searched for and detected. This option
- * only affects searching for ISA and VL boards.
- *
- * If ADVANSYS_DEBUG is defined the driver debug level may
- * be set using the 5th (ASC_NUM_IOPORT_PROBE + 1) I/O Port.
- *
- * Examples:
- * 1. Eliminate I/O port scanning:
- * boot: linux advansys=
- *   or
- * boot: linux advansys=0x0
- * 2. Limit I/O port scanning to one I/O port:
- *boot: linux advansys=0x110
- * 3. Limit I/O port scanning to four I/O ports:
- *boot: linux advansys=0x110,0x210,0x230,0x330
- * 4. If ADVANSYS_DEBUG, limit I/O port scanning to four I/O ports and
- *set the driver debug level to 2.
- *boot: linux advansys=0x110,0x210,0x230,0x330,0xdeb2
- *
- * ints[0] - number of arguments
- * ints[1] - first argument
- * ints[2] - second argument
- * ...
- */
-void __init
-advansys_setup(char *str, int *ints)
-{
-int

[patch 04/25] drivers/scsi/NCR5380.c: Replacing yield() with a better alternative

2007-05-23 Thread akpm
From: Amol Lad [EMAIL PROTECTED]

Replaced yield() with cond_resched()

Signed-off-by: Amol Lad [EMAIL PROTECTED]
Acked-by: Alan Cox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/NCR5380.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/NCR5380.c~drivers-scsi-ncr5380c-replacing-yield-with-a 
drivers/scsi/NCR5380.c
--- a/drivers/scsi/NCR5380.c~drivers-scsi-ncr5380c-replacing-yield-with-a
+++ a/drivers/scsi/NCR5380.c
@@ -347,7 +347,7 @@ static int NCR5380_poll_politely(struct 
if((r  bit) == val)
return 0;
if(!in_interrupt())
-   yield();
+   cond_resched();
else
cpu_relax();
}
_
-
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/25] scsi: remove unnecessary check in drivers/scsi/sg.c

2007-05-23 Thread akpm
From: Eric Sesterhenn [EMAIL PROTECTED]

coverity spotted this (cid #758).  All callers dereference sfp, so we dont
need this check.  In addition to this, we dereference it earlier in the
function.

Signed-off-by: Eric Sesterhenn [EMAIL PROTECTED]
Cc: Douglas Gilbert [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sg.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/sg.c~remove-unnecessary-check-in-drivers-scsi-sgc 
drivers/scsi/sg.c
--- a/drivers/scsi/sg.c~remove-unnecessary-check-in-drivers-scsi-sgc
+++ a/drivers/scsi/sg.c
@@ -1842,7 +1842,7 @@ sg_build_indirect(Sg_scatter_hold * schp
int blk_size = buff_size;
struct page *p = NULL;
 
-   if ((blk_size  0) || (!sfp))
+   if (blk_size  0)
return -EFAULT;
if (0 == blk_size)
++blk_size; /* don't know why */
_
-
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/25] SCSI: Fix obvious typo spin_lock_irqrestore() in gdth.c

2007-05-23 Thread akpm
From: Robert P. J. Day [EMAIL PROTECTED]

Fix misspelled spin_lock_irqrestore to read spin_unlock_irqrestore
instead.

Presumably, GDTH_RTC doesn't get used a lot.

Signed-off-by: Robert P. J. Day [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/gdth.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/scsi/gdth.c~scsi-fix-obvious-typo-spin_lock_irqrestore-in-gdthc 
drivers/scsi/gdth.c
--- a/drivers/scsi/gdth.c~scsi-fix-obvious-typo-spin_lock_irqrestore-in-gdthc
+++ a/drivers/scsi/gdth.c
@@ -1955,7 +1955,7 @@ static int __init gdth_search_drives(int
 for (j = 0; j  12; ++j) 
 rtc[j] = CMOS_READ(j);
 } while (rtc[0] != CMOS_READ(0));
-spin_lock_irqrestore(rtc_lock, flags);
+spin_unlock_irqrestore(rtc_lock, flags);
 TRACE2((gdth_search_drives(): RTC: %x/%x/%x\n,*(ulong32 *)rtc[0],
 *(ulong32 *)rtc[4], *(ulong32 *)rtc[8]));
 /* 3. send to controller firmware */
_
-
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 05/25] sym53c8xx_2 claims cpqarray device

2007-05-23 Thread akpm
From: Chip Coldwell [EMAIL PROTECTED]

Apropos this thread

http://marc.theaimsgroup.com/?l=linux-scsim=115591706804045w=2

which led to this patch

http://www.kernel.org/git/?p=linux/kernel/git/jejb/scsi-rc-fixes-2.6.git;a=commit;h=b2b3c121076961333977f485f0d54c22121df920

do we not also need the following patch, nine lines lower in the same file?

Signed-off-by: Chip Coldwell [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c8xx_2/sym_glue.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/scsi/sym53c8xx_2/sym_glue.c~sym53c8xx_2-claims-cpqarray-device 
drivers/scsi/sym53c8xx_2/sym_glue.c
--- a/drivers/scsi/sym53c8xx_2/sym_glue.c~sym53c8xx_2-claims-cpqarray-device
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -2094,7 +2094,7 @@ static struct pci_device_id sym2_id_tabl
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C875,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C1510,
- PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, /* new */
+ PCI_ANY_ID, PCI_ANY_ID,  PCI_CLASS_STORAGE_SCSI8,  0x00, 0UL }, 
/* new */
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C895A,
  PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
{ PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C875A,
_
-
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


[AIC7xxx] tree things to report

2007-05-23 Thread Emmanuel Fusté
Hello,

After one year of rest, I resurrect my old computer, install a
2.6.21 kernel and updated my Debian distro.

Tree things to repport:

First, a cosmetic thing: I have two scsi sync devices and two
async devices. For the first ones, domain validation return
the negociated speed and mode. For the second ones, domain
validation return nothing. I expect it is just a 'missing
feature' but that all went ok. I am right ?

scsi0 : Adaptec AIC7XXX EISA/VLB/PCI SCSI HBA DRIVER, Rev 7.0
Adaptec 2940 Ultra2 SCSI adapter
aic7890/91: Ultra2 Wide Channel A, SCSI Id=7, 32/253 SCBs

scsi 0:0:0:0: Direct-Access IBM  DMVS18V 02B0
PQ: 0 ANSI: 3
scsi0:A:0:0: Tagged Queuing enabled.  Depth 8 
 target0:0:0: Beginning Domain Validation
 target0:0:0: wide asynchronous
 target0:0:0: FAST-40 WIDE SCSI 80.0 MB/s ST (25ns, offset 31)
 target0:0:0: Domain Validation skipping write tests
 target0:0:0: Ending Domain Validation
scsi 0:0:3:0: CD-ROMYAMAHA   CRW6416S 1.0d
PQ: 0 ANSI: 2
 target0:0:3: Beginning Domain Validation
 target0:0:3: FAST-10 SCSI 10.0 MB/s ST (100 ns,offset 15)
 target0:0:3: Domain Validation skipping write tests
 target0:0:3: Ending Domain Validation
scsi 0:0:4:0: CD-ROMTOSHIBA  CD-ROM XM-3501TA 1875
PQ: 0 ANSI: 2
 target0:0:4: Beginning Domain Validation
 target0:0:4: Domain Validation skipping write tests
 target0:0:4: Ending Domain Validation
scsi 0:0:6:0: Sequential-Access WANGTEK  5525ES SCSI REV7 0W 
 PQ: 0 ANSI: 1
 target0:0:6: Beginning Domain Validation
 target0:0:6: Ending Domain Validation

Secondly, It seems that something is doing weird things with
my old CD-ROM reader (XM-3501TA). At some point in time (not
really regular), I get this in my logs:
May 23 00:45:44 rafale kernel: (scsi0:A:4:0): No or incomplete
CDB sent to device.
May 23 00:45:44 rafale kernel: (scsi0:A:4:0): Protocol
violation in Message-in phase.  Attempting to abort.
May 23 00:45:44 rafale kernel: (scsi0:A:4:0): Abort Message Sent
May 23 00:45:44 rafale kernel: (scsi0:A:4:0): SCB 11 - Abort
Completed.
And sometimes (but seem related to problems with my cable):
May 23 04:32:49 rafale kernel: (scsi0:A:4:0): parity error
detected in Status phase. SEQADDR(0xad) SCSIRATE(0x0)
May 23 05:13:03 rafale kernel: (scsi0:A:4:0): parity error
detected in Status phase. SEQADDR(0xac) SCSIRATE(0x0)

There is no scsi bus freeze, and the device work perfectly
without generating other errors. DV problem ? Bad hal daemon
interaction ? Defect in the driver trigged by bad hal daemon
behavior ? 

Last thing, a now two years problem:
cdrwtools -d /dev/sr0 -q still instantly crash the
scsibus/cdwriter and the driver never recover.
I did not have a new log because of the complete bus crash.
Have you new ideas about this problem ??
I will try:
- to get a log on a usb key
- to port patch from Bugzilla Bug 5921 to current kernel. With
the previous ones, the driver recover. (but i was experiencing
FS corruption but it seems it was not related).
- to identify exactly what cdrwtools send to the kernel/driver
which cause the crash.
If some scsi experts have a clue, I am taking.

Thank you all,
Best regards,
Emmanuel.
 
---

Créez votre adresse électronique [EMAIL PROTECTED] 
1 Go d'espace de stockage, anti-spam et anti-virus intégrés.

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


[patch 14/25] SCSI: use irq_handler_t where appropriate

2007-05-23 Thread akpm
From: Jeff Garzik [EMAIL PROTECTED]

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aacraid/aacraid.h |2 +-
 drivers/scsi/qla2xxx/qla_isr.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff -puN 
drivers/scsi/aacraid/aacraid.h~scsi-use-irq_handler_t-where-appropriate 
drivers/scsi/aacraid/aacraid.h
--- a/drivers/scsi/aacraid/aacraid.h~scsi-use-irq_handler_t-where-appropriate
+++ a/drivers/scsi/aacraid/aacraid.h
@@ -464,7 +464,7 @@ struct adapter_ops
int  (*adapter_restart)(struct aac_dev *dev, int bled);
/* Transport operations */
int  (*adapter_ioremap)(struct aac_dev * dev, u32 size);
-   irqreturn_t (*adapter_intr)(int irq, void *dev_id);
+   irq_handler_t adapter_intr;
/* Packet operations */
int  (*adapter_deliver)(struct fib * fib);
int  (*adapter_bounds)(struct aac_dev * dev, struct scsi_cmnd * cmd, 
u64 lba);
diff -puN 
drivers/scsi/qla2xxx/qla_isr.c~scsi-use-irq_handler_t-where-appropriate 
drivers/scsi/qla2xxx/qla_isr.c
--- a/drivers/scsi/qla2xxx/qla_isr.c~scsi-use-irq_handler_t-where-appropriate
+++ a/drivers/scsi/qla2xxx/qla_isr.c
@@ -1633,7 +1633,7 @@ struct qla_init_msix_entry {
uint16_t entry;
uint16_t index;
const char *name;
-   irqreturn_t (*handler)(int, void *);
+   irq_handler_t handler;
 };
 
 static struct qla_init_msix_entry imsix_entries[QLA_MSIX_ENTRIES] = {
_
-
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/25] make seagate_st0x_detect() static

2007-05-23 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

seagate_st0x_detect() can become static.

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/seagate.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/seagate.c~make-seagate_st0x_detect-static 
drivers/scsi/seagate.c
--- a/drivers/scsi/seagate.c~make-seagate_st0x_detect-static
+++ a/drivers/scsi/seagate.c
@@ -420,7 +420,7 @@ static inline void borken_wait (void)
 #define ULOOP( i ) for (clock = i*8;;)
 #define TIMEOUT (!(clock--))
 
-int __init seagate_st0x_detect (struct scsi_host_template * tpnt)
+static int __init seagate_st0x_detect (struct scsi_host_template * tpnt)
 {
struct Scsi_Host *instance;
int i, j;
_
-
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/25] scsi: fix CONFIG_SCSI_WAIT_SCAN=m

2007-05-23 Thread akpm
From: Hugh Dickins [EMAIL PROTECTED]

CONFIG_MODULES=y
CONFIG_SCSI=y
CONFIG_SCSI_SCAN_ASYNC=y
CONFIG_SCSI_WAIT_SCAN=m

2.6.21-rc5-mm2 VFS panics unable to find my root on /dev/sda2, but boots
okay if I change drivers/scsi/Kconfig to default y instead of default m
for SCSI_WAIT_SCAN.

Make sure there's a late_initcall to scsi_complete_async_scans when it's
built in, so a monolithic SCSI_SCAN_ASYNC kernel can rely on the scans
being completed before trying to mount root, even if they're slow.

[EMAIL PROTECTED]: build fixes]
Signed-off-by: Hugh Dickins [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
---
James sayeth This isn't the right fix ...  this has to be invoked last in the
call sequence ...  I can't see another way of doing this except yet another
file added as a final component to the link.
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/scsi_scan.c |9 +
 1 files changed, 9 insertions(+)

diff -puN drivers/scsi/scsi_scan.c~scsi-fix-config_scsi_wait_scan=m 
drivers/scsi/scsi_scan.c
--- a/drivers/scsi/scsi_scan.c~scsi-fix-config_scsi_wait_scan=m
+++ a/drivers/scsi/scsi_scan.c
@@ -184,6 +184,15 @@ int scsi_complete_async_scans(void)
 /* Only exported for the benefit of scsi_wait_scan */
 EXPORT_SYMBOL_GPL(scsi_complete_async_scans);
 
+#ifndef MODULE
+/*
+ * For async scanning we need to wait for all the scans to complete before
+ * trying to mount the root fs.  Otherwise non-modular drivers may not be ready
+ * yet.
+ */
+late_initcall(scsi_complete_async_scans);
+#endif
+
 /**
  * scsi_unlock_floptical - unlock device via a special MODE SENSE command
  * @sdev:  scsi device to send command to
_
-
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/25] drivers/message/i2o/device.c: remove redundant GFP_ATOMIC from kmalloc

2007-05-23 Thread akpm
From: Satyam Sharma [EMAIL PROTECTED]

drivers/message/i2o/device.c:i2o_parm_field_get() unnecessarily passes
GFP_ATOMIC (along with GFP_KERNEL) to kmalloc() from a context that is not
atomic. Remove the pointless GFP_ATOMIC.

Signed-off-by: Satyam Sharma [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/message/i2o/device.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/message/i2o/device.c~drivers-message-i2o-devicec-remove-redundant-gfp_atomic-from-kmalloc
 drivers/message/i2o/device.c
--- 
a/drivers/message/i2o/device.c~drivers-message-i2o-devicec-remove-redundant-gfp_atomic-from-kmalloc
+++ a/drivers/message/i2o/device.c
@@ -485,7 +485,7 @@ int i2o_parm_field_get(struct i2o_device
u8 *resblk; /* 8 bytes for header */
int rc;
 
-   resblk = kmalloc(buflen + 8, GFP_KERNEL | GFP_ATOMIC);
+   resblk = kmalloc(buflen + 8, GFP_KERNEL);
if (!resblk)
return -ENOMEM;
 
_
-
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 19/25] drivers/scsi/aic7xxx_old.c: remove redundant GFP_ATOMIC from kmalloc

2007-05-23 Thread akpm
From: Satyam Sharma [EMAIL PROTECTED]

drivers/scsi/aic7xxx_old.c:aic7xxx_slave_alloc() unnecessarily passes
GFP_ATOMIC (along with GFP_KERNEL) to kmalloc() from a context that is not
atomic. Remove the pointless GFP_ATOMIC.

Signed-off-by: Satyam Sharma [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aic7xxx_old.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN 
drivers/scsi/aic7xxx_old.c~drivers-scsi-aic7xxx_oldc-remove-redundant-gfp_atomic-from-kmalloc
 drivers/scsi/aic7xxx_old.c
--- 
a/drivers/scsi/aic7xxx_old.c~drivers-scsi-aic7xxx_oldc-remove-redundant-gfp_atomic-from-kmalloc
+++ a/drivers/scsi/aic7xxx_old.c
@@ -6581,7 +6581,7 @@ aic7xxx_slave_alloc(struct scsi_device *
   struct aic7xxx_host *p = (struct aic7xxx_host *)SDptr-host-hostdata;
   struct aic_dev_data *aic_dev;
 
-  aic_dev = kmalloc(sizeof(struct aic_dev_data), GFP_ATOMIC | GFP_KERNEL);
+  aic_dev = kmalloc(sizeof(struct aic_dev_data), GFP_KERNEL);
   if(!aic_dev)
 return 1;
   /*
_
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[patch 23/25] scsi: megaraid_sas: intercept cmd timeout and throttle io

2007-05-23 Thread akpm
From: Sumant Patro [EMAIL PROTECTED]

eh_timed_out call back (megasas_reset_timer) is used to throttle io to the
adapter when it is called the first time for a scmd.  The MEGASAS_FW_BUSY
flag is set and can_queue reduced to 16.  The can_queue is restored from
completion routine in following two conditions : 5 seconds has elapsed and
the # of outstanding cmds in FW is  17.

Signed-off-by: Sumant Patro [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/megaraid/megaraid_sas.c |   67 ++---
 drivers/scsi/megaraid/megaraid_sas.h |   14 +++--
 2 files changed, 69 insertions(+), 12 deletions(-)

diff -puN 
drivers/scsi/megaraid/megaraid_sas.c~scsi-megaraid_sas-intercepts-cmd-timeout-and-throttle-io
 drivers/scsi/megaraid/megaraid_sas.c
--- 
a/drivers/scsi/megaraid/megaraid_sas.c~scsi-megaraid_sas-intercepts-cmd-timeout-and-throttle-io
+++ a/drivers/scsi/megaraid/megaraid_sas.c
@@ -10,7 +10,7 @@
  *2 of the License, or (at your option) any later version.
  *
  * FILE: megaraid_sas.c
- * Version : v00.00.03.10-rc1
+ * Version : v00.00.03.10-rc5
  *
  * Authors:
  * (email-id : [EMAIL PROTECTED])
@@ -886,6 +886,7 @@ megasas_queue_command(struct scsi_cmnd *
goto out_return_cmd;
 
cmd-scmd = scmd;
+   scmd-SCp.ptr = (char *)cmd;
 
/*
 * Issue the command to the FW
@@ -919,7 +920,7 @@ static int megasas_slave_configure(struc
 * The RAID firmware may require extended timeouts.
 */
if (sdev-channel = MEGASAS_MAX_PD_CHANNELS)
-   sdev-timeout = 90 * HZ;
+   sdev-timeout = MEGASAS_DEFAULT_CMD_TIMEOUT * HZ;
return 0;
 }
 
@@ -981,8 +982,8 @@ static int megasas_generic_reset(struct 
 
instance = (struct megasas_instance *)scmd-device-host-hostdata;
 
-   scmd_printk(KERN_NOTICE, scmd, megasas: RESET -%ld cmd=%x\n,
-  scmd-serial_number, scmd-cmnd[0]);
+   scmd_printk(KERN_NOTICE, scmd, megasas: RESET -%ld cmd=%x 
retries=%x\n,
+scmd-serial_number, scmd-cmnd[0], scmd-retries);
 
if (instance-hw_crit_error) {
printk(KERN_ERR megasas: cannot recover from previous reset 
@@ -1000,6 +1001,39 @@ static int megasas_generic_reset(struct 
 }
 
 /**
+ * megasas_reset_timer - quiesce the adapter if required
+ * @scmd:  scsi cmnd
+ *
+ * Sets the FW busy flag and reduces the host-can_queue if the
+ * cmd has not been completed within the timeout period.
+ */
+static enum
+scsi_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)
+{
+   struct megasas_cmd *cmd = (struct megasas_cmd *)scmd-SCp.ptr;
+   struct megasas_instance *instance;
+   unsigned long flags;
+
+   if (time_after(jiffies, scmd-jiffies_at_alloc +
+   (MEGASAS_DEFAULT_CMD_TIMEOUT * 2) * HZ)) {
+   return EH_NOT_HANDLED;
+   }
+
+   instance = cmd-instance;
+   if (!(instance-flag  MEGASAS_FW_BUSY)) {
+   /* FW is busy, throttle IO */
+   spin_lock_irqsave(instance-host-host_lock, flags);
+
+   instance-host-can_queue = 16;
+   instance-last_time = jiffies;
+   instance-flag |= MEGASAS_FW_BUSY;
+
+   spin_unlock_irqrestore(instance-host-host_lock, flags);
+   }
+   return EH_RESET_TIMER;
+}
+
+/**
  * megasas_reset_device -  Device reset handler entry point
  */
 static int megasas_reset_device(struct scsi_cmnd *scmd)
@@ -1112,6 +1146,7 @@ static struct scsi_host_template megasas
.eh_device_reset_handler = megasas_reset_device,
.eh_bus_reset_handler = megasas_reset_bus_host,
.eh_host_reset_handler = megasas_reset_bus_host,
+   .eh_timed_out = megasas_reset_timer,
.bios_param = megasas_bios_param,
.use_clustering = ENABLE_CLUSTERING,
 };
@@ -1215,9 +1250,8 @@ megasas_complete_cmd(struct megasas_inst
int exception = 0;
struct megasas_header *hdr = cmd-frame-hdr;
 
-   if (cmd-scmd) {
-   cmd-scmd-SCp.ptr = (char *)0;
-   }
+   if (cmd-scmd)
+   cmd-scmd-SCp.ptr = NULL;
 
switch (hdr-cmd) {
 
@@ -1806,6 +1840,7 @@ static void megasas_complete_cmd_dpc(uns
u32 context;
struct megasas_cmd *cmd;
struct megasas_instance *instance = (struct megasas_instance 
*)instance_addr;
+   unsigned long flags;
 
/* If we have already declared adapter dead, donot complete cmds */
if (instance-hw_crit_error)
@@ -1828,6 +1863,22 @@ static void megasas_complete_cmd_dpc(uns
}
 
*instance-consumer = producer;
+
+   /*
+* Check if we can restore can_queue
+*/
+   if (instance-flag  MEGASAS_FW_BUSY
+time_after(jiffies, instance-last_time + 5 * HZ)
+atomic_read(instance-fw_outstanding)  17) {
+
+   spin_lock_irqsave(instance-host-host_lock, flags);
+

[patch 24/25] scsi: remove __GFP_DMA

2007-05-23 Thread akpm
From: Bernhard Walle [EMAIL PROTECTED]

After 821de3a27bf33f11ec878562577c586cd5f83c64, it's not necessary to
allocate a DMA buffer any more in sd.c.

Signed-off-by: Bernhard Walle [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Acked-by: Christoph Lameter [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sd.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/sd.c~scsi-remove-__gfp_dma drivers/scsi/sd.c
--- a/drivers/scsi/sd.c~scsi-remove-__gfp_dma
+++ a/drivers/scsi/sd.c
@@ -1515,7 +1515,7 @@ static int sd_revalidate_disk(struct gen
if (!scsi_device_online(sdp))
goto out;
 
-   buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL | __GFP_DMA);
+   buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL);
if (!buffer) {
sd_printk(KERN_WARNING, sdkp, sd_revalidate_disk: Memory 
  allocation failure.\n);
_
-
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/25] drivers/scsi/pcmcia/nsp_cs.c: remove kernel 2.4 code

2007-05-23 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/pcmcia/nsp_cs.c |  159 +
 drivers/scsi/pcmcia/nsp_cs.h |8 -
 2 files changed, 5 insertions(+), 162 deletions(-)

diff -puN 
drivers/scsi/pcmcia/nsp_cs.c~drivers-scsi-pcmcia-nsp_csc-remove-kernel-24-code 
drivers/scsi/pcmcia/nsp_cs.c
--- 
a/drivers/scsi/pcmcia/nsp_cs.c~drivers-scsi-pcmcia-nsp_csc-remove-kernel-24-code
+++ a/drivers/scsi/pcmcia/nsp_cs.c
@@ -25,8 +25,6 @@
 
 ***/
 
-/* $Id: nsp_cs.c,v 1.23 2003/08/18 11:09:19 elca Exp $ */
-
 #include linux/version.h
 #include linux/module.h
 #include linux/kernel.h
@@ -59,7 +57,7 @@
 #include nsp_cs.h
 
 MODULE_AUTHOR(YOKOTA Hiroshi [EMAIL PROTECTED]);
-MODULE_DESCRIPTION(WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI 
host adapter module $Revision: 1.23 $);
+MODULE_DESCRIPTION(WorkBit NinjaSCSI-3 / NinjaSCSI-32Bi(16bit) PCMCIA SCSI 
host adapter module);
 MODULE_SUPPORTED_DEVICE(sd,sr,sg,st);
 #ifdef MODULE_LICENSE
 MODULE_LICENSE(GPL);
@@ -83,10 +81,6 @@ static struct scsi_host_template nsp_dri
.proc_name   = nsp_cs,
.proc_info   = nsp_proc_info,
.name= WorkBit NinjaSCSI-3/32Bi(16bit),
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0))
-   .detect  = nsp_detect_old,
-   .release = nsp_release_old,
-#endif
.info= nsp_info,
.queuecommand= nsp_queuecommand,
 /* .eh_abort_handler= nsp_eh_abort,*/
@@ -97,9 +91,6 @@ static struct scsi_host_template nsp_dri
.sg_tablesize= SG_ALL,
.cmd_per_lun = 1,
.use_clustering  = DISABLE_CLUSTERING,
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,2))
-   .use_new_eh_code = 1,
-#endif
 };
 
 static nsp_hw_data nsp_data_base; /* attach - detect glue */
@@ -1313,11 +1304,7 @@ static struct Scsi_Host *nsp_detect(stru
nsp_hw_data *data_b = nsp_data_base, *data;
 
nsp_dbg(NSP_DEBUG_INIT, this_id=%d, sht-this_id);
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
host = scsi_host_alloc(nsp_driver_template, sizeof(nsp_hw_data));
-#else
-   host = scsi_register(sht, sizeof(nsp_hw_data));
-#endif
if (host == NULL) {
nsp_dbg(NSP_DEBUG_INIT, host failed);
return NULL;
@@ -1354,37 +1341,6 @@ static struct Scsi_Host *nsp_detect(stru
return host; /* detect done. */
 }
 
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0))
-static int nsp_detect_old(struct scsi_host_template *sht)
-{
-   if (nsp_detect(sht) == NULL) {
-   return 0;
-   } else {
-   //MOD_INC_USE_COUNT;
-   return 1;
-   }
-}
-
-
-static int nsp_release_old(struct Scsi_Host *shpnt)
-{
-   //nsp_hw_data *data = (nsp_hw_data *)shpnt-hostdata;
-
-   /* PCMCIA Card Service dose same things below. */
-   /* So we do nothing.   */
-   //if (shpnt-irq) {
-   //  free_irq(shpnt-irq, data-ScsiInfo);
-   //}
-   //if (shpnt-io_port) {
-   //  release_region(shpnt-io_port, shpnt-n_io_port);
-   //}
-
-   //MOD_DEC_USE_COUNT;
-
-   return 0;
-}
-#endif
-
 /**/
 /* return info string*/
 /**/
@@ -1403,19 +1359,9 @@ static const char *nsp_info(struct Scsi_
nsp_dbg(NSP_DEBUG_PROC, buffer=0x%p pos=0x%p length=%d 
%d\n, buffer, pos, length,  length - (pos - buffer));\
} \
} while(0)
-static int
-nsp_proc_info(
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
-   struct Scsi_Host *host,
-#endif
-   char  *buffer,
-   char **start,
-   off_t  offset,
-   intlength,
-#if !(LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
-   inthostno,
-#endif
-   intinout)
+
+static int nsp_proc_info(struct Scsi_Host *host, char *buffer, char **start,
+off_t offset, int length, int inout)
 {
int id;
char *pos = buffer;
@@ -1423,24 +1369,13 @@ nsp_proc_info(
int speed;
unsigned long flags;
nsp_hw_data *data;
-#if !(LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
-   struct Scsi_Host *host;
-#else
int hostno;
-#endif
+
if (inout) {
return -EINVAL;
}
 
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
hostno = host-host_no;
-#else
-   /* search this HBA host */
-   host = scsi_host_hn_get(hostno);
-   if (host == NULL) {
-   return -ESRCH;
-   }
-#endif
data = (nsp_hw_data *)host-hostdata;
 
 
@@ -1676,10 +1611,6 @@ static int 

[patch 21/25] scsi: fix ambiguous gdthtable definition

2007-05-23 Thread akpm
From: David Rientjes [EMAIL PROTECTED]

Labeling a variable as __attribute_used__ is ambiguous: it means
__attribute__((unused)) for gcc 3.4 and __attribute__((used)) for gcc =3.4. 
There is no such thing as labeling a variable as __attribute__((used)).  We
assume that we're simply suppressing a warning here if gdthtable[] is declared
but unreferenced.

Cc: Achim Leubner [EMAIL PROTECTED]
Signed-off-by: David Rientjes [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/gdth.c |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/scsi/gdth.c~scsi-fix-ambiguous-gdthtable-definition 
drivers/scsi/gdth.c
--- a/drivers/scsi/gdth.c~scsi-fix-ambiguous-gdthtable-definition
+++ a/drivers/scsi/gdth.c
@@ -876,7 +876,7 @@ static int __init gdth_search_pci(gdth_p
 /* Vortex only makes RAID controllers.
  * We do not really want to specify all 550 ids here, so wildcard match.
  */
-static struct pci_device_id gdthtable[] __attribute_used__ = {
+static struct pci_device_id gdthtable[] __maybe_unused = {
 {PCI_VENDOR_ID_VORTEX,PCI_ANY_ID,PCI_ANY_ID, PCI_ANY_ID},
 {PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID_INTEL_SRC,PCI_ANY_ID,PCI_ANY_ID}, 
 
{PCI_VENDOR_ID_INTEL,PCI_DEVICE_ID_INTEL_SRC_XSCALE,PCI_ANY_ID,PCI_ANY_ID}, 
_
-
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/25] drivers/scsi/nsp32.c: remove kernel 2.4 code

2007-05-23 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Acked-by: GOTO Masanori [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/nsp32.c |  109 -
 1 files changed, 13 insertions(+), 96 deletions(-)

diff -puN drivers/scsi/nsp32.c~drivers-scsi-nsp32c-remove-kernel-24-code 
drivers/scsi/nsp32.c
--- a/drivers/scsi/nsp32.c~drivers-scsi-nsp32c-remove-kernel-24-code
+++ a/drivers/scsi/nsp32.c
@@ -49,10 +49,6 @@
 #include scsi/scsi_host.h
 #include scsi/scsi_ioctl.h
 
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,6,0))
-# include linux/blk.h
-#endif
-
 #include nsp32.h
 
 
@@ -199,17 +195,9 @@ static int  __initinit_nsp32  (void)
 static void __exitexit_nsp32  (void);
 
 /* struct struct scsi_host_template */
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
 static int nsp32_proc_info   (struct Scsi_Host *, char *, char **, 
off_t, int, int);
-#else
-static int nsp32_proc_info   (char *, char **, off_t, int, int, int);
-#endif
 
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
 static int nsp32_detect  (struct pci_dev *pdev);
-#else
-static int nsp32_detect  (struct scsi_host_template *);
-#endif
 static int nsp32_queuecommand(struct scsi_cmnd *,
void (*done)(struct scsi_cmnd *));
 static const char *nsp32_info(struct Scsi_Host *);
@@ -296,15 +284,7 @@ static struct scsi_host_template nsp32_t
.eh_abort_handler   = nsp32_eh_abort,
.eh_bus_reset_handler   = nsp32_eh_bus_reset,
.eh_host_reset_handler  = nsp32_eh_host_reset,
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,74))
-   .detect = nsp32_detect,
-   .release= nsp32_release,
-#endif
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,2))
-   .use_new_eh_code= 1,
-#else
 /* .highmem_io = 1, */
-#endif
 };
 
 #include nsp32_io.h
@@ -1210,13 +1190,9 @@ static irqreturn_t do_nsp32_isr(int irq,
unsigned long flags;
int ret;
int handled = 0;
-
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0))
struct Scsi_Host *host = data-Host;
+
spin_lock_irqsave(host-host_lock, flags);
-#else
-   spin_lock_irqsave(io_request_lock, flags);
-#endif
 
/*
 * IRQ check, then enable IRQ mask
@@ -1480,11 +1456,7 @@ static irqreturn_t do_nsp32_isr(int irq,
nsp32_write2(base, IRQ_CONTROL, 0);
 
  out2:
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0))
spin_unlock_irqrestore(host-host_lock, flags);
-#else
-   spin_unlock_irqrestore(io_request_lock, flags);
-#endif
 
nsp32_dbg(NSP32_DEBUG_INTR, exit);
 
@@ -1499,28 +1471,15 @@ static irqreturn_t do_nsp32_isr(int irq,
nsp32_dbg(NSP32_DEBUG_PROC, buffer=0x%p pos=0x%p 
length=%d %d\n, buffer, pos, length,  length - (pos - buffer));\
} \
} while(0)
-static int nsp32_proc_info(
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73)) 
-   struct Scsi_Host *host,
-#endif
-   char *buffer,
-   char**start,
-   off_t offset,
-   int   length,
-#if !(LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73)) 
-   int   hostno,
-#endif
-   int   inout)
+
+static int nsp32_proc_info(struct Scsi_Host *host, char *buffer, char **start,
+  off_t offset, int length, int inout)
 {
char *pos = buffer;
int   thislength;
unsigned long flags;
nsp32_hw_data*data;
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73)) 
int   hostno;
-#else
-   struct Scsi_Host *host;
-#endif
unsigned int  base;
unsigned char mode_reg;
int   id, speed;
@@ -1531,15 +1490,7 @@ static int nsp32_proc_info(
return -EINVAL;
}
 
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73)) 
hostno = host-host_no;
-#else
-   /* search this HBA host */
-   host = scsi_host_hn_get(hostno);
-   if (host == NULL) {
-   return -ESRCH;
-   }
-#endif
data = (nsp32_hw_data *)host-hostdata;
base = host-io_port;
 
@@ -2674,17 +2625,7 @@ static void nsp32_sack_negate(nsp32_hw_d
  * 0x900-0xbff: (map same 0x800-0x8ff I/O port image repeatedly)
  * 0xc00-0xfff: CardBus status registers
  */
-#if (LINUX_VERSION_CODE  KERNEL_VERSION(2,5,73))
-#define DETECT_OK 0
-#define DETECT_NG 1
-#define PCIDEVpdev
 static int nsp32_detect(struct pci_dev *pdev)
-#else
-#define DETECT_OK 1
-#define DETECT_NG 0
-#define PCIDEV(data-Pci)
-static int nsp32_detect(struct scsi_host_template *sht)
-#endif
 {
struct Scsi_Host *host; /* registered host structure */
struct resource  *res;
@@ -2697,11 +2638,7 @@ static int nsp32_detect(struct scsi_host
   

[patch 22/25] Use menuconfig objects II - SCSI

2007-05-23 Thread akpm
From: Jan Engelhardt [EMAIL PROTECTED]

Make a menuconfig out of the Kconfig objects menu, ..., endmenu,
so that the user can disable all the options in that menu at once
instead of having to disable each option separately.

Signed-off-by: Jan Engelhardt [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/Kconfig|8 ++--
 drivers/scsi/pcmcia/Kconfig |8 ++--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff -puN drivers/scsi/Kconfig~use-menuconfig-objects-ii-scsi 
drivers/scsi/Kconfig
--- a/drivers/scsi/Kconfig~use-menuconfig-objects-ii-scsi
+++ a/drivers/scsi/Kconfig
@@ -285,8 +285,12 @@ source drivers/scsi/libsas/Kconfig
 
 endmenu
 
-menu SCSI low-level drivers
+menuconfig SCSI_LOWLEVEL
+   bool SCSI low-level drivers
depends on SCSI!=n
+   default y
+
+if SCSI_LOWLEVEL
 
 config ISCSI_TCP
tristate iSCSI Initiator over TCP/IP
@@ -1803,7 +1807,7 @@ config SCSI_SRP
  To compile this driver as a module, choose M here: the
  module will be called libsrp.
 
-endmenu
+endif # SCSI_LOWLEVEL
 
 source drivers/scsi/pcmcia/Kconfig
 
diff -puN drivers/scsi/pcmcia/Kconfig~use-menuconfig-objects-ii-scsi 
drivers/scsi/pcmcia/Kconfig
--- a/drivers/scsi/pcmcia/Kconfig~use-menuconfig-objects-ii-scsi
+++ a/drivers/scsi/pcmcia/Kconfig
@@ -2,8 +2,12 @@
 # PCMCIA SCSI adapter configuration
 #
 
-menu PCMCIA SCSI adapter support
+menuconfig SCSI_LOWLEVEL_PCMCIA
+   bool PCMCIA SCSI adapter support
depends on SCSI!=n  PCMCIA!=n
+   default y
+
+if SCSI_LOWLEVEL_PCMCIA
 
 config PCMCIA_AHA152X
tristate Adaptec AHA152X PCMCIA support
@@ -77,4 +81,4 @@ config PCMCIA_SYM53C500
  To compile this driver as a module, choose M here: the
  module will be called sym53c500_cs.
 
-endmenu
+endif # SCSI_LOWLEVEL_PCMCIA
_
-
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/25] PCI Error Recovery: Symbios SCSI First Failure

2007-05-23 Thread akpm
From: Linas Vepstas [EMAIL PROTECTED]

Implement the so-called first failure data capture (FFDC) for the symbios
PCI error recovery.  After a PCI error event is reported, the driver
requests that MMIO be enabled.  Once enabled, it then reads and dumps
assorted status registers, and concludes by requesting the usual reset
sequence.

(includes a whitespace fix for bad indentation).

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c8xx_2/sym_glue.c |   15 +++
 drivers/scsi/sym53c8xx_2/sym_glue.h |1 +
 drivers/scsi/sym53c8xx_2/sym_hipd.c |   18 ++
 3 files changed, 30 insertions(+), 4 deletions(-)

diff -puN 
drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-first-failure
 drivers/scsi/sym53c8xx_2/sym_glue.c
--- 
a/drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-first-failure
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -1987,6 +1987,20 @@ static pci_ers_result_t sym2_io_error_de
disable_irq(pdev-irq);
pci_disable_device(pdev);
 
+   /* Request that MMIO be enabled, so register dump can be taken. */
+   return PCI_ERS_RESULT_CAN_RECOVER;
+}
+
+/**
+ * sym2_io_slot_dump -- Enable MMIO and dump debug registers
+ * @pdev: pointer to PCI device
+ */
+static pci_ers_result_t sym2_io_slot_dump(struct pci_dev *pdev)
+{
+   struct sym_hcb *np = pci_get_drvdata(pdev);
+
+   sym_dump_registers(np);
+
/* Request a slot reset. */
return PCI_ERS_RESULT_NEED_RESET;
 }
@@ -2241,6 +2255,7 @@ MODULE_DEVICE_TABLE(pci, sym2_id_table);
 
 static struct pci_error_handlers sym2_err_handler = {
.error_detected = sym2_io_error_detected,
+   .mmio_enabled = sym2_io_slot_dump,
.slot_reset = sym2_io_slot_reset,
.resume = sym2_io_resume,
 };
diff -puN 
drivers/scsi/sym53c8xx_2/sym_glue.h~pci-error-recovery-symbios-scsi-first-failure
 drivers/scsi/sym53c8xx_2/sym_glue.h
--- 
a/drivers/scsi/sym53c8xx_2/sym_glue.h~pci-error-recovery-symbios-scsi-first-failure
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.h
@@ -270,5 +270,6 @@ void sym_xpt_async_bus_reset(struct sym_
 void sym_xpt_async_sent_bdr(struct sym_hcb *np, int target);
 int  sym_setup_data_and_start (struct sym_hcb *np, struct scsi_cmnd *csio, 
struct sym_ccb *cp);
 void sym_log_bus_error(struct sym_hcb *np);
+void sym_dump_registers(struct sym_hcb *np);
 
 #endif /* SYM_GLUE_H */
diff -puN 
drivers/scsi/sym53c8xx_2/sym_hipd.c~pci-error-recovery-symbios-scsi-first-failure
 drivers/scsi/sym53c8xx_2/sym_hipd.c
--- 
a/drivers/scsi/sym53c8xx_2/sym_hipd.c~pci-error-recovery-symbios-scsi-first-failure
+++ a/drivers/scsi/sym53c8xx_2/sym_hipd.c
@@ -1180,10 +1180,10 @@ static void sym_log_hard_error(struct sy
scr_to_cpu((int) *(u32 *)(script_base + script_ofs)));
}
 
-printf (%s: regdump:, sym_name(np));
-for (i=0; i24;i++)
-printf ( %02x, (unsigned)INB_OFF(np, i));
-printf (.\n);
+   printf(%s: regdump:, sym_name(np));
+   for (i = 0; i  24; i++)
+   printf( %02x, (unsigned)INB_OFF(np, i));
+   printf(.\n);
 
/*
 *  PCI BUS error.
@@ -1192,6 +1192,16 @@ static void sym_log_hard_error(struct sy
sym_log_bus_error(np);
 }
 
+void sym_dump_registers(struct sym_hcb *np)
+{
+   u_short sist;
+   u_char dstat;
+
+   sist = INW(np, nc_sist);
+   dstat = INB(np, nc_dstat);
+   sym_log_hard_error(np, sist, dstat);
+}
+
 static struct sym_chip sym_dev_table[] = {
  {PCI_DEVICE_ID_NCR_53C810, 0x0f, 810, 4, 8, 4, 64,
  FE_ERL}
_
-
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/25] drivers/scsi/ips.c: remove kernel 2.4 code

2007-05-23 Thread akpm
From: Adrian Bunk [EMAIL PROTECTED]

Signed-off-by: Adrian Bunk [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/ips.c |  145 +--
 drivers/scsi/ips.h |   44 -
 2 files changed, 20 insertions(+), 169 deletions(-)

diff -puN drivers/scsi/ips.c~drivers-scsi-ipsc-remove-kernel-24-code 
drivers/scsi/ips.c
--- a/drivers/scsi/ips.c~drivers-scsi-ipsc-remove-kernel-24-code
+++ a/drivers/scsi/ips.c
@@ -211,19 +211,6 @@ module_param(ips, charp, 0);
 #warning This driver has only been tested on the x86/ia64/x86_64 platforms
 #endif
 
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,5,0)
-#include linux/blk.h
-#include sd.h
-#define IPS_LOCK_SAVE(lock,flags) spin_lock_irqsave(io_request_lock,flags)
-#define IPS_UNLOCK_RESTORE(lock,flags) 
spin_unlock_irqrestore(io_request_lock,flags)
-#ifndef __devexit_p
-#define __devexit_p(x) x
-#endif
-#else
-#define IPS_LOCK_SAVE(lock,flags) do{spin_lock(lock);(void)flags;}while(0)
-#define IPS_UNLOCK_RESTORE(lock,flags) 
do{spin_unlock(lock);(void)flags;}while(0)
-#endif
-
 #define IPS_DMA_DIR(scb) ((!scb-scsi_cmd || ips_is_passthru(scb-scsi_cmd) || 
\
  DMA_NONE == scb-scsi_cmd-sc_data_direction) ? \
  PCI_DMA_BIDIRECTIONAL : \
@@ -381,24 +368,13 @@ static struct scsi_host_template ips_dri
.eh_abort_handler   = ips_eh_abort,
.eh_host_reset_handler  = ips_eh_reset,
.proc_name  = ips,
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0)
.proc_info  = ips_proc_info,
.slave_configure= ips_slave_configure,
-#else
-   .proc_info  = ips_proc24_info,
-   .select_queue_depths= ips_select_queue_depth,
-#endif
.bios_param = ips_biosparam,
.this_id= -1,
.sg_tablesize   = IPS_MAX_SG,
.cmd_per_lun= 3,
.use_clustering = ENABLE_CLUSTERING,
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0)
-   .use_new_eh_code= 1,
-#endif
-#if LINUX_VERSION_CODE = KERNEL_VERSION(2,4,20)LINUX_VERSION_CODE  
KERNEL_VERSION(2,5,0)
-.highmem_io  = 1,   
-#endif
 };
 
 
@@ -731,7 +707,7 @@ ips_release(struct Scsi_Host *sh)
/* free IRQ */
free_irq(ha-irq, ha);
 
-   IPS_REMOVE_HOST(sh);
+   scsi_remove_host(sh);
scsi_host_put(sh);
 
ips_released_controllers++;
@@ -813,7 +789,6 @@ int ips_eh_abort(struct scsi_cmnd *SC)
ips_ha_t *ha;
ips_copp_wait_item_t *item;
int ret;
-   unsigned long cpu_flags;
struct Scsi_Host *host;
 
METHOD_TRACE(ips_eh_abort, 1);
@@ -830,7 +805,7 @@ int ips_eh_abort(struct scsi_cmnd *SC)
if (!ha-active)
return (FAILED);
 
-   IPS_LOCK_SAVE(host-host_lock, cpu_flags);
+   spin_lock(host-host_lock);
 
/* See if the command is on the copp queue */
item = ha-copp_waitlist.head;
@@ -851,7 +826,7 @@ int ips_eh_abort(struct scsi_cmnd *SC)
ret = (FAILED);
}
 
-   IPS_UNLOCK_RESTORE(host-host_lock, cpu_flags);
+   spin_unlock(host-host_lock);
return ret;
 }
 
@@ -1176,18 +1151,10 @@ static int ips_queue(struct scsi_cmnd *S
 /*   Set bios geometry for the controller   */
 /*  */
 //
-static int
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0)
-ips_biosparam(Disk * disk, kdev_t dev, int geom[])
-{
-   ips_ha_t *ha = (ips_ha_t *) disk-device-host-hostdata;
-   unsigned long capacity = disk-capacity;
-#else
-ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
- sector_t capacity, int geom[])
+static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev,
+sector_t capacity, int geom[])
 {
ips_ha_t *ha = (ips_ha_t *) sdev-host-hostdata;
-#endif
int heads;
int sectors;
int cylinders;
@@ -1225,70 +1192,6 @@ ips_biosparam(struct scsi_device *sdev, 
return (0);
 }
 
-#if LINUX_VERSION_CODE  KERNEL_VERSION(2,5,0)
-
-/* ips_proc24_info is a wrapper around ips_proc_info *
- * for compatibility with the 2.4 scsi parameters*/
-static int
-ips_proc24_info(char *buffer, char **start, off_t offset, int length,
- int hostno, int func)
-{
-   int i;
-
-   for (i = 0; i  ips_next_controller; i++) {
-   if (ips_sh[i]  ips_sh[i]-host_no == hostno) {
-   return ips_proc_info(ips_sh[i], buffer, start,
-offset, length, func);
-   }
-   }
-   return -EINVAL; 
-}
-
-//
-/*

[patch 12/25] PCI Error Recovery: Symbios SCSI base support

2007-05-23 Thread akpm
From: Linas Vepstas [EMAIL PROTECTED]

Various PCI bus errors can be signaled by newer PCI controllers.  This
patch adds the PCI error recovery callbacks to the Symbios SCSI device
driver.  The patch has been tested, and appears to work well.

Signed-off-by: Linas Vepstas [EMAIL PROTECTED]
Cc: Matthew Wilcox [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/sym53c8xx_2/sym_glue.c |  136 ++
 drivers/scsi/sym53c8xx_2/sym_glue.h |4 
 drivers/scsi/sym53c8xx_2/sym_hipd.c |6 +
 3 files changed, 146 insertions(+)

diff -puN 
drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-base-support
 drivers/scsi/sym53c8xx_2/sym_glue.c
--- 
a/drivers/scsi/sym53c8xx_2/sym_glue.c~pci-error-recovery-symbios-scsi-base-support
+++ a/drivers/scsi/sym53c8xx_2/sym_glue.c
@@ -657,6 +657,10 @@ static irqreturn_t sym53c8xx_intr(int ir
unsigned long flags;
struct sym_hcb *np = (struct sym_hcb *)dev_id;
 
+   /* Avoid spinloop trying to handle interrupts on frozen device */
+   if (pci_channel_offline(np-s.device))
+   return IRQ_HANDLED;
+
if (DEBUG_FLAGS  DEBUG_TINY) printf_debug ([);
 
spin_lock_irqsave(np-s.host-host_lock, flags);
@@ -726,6 +730,20 @@ static int sym_eh_handler(int op, char *
 
dev_warn(cmd-device-sdev_gendev, %s operation started.\n, opname);
 
+   /* We may be in an error condition because the PCI bus
+* went down. In this case, we need to wait until the
+* PCI bus is reset, the card is reset, and only then
+* proceed with the scsi error recovery.  There's no
+* point in hurrying; take a leisurely wait.
+*/
+#define WAIT_FOR_PCI_RECOVERY  35
+   if (pci_channel_offline(np-s.device)) {
+   int finished_reset = wait_for_completion_timeout(
+   np-s.io_reset_wait, WAIT_FOR_PCI_RECOVERY*HZ);
+   if (!finished_reset)
+   return SCSI_FAILED;
+   }
+
spin_lock_irq(host-host_lock);
/* This one is queued in some place - to wait for completion */
FOR_EACH_QUEUED_ELEMENT(np-busy_ccbq, qp) {
@@ -1510,6 +1528,7 @@ static struct Scsi_Host * __devinit sym_
np-maxoffs = dev-chip.offset_max;
np-maxburst= dev-chip.burst_max;
np-myaddr  = dev-host_id;
+   init_completion(np-s.io_reset_wait);
 
/*
 *  Edit its name.
@@ -1948,6 +1967,116 @@ static void __devexit sym2_remove(struct
attach_count--;
 }
 
+/**
+ * sym2_io_error_detected() -- called when PCI error is detected
+ * @pdev: pointer to PCI device
+ * @state: current state of the PCI slot
+ */
+static pci_ers_result_t sym2_io_error_detected(struct pci_dev *pdev,
+ enum pci_channel_state state)
+{
+   struct sym_hcb *np = pci_get_drvdata(pdev);
+
+   /* If slot is permanently frozen, turn everything off */
+   if (state == pci_channel_io_perm_failure) {
+   sym2_remove(pdev);
+   return PCI_ERS_RESULT_DISCONNECT;
+   }
+
+   init_completion(np-s.io_reset_wait);
+   disable_irq(pdev-irq);
+   pci_disable_device(pdev);
+
+   /* Request a slot reset. */
+   return PCI_ERS_RESULT_NEED_RESET;
+}
+
+/**
+ * sym2_reset_workarounds -- hardware-specific work-arounds
+ *
+ * This routine is similar to sym_set_workarounds(), except
+ * that, at this point, we already know that the device was
+ * succesfully intialized at least once before, and so most
+ * of the steps taken there are un-needed here.
+ */
+static void sym2_reset_workarounds(struct pci_dev *pdev)
+{
+   u_char revision;
+   u_short status_reg;
+   struct sym_chip *chip;
+
+   pci_read_config_byte(pdev, PCI_CLASS_REVISION, revision);
+   chip = sym_lookup_chip_table(pdev-device, revision);
+
+   /* Work around for errant bit in 895A, in a fashion
+* similar to what is done in sym_set_workarounds().
+*/
+   pci_read_config_word(pdev, PCI_STATUS, status_reg);
+   if (!(chip-features  FE_66MHZ)  (status_reg  PCI_STATUS_66MHZ)) {
+   status_reg = PCI_STATUS_66MHZ;
+   pci_write_config_word(pdev, PCI_STATUS, status_reg);
+   pci_read_config_word(pdev, PCI_STATUS, status_reg);
+   }
+}
+
+/**
+ * sym2_io_slot_reset() -- called when the pci bus has been reset.
+ * @pdev: pointer to PCI device
+ *
+ * Restart the card from scratch.
+ */
+static pci_ers_result_t sym2_io_slot_reset(struct pci_dev *pdev)
+{
+   struct sym_hcb *np = pci_get_drvdata(pdev);
+
+   printk(KERN_INFO %s: recovering from a PCI slot reset\n,
+ sym_name(np));
+
+   if (pci_enable_device(pdev)) {
+   printk(KERN_ERR %s: Unable to enable afer PCI reset\n,
+   sym_name(np));
+   return PCI_ERS_RESULT_DISCONNECT;
+   }
+
+   pci_set_master(pdev);
+   

Re: [patch 14/25] SCSI: use irq_handler_t where appropriate

2007-05-23 Thread Jeff Garzik

[EMAIL PROTECTED] wrote:

From: Jeff Garzik [EMAIL PROTECTED]

Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/aacraid/aacraid.h |2 +-
 drivers/scsi/qla2xxx/qla_isr.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


hrm.  This appears to have been sent to linux-scsi at least three times.

If it doesn't stick, I'll go ahead and send it up myself.

Jeff



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


Re: [patch 14/25] SCSI: use irq_handler_t where appropriate

2007-05-23 Thread Andrew Morton
On Wed, 23 May 2007 18:07:35 -0400
Jeff Garzik [EMAIL PROTECTED] wrote:

 [EMAIL PROTECTED] wrote:
  From: Jeff Garzik [EMAIL PROTECTED]
  
  Signed-off-by: Jeff Garzik [EMAIL PROTECTED]
  Signed-off-by: Andrew Morton [EMAIL PROTECTED]
  ---
  
   drivers/scsi/aacraid/aacraid.h |2 +-
   drivers/scsi/qla2xxx/qla_isr.c |2 +-
   2 files changed, 2 insertions(+), 2 deletions(-)
 
 hrm.  This appears to have been sent to linux-scsi at least three times.

One of these patches is appearing on linux-scsi for the fifteenth time.

 If it doesn't stick, I'll go ahead and send it up myself.

Well I've had it.  If nothing happens this time I shall re-review the
ancient and neglected patches and I will merge them up myself.

-
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 07/25] scsi: cover up bugs^W^W^WFix up compiler warnings in megaraid driver

2007-05-23 Thread James Bottomley
On Wed, 2007-05-23 at 14:41 -0700, [EMAIL PROTECTED] wrote:
 From: Martin Bligh [EMAIL PROTECTED]
 
 Fix up compiler warnings in megaraid driver
 
 [EMAIL PROTECTED]: build fix]
 Signed-off-by: Martin J. Bligh [EMAIL PROTECTED]
 Cc: James Bottomley [EMAIL PROTECTED]
 Signed-off-by: Andrew Morton [EMAIL PROTECTED]
 ---
 
  drivers/scsi/megaraid.c |   22 +-
  1 files changed, 13 insertions(+), 9 deletions(-)
 
 diff -puN 
 drivers/scsi/megaraid.c~scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver
  drivers/scsi/megaraid.c
 --- 
 a/drivers/scsi/megaraid.c~scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver
 +++ a/drivers/scsi/megaraid.c
 @@ -73,10 +73,14 @@ static unsigned short int max_mbox_busy_
  module_param(max_mbox_busy_wait, ushort, 0);
  MODULE_PARM_DESC(max_mbox_busy_wait, Maximum wait for mailbox in 
 microseconds if busy (default=MBOX_BUSY_WAIT=10));
  
 -#define RDINDOOR(adapter)readl((adapter)-mmio_base + 0x20)
 -#define RDOUTDOOR(adapter)   readl((adapter)-mmio_base + 0x2C)
 -#define WRINDOOR(adapter,value)   writel(value, (adapter)-mmio_base + 
 0x20)
 -#define WROUTDOOR(adapter,value) writel(value, (adapter)-mmio_base + 0x2C)
 +#define RDINDOOR(adapter)readl((volatile void __iomem *) \
 + (adapter)-base + 0x20)
 +#define RDOUTDOOR(adapter)   readl((volatile void __iomem *) \
 + (adapter)-base + 0x2C)
 +#define WRINDOOR(adapter,value)  writel(value, (volatile void 
 __iomem *)\
 + (adapter)-base + 0x20)
 +#define WROUTDOOR(adapter,value) writel(value, (volatile void __iomem *)\
 + (adapter)-base + 0x2C)

This is both unnecessary and wrong ... it coerces the iomem value and
would squelch the useful warnings gcc would issue if base ever lost its
iomem annotation.

  /*
   * Global variables
 @@ -3571,7 +3575,7 @@ megadev_ioctl(struct inode *inode, struc
   /*
* The user passthru structure
*/
 - upthru = (mega_passthru __user *)MBOX(uioc)-xferaddr;
 + upthru = (mega_passthru __user *)(unsigned 
 long)MBOX(uioc)-xferaddr;
  
   /*
* Copy in the user passthru here.
 @@ -3623,7 +3627,7 @@ megadev_ioctl(struct inode *inode, struc
   /*
* Get the user data
*/
 - if( copy_from_user(data, (char __user 
 *)uxferaddr,
 + if( copy_from_user(data, (char __user 
 *)(unsigned long) uxferaddr,
   pthru-dataxferlen) ) {
   rval = (-EFAULT);
   goto freemem_and_return;
 @@ -3649,7 +3653,7 @@ megadev_ioctl(struct inode *inode, struc
* Is data going up-stream
*/
   if( pthru-dataxferlen  (uioc.flags  UIOC_RD) ) {
 - if( copy_to_user((char __user *)uxferaddr, data,
 + if( copy_to_user((char __user *)(unsigned long) 
 uxferaddr, data,
   pthru-dataxferlen) ) {
   rval = (-EFAULT);
   }
 @@ -3702,7 +3706,7 @@ freemem_and_return:
   /*
* Get the user data
*/
 - if( copy_from_user(data, (char __user 
 *)uxferaddr,
 + if( copy_from_user(data, (char __user 
 *)(unsigned long) uxferaddr,
   uioc.xferlen) ) {
  
   pci_free_consistent(pdev,
 @@ -3742,7 +3746,7 @@ freemem_and_return:
* Is data going up-stream
*/
   if( uioc.xferlen  (uioc.flags  UIOC_RD) ) {
 - if( copy_to_user((char __user *)uxferaddr, data,
 + if( copy_to_user((char __user *)(unsigned long) 
 uxferaddr, data,
   uioc.xferlen) ) {
  
   rval = (-EFAULT);

This lot, I think are all OK.  The mbox descriptor can only handle 32
bits.  However, the mbox itself is in PCI consistent memory, which, by
definition on all platforms is in the first 4GB unless you raise the
consistent dma mask.  If that's true, it's not covering up anything
other than a spurious compiler error.

Would be nice to get an ack from the maintainer to this, though.

James


-
To unsubscribe from this list: send 

Re: [patch 07/25] scsi: cover up bugs^W^W^WFix up compiler warnings in megaraid driver

2007-05-23 Thread James Bottomley
On Wed, 2007-05-23 at 15:54 -0700, Martin Bligh wrote:
 James Bottomley wrote:
  On Wed, 2007-05-23 at 14:41 -0700, [EMAIL PROTECTED] wrote:
  From: Martin Bligh [EMAIL PROTECTED]
 
  Fix up compiler warnings in megaraid driver
 
  [EMAIL PROTECTED]: build fix]
  Signed-off-by: Martin J. Bligh [EMAIL PROTECTED]
  Cc: James Bottomley [EMAIL PROTECTED]
  Signed-off-by: Andrew Morton [EMAIL PROTECTED]
  ---
 
   drivers/scsi/megaraid.c |   22 +-
   1 files changed, 13 insertions(+), 9 deletions(-)
 
  diff -puN 
  drivers/scsi/megaraid.c~scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver
   drivers/scsi/megaraid.c
  --- 
  a/drivers/scsi/megaraid.c~scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver
  +++ a/drivers/scsi/megaraid.c
  @@ -73,10 +73,14 @@ static unsigned short int max_mbox_busy_
   module_param(max_mbox_busy_wait, ushort, 0);
   MODULE_PARM_DESC(max_mbox_busy_wait, Maximum wait for mailbox in 
  microseconds if busy (default=MBOX_BUSY_WAIT=10));
   
  -#define RDINDOOR(adapter) readl((adapter)-mmio_base + 0x20)
  -#define RDOUTDOOR(adapter)readl((adapter)-mmio_base + 0x2C)
  -#define WRINDOOR(adapter,value)writel(value, (adapter)-mmio_base + 
  0x20)
  -#define WROUTDOOR(adapter,value) writel(value, (adapter)-mmio_base + 
  0x2C)
  +#define RDINDOOR(adapter) readl((volatile void __iomem *) \
  +  (adapter)-base + 0x20)
  +#define RDOUTDOOR(adapter)readl((volatile void __iomem *) 
  \
  +  (adapter)-base + 0x2C)
  +#define WRINDOOR(adapter,value)   writel(value, (volatile void 
  __iomem *)\
  +  (adapter)-base + 0x20)
  +#define WROUTDOOR(adapter,value)  writel(value, (volatile void __iomem *)\
  +  (adapter)-base + 0x2C)
  
  This is both unnecessary and wrong ... it coerces the iomem value and
  would squelch the useful warnings gcc would issue if base ever lost its
  iomem annotation.
 
 Is there another, better, way to stop it spewing compile warnings like
 something out of a horror movie?

It only spews pointer to int conversion warnings on 64 bit for the four
cases you identified below this.  I suspect the above is a remnant from
before the driver was converted to the __iomem annotations ... it should
now be unnecessary because the (adapter)-base has an __iomem
annotation).

James


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


Re: [patch 14/25] SCSI: use irq_handler_t where appropriate

2007-05-23 Thread David Miller
From: Jeff Garzik [EMAIL PROTECTED]
Date: Wed, 23 May 2007 18:07:35 -0400

 hrm.  This appears to have been sent to linux-scsi at least three times.
 
 If it doesn't stick, I'll go ahead and send it up myself.

The latency on linux-scsi review and integration of patches is not so
hot lately, or perhaps I've only been paying attention recently
and this is how things always have been.
-
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 07/25] scsi: cover up bugs^W^W^WFix up compiler warnings in megaraid driver

2007-05-23 Thread Andrew Morton
On Wed, 23 May 2007 17:52:40 -0500
James Bottomley [EMAIL PROTECTED] wrote:

 On Wed, 2007-05-23 at 14:41 -0700, [EMAIL PROTECTED] wrote:
  From: Martin Bligh [EMAIL PROTECTED]
  
  Fix up compiler warnings in megaraid driver
  
  [EMAIL PROTECTED]: build fix]
  Signed-off-by: Martin J. Bligh [EMAIL PROTECTED]
  Cc: James Bottomley [EMAIL PROTECTED]
  Signed-off-by: Andrew Morton [EMAIL PROTECTED]
  ---
  
   drivers/scsi/megaraid.c |   22 +-
   1 files changed, 13 insertions(+), 9 deletions(-)
  
  diff -puN 
  drivers/scsi/megaraid.c~scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver
   drivers/scsi/megaraid.c
  --- 
  a/drivers/scsi/megaraid.c~scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver
  +++ a/drivers/scsi/megaraid.c
  @@ -73,10 +73,14 @@ static unsigned short int max_mbox_busy_
   module_param(max_mbox_busy_wait, ushort, 0);
   MODULE_PARM_DESC(max_mbox_busy_wait, Maximum wait for mailbox in 
  microseconds if busy (default=MBOX_BUSY_WAIT=10));
   
  -#define RDINDOOR(adapter)  readl((adapter)-mmio_base + 0x20)
  -#define RDOUTDOOR(adapter) readl((adapter)-mmio_base + 0x2C)
  -#define WRINDOOR(adapter,value) writel(value, (adapter)-mmio_base + 
  0x20)
  -#define WROUTDOOR(adapter,value) writel(value, (adapter)-mmio_base + 0x2C)
  +#define RDINDOOR(adapter)  readl((volatile void __iomem *) \
  +   (adapter)-base + 0x20)
  +#define RDOUTDOOR(adapter) readl((volatile void __iomem *) \
  +   (adapter)-base + 0x2C)
  +#define WRINDOOR(adapter,value)writel(value, (volatile void 
  __iomem *)\
  +   (adapter)-base + 0x20)
  +#define WROUTDOOR(adapter,value)   writel(value, (volatile void __iomem *)\
  +   (adapter)-base + 0x2C)
 
 This is both unnecessary and wrong ... it coerces the iomem value and
 would squelch the useful warnings gcc would issue if base ever lost its
 iomem annotation.

hm, I removed that part and I'm still not getting any warnings.

Actually it looks wrong anyway - it replaced mio_base with base.

   /*
* Global variables
  @@ -3571,7 +3575,7 @@ megadev_ioctl(struct inode *inode, struc
  /*
   * The user passthru structure
   */
  -   upthru = (mega_passthru __user *)MBOX(uioc)-xferaddr;
  +   upthru = (mega_passthru __user *)(unsigned 
  long)MBOX(uioc)-xferaddr;
   
  /*
   * Copy in the user passthru here.
  @@ -3623,7 +3627,7 @@ megadev_ioctl(struct inode *inode, struc
  /*
   * Get the user data
   */
  -   if( copy_from_user(data, (char __user 
  *)uxferaddr,
  +   if( copy_from_user(data, (char __user 
  *)(unsigned long) uxferaddr,
  pthru-dataxferlen) ) {
  rval = (-EFAULT);
  goto freemem_and_return;
  @@ -3649,7 +3653,7 @@ megadev_ioctl(struct inode *inode, struc
   * Is data going up-stream
   */
  if( pthru-dataxferlen  (uioc.flags  UIOC_RD) ) {
  -   if( copy_to_user((char __user *)uxferaddr, data,
  +   if( copy_to_user((char __user *)(unsigned long) 
  uxferaddr, data,
  pthru-dataxferlen) ) {
  rval = (-EFAULT);
  }
  @@ -3702,7 +3706,7 @@ freemem_and_return:
  /*
   * Get the user data
   */
  -   if( copy_from_user(data, (char __user 
  *)uxferaddr,
  +   if( copy_from_user(data, (char __user 
  *)(unsigned long) uxferaddr,
  uioc.xferlen) ) {
   
  pci_free_consistent(pdev,
  @@ -3742,7 +3746,7 @@ freemem_and_return:
   * Is data going up-stream
   */
  if( uioc.xferlen  (uioc.flags  UIOC_RD) ) {
  -   if( copy_to_user((char __user *)uxferaddr, data,
  +   if( copy_to_user((char __user *)(unsigned long) 
  uxferaddr, data,
  uioc.xferlen) ) {
   
  rval = (-EFAULT);
 
 This lot, I think are all OK.  The mbox descriptor can only handle 32
 bits.  However, the mbox itself is in PCI consistent memory, which, by
 definition on all platforms is in the first 4GB unless you raise the
 

[patch 1/1] scsi: cover up bugs^W^W^WFix up compiler warnings in megaraid driver

2007-05-23 Thread akpm
From: Martin Bligh [EMAIL PROTECTED]

Fix up compiler warnings in megaraid driver

Signed-off-by: Martin J. Bligh [EMAIL PROTECTED]
Cc: James Bottomley [EMAIL PROTECTED]
Signed-off-by: Andrew Morton [EMAIL PROTECTED]
---

 drivers/scsi/megaraid.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff -puN 
drivers/scsi/megaraid.c~scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver
 drivers/scsi/megaraid.c
--- 
a/drivers/scsi/megaraid.c~scsi-cover-up-bugs-fix-up-compiler-warnings-in-megaraid-driver
+++ a/drivers/scsi/megaraid.c
@@ -3571,7 +3571,7 @@ megadev_ioctl(struct inode *inode, struc
/*
 * The user passthru structure
 */
-   upthru = (mega_passthru __user *)MBOX(uioc)-xferaddr;
+   upthru = (mega_passthru __user *)(unsigned 
long)MBOX(uioc)-xferaddr;
 
/*
 * Copy in the user passthru here.
@@ -3623,7 +3623,7 @@ megadev_ioctl(struct inode *inode, struc
/*
 * Get the user data
 */
-   if( copy_from_user(data, (char __user 
*)uxferaddr,
+   if( copy_from_user(data, (char __user 
*)(unsigned long) uxferaddr,
pthru-dataxferlen) ) {
rval = (-EFAULT);
goto freemem_and_return;
@@ -3649,7 +3649,7 @@ megadev_ioctl(struct inode *inode, struc
 * Is data going up-stream
 */
if( pthru-dataxferlen  (uioc.flags  UIOC_RD) ) {
-   if( copy_to_user((char __user *)uxferaddr, data,
+   if( copy_to_user((char __user *)(unsigned long) 
uxferaddr, data,
pthru-dataxferlen) ) {
rval = (-EFAULT);
}
@@ -3702,7 +3702,7 @@ freemem_and_return:
/*
 * Get the user data
 */
-   if( copy_from_user(data, (char __user 
*)uxferaddr,
+   if( copy_from_user(data, (char __user 
*)(unsigned long) uxferaddr,
uioc.xferlen) ) {
 
pci_free_consistent(pdev,
@@ -3742,7 +3742,7 @@ freemem_and_return:
 * Is data going up-stream
 */
if( uioc.xferlen  (uioc.flags  UIOC_RD) ) {
-   if( copy_to_user((char __user *)uxferaddr, data,
+   if( copy_to_user((char __user *)(unsigned long) 
uxferaddr, data,
uioc.xferlen) ) {
 
rval = (-EFAULT);
_
-
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 02/25] drivers/scsi/advansys.c: cleanups

2007-05-23 Thread James Bottomley
On Wed, 2007-05-23 at 14:41 -0700, [EMAIL PROTECTED] wrote:
 From: Adrian Bunk [EMAIL PROTECTED]
 
 - remove the unneeded advansys.h
 - remove the unused advansys_setup()

This isn't quite right, though, is it?  advansys_setup() should be used.

It looks like there was a bogus conversion away from init/main.c which
left the function dangling.  Isn't the correct thing to do to wire it up
in advansys_detect() which is where it should have been in the first
place.

James


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


Re: [patch 02/25] drivers/scsi/advansys.c: cleanups

2007-05-23 Thread Andrew Morton
On Wed, 23 May 2007 18:21:31 -0500
James Bottomley [EMAIL PROTECTED] wrote:

 On Wed, 2007-05-23 at 14:41 -0700, [EMAIL PROTECTED] wrote:
  From: Adrian Bunk [EMAIL PROTECTED]
  
  - remove the unneeded advansys.h
  - remove the unused advansys_setup()
 
 This isn't quite right, though, is it?  advansys_setup() should be used.
 
 It looks like there was a bogus conversion away from init/main.c which
 left the function dangling.  Isn't the correct thing to do to wire it up
 in advansys_detect() which is where it should have been in the first
 place.
 

Even going back to linux-2.4.2 I can find no caller to advansys_setup(). 
Or was its call buried in the magical template macros?

-
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/8] qla4xxx: Resubmission of patches to add IPv6 support etc

2007-05-23 Thread David C Somayajulu
This series of patches is a resubmission of the previous patch under the title 
[RFC] [PATCH]  qla4xxx: Updated add IPv6 and misc support bugfixes cleanup as 
set of smaller patches per Mike Christie's advice/feedback. They contain the 
following:
1. Support for IPv6 and QLA4032.
2. Bug fixes and clean up to confirm to linux coding style.

Thanks
David Somayajulu 
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 1/8] qla4xxx: Resubmission: ql4_dbg.c remove dead code

2007-05-23 Thread David C Somayajulu
Remove dead code

Signed-off-by: David Somayajulu [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]

 drivers/scsi/qla4xxx/ql4_dbg.c |  174 +---
 1 files changed, 3 insertions(+), 171 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_dbg.c b/drivers/scsi/qla4xxx/ql4_dbg.c
index 6437d02..fcc184c 100644
--- a/drivers/scsi/qla4xxx/ql4_dbg.c
+++ b/drivers/scsi/qla4xxx/ql4_dbg.c
@@ -6,176 +6,9 @@
  */
 
 #include ql4_def.h
-#include scsi/scsi_dbg.h
-
-#if 0
-
-static void qla4xxx_print_srb_info(struct srb * srb)
-{
-   printk(%s: srb = 0x%p, flags=0x%02x\n, __func__, srb, srb-flags);
-   printk(%s: cmd = 0x%p, saved_dma_handle = 0x%lx\n,
-  __func__, srb-cmd, (unsigned long) srb-dma_handle);
-   printk(%s: fw_ddb_index = %d, lun = %d\n,
-  __func__, srb-fw_ddb_index, srb-cmd-device-lun);
-   printk(%s: iocb_tov = %d\n,
-  __func__, srb-iocb_tov);
-   printk(%s: cc_stat = 0x%x, r_start = 0x%lx, u_start = 0x%lx\n\n,
-  __func__, srb-cc_stat, srb-r_start, srb-u_start);
-}
-
-void qla4xxx_print_scsi_cmd(struct scsi_cmnd *cmd)
-{
-   printk(SCSI Command = 0x%p, Handle=0x%p\n, cmd, cmd-host_scribble);
-   printk(  b=%d, t=%02xh, l=%02xh, cmd_len = %02xh\n,
-  cmd-device-channel, cmd-device-id, cmd-device-lun,
-  cmd-cmd_len);
-   scsi_print_command(cmd);
-   printk(  seg_cnt = %d\n, cmd-use_sg);
-   printk(  request buffer = 0x%p, request buffer len = 0x%x\n,
-  cmd-request_buffer, cmd-request_bufflen);
-   if (cmd-use_sg) {
-   struct scatterlist *sg;
-   sg = (struct scatterlist *)cmd-request_buffer;
-   printk(  SG buffer: \n);
-   qla4xxx_dump_buffer((caddr_t) sg,
-   (cmd-use_sg * sizeof(*sg)));
-   }
-   printk(  tag = %d, transfersize = 0x%x \n, cmd-tag,
-  cmd-transfersize);
-   printk(  Pid = %d, SP = 0x%p\n, (int)cmd-pid, cmd-SCp.ptr);
-   printk(  underflow size = 0x%x, direction=0x%x\n, cmd-underflow,
-  cmd-sc_data_direction);
-   printk(  Current time (jiffies) = 0x%lx, 
-  timeout expires = 0x%lx\n, jiffies, cmd-eh_timeout.expires);
-   qla4xxx_print_srb_info((struct srb *) cmd-SCp.ptr);
-}
-
-void __dump_registers(struct scsi_qla_host *ha)
-{
-   uint8_t i;
-   for (i = 0; i  MBOX_REG_COUNT; i++) {
-   printk(KERN_INFO 0x%02X mailbox[%d]  = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg, mailbox[i]), i,
-  readw(ha-reg-mailbox[i]));
-   }
-   printk(KERN_INFO 0x%02X flash_address   = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg, flash_address),
-  readw(ha-reg-flash_address));
-   printk(KERN_INFO 0x%02X flash_data  = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg, flash_data),
-  readw(ha-reg-flash_data));
-   printk(KERN_INFO 0x%02X ctrl_status = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg, ctrl_status),
-  readw(ha-reg-ctrl_status));
-   if (is_qla4010(ha)) {
-   printk(KERN_INFO 0x%02X nvram   = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg, u1.isp4010.nvram),
-  readw(ha-reg-u1.isp4010.nvram));
-   }
-
-   else if (is_qla4022(ha) | is_qla4032(ha)) {
-   printk(KERN_INFO 0x%02X intr_mask   = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg,
- u1.isp4022.intr_mask),
-  readw(ha-reg-u1.isp4022.intr_mask));
-   printk(KERN_INFO 0x%02X nvram   = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg, u1.isp4022.nvram),
-  readw(ha-reg-u1.isp4022.nvram));
-   printk(KERN_INFO 0x%02X semaphore   = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg,
- u1.isp4022.semaphore),
-  readw(ha-reg-u1.isp4022.semaphore));
-   }
-   printk(KERN_INFO 0x%02X req_q_in= 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg, req_q_in),
-  readw(ha-reg-req_q_in));
-   printk(KERN_INFO 0x%02X rsp_q_out   = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg, rsp_q_out),
-  readw(ha-reg-rsp_q_out));
-   if (is_qla4010(ha)) {
-   printk(KERN_INFO 0x%02X ext_hw_conf = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg,
- u2.isp4010.ext_hw_conf),
-  readw(ha-reg-u2.isp4010.ext_hw_conf));
-   printk(KERN_INFO 0x%02X port_ctrl   = 0x%08X\n,
-  (uint8_t) offsetof(struct isp_reg,
- u2.isp4010.port_ctrl),
-  

[PATCH 2/8] qla4xxx: Resubmission: ql4_def.h log all AENs and cleanup

2007-05-23 Thread David C Somayajulu
Add support for logging all AENs and clean up

Signed-off-by: David Somayajulu [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]

 drivers/scsi/qla4xxx/ql4_def.h |   78 
 1 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 6f4cf2d..accaf69 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -122,8 +122,7 @@ #define MAX_REQS_SERVICED_PER_INTR  16
 
 #define ISCSI_IPADDR_SIZE  4   /* IP address size */
 #define ISCSI_ALIAS_SIZE   32  /* ISCSI Alais name size */
-#define ISCSI_NAME_SIZE255 /* ISCSI Name size -
-* usually a string */
+#define ISCSI_NAME_SIZE0xE0/* ISCSI Name size */
 
 #define LSDW(x) ((u32)((u64)(x)))
 #define MSDW(x) ((u32)u64)(x))  16)  16))
@@ -187,9 +186,21 @@ #define SRB_ERR_OTHER 4
u_long u_start; /* Time when we handed the cmd to F/W */
 };
 
-   /*
-* Device Database (DDB) structure
-*/
+/*
+ * Asynchronous Event Queue structure
+ */
+struct aen {
+uint32_t mbox_sts[MBOX_AEN_REG_COUNT];
+};
+
+struct ql4_aen_log {
+int count;
+struct aen entry[MAX_AEN_ENTRIES];
+};
+
+/*
+ * Device Database (DDB) structure
+ */
 struct ddb_entry {
struct list_head list;  /* ddb list */
struct scsi_qla_host *ha;
@@ -254,13 +265,6 @@ #define DF_NO_RELOGIN  1   /* Do not relog
 #define DF_ISNS_DISCOVERED 2   /* Device was discovered via iSNS */
 #define DF_FO_MASKED   3
 
-/*
- * Asynchronous Event Queue structure
- */
-struct aen {
-   uint32_t mbox_sts[MBOX_AEN_REG_COUNT];
-};
-
 
 #include ql4_fw.h
 #include ql4_nvram.h
@@ -270,31 +274,31 @@ #include ql4_nvram.h
  */
 struct scsi_qla_host {
/* Linux adapter configuration data */
-   struct Scsi_Host *host; /* pointer to host data */
-   uint32_t tot_ddbs;
unsigned long flags;
 
-#define AF_ONLINE0 /* 0x0001 */
-#define AF_INIT_DONE 1 /* 0x0002 */
-#define AF_MBOX_COMMAND  2 /* 0x0004 */
-#define AF_MBOX_COMMAND_DONE 3 /* 0x0008 */
-#define AF_INTERRUPTS_ON 6 /* 0x0040 Not Used */
-#define AF_GET_CRASH_RECORD  7 /* 0x0080 */
-#define AF_LINK_UP   8 /* 0x0100 */
-#define AF_IRQ_ATTACHED 10 /* 0x0400 */
-#define AF_ISNS_CMD_IN_PROCESS  12 /* 0x1000 */
-#define AF_ISNS_CMD_DONE13 /* 0x2000 */
+#define AF_ONLINE  0 /* 0x0001 */
+#define AF_INIT_DONE   1 /* 0x0002 */
+#define AF_MBOX_COMMAND2 /* 0x0004 */
+#define AF_MBOX_COMMAND_DONE   3 /* 0x0008 */
+#define AF_INTERRUPTS_ON   6 /* 0x0040 */
+#define AF_GET_CRASH_RECORD7 /* 0x0080 */
+#define AF_LINK_UP 8 /* 0x0100 */
+#define AF_IRQ_ATTACHED10 /* 0x0400 */
+#define AF_DISABLE_ACB_COMPLETE11 /* 0x0800 */
 
unsigned long dpc_flags;
 
-#define DPC_RESET_HA 1 /* 0x0002 */
-#define DPC_RETRY_RESET_HA   2 /* 0x0004 */
-#define DPC_RELOGIN_DEVICE   3 /* 0x0008 */
-#define DPC_RESET_HA_DESTROY_DDB_LIST 4 /* 0x0010 */
-#define DPC_RESET_HA_INTR5 /* 0x0020 */
-#define DPC_ISNS_RESTART 7 /* 0x0080 */
-#define DPC_AEN  9 /* 0x0200 */
-#define DPC_GET_DHCP_IP_ADDR15 /* 0x8000 */
+#define DPC_RESET_HA   1 /* 0x0002 */
+#define DPC_RETRY_RESET_HA 2 /* 0x0004 */
+#define DPC_RELOGIN_DEVICE 3 /* 0x0008 */
+#define DPC_RESET_HA_DESTROY_DDB_LIST  4 /* 0x0010 */
+#define DPC_RESET_HA_INTR  5 /* 0x0020 */
+#define DPC_ISNS_RESTART   7 /* 0x0080 */
+#define DPC_AEN9 /* 0x0200 */
+#define DPC_GET_DHCP_IP_ADDR   15 /* 0x8000 */
+
+   struct Scsi_Host *host; /* pointer to host data */
+   uint32_t tot_ddbs;
 
uint16_tiocb_cnt;
uint16_tiocb_hiwat;
@@ -344,6 +348,7 @@ #define MIN_IOBASE_LEN  0x100
uint32_t firmware_version[2];
uint32_t patch_number;
uint32_t build_number;
+   uint32_t board_id;
 
/* --- From Init_FW --- */
/* init_cb_t *init_cb; */
@@ -363,7 +368,6 @@ #define MIN_IOBASE_LEN  0x100
 
/* --- From GetFwState --- */
uint32_t firmware_state;
-   uint32_t board_id;
uint32_t addl_fw_state;
 
/* Linux kernel thread */
@@ -414,6 +418,8 @@ #define MEM_ALIGN_VALUE \
uint16_t aen_out;
struct aen 

[PATCH 3/8] qla4xxx: Resubmission: ql4_fw.h add support for qla4032

2007-05-23 Thread David C Somayajulu
Add support for QLA4032 which supports IPv6

Signed-off-by: David Somayajulu [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]

 drivers/scsi/qla4xxx/ql4_fw.h |  426 +
 1 files changed, 177 insertions(+), 249 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h
index 4eea8c5..9bb3d1d 100644
--- a/drivers/scsi/qla4xxx/ql4_fw.h
+++ b/drivers/scsi/qla4xxx/ql4_fw.h
@@ -20,143 +20,23 @@ #define MAX_DEV_DB_ENTRIES 512
  */
 
 struct port_ctrl_stat_regs {
-   __le32 ext_hw_conf; /*  80 x50  R/W */
-   __le32 intChipConfiguration; /*  84 x54 */
-   __le32 port_ctrl;   /*  88 x58 */
-   __le32 port_status; /*  92 x5c */
-   __le32 HostPrimMACHi;   /*  96 x60 */
-   __le32 HostPrimMACLow;  /* 100 x64 */
-   __le32 HostSecMACHi;/* 104 x68 */
-   __le32 HostSecMACLow;   /* 108 x6c */
-   __le32 EPPrimMACHi; /* 112 x70 */
-   __le32 EPPrimMACLow;/* 116 x74 */
-   __le32 EPSecMACHi;  /* 120 x78 */
-   __le32 EPSecMACLow; /* 124 x7c */
-   __le32 HostPrimIPHi;/* 128 x80 */
-   __le32 HostPrimIPMidHi; /* 132 x84 */
-   __le32 HostPrimIPMidLow;/* 136 x88 */
-   __le32 HostPrimIPLow;   /* 140 x8c */
-   __le32 HostSecIPHi; /* 144 x90 */
-   __le32 HostSecIPMidHi;  /* 148 x94 */
-   __le32 HostSecIPMidLow; /* 152 x98 */
-   __le32 HostSecIPLow;/* 156 x9c */
-   __le32 EPPrimIPHi;  /* 160 xa0 */
-   __le32 EPPrimIPMidHi;   /* 164 xa4 */
-   __le32 EPPrimIPMidLow;  /* 168 xa8 */
-   __le32 EPPrimIPLow; /* 172 xac */
-   __le32 EPSecIPHi;   /* 176 xb0 */
-   __le32 EPSecIPMidHi;/* 180 xb4 */
-   __le32 EPSecIPMidLow;   /* 184 xb8 */
-   __le32 EPSecIPLow;  /* 188 xbc */
-   __le32 IPReassemblyTimeout; /* 192 xc0 */
-   __le32 EthMaxFramePayload; /* 196 xc4 */
-   __le32 TCPMaxWindowSize; /* 200 xc8 */
-   __le32 TCPCurrentTimestampHi; /* 204 xcc */
-   __le32 TCPCurrentTimestampLow; /* 208 xd0 */
-   __le32 LocalRAMAddress; /* 212 xd4 */
-   __le32 LocalRAMData;/* 216 xd8 */
-   __le32 PCSReserved1;/* 220 xdc */
-   __le32 gp_out;  /* 224 xe0 */
-   __le32 gp_in;   /* 228 xe4 */
-   __le32 ProbeMuxAddr;/* 232 xe8 */
-   __le32 ProbeMuxData;/* 236 xec */
-   __le32 ERMQueueBaseAddr0; /* 240 xf0 */
-   __le32 ERMQueueBaseAddr1; /* 244 xf4 */
-   __le32 MACConfiguration; /* 248 xf8 */
-   __le32 port_err_status; /* 252 xfc  COR */
+   __le32 ext_hw_conf; /* 0x50  R/W */
+   __le32 rsrvd0;  /* 0x54 */
+   __le32 port_ctrl;   /* 0x58 */
+   __le32 port_status; /* 0x5c */
+   __le32 rsrvd1[32];  /* 0x60-0xdf */
+   __le32 gp_out;  /* 0xe0 */
+   __le32 gp_in;   /* 0xe4 */
+   __le32 rsrvd2[5];   /* 0xe8-0xfb */
+   __le32 port_err_status; /* 0xfc */
 };
 
 struct host_mem_cfg_regs {
-   __le32 NetRequestQueueOut; /*  80 x50 */
-   __le32 NetRequestQueueOutAddrHi; /*  84 x54 */
-   __le32 NetRequestQueueOutAddrLow; /*  88 x58 */
-   __le32 NetRequestQueueBaseAddrHi; /*  92 x5c */
-   __le32 NetRequestQueueBaseAddrLow; /*  96 x60 */
-   __le32 NetRequestQueueLength; /* 100 x64 */
-   __le32 NetResponseQueueIn; /* 104 x68 */
-   __le32 NetResponseQueueInAddrHi; /* 108 x6c */
-   __le32 NetResponseQueueInAddrLow; /* 112 x70 */
-   __le32 NetResponseQueueBaseAddrHi; /* 116 x74 */
-   __le32 NetResponseQueueBaseAddrLow; /* 120 x78 */
-   __le32 NetResponseQueueLength; /* 124 x7c */
-   __le32 req_q_out;   /* 128 x80 */
-   __le32 RequestQueueOutAddrHi; /* 132 x84 */
-   __le32 RequestQueueOutAddrLow; /* 136 x88 */
-   __le32 RequestQueueBaseAddrHi; /* 140 x8c */
-   __le32 RequestQueueBaseAddrLow; /* 144 x90 */
-   __le32 RequestQueueLength; /* 148 x94 */
-   __le32 ResponseQueueIn; /* 152 x98 */
-   __le32 ResponseQueueInAddrHi; /* 156 x9c */
-   __le32 ResponseQueueInAddrLow; /* 160 xa0 */
-   __le32 ResponseQueueBaseAddrHi; /* 164 xa4 */
-   __le32 ResponseQueueBaseAddrLow; /* 168 xa8 */
-   __le32 ResponseQueueLength; /* 172 xac */
-   __le32 NetRxLargeBufferQueueOut; /* 176 xb0 */
-   __le32 NetRxLargeBufferQueueBaseAddrHi; /* 180 xb4 */
-   __le32 NetRxLargeBufferQueueBaseAddrLow; /* 184 xb8 */
-   __le32 NetRxLargeBufferQueueLength; /* 188 xbc */
-   __le32 NetRxLargeBufferLength; /* 192 xc0 */
-   __le32 NetRxSmallBufferQueueOut; /* 196 xc4 */
-   __le32 NetRxSmallBufferQueueBaseAddrHi; /* 200 xc8 */
-   __le32 NetRxSmallBufferQueueBaseAddrLow; /* 204 xcc */
-   __le32 NetRxSmallBufferQueueLength; /* 208 xd0 */
-   __le32 NetRxSmallBufferLength; /* 212 xd4 */
-   __le32 

[PATCH 4/8] qla4xxx: Resubmission: update rev num and misc cleanup

2007-05-23 Thread David C Somayajulu
Clean up and update version number

Signed-off-by: David Somayajulu [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]

 drivers/scsi/qla4xxx/ql4_glbl.h|7 ++-
 drivers/scsi/qla4xxx/ql4_iocb.c|8 ++--
 drivers/scsi/qla4xxx/ql4_nvram.c   |3 +++
 drivers/scsi/qla4xxx/ql4_version.h |3 ++-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h
index 5b00cb0..a3608e0 100644
--- a/drivers/scsi/qla4xxx/ql4_glbl.h
+++ b/drivers/scsi/qla4xxx/ql4_glbl.h
@@ -8,6 +8,9 @@
 #ifndef __QLA4x_GBL_H
 #define__QLA4x_GBL_H
 
+struct iscsi_cls_conn;
+
+void qla4xxx_hw_reset(struct scsi_qla_host *ha);
 int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a);
 int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port);
 int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb);
@@ -58,11 +61,13 @@ int qla4xxx_get_fw_version(struct scsi_q
 void qla4xxx_interrupt_service_routine(struct scsi_qla_host * ha,
   uint32_t intr_status);
 int qla4xxx_init_rings(struct scsi_qla_host * ha);
-struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha, uint32_t 
index);
+struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha,
+   uint32_t index);
 void qla4xxx_srb_compl(struct scsi_qla_host *ha, struct srb *srb);
 int qla4xxx_reinitialize_ddb_list(struct scsi_qla_host * ha);
 int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha,
uint32_t fw_ddb_index, uint32_t state);
+void qla4xxx_dump_buffer(void *b, uint32_t size);
 
 extern int ql4xextended_error_logging;
 extern int ql4xdiscoverywait;
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index a216a17..6e3c8c8 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -6,6 +6,10 @@
  */
 
 #include ql4_def.h
+#include ql4_glbl.h
+#include ql4_dbg.h
+#include ql4_inline.h
+
 
 #include scsi/scsi_tcq.h
 
@@ -243,8 +247,8 @@ int qla4xxx_send_command_to_isp(struct s
dma_addr_t  req_dma;
 
req_dma = pci_map_single(ha-pdev, cmd-request_buffer,
-cmd-request_bufflen,
-cmd-sc_data_direction);
+cmd-request_bufflen,
+cmd-sc_data_direction);
if (dma_mapping_error(req_dma))
goto queuing_error;
 
diff --git a/drivers/scsi/qla4xxx/ql4_nvram.c b/drivers/scsi/qla4xxx/ql4_nvram.c
index 58afd13..7fe0482 100644
--- a/drivers/scsi/qla4xxx/ql4_nvram.c
+++ b/drivers/scsi/qla4xxx/ql4_nvram.c
@@ -6,6 +6,9 @@
  */
 
 #include ql4_def.h
+#include ql4_glbl.h
+#include ql4_dbg.h
+#include ql4_inline.h
 
 static inline void eeprom_cmd(uint32_t cmd, struct scsi_qla_host *ha)
 {
diff --git a/drivers/scsi/qla4xxx/ql4_version.h 
b/drivers/scsi/qla4xxx/ql4_version.h
index e5183a6..2149069 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,4 +5,5 @@
  * See LICENSE.qla4xxx for copyright and licensing details.
  */
 
-#define QLA4XXX_DRIVER_VERSION 5.00.07-k1
+#define QLA4XXX_DRIVER_VERSION 5.01.00-k7
+

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


[PATCH 4/8] qla4xxx: Resubmission: ql4_init.c bugfixes

2007-05-23 Thread David C Somayajulu
In qla4xxx_get_ddb_entry() and qla4xxx_add_device_dynamically() differentiate 
between a target which has been newly added vs a target which went offline 
temporarily and is online again.  In qla4xxx_build_ddb_list() firmware ddb 
state needs to be updated by calling qla4xxx_get_ddb_entry(). Fix 
qla4x00_pci_config() and clean up code.

Signed-off-by: David Somayajulu [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]

 drivers/scsi/qla4xxx/ql4_init.c |   92 +++
 1 files changed, 63 insertions(+), 29 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c
index 6365df2..b76ba54 100644
--- a/drivers/scsi/qla4xxx/ql4_init.c
+++ b/drivers/scsi/qla4xxx/ql4_init.c
@@ -6,6 +6,9 @@
  */
 
 #include ql4_def.h
+#include ql4_glbl.h
+#include ql4_dbg.h
+#include ql4_inline.h
 
 static struct ddb_entry * qla4xxx_alloc_ddb(struct scsi_qla_host *ha,
uint32_t fw_ddb_index);
@@ -300,12 +303,12 @@ static int qla4xxx_init_firmware(struct 
if (!qla4xxx_fw_ready(ha))
return status;
 
-   set_bit(AF_ONLINE, ha-flags);
return qla4xxx_get_firmware_status(ha);
 }
 
 static struct ddb_entry* qla4xxx_get_ddb_entry(struct scsi_qla_host *ha,
-  uint32_t fw_ddb_index)
+   uint32_t fw_ddb_index,
+   uint32_t *new_tgt)
 {
struct dev_db_entry *fw_ddb_entry = NULL;
dma_addr_t fw_ddb_entry_dma;
@@ -313,6 +316,7 @@ static struct ddb_entry* qla4xxx_get_ddb
int found = 0;
uint32_t device_state;
 
+   *new_tgt = 0;
/* Make sure the dma buffer is valid */
fw_ddb_entry = dma_alloc_coherent(ha-pdev-dev,
  sizeof(*fw_ddb_entry),
@@ -337,7 +341,7 @@ static struct ddb_entry* qla4xxx_get_ddb
DEBUG2(printk(scsi%ld: %s: Looking for ddb[%d]\n, ha-host_no,
  __func__, fw_ddb_index));
list_for_each_entry(ddb_entry, ha-ddb_list, list) {
-   if (memcmp(ddb_entry-iscsi_name, fw_ddb_entry-iscsiName,
+   if (memcmp(ddb_entry-iscsi_name, fw_ddb_entry-iscsi_name,
   ISCSI_NAME_SIZE) == 0) {
found++;
break;
@@ -348,6 +352,7 @@ static struct ddb_entry* qla4xxx_get_ddb
DEBUG2(printk(scsi%ld: %s: ddb[%d] not found - allocating 
  new ddb\n, ha-host_no, __func__,
  fw_ddb_index));
+   *new_tgt = 1;
ddb_entry = qla4xxx_alloc_ddb(ha, fw_ddb_index);
}
 
@@ -409,26 +414,26 @@ static int qla4xxx_update_ddb_entry(stru
}
 
status = QLA_SUCCESS;
-   ddb_entry-target_session_id = le16_to_cpu(fw_ddb_entry-TSID);
+   ddb_entry-target_session_id = le16_to_cpu(fw_ddb_entry-tsid);
ddb_entry-task_mgmt_timeout =
-   le16_to_cpu(fw_ddb_entry-taskMngmntTimeout);
+   le16_to_cpu(fw_ddb_entry-def_timeout);
ddb_entry-CmdSn = 0;
-   ddb_entry-exe_throttle = le16_to_cpu(fw_ddb_entry-exeThrottle);
+   ddb_entry-exe_throttle = le16_to_cpu(fw_ddb_entry-exec_throttle);
ddb_entry-default_relogin_timeout =
-   le16_to_cpu(fw_ddb_entry-taskMngmntTimeout);
-   ddb_entry-default_time2wait = le16_to_cpu(fw_ddb_entry-minTime2Wait);
+   le16_to_cpu(fw_ddb_entry-def_timeout);
+   ddb_entry-default_time2wait = 
le16_to_cpu(fw_ddb_entry-iscsi_def_time2wait);
 
/* Update index in case it changed */
ddb_entry-fw_ddb_index = fw_ddb_index;
ha-fw_ddb_index_map[fw_ddb_index] = ddb_entry;
 
-   ddb_entry-port = le16_to_cpu(fw_ddb_entry-portNumber);
-   ddb_entry-tpgt = le32_to_cpu(fw_ddb_entry-TargetPortalGroup);
-   memcpy(ddb_entry-iscsi_name[0], fw_ddb_entry-iscsiName[0],
+   ddb_entry-port = le16_to_cpu(fw_ddb_entry-port);
+   ddb_entry-tpgt = le32_to_cpu(fw_ddb_entry-tgt_portal_grp);
+   memcpy(ddb_entry-iscsi_name[0], fw_ddb_entry-iscsi_name[0],
   min(sizeof(ddb_entry-iscsi_name),
-  sizeof(fw_ddb_entry-iscsiName)));
-   memcpy(ddb_entry-ip_addr[0], fw_ddb_entry-ipAddr[0],
-  min(sizeof(ddb_entry-ip_addr), sizeof(fw_ddb_entry-ipAddr)));
+  sizeof(fw_ddb_entry-iscsi_name)));
+   memcpy(ddb_entry-ip_addr[0], fw_ddb_entry-ip_addr[0],
+  min(sizeof(ddb_entry-ip_addr), sizeof(fw_ddb_entry-ip_addr)));
 
DEBUG2(printk(scsi%ld: %s: ddb[%d] - State= %x status= %d.\n,
  ha-host_no, __func__, fw_ddb_index,
@@ -495,6 +500,7 @@ static int qla4xxx_build_ddb_list(struct
uint32_t ddb_state;
uint32_t conn_err, err_code;
struct ddb_entry *ddb_entry;
+   uint32_t new_tgt;
 
dev_info(ha-pdev-dev, Initializing 

[PATCH 6/8] qla4xxx: Resubmission: ql4_isr.c support for new mbx cmds

2007-05-23 Thread David C Somayajulu
Add support to log all AENs and service mbx cmd completions for QLA4032

Signed-off-by: David Somayajulu [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]

 drivers/scsi/qla4xxx/ql4_isr.c |   53 ++--
 1 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c
index 35b9e36..946e22b 100644
--- a/drivers/scsi/qla4xxx/ql4_isr.c
+++ b/drivers/scsi/qla4xxx/ql4_isr.c
@@ -6,6 +6,9 @@
  */
 
 #include ql4_def.h
+#include ql4_glbl.h
+#include ql4_dbg.h
+#include ql4_inline.h
 
 /**
  * qla2x00_process_completed_request() - Process a Fast Post response.
@@ -417,6 +420,7 @@ static void qla4xxx_isr_decode_mailbox(s
   uint32_t mbox_status)
 {
int i;
+   uint32_t mbox_stat2, mbox_stat3;
 
if ((mbox_status == MBOX_STS_BUSY) ||
(mbox_status == MBOX_STS_INTERMEDIATE_COMPLETION) ||
@@ -437,6 +441,12 @@ static void qla4xxx_isr_decode_mailbox(s
} else if (mbox_status  12 == MBOX_ASYNC_EVENT_STATUS) {
/* Immediately process the AENs that don't require much work.
 * Only queue the database_changed AENs */
+   if (ha-aen_log.count  MAX_AEN_ENTRIES) {
+   for (i = 0; i  MBOX_AEN_REG_COUNT; i++)
+   
ha-aen_log.entry[ha-aen_log.count].mbox_sts[i] =
+   readl(ha-reg-mailbox[i]);
+   ha-aen_log.count++;
+   }
switch (mbox_status) {
case MBOX_ASTS_SYSTEM_ERROR:
/* Log Mailbox registers */
@@ -493,6 +503,16 @@ static void qla4xxx_isr_decode_mailbox(s
  mbox_status));
break;
 
+   case MBOX_ASTS_IP_ADDR_STATE_CHANGED:
+   mbox_stat2 = readl(ha-reg-mailbox[2]);
+   mbox_stat3 = readl(ha-reg-mailbox[3]);
+
+   if ((mbox_stat3 == 5)  (mbox_stat2 == 3))
+   set_bit(DPC_GET_DHCP_IP_ADDR, ha-dpc_flags);
+   else if ((mbox_stat3 == 2)  (mbox_stat2 == 5))
+   set_bit(DPC_RESET_HA, ha-dpc_flags);
+   break;
+
case MBOX_ASTS_MAC_ADDRESS_CHANGED:
case MBOX_ASTS_DNS:
/* No action */
@@ -518,11 +538,6 @@ static void qla4xxx_isr_decode_mailbox(s
/* Queue AEN information and process it in the DPC
 * routine */
if (ha-aen_q_count  0) {
-   /* advance pointer */
-   if (ha-aen_in == (MAX_AEN_ENTRIES - 1))
-   ha-aen_in = 0;
-   else
-   ha-aen_in++;
 
/* decrement available counter */
ha-aen_q_count--;
@@ -542,6 +557,10 @@ static void qla4xxx_isr_decode_mailbox(s
  ha-aen_q[ha-aen_in].mbox_sts[2],
  ha-aen_q[ha-aen_in].mbox_sts[3],
  ha-aen_q[ha-aen_in].  
mbox_sts[4]));
+   /* advance pointer */
+   ha-aen_in++;
+   if (ha-aen_in == MAX_AEN_ENTRIES)
+   ha-aen_in = 0;
 
/* The DPC routine will process the aen */
set_bit(DPC_AEN, ha-dpc_flags);
@@ -724,25 +743,24 @@ void qla4xxx_process_aen(struct scsi_qla
 
spin_lock_irqsave(ha-hardware_lock, flags);
while (ha-aen_out != ha-aen_in) {
-   /* Advance pointers for next entry */
-   if (ha-aen_out == (MAX_AEN_ENTRIES - 1))
-   ha-aen_out = 0;
-   else
-   ha-aen_out++;
-
-   ha-aen_q_count++;
aen = ha-aen_q[ha-aen_out];
-
/* copy aen information to local structure */
for (i = 0; i  MBOX_AEN_REG_COUNT; i++)
mbox_sts[i] = aen-mbox_sts[i];
 
+   ha-aen_q_count++;
+   ha-aen_out++;
+
+   if (ha-aen_out == MAX_AEN_ENTRIES)
+   ha-aen_out = 0;
+
spin_unlock_irqrestore(ha-hardware_lock, flags);
 
-   DEBUG(printk(scsi%ld: AEN[%d] %04x, index [%d] state=%04x 
-mod=%x conerr=%08x \n, ha-host_no, ha-aen_out,
-mbox_sts[0], mbox_sts[2], mbox_sts[3],
-mbox_sts[1], mbox_sts[4]));
+   DEBUG2(printk(qla4xxx(%ld): AEN[%d]=0x%08x, mbx1=0x%08x 
mbx2=0x%08x
+mbx3=0x%08x 

[PATCH 7/8] qla4xxx: Resubmission: ql4_mbx.c remove dead code bugfixes

2007-05-23 Thread David C Somayajulu
All all inbound mbx registers for all mbx commands. Remove dead code.

Signed-off-by: David Somayajulu [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]

 drivers/scsi/qla4xxx/ql4_mbx.c |  274 +++-
 1 files changed, 103 insertions(+), 171 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c
index f116ff9..35cd73c 100644
--- a/drivers/scsi/qla4xxx/ql4_mbx.c
+++ b/drivers/scsi/qla4xxx/ql4_mbx.c
@@ -6,6 +6,9 @@
  */
 
 #include ql4_def.h
+#include ql4_glbl.h
+#include ql4_dbg.h
+#include ql4_inline.h
 
 
 /**
@@ -169,84 +172,6 @@ mbox_exit:
return status;
 }
 
-
-#if 0
-
-/**
- * qla4xxx_issue_iocb - issue mailbox iocb command
- * @ha: adapter state pointer.
- * @buffer: buffer pointer.
- * @phys_addr: physical address of buffer.
- * @size: size of buffer.
- *
- * Issues iocbs via mailbox commands.
- * TARGET_QUEUE_LOCK must be released.
- * ADAPTER_STATE_LOCK must be released.
- **/
-int
-qla4xxx_issue_iocb(struct scsi_qla_host * ha, void *buffer,
-  dma_addr_t phys_addr, size_t size)
-{
-   uint32_t mbox_cmd[MBOX_REG_COUNT];
-   uint32_t mbox_sts[MBOX_REG_COUNT];
-   int status;
-
-   memset(mbox_cmd, 0, sizeof(mbox_cmd));
-   memset(mbox_sts, 0, sizeof(mbox_sts));
-   mbox_cmd[0] = MBOX_CMD_EXECUTE_IOCB_A64;
-   mbox_cmd[1] = 0;
-   mbox_cmd[2] = LSDW(phys_addr);
-   mbox_cmd[3] = MSDW(phys_addr);
-   status = qla4xxx_mailbox_command(ha, 4, 1, mbox_cmd[0], mbox_sts[0]);
-   return status;
-}
-
-int qla4xxx_conn_close_sess_logout(struct scsi_qla_host * ha,
-  uint16_t fw_ddb_index,
-  uint16_t connection_id,
-  uint16_t option)
-{
-   uint32_t mbox_cmd[MBOX_REG_COUNT];
-   uint32_t mbox_sts[MBOX_REG_COUNT];
-
-   memset(mbox_cmd, 0, sizeof(mbox_cmd));
-   memset(mbox_sts, 0, sizeof(mbox_sts));
-   mbox_cmd[0] = MBOX_CMD_CONN_CLOSE_SESS_LOGOUT;
-   mbox_cmd[1] = fw_ddb_index;
-   mbox_cmd[2] = connection_id;
-   mbox_cmd[3] = LOGOUT_OPTION_RELOGIN;
-   if (qla4xxx_mailbox_command(ha, 4, 2, mbox_cmd[0], mbox_sts[0]) !=
-   QLA_SUCCESS) {
-   DEBUG2(printk(scsi%ld: %s: MBOX_CMD_CONN_CLOSE_SESS_LOGOUT 
- option %04x failed sts %04X %04X,
- ha-host_no, __func__,
- option, mbox_sts[0], mbox_sts[1]));
-   if (mbox_sts[0] == 0x4005)
-   DEBUG2(printk(%s reason %04X\n, __func__,
- mbox_sts[1]));
-   }
-   return QLA_SUCCESS;
-}
-
-int qla4xxx_clear_database_entry(struct scsi_qla_host * ha,
-uint16_t fw_ddb_index)
-{
-   uint32_t mbox_cmd[MBOX_REG_COUNT];
-   uint32_t mbox_sts[MBOX_REG_COUNT];
-
-   memset(mbox_cmd, 0, sizeof(mbox_cmd));
-   memset(mbox_sts, 0, sizeof(mbox_sts));
-   mbox_cmd[0] = MBOX_CMD_CLEAR_DATABASE_ENTRY;
-   mbox_cmd[1] = fw_ddb_index;
-   if (qla4xxx_mailbox_command(ha, 2, 5, mbox_cmd[0], mbox_sts[0]) !=
-   QLA_SUCCESS)
-   return QLA_ERROR;
-
-   return QLA_SUCCESS;
-}
-
-#endif  /*  0  */
-
 /**
  * qla4xxx_initialize_fw_cb - initializes firmware control block.
  * @ha: Pointer to host adapter structure.
@@ -272,10 +197,13 @@ int qla4xxx_initialize_fw_cb(struct scsi
/* Get Initialize Firmware Control Block. */
memset(mbox_cmd, 0, sizeof(mbox_cmd));
memset(mbox_sts, 0, sizeof(mbox_sts));
+
mbox_cmd[0] = MBOX_CMD_GET_INIT_FW_CTRL_BLOCK;
mbox_cmd[2] = LSDW(init_fw_cb_dma);
mbox_cmd[3] = MSDW(init_fw_cb_dma);
-   if (qla4xxx_mailbox_command(ha, 4, 1, mbox_cmd[0], mbox_sts[0]) !=
+   mbox_cmd[4] = sizeof(struct init_fw_ctrl_blk);
+
+   if (qla4xxx_mailbox_command(ha, MBOX_REG_COUNT, 1, mbox_cmd[0], 
mbox_sts[0]) !=
QLA_SUCCESS) {
dma_free_coherent(ha-pdev-dev,
  sizeof(struct init_fw_ctrl_blk),
@@ -287,51 +215,56 @@ int qla4xxx_initialize_fw_cb(struct scsi
qla4xxx_init_rings(ha);
 
/* Fill in the request and response queue information. */
-   init_fw_cb-ReqQConsumerIndex = cpu_to_le16(ha-request_out);
-   init_fw_cb-ComplQProducerIndex = cpu_to_le16(ha-response_in);
-   init_fw_cb-ReqQLen = __constant_cpu_to_le16(REQUEST_QUEUE_DEPTH);
-   init_fw_cb-ComplQLen = __constant_cpu_to_le16(RESPONSE_QUEUE_DEPTH);
-   init_fw_cb-ReqQAddrLo = cpu_to_le32(LSDW(ha-request_dma));
-   init_fw_cb-ReqQAddrHi = cpu_to_le32(MSDW(ha-request_dma));
-   init_fw_cb-ComplQAddrLo = cpu_to_le32(LSDW(ha-response_dma));
-   init_fw_cb-ComplQAddrHi = cpu_to_le32(MSDW(ha-response_dma));
-   init_fw_cb-ShadowRegBufAddrLo =
+   init_fw_cb-pri.rqq_consumer_idx = cpu_to_le16(ha-request_out);
+   

[PATCH 8/8] qla4xxx: Resubmission: ql4_os.c bugfixes

2007-05-23 Thread David C Somayajulu
Free memory resources after invoking free_irq() in qla4xxx_free_adapter(). 
QLA4xxx has two pci functions per port (Ethernet and iSCSI). When one of these 
PCI functions issues a HBA reset, all other functions are notified and need to 
acknowledge and re-initialize. During module qla4xxx_remove_adapter() gets 
invoked. This function needs to wait if it is currently responding to a reset 
from another function.

Signed-off-by: David Somayajulu [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]

 drivers/scsi/qla4xxx/ql4_os.c |   17 +
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c
index da21f5f..0e4688c 100644
--- a/drivers/scsi/qla4xxx/ql4_os.c
+++ b/drivers/scsi/qla4xxx/ql4_os.c
@@ -10,6 +10,10 @@ #include scsi/scsi_tcq.h
 #include scsi/scsicam.h
 
 #include ql4_def.h
+#include ql4_version.h
+#include ql4_glbl.h
+#include ql4_dbg.h
+#include ql4_inline.h
 
 /*
  * Driver version
@@ -711,7 +715,7 @@ static int qla4xxx_cmd_wait(struct scsi_
return stat;
 }
 
-static void qla4xxx_hw_reset(struct scsi_qla_host *ha)
+void qla4xxx_hw_reset(struct scsi_qla_host *ha)
 {
uint32_t ctrl_status;
unsigned long flags = 0;
@@ -1081,13 +1085,13 @@ static void qla4xxx_free_adapter(struct 
if (ha-timer_active)
qla4xxx_stop_timer(ha);
 
-   /* free extra memory */
-   qla4xxx_mem_free(ha);
-
/* Detach interrupts */
if (test_and_clear_bit(AF_IRQ_ATTACHED, ha-flags))
free_irq(ha-pdev-irq, ha);
 
+   /* free extra memory */
+   qla4xxx_mem_free(ha);
+
pci_disable_device(ha-pdev);
 
 }
@@ -1332,6 +1336,11 @@ static void __devexit qla4xxx_remove_ada
 
ha = pci_get_drvdata(pdev);
 
+   qla4xxx_disable_intrs(ha);
+
+   while (test_bit(DPC_RESET_HA_INTR, ha-dpc_flags))
+   ssleep(1);
+
/* remove devs from iscsi_sessions to scsi_devices */
qla4xxx_free_ddb_list(ha);
 

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


Re: [PATCH 4/8] qla4xxx: Resubmission: update rev num and misc cleanup

2007-05-23 Thread David C Somayajulu
On Wed, 2007-05-23 at 17:54 -0700, David C Somayajulu wrote:
Sorry I hit send before changing the subject header completely. Please 
disregard this one. I will resend this patch with the proper subject line.
-david S.

 Clean up and update version number
 
 Signed-off-by: David Somayajulu [EMAIL PROTECTED]
 Signed-off-by: Mike Christie [EMAIL PROTECTED]
 
  drivers/scsi/qla4xxx/ql4_glbl.h|7 ++-
  drivers/scsi/qla4xxx/ql4_iocb.c|8 ++--
  drivers/scsi/qla4xxx/ql4_nvram.c   |3 +++
  drivers/scsi/qla4xxx/ql4_version.h |3 ++-
  4 files changed, 17 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h
 index 5b00cb0..a3608e0 100644
 --- a/drivers/scsi/qla4xxx/ql4_glbl.h
 +++ b/drivers/scsi/qla4xxx/ql4_glbl.h
 @@ -8,6 +8,9 @@
  #ifndef __QLA4x_GBL_H
  #define  __QLA4x_GBL_H
  
 +struct iscsi_cls_conn;
 +
 +void qla4xxx_hw_reset(struct scsi_qla_host *ha);
  int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a);
  int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port);
  int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb);
 @@ -58,11 +61,13 @@ int qla4xxx_get_fw_version(struct scsi_q
  void qla4xxx_interrupt_service_routine(struct scsi_qla_host * ha,
  uint32_t intr_status);
  int qla4xxx_init_rings(struct scsi_qla_host * ha);
 -struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha, 
 uint32_t index);
 +struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha,
 + uint32_t index);
  void qla4xxx_srb_compl(struct scsi_qla_host *ha, struct srb *srb);
  int qla4xxx_reinitialize_ddb_list(struct scsi_qla_host * ha);
  int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha,
   uint32_t fw_ddb_index, uint32_t state);
 +void qla4xxx_dump_buffer(void *b, uint32_t size);
  
  extern int ql4xextended_error_logging;
  extern int ql4xdiscoverywait;
 diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
 index a216a17..6e3c8c8 100644
 --- a/drivers/scsi/qla4xxx/ql4_iocb.c
 +++ b/drivers/scsi/qla4xxx/ql4_iocb.c
 @@ -6,6 +6,10 @@
   */
  
  #include ql4_def.h
 +#include ql4_glbl.h
 +#include ql4_dbg.h
 +#include ql4_inline.h
 +
  
  #include scsi/scsi_tcq.h
  
 @@ -243,8 +247,8 @@ int qla4xxx_send_command_to_isp(struct s
   dma_addr_t  req_dma;
  
   req_dma = pci_map_single(ha-pdev, cmd-request_buffer,
 -  cmd-request_bufflen,
 -  cmd-sc_data_direction);
 +  cmd-request_bufflen,
 +  cmd-sc_data_direction);
   if (dma_mapping_error(req_dma))
   goto queuing_error;
  
 diff --git a/drivers/scsi/qla4xxx/ql4_nvram.c 
 b/drivers/scsi/qla4xxx/ql4_nvram.c
 index 58afd13..7fe0482 100644
 --- a/drivers/scsi/qla4xxx/ql4_nvram.c
 +++ b/drivers/scsi/qla4xxx/ql4_nvram.c
 @@ -6,6 +6,9 @@
   */
  
  #include ql4_def.h
 +#include ql4_glbl.h
 +#include ql4_dbg.h
 +#include ql4_inline.h
  
  static inline void eeprom_cmd(uint32_t cmd, struct scsi_qla_host *ha)
  {
 diff --git a/drivers/scsi/qla4xxx/ql4_version.h 
 b/drivers/scsi/qla4xxx/ql4_version.h
 index e5183a6..2149069 100644
 --- a/drivers/scsi/qla4xxx/ql4_version.h
 +++ b/drivers/scsi/qla4xxx/ql4_version.h
 @@ -5,4 +5,5 @@
   * See LICENSE.qla4xxx for copyright and licensing details.
   */
  
 -#define QLA4XXX_DRIVER_VERSION   5.00.07-k1
 +#define QLA4XXX_DRIVER_VERSION   5.01.00-k7
 +
 
-
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/8] qla4xxx: Resubmission: update rev num and misc cleanup

2007-05-23 Thread David C Somayajulu
Clean up and update version number

Signed-off-by: David Somayajulu [EMAIL PROTECTED]
Signed-off-by: Mike Christie [EMAIL PROTECTED]

 drivers/scsi/qla4xxx/ql4_glbl.h|7 ++-
 drivers/scsi/qla4xxx/ql4_iocb.c|8 ++--
 drivers/scsi/qla4xxx/ql4_nvram.c   |3 +++
 drivers/scsi/qla4xxx/ql4_version.h |3 ++-
 4 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h
index 5b00cb0..a3608e0 100644
--- a/drivers/scsi/qla4xxx/ql4_glbl.h
+++ b/drivers/scsi/qla4xxx/ql4_glbl.h
@@ -8,6 +8,9 @@
 #ifndef __QLA4x_GBL_H
 #define__QLA4x_GBL_H
 
+struct iscsi_cls_conn;
+
+void qla4xxx_hw_reset(struct scsi_qla_host *ha);
 int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a);
 int qla4xxx_send_tgts(struct scsi_qla_host *ha, char *ip, uint16_t port);
 int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb);
@@ -58,11 +61,13 @@ int qla4xxx_get_fw_version(struct scsi_q
 void qla4xxx_interrupt_service_routine(struct scsi_qla_host * ha,
   uint32_t intr_status);
 int qla4xxx_init_rings(struct scsi_qla_host * ha);
-struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha, uint32_t 
index);
+struct srb * qla4xxx_del_from_active_array(struct scsi_qla_host *ha,
+   uint32_t index);
 void qla4xxx_srb_compl(struct scsi_qla_host *ha, struct srb *srb);
 int qla4xxx_reinitialize_ddb_list(struct scsi_qla_host * ha);
 int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha,
uint32_t fw_ddb_index, uint32_t state);
+void qla4xxx_dump_buffer(void *b, uint32_t size);
 
 extern int ql4xextended_error_logging;
 extern int ql4xdiscoverywait;
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c
index a216a17..6e3c8c8 100644
--- a/drivers/scsi/qla4xxx/ql4_iocb.c
+++ b/drivers/scsi/qla4xxx/ql4_iocb.c
@@ -6,6 +6,10 @@
  */
 
 #include ql4_def.h
+#include ql4_glbl.h
+#include ql4_dbg.h
+#include ql4_inline.h
+
 
 #include scsi/scsi_tcq.h
 
@@ -243,8 +247,8 @@ int qla4xxx_send_command_to_isp(struct s
dma_addr_t  req_dma;
 
req_dma = pci_map_single(ha-pdev, cmd-request_buffer,
-cmd-request_bufflen,
-cmd-sc_data_direction);
+cmd-request_bufflen,
+cmd-sc_data_direction);
if (dma_mapping_error(req_dma))
goto queuing_error;
 
diff --git a/drivers/scsi/qla4xxx/ql4_nvram.c b/drivers/scsi/qla4xxx/ql4_nvram.c
index 58afd13..7fe0482 100644
--- a/drivers/scsi/qla4xxx/ql4_nvram.c
+++ b/drivers/scsi/qla4xxx/ql4_nvram.c
@@ -6,6 +6,9 @@
  */
 
 #include ql4_def.h
+#include ql4_glbl.h
+#include ql4_dbg.h
+#include ql4_inline.h
 
 static inline void eeprom_cmd(uint32_t cmd, struct scsi_qla_host *ha)
 {
diff --git a/drivers/scsi/qla4xxx/ql4_version.h 
b/drivers/scsi/qla4xxx/ql4_version.h
index e5183a6..2149069 100644
--- a/drivers/scsi/qla4xxx/ql4_version.h
+++ b/drivers/scsi/qla4xxx/ql4_version.h
@@ -5,4 +5,5 @@
  * See LICENSE.qla4xxx for copyright and licensing details.
  */
 
-#define QLA4XXX_DRIVER_VERSION 5.00.07-k1
+#define QLA4XXX_DRIVER_VERSION 5.01.00-k7
+

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


Re: [PATCH] [scsi] Remove __GFP_DMA

2007-05-23 Thread Robert Hancock

Alan Cox wrote:

On Wed, 23 May 2007 15:17:08 -0400
Salyzyn, Mark [EMAIL PROTECTED] wrote:


The 31 bit limit for some of these cards is a problem, we currently only
do __GFP_DMA for bounce buffer sg elements allocated for user supplied
references in ioctls.

I figure we should be using pci_alloc_consistent calls for these
allocations to more accurately acquire memory within the 31 bit limit if
necessary, we could switch to these to remove the need for the __GFP_DMA
flag in the aacraid driver?


That didn't used to work right on the AMD boards when I tried it last as
we ended up with a buffer that was mapped by the IOMMU for some reason
and that was not below 2GB.


The physical address you mean? If that is still happening then it needs 
to get fixed. The allocation should not succeed if it can't provide 
memory that's inside the DMA mask for the device..


--
Robert Hancock  Saskatoon, SK, Canada
To email, remove nospam from [EMAIL PROTECTED]
Home Page: http://www.roberthancock.com/

-
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