[PATCH -next] [SCSI] qla2xxx: fix error return code in qla2x00_probe_one()

2013-04-18 Thread Wei Yongjun
From: Wei Yongjun 

Fix to return a negative error code in the queues alloc error handling
case instead of 0, as done elsewhere in this function.
And also fix to return 0 from qla2x00_alloc_queues() when no error, otherwise
this cause if (!qla2x00_alloc_queues(ha, req, rsp)) always be false.

Signed-off-by: Wei Yongjun 
---
 drivers/scsi/qla2xxx/qla_os.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 5307bf8..16fe011 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -344,7 +344,7 @@ static int qla2x00_alloc_queues(struct qla_hw_data *ha, 
struct req_que *req,
ha->req_q_map[0] = req;
set_bit(0, ha->rsp_qid_map);
set_bit(0, ha->req_qid_map);
-   return 1;
+   return 0;
 
 fail_rsp_map:
kfree(ha->req_q_map);
@@ -2631,7 +2631,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct 
pci_device_id *id)
 
 que_init:
/* Alloc arrays of request and response ring ptrs */
-   if (!qla2x00_alloc_queues(ha, req, rsp)) {
+   ret = qla2x00_alloc_queues(ha, req, rsp);
+   if (ret) {
ql_log(ql_log_fatal, base_vha, 0x003d,
"Failed to allocate memory for queue pointers..."
"aborting.\n");

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


[PATCH 0/1] ipr: SATA DVD probing failed with 64bit adapter

2013-04-18 Thread wenxiong
This patch fixes the SATA DVD probing failing issue.


Thanks for your help!
Wendy
-- 
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1] ipr: SATA DVD probing failed with 64bit adapter

2013-04-18 Thread wenxiong
Driver passed the wrong IOADL address to IOA adapter. The patch
fixes the issue.

Signed-off-by: Wen Xiong 
---
 drivers/scsi/ipr.c |4 ++--
 drivers/scsi/ipr.h |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Index: b/drivers/scsi/ipr.c
===
--- a/drivers/scsi/ipr.c2013-04-18 14:10:44.0 -0500
+++ b/drivers/scsi/ipr.c2013-04-18 14:15:08.767887656 -0500
@@ -6421,7 +6421,7 @@ static void ipr_build_ata_ioadl64(struct
 {
u32 ioadl_flags = 0;
struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb;
-   struct ipr_ioadl64_desc *ioadl64 = ipr_cmd->i.ioadl64;
+   struct ipr_ioadl64_desc *ioadl64 = ipr_cmd->i.ata_ioadl.ioadl64;
struct ipr_ioadl64_desc *last_ioadl64 = NULL;
int len = qc->nbytes;
struct scatterlist *sg;
@@ -6441,7 +6441,7 @@ static void ipr_build_ata_ioadl64(struct
ioarcb->ioadl_len =
cpu_to_be32(sizeof(struct ipr_ioadl64_desc) * 
ipr_cmd->dma_use_sg);
ioarcb->u.sis64_addr_data.data_ioadl_addr =
-   cpu_to_be64(dma_addr + offsetof(struct ipr_cmnd, i.ata_ioadl));
+   cpu_to_be64(dma_addr + offsetof(struct ipr_cmnd, 
i.ata_ioadl.ioadl64));
 
for_each_sg(qc->sg, sg, qc->n_elem, si) {
ioadl64->flags = cpu_to_be32(ioadl_flags);
Index: b/drivers/scsi/ipr.h
===
--- a/drivers/scsi/ipr.h2013-04-18 14:08:22.0 -0500
+++ b/drivers/scsi/ipr.h2013-04-18 14:12:50.677887864 -0500
@@ -552,7 +552,7 @@ struct ipr_ioarcb_ata_regs {/* 22 bytes
u8 hob_lbam;
u8 hob_lbah;
u8 ctl;
-}__attribute__ ((packed, aligned(4)));
+}__attribute__ ((packed, aligned(2)));
 
 struct ipr_ioadl_desc {
__be32 flags_and_data_len;

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


[PATCH -next] [SCSI] scsi_transport_iscsi: fix error return code in iscsi_transport_init()

2013-04-18 Thread Wei Yongjun
From: Wei Yongjun 

Fix to return -ENOMEM in the create workqueue error case
instead of 0, as done elsewhere in this function.

Signed-off-by: Wei Yongjun 
---
 drivers/scsi/scsi_transport_iscsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index 47799a3..475265a 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -3985,8 +3985,10 @@ static __init int iscsi_transport_init(void)
}
 
iscsi_eh_timer_workq = create_singlethread_workqueue("iscsi_eh");
-   if (!iscsi_eh_timer_workq)
+   if (!iscsi_eh_timer_workq) {
+   err = -ENOMEM;
goto release_nls;
+   }
 
return 0;
 

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


Re: [PATCH 0/5] bnx2fc version 1.0.14

2013-04-18 Thread Bhanu Prakash Gollapudi

On 03/08/2013 01:28 PM, Bhanu Prakash Gollapudi wrote:

Hi James,

Please consider including the following patches for 3.9+ merge window.

Thanks,
Bhanu

Bhanu Prakash Gollapudi (5):
   bnx2fc: Enable cached tasks to improve performance
   bnx2fc: Include chip number in the symbolic name
   bnx2fc: Fix race condition between IO completion and abort
   bnx2fc: Update copyright information
   bnx2fc: Bumped version to 1.0.14

  drivers/scsi/bnx2fc/bnx2fc.h  |   57 +++-
  drivers/scsi/bnx2fc/bnx2fc_els.c  |2 +-
  drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   55 ++-
  drivers/scsi/bnx2fc/bnx2fc_hwi.c  |8 -
  drivers/scsi/bnx2fc/bnx2fc_io.c   |9 --
  drivers/scsi/bnx2fc/bnx2fc_tgt.c  |2 +-
  6 files changed, 116 insertions(+), 17 deletions(-)



Hi James,

I see that these patches were not picked up by you yet.  Please let me 
know if you're waiting for any information.


thanks,
Bhanu


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


[PATCH 1/1] cciss: add cciss_allow_hpsa module parameter

2013-04-18 Thread Mike Miller

Add the cciss_allow_hpsa modules parameter. This allows users to use the hpsa
driver instead of cciss for older controllers.
Tested with 3.9.0-rc7 in combination with the bug fix submitted Tuesday. My
apologies for not testing that patch with the correct kernel.

From: Mike 
Signed-off-by: Mike Miller 

---
 drivers/block/cciss.c |   12 +++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index a6c0973..081d1a8 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -75,6 +75,12 @@ module_param(cciss_simple_mode, int, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(cciss_simple_mode,
"Use 'simple mode' rather than 'performant mode'");
 
+static int cciss_allow_hpsa;
+module_param(cciss_allow_hpsa, int, S_IRUGO|S_IWUSR);
+MODULE_PARM_DESC(cciss_allow_hpsa,
+   "Prevent cciss driver from accessing hardware known to be "
+   " supported by the hpsa driver");
+
 static DEFINE_MUTEX(cciss_mutex);
 static struct proc_dir_entry *proc_cciss;
 
@@ -4116,9 +4122,13 @@ static int cciss_lookup_board_id(struct pci_dev *pdev, 
u32 *board_id)
*board_id = ((subsystem_device_id << 16) & 0x) |
subsystem_vendor_id;
 
-   for (i = 0; i < ARRAY_SIZE(products); i++)
+   for (i = 0; i < ARRAY_SIZE(products); i++) {
+   /* Stand aside for hpsa driver on request */
+   if (cciss_allow_hpsa)
+   return -ENODEV;
if (*board_id == products[i].board_id)
return i;
+   }
dev_warn(&pdev->dev, "unrecognized board ID: 0x%08x, ignoring.\n",
*board_id);
return -ENODEV;
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [PATCH V3 02/12] pm80xx: Added SPCv/ve specific ids, variables and modify for SPC

2013-04-18 Thread Anand Kumar Santhanam
Hi James,

I have resubmitted the patchset v4 after fixing the patch format
problems.
Pls apply from patch 1 of the series onwards.

Regards
Anand

-Original Message-
From: James Bottomley [mailto:james.bottom...@hansenpartnership.com] 
Sent: Friday, April 12, 2013 8:37 AM
To: Anand Kumar Santhanam
Cc: linux-scsi@vger.kernel.org; Harry Yang; Rich Bono;
sakthivel...@hcl.com; Sangeetha Gnanasekaran; xjtu...@gmail.com;
Vishwanath Maram
Subject: Re: [PATCH V3 02/12] pm80xx: Added SPCv/ve specific ids,
variables and modify for SPC

On Thu, 2013-04-11 at 19:38 -0700, Anand Kumar Santhanam wrote:
> Hi James,
> 
> I will double check the same. Also can you pls provide the tool which 
> you are using to apply the patch and also the kernel version?

It's git and the tip of the SCSI misc branch

> I will ensure that we locally apply the patches before sending to the 
> list.

Thanks,

James


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


[PATCH V4 12/12] pm80xx: thermal, sas controller config and error handling update

2013-04-18 Thread Anand
>From ffe82b1efc42510239046909a7ac0aff10bb4162 Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Tue, 19 Mar 2013 18:08:40 +0530
Subject: [PATCH V4 12/12] pm80xx: thermal, sas controller config and error 
handling update

Modified thermal configuration to happen after interrupt registration
Added SAS controller configuration during initialization
Added error handling logic to handle I_T_Nexus errors and variants

Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by: Hannes Reinecke  
---
 drivers/scsi/pm8001/pm8001_hwi.c  |2 +-
 drivers/scsi/pm8001/pm8001_init.c |2 +
 drivers/scsi/pm8001/pm8001_sas.c  |   66 
 drivers/scsi/pm8001/pm8001_sas.h  |2 +
 drivers/scsi/pm8001/pm80xx_hwi.c  |  150 +
 drivers/scsi/pm8001/pm80xx_hwi.h  |   44 +++-
 6 files changed, 249 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index a90c002..d18f421 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -1670,7 +1670,7 @@ void pm8001_work_fn(struct work_struct *work)
}   break;
case IO_OPEN_CNX_ERROR_IT_NEXUS_LOSS:
dev = pm8001_dev->sas_device;
-   pm8001_I_T_nexus_reset(dev);
+   pm8001_I_T_nexus_event_handler(dev);
break;
case IO_OPEN_CNX_ERROR_STP_RESOURCES_BUSY:
dev = pm8001_dev->sas_device;
diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index 055f7d0..1c71852 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -838,6 +838,8 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
if (pm8001_ha->chip_id != chip_8001) {
for (i = 1; i < pm8001_ha->number_of_intr; i++)
PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, i);
+   /* setup thermal configuration. */
+   pm80xx_set_thermal_config(pm8001_ha);
}
 
pm8001_init_sas_add(pm8001_ha);
diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index c720917..9af9585 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -1018,6 +1018,72 @@ int pm8001_I_T_nexus_reset(struct domain_device *dev)
return rc;
 }
 
+/*
+* This function handle the IT_NEXUS_XXX event or completion
+* status code for SSP/SATA/SMP I/O request.
+*/
+int pm8001_I_T_nexus_event_handler(struct domain_device *dev)
+{
+   int rc = TMF_RESP_FUNC_FAILED;
+   struct pm8001_device *pm8001_dev;
+   struct pm8001_hba_info *pm8001_ha;
+   struct sas_phy *phy;
+   u32 device_id = 0;
+
+   if (!dev || !dev->lldd_dev)
+   return -1;
+
+   pm8001_dev = dev->lldd_dev;
+   device_id = pm8001_dev->device_id;
+   pm8001_ha = pm8001_find_ha_by_dev(dev);
+
+   PM8001_EH_DBG(pm8001_ha,
+   pm8001_printk("I_T_Nexus handler invoked !!"));
+
+   phy = sas_get_local_phy(dev);
+
+   if (dev_is_sata(dev)) {
+   DECLARE_COMPLETION_ONSTACK(completion_setstate);
+   if (scsi_is_sas_phy_local(phy)) {
+   rc = 0;
+   goto out;
+   }
+   /* send internal ssp/sata/smp abort command to FW */
+   rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
+   dev, 1, 0);
+   msleep(100);
+
+   /* deregister the target device */
+   pm8001_dev_gone_notify(dev);
+   msleep(200);
+
+   /*send phy reset to hard reset target */
+   rc = sas_phy_reset(phy, 1);
+   msleep(2000);
+   pm8001_dev->setds_completion = &completion_setstate;
+
+   wait_for_completion(&completion_setstate);
+   } else {
+   /* send internal ssp/sata/smp abort command to FW */
+   rc = pm8001_exec_internal_task_abort(pm8001_ha, pm8001_dev ,
+   dev, 1, 0);
+   msleep(100);
+
+   /* deregister the target device */
+   pm8001_dev_gone_notify(dev);
+   msleep(200);
+
+   /*send phy reset to hard reset target */
+   rc = sas_phy_reset(phy, 1);
+   msleep(2000);
+   }
+   PM8001_EH_DBG(pm8001_ha, pm8001_printk(" for device[%x]:rc=%d\n",
+   pm8001_dev->device_id, rc));
+out:
+   sas_put_local_phy(phy);
+
+   return rc;
+}
 /* mandatory SAM-3, the task reset the specified LUN*/
 int pm8001_lu_reset(struct domain_device *dev, u8 *lun)
 {
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
index ab30193..72d46ea 100644
--- a/drivers/scsi/pm8001/pm8001_sas.h
+++ b/drivers/scsi/pm8001/pm8001_sas.h
@@ -563,6 +563,7 @@ int pm8001_dev_found(struct domai

[PATCH V4 11/12] pm80xx: NCQ error handling changes

2013-04-18 Thread Anand
>From 2738e0b59fe103a363b0ea600b3eccc687a7fa3c Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Tue, 19 Mar 2013 18:08:08 +0530
Subject: [PATCH V4 11/12] pm80xx: NCQ error handling changes

Handled NCQ errors in the low level driver as the FW
is not providing the faulty tag for NCQ errors for libsas
to recover.

Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by: Hannes Reinecke  
---
 drivers/scsi/pm8001/pm8001_hwi.c |  270 --
 drivers/scsi/pm8001/pm8001_sas.c |   22 +++-
 drivers/scsi/pm8001/pm8001_sas.h |   15 ++-
 drivers/scsi/pm8001/pm80xx_hwi.c |  262 +++--
 drivers/scsi/pm8001/pm80xx_hwi.h |1 +
 5 files changed, 543 insertions(+), 27 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 265dbf4..a90c002 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -1707,6 +1707,123 @@ int pm8001_handle_event(struct pm8001_hba_info 
*pm8001_ha, void *data,
return ret;
 }
 
+static void pm8001_send_abort_all(struct pm8001_hba_info *pm8001_ha,
+   struct pm8001_device *pm8001_ha_dev)
+{
+   int res;
+   u32 ccb_tag;
+   struct pm8001_ccb_info *ccb;
+   struct sas_task *task = NULL;
+   struct task_abort_req task_abort;
+   struct inbound_queue_table *circularQ;
+   u32 opc = OPC_INB_SATA_ABORT;
+   int ret;
+
+   if (!pm8001_ha_dev) {
+   PM8001_FAIL_DBG(pm8001_ha, pm8001_printk("dev is null \n"));
+   return;
+   }
+
+   task = sas_alloc_slow_task(GFP_ATOMIC);
+
+   if (!task) {
+   PM8001_FAIL_DBG(pm8001_ha, pm8001_printk("cannot "
+   "allocate task \n"));
+   return;
+   }
+
+   task->task_done = pm8001_task_done;
+
+   res = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
+   if (res)
+   return;
+
+   ccb = &pm8001_ha->ccb_info[ccb_tag];
+   ccb->device = pm8001_ha_dev;
+   ccb->ccb_tag = ccb_tag;
+   ccb->task = task;
+
+   circularQ = &pm8001_ha->inbnd_q_tbl[0];
+
+   memset(&task_abort, 0, sizeof(task_abort));
+   task_abort.abort_all = cpu_to_le32(1);
+   task_abort.device_id = cpu_to_le32(pm8001_ha_dev->device_id);
+   task_abort.tag = cpu_to_le32(ccb_tag);
+
+   ret = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &task_abort, 0);
+
+}
+
+static void pm8001_send_read_log(struct pm8001_hba_info *pm8001_ha,
+   struct pm8001_device *pm8001_ha_dev)
+{
+   struct sata_start_req sata_cmd;
+   int res;
+   u32 ccb_tag;
+   struct pm8001_ccb_info *ccb;
+   struct sas_task *task = NULL;
+   struct host_to_dev_fis fis;
+   struct domain_device *dev;
+   struct inbound_queue_table *circularQ;
+   u32 opc = OPC_INB_SATA_HOST_OPSTART;
+
+   task = sas_alloc_slow_task(GFP_ATOMIC);
+
+   if (!task) {
+   PM8001_FAIL_DBG(pm8001_ha,
+   pm8001_printk("cannot allocate task !!!\n"));
+   return;
+   }
+   task->task_done = pm8001_task_done;
+
+   res = pm8001_tag_alloc(pm8001_ha, &ccb_tag);
+   if (res) {
+   PM8001_FAIL_DBG(pm8001_ha,
+   pm8001_printk("cannot allocate tag !!!\n"));
+   return;
+   }
+
+   /* allocate domain device by ourselves as libsas
+* is not going to provide any
+   */
+   dev = kzalloc(sizeof(struct domain_device), GFP_ATOMIC);
+   if (!dev) {
+   PM8001_FAIL_DBG(pm8001_ha,
+   pm8001_printk("Domain device cannot be allocated \n"));
+   sas_free_task(task);
+   return;
+   } else {
+   task->dev = dev;
+   task->dev->lldd_dev = pm8001_ha_dev;
+   }
+
+   ccb = &pm8001_ha->ccb_info[ccb_tag];
+   ccb->device = pm8001_ha_dev;
+   ccb->ccb_tag = ccb_tag;
+   ccb->task = task;
+   pm8001_ha_dev->id |= NCQ_READ_LOG_FLAG;
+   pm8001_ha_dev->id |= NCQ_2ND_RLE_FLAG;
+
+   memset(&sata_cmd, 0, sizeof(sata_cmd));
+   circularQ = &pm8001_ha->inbnd_q_tbl[0];
+
+   /* construct read log FIS */
+   memset(&fis, 0, sizeof(struct host_to_dev_fis));
+   fis.fis_type = 0x27;
+   fis.flags = 0x80;
+   fis.command = ATA_CMD_READ_LOG_EXT;
+   fis.lbal = 0x10;
+   fis.sector_count = 0x1;
+
+   sata_cmd.tag = cpu_to_le32(ccb_tag);
+   sata_cmd.device_id = cpu_to_le32(pm8001_ha_dev->device_id);
+   sata_cmd.ncqtag_atap_dir_m |= ((0x1 << 7) | (0x5 << 9));
+   memcpy(&sata_cmd.sata_fis, &fis, sizeof(struct host_to_dev_fis));
+
+   res = pm8001_mpi_build_cmd(pm8001_ha, circularQ, opc, &sata_cmd, 0);
+
+}
+
 /**
  * mpi_ssp_completion- process the event that FW response to the SSP request.
  * @pm8001_ha: our hba card information
@@ -2170,16 +2287,44 @@ mpi_sata_completion(struct pm8001_hba_info *pm

[PATCH V4 10/12] pm80xx: WWN Modification for PM8081/88/89 controllers

2013-04-18 Thread Anand
>From 6fb08e45a7272daecc4b8bdce643e40fd2062542 Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Tue, 19 Mar 2013 18:07:35 +0530
Subject: [PATCH V4 10/12] pm80xx: WWN Modification for PM8081/88/89 controllers

Individual WWN read operations based on controller.
PM8081 - Read WWN from Flash VPD.
PM8088/89 - Read WWN from EEPROM.
PM8001 - Read WWN from NVM.

Signed-off-by: Sakthivel K 
Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by: Hannes Reinecke  
---
 drivers/scsi/pm8001/pm8001_init.c |   43 +++--
 1 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index 0c14dc0..055f7d0 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -605,21 +605,50 @@ static void  pm8001_post_sas_ha_init(struct Scsi_Host 
*shost,
  */
 static void pm8001_init_sas_add(struct pm8001_hba_info *pm8001_ha)
 {
-   u8 i;
+   u8 i, j;
 #ifdef PM8001_READ_VPD
+   /* For new SPC controllers WWN is stored in flash vpd
+   *  For SPC/SPCve controllers WWN is stored in EEPROM
+   *  For Older SPC WWN is stored in NVMD
+   */
DECLARE_COMPLETION_ONSTACK(completion);
struct pm8001_ioctl_payload payload;
+   u16 deviceid;
+   pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid);
pm8001_ha->nvmd_completion = &completion;
-   payload.minor_function = 0;
-   payload.length = 128;
-   payload.func_specific = kzalloc(128, GFP_KERNEL);
+
+   if (pm8001_ha->chip_id == chip_8001) {
+   if (deviceid == 0x8081) {
+   payload.minor_function = 4;
+   payload.length = 4096;
+   } else {
+   payload.minor_function = 0;
+   payload.length = 128;
+   }
+   } else {
+   payload.minor_function = 1;
+   payload.length = 4096;
+   }
+   payload.offset = 0;
+   payload.func_specific = kzalloc(payload.length, GFP_KERNEL);
PM8001_CHIP_DISP->get_nvmd_req(pm8001_ha, &payload);
wait_for_completion(&completion);
+
+   for (i = 0, j = 0; i <= 7; i++, j++) {
+   if (pm8001_ha->chip_id == chip_8001) {
+   if (deviceid == 0x8081)
+   pm8001_ha->sas_addr[j] =
+   payload.func_specific[0x704 + i];
+   } else
+   pm8001_ha->sas_addr[j] =
+   payload.func_specific[0x804 + i];
+   }
+
for (i = 0; i < pm8001_ha->chip->n_phy; i++) {
-   memcpy(&pm8001_ha->phy[i].dev_sas_addr, pm8001_ha->sas_addr,
-   SAS_ADDR_SIZE);
+   memcpy(&pm8001_ha->phy[i].dev_sas_addr,
+   pm8001_ha->sas_addr, SAS_ADDR_SIZE);
PM8001_INIT_DBG(pm8001_ha,
-   pm8001_printk("phy %d sas_addr = %016llx \n", i,
+   pm8001_printk("phy %d sas_addr = %016llx\n", i,
pm8001_ha->phy[i].dev_sas_addr));
}
 #else
-- 
1.7.1

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


[PATCH V4 09/12] pm80xx: Changed module name and debug messages update

2013-04-18 Thread Anand
>From 8d5db4d3d00604c8dc3db6e616ed21e0c46bcbaf Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Tue, 19 Mar 2013 18:07:09 +0530
Subject: [PATCH V4 09/12] pm80xx: Changed module name and debug messages update

Changed name in driver to pm80xx. Updated debug messages.

Signed-off-by: Sakthivel K 
Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by: Hannes Reinecke  
---
 drivers/scsi/pm8001/pm8001_hwi.c  |   11 ++-
 drivers/scsi/pm8001/pm8001_init.c |   14 ++
 drivers/scsi/pm8001/pm8001_sas.h  |8 
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index c124fc6..265dbf4 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -2506,9 +2506,9 @@ static void mpi_sata_event(struct pm8001_hba_info 
*pm8001_ha , void *piomb)
if (unlikely(!t || !t->lldd_task || !t->dev))
return;
ts = &t->task_status;
-   PM8001_IO_DBG(pm8001_ha,
-   pm8001_printk("port_id = %x,device_id = %x\n",
-   port_id, dev_id));
+   PM8001_IO_DBG(pm8001_ha, pm8001_printk(
+   "port_id:0x%x, device_id:0x%x, tag:0x%x, event:0x%x\n",
+   port_id, dev_id, tag, event));
switch (event) {
case IO_OVERFLOW:
PM8001_IO_DBG(pm8001_ha, pm8001_printk("IO_UNDERFLOW\n"));
@@ -4409,8 +4409,9 @@ int pm8001_chip_abort_task(struct pm8001_hba_info 
*pm8001_ha,
 {
u32 opc, device_id;
int rc = TMF_RESP_FUNC_FAILED;
-   PM8001_EH_DBG(pm8001_ha, pm8001_printk("cmd_tag = %x, abort task tag"
-   " = %x", cmd_tag, task_tag));
+   PM8001_EH_DBG(pm8001_ha,
+   pm8001_printk("cmd_tag = %x, abort task tag = 0x%x",
+   cmd_tag, task_tag));
if (pm8001_dev->dev_type == SAS_END_DEV)
opc = OPC_INB_SSP_ABORT;
else if (pm8001_dev->dev_type == SATA_DEV)
diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index 64168eb..0c14dc0 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -741,7 +741,7 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
const struct pm8001_chip_info *chip;
 
dev_printk(KERN_INFO, &pdev->dev,
-   "pm8001: driver version %s\n", DRV_VERSION);
+   "pm80xx: driver version %s\n", DRV_VERSION);
rc = pci_enable_device(pdev);
if (rc)
goto err_out_enable;
@@ -789,15 +789,21 @@ static int pm8001_pci_probe(struct pci_dev *pdev,
list_add_tail(&pm8001_ha->list, &hba_list);
PM8001_CHIP_DISP->chip_soft_rst(pm8001_ha);
rc = PM8001_CHIP_DISP->chip_init(pm8001_ha);
-   if (rc)
+   if (rc) {
+   PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
+   "chip_init failed [ret: %d]\n", rc));
goto err_out_ha_free;
+   }
 
rc = scsi_add_host(shost, &pdev->dev);
if (rc)
goto err_out_ha_free;
rc = pm8001_request_irq(pm8001_ha);
-   if (rc)
+   if (rc) {
+   PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
+   "pm8001_request_irq failed [ret: %d]\n", rc));
goto err_out_shost;
+   }
 
PM8001_CHIP_DISP->interrupt_enable(pm8001_ha, 0);
if (pm8001_ha->chip_id != chip_8001) {
@@ -1039,7 +1045,7 @@ static int __init pm8001_init(void)
 {
int rc = -ENOMEM;
 
-   pm8001_wq = alloc_workqueue("pm8001", 0, 0);
+   pm8001_wq = alloc_workqueue("pm80xx", 0, 0);
if (!pm8001_wq)
goto err;
 
diff --git a/drivers/scsi/pm8001/pm8001_sas.h b/drivers/scsi/pm8001/pm8001_sas.h
index c6fd99a..89dc227 100644
--- a/drivers/scsi/pm8001/pm8001_sas.h
+++ b/drivers/scsi/pm8001/pm8001_sas.h
@@ -57,8 +57,8 @@
 #include 
 #include "pm8001_defs.h"
 
-#define DRV_NAME   "pm8001"
-#define DRV_VERSION"0.1.36"
+#define DRV_NAME   "pm80xx"
+#define DRV_VERSION"0.1.37"
 #define PM8001_FAIL_LOGGING0x01 /* Error message logging */
 #define PM8001_INIT_LOGGING0x02 /* driver init logging */
 #define PM8001_DISC_LOGGING0x04 /* discovery layer logging */
@@ -66,8 +66,8 @@
 #define PM8001_EH_LOGGING  0x10 /* libsas EH function logging*/
 #define PM8001_IOCTL_LOGGING   0x20 /* IOCTL message logging */
 #define PM8001_MSG_LOGGING 0x40 /* misc message logging */
-#define pm8001_printk(format, arg...)  printk(KERN_INFO "%s %d:" format,\
-   __func__, __LINE__, ## arg)
+#define pm8001_printk(format, arg...)  printk(KERN_INFO "pm80xx %s %d:" \
+   format, __func__, __LINE__, ## arg)
 #define PM8001_CHECK_LOGGING(HBA, LEVEL, CMD)  \
 do {   \
if (unlikely(HBA->logging_level & LEVEL))   \
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsub

[PATCH V4 08/12] pm80xx: Firmware flash memory free fix, with addition of new memory region for it

2013-04-18 Thread Anand
>From 4043d1eb8813a2fc0656815fe2e6d21d4df0da66 Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Tue, 19 Mar 2013 18:06:40 +0530
Subject: [PATCH V4 08/12] pm80xx: Firmware flash memory free fix, with addition 
of new memory region for it

Performing pci_free_consistent in tasklet had result in a core dump. So
allocated a new memory region for it. Fix for passing proper address
and operation in firmware flash update.

Signed-off-by: Sakthivel K 
Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by: Hannes Reinecke  
---
 drivers/scsi/pm8001/pm8001_ctl.c  |5 +++--
 drivers/scsi/pm8001/pm8001_defs.h |3 ++-
 drivers/scsi/pm8001/pm8001_hwi.c  |   30 ++
 drivers/scsi/pm8001/pm8001_init.c |3 +++
 4 files changed, 14 insertions(+), 27 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
index ae2b124..d99f41c 100644
--- a/drivers/scsi/pm8001/pm8001_ctl.c
+++ b/drivers/scsi/pm8001/pm8001_ctl.c
@@ -400,10 +400,11 @@ static int pm8001_set_nvmd(struct pm8001_hba_info 
*pm8001_ha)
goto out;
}
payload = (struct pm8001_ioctl_payload *)ioctlbuffer;
-   memcpy((u8 *)payload->func_specific, (u8 *)pm8001_ha->fw_image->data,
+   memcpy((u8 *)&payload->func_specific, (u8 *)pm8001_ha->fw_image->data,
pm8001_ha->fw_image->size);
payload->length = pm8001_ha->fw_image->size;
payload->id = 0;
+   payload->minor_function = 0x1;
pm8001_ha->nvmd_completion = &completion;
ret = PM8001_CHIP_DISP->set_nvmd_req(pm8001_ha, payload);
wait_for_completion(&completion);
@@ -450,7 +451,7 @@ static int pm8001_update_flash(struct pm8001_hba_info 
*pm8001_ha)
payload->length = 1024*16;
payload->id = 0;
fwControl =
- (struct fw_control_info *)payload->func_specific;
+ (struct fw_control_info *)&payload->func_specific;
fwControl->len = IOCTL_BUF_SIZE;   /* IN */
fwControl->size = partitionSize + HEADER_LEN;/* IN */
fwControl->retcode = 0;/* OUT */
diff --git a/drivers/scsi/pm8001/pm8001_defs.h 
b/drivers/scsi/pm8001/pm8001_defs.h
index 26a2ee6..479c5a7 100644
--- a/drivers/scsi/pm8001/pm8001_defs.h
+++ b/drivers/scsi/pm8001/pm8001_defs.h
@@ -86,7 +86,7 @@ enum port_type {
 #definePM8001_MAX_DEVICES   2048   /* max supported device */
 #definePM8001_MAX_MSIX_VEC  64 /* max msi-x int for spcv/ve */
 
-#define USI_MAX_MEMCNT_BASE4
+#define USI_MAX_MEMCNT_BASE5
 #define IB (USI_MAX_MEMCNT_BASE + 1)
 #define CI (IB + PM8001_MAX_SPCV_INB_NUM)
 #define OB (CI + PM8001_MAX_SPCV_INB_NUM)
@@ -99,6 +99,7 @@ enum memory_region_num {
NVMD,   /* NVM device */
DEV_MEM,/* memory for devices */
CCB_MEM,/* memory for command control block */
+   FW_FLASH/* memory for fw flash update */
 };
 #definePM8001_EVENT_LOG_SIZE(128 * 1024)
 
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 3adf499..c124fc6 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -3481,10 +3481,6 @@ int pm8001_mpi_fw_flash_update_resp(struct 
pm8001_hba_info *pm8001_ha,
break;
}
ccb->fw_control_context->fw_control->retcode = status;
-   pci_free_consistent(pm8001_ha->pdev,
-   fw_control_context.len,
-   fw_control_context.virtAddr,
-   fw_control_context.phys_addr);
complete(pm8001_ha->nvmd_completion);
ccb->task = NULL;
ccb->ccb_tag = 0x;
@@ -4474,7 +4470,7 @@ int pm8001_chip_get_nvmd_req(struct pm8001_hba_info 
*pm8001_ha,
fw_control_context = kzalloc(sizeof(struct fw_control_ex), GFP_KERNEL);
if (!fw_control_context)
return -ENOMEM;
-   fw_control_context->usrAddr = (u8 *)&ioctl_payload->func_specific[0];
+   fw_control_context->usrAddr = (u8 *)ioctl_payload->func_specific;
fw_control_context->len = ioctl_payload->length;
circularQ = &pm8001_ha->inbnd_q_tbl[0];
memset(&nvmd_req, 0, sizeof(nvmd_req));
@@ -4556,7 +4552,7 @@ int pm8001_chip_set_nvmd_req(struct pm8001_hba_info 
*pm8001_ha,
return -ENOMEM;
circularQ = &pm8001_ha->inbnd_q_tbl[0];
memcpy(pm8001_ha->memoryMap.region[NVMD].virt_ptr,
-   ioctl_payload->func_specific,
+   &ioctl_payload->func_specific,
ioctl_payload->length);
memset(&nvmd_req, 0, sizeof(nvmd_req));
rc = pm8001_tag_alloc(pm8001_ha, &tag);
@@ -4658,29 +4654,14 @@ pm8001_chip_fw_flash_update_req(struct pm8001_hba_info 
*pm8001_ha,
int rc;
u32 tag;
struct pm8001_

[PATCH V4 07/12] pm80xx: SPC new firmware changes for device id 0x8081 alone

2013-04-18 Thread Anand
>From 2ce3ecb52358fcd358e1ea93a02522084fc7f968 Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Tue, 19 Mar 2013 18:05:55 +0530
Subject: [PATCH V4 07/12] pm80xx: SPC new firmware changes for device id 0x8081 
alone

Additional bar shift for new SPC firmware, applicable to device
id 0x8081 only.

Signed-off-by: Sakthivel K 
Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by: Hannes Reinecke  
---
 drivers/scsi/pm8001/pm8001_hwi.c |   31 ---
 drivers/scsi/pm8001/pm8001_hwi.h |2 ++
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index c335ae8..3adf499 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -640,6 +640,18 @@ static void init_pci_device_addresses(struct 
pm8001_hba_info *pm8001_ha)
 static int pm8001_chip_init(struct pm8001_hba_info *pm8001_ha)
 {
u8 i = 0;
+   u16 deviceid;
+   pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid);
+   /* 8081 controllers need BAR shift to access MPI space
+   * as this is shared with BIOS data */
+   if (deviceid == 0x8081) {
+   if (-1 == pm8001_bar4_shift(pm8001_ha, GSM_SM_BASE)) {
+   PM8001_FAIL_DBG(pm8001_ha,
+   pm8001_printk("Shift Bar4 to 0x%x failed\n",
+   GSM_SM_BASE));
+   return -1;
+   }
+   }
/* check the firmware status */
if (-1 == check_fw_ready(pm8001_ha)) {
PM8001_FAIL_DBG(pm8001_ha,
@@ -660,9 +672,12 @@ static int pm8001_chip_init(struct pm8001_hba_info 
*pm8001_ha)
update_inbnd_queue_table(pm8001_ha, i);
for (i = 0; i < PM8001_MAX_OUTB_NUM; i++)
update_outbnd_queue_table(pm8001_ha, i);
-   mpi_set_phys_g3_with_ssc(pm8001_ha, 0);
-   /* 7->130ms, 34->500ms, 119->1.5s */
-   mpi_set_open_retry_interval_reg(pm8001_ha, 119);
+   /* 8081 controller donot require these operations */
+   if (deviceid != 0x8081) {
+   mpi_set_phys_g3_with_ssc(pm8001_ha, 0);
+   /* 7->130ms, 34->500ms, 119->1.5s */
+   mpi_set_open_retry_interval_reg(pm8001_ha, 119);
+   }
/* notify firmware update finished and check initialization status */
if (0 == mpi_init_check(pm8001_ha)) {
PM8001_INIT_DBG(pm8001_ha,
@@ -684,6 +699,16 @@ static int mpi_uninit_check(struct pm8001_hba_info 
*pm8001_ha)
u32 max_wait_count;
u32 value;
u32 gst_len_mpistate;
+   u16 deviceid;
+   pci_read_config_word(pm8001_ha->pdev, PCI_DEVICE_ID, &deviceid);
+   if (deviceid == 0x8081) {
+   if (-1 == pm8001_bar4_shift(pm8001_ha, GSM_SM_BASE)) {
+   PM8001_FAIL_DBG(pm8001_ha,
+   pm8001_printk("Shift Bar4 to 0x%x failed\n",
+   GSM_SM_BASE));
+   return -1;
+   }
+   }
init_pci_device_addresses(pm8001_ha);
/* Write bit1=1 to Inbound DoorBell Register to tell the SPC FW the
table is stop */
diff --git a/drivers/scsi/pm8001/pm8001_hwi.h b/drivers/scsi/pm8001/pm8001_hwi.h
index 2399aab..d7c1e20 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.h
+++ b/drivers/scsi/pm8001/pm8001_hwi.h
@@ -131,6 +131,8 @@
 #define LINKRATE_30(0x02 << 8)
 #define LINKRATE_60(0x04 << 8)
 
+/* for new SPC controllers MEMBASE III is shared between BIOS and DATA */
+#define GSM_SM_BASE0x4F
 struct mpi_msg_hdr{
__le32  header; /* Bits [11:0]  - Message operation code */
/* Bits [15:12] - Message Category */
-- 
1.7.1

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


[PATCH V4 5/12] pm80xx: MSI-X implementation for using 64 interrupts

2013-04-18 Thread Anand
>From c9ef2f3de75ccd7d33ac26ab3e40745ce3134a2b Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Tue, 19 Mar 2013 17:56:17 +0530
Subject: [PATCH V4 5/12] pm80xx: MSI-X implementation for using 64 interrupts

Implementation of interrupt handlers and tasklets to support
upto 64 interrupt for the device.

Signed-off-by: Sakthivel K 
Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by: Hannes Reinecke 
---
 drivers/scsi/pm8001/pm8001_init.c |  141 +
 drivers/scsi/pm8001/pm8001_sas.h  |2 +
 2 files changed, 113 insertions(+), 30 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index 19fbd03..75270ee 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -159,33 +159,71 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
 }
 
 #ifdef PM8001_USE_TASKLET
+
+/**
+ * tasklet for 64 msi-x interrupt handler
+ * @opaque: the passed general host adapter struct
+ * Note: pm8001_tasklet is common for pm8001 & pm80xx
+ */
 static void pm8001_tasklet(unsigned long opaque)
 {
struct pm8001_hba_info *pm8001_ha;
+   u32 vec;
pm8001_ha = (struct pm8001_hba_info *)opaque;
if (unlikely(!pm8001_ha))
BUG_ON(1);
-   PM8001_CHIP_DISP->isr(pm8001_ha, 0);
+   vec = pm8001_ha->int_vector;
+   PM8001_CHIP_DISP->isr(pm8001_ha, vec);
+}
+#endif
+
+static struct  pm8001_hba_info *outq_to_hba(u8 *outq)
+{
+   return container_of((outq - *outq), struct pm8001_hba_info, outq[0]);
 }
+
+/**
+ * pm8001_interrupt_handler_msix - main MSIX interrupt handler.
+ * It obtains the vector number and calls the equivalent bottom
+ * half or services directly.
+ * @opaque: the passed outbound queue/vector. Host structure is
+ * retrieved from the same.
+ */
+static irqreturn_t pm8001_interrupt_handler_msix(int irq, void *opaque)
+{
+   struct pm8001_hba_info *pm8001_ha = outq_to_hba(opaque);
+   u8 outq = *(u8 *)opaque;
+   irqreturn_t ret = IRQ_HANDLED;
+   if (unlikely(!pm8001_ha))
+   return IRQ_NONE;
+   if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha))
+   return IRQ_NONE;
+   pm8001_ha->int_vector = outq;
+#ifdef PM8001_USE_TASKLET
+   tasklet_schedule(&pm8001_ha->tasklet);
+#else
+   ret = PM8001_CHIP_DISP->isr(pm8001_ha, outq);
 #endif
+   return ret;
+}
 
+/**
+ * pm8001_interrupt_handler_intx - main INTx interrupt handler.
+ * @dev_id: sas_ha structure. The HBA is retrieved from sas_has structure.
+ */
 
- /**
-  * pm8001_interrupt - when HBA originate a interrupt,we should invoke this
-  * dispatcher to handle each case.
-  * @irq: irq number.
-  * @opaque: the passed general host adapter struct
-  */
-static irqreturn_t pm8001_interrupt(int irq, void *opaque)
+static irqreturn_t pm8001_interrupt_handler_intx(int irq, void *dev_id)
 {
struct pm8001_hba_info *pm8001_ha;
irqreturn_t ret = IRQ_HANDLED;
-   struct sas_ha_struct *sha = opaque;
+   struct sas_ha_struct *sha = dev_id;
pm8001_ha = sha->lldd_ha;
if (unlikely(!pm8001_ha))
return IRQ_NONE;
if (!PM8001_CHIP_DISP->is_our_interupt(pm8001_ha))
return IRQ_NONE;
+
+   pm8001_ha->int_vector = 0;
 #ifdef PM8001_USE_TASKLET
tasklet_schedule(&pm8001_ha->tasklet);
 #else
@@ -427,8 +465,12 @@ static struct pm8001_hba_info *pm8001_pci_alloc(struct 
pci_dev *pdev,
pm8001_ha->iomb_size = IOMB_SIZE_SPC;
 
 #ifdef PM8001_USE_TASKLET
+   /**
+   * default tasklet for non msi-x interrupt handler/first msi-x
+   * interrupt handler
+   **/
tasklet_init(&pm8001_ha->tasklet, pm8001_tasklet,
-   (unsigned long)pm8001_ha);
+   (unsigned long)pm8001_ha);
 #endif
pm8001_ioremap(pm8001_ha);
if (!pm8001_alloc(pm8001_ha, ent))
@@ -591,31 +633,50 @@ static void pm8001_init_sas_add(struct pm8001_hba_info 
*pm8001_ha)
  * @chip_info: our ha struct.
  * @irq_handler: irq_handler
  */
-static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha,
-   irq_handler_t irq_handler)
+static u32 pm8001_setup_msix(struct pm8001_hba_info *pm8001_ha)
 {
u32 i = 0, j = 0;
-   u32 number_of_intr = 1;
+   u32 number_of_intr;
int flag = 0;
u32 max_entry;
int rc;
+   static char intr_drvname[PM8001_MAX_MSIX_VEC][sizeof(DRV_NAME)+3];
+
+   /* SPCv controllers supports 64 msi-x */
+   if (pm8001_ha->chip_id == chip_8001) {
+   number_of_intr = 1;
+   flag |= IRQF_DISABLED;
+   } else {
+   number_of_intr = PM8001_MAX_MSIX_VEC;
+   flag &= ~IRQF_SHARED;
+   flag |= IRQF_DISABLED;
+   }
+
max_entry = sizeof(pm8001_ha->msix_entries) /
sizeof(pm8001_ha->msix_entries[0]);
-   flag |= IRQF_DISABLED;
for (i = 0; i < max_entry ; i++)
pm8001_h

[PATCH V4 4/12] pm80xx: Updated common functions common for SPC and SPCv/ve

2013-04-18 Thread Anand
>From c5a2c7eff684b5ece5320f070855e3c9321f9b94 Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Wed, 27 Feb 2013 20:27:43 +0530
Subject: [PATCH V4 4/12] pm80xx: Updated common functions common for SPC and 
SPCv/ve

Update of function prototype for common function to SPC and SPCv/ve.
Multiple queues implementation for IO.

Signed-off-by: Sakthivel K 
Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by: Hannes Reinecke 
---
 drivers/scsi/pm8001/pm8001_hwi.c  |  193 +++--
 drivers/scsi/pm8001/pm8001_init.c |   20 +++--
 drivers/scsi/pm8001/pm8001_sas.h  |   60 +++-
 3 files changed, 168 insertions(+), 105 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index 6a1b45b..33ebfea 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -1158,7 +1158,7 @@ static void pm8001_hw_chip_rst(struct pm8001_hba_info 
*pm8001_ha)
  * pm8001_chip_iounmap - which maped when initialized.
  * @pm8001_ha: our hba card information
  */
-static void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha)
+void pm8001_chip_iounmap(struct pm8001_hba_info *pm8001_ha)
 {
s8 bar, logical = 0;
for (bar = 0; bar < 6; bar++) {
@@ -1237,7 +1237,7 @@ pm8001_chip_msix_interrupt_disable(struct pm8001_hba_info 
*pm8001_ha,
  * @pm8001_ha: our hba card information
  */
 static void
-pm8001_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha)
+pm8001_chip_interrupt_enable(struct pm8001_hba_info *pm8001_ha, u8 vec)
 {
 #ifdef PM8001_USE_MSIX
pm8001_chip_msix_interrupt_enable(pm8001_ha, 0);
@@ -1252,7 +1252,7 @@ pm8001_chip_interrupt_enable(struct pm8001_hba_info 
*pm8001_ha)
  * @pm8001_ha: our hba card information
  */
 static void
-pm8001_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha)
+pm8001_chip_interrupt_disable(struct pm8001_hba_info *pm8001_ha, u8 vec)
 {
 #ifdef PM8001_USE_MSIX
pm8001_chip_msix_interrupt_disable(pm8001_ha, 0);
@@ -1263,12 +1263,13 @@ pm8001_chip_interrupt_disable(struct pm8001_hba_info 
*pm8001_ha)
 }
 
 /**
- * mpi_msg_free_get- get the free message buffer for transfer inbound queue.
+ * pm8001_mpi_msg_free_get - get the free message buffer for transfer
+ * inbound queue.
  * @circularQ: the inbound queue  we want to transfer to HBA.
  * @messageSize: the message size of this transfer, normally it is 64 bytes
  * @messagePtr: the pointer to message.
  */
-static int mpi_msg_free_get(struct inbound_queue_table *circularQ,
+int pm8001_mpi_msg_free_get(struct inbound_queue_table *circularQ,
u16 messageSize, void **messagePtr)
 {
u32 offset, consumer_index;
@@ -1276,7 +1277,7 @@ static int mpi_msg_free_get(struct inbound_queue_table 
*circularQ,
u8 bcCount = 1; /* only support single buffer */
 
/* Checks is the requested message size can be allocated in this queue*/
-   if (messageSize > 64) {
+   if (messageSize > IOMB_SIZE_SPCV) {
*messagePtr = NULL;
return -1;
}
@@ -1290,7 +1291,7 @@ static int mpi_msg_free_get(struct inbound_queue_table 
*circularQ,
return -1;
}
/* get memory IOMB buffer address */
-   offset = circularQ->producer_idx * 64;
+   offset = circularQ->producer_idx * messageSize;
/* increment to next bcCount element */
circularQ->producer_idx = (circularQ->producer_idx + bcCount)
% PM8001_MPI_QUEUE;
@@ -1302,29 +1303,30 @@ static int mpi_msg_free_get(struct inbound_queue_table 
*circularQ,
 }
 
 /**
- * mpi_build_cmd- build the message queue for transfer, update the PI to FW
- * to tell the fw to get this message from IOMB.
+ * pm8001_mpi_build_cmd- build the message queue for transfer, update the PI to
+ * FW to tell the fw to get this message from IOMB.
  * @pm8001_ha: our hba card information
  * @circularQ: the inbound queue we want to transfer to HBA.
  * @opCode: the operation code represents commands which LLDD and fw 
recognized.
  * @payload: the command payload of each operation command.
  */
-static int mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
+int pm8001_mpi_build_cmd(struct pm8001_hba_info *pm8001_ha,
 struct inbound_queue_table *circularQ,
-u32 opCode, void *payload)
+u32 opCode, void *payload, u32 responseQueue)
 {
u32 Header = 0, hpriority = 0, bc = 1, category = 0x02;
-   u32 responseQueue = 0;
void *pMessage;
 
-   if (mpi_msg_free_get(circularQ, 64, &pMessage) < 0) {
+   if (pm8001_mpi_msg_free_get(circularQ, pm8001_ha->iomb_size,
+   &pMessage) < 0) {
PM8001_IO_DBG(pm8001_ha,
pm8001_printk("No free mpi buffer\n"));
return -1;
}
BUG_ON(!payload);
/*Copy to the payload*/
-   memcpy(pMessage, payload, (64 - sizeof(struct mpi_msg_hdr)));
+   

[PATCH V4 3/12] pm80xx: Multiple inbound/outbound queue configuration

2013-04-18 Thread Anand
>From 6218dd8466f6771ff46dfcd0a820f853c62cde32 Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Wed, 27 Feb 2013 20:25:25 +0530
Subject: [PATCH V4 3/12] pm80xx: Multiple inbound/outbound queue configuration

Memory allocation and configuration of multiple inbound and
outbound queues.

Signed-off-by: Sakthivel K 
Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by: Hannes Reinecke 
---
 drivers/scsi/pm8001/pm8001_defs.h |   14 +++--
 drivers/scsi/pm8001/pm8001_hwi.c  |   43 
 drivers/scsi/pm8001/pm8001_init.c |  101 +
 3 files changed, 98 insertions(+), 60 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_defs.h 
b/drivers/scsi/pm8001/pm8001_defs.h
index b25f87c..26a2ee6 100644
--- a/drivers/scsi/pm8001/pm8001_defs.h
+++ b/drivers/scsi/pm8001/pm8001_defs.h
@@ -48,8 +48,7 @@ enum chip_flavors {
chip_8018,
chip_8019
 };
-#define USI_MAX_MEMCNT 9
-#define PM8001_MAX_DMA_SG  SG_ALL
+
 enum phy_speed {
PHY_SPEED_15 = 0x01,
PHY_SPEED_30 = 0x02,
@@ -87,13 +86,16 @@ enum port_type {
 #definePM8001_MAX_DEVICES   2048   /* max supported device */
 #definePM8001_MAX_MSIX_VEC  64 /* max msi-x int for spcv/ve */
 
+#define USI_MAX_MEMCNT_BASE4
+#define IB (USI_MAX_MEMCNT_BASE + 1)
+#define CI (IB + PM8001_MAX_SPCV_INB_NUM)
+#define OB (CI + PM8001_MAX_SPCV_INB_NUM)
+#define PI (OB + PM8001_MAX_SPCV_OUTB_NUM)
+#define USI_MAX_MEMCNT (PI + PM8001_MAX_SPCV_OUTB_NUM)
+#define PM8001_MAX_DMA_SG  SG_ALL
 enum memory_region_num {
AAP1 = 0x0, /* application acceleration processor */
IOP,/* IO processor */
-   CI, /* consumer index */
-   PI, /* producer index */
-   IB, /* inbound queue */
-   OB, /* outbound queue */
NVMD,   /* NVM device */
DEV_MEM,/* memory for devices */
CCB_MEM,/* memory for command control block */
diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index dc45fdc..6a1b45b 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -151,10 +151,9 @@ static void read_general_status_table(struct 
pm8001_hba_info *pm8001_ha)
  */
 static void read_inbnd_queue_table(struct pm8001_hba_info *pm8001_ha)
 {
-   int inbQ_num = 1;
int i;
void __iomem *address = pm8001_ha->inbnd_q_tbl_addr;
-   for (i = 0; i < inbQ_num; i++) {
+   for (i = 0; i < PM8001_MAX_INB_NUM; i++) {
u32 offset = i * 0x20;
pm8001_ha->inbnd_q_tbl[i].pi_pci_bar =
  get_pci_bar_index(pm8001_mr32(address, (offset + 0x14)));
@@ -169,10 +168,9 @@ static void read_inbnd_queue_table(struct pm8001_hba_info 
*pm8001_ha)
  */
 static void read_outbnd_queue_table(struct pm8001_hba_info *pm8001_ha)
 {
-   int outbQ_num = 1;
int i;
void __iomem *address = pm8001_ha->outbnd_q_tbl_addr;
-   for (i = 0; i < outbQ_num; i++) {
+   for (i = 0; i < PM8001_MAX_OUTB_NUM; i++) {
u32 offset = i * 0x24;
pm8001_ha->outbnd_q_tbl[i].ci_pci_bar =
  get_pci_bar_index(pm8001_mr32(address, (offset + 0x14)));
@@ -225,19 +223,19 @@ static void init_default_table_values(struct 
pm8001_hba_info *pm8001_ha)
pm8001_ha->inbnd_q_tbl[i].element_pri_size_cnt  =
PM8001_MPI_QUEUE | (64 << 16) | (0x00<<30);
pm8001_ha->inbnd_q_tbl[i].upper_base_addr   =
-   pm8001_ha->memoryMap.region[IB].phys_addr_hi;
+   pm8001_ha->memoryMap.region[IB + i].phys_addr_hi;
pm8001_ha->inbnd_q_tbl[i].lower_base_addr   =
-   pm8001_ha->memoryMap.region[IB].phys_addr_lo;
+   pm8001_ha->memoryMap.region[IB + i].phys_addr_lo;
pm8001_ha->inbnd_q_tbl[i].base_virt =
-   (u8 *)pm8001_ha->memoryMap.region[IB].virt_ptr;
+   (u8 *)pm8001_ha->memoryMap.region[IB + i].virt_ptr;
pm8001_ha->inbnd_q_tbl[i].total_length  =
-   pm8001_ha->memoryMap.region[IB].total_len;
+   pm8001_ha->memoryMap.region[IB + i].total_len;
pm8001_ha->inbnd_q_tbl[i].ci_upper_base_addr=
-   pm8001_ha->memoryMap.region[CI].phys_addr_hi;
+   pm8001_ha->memoryMap.region[CI + i].phys_addr_hi;
pm8001_ha->inbnd_q_tbl[i].ci_lower_base_addr=
-   pm8001_ha->memoryMap.region[CI].phys_addr_lo;
+   pm8001_ha->memoryMap.region[CI + i].phys_addr_lo;
pm8001_ha->inbnd_q_tbl[i].ci_virt   =
-   pm8001_ha->memoryMap.region[CI].virt_ptr;
+   pm8001_ha->me

[PATCH V4 2/12] pm80xx: Added SPCv/ve specific ids, variables and modify for SPC

2013-04-18 Thread Anand
>From 6e057b9cd46d2f0f1838cf727bf8c0abc6a7b399 Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Wed, 17 Apr 2013 16:26:36 +0530
Subject: [PATCH V4 2/12] pm80xx: Added SPCv/ve specific ids, variables and 
modify for SPC

Updated pci id table with device, vendor, subdevice and subvendor ids
for 8081, 8088, 8089 SAS/SATA controllers. Added SPCv/ve related macros.
Updated macros, hba info structure and other structures for SPCv/ve.
Update of structure and variable names for SPC hardware functionalities.

Signed-off-by: Sakthivel K 
Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by:  Hannes Reinecke 
---
 drivers/scsi/pm8001/pm8001_ctl.c  |   69 ++---
 drivers/scsi/pm8001/pm8001_defs.h |   19 +++-
 drivers/scsi/pm8001/pm8001_hwi.c  |  213 ++---
 drivers/scsi/pm8001/pm8001_init.c |   48 +++-
 drivers/scsi/pm8001/pm8001_sas.h  |   92 ++--
 5 files changed, 320 insertions(+), 121 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_ctl.c b/drivers/scsi/pm8001/pm8001_ctl.c
index 45bc197..ae2b124 100644
--- a/drivers/scsi/pm8001/pm8001_ctl.c
+++ b/drivers/scsi/pm8001/pm8001_ctl.c
@@ -1,5 +1,5 @@
 /*
- * PMC-Sierra SPC 8001 SAS/SATA based host adapters driver
+ * PMC-Sierra 8001/8081/8088/8089 SAS/SATA based host adapters driver
  *
  * Copyright (c) 2008-2009 USI Co., Ltd.
  * All rights reserved.
@@ -58,8 +58,13 @@ static ssize_t pm8001_ctl_mpi_interface_rev_show(struct 
device *cdev,
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
 
-   return snprintf(buf, PAGE_SIZE, "%d\n",
-   pm8001_ha->main_cfg_tbl.interface_rev);
+   if (pm8001_ha->chip_id == chip_8001) {
+   return snprintf(buf, PAGE_SIZE, "%d\n",
+   pm8001_ha->main_cfg_tbl.pm8001_tbl.interface_rev);
+   } else {
+   return snprintf(buf, PAGE_SIZE, "%d\n",
+   pm8001_ha->main_cfg_tbl.pm80xx_tbl.interface_rev);
+   }
 }
 static
 DEVICE_ATTR(interface_rev, S_IRUGO, pm8001_ctl_mpi_interface_rev_show, NULL);
@@ -78,11 +83,19 @@ static ssize_t pm8001_ctl_fw_version_show(struct device 
*cdev,
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
 
-   return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x.%02x\n",
-  (u8)(pm8001_ha->main_cfg_tbl.firmware_rev >> 24),
-  (u8)(pm8001_ha->main_cfg_tbl.firmware_rev >> 16),
-  (u8)(pm8001_ha->main_cfg_tbl.firmware_rev >> 8),
-  (u8)(pm8001_ha->main_cfg_tbl.firmware_rev));
+   if (pm8001_ha->chip_id == chip_8001) {
+   return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x.%02x\n",
+   (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev >> 24),
+   (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev >> 16),
+   (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev >> 8),
+   (u8)(pm8001_ha->main_cfg_tbl.pm8001_tbl.firmware_rev));
+   } else {
+   return snprintf(buf, PAGE_SIZE, "%02x.%02x.%02x.%02x\n",
+   (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev >> 24),
+   (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev >> 16),
+   (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev >> 8),
+   (u8)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.firmware_rev));
+   }
 }
 static DEVICE_ATTR(fw_version, S_IRUGO, pm8001_ctl_fw_version_show, NULL);
 /**
@@ -99,8 +112,13 @@ static ssize_t pm8001_ctl_max_out_io_show(struct device 
*cdev,
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
 
-   return snprintf(buf, PAGE_SIZE, "%d\n",
-   pm8001_ha->main_cfg_tbl.max_out_io);
+   if (pm8001_ha->chip_id == chip_8001) {
+   return snprintf(buf, PAGE_SIZE, "%d\n",
+   pm8001_ha->main_cfg_tbl.pm8001_tbl.max_out_io);
+   } else {
+   return snprintf(buf, PAGE_SIZE, "%d\n",
+   pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_out_io);
+   }
 }
 static DEVICE_ATTR(max_out_io, S_IRUGO, pm8001_ctl_max_out_io_show, NULL);
 /**
@@ -117,8 +135,15 @@ static ssize_t pm8001_ctl_max_devices_show(struct device 
*cdev,
struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
 
-   return snprintf(buf, PAGE_SIZE, "%04d\n",
-   (u16)(pm8001_ha->main_cfg_tbl.max_sgl >> 16));
+   if (pm8001_ha->chip_id == chip_8001) {
+   return snprintf(buf, PAGE_SIZE, "%04d\n",
+   (u16)(pm8001_ha->main_cfg_tbl.pm8001_tbl.max_sgl >> 16)
+   );
+   } else {
+   return snprintf(buf, PAGE_SIZE, "%04d\n",
+   (u16)(pm8001_ha->main_cfg_tbl.pm80xx_tbl.max_sgl >> 16)
+ 

[PATCH V4 1/12] pm80xx: fix for memory region free

2013-04-18 Thread Anand
>From 8464bcd3b7789798a1f34826fe51eb833ae0578d Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Mon, 4 Feb 2013 12:10:02 +0530
Subject: [PATCH V4 1/12] pm80xx: fix for memory region free

All memory regions are allocated based on variables total_len
and alignment but free was based on element_size.

Signed-off-by: Sakthivel K 
Signed-off-by: Anand Kumar S 
Ack-by: Jack Wang 
Ack-by: Hannes Reinecke 
---
 drivers/scsi/pm8001/pm8001_init.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/pm8001/pm8001_init.c 
b/drivers/scsi/pm8001/pm8001_init.c
index 4c9fe73..3d5e522 100644
--- a/drivers/scsi/pm8001/pm8001_init.c
+++ b/drivers/scsi/pm8001/pm8001_init.c
@@ -140,7 +140,8 @@ static void pm8001_free(struct pm8001_hba_info *pm8001_ha)
for (i = 0; i < USI_MAX_MEMCNT; i++) {
if (pm8001_ha->memoryMap.region[i].virt_ptr != NULL) {
pci_free_consistent(pm8001_ha->pdev,
-   pm8001_ha->memoryMap.region[i].element_size,
+   (pm8001_ha->memoryMap.region[i].total_len +
+   pm8001_ha->memoryMap.region[i].alignment),
pm8001_ha->memoryMap.region[i].virt_ptr,
pm8001_ha->memoryMap.region[i].phys_addr);
}
-- 
1.7.1

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


[PATCH V4 00/12] Support for PMC 8081/8088/8089 controllers

2013-04-18 Thread Anand
>From ffe82b1efc42510239046909a7ac0aff10bb4162 Mon Sep 17 00:00:00 2001
From: Sakthivel K 
Date: Tue, 19 Mar 2013 18:32:55 +0530
Subject: [PATCH V4 00/12] Support for PMC 8081/8088/8089 controllers

V4

Resubmission of patchset to handle patch apply issue
reported by James.
Fixed dependencies in patch 2 and 6.

V3

Resubmission of patchset addressing Hannes comment
on usage of multiple interrupt handlers for handling
MSI-X.

V2

Resubmission of patchset addressing Hannes comment
on usage of multiple tasklets for handling MSI-X.

1. Patch5 - Implemented a single tasklet to handle all MSI-x
interrupts

V1

Resubmission of pm8001 patchset based on James Bottomley comments

1. The patch permission level corrected to 644.
2. Patches 2 3 and 4 of the original patchset have been merged to a
   single patch (patch 2) to fix compilation error and ensure
   individual functionality.
3. Email id's changed to resolvable ids.

Sakthivel K (12):
  pm80xx: fix for memory region free
  pm80xx: Added SPCv/ve specific ids, variables and modify for SPC
  pm80xx: Multiple inbound/outbound queue configuration
  pm80xx: Updated common functions common for SPC and SPCv/ve
  pm80xx: MSI-X implementation for using 64 interrupts
  pm80xx: Added SPCv/ve specific hardware functionalities and  
relavent changes in common files
  pm80xx: SPC new firmware changes for device id 0x8081 alone
  pm80xx: Firmware flash memory free fix, with addition of new memory
region for it
  pm80xx: Changed module name and debug messages update
  pm80xx: WWN Modification for PM8081/88/89 controllers
  pm80xx: NCQ error handling changes
  pm80xx: thermal, sas controller config and error handling update

 drivers/scsi/pm8001/Makefile  |7 +-
 drivers/scsi/pm8001/pm8001_ctl.c  |   74 +-
 drivers/scsi/pm8001/pm8001_defs.h |   34 +-
 drivers/scsi/pm8001/pm8001_hwi.c  |  796 +---
 drivers/scsi/pm8001/pm8001_hwi.h  |4 +-
 drivers/scsi/pm8001/pm8001_init.c |  384 +++-
 drivers/scsi/pm8001/pm8001_sas.c  |  105 +-
 drivers/scsi/pm8001/pm8001_sas.h  |  177 ++-
 drivers/scsi/pm8001/pm80xx_hwi.c  | 4131 +
 drivers/scsi/pm8001/pm80xx_hwi.h  | 1524 ++
 10 files changed, 6845 insertions(+), 391 deletions(-)
 create mode 100644 drivers/scsi/pm8001/pm80xx_hwi.c
 create mode 100644 drivers/scsi/pm8001/pm80xx_hwi.h

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


Re: [Patch 1/1] cciss: bug fix, prevent cciss from loading in kdump kernel

2013-04-18 Thread Mike Miller (OS Dev)
On Wed, 2013-04-17 at 15:02 -0700, Andrew Morton wrote:
> On Mon, 15 Apr 2013 12:59:06 -0500 Mike Miller  wrote:
> 
> > Patch 1/1
> > 
> > If hpsa is selected as the Smart Array driver cciss may try to load in the
> > kdump kernel. When this happens kdump fails and a core file cannot be 
> > created.
> > This patch prevents cciss from trying to load in this scenario. This effects
> > primarily older Smart Array controllers.
> > 
> > ...
> >
> > --- a/drivers/block/cciss.c
> > +++ b/drivers/block/cciss.c
> > @@ -4960,6 +4960,12 @@ static int cciss_init_one(struct pci_dev *pdev, 
> > const struct pci_device_id *ent)
> > ctlr_info_t *h;
> > unsigned long flags;
> >  
> > +   /*
> > +* if this is the kdump kernel and the user has set the flags to
> > +* use hpsa rather than cciss just bail
> > +*/
> > +   if ((reset_devices) && (cciss_allow_hpsa == 1))
> > +   return -ENODEV;
> 
> OK, wazzup.  That's the only occurrence of the symbol
> "cciss_allow_hpsa" in Linux and needless to say, the compiler laughed
> at me.

Argh. Sorry about that. I could have sworn I tested that on rc7. I'll
have another patch ready in a bit to add the flag.

> 


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


Re: [Patch 1/1] cciss: bug fix, prevent cciss from loading in kdump kernel

2013-04-18 Thread Mike Miller (OS Dev)
On Tue, 2013-04-16 at 15:00 -0700, Andrew Morton wrote:
> On Mon, 15 Apr 2013 12:59:06 -0500 Mike Miller  wrote:
> 
> > Patch 1/1
> > 
> > If hpsa is selected as the Smart Array driver cciss may try to load in the
> > kdump kernel. When this happens kdump fails and a core file cannot be 
> > created.
> > This patch prevents cciss from trying to load in this scenario. This effects
> > primarily older Smart Array controllers.
> > 
> 
> OK, this is weird.  kdump and scsi drivers are pretty darn remote things
> and I've never heard of such an interaction.  Can you tell us a bit more
> about how and why this happened?  Is there something special about
> cciss, or can we expect similar kdump interactions with other device drivers?

I thought it was weird, too. I've never seen this happen before and it
was very hard to duplicate this in the lab. I think the reason it did
happen was twofold. The cciss driver was being loaded first from the
kdump initramfs image and the driver load sequence is now different than
it used to be. We used to call cciss_pci_init as one the first things we
did from our probe function, cciss_init_one. Now if reset_devices is
true we immediately call into cciss_hard_reset controller and we do not
check to see if cciss_allow_hpsa is set. Sorry, that's the best
explanation I have.
Offhand, I don't know of any of any other hardware devices that have 2
distinctly different drivers, one block and one scsi. So I don't _think_
this would happen with other drivers/devices.

-- mikem

> 
> 


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


[patch 1/1] sd_dif: problem with verify of type 1 protection information (PI)

2013-04-18 Thread Jeremy Higdon
It appears to me that there is a problem with handling of type 1 protection 
information.

It is considering a logical block reference tag of 0x to be an error,
but it is actually valid any time ((lba & 0x) == 0x) [for
example, 2TiB-1, 4TiB-1, 6TiB-1, etc.].

I'm going by what's written in 4.18.3 of SBC3, where there doesn't appear
to be any invalid value for the reference tag.

Signed-off-by: Jeremy Higdon 


 sd_dif.c |8 
 1 file changed, 8 deletions(-)


--- a/drivers/scsi/sd_dif.c 2013-04-14 17:45:16.0 -0700
+++ b/drivers/scsi/sd_dif.c 2013-04-18 02:36:27.0 -0700
@@ -93,14 +93,6 @@ static int sd_dif_type1_verify(struct bl
if (sdt->app_tag == 0x)
return 0;
 
-   /* Bad ref tag received from disk */
-   if (sdt->ref_tag == 0x) {
-   printk(KERN_ERR
-  "%s: bad phys ref tag on sector %lu\n",
-  bix->disk_name, (unsigned long)sector);
-   return -EIO;
-   }
-
if (be32_to_cpu(sdt->ref_tag) != (sector & 0x)) {
printk(KERN_ERR
   "%s: ref tag error on sector %lu (rcvd %u)\n",
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] scsi: ufs: add support for query requests

2013-04-18 Thread Dolev Raviv
Hi All,

A minor bug was spotted, as shown blow. The fix will be submitted with the
next version.

> +static int ufshcd_compose_upiu(struct ufs_hba *hba, struct ufshcd_lrb
> *lrbp)
> +{
> + u32 upiu_flags;
> + int ret = 0;
> +
> + if (!lrbp) {
> + dev_err(hba->dev, "%s: lrbp can not be NULL\n", __func__);
> + ret = -EINVAL;
> + } else if (!lrbp->ucd_req_ptr) {
> + dev_err(hba->dev, "%s: ucd_req_ptr can not be NULL\n",
> + __func__);
> + ret = -EINVAL;
> + } else if (!lrbp->utr_descriptor_ptr) {
> + dev_err(hba->dev, "%s: utr_descriptor_ptr can not be NULL\n",
> + __func__);
> + ret = -EINVAL;
> + }
> + if (!ret)
> + goto exit;
should be:
if (ret)

Thanks,
Dolev

-- 
QUALCOMM ISRAEL, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation


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