[patch] [SCSI] mvumi: use GFP_ATOMIC under spin lock

2012-09-29 Thread Dan Carpenter
This is called from the interrupt handler and with spin_locks held.  Use
GFP_ATOMIC.  The call tree looks like:
  mvumi_isr_handler() - takes a spin lock
  - mvumi_handshake()
 - mvumi_init_data()
- mvumi_alloc_mem_resource() - GFP_KERNEL

Signed-off-by: Dan Carpenter dan.carpen...@oracle.com

diff --git a/drivers/scsi/mvumi.c b/drivers/scsi/mvumi.c
index 783edc7..5ad8da4 100644
--- a/drivers/scsi/mvumi.c
+++ b/drivers/scsi/mvumi.c
@@ -118,7 +118,7 @@ static int mvumi_map_pci_addr(struct pci_dev *dev, void 
**addr_array)
 static struct mvumi_res *mvumi_alloc_mem_resource(struct mvumi_hba *mhba,
enum resource_type type, unsigned int size)
 {
-   struct mvumi_res *res = kzalloc(sizeof(*res), GFP_KERNEL);
+   struct mvumi_res *res = kzalloc(sizeof(*res), GFP_ATOMIC);
 
if (!res) {
dev_err(mhba-pdev-dev,
@@ -128,7 +128,7 @@ static struct mvumi_res *mvumi_alloc_mem_resource(struct 
mvumi_hba *mhba,
 
switch (type) {
case RESOURCE_CACHED_MEMORY:
-   res-virt_addr = kzalloc(size, GFP_KERNEL);
+   res-virt_addr = kzalloc(size, GFP_ATOMIC);
if (!res-virt_addr) {
dev_err(mhba-pdev-dev,
unable to allocate memory,size = %d.\n, size);
--
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 v7 2/6] scsi: sr: support runtime pm

2012-09-29 Thread Alan Stern
On Sat, 29 Sep 2012, Aaron Lu wrote:

  I don't think this is a good idea, quite frankly.  sr seems to be a too
  generic place for that.
 
 Does this mean sr can only have code that is useful to all devices it
 manages? i.e. If a piece of code enables a feature for a special kind of
 ODD(like the sata based ZPODD), it shouldn't be done in sr?

Drivers are allowed to have special features and quirks that apply only 
to some devices.

 There is nothing in theory stopping us from doing this in ata layer.
 For the loading mechanism, we can always send an ATAPI command to figure
 it out.
 
 So gentlemen, I need your opinions on where this ZPODD code should live
 before I can continue this work, thanks.

Can arbitrary SCSI devices be ZP, or does this notion apply only to
ATAPI-based drives?  That's the key question, and the answer determines
where the ZP support belongs.

On the other hand, the sr driver certainly deserves to have some form 
of runtime PM support, even for devices that aren't ZP.

Alan Stern

--
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 v7 2/6] scsi: sr: support runtime pm

2012-09-29 Thread Aaron Lu
On 09/29/2012 10:29 PM, Alan Stern wrote:
 On Sat, 29 Sep 2012, Aaron Lu wrote:
 
 I don't think this is a good idea, quite frankly.  sr seems to be a too
 generic place for that.

 Does this mean sr can only have code that is useful to all devices it
 manages? i.e. If a piece of code enables a feature for a special kind of
 ODD(like the sata based ZPODD), it shouldn't be done in sr?
 
 Drivers are allowed to have special features and quirks that apply only 
 to some devices.

I think SATA based zero power capable ODDs are the some devices.

 
 There is nothing in theory stopping us from doing this in ata layer.
 For the loading mechanism, we can always send an ATAPI command to figure
 it out.

 So gentlemen, I need your opinions on where this ZPODD code should live
 before I can continue this work, thanks.
 
 Can arbitrary SCSI devices be ZP, or does this notion apply only to
 ATAPI-based drives?  That's the key question, and the answer determines
 where the ZP support belongs.

I don't know if arbitrary SCSI devices can be ZP or not, the SPC spec
doesn't seem to define such a power state.

ZPODD is defined for sata based ATAPI ODD which supports device
attention, but doesn't specify how the ODD is powered off and how the
device attention pin notifies OS. On x86 systems, these are implemented
by ACPI.

Though SCSI devices may not have a general notion of ZP, the fact that
ZPODD are managed by sr driver is enough to make the decision that ZPODD
code can live in sr?

 
 On the other hand, the sr driver certainly deserves to have some form 
 of runtime PM support, even for devices that aren't ZP.

Agree.

And the following codes need to find a home:
- Code used to handle ACPI wake notification(currently done in ATA, but
  causes the annoying need_eject flag in scsi_device);
- Code to check if the ODD is ready to be powered off per the ZPODD
  spec.

Thanks,
Aaron

--
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 00/16] lpfc 8.3.35: Update lpfc to revision 8.3.35

2012-09-29 Thread James Smart
This patch set updates the lpfc driver to revision 8.3.35

The patches for 8.3.35 contain:

- Fix interrupt delay multipler conversion for eq_create
- Added checking BMBX register for RDY bit before writing the first address in
- Fix incorrect comment in T10 DIF attributes
- Correct missing queue destroy on function reset
- Expand I/O channel support for large systems
- Fixed Linux generic firmware download on SLI4 devices with longer module names
- Fix FCP2 Retries for non-r/w commands.
- Correct request_firmware use that was increasing boot times
- Fixed PRLI not being retried if a LS_RJT with a reason 
- Fixed kernel warning on spinlock usage on some distributions
- Fixed messages for misconfigured port errors 
- Fixed not checking solicition in progress bit when verifying FCF
  record for use
- Fixed SCSI host create showing wrong link speed on SLI3 HBA ports
- Fix error with fabric service parameters
- Fixed not reporting logical link speed to SCSI midlayer when QoS not on
- Update lpfc version for 8.3.35 driver release


The patches were cut against scsi.git, branch misc.

-- james s


Signed-off-by: James Smart james.sm...@emulex.com





--
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 01/16] lpfc 8.3.35: Fix interrupt delay multipler conversion for eq_create

2012-09-29 Thread James Smart
Fix interrupt delay multipler conversion for eq_create


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_sli.c  |   15 +++
 lpfc_sli4.h |2 +-
 2 files changed, 12 insertions(+), 5 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_sli4.h b/drivers/scsi/lpfc/lpfc_sli4.h
--- a/drivers/scsi/lpfc/lpfc_sli4.h 2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli4.h 2012-09-26 21:11:18.456153500 -0400
@@ -626,7 +626,7 @@ void lpfc_sli4_hba_reset(struct lpfc_hba
 struct lpfc_queue *lpfc_sli4_queue_alloc(struct lpfc_hba *, uint32_t,
uint32_t);
 void lpfc_sli4_queue_free(struct lpfc_queue *);
-uint32_t lpfc_eq_create(struct lpfc_hba *, struct lpfc_queue *, uint16_t);
+uint32_t lpfc_eq_create(struct lpfc_hba *, struct lpfc_queue *, uint32_t);
 uint32_t lpfc_modify_fcp_eq_delay(struct lpfc_hba *, uint16_t);
 uint32_t lpfc_cq_create(struct lpfc_hba *, struct lpfc_queue *,
struct lpfc_queue *, uint32_t, uint32_t);
diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2012-09-26 21:11:18.464153500 -0400
@@ -12099,6 +12099,7 @@ lpfc_modify_fcp_eq_delay(struct lpfc_hba
struct lpfc_queue *eq;
int cnt, rc, length, status = 0;
uint32_t shdr_status, shdr_add_status;
+   uint32_t result;
int fcp_eqidx;
union lpfc_sli4_cfg_shdr *shdr;
uint16_t dmult;
@@ -12117,8 +12118,11 @@ lpfc_modify_fcp_eq_delay(struct lpfc_hba
eq_delay = mbox-u.mqe.un.eq_delay;
 
/* Calculate delay multiper from maximum interrupt per second */
-   dmult = phba-cfg_fcp_imax / phba-cfg_fcp_io_channel;
-   dmult = LPFC_DMULT_CONST/dmult - 1;
+   result = phba-cfg_fcp_imax / phba-cfg_fcp_io_channel;
+   if (result  LPFC_DMULT_CONST)
+   dmult = 0;
+   else
+   dmult = LPFC_DMULT_CONST/result - 1;
 
cnt = 0;
for (fcp_eqidx = startq; fcp_eqidx  phba-cfg_fcp_io_channel;
@@ -12174,7 +12178,7 @@ lpfc_modify_fcp_eq_delay(struct lpfc_hba
  * fails this function will return -ENXIO.
  **/
 uint32_t
-lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint16_t imax)
+lpfc_eq_create(struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax)
 {
struct lpfc_mbx_eq_create *eq_create;
LPFC_MBOXQ_t *mbox;
@@ -12206,7 +12210,10 @@ lpfc_eq_create(struct lpfc_hba *phba, st
   LPFC_EQE_SIZE);
bf_set(lpfc_eq_context_valid, eq_create-u.request.context, 1);
/* Calculate delay multiper from maximum interrupt per second */
-   dmult = LPFC_DMULT_CONST/imax - 1;
+   if (imax  LPFC_DMULT_CONST)
+   dmult = 0;
+   else
+   dmult = LPFC_DMULT_CONST/imax - 1;
bf_set(lpfc_eq_context_delay_multi, eq_create-u.request.context,
   dmult);
switch (eq-entry_count) {



--
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 02/16] lpfc 8.3.35: Added checking BMBX register for RDY bit before writing the first address in

2012-09-29 Thread James Smart
Added checking BMBX register for RDY bit before writing the first address in


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_sli.c |   75 ++---
 1 file changed, 47 insertions(+), 28 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2012-09-26 21:11:18.464153500 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2012-09-26 21:11:28.318153726 -0400
@@ -7072,6 +7072,40 @@ lpfc_sli4_async_mbox_unblock(struct lpfc
 }
 
 /**
+ * lpfc_sli4_wait_bmbx_ready - Wait for bootstrap mailbox register ready
+ * @phba: Pointer to HBA context object.
+ * @mboxq: Pointer to mailbox object.
+ *
+ * The function waits for the bootstrap mailbox register ready bit from
+ * port for twice the regular mailbox command timeout value.
+ *
+ *  0 - no timeout on waiting for bootstrap mailbox register ready.
+ *  MBXERR_ERROR - wait for bootstrap mailbox register timed out.
+ **/
+static int
+lpfc_sli4_wait_bmbx_ready(struct lpfc_hba *phba, LPFC_MBOXQ_t *mboxq)
+{
+   uint32_t db_ready;
+   unsigned long timeout;
+   struct lpfc_register bmbx_reg;
+
+   timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq)
+  * 1000) + jiffies;
+
+   do {
+   bmbx_reg.word0 = readl(phba-sli4_hba.BMBXregaddr);
+   db_ready = bf_get(lpfc_bmbx_rdy, bmbx_reg);
+   if (!db_ready)
+   msleep(2);
+
+   if (time_after(jiffies, timeout))
+   return MBXERR_ERROR;
+   } while (!db_ready);
+
+   return 0;
+}
+
+/**
  * lpfc_sli4_post_sync_mbox - Post an SLI4 mailbox to the bootstrap mailbox
  * @phba: Pointer to HBA context object.
  * @mboxq: Pointer to mailbox object.
@@ -7092,15 +7126,12 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba
 {
int rc = MBX_SUCCESS;
unsigned long iflag;
-   uint32_t db_ready;
uint32_t mcqe_status;
uint32_t mbx_cmnd;
-   unsigned long timeout;
struct lpfc_sli *psli = phba-sli;
struct lpfc_mqe *mb = mboxq-u.mqe;
struct lpfc_bmbx_create *mbox_rgn;
struct dma_address *dma_address;
-   struct lpfc_register bmbx_reg;
 
/*
 * Only one mailbox can be active to the bootstrap mailbox region
@@ -7124,6 +7155,11 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba
phba-sli.mbox_active = mboxq;
spin_unlock_irqrestore(phba-hbalock, iflag);
 
+   /* wait for bootstrap mbox register for readyness */
+   rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq);
+   if (rc)
+   goto exit;
+
/*
 * Initialize the bootstrap memory region to avoid stale data areas
 * in the mailbox post.  Then copy the caller's mailbox contents to
@@ -7138,35 +7174,18 @@ lpfc_sli4_post_sync_mbox(struct lpfc_hba
dma_address = phba-sli4_hba.bmbx.dma_address;
writel(dma_address-addr_hi, phba-sli4_hba.BMBXregaddr);
 
-   timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq)
-  * 1000) + jiffies;
-   do {
-   bmbx_reg.word0 = readl(phba-sli4_hba.BMBXregaddr);
-   db_ready = bf_get(lpfc_bmbx_rdy, bmbx_reg);
-   if (!db_ready)
-   msleep(2);
-
-   if (time_after(jiffies, timeout)) {
-   rc = MBXERR_ERROR;
-   goto exit;
-   }
-   } while (!db_ready);
+   /* wait for bootstrap mbox register for hi-address write done */
+   rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq);
+   if (rc)
+   goto exit;
 
/* Post the low mailbox dma address to the port. */
writel(dma_address-addr_lo, phba-sli4_hba.BMBXregaddr);
-   timeout = msecs_to_jiffies(lpfc_mbox_tmo_val(phba, mboxq)
-  * 1000) + jiffies;
-   do {
-   bmbx_reg.word0 = readl(phba-sli4_hba.BMBXregaddr);
-   db_ready = bf_get(lpfc_bmbx_rdy, bmbx_reg);
-   if (!db_ready)
-   msleep(2);
 
-   if (time_after(jiffies, timeout)) {
-   rc = MBXERR_ERROR;
-   goto exit;
-   }
-   } while (!db_ready);
+   /* wait for bootstrap mbox register for low address write done */
+   rc = lpfc_sli4_wait_bmbx_ready(phba, mboxq);
+   if (rc)
+   goto exit;
 
/*
 * Read the CQ to ensure the mailbox has completed.



--
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 03/16] lpfc 8.3.35: Fix incorrect comment in T10 DIF attributes

2012-09-29 Thread James Smart
Fix incorrect comment in T10 DIF attributes


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_attr.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
--- a/drivers/scsi/lpfc/lpfc_attr.c 2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_attr.c 2012-09-26 21:11:31.694153802 -0400
@@ -3935,6 +3935,12 @@ MODULE_PARM_DESC(lpfc_fcp_look_ahead, L
 #  - Only meaningful if BG is turned on (lpfc_enable_bg=1).
 #  - Allows you to ultimately specify which profiles to use
 #  - Default will result in registering capabilities for all profiles.
+#  - SHOST_DIF_TYPE1_PROTECTION1
+#  HBA supports T10 DIF Type 1: HBA to Target Type 1 Protection
+#  - SHOST_DIX_TYPE0_PROTECTION8
+#  HBA supports DIX Type 0: Host to HBA protection only
+#  - SHOST_DIX_TYPE1_PROTECTION16
+#  HBA supports DIX Type 1: Host to HBA  Type 1 protection
 #
 */
 unsigned int lpfc_prot_mask = SHOST_DIF_TYPE1_PROTECTION |
@@ -3947,7 +3953,7 @@ MODULE_PARM_DESC(lpfc_prot_mask, host p
 /*
 # lpfc_prot_guard: i
 #  - Bit mask of protection guard types to register with the SCSI mid-layer
-#  - Guard types are currently either 1) IP checksum 2) T10-DIF CRC
+#  - Guard types are currently either 1) T10-DIF CRC 2) IP checksum
 #  - Allows you to ultimately specify which profiles to use
 #  - Default will result in registering capabilities for all guard types
 #



--
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 04/16] lpfc 8.3.35: Correct missing queue destroy on function reset

2012-09-29 Thread James Smart
Correct missing queue destroy on function reset


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_sli.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2012-09-26 21:11:28.318153726 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2012-09-26 21:11:34.543153866 -0400
@@ -3964,9 +3964,9 @@ lpfc_sli4_brdreset(struct lpfc_hba *phba
pci_write_config_word(phba-pcidev, PCI_COMMAND, (cfg_value 
  ~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR)));
 
-   /* Perform FCoE PCI function reset */
-   lpfc_sli4_queue_destroy(phba);
+   /* Perform FCoE PCI function reset before freeing queue memory */
rc = lpfc_pci_function_reset(phba);
+   lpfc_sli4_queue_destroy(phba);
 
/* Restore PCI cmd register */
pci_write_config_word(phba-pcidev, PCI_COMMAND, cfg_value);



--
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 05/16] lpfc 8.3.35: Expand I/O channel support for large systems

2012-09-29 Thread James Smart
Expand I/O channel support for large systems


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_init.c |   40 +---
 lpfc_sli4.h |4 +---
 2 files changed, 22 insertions(+), 22 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:11:36.039153900 -0400
@@ -4947,7 +4947,7 @@ lpfc_sli4_driver_resource_setup(struct l
}
 
phba-sli4_hba.msix_entries = kzalloc((sizeof(struct msix_entry) *
- phba-sli4_hba.cfg_eqn), GFP_KERNEL);
+ phba-cfg_fcp_io_channel), GFP_KERNEL);
if (!phba-sli4_hba.msix_entries) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2573 Failed allocate memory for msi-x 
@@ -6559,7 +6559,8 @@ lpfc_sli4_queue_verify(struct lpfc_hba *
i++;
}
if (i  cfg_fcp_io_channel) {
-   lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
+   lpfc_printf_log(phba,
+   KERN_ERR, LOG_INIT,
3188 Reducing IO channels to match number of 
CPUs: from %d to %d\n, cfg_fcp_io_channel, i);
cfg_fcp_io_channel = i;
@@ -6567,8 +6568,8 @@ lpfc_sli4_queue_verify(struct lpfc_hba *
 
if (cfg_fcp_io_channel 
phba-sli4_hba.max_cfg_param.max_eq) {
-   cfg_fcp_io_channel = phba-sli4_hba.max_cfg_param.max_eq;
-   if (cfg_fcp_io_channel  LPFC_FCP_IO_CHAN_MIN) {
+   if (phba-sli4_hba.max_cfg_param.max_eq 
+   LPFC_FCP_IO_CHAN_MIN) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
2574 Not enough EQs (%d) from the 
pci function for supporting FCP 
@@ -6577,13 +6578,12 @@ lpfc_sli4_queue_verify(struct lpfc_hba *
phba-cfg_fcp_io_channel);
goto out_error;
}
-   lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
-   2575 Not enough EQs (%d) from the pci 
-   function for supporting the requested 
-   FCP EQs (%d), the actual FCP EQs can 
-   be supported: %d\n,
-   phba-sli4_hba.max_cfg_param.max_eq,
-   phba-cfg_fcp_io_channel, cfg_fcp_io_channel);
+   lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+   2575 Reducing IO channels to match number of 
+   available EQs: from %d to %d\n,
+   cfg_fcp_io_channel,
+   phba-sli4_hba.max_cfg_param.max_eq);
+   cfg_fcp_io_channel = phba-sli4_hba.max_cfg_param.max_eq;
}
 
/* Eventually cfg_fcp_eq_count / cfg_fcp_wq_count will be depricated */
@@ -6592,7 +6592,6 @@ lpfc_sli4_queue_verify(struct lpfc_hba *
phba-cfg_fcp_eq_count = cfg_fcp_io_channel;
phba-cfg_fcp_wq_count = cfg_fcp_io_channel;
phba-cfg_fcp_io_channel = cfg_fcp_io_channel;
-   phba-sli4_hba.cfg_eqn = cfg_fcp_io_channel;
 
/* Get EQ depth from module parameter, fake the default for now */
phba-sli4_hba.eq_esize = LPFC_EQE_SIZE_4B;
@@ -8095,11 +8094,11 @@ lpfc_sli4_enable_msix(struct lpfc_hba *p
int vectors, rc, index;
 
/* Set up MSI-X multi-message vectors */
-   for (index = 0; index  phba-sli4_hba.cfg_eqn; index++)
+   for (index = 0; index  phba-cfg_fcp_io_channel; index++)
phba-sli4_hba.msix_entries[index].entry = index;
 
/* Configure MSI-X capability structure */
-   vectors = phba-sli4_hba.cfg_eqn;
+   vectors = phba-cfg_fcp_io_channel;
 enable_msix_vectors:
rc = pci_enable_msix(phba-pcidev, phba-sli4_hba.msix_entries,
 vectors);
@@ -8142,8 +8141,14 @@ enable_msix_vectors:
goto cfg_fail_out;
}
}
-   phba-sli4_hba.msix_vec_nr = vectors;
 
+   if (vectors != phba-cfg_fcp_io_channel) {
+   lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+   3238 Reducing IO channels to match number of 
+   MSI-X vectors, requested %d got %d\n,
+   phba-cfg_fcp_io_channel, vectors);
+   phba-cfg_fcp_io_channel = vectors;
+   }
return rc;
 
 cfg_fail_out:
@@ -8171,7 +8176,7 @@ lpfc_sli4_disable_msix(struct lpfc_hba *
int index;
 
/* Free up MSI-X multi-message vectors */
-   for (index = 0; index  phba-sli4_hba.msix_vec_nr; index++)
+   for (index = 0; index  

[PATCH 06/16] lpfc 8.3.35: Fixed Linux generic firmware download on SLI4 devices with longer module names

2012-09-29 Thread James Smart
Fixed Linux generic firmware download on SLI4 devices with longer module names


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc.h  |2 ++
 lpfc_init.c |5 +++--
 2 files changed, 5 insertions(+), 2 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc.h b/drivers/scsi/lpfc/lpfc.h
--- a/drivers/scsi/lpfc/lpfc.h  2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc.h  2012-09-26 21:11:37.205153927 -0400
@@ -27,6 +27,8 @@
 
 struct lpfc_sli2_slim;
 
+#define ELX_MODEL_NAME_SIZE80
+
 #define LPFC_PCI_DEV_LP0x1
 #define LPFC_PCI_DEV_OC0x2
 
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:11:36.039153900 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:11:37.227153927 -0400
@@ -9428,7 +9428,7 @@ lpfc_pci_probe_one_s4(struct pci_dev *pd
int mcnt;
int adjusted_fcp_io_channel;
const struct firmware *fw;
-   uint8_t file_name[16];
+   uint8_t file_name[ELX_MODEL_NAME_SIZE];
 
/* Allocate memory for HBA structure */
phba = lpfc_hba_alloc(pdev);
@@ -9574,7 +9574,8 @@ lpfc_pci_probe_one_s4(struct pci_dev *pd
/* check for firmware upgrade or downgrade (if_type 2 only) */
if (bf_get(lpfc_sli_intf_if_type, phba-sli4_hba.sli_intf) ==
LPFC_SLI_INTF_IF_TYPE_2) {
-   snprintf(file_name, 16, %s.grp, phba-ModelName);
+   snprintf(file_name, ELX_MODEL_NAME_SIZE, %s.grp,
+phba-ModelName);
error = request_firmware(fw, file_name, phba-pcidev-dev);
if (!error) {
lpfc_write_firmware(phba, fw);



--
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 07/16] lpfc 8.3.35: Fix FCP2 Retries for non-r/w commands.

2012-09-29 Thread James Smart
Fix FCP2 Retries for non-r/w commands.


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_sli.c |2 ++
 1 file changed, 2 insertions(+)


diff -upNr a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c
--- a/drivers/scsi/lpfc/lpfc_sli.c  2012-09-26 21:11:34.543153866 -0400
+++ b/drivers/scsi/lpfc/lpfc_sli.c  2012-09-26 21:11:38.481153956 -0400
@@ -8109,6 +8109,8 @@ lpfc_sli4_iocb2wqe(struct lpfc_hba *phba
bf_set(wqe_lenloc, wqe-fcp_icmd.wqe_com,
   LPFC_WQE_LENLOC_NONE);
bf_set(wqe_ebde_cnt, wqe-fcp_icmd.wqe_com, 0);
+   bf_set(wqe_erp, wqe-fcp_icmd.wqe_com,
+  iocbq-iocb.ulpFCP2Rcvy);
break;
case CMD_GEN_REQUEST64_CR:
/* For this command calculate the xmit length of the



--
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 08/16] lpfc 8.3.35: Correct request_firmware use that was increasing boot times

2012-09-29 Thread James Smart
Correct request_firmware use that was increasing boot times


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_init.c |   57 +++--
 1 file changed, 31 insertions(+), 26 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:11:37.227153927 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:11:40.048153996 -0400
@@ -9309,23 +9309,28 @@ lpfc_sli4_get_els_iocb_cnt(struct lpfc_h
 
 /**
  * lpfc_write_firmware - attempt to write a firmware image to the port
- * @phba: pointer to lpfc hba data structure.
  * @fw: pointer to firmware image returned from request_firmware.
+ * @phba: pointer to lpfc hba data structure.
  *
- * returns the number of bytes written if write is successful.
- * returns a negative error value if there were errors.
- * returns 0 if firmware matches currently active firmware on port.
  **/
-int
-lpfc_write_firmware(struct lpfc_hba *phba, const struct firmware *fw)
+static void
+lpfc_write_firmware(const struct firmware *fw, void *context)
 {
+   struct lpfc_hba *phba = (struct lpfc_hba *)context;
char fwrev[FW_REV_STR_SIZE];
-   struct lpfc_grp_hdr *image = (struct lpfc_grp_hdr *)fw-data;
+   struct lpfc_grp_hdr *image;
struct list_head dma_buffer_list;
int i, rc = 0;
struct lpfc_dmabuf *dmabuf, *next;
uint32_t offset = 0, temp_offset = 0;
 
+   /* It can be null, sanity check */
+   if (!fw) {
+   rc = -ENXIO;
+   goto out;
+   }
+   image = (struct lpfc_grp_hdr *)fw-data;
+
INIT_LIST_HEAD(dma_buffer_list);
if ((be32_to_cpu(image-magic_number) != LPFC_GROUP_OJECT_MAGIC_NUM) ||
(bf_get_be32(lpfc_grp_hdr_file_type, image) !=
@@ -9338,12 +9343,13 @@ lpfc_write_firmware(struct lpfc_hba *phb
be32_to_cpu(image-magic_number),
bf_get_be32(lpfc_grp_hdr_file_type, image),
bf_get_be32(lpfc_grp_hdr_id, image));
-   return -EINVAL;
+   rc = -EINVAL;
+   goto release_out;
}
lpfc_decode_firmware_rev(phba, fwrev, 1);
if (strncmp(fwrev, image-revision, strnlen(image-revision, 16))) {
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-   3023 Updating Firmware. Current Version:%s 
+   3023 Updating Firmware, Current Version:%s 
New Version:%s\n,
fwrev, image-revision);
for (i = 0; i  LPFC_MBX_WR_CONFIG_MAX_BDE; i++) {
@@ -9351,7 +9357,7 @@ lpfc_write_firmware(struct lpfc_hba *phb
 GFP_KERNEL);
if (!dmabuf) {
rc = -ENOMEM;
-   goto out;
+   goto release_out;
}
dmabuf-virt = dma_alloc_coherent(phba-pcidev-dev,
  SLI4_PAGE_SIZE,
@@ -9360,7 +9366,7 @@ lpfc_write_firmware(struct lpfc_hba *phb
if (!dmabuf-virt) {
kfree(dmabuf);
rc = -ENOMEM;
-   goto out;
+   goto release_out;
}
list_add_tail(dmabuf-list, dma_buffer_list);
}
@@ -9380,23 +9386,24 @@ lpfc_write_firmware(struct lpfc_hba *phb
}
rc = lpfc_wr_object(phba, dma_buffer_list,
(fw-size - offset), offset);
-   if (rc) {
-   lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-   3024 Firmware update failed. 
-   %d\n, rc);
-   goto out;
-   }
+   if (rc)
+   goto release_out;
}
rc = offset;
}
-out:
+
+release_out:
list_for_each_entry_safe(dmabuf, next, dma_buffer_list, list) {
list_del(dmabuf-list);
dma_free_coherent(phba-pcidev-dev, SLI4_PAGE_SIZE,
  dmabuf-virt, dmabuf-phys);
kfree(dmabuf);
}
-   return rc;
+   release_firmware(fw);
+out:
+   lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
+   3024 Firmware update done: %d., rc);
+   return;
 }
 
 /**
@@ -9423,11 +9430,10 @@ lpfc_pci_probe_one_s4(struct pci_dev *pd
struct lpfc_hba   *phba;
struct lpfc_vport *vport = NULL;
struct Scsi_Host  *shost = NULL;
-   int error;
+   int 

[PATCH 09/16] lpfc 8.3.35: Fixed PRLI not being retried if a LS_RJT with a reason

2012-09-29 Thread James Smart
Fixed PRLI not being retried if a LS_RJT with a reason


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_els.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
--- a/drivers/scsi/lpfc/lpfc_els.c  2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_els.c  2012-09-26 21:11:41.195154018 -0400
@@ -3160,7 +3160,8 @@ lpfc_els_retry(struct lpfc_hba *phba, st
retry = 1;
break;
}
-   if (cmd == ELS_CMD_PLOGI) {
+   if ((cmd == ELS_CMD_PLOGI) ||
+   (cmd == ELS_CMD_PRLI)) {
delay = 1000;
maxretry = lpfc_max_els_tries + 1;
retry = 1;
@@ -3305,7 +3306,7 @@ lpfc_els_retry(struct lpfc_hba *phba, st
ndlp-nlp_prev_state = ndlp-nlp_state;
if (cmd == ELS_CMD_PRLI)
lpfc_nlp_set_state(vport, ndlp,
-   NLP_STE_REG_LOGIN_ISSUE);
+   NLP_STE_PRLI_ISSUE);
else
lpfc_nlp_set_state(vport, ndlp,
NLP_STE_NPR_NODE);



--
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 10/16] lpfc 8.3.35: Fixed kernel warning on spinlock usage on some distributions

2012-09-29 Thread James Smart
Fixed kernel warning on spinlock usage on some distributions


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_scsi.c |   21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c
--- a/drivers/scsi/lpfc/lpfc_scsi.c 2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_scsi.c 2012-09-26 21:11:42.521154049 -0400
@@ -3829,9 +3829,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba
cmd-scsi_done(cmd);
 
if (phba-cfg_poll  ENABLE_FCP_RING_POLLING) {
-   spin_lock_irq(phba-hbalock);
+   spin_lock_irqsave(phba-hbalock, flags);
lpfc_cmd-pCmd = NULL;
-   spin_unlock_irq(phba-hbalock);
+   spin_unlock_irqrestore(phba-hbalock, flags);
 
/*
 * If there is a thread waiting for command completion
@@ -3871,9 +3871,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba
}
}
 
-   spin_lock_irq(phba-hbalock);
+   spin_lock_irqsave(phba-hbalock, flags);
lpfc_cmd-pCmd = NULL;
-   spin_unlock_irq(phba-hbalock);
+   spin_unlock_irqrestore(phba-hbalock, flags);
 
/*
 * If there is a thread waiting for command completion
@@ -4398,16 +4398,17 @@ lpfc_abort_handler(struct scsi_cmnd *cmn
struct lpfc_scsi_buf *lpfc_cmd;
IOCB_t *cmd, *icmd;
int ret = SUCCESS, status = 0;
+   unsigned long flags;
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(waitq);
 
status = fc_block_scsi_eh(cmnd);
if (status != 0  status != SUCCESS)
return status;
 
-   spin_lock_irq(phba-hbalock);
+   spin_lock_irqsave(phba-hbalock, flags);
/* driver queued commands are in process of being flushed */
if (phba-hba_flag  HBA_FCP_IOQ_FLUSH) {
-   spin_unlock_irq(phba-hbalock);
+   spin_unlock_irqrestore(phba-hbalock, flags);
lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
3168 SCSI Layer abort requested I/O has been 
flushed by LLD.\n);
@@ -4416,7 +4417,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmn
 
lpfc_cmd = (struct lpfc_scsi_buf *)cmnd-host_scribble;
if (!lpfc_cmd || !lpfc_cmd-pCmd) {
-   spin_unlock_irq(phba-hbalock);
+   spin_unlock_irqrestore(phba-hbalock, flags);
lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
 2873 SCSI Layer I/O Abort Request IO CMPL Status 
 x%x ID %d LUN %d\n,
@@ -4427,7 +4428,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmn
iocb = lpfc_cmd-cur_iocbq;
/* the command is in process of being cancelled */
if (!(iocb-iocb_flag  LPFC_IO_ON_TXCMPLQ)) {
-   spin_unlock_irq(phba-hbalock);
+   spin_unlock_irqrestore(phba-hbalock, flags);
lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
3169 SCSI Layer abort requested I/O has been 
cancelled by LLD.\n);
@@ -4484,7 +4485,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmn
abtsiocb-iocb_cmpl = lpfc_sli_abort_fcp_cmpl;
abtsiocb-vport = vport;
/* no longer need the lock after this point */
-   spin_unlock_irq(phba-hbalock);
+   spin_unlock_irqrestore(phba-hbalock, flags);
 
if (lpfc_sli_issue_iocb(phba, LPFC_FCP_RING, abtsiocb, 0) ==
IOCB_ERROR) {
@@ -4516,7 +4517,7 @@ lpfc_abort_handler(struct scsi_cmnd *cmn
goto out;
 
 out_unlock:
-   spin_unlock_irq(phba-hbalock);
+   spin_unlock_irqrestore(phba-hbalock, flags);
 out:
lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
 0749 SCSI Layer I/O Abort Request Status x%x ID %d 



--
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 11/16] lpfc 8.3.35: Fixed messages for misconfigured port errors

2012-09-29 Thread James Smart
Fixed messages for misconfigured port errors to be consistent for
 all OS platforms (108240)


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_init.c |   10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:11:40.048153996 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:11:44.140154085 -0400
@@ -3783,14 +3783,18 @@ lpfc_sli4_async_sli_evt(struct lpfc_hba
case LPFC_SLI_EVENT_STATUS_VALID:
return; /* no message if the sfp is okay */
case LPFC_SLI_EVENT_STATUS_NOT_PRESENT:
-   sprintf(message, Not installed);
+   sprintf(message, Optics faulted/incorrectly installed/not  \
+   installed - Reseat optics, if issue not 
+   resolved, replace.);
break;
case LPFC_SLI_EVENT_STATUS_WRONG_TYPE:
sprintf(message,
-   Optics of two types installed);
+   Optics of two types installed - Remove one optic or  \
+   install matching pair of optics.);
break;
case LPFC_SLI_EVENT_STATUS_UNSUPPORTED:
-   sprintf(message, Incompatible optics);
+   sprintf(message, Incompatible optics - Replace with  \
+   compatible optics for card to function.);
break;
default:
/* firmware is reporting a status we don't know about */



--
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 12/16] lpfc 8.3.35: Fixed not checking solicition in progress bit when verifying FCF record for use

2012-09-29 Thread James Smart
Fixed not checking solicition in progress bit when verifying FCF record for use


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_hbadisc.c |   11 ---
 lpfc_hw4.h |8 +++-
 2 files changed, 15 insertions(+), 4 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c
--- a/drivers/scsi/lpfc/lpfc_hbadisc.c  2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_hbadisc.c  2012-09-26 21:11:46.312154134 -0400
@@ -1506,9 +1506,10 @@ lpfc_match_fcf_conn_list(struct lpfc_hba
}
}
 
-   /* If FCF not available return 0 */
+   /* FCF not valid/available or solicitation in progress */
if (!bf_get(lpfc_fcf_record_fcf_avail, new_fcf_record) ||
-   !bf_get(lpfc_fcf_record_fcf_valid, new_fcf_record))
+   !bf_get(lpfc_fcf_record_fcf_valid, new_fcf_record) ||
+   bf_get(lpfc_fcf_record_fcf_sol, new_fcf_record))
return 0;
 
if (!(phba-hba_flag  HBA_FIP_SUPPORT)) {
@@ -1842,6 +1843,7 @@ lpfc_sli4_log_fcf_record_info(struct lpf
\tFCF_Index : x%x\n
\tFCF_Avail : x%x\n
\tFCF_Valid : x%x\n
+   \tFCF_SOL   : x%x\n
\tFIP_Priority  : x%x\n
\tMAC_Provider  : x%x\n
\tLowest VLANID : x%x\n
@@ -1852,6 +1854,7 @@ lpfc_sli4_log_fcf_record_info(struct lpf
bf_get(lpfc_fcf_record_fcf_index, fcf_record),
bf_get(lpfc_fcf_record_fcf_avail, fcf_record),
bf_get(lpfc_fcf_record_fcf_valid, fcf_record),
+   bf_get(lpfc_fcf_record_fcf_sol, fcf_record),
fcf_record-fip_priority,
bf_get(lpfc_fcf_record_mac_addr_prov, fcf_record),
vlan_id,
@@ -2185,12 +2188,14 @@ lpfc_mbx_cmpl_fcf_scan_read_fcf_rec(stru
   new_fcf_record));
lpfc_printf_log(phba, KERN_WARNING, LOG_FIP,
2781 FCF (x%x) failed connection 
-   list check: (x%x/x%x)\n,
+   list check: (x%x/x%x/%x)\n,
bf_get(lpfc_fcf_record_fcf_index,
   new_fcf_record),
bf_get(lpfc_fcf_record_fcf_avail,
   new_fcf_record),
bf_get(lpfc_fcf_record_fcf_valid,
+  new_fcf_record),
+   bf_get(lpfc_fcf_record_fcf_sol,
   new_fcf_record));
if ((phba-fcf.fcf_flag  FCF_IN_USE) 
lpfc_sli4_fcf_record_match(phba, phba-fcf.current_rec,
diff -upNr a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
--- a/drivers/scsi/lpfc/lpfc_hw4.h  2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_hw4.h  2012-09-26 21:11:46.323154134 -0400
@@ -1695,8 +1695,14 @@ struct fcf_record {
 #define lpfc_fcf_record_fc_map_2_MASK  0x00FF
 #define lpfc_fcf_record_fc_map_2_WORD  word7
 #define lpfc_fcf_record_fcf_valid_SHIFT24
-#define lpfc_fcf_record_fcf_valid_MASK 0x00FF
+#define lpfc_fcf_record_fcf_valid_MASK 0x0001
 #define lpfc_fcf_record_fcf_valid_WORD word7
+#define lpfc_fcf_record_fcf_fc_SHIFT   25
+#define lpfc_fcf_record_fcf_fc_MASK0x0001
+#define lpfc_fcf_record_fcf_fc_WORDword7
+#define lpfc_fcf_record_fcf_sol_SHIFT  31
+#define lpfc_fcf_record_fcf_sol_MASK   0x0001
+#define lpfc_fcf_record_fcf_sol_WORD   word7
uint32_t word8;
 #define lpfc_fcf_record_fcf_index_SHIFT0
 #define lpfc_fcf_record_fcf_index_MASK 0x



--
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 13/16] lpfc 8.3.35: Fixed SCSI host create showing wrong link speed on SLI3 HBA ports

2012-09-29 Thread James Smart
Fixed SCSI host create showing wrong link speed on SLI3 HBA ports


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_init.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:11:44.140154085 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:11:47.796154168 -0400
@@ -1892,8 +1892,10 @@ lpfc_get_hba_model_desc(struct lpfc_hba
max_speed = 4;
else if (phba-lmt  LMT_2Gb)
max_speed = 2;
-   else
+   else if (phba-lmt  LMT_1Gb)
max_speed = 1;
+   else
+   max_speed = 0;
 
vp = phba-vpd;
 
@@ -2078,9 +2080,13 @@ lpfc_get_hba_model_desc(struct lpfc_hba
if (descp  descp[0] == '\0') {
if (oneConnect)
snprintf(descp, 255,
-   Emulex OneConnect %s, %s Initiator, Port %s,
+   Emulex OneConnect %s, %s Initiator %s,
m.name, m.function,
phba-Port);
+   else if (max_speed == 0)
+   snprintf(descp, 255,
+   Emulex %s %s %s ,
+   m.name, m.bus, m.function);
else
snprintf(descp, 255,
Emulex %s %d%s %s %s,



--
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 14/16] lpfc 8.3.35: Fix error with fabric service parameters causing performance issues

2012-09-29 Thread James Smart
Fix error with fabric service parameters causing performance issues


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_els.c |2 ++
 1 file changed, 2 insertions(+)


diff -upNr a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
--- a/drivers/scsi/lpfc/lpfc_els.c  2012-09-26 21:11:41.195154018 -0400
+++ b/drivers/scsi/lpfc/lpfc_els.c  2012-09-26 21:11:59.119154426 -0400
@@ -809,6 +809,8 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_vp
phba-fc_ratov = FF_DEF_RATOV;
rc = memcmp(vport-fc_portname, sp-portName,
sizeof(vport-fc_portname));
+   memcpy(phba-fc_fabparam, sp, sizeof(struct serv_parm));
+
if (rc = 0) {
/* This side will initiate the PLOGI */
spin_lock_irq(shost-host_lock);



--
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 15/16] lpfc 8.3.35: Fixed not reporting logical link speed to SCSI midlayer when QoS not on

2012-09-29 Thread James Smart
Fixed not reporting logical link speed to SCSI midlayer when QoS not on


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_crtn.h |1 
 lpfc_hw4.h  |   12 +
 lpfc_init.c |  134 +++-
 lpfc_scsi.c |   18 +---
 lpfc_sli4.h |2 
 5 files changed, 151 insertions(+), 16 deletions(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_crtn.h b/drivers/scsi/lpfc/lpfc_crtn.h
--- a/drivers/scsi/lpfc/lpfc_crtn.h 2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_crtn.h 2012-09-26 21:12:00.571154459 -0400
@@ -467,3 +467,4 @@ int lpfc_sli4_read_config(struct lpfc_hb
 void lpfc_sli4_node_prep(struct lpfc_hba *);
 int lpfc_sli4_xri_sgl_update(struct lpfc_hba *);
 void lpfc_free_sgl_list(struct lpfc_hba *, struct list_head *);
+uint32_t lpfc_sli_port_speed_get(struct lpfc_hba *);
diff -upNr a/drivers/scsi/lpfc/lpfc_hw4.h b/drivers/scsi/lpfc/lpfc_hw4.h
--- a/drivers/scsi/lpfc/lpfc_hw4.h  2012-09-26 21:11:46.323154134 -0400
+++ b/drivers/scsi/lpfc/lpfc_hw4.h  2012-09-26 21:12:00.582154459 -0400
@@ -1305,6 +1305,11 @@ struct lpfc_mbx_mq_create_ext {
 #define lpfc_mbx_mq_create_ext_async_evt_link_SHIFTLPFC_TRAILER_CODE_LINK
 #define lpfc_mbx_mq_create_ext_async_evt_link_MASK 0x0001
 #define lpfc_mbx_mq_create_ext_async_evt_link_WORD async_evt_bmap
+#define LPFC_EVT_CODE_LINK_NO_LINK 0x0
+#define LPFC_EVT_CODE_LINK_10_MBIT 0x1
+#define LPFC_EVT_CODE_LINK_100_MBIT0x2
+#define LPFC_EVT_CODE_LINK_1_GBIT  0x3
+#define LPFC_EVT_CODE_LINK_10_GBIT 0x4
 #define lpfc_mbx_mq_create_ext_async_evt_fip_SHIFT LPFC_TRAILER_CODE_FCOE
 #define lpfc_mbx_mq_create_ext_async_evt_fip_MASK  0x0001
 #define lpfc_mbx_mq_create_ext_async_evt_fip_WORD  async_evt_bmap
@@ -1314,6 +1319,13 @@ struct lpfc_mbx_mq_create_ext {
 #define lpfc_mbx_mq_create_ext_async_evt_fc_SHIFT  LPFC_TRAILER_CODE_FC
 #define lpfc_mbx_mq_create_ext_async_evt_fc_MASK   0x0001
 #define lpfc_mbx_mq_create_ext_async_evt_fc_WORD   async_evt_bmap
+#define LPFC_EVT_CODE_FC_NO_LINK   0x0
+#define LPFC_EVT_CODE_FC_1_GBAUD   0x1
+#define LPFC_EVT_CODE_FC_2_GBAUD   0x2
+#define LPFC_EVT_CODE_FC_4_GBAUD   0x4
+#define LPFC_EVT_CODE_FC_8_GBAUD   0x8
+#define LPFC_EVT_CODE_FC_10_GBAUD  0xA
+#define LPFC_EVT_CODE_FC_16_GBAUD  0x10
 #define lpfc_mbx_mq_create_ext_async_evt_sli_SHIFT LPFC_TRAILER_CODE_SLI
 #define lpfc_mbx_mq_create_ext_async_evt_sli_MASK  0x0001
 #define lpfc_mbx_mq_create_ext_async_evt_sli_WORD  async_evt_bmap
diff -upNr a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
--- a/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:11:47.796154168 -0400
+++ b/drivers/scsi/lpfc/lpfc_init.c 2012-09-26 21:12:00.597154460 -0400
@@ -3508,6 +3508,119 @@ lpfc_sli4_parse_latt_link_speed(struct l
 }
 
 /**
+ * lpfc_sli_port_speed_get - Get sli3 link speed code to link speed
+ * @phba: pointer to lpfc hba data structure.
+ *
+ * This routine is to get an SLI3 FC port's link speed in Mbps.
+ *
+ * Return: link speed in terms of Mbps.
+ **/
+uint32_t
+lpfc_sli_port_speed_get(struct lpfc_hba *phba)
+{
+   uint32_t link_speed;
+
+   if (!lpfc_is_link_up(phba))
+   return 0;
+
+   switch (phba-fc_linkspeed) {
+   case LPFC_LINK_SPEED_1GHZ:
+   link_speed = 1000;
+   break;
+   case LPFC_LINK_SPEED_2GHZ:
+   link_speed = 2000;
+   break;
+   case LPFC_LINK_SPEED_4GHZ:
+   link_speed = 4000;
+   break;
+   case LPFC_LINK_SPEED_8GHZ:
+   link_speed = 8000;
+   break;
+   case LPFC_LINK_SPEED_10GHZ:
+   link_speed = 1;
+   break;
+   case LPFC_LINK_SPEED_16GHZ:
+   link_speed = 16000;
+   break;
+   default:
+   link_speed = 0;
+   }
+   return link_speed;
+}
+
+/**
+ * lpfc_sli4_port_speed_parse - Parse async evt link speed code to link speed
+ * @phba: pointer to lpfc hba data structure.
+ * @evt_code: asynchronous event code.
+ * @speed_code: asynchronous event link speed code.
+ *
+ * This routine is to parse the giving SLI4 async event link speed code into
+ * value of Mbps for the link speed.
+ *
+ * Return: link speed in terms of Mbps.
+ **/
+static uint32_t
+lpfc_sli4_port_speed_parse(struct lpfc_hba *phba, uint32_t evt_code,
+  uint8_t speed_code)
+{
+   uint32_t port_speed;
+
+   switch (evt_code) {
+   case LPFC_TRAILER_CODE_LINK:
+   switch (speed_code) {
+   case LPFC_EVT_CODE_LINK_NO_LINK:
+   port_speed = 0;
+   break;
+   case LPFC_EVT_CODE_LINK_10_MBIT:
+   port_speed = 10;
+   break;
+   case LPFC_EVT_CODE_LINK_100_MBIT:
+   port_speed = 100;
+   

[PATCH 16/16] lpfc 8.3.35: Update lpfc version for 8.3.35 driver release

2012-09-29 Thread James Smart
Update lpfc version for 8.3.35 driver release


Signed-off-by: James Smart james.sm...@emulex.com

 ---

 lpfc_version.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff -upNr a/drivers/scsi/lpfc/lpfc_version.h b/drivers/scsi/lpfc/lpfc_version.h
--- a/drivers/scsi/lpfc/lpfc_version.h  2012-09-26 20:19:47.0 -0400
+++ b/drivers/scsi/lpfc/lpfc_version.h  2012-09-26 21:12:03.409154523 -0400
@@ -18,7 +18,7 @@
  * included with this package. *
  ***/
 
-#define LPFC_DRIVER_VERSION 8.3.34
+#define LPFC_DRIVER_VERSION 8.3.35
 #define LPFC_DRIVER_NAME   lpfc
 
 /* Used for SLI 2/3 */



--
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 07/17] be2iscsi: Fix the kernel panic in blkiopoll disable mode

2012-09-29 Thread Michael Christie

On Sep 28, 2012, at 8:32 PM, John Soni Jose sony.joh...@emulex.com wrote:

 From: Jayamohan Kallickal jayamohan.kallic...@emulex.com
 
 Fix kernel panic issue while running IO in blk_iopoll disable mode.

What was the bug exactly?

 Creating UNBOUND WQ for each EQ in the driver.

What is the benefit of doing this vs per hba like before?

Why WQ_UNBOUND? It seems other drivers prefer it the other way.
--
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/3] Revert ata: make ata port as parent device of scsi host

2012-09-29 Thread Sergei Shtylyov

Hello.

On 27-09-2012 21:04, Gwendal Grignou wrote:


This reverts commit 9a6d6a2ddabbd32c07f6a38b659e5f3db319fa5a.

Instead, melt libata transport sysfs object in scsi objects.

Change-Id: I8c709f63ddf7ba97b9e6f449d5c0b8b85e44e818


   Remove this line please, it has no place in the upstream commit.


Signed-off-by: Gwendal Grignougwen...@google.com



MBR, Sergei

--
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: [usb-storage] Re: usb3 fails to write when using usb3 hub in usb3 port

2012-09-29 Thread Adrian Sandu
 The only solution I see is to buy something else, like an Asus
 EB1501P-B057E .. I need something small and fast enough .. :| Maybe
 any other recommendations ? ( other root chipset / atom cpu .. small
 powered .. etc. )

DON'T KILL ME ! .. I got the best cables I could get my hands on (
double-shielded, 24k golded connectors .. metal pieces .. the best I
could get my hands on on such short notice )... I replaced 2 cables (
to hard drives ) and the one from the hub to the computer. I only got
1 reset message in /var/log/messages in 24 hours .. I'll replace the
other 4 just to be sure .. Now I should spam the companies and tell
them they should provide cables within specs ..

I guess having 6 drives that close ( among with other powering cables
.. networking (I think I got at least 40 cables in that 1 sq m. ))
isn't that good especially when the usb has another power source and
stuff..

IT WORKS. YEY. Hope this will help somebody in the future. Thanks for
bearing me .. I sure learned a lesson from this. I guess all is well
when it ends well.
--
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][SCSI] mpt3sas: Driver submission v01.100.00.00

2012-09-29 Thread sreekanth.reddy
This is new scsi lld device driver from LSI supporting the SAS 3.0
standard.

Here is list of new 12gb host controllers:

  LSI SAS3004
  LSI SAS3008
  LSI SAS3108

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---
Here is the brief description of patches:
[PATCH 01/20] [SCSI] mpt3sas : Makefile, Kconfig and scsi_transport_sas file 
changes to support new driver mpt3sas
[PATCH 02/20] [SCSI] mpt3sas : MPI API headers. This patch is part 1 of MPI API 
headers.
[PATCH 03/20] [SCSI] mpt3sas : MPI API headers. This patch is part 2 of MPI API 
headers.
[PATCH 04/20] [SCSI] mpt3sas : MPI API headers. This patch is part 3 of MPI API 
headers.
[PATCH 05/20] [SCSI] mpt3sas : MPI API headers. This patch is part 4 of MPI API 
headers.
[PATCH 06/20] [SCSI] mpt3sas : MPI API headers. This patch is part 5 of MPI API 
headers.
[PATCH 07/20] [SCSI] mpt3sas : Fusion MPT base driver providing common API 
layer interface
for access to MPT (Message 
Passing Technology) firmware.
This patch is part 1 of 
mpt3sas_base.c
[PATCH 08/20] [SCSI] mpt3sas : This patch is part 2 of mpt3sas_base.c
[PATCH 09/20] [SCSI] mpt3sas : Fusion MPT base driver providing common API 
layer interface
headers for access to MPT 
(Message Passing Technology) firmware.
[PATCH 10/20] [SCSI] mpt3sas : Common API for accessing firmware configuration 
pages
[PATCH 11/20] [SCSI] mpt3sas : Ioctl Support for MPT (Message Passing 
Technology)
based controller
[PATCH 12/20] [SCSI] mpt3sas : Ioctl Module Support headers for MPT (Message 
Passing Technology)
based controllers
[PATCH 13/20] [SCSI] mpt3sas : Logging Support for MPT (Message Passing 
Technology)
based controllers
[PATCH 14/20] [SCSI] mpt3sas : Code related to Scsi Host Layer for
MPT (Message Passing 
Technology) based controllers
This patch is part 1 of 
mpt3sas_scsih.c
[PATCH 15/20] [SCSI] mpt3sas : This patch is part 2 of mpt3sas_scsih.c
[PATCH 16/20] [SCSI] mpt3sas : This patch is part 3 of mpt3sas_scsih.c
[PATCH 17/20] [SCSI] mpt3sas : Code related to SAS Transport Layer for
MPT (Message Passing Technology) based 
controllers
[PATCH 18/20] [SCSI] mpt3sas : Common API to set Diagnostic trigger for MPT
(Message Passing Technology) based 
controllers
[PATCH 19/20] [SCSI] mpt3sas : Common API headers to set Diagnostic trigger for 
MPT
(Message Passing Technology) based 
controllers
[PATCH 20/20] [SCSI] mpt3sas : Adding support for MPT3SAS_MINOR(222)
--
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][SCSI] mpt3sas: Makefile, Kconfig and scsi_transport_sas file changes to support new driver mpt3sas

2012-09-29 Thread sreekanth.reddy
This patch contains the Makefile, Kconfig and 
scsi_transport_sas file changes to support new driver mpt3sas

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index e955978..49244f8 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -620,6 +620,7 @@ config SCSI_ARCMSR
 
 source drivers/scsi/megaraid/Kconfig.megaraid
 source drivers/scsi/mpt2sas/Kconfig
+source drivers/scsi/mpt3sas/Kconfig
 source drivers/scsi/ufs/Kconfig
 
 config SCSI_HPTIOP
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 1a3368b..88e52bb 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -106,6 +106,7 @@ obj-$(CONFIG_MEGARAID_LEGACY)   += megaraid.o
 obj-$(CONFIG_MEGARAID_NEWGEN)  += megaraid/
 obj-$(CONFIG_MEGARAID_SAS) += megaraid/
 obj-$(CONFIG_SCSI_MPT2SAS) += mpt2sas/
+obj-$(CONFIG_SCSI_MPT3SAS) += mpt3sas/
 obj-$(CONFIG_SCSI_UFSHCD)  += ufs/
 obj-$(CONFIG_SCSI_ACARD)   += atp870u.o
 obj-$(CONFIG_SCSI_SUNESP)  += esp_scsi.o   sun_esp.o
diff --git a/drivers/scsi/mpt3sas/Kconfig b/drivers/scsi/mpt3sas/Kconfig
new file mode 100644
index 000..81471bf
--- /dev/null
+++ b/drivers/scsi/mpt3sas/Kconfig
@@ -0,0 +1,67 @@
+#
+# Kernel configuration file for the MPT3SAS
+#
+# This code is based on drivers/scsi/mpt3sas/Kconfig
+# Copyright (C) 2012  LSI Corporation
+#  (mailto:dl-mptfusionli...@lsi.com)
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# NO WARRANTY
+# THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+# LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+# solely responsible for determining the appropriateness of using and
+# distributing the Program and assumes all risks associated with its
+# exercise of rights under this Agreement, including but not limited to
+# the risks and costs of program errors, damage to or loss of data,
+# programs or equipment, and unavailability or interruption of operations.
+
+# DISCLAIMER OF LIABILITY
+# NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+# USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+# HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+# USA.
+
+config SCSI_MPT3SAS
+   tristate LSI MPT Fusion SAS 3.0 Device Driver
+   depends on PCI  SCSI
+   select SCSI_SAS_ATTRS
+   select RAID_ATTRS
+   ---help---
+   This driver supports PCI-Express SAS 12Gb/s Host Adapters.
+
+config SCSI_MPT3SAS_MAX_SGE
+   int LSI MPT Fusion Max number of SG Entries (16 - 256)
+   depends on PCI  SCSI  SCSI_MPT3SAS
+   default 128
+   range 16 256
+   ---help---
+   This option allows you to specify the maximum number of scatter-
+   gather entries per I/O. The driver default is 128, which matches
+   MAX_PHYS_SEGMENTS in most kernels.  However in SuSE kernels this
+   can be 256. However, it may decreased down to 16.  Decreasing this
+   parameter will reduce memory requirements on a per controller instance.
+
+config SCSI_MPT3SAS_LOGGING
+   bool LSI MPT Fusion logging facility
+   depends on PCI  SCSI  SCSI_MPT3SAS
+   ---help---
+   This turns on a logging facility.
diff --git a/drivers/scsi/mpt3sas/Makefile b/drivers/scsi/mpt3sas/Makefile
new file mode 100644
index 000..4c1d2e7
--- /dev/null
+++ b/drivers/scsi/mpt3sas/Makefile
@@ -0,0 +1,8 @@
+# mpt3sas makefile
+obj-m += mpt3sas.o
+mpt3sas-y +=  mpt3sas_base.o \
+   mpt3sas_config.o \
+   mpt3sas_scsih.o  \
+   mpt3sas_transport.o \
+   mpt3sas_ctl.o   \
+   mpt3sas_trigger_diag.o
diff --git a/drivers/scsi/scsi_transport_sas.c 
b/drivers/scsi/scsi_transport_sas.c
index f7565fc..1b68142 100644
--- 

[PATCH][SCSI] mpt3sas: Paer 1 of MPI API headers

2012-09-29 Thread sreekanth.reddy
This patch contains MPI API headers
This patch is part 1 of MPI API headers.
Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---


diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h
new file mode 100644
index 000..03317ff
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpi/mpi2.h
@@ -0,0 +1,1164 @@
+/*
+ * Copyright (c) 2000-2012 LSI Corporation.
+ *
+ *
+ *  Name:  mpi2.h
+ * Title:  MPI Message independent structures and definitions
+ * including System Interface Register Set and
+ * scatter/gather formats.
+ * Creation Date:  June 21, 2006
+ *
+ * mpi2.h Version:  02.00.26
+ *
+ * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25
+ *   prefix are for use only on MPI v2.5 products, and must not be used
+ *   with MPI v2.0 products. Unless otherwise noted, names beginning with
+ *   MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products.
+ *
+ * Version History
+ * ---
+ *
+ * Date  Version   Description
+ *     --
+ * 04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
+ * 06-04-07  02.00.01  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 06-26-07  02.00.02  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 08-31-07  02.00.03  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Moved ReplyPostHostIndex register to offset 0x6C of the
+ * MPI2_SYSTEM_INTERFACE_REGS and modified the define for
+ * MPI2_REPLY_POST_HOST_INDEX_OFFSET.
+ * Added union of request descriptors.
+ * Added union of reply descriptors.
+ * 10-31-07  02.00.04  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added define for MPI2_VERSION_02_00.
+ * Fixed the size of the FunctionDependent5 field in the
+ * MPI2_DEFAULT_REPLY structure.
+ * 12-18-07  02.00.05  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Removed the MPI-defined Fault Codes and extended the
+ * product specific codes up to 0xEFFF.
+ * Added a sixth key value for the WriteSequence register
+ * and changed the flush value to 0x0.
+ * Added message function codes for Diagnostic Buffer Post
+ * and Diagnsotic Release.
+ * New IOCStatus define: MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED
+ * Moved MPI2_VERSION_UNION from mpi2_ioc.h.
+ * 02-29-08  02.00.06  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 03-03-08  02.00.07  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 05-21-08  02.00.08  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added #defines for marking a reply descriptor as unused.
+ * 06-27-08  02.00.09  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 10-02-08  02.00.10  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Moved LUN field defines from mpi2_init.h.
+ * 01-19-09  02.00.11  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 05-06-09  02.00.12  Bumped MPI2_HEADER_VERSION_UNIT.
+ * In all request and reply descriptors, replaced VF_ID
+ * field with MSIxIndex field.
+ * Removed DevHandle field from
+ * MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR and made those
+ * bytes reserved.
+ * Added RAID Accelerator functionality.
+ * 07-30-09  02.00.13  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 10-28-09  02.00.14  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added MSI-x index mask and shift for Reply Post Host
+ * Index register.
+ * Added function code for Host Based Discovery Action.
+ * 02-10-10  02.00.15  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL.
+ * Added defines for product-specific range of message
+ * function codes, 0xF0 to 0xFF.
+ * 05-12-10  02.00.16  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added alternative defines for the SGE Direction bit.
+ * 08-11-10  02.00.17  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 11-10-10  02.00.18  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR define.
+ * 02-23-11  02.00.19  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added MPI2_FUNCTION_SEND_HOST_MESSAGE.
+ * 03-09-11  02.00.20  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 05-25-11  02.00.21  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 08-24-11  02.00.22  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 11-18-11  02.00.23  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Incorporating additions for MPI v2.5.
+ * 02-06-12  02.00.24  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 03-29-12  02.00.25  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added 

[PATCH][SCSI] mpt3sas: Part 5 of MPI API headers

2012-09-29 Thread sreekanth.reddy
This patch contains MPI API headers
This patch is part 5 of MPI API headers.
Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_raid.h 
b/drivers/scsi/mpt3sas/mpi/mpi2_raid.h
new file mode 100644
index 000..d1d9866
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpi/mpi2_raid.h
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2000-2012 LSI Corporation.
+ *
+ *
+ *  Name:  mpi2_raid.h
+ * Title:  MPI Integrated RAID messages and structures
+ * Creation Date:  April 26, 2007
+ *
+ *   mpi2_raid.h Version:  02.00.08
+ *
+ * Version History
+ * ---
+ *
+ * Date  Version   Description
+ *     --
+ * 04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
+ * 08-31-07  02.00.01  Modifications to RAID Action request and reply,
+ * including the Actions and ActionData.
+ * 02-29-08  02.00.02  Added MPI2_RAID_ACTION_ADATA_DISABL_FULL_REBUILD.
+ * 05-21-08  02.00.03  Added MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS so that
+ * the PhysDisk array in MPI2_RAID_VOLUME_CREATION_STRUCT
+ * can be sized by the build environment.
+ * 07-30-09  02.00.04  Added proper define for the Use Default Settings bit of
+ * VolumeCreationFlags and marked the old one as obsolete.
+ * 05-12-10  02.00.05  Added MPI2_RAID_VOL_FLAGS_OP_MDC define.
+ * 08-24-10  02.00.06  Added MPI2_RAID_ACTION_COMPATIBILITY_CHECK along with
+ * related structures and defines.
+ * Added product-specific range to RAID Action values.
+ * 11-18-11  02.00.07  Incorporating additions for MPI v2.5.
+ * 02-06-12  02.00.08  Added MPI2_RAID_ACTION_PHYSDISK_HIDDEN.
+ * --
+ */
+
+#ifndef MPI2_RAID_H
+#define MPI2_RAID_H
+
+/*
+*
+*  Integrated RAID Messages
+*
+*/
+
+/
+* RAID Action messages
+/
+
+/*ActionDataWord defines for use with MPI2_RAID_ACTION_DELETE_VOLUME action */
+#define MPI2_RAID_ACTION_ADATA_KEEP_LBA0(0x)
+#define MPI2_RAID_ACTION_ADATA_ZERO_LBA0(0x0001)
+
+/*use MPI2_RAIDVOL0_SETTING_ defines from mpi2_cnfg.h for
+ *MPI2_RAID_ACTION_CHANGE_VOL_WRITE_CACHE action */
+
+/*ActionDataWord defines for use with
+ *MPI2_RAID_ACTION_DISABLE_ALL_VOLUMES action */
+#define MPI2_RAID_ACTION_ADATA_DISABL_FULL_REBUILD  (0x0001)
+
+/*ActionDataWord for MPI2_RAID_ACTION_SET_RAID_FUNCTION_RATE Action */
+typedef struct _MPI2_RAID_ACTION_RATE_DATA {
+   U8 RateToChange;/*0x00 */
+   U8 RateOrMode;  /*0x01 */
+   U16 DataScrubDuration;  /*0x02 */
+} MPI2_RAID_ACTION_RATE_DATA, *PTR_MPI2_RAID_ACTION_RATE_DATA,
+   Mpi2RaidActionRateData_t, *pMpi2RaidActionRateData_t;
+
+#define MPI2_RAID_ACTION_SET_RATE_RESYNC(0x00)
+#define MPI2_RAID_ACTION_SET_RATE_DATA_SCRUB(0x01)
+#define MPI2_RAID_ACTION_SET_RATE_POWERSAVE_MODE(0x02)
+
+/*ActionDataWord for MPI2_RAID_ACTION_START_RAID_FUNCTION Action */
+typedef struct _MPI2_RAID_ACTION_START_RAID_FUNCTION {
+   U8 RAIDFunction;/*0x00 */
+   U8 Flags;   /*0x01 */
+   U16 Reserved1;  /*0x02 */
+} MPI2_RAID_ACTION_START_RAID_FUNCTION,
+   *PTR_MPI2_RAID_ACTION_START_RAID_FUNCTION,
+   Mpi2RaidActionStartRaidFunction_t,
+   *pMpi2RaidActionStartRaidFunction_t;
+
+/*defines for the RAIDFunction field */
+#define MPI2_RAID_ACTION_START_BACKGROUND_INIT  (0x00)
+#define MPI2_RAID_ACTION_START_ONLINE_CAP_EXPANSION (0x01)
+#define MPI2_RAID_ACTION_START_CONSISTENCY_CHECK(0x02)
+
+/*defines for the Flags field */
+#define MPI2_RAID_ACTION_START_NEW  (0x00)
+#define MPI2_RAID_ACTION_START_RESUME   (0x01)
+
+/*ActionDataWord for MPI2_RAID_ACTION_STOP_RAID_FUNCTION Action */
+typedef struct _MPI2_RAID_ACTION_STOP_RAID_FUNCTION {
+   U8 RAIDFunction;/*0x00 */
+   U8 Flags;   /*0x01 */
+   U16 Reserved1;  /*0x02 */
+} MPI2_RAID_ACTION_STOP_RAID_FUNCTION,
+   *PTR_MPI2_RAID_ACTION_STOP_RAID_FUNCTION,
+   Mpi2RaidActionStopRaidFunction_t,
+   *pMpi2RaidActionStopRaidFunction_t;
+
+/*defines for the RAIDFunction field */
+#define MPI2_RAID_ACTION_STOP_BACKGROUND_INIT   (0x00)
+#define MPI2_RAID_ACTION_STOP_ONLINE_CAP_EXPANSION  (0x01)
+#define MPI2_RAID_ACTION_STOP_CONSISTENCY_CHECK (0x02)
+
+/*defines for the Flags field */
+#define MPI2_RAID_ACTION_STOP_ABORT (0x00)
+#define 

[PATCH][SCSI] mpt3sas: Common API layer interface headers for access to MPT firmware.

2012-09-29 Thread sreekanth.reddy
This patch contains the Fusion MPT base driver providing common API layer 
interface
headers for access to MPT (Message Passing Technology) firmware.

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
new file mode 100644
index 000..4e08a3c
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -0,0 +1,1139 @@
+/*
+ * This is the Fusion MPT base driver providing common API layer interface
+ * for access to MPT (Message Passing Technology) firmware.
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#ifndef MPT3SAS_BASE_H_INCLUDED
+#define MPT3SAS_BASE_H_INCLUDED
+
+#include mpi/mpi2_type.h
+#include mpi/mpi2.h
+#include mpi/mpi2_ioc.h
+#include mpi/mpi2_cnfg.h
+#include mpi/mpi2_init.h
+#include mpi/mpi2_raid.h
+#include mpi/mpi2_tool.h
+#include mpi/mpi2_sas.h
+
+#include scsi/scsi.h
+#include scsi/scsi_cmnd.h
+#include scsi/scsi_device.h
+#include scsi/scsi_host.h
+#include scsi/scsi_tcq.h
+#include scsi/scsi_transport_sas.h
+#include scsi/scsi_dbg.h
+#include scsi/scsi_eh.h
+
+#include mpt3sas_debug.h
+#include mpt3sas_trigger_diag.h
+
+/* driver versioning info */
+#define MPT3SAS_DRIVER_NAMEmpt3sas
+#define MPT3SAS_AUTHOR LSI Corporation dl-mptfusionli...@lsi.com
+#define MPT3SAS_DESCRIPTIONLSI MPT Fusion SAS 3.0 Device Driver
+#define MPT3SAS_DRIVER_VERSION 01.100.00.00
+#define MPT3SAS_MAJOR_VERSION  1
+#define MPT3SAS_MINOR_VERSION  100
+#define MPT3SAS_BUILD_VERSION  0
+#define MPT3SAS_RELEASE_VERSION00
+
+/*
+ * Set MPT3SAS_SG_DEPTH value based on user input.
+ */
+#define MPT3SAS_MAX_PHYS_SEGMENTS  SCSI_MAX_SG_SEGMENTS
+#define MPT3SAS_MIN_PHYS_SEGMENTS  16
+#ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE
+#define MPT3SAS_SG_DEPTH   CONFIG_SCSI_MPT3SAS_MAX_SGE
+#else
+#define MPT3SAS_SG_DEPTH   MPT3SAS_MAX_PHYS_SEGMENTS
+#endif
+
+
+/*
+ * Generic Defines
+ */
+#define MPT3SAS_SATA_QUEUE_DEPTH   32
+#define MPT3SAS_SAS_QUEUE_DEPTH254
+#define MPT3SAS_RAID_QUEUE_DEPTH   128
+
+#define MPT_NAME_LENGTH32  /* generic length of 
strings */
+#define MPT_STRING_LENGTH  64
+
+#define MPT_MAX_CALLBACKS  32
+
+
+#define CAN_SLEEP  1
+#define  NO_SLEEP  0
+
+#define INTERNAL_CMDS_COUNT10  /* reserved cmds */
+
+#define MPI3_HIM_MASK  0x /* mask every bit*/
+
+#define MPT3SAS_INVALID_DEVICE_HANDLE  0x
+
+/*
+ * reset phases
+ */
+#define MPT3_IOC_PRE_RESET 1 /* prior to host reset */
+#define MPT3_IOC_AFTER_RESET   2 /* just after host reset */
+#define MPT3_IOC_DONE_RESET3 /* links re-initialized */
+
+/*
+ * logging format
+ */
+#define 

[PATCH][SCSI] mpt3sas: Common API for accessing firmware configuration pages

2012-09-29 Thread sreekanth.reddy
This patch provides common API for accessing firmware configuration pages

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_config.c 
b/drivers/scsi/mpt3sas/mpt3sas_config.c
new file mode 100644
index 000..ce7e59b
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_config.c
@@ -0,0 +1,1650 @@
+/*
+ * This module provides common API for accessing firmware configuration pages
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.c
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#include linux/version.h
+#include linux/module.h
+#include linux/kernel.h
+#include linux/init.h
+#include linux/errno.h
+#include linux/blkdev.h
+#include linux/sched.h
+#include linux/workqueue.h
+#include linux/delay.h
+#include linux/pci.h
+
+#include mpt3sas_base.h
+
+/* local definitions */
+
+/* Timeout for config page request (in seconds) */
+#define MPT3_CONFIG_PAGE_DEFAULT_TIMEOUT 15
+
+/* Common sgl flags for READING a config page. */
+#define MPT3_CONFIG_COMMON_SGLFLAGS ((MPI2_SGE_FLAGS_SIMPLE_ELEMENT | \
+   MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER \
+   | MPI2_SGE_FLAGS_END_OF_LIST)  MPI2_SGE_FLAGS_SHIFT)
+
+/* Common sgl flags for WRITING a config page. */
+#define MPT3_CONFIG_COMMON_WRITE_SGLFLAGS ((MPI2_SGE_FLAGS_SIMPLE_ELEMENT | \
+   MPI2_SGE_FLAGS_LAST_ELEMENT | MPI2_SGE_FLAGS_END_OF_BUFFER \
+   | MPI2_SGE_FLAGS_END_OF_LIST | MPI2_SGE_FLAGS_HOST_TO_IOC) \
+MPI2_SGE_FLAGS_SHIFT)
+
+/**
+ * struct config_request - obtain dma memory via routine
+ * @sz: size
+ * @page: virt pointer
+ * @page_dma: phys pointer
+ *
+ */
+struct config_request {
+   u16 sz;
+   void*page;
+   dma_addr_t  page_dma;
+};
+
+#ifdef CONFIG_SCSI_MPT3SAS_LOGGING
+/**
+ * _config_display_some_debug - debug routine
+ * @ioc: per adapter object
+ * @smid: system request message index
+ * @calling_function_name: string pass from calling function
+ * @mpi_reply: reply message frame
+ * Context: none.
+ *
+ * Function for displaying debug info helpful when debugging issues
+ * in this module.
+ */
+static void
+_config_display_some_debug(struct MPT3SAS_ADAPTER *ioc, u16 smid,
+   char *calling_function_name, MPI2DefaultReply_t *mpi_reply)
+{
+   Mpi2ConfigRequest_t *mpi_request;
+   char *desc = NULL;
+
+   if (!(ioc-logging_level  MPT_DEBUG_CONFIG))
+   return;
+
+   mpi_request = mpt3sas_base_get_msg_frame(ioc, smid);
+   switch (mpi_request-Header.PageType  MPI2_CONFIG_PAGETYPE_MASK) {
+   case MPI2_CONFIG_PAGETYPE_IO_UNIT:
+   desc = io_unit;
+   break;
+   case MPI2_CONFIG_PAGETYPE_IOC:
+   desc = ioc;
+   break;
+   case MPI2_CONFIG_PAGETYPE_BIOS:
+   desc = bios;
+   break;
+   case MPI2_CONFIG_PAGETYPE_RAID_VOLUME:
+  

[PATCH][SCSI] mpt3sas: Ioctl Module Support for MPT based controllers

2012-09-29 Thread sreekanth.reddy
This patch provides headers for ioctl Module Support for MPT (Message Passing 
Technology)
based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.h 
b/drivers/scsi/mpt3sas/mpt3sas_ctl.h
new file mode 100644
index 000..bd89f4f
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.h
@@ -0,0 +1,418 @@
+/*
+ * Management Module Support for MPT (Message Passing Technology) based
+ * controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_ctl.h
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#ifndef MPT3SAS_CTL_H_INCLUDED
+#define MPT3SAS_CTL_H_INCLUDED
+
+#ifdef __KERNEL__
+#include linux/miscdevice.h
+#endif
+
+
+#ifndef MPT3SAS_MINOR
+#define MPT3SAS_MINOR  (MPT_MINOR + 2)
+#endif
+#define MPT3SAS_DEV_NAME   mpt3ctl
+#define MPT3_MAGIC_NUMBER  'L'
+#define MPT3_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */
+
+/**
+ * IOCTL opcodes
+ */
+#define MPT3IOCINFO_IOWR(MPT3_MAGIC_NUMBER, 17, \
+   struct mpt3_ioctl_iocinfo)
+#define MPT3COMMAND_IOWR(MPT3_MAGIC_NUMBER, 20, \
+   struct mpt3_ioctl_command)
+#ifdef CONFIG_COMPAT
+#define MPT3COMMAND32  _IOWR(MPT3_MAGIC_NUMBER, 20, \
+   struct mpt3_ioctl_command32)
+#endif
+#define MPT3EVENTQUERY _IOWR(MPT3_MAGIC_NUMBER, 21, \
+   struct mpt3_ioctl_eventquery)
+#define MPT3EVENTENABLE_IOWR(MPT3_MAGIC_NUMBER, 22, \
+   struct mpt3_ioctl_eventenable)
+#define MPT3EVENTREPORT_IOWR(MPT3_MAGIC_NUMBER, 23, \
+   struct mpt3_ioctl_eventreport)
+#define MPT3HARDRESET  _IOWR(MPT3_MAGIC_NUMBER, 24, \
+   struct mpt3_ioctl_diag_reset)
+#define MPT3BTDHMAPPING_IOWR(MPT3_MAGIC_NUMBER, 31, \
+   struct mpt3_ioctl_btdh_mapping)
+
+/* diag buffer support */
+#define MPT3DIAGREGISTER _IOWR(MPT3_MAGIC_NUMBER, 26, \
+   struct mpt3_diag_register)
+#define MPT3DIAGRELEASE_IOWR(MPT3_MAGIC_NUMBER, 27, \
+   struct mpt3_diag_release)
+#define MPT3DIAGUNREGISTER _IOWR(MPT3_MAGIC_NUMBER, 28, \
+   struct mpt3_diag_unregister)
+#define MPT3DIAGQUERY  _IOWR(MPT3_MAGIC_NUMBER, 29, \
+   struct mpt3_diag_query)
+#define MPT3DIAGREADBUFFER _IOWR(MPT3_MAGIC_NUMBER, 30, \
+   struct mpt3_diag_read_buffer)
+
+/**
+ * struct mpt3_ioctl_header - main header structure
+ * @ioc_number -  IOC unit number
+ * @port_number - IOC port number
+ * @max_data_size - maximum number bytes to transfer on read
+ */
+struct mpt3_ioctl_header {
+   uint32_t ioc_number;
+   uint32_t port_number;
+   uint32_t max_data_size;
+};
+
+/**
+ * struct mpt3_ioctl_diag_reset - diagnostic reset
+ * @hdr - generic header
+ */
+struct mpt3_ioctl_diag_reset {
+   struct mpt3_ioctl_header hdr;
+};
+
+
+/**
+ * struct mpt3_ioctl_pci_info - pci device info
+ * @device - pci device id
+ * @function - pci function id
+ * @bus - pci bus id
+ * @segment_id - pci segment id
+ */
+struct mpt3_ioctl_pci_info {
+

[PATCH][SCSI] mpt3sas: Logging Support for MPT based controllers

2012-09-29 Thread sreekanth.reddy
This patch provides Logging Support for MPT (Message Passing Technology)
based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_debug.h 
b/drivers/scsi/mpt3sas/mpt3sas_debug.h
new file mode 100644
index 000..ce70b87
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_debug.h
@@ -0,0 +1,219 @@
+/*
+ * Logging Support for MPT (Message Passing Technology) based controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_debug.c
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#ifndef MPT3SAS_DEBUG_H_INCLUDED
+#define MPT3SAS_DEBUG_H_INCLUDED
+
+#define MPT_DEBUG  0x0001
+#define MPT_DEBUG_MSG_FRAME0x0002
+#define MPT_DEBUG_SG   0x0004
+#define MPT_DEBUG_EVENTS   0x0008
+#define MPT_DEBUG_EVENT_WORK_TASK  0x0010
+#define MPT_DEBUG_INIT 0x0020
+#define MPT_DEBUG_EXIT 0x0040
+#define MPT_DEBUG_FAIL 0x0080
+#define MPT_DEBUG_TM   0x0100
+#define MPT_DEBUG_REPLY0x0200
+#define MPT_DEBUG_HANDSHAKE0x0400
+#define MPT_DEBUG_CONFIG   0x0800
+#define MPT_DEBUG_DL   0x1000
+#define MPT_DEBUG_RESET0x2000
+#define MPT_DEBUG_SCSI 0x4000
+#define MPT_DEBUG_IOCTL0x8000
+#define MPT_DEBUG_SAS  0x0002
+#define MPT_DEBUG_TRANSPORT0x0004
+#define MPT_DEBUG_TASK_SET_FULL0x0008
+
+#define MPT_DEBUG_TRIGGER_DIAG 0x0020
+
+
+/*
+ * CONFIG_SCSI_MPT3SAS_LOGGING - enabled in Kconfig
+ */
+
+#ifdef CONFIG_SCSI_MPT3SAS_LOGGING
+#define MPT_CHECK_LOGGING(IOC, CMD, BITS)  \
+{  \
+   if (IOC-logging_level  BITS)  \
+   CMD;\
+}
+#else
+#define MPT_CHECK_LOGGING(IOC, CMD, BITS)
+#endif /* CONFIG_SCSI_MPT3SAS_LOGGING */
+
+
+/*
+ * debug macros
+ */
+
+#define dprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG)
+
+#define dsgprintk(IOC, CMD)\
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SG)
+
+#define devtprintk(IOC, CMD)   \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENTS)
+
+#define dewtprintk(IOC, CMD)   \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENT_WORK_TASK)
+
+#define dinitprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_INIT)
+
+#define dexitprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EXIT)
+
+#define dfailprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FAIL)
+
+#define dtmprintk(IOC, CMD)\
+   

[PATCH][SCSI] mpt3sas: Common API to set Diagnostic trigger for MPT based controllers

2012-09-29 Thread sreekanth.reddy
This patch provides common API to set Diagnostic trigger for MPT
(Message Passing Technology) based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c 
b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
new file mode 100644
index 000..da6c5f2
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
@@ -0,0 +1,434 @@
+/*
+ * This module provides common API to set Diagnostic trigger for MPT
+ * (Message Passing Technology) based controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#include linux/version.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/errno.h
+#include linux/init.h
+#include linux/slab.h
+#include linux/types.h
+#include linux/pci.h
+#include linux/delay.h
+#include linux/compat.h
+#include linux/poll.h
+
+#include linux/io.h
+#include linux/uaccess.h
+
+#include mpt3sas_base.h
+
+/**
+ * _mpt3sas_raise_sigio - notifiy app
+ * @ioc: per adapter object
+ * @event_data:
+ */
+static void
+_mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc,
+   struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data)
+{
+   Mpi2EventNotificationReply_t *mpi_reply;
+   u16 sz, event_data_sz;
+   unsigned long flags;
+
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT %s: enter\n,
+   ioc-name, __func__));
+
+   sz = offsetof(Mpi2EventNotificationReply_t, EventData) +
+   sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4;
+   mpi_reply = kzalloc(sz, GFP_KERNEL);
+   if (!mpi_reply)
+   goto out;
+   mpi_reply-Event = cpu_to_le16(MPI3_EVENT_DIAGNOSTIC_TRIGGER_FIRED);
+   event_data_sz = (sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4) / 4;
+   mpi_reply-EventDataLength = cpu_to_le16(event_data_sz);
+   memcpy(mpi_reply-EventData, event_data,
+   sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
+   %s: add to driver event log\n,
+   ioc-name, __func__));
+   mpt3sas_ctl_add_to_event_log(ioc, mpi_reply);
+   kfree(mpi_reply);
+ out:
+
+   /* clearing the diag_trigger_active flag */
+   spin_lock_irqsave(ioc-diag_trigger_lock, flags);
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
+   %s: clearing diag_trigger_active flag\n,
+   ioc-name, __func__));
+   ioc-diag_trigger_active = 0;
+   spin_unlock_irqrestore(ioc-diag_trigger_lock, flags);
+
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT %s: exit\n, ioc-name,
+   __func__));
+}
+
+/**
+ * mpt3sas_process_trigger_data - process the event data for the trigger
+ * @ioc: per adapter object
+ * @event_data:
+ */
+void
+mpt3sas_process_trigger_data(struct MPT3SAS_ADAPTER *ioc,
+   struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data)
+{
+   u8 issue_reset = 0;
+
+  

[PATCH][SCSI] mpt3sas: Common API headers to set Diagnostic trigger for MPT based controllers

2012-09-29 Thread sreekanth.reddy
This patch provides common API headers to set Diagnostic trigger for MPT
(Message Passing Technology) based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h 
b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h
new file mode 100644
index 000..a10c309
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h
@@ -0,0 +1,193 @@
+/*
+ * This is the Fusion MPT base driver providing common API layer interface
+ * to set Diagnostic triggers for MPT (Message Passing Technology) based
+ * controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+  /* Diagnostic Trigger Configuration Data Structures */
+
+#ifndef MPT3SAS_TRIGGER_DIAG_H_INCLUDED
+#define MPT3SAS_TRIGGER_DIAG_H_INCLUDED
+
+/* limitation on number of entries */
+#define NUM_VALID_ENTRIES   (20)
+
+/* trigger types */
+#define MPT3SAS_TRIGGER_MASTER  (1)
+#define MPT3SAS_TRIGGER_EVENT   (2)
+#define MPT3SAS_TRIGGER_SCSI(3)
+#define MPT3SAS_TRIGGER_MPI (4)
+
+/* trigger names */
+#define MASTER_TRIGGER_FILE_NAMEdiag_trigger_master
+#define EVENT_TRIGGERS_FILE_NAMEdiag_trigger_event
+#define SCSI_TRIGGERS_FILE_NAME diag_trigger_scsi
+#define MPI_TRIGGER_FILE_NAME   diag_trigger_mpi
+
+/* master trigger bitmask */
+#define MASTER_TRIGGER_FW_FAULT (0x0001)
+#define MASTER_TRIGGER_ADAPTER_RESET(0x0002)
+#define MASTER_TRIGGER_TASK_MANAGMENT   (0x0004)
+#define MASTER_TRIGGER_DEVICE_REMOVAL   (0x0008)
+
+/* fake firmware event for tigger */
+#define MPI3_EVENT_DIAGNOSTIC_TRIGGER_FIRED(0x6E)
+
+/**
+ * MasterTrigger is a single U32 passed to/from sysfs.
+ *
+ * Bit Flags (enables) include:
+ * 1. FW Faults
+ * 2. Adapter Reset issued by driver
+ * 3. TMs
+ * 4. Device Remove Event sent by FW
+ */
+
+struct SL_WH_MASTER_TRIGGER_T {
+   uint32_t MasterData;
+};
+
+/**
+ * struct SL_WH_EVENT_TRIGGER_T -  Definition of an event trigger element
+ * @EventValue: Event Code to trigger on
+ * @LogEntryQualifier: Type of FW event that logged (Log Entry Added Event 
only)
+ *
+ * Defines an event that should induce a DIAG_TRIGGER driver event if observed.
+ */
+struct SL_WH_EVENT_TRIGGER_T {
+   uint16_t EventValue;
+   uint16_t LogEntryQualifier;
+};
+
+/**
+ * struct SL_WH_EVENT_TRIGGERS_T -  Structure passed to/from sysfs containing a
+ *list of Event Triggers to be monitored for.
+ * @ValidEntries: Number of _SL_WH_EVENT_TRIGGER_T structures contained in this
+ *structure.
+ * @EventTriggerEntry: List of Event trigger elements.
+ *
+ * This binary structure is transferred via sysfs to get/set Event Triggers
+ * in the Linux Driver.
+ */
+
+struct SL_WH_EVENT_TRIGGERS_T {
+   uint32_t ValidEntries;
+   struct SL_WH_EVENT_TRIGGER_T 

[PATCH][SCSI] mpt3sas: Adding support for MPT3SAS_MINOR(222)

2012-09-29 Thread sreekanth.reddy
Adding support for MPT3SAS_MINOR(222)

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 0549d211..9c9ba04 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -34,6 +34,7 @@
 #define MWAVE_MINOR219 /* ACP/Mwave Modem */
 #define MPT_MINOR  220
 #define MPT2SAS_MINOR  221
+#define MPT3SAS_MINOR  222
 #define UINPUT_MINOR   223
 #define HPET_MINOR 228
 #define FUSE_MINOR 229
--
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


[RESEND][PATCH 0/20][SCSI] mpt3sas: Driver submission v01.100.00.00

2012-09-29 Thread sreekanth.reddy
This is new scsi lld device driver from LSI supporting the SAS 3.0
standard.

Here is list of new 12gb host controllers:

  LSI SAS3004
  LSI SAS3008
  LSI SAS3108

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---
Here is the brief description of patches:
[PATCH 01/20] [SCSI] mpt3sas : Makefile, Kconfig and scsi_transport_sas file 
changes to support new driver mpt3sas
[PATCH 02/20] [SCSI] mpt3sas : MPI API headers. This patch is part 1 of MPI API 
headers.
[PATCH 03/20] [SCSI] mpt3sas : MPI API headers. This patch is part 2 of MPI API 
headers.
[PATCH 04/20] [SCSI] mpt3sas : MPI API headers. This patch is part 3 of MPI API 
headers.
[PATCH 05/20] [SCSI] mpt3sas : MPI API headers. This patch is part 4 of MPI API 
headers.
[PATCH 06/20] [SCSI] mpt3sas : MPI API headers. This patch is part 5 of MPI API 
headers.
[PATCH 07/20] [SCSI] mpt3sas : Fusion MPT base driver providing common API 
layer interface
for access to MPT (Message 
Passing Technology) firmware.
This patch is part 1 of 
mpt3sas_base.c
[PATCH 08/20] [SCSI] mpt3sas : This patch is part 2 of mpt3sas_base.c
[PATCH 09/20] [SCSI] mpt3sas : Fusion MPT base driver providing common API 
layer interface
headers for access to MPT 
(Message Passing Technology) firmware.
[PATCH 10/20] [SCSI] mpt3sas : Common API for accessing firmware configuration 
pages
[PATCH 11/20] [SCSI] mpt3sas : Ioctl Support for MPT (Message Passing 
Technology)
based controller
[PATCH 12/20] [SCSI] mpt3sas : Ioctl Module Support headers for MPT (Message 
Passing Technology)
based controllers
[PATCH 13/20] [SCSI] mpt3sas : Logging Support for MPT (Message Passing 
Technology)
based controllers
[PATCH 14/20] [SCSI] mpt3sas : Code related to Scsi Host Layer for
MPT (Message Passing 
Technology) based controllers
This patch is part 1 of 
mpt3sas_scsih.c
[PATCH 15/20] [SCSI] mpt3sas : This patch is part 2 of mpt3sas_scsih.c
[PATCH 16/20] [SCSI] mpt3sas : This patch is part 3 of mpt3sas_scsih.c
[PATCH 17/20] [SCSI] mpt3sas : Code related to SAS Transport Layer for
MPT (Message Passing Technology) based 
controllers
[PATCH 18/20] [SCSI] mpt3sas : Common API to set Diagnostic trigger for MPT
(Message Passing Technology) based 
controllers
[PATCH 19/20] [SCSI] mpt3sas : Common API headers to set Diagnostic trigger for 
MPT
(Message Passing Technology) based 
controllers
[PATCH 20/20] [SCSI] mpt3sas : Adding support for MPT3SAS_MINOR(222)
--
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


[RESEND][PATCH 1/20][SCSI] mpt3sas: Makefile, Kconfig and scsi_transport_sas file changes to support new driver mpt3sas

2012-09-29 Thread sreekanth.reddy
This patch contains the Makefile, Kconfig and 
scsi_transport_sas file changes to support new driver mpt3sas

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index e955978..49244f8 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -620,6 +620,7 @@ config SCSI_ARCMSR
 
 source drivers/scsi/megaraid/Kconfig.megaraid
 source drivers/scsi/mpt2sas/Kconfig
+source drivers/scsi/mpt3sas/Kconfig
 source drivers/scsi/ufs/Kconfig
 
 config SCSI_HPTIOP
diff --git a/drivers/scsi/Makefile b/drivers/scsi/Makefile
index 1a3368b..88e52bb 100644
--- a/drivers/scsi/Makefile
+++ b/drivers/scsi/Makefile
@@ -106,6 +106,7 @@ obj-$(CONFIG_MEGARAID_LEGACY)   += megaraid.o
 obj-$(CONFIG_MEGARAID_NEWGEN)  += megaraid/
 obj-$(CONFIG_MEGARAID_SAS) += megaraid/
 obj-$(CONFIG_SCSI_MPT2SAS) += mpt2sas/
+obj-$(CONFIG_SCSI_MPT3SAS) += mpt3sas/
 obj-$(CONFIG_SCSI_UFSHCD)  += ufs/
 obj-$(CONFIG_SCSI_ACARD)   += atp870u.o
 obj-$(CONFIG_SCSI_SUNESP)  += esp_scsi.o   sun_esp.o
diff --git a/drivers/scsi/mpt3sas/Kconfig b/drivers/scsi/mpt3sas/Kconfig
new file mode 100644
index 000..81471bf
--- /dev/null
+++ b/drivers/scsi/mpt3sas/Kconfig
@@ -0,0 +1,67 @@
+#
+# Kernel configuration file for the MPT3SAS
+#
+# This code is based on drivers/scsi/mpt3sas/Kconfig
+# Copyright (C) 2012  LSI Corporation
+#  (mailto:dl-mptfusionli...@lsi.com)
+
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# NO WARRANTY
+# THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+# LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+# solely responsible for determining the appropriateness of using and
+# distributing the Program and assumes all risks associated with its
+# exercise of rights under this Agreement, including but not limited to
+# the risks and costs of program errors, damage to or loss of data,
+# programs or equipment, and unavailability or interruption of operations.
+
+# DISCLAIMER OF LIABILITY
+# NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+# TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+# USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+# HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+# USA.
+
+config SCSI_MPT3SAS
+   tristate LSI MPT Fusion SAS 3.0 Device Driver
+   depends on PCI  SCSI
+   select SCSI_SAS_ATTRS
+   select RAID_ATTRS
+   ---help---
+   This driver supports PCI-Express SAS 12Gb/s Host Adapters.
+
+config SCSI_MPT3SAS_MAX_SGE
+   int LSI MPT Fusion Max number of SG Entries (16 - 256)
+   depends on PCI  SCSI  SCSI_MPT3SAS
+   default 128
+   range 16 256
+   ---help---
+   This option allows you to specify the maximum number of scatter-
+   gather entries per I/O. The driver default is 128, which matches
+   MAX_PHYS_SEGMENTS in most kernels.  However in SuSE kernels this
+   can be 256. However, it may decreased down to 16.  Decreasing this
+   parameter will reduce memory requirements on a per controller instance.
+
+config SCSI_MPT3SAS_LOGGING
+   bool LSI MPT Fusion logging facility
+   depends on PCI  SCSI  SCSI_MPT3SAS
+   ---help---
+   This turns on a logging facility.
diff --git a/drivers/scsi/mpt3sas/Makefile b/drivers/scsi/mpt3sas/Makefile
new file mode 100644
index 000..4c1d2e7
--- /dev/null
+++ b/drivers/scsi/mpt3sas/Makefile
@@ -0,0 +1,8 @@
+# mpt3sas makefile
+obj-m += mpt3sas.o
+mpt3sas-y +=  mpt3sas_base.o \
+   mpt3sas_config.o \
+   mpt3sas_scsih.o  \
+   mpt3sas_transport.o \
+   mpt3sas_ctl.o   \
+   mpt3sas_trigger_diag.o
diff --git a/drivers/scsi/scsi_transport_sas.c 
b/drivers/scsi/scsi_transport_sas.c
index f7565fc..1b68142 100644
--- 

[RESEND][PATCH 2/20][SCSI] mpt3sas: Paer 1 of MPI API headers

2012-09-29 Thread sreekanth.reddy
This patch contains MPI API headers
This patch is part 1 of MPI API headers.
Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---


diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h
new file mode 100644
index 000..03317ff
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpi/mpi2.h
@@ -0,0 +1,1164 @@
+/*
+ * Copyright (c) 2000-2012 LSI Corporation.
+ *
+ *
+ *  Name:  mpi2.h
+ * Title:  MPI Message independent structures and definitions
+ * including System Interface Register Set and
+ * scatter/gather formats.
+ * Creation Date:  June 21, 2006
+ *
+ * mpi2.h Version:  02.00.26
+ *
+ * NOTE: Names (typedefs, defines, etc.) beginning with an MPI25 or Mpi25
+ *   prefix are for use only on MPI v2.5 products, and must not be used
+ *   with MPI v2.0 products. Unless otherwise noted, names beginning with
+ *   MPI2 or Mpi2 are for use with both MPI v2.0 and MPI v2.5 products.
+ *
+ * Version History
+ * ---
+ *
+ * Date  Version   Description
+ *     --
+ * 04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
+ * 06-04-07  02.00.01  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 06-26-07  02.00.02  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 08-31-07  02.00.03  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Moved ReplyPostHostIndex register to offset 0x6C of the
+ * MPI2_SYSTEM_INTERFACE_REGS and modified the define for
+ * MPI2_REPLY_POST_HOST_INDEX_OFFSET.
+ * Added union of request descriptors.
+ * Added union of reply descriptors.
+ * 10-31-07  02.00.04  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added define for MPI2_VERSION_02_00.
+ * Fixed the size of the FunctionDependent5 field in the
+ * MPI2_DEFAULT_REPLY structure.
+ * 12-18-07  02.00.05  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Removed the MPI-defined Fault Codes and extended the
+ * product specific codes up to 0xEFFF.
+ * Added a sixth key value for the WriteSequence register
+ * and changed the flush value to 0x0.
+ * Added message function codes for Diagnostic Buffer Post
+ * and Diagnsotic Release.
+ * New IOCStatus define: MPI2_IOCSTATUS_DIAGNOSTIC_RELEASED
+ * Moved MPI2_VERSION_UNION from mpi2_ioc.h.
+ * 02-29-08  02.00.06  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 03-03-08  02.00.07  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 05-21-08  02.00.08  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added #defines for marking a reply descriptor as unused.
+ * 06-27-08  02.00.09  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 10-02-08  02.00.10  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Moved LUN field defines from mpi2_init.h.
+ * 01-19-09  02.00.11  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 05-06-09  02.00.12  Bumped MPI2_HEADER_VERSION_UNIT.
+ * In all request and reply descriptors, replaced VF_ID
+ * field with MSIxIndex field.
+ * Removed DevHandle field from
+ * MPI2_SCSI_IO_SUCCESS_REPLY_DESCRIPTOR and made those
+ * bytes reserved.
+ * Added RAID Accelerator functionality.
+ * 07-30-09  02.00.13  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 10-28-09  02.00.14  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added MSI-x index mask and shift for Reply Post Host
+ * Index register.
+ * Added function code for Host Based Discovery Action.
+ * 02-10-10  02.00.15  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added define for MPI2_FUNCTION_PWR_MGMT_CONTROL.
+ * Added defines for product-specific range of message
+ * function codes, 0xF0 to 0xFF.
+ * 05-12-10  02.00.16  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added alternative defines for the SGE Direction bit.
+ * 08-11-10  02.00.17  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 11-10-10  02.00.18  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added MPI2_IEEE_SGE_FLAGS_SYSTEMPLBCPI_ADDR define.
+ * 02-23-11  02.00.19  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added MPI2_FUNCTION_SEND_HOST_MESSAGE.
+ * 03-09-11  02.00.20  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 05-25-11  02.00.21  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 08-24-11  02.00.22  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 11-18-11  02.00.23  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Incorporating additions for MPI v2.5.
+ * 02-06-12  02.00.24  Bumped MPI2_HEADER_VERSION_UNIT.
+ * 03-29-12  02.00.25  Bumped MPI2_HEADER_VERSION_UNIT.
+ * Added 

[RESEND][PATCH 6/20][SCSI] mpt3sas: Part 5 of MPI API headers

2012-09-29 Thread sreekanth.reddy
This patch contains MPI API headers
This patch is part 5 of MPI API headers.
Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpi/mpi2_raid.h 
b/drivers/scsi/mpt3sas/mpi/mpi2_raid.h
new file mode 100644
index 000..d1d9866
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpi/mpi2_raid.h
@@ -0,0 +1,346 @@
+/*
+ * Copyright (c) 2000-2012 LSI Corporation.
+ *
+ *
+ *  Name:  mpi2_raid.h
+ * Title:  MPI Integrated RAID messages and structures
+ * Creation Date:  April 26, 2007
+ *
+ *   mpi2_raid.h Version:  02.00.08
+ *
+ * Version History
+ * ---
+ *
+ * Date  Version   Description
+ *     --
+ * 04-30-07  02.00.00  Corresponds to Fusion-MPT MPI Specification Rev A.
+ * 08-31-07  02.00.01  Modifications to RAID Action request and reply,
+ * including the Actions and ActionData.
+ * 02-29-08  02.00.02  Added MPI2_RAID_ACTION_ADATA_DISABL_FULL_REBUILD.
+ * 05-21-08  02.00.03  Added MPI2_RAID_VOL_CREATION_NUM_PHYSDISKS so that
+ * the PhysDisk array in MPI2_RAID_VOLUME_CREATION_STRUCT
+ * can be sized by the build environment.
+ * 07-30-09  02.00.04  Added proper define for the Use Default Settings bit of
+ * VolumeCreationFlags and marked the old one as obsolete.
+ * 05-12-10  02.00.05  Added MPI2_RAID_VOL_FLAGS_OP_MDC define.
+ * 08-24-10  02.00.06  Added MPI2_RAID_ACTION_COMPATIBILITY_CHECK along with
+ * related structures and defines.
+ * Added product-specific range to RAID Action values.
+ * 11-18-11  02.00.07  Incorporating additions for MPI v2.5.
+ * 02-06-12  02.00.08  Added MPI2_RAID_ACTION_PHYSDISK_HIDDEN.
+ * --
+ */
+
+#ifndef MPI2_RAID_H
+#define MPI2_RAID_H
+
+/*
+*
+*  Integrated RAID Messages
+*
+*/
+
+/
+* RAID Action messages
+/
+
+/*ActionDataWord defines for use with MPI2_RAID_ACTION_DELETE_VOLUME action */
+#define MPI2_RAID_ACTION_ADATA_KEEP_LBA0(0x)
+#define MPI2_RAID_ACTION_ADATA_ZERO_LBA0(0x0001)
+
+/*use MPI2_RAIDVOL0_SETTING_ defines from mpi2_cnfg.h for
+ *MPI2_RAID_ACTION_CHANGE_VOL_WRITE_CACHE action */
+
+/*ActionDataWord defines for use with
+ *MPI2_RAID_ACTION_DISABLE_ALL_VOLUMES action */
+#define MPI2_RAID_ACTION_ADATA_DISABL_FULL_REBUILD  (0x0001)
+
+/*ActionDataWord for MPI2_RAID_ACTION_SET_RAID_FUNCTION_RATE Action */
+typedef struct _MPI2_RAID_ACTION_RATE_DATA {
+   U8 RateToChange;/*0x00 */
+   U8 RateOrMode;  /*0x01 */
+   U16 DataScrubDuration;  /*0x02 */
+} MPI2_RAID_ACTION_RATE_DATA, *PTR_MPI2_RAID_ACTION_RATE_DATA,
+   Mpi2RaidActionRateData_t, *pMpi2RaidActionRateData_t;
+
+#define MPI2_RAID_ACTION_SET_RATE_RESYNC(0x00)
+#define MPI2_RAID_ACTION_SET_RATE_DATA_SCRUB(0x01)
+#define MPI2_RAID_ACTION_SET_RATE_POWERSAVE_MODE(0x02)
+
+/*ActionDataWord for MPI2_RAID_ACTION_START_RAID_FUNCTION Action */
+typedef struct _MPI2_RAID_ACTION_START_RAID_FUNCTION {
+   U8 RAIDFunction;/*0x00 */
+   U8 Flags;   /*0x01 */
+   U16 Reserved1;  /*0x02 */
+} MPI2_RAID_ACTION_START_RAID_FUNCTION,
+   *PTR_MPI2_RAID_ACTION_START_RAID_FUNCTION,
+   Mpi2RaidActionStartRaidFunction_t,
+   *pMpi2RaidActionStartRaidFunction_t;
+
+/*defines for the RAIDFunction field */
+#define MPI2_RAID_ACTION_START_BACKGROUND_INIT  (0x00)
+#define MPI2_RAID_ACTION_START_ONLINE_CAP_EXPANSION (0x01)
+#define MPI2_RAID_ACTION_START_CONSISTENCY_CHECK(0x02)
+
+/*defines for the Flags field */
+#define MPI2_RAID_ACTION_START_NEW  (0x00)
+#define MPI2_RAID_ACTION_START_RESUME   (0x01)
+
+/*ActionDataWord for MPI2_RAID_ACTION_STOP_RAID_FUNCTION Action */
+typedef struct _MPI2_RAID_ACTION_STOP_RAID_FUNCTION {
+   U8 RAIDFunction;/*0x00 */
+   U8 Flags;   /*0x01 */
+   U16 Reserved1;  /*0x02 */
+} MPI2_RAID_ACTION_STOP_RAID_FUNCTION,
+   *PTR_MPI2_RAID_ACTION_STOP_RAID_FUNCTION,
+   Mpi2RaidActionStopRaidFunction_t,
+   *pMpi2RaidActionStopRaidFunction_t;
+
+/*defines for the RAIDFunction field */
+#define MPI2_RAID_ACTION_STOP_BACKGROUND_INIT   (0x00)
+#define MPI2_RAID_ACTION_STOP_ONLINE_CAP_EXPANSION  (0x01)
+#define MPI2_RAID_ACTION_STOP_CONSISTENCY_CHECK (0x02)
+
+/*defines for the Flags field */
+#define MPI2_RAID_ACTION_STOP_ABORT (0x00)
+#define 

[RESEND][PATCH 9/20][SCSI] mpt3sas: Common API layer interface headers for access to MPT firmware.

2012-09-29 Thread sreekanth.reddy
This patch contains the Fusion MPT base driver providing common API layer 
interface
headers for access to MPT (Message Passing Technology) firmware.

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_base.h 
b/drivers/scsi/mpt3sas/mpt3sas_base.h
new file mode 100644
index 000..4e08a3c
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_base.h
@@ -0,0 +1,1139 @@
+/*
+ * This is the Fusion MPT base driver providing common API layer interface
+ * for access to MPT (Message Passing Technology) firmware.
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#ifndef MPT3SAS_BASE_H_INCLUDED
+#define MPT3SAS_BASE_H_INCLUDED
+
+#include mpi/mpi2_type.h
+#include mpi/mpi2.h
+#include mpi/mpi2_ioc.h
+#include mpi/mpi2_cnfg.h
+#include mpi/mpi2_init.h
+#include mpi/mpi2_raid.h
+#include mpi/mpi2_tool.h
+#include mpi/mpi2_sas.h
+
+#include scsi/scsi.h
+#include scsi/scsi_cmnd.h
+#include scsi/scsi_device.h
+#include scsi/scsi_host.h
+#include scsi/scsi_tcq.h
+#include scsi/scsi_transport_sas.h
+#include scsi/scsi_dbg.h
+#include scsi/scsi_eh.h
+
+#include mpt3sas_debug.h
+#include mpt3sas_trigger_diag.h
+
+/* driver versioning info */
+#define MPT3SAS_DRIVER_NAMEmpt3sas
+#define MPT3SAS_AUTHOR LSI Corporation dl-mptfusionli...@lsi.com
+#define MPT3SAS_DESCRIPTIONLSI MPT Fusion SAS 3.0 Device Driver
+#define MPT3SAS_DRIVER_VERSION 01.100.00.00
+#define MPT3SAS_MAJOR_VERSION  1
+#define MPT3SAS_MINOR_VERSION  100
+#define MPT3SAS_BUILD_VERSION  0
+#define MPT3SAS_RELEASE_VERSION00
+
+/*
+ * Set MPT3SAS_SG_DEPTH value based on user input.
+ */
+#define MPT3SAS_MAX_PHYS_SEGMENTS  SCSI_MAX_SG_SEGMENTS
+#define MPT3SAS_MIN_PHYS_SEGMENTS  16
+#ifdef CONFIG_SCSI_MPT3SAS_MAX_SGE
+#define MPT3SAS_SG_DEPTH   CONFIG_SCSI_MPT3SAS_MAX_SGE
+#else
+#define MPT3SAS_SG_DEPTH   MPT3SAS_MAX_PHYS_SEGMENTS
+#endif
+
+
+/*
+ * Generic Defines
+ */
+#define MPT3SAS_SATA_QUEUE_DEPTH   32
+#define MPT3SAS_SAS_QUEUE_DEPTH254
+#define MPT3SAS_RAID_QUEUE_DEPTH   128
+
+#define MPT_NAME_LENGTH32  /* generic length of 
strings */
+#define MPT_STRING_LENGTH  64
+
+#define MPT_MAX_CALLBACKS  32
+
+
+#define CAN_SLEEP  1
+#define  NO_SLEEP  0
+
+#define INTERNAL_CMDS_COUNT10  /* reserved cmds */
+
+#define MPI3_HIM_MASK  0x /* mask every bit*/
+
+#define MPT3SAS_INVALID_DEVICE_HANDLE  0x
+
+/*
+ * reset phases
+ */
+#define MPT3_IOC_PRE_RESET 1 /* prior to host reset */
+#define MPT3_IOC_AFTER_RESET   2 /* just after host reset */
+#define MPT3_IOC_DONE_RESET3 /* links re-initialized */
+
+/*
+ * logging format
+ */
+#define 

[RESEND][PATCH 12/20][SCSI] mpt3sas: Ioctl Module Support for MPT based controllers

2012-09-29 Thread sreekanth.reddy
This patch provides headers for ioctl Module Support for MPT (Message Passing 
Technology)
based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.h 
b/drivers/scsi/mpt3sas/mpt3sas_ctl.h
new file mode 100644
index 000..bd89f4f
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.h
@@ -0,0 +1,418 @@
+/*
+ * Management Module Support for MPT (Message Passing Technology) based
+ * controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_ctl.h
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#ifndef MPT3SAS_CTL_H_INCLUDED
+#define MPT3SAS_CTL_H_INCLUDED
+
+#ifdef __KERNEL__
+#include linux/miscdevice.h
+#endif
+
+
+#ifndef MPT3SAS_MINOR
+#define MPT3SAS_MINOR  (MPT_MINOR + 2)
+#endif
+#define MPT3SAS_DEV_NAME   mpt3ctl
+#define MPT3_MAGIC_NUMBER  'L'
+#define MPT3_IOCTL_DEFAULT_TIMEOUT (10) /* in seconds */
+
+/**
+ * IOCTL opcodes
+ */
+#define MPT3IOCINFO_IOWR(MPT3_MAGIC_NUMBER, 17, \
+   struct mpt3_ioctl_iocinfo)
+#define MPT3COMMAND_IOWR(MPT3_MAGIC_NUMBER, 20, \
+   struct mpt3_ioctl_command)
+#ifdef CONFIG_COMPAT
+#define MPT3COMMAND32  _IOWR(MPT3_MAGIC_NUMBER, 20, \
+   struct mpt3_ioctl_command32)
+#endif
+#define MPT3EVENTQUERY _IOWR(MPT3_MAGIC_NUMBER, 21, \
+   struct mpt3_ioctl_eventquery)
+#define MPT3EVENTENABLE_IOWR(MPT3_MAGIC_NUMBER, 22, \
+   struct mpt3_ioctl_eventenable)
+#define MPT3EVENTREPORT_IOWR(MPT3_MAGIC_NUMBER, 23, \
+   struct mpt3_ioctl_eventreport)
+#define MPT3HARDRESET  _IOWR(MPT3_MAGIC_NUMBER, 24, \
+   struct mpt3_ioctl_diag_reset)
+#define MPT3BTDHMAPPING_IOWR(MPT3_MAGIC_NUMBER, 31, \
+   struct mpt3_ioctl_btdh_mapping)
+
+/* diag buffer support */
+#define MPT3DIAGREGISTER _IOWR(MPT3_MAGIC_NUMBER, 26, \
+   struct mpt3_diag_register)
+#define MPT3DIAGRELEASE_IOWR(MPT3_MAGIC_NUMBER, 27, \
+   struct mpt3_diag_release)
+#define MPT3DIAGUNREGISTER _IOWR(MPT3_MAGIC_NUMBER, 28, \
+   struct mpt3_diag_unregister)
+#define MPT3DIAGQUERY  _IOWR(MPT3_MAGIC_NUMBER, 29, \
+   struct mpt3_diag_query)
+#define MPT3DIAGREADBUFFER _IOWR(MPT3_MAGIC_NUMBER, 30, \
+   struct mpt3_diag_read_buffer)
+
+/**
+ * struct mpt3_ioctl_header - main header structure
+ * @ioc_number -  IOC unit number
+ * @port_number - IOC port number
+ * @max_data_size - maximum number bytes to transfer on read
+ */
+struct mpt3_ioctl_header {
+   uint32_t ioc_number;
+   uint32_t port_number;
+   uint32_t max_data_size;
+};
+
+/**
+ * struct mpt3_ioctl_diag_reset - diagnostic reset
+ * @hdr - generic header
+ */
+struct mpt3_ioctl_diag_reset {
+   struct mpt3_ioctl_header hdr;
+};
+
+
+/**
+ * struct mpt3_ioctl_pci_info - pci device info
+ * @device - pci device id
+ * @function - pci function id
+ * @bus - pci bus id
+ * @segment_id - pci segment id
+ */
+struct mpt3_ioctl_pci_info {
+

[RESEND][PATCH 13/20][SCSI] mpt3sas: Logging Support for MPT based controllers

2012-09-29 Thread sreekanth.reddy
This patch provides Logging Support for MPT (Message Passing Technology)
based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_debug.h 
b/drivers/scsi/mpt3sas/mpt3sas_debug.h
new file mode 100644
index 000..ce70b87
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_debug.h
@@ -0,0 +1,219 @@
+/*
+ * Logging Support for MPT (Message Passing Technology) based controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_debug.c
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#ifndef MPT3SAS_DEBUG_H_INCLUDED
+#define MPT3SAS_DEBUG_H_INCLUDED
+
+#define MPT_DEBUG  0x0001
+#define MPT_DEBUG_MSG_FRAME0x0002
+#define MPT_DEBUG_SG   0x0004
+#define MPT_DEBUG_EVENTS   0x0008
+#define MPT_DEBUG_EVENT_WORK_TASK  0x0010
+#define MPT_DEBUG_INIT 0x0020
+#define MPT_DEBUG_EXIT 0x0040
+#define MPT_DEBUG_FAIL 0x0080
+#define MPT_DEBUG_TM   0x0100
+#define MPT_DEBUG_REPLY0x0200
+#define MPT_DEBUG_HANDSHAKE0x0400
+#define MPT_DEBUG_CONFIG   0x0800
+#define MPT_DEBUG_DL   0x1000
+#define MPT_DEBUG_RESET0x2000
+#define MPT_DEBUG_SCSI 0x4000
+#define MPT_DEBUG_IOCTL0x8000
+#define MPT_DEBUG_SAS  0x0002
+#define MPT_DEBUG_TRANSPORT0x0004
+#define MPT_DEBUG_TASK_SET_FULL0x0008
+
+#define MPT_DEBUG_TRIGGER_DIAG 0x0020
+
+
+/*
+ * CONFIG_SCSI_MPT3SAS_LOGGING - enabled in Kconfig
+ */
+
+#ifdef CONFIG_SCSI_MPT3SAS_LOGGING
+#define MPT_CHECK_LOGGING(IOC, CMD, BITS)  \
+{  \
+   if (IOC-logging_level  BITS)  \
+   CMD;\
+}
+#else
+#define MPT_CHECK_LOGGING(IOC, CMD, BITS)
+#endif /* CONFIG_SCSI_MPT3SAS_LOGGING */
+
+
+/*
+ * debug macros
+ */
+
+#define dprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG)
+
+#define dsgprintk(IOC, CMD)\
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SG)
+
+#define devtprintk(IOC, CMD)   \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENTS)
+
+#define dewtprintk(IOC, CMD)   \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENT_WORK_TASK)
+
+#define dinitprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_INIT)
+
+#define dexitprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EXIT)
+
+#define dfailprintk(IOC, CMD)  \
+   MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FAIL)
+
+#define dtmprintk(IOC, CMD)\
+   

[RESEND][PATCH 18/20][SCSI] mpt3sas: Common API to set Diagnostic trigger for MPT based controllers

2012-09-29 Thread sreekanth.reddy
This patch provides common API to set Diagnostic trigger for MPT
(Message Passing Technology) based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c 
b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
new file mode 100644
index 000..da6c5f2
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
@@ -0,0 +1,434 @@
+/*
+ * This module provides common API to set Diagnostic trigger for MPT
+ * (Message Passing Technology) based controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_trigger_diag.c
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+
+#include linux/version.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/errno.h
+#include linux/init.h
+#include linux/slab.h
+#include linux/types.h
+#include linux/pci.h
+#include linux/delay.h
+#include linux/compat.h
+#include linux/poll.h
+
+#include linux/io.h
+#include linux/uaccess.h
+
+#include mpt3sas_base.h
+
+/**
+ * _mpt3sas_raise_sigio - notifiy app
+ * @ioc: per adapter object
+ * @event_data:
+ */
+static void
+_mpt3sas_raise_sigio(struct MPT3SAS_ADAPTER *ioc,
+   struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data)
+{
+   Mpi2EventNotificationReply_t *mpi_reply;
+   u16 sz, event_data_sz;
+   unsigned long flags;
+
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT %s: enter\n,
+   ioc-name, __func__));
+
+   sz = offsetof(Mpi2EventNotificationReply_t, EventData) +
+   sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4;
+   mpi_reply = kzalloc(sz, GFP_KERNEL);
+   if (!mpi_reply)
+   goto out;
+   mpi_reply-Event = cpu_to_le16(MPI3_EVENT_DIAGNOSTIC_TRIGGER_FIRED);
+   event_data_sz = (sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T) + 4) / 4;
+   mpi_reply-EventDataLength = cpu_to_le16(event_data_sz);
+   memcpy(mpi_reply-EventData, event_data,
+   sizeof(struct SL_WH_TRIGGERS_EVENT_DATA_T));
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
+   %s: add to driver event log\n,
+   ioc-name, __func__));
+   mpt3sas_ctl_add_to_event_log(ioc, mpi_reply);
+   kfree(mpi_reply);
+ out:
+
+   /* clearing the diag_trigger_active flag */
+   spin_lock_irqsave(ioc-diag_trigger_lock, flags);
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT
+   %s: clearing diag_trigger_active flag\n,
+   ioc-name, __func__));
+   ioc-diag_trigger_active = 0;
+   spin_unlock_irqrestore(ioc-diag_trigger_lock, flags);
+
+   dTriggerDiagPrintk(ioc, pr_info(MPT3SAS_FMT %s: exit\n, ioc-name,
+   __func__));
+}
+
+/**
+ * mpt3sas_process_trigger_data - process the event data for the trigger
+ * @ioc: per adapter object
+ * @event_data:
+ */
+void
+mpt3sas_process_trigger_data(struct MPT3SAS_ADAPTER *ioc,
+   struct SL_WH_TRIGGERS_EVENT_DATA_T *event_data)
+{
+   u8 issue_reset = 0;
+
+  

[RESEND][PATCH 19/20][SCSI] mpt3sas: Common API headers to set Diagnostic trigger for MPT based controllers

2012-09-29 Thread sreekanth.reddy
This patch provides common API headers to set Diagnostic trigger for MPT
(Message Passing Technology) based controllers

Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
---

diff --git a/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h 
b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h
new file mode 100644
index 000..a10c309
--- /dev/null
+++ b/drivers/scsi/mpt3sas/mpt3sas_trigger_diag.h
@@ -0,0 +1,193 @@
+/*
+ * This is the Fusion MPT base driver providing common API layer interface
+ * to set Diagnostic triggers for MPT (Message Passing Technology) based
+ * controllers
+ *
+ * This code is based on drivers/scsi/mpt3sas/mpt3sas_base.h
+ * Copyright (C) 2012  LSI Corporation
+ *  (mailto:dl-mptfusionli...@lsi.com)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * NO WARRANTY
+ * THE PROGRAM IS PROVIDED ON AN AS IS BASIS, WITHOUT WARRANTIES OR
+ * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
+ * LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+ * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
+ * solely responsible for determining the appropriateness of using and
+ * distributing the Program and assumes all risks associated with its
+ * exercise of rights under this Agreement, including but not limited to
+ * the risks and costs of program errors, damage to or loss of data,
+ * programs or equipment, and unavailability or interruption of operations.
+
+ * DISCLAIMER OF LIABILITY
+ * NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
+ * HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
+ * USA.
+ */
+  /* Diagnostic Trigger Configuration Data Structures */
+
+#ifndef MPT3SAS_TRIGGER_DIAG_H_INCLUDED
+#define MPT3SAS_TRIGGER_DIAG_H_INCLUDED
+
+/* limitation on number of entries */
+#define NUM_VALID_ENTRIES   (20)
+
+/* trigger types */
+#define MPT3SAS_TRIGGER_MASTER  (1)
+#define MPT3SAS_TRIGGER_EVENT   (2)
+#define MPT3SAS_TRIGGER_SCSI(3)
+#define MPT3SAS_TRIGGER_MPI (4)
+
+/* trigger names */
+#define MASTER_TRIGGER_FILE_NAMEdiag_trigger_master
+#define EVENT_TRIGGERS_FILE_NAMEdiag_trigger_event
+#define SCSI_TRIGGERS_FILE_NAME diag_trigger_scsi
+#define MPI_TRIGGER_FILE_NAME   diag_trigger_mpi
+
+/* master trigger bitmask */
+#define MASTER_TRIGGER_FW_FAULT (0x0001)
+#define MASTER_TRIGGER_ADAPTER_RESET(0x0002)
+#define MASTER_TRIGGER_TASK_MANAGMENT   (0x0004)
+#define MASTER_TRIGGER_DEVICE_REMOVAL   (0x0008)
+
+/* fake firmware event for tigger */
+#define MPI3_EVENT_DIAGNOSTIC_TRIGGER_FIRED(0x6E)
+
+/**
+ * MasterTrigger is a single U32 passed to/from sysfs.
+ *
+ * Bit Flags (enables) include:
+ * 1. FW Faults
+ * 2. Adapter Reset issued by driver
+ * 3. TMs
+ * 4. Device Remove Event sent by FW
+ */
+
+struct SL_WH_MASTER_TRIGGER_T {
+   uint32_t MasterData;
+};
+
+/**
+ * struct SL_WH_EVENT_TRIGGER_T -  Definition of an event trigger element
+ * @EventValue: Event Code to trigger on
+ * @LogEntryQualifier: Type of FW event that logged (Log Entry Added Event 
only)
+ *
+ * Defines an event that should induce a DIAG_TRIGGER driver event if observed.
+ */
+struct SL_WH_EVENT_TRIGGER_T {
+   uint16_t EventValue;
+   uint16_t LogEntryQualifier;
+};
+
+/**
+ * struct SL_WH_EVENT_TRIGGERS_T -  Structure passed to/from sysfs containing a
+ *list of Event Triggers to be monitored for.
+ * @ValidEntries: Number of _SL_WH_EVENT_TRIGGER_T structures contained in this
+ *structure.
+ * @EventTriggerEntry: List of Event trigger elements.
+ *
+ * This binary structure is transferred via sysfs to get/set Event Triggers
+ * in the Linux Driver.
+ */
+
+struct SL_WH_EVENT_TRIGGERS_T {
+   uint32_t ValidEntries;
+   struct SL_WH_EVENT_TRIGGER_T 

Re: [PATCH][SCSI] mpt3sas: Paer 1 of MPI API headers

2012-09-29 Thread Bjørn Mork
sreekanth.re...@lsi.com writes:

 This patch contains MPI API headers
 This patch is part 1 of MPI API headers.
 Signed-off-by: Sreekanth Reddy sreekanth.re...@lsi.com
 Reviewed-by: Nagalakshmi Nandigama nagalakshmi.nandig...@lsi.com
 ---


 diff --git a/drivers/scsi/mpt3sas/mpi/mpi2.h b/drivers/scsi/mpt3sas/mpi/mpi2.h
 new file mode 100644
 index 000..03317ff
 --- /dev/null
 +++ b/drivers/scsi/mpt3sas/mpi/mpi2.h
 @@ -0,0 +1,1164 @@

Why can't this and the other headers be shared between the mpt2sas and
mpt3sas drivers?  Looks like you are duplicating a lot of code already
present in drivers/scsi/mpt2sas.  Why?  That's a recipe for maintenance
hell...

And it makes this submission impossible to review.


Bjørn
--
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: [usb-storage] Re: usb3 fails to write when using usb3 hub in usb3 port

2012-09-29 Thread Theodore Kilgore


On Sat, 29 Sep 2012, Adrian Sandu wrote:

  The only solution I see is to buy something else, like an Asus
  EB1501P-B057E .. I need something small and fast enough .. :| Maybe
  any other recommendations ? ( other root chipset / atom cpu .. small
  powered .. etc. )
 
 DON'T KILL ME ! .. I got the best cables I could get my hands on (
 double-shielded, 24k golded connectors .. metal pieces .. the best I
 could get my hands on on such short notice )... I replaced 2 cables (
 to hard drives ) and the one from the hub to the computer. I only got
 1 reset message in /var/log/messages in 24 hours .. I'll replace the
 other 4 just to be sure .. Now I should spam the companies and tell
 them they should provide cables within specs ..
 
 I guess having 6 drives that close ( among with other powering cables
 .. networking (I think I got at least 40 cables in that 1 sq m. ))
 isn't that good especially when the usb has another power source and
 stuff..
 
 IT WORKS. YEY. Hope this will help somebody in the future. Thanks for
 bearing me .. I sure learned a lesson from this. I guess all is well
 when it ends well.

Adrian,

I certainly would not think of killing anyone. I don't think anyone else 
on the list would, either. But your problems with the hard drivers are in 
fact an object lesson about flaky and barely-within-spec or 
barely-out-of-spec hardware. The problems are indeed very vexing and are 
quite difficult to isolate. I am glad that a couple of us actually began 
to suspect the hardware. It seems that those suspicions panned out, and 
all is well that ends well.

Even though I was not the first to pinpoint the problem, I had been 
reading this thread and the other post which raised the issue of hardware 
problems really got my spider-sense tingling. I started to remember some 
of my own experiences. Two of them immediately come to mind and might 
serve as a further object lesson to anyone who passes by and reads this:

1. A camera with the SQ913 camera chipset inside. My camera, which was 
used to write the driver code in libgphoto2, worked just fine on a Dell 
Pentium 3 system and on an old laptop with an OHCI setup for its USB, and 
refused to work properly on any of several computers in the house which 
ran an AMD cpu on top of a VIA-based motherboard. On those systems, severe 
data loss, data corruption, and actual crashing occurred while downloading 
still photos from the camera. Putting a magnetic core around the cable 
helped a little bit, but the problem did not go away. So, again, an 
example of a poor specimen of hardware hooked by a cheap cable to a cheap 
motherboard, and there was trouble. To this day I have no way to pinpoint 
the exact cause of the problem.

2. I forget which dual-mode camera it was, but it is one of those for 
which I wrote the kernel support. I discovered the problem at the worst 
possible time: after already writing the code and submitting same, and it 
actually went into a production kernel. When I found the problem, it was 
too late to get anything changed until the next release date. What was the 
problem? Well, the camera needs several mysterious initialization commands 
to start the video stream. Some of these were obviously superfluous and 
could be safely left unused. But I left out one too many. I developed the 
driver on an AMD system with ATI USB host controllers. Everything worked, 
and the code was duly submitted. Then, too late, I tested on a 
Pentium4-on-Intel system. There, the video stream would not start, 
or it would start and speedily crash. When I put back into the driver 
that pesky one too many omitted init string, the camera worked on an 
Intel setup, too. What exactly does that one command do? I don't 
exactly know. Precisely what caused the problem? I don't know. All I can 
say for sure is that the Intel (UHCI) system needed for a certain setup 
command to be sent to the camera, whereas the ATI (OHCI) system did not. 
And that is, in fact, something very strange. Go figure.

We are working with computers. Weird stuff is not supposed to happen. But 
it does. Occasionally, this needs to be remembered, as it does 
occasionally cause real-world problems and is often the likely explanation 
for what is otherwise inexplicable. Thus, sooner or later some old geezer 
comes along and reminds people that Murphy is still around to do his 
mischief. I am glad that my suggestions turned out to be helpful.

Theodore Kilgore




--
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: [usb-storage] Re: usb3 fails to write when using usb3 hub in usb3 port

2012-09-29 Thread Adrian Sandu
 We are working with computers. Weird stuff is not supposed to happen. But
 it does. Occasionally, this needs to be remembered, as it does
 occasionally cause real-world problems and is often the likely explanation
 for what is otherwise inexplicable. Thus, sooner or later some old geezer
 comes along and reminds people that Murphy is still around to do his
 mischief. I am glad that my suggestions turned out to be helpful.

I can't thank you people enough .. I just hope that this thread will
help someone else in the future ( feel free to add this to your list
of stories ! :) )
I just hate it when hardware (or in my case, cable ) makes don't stick
to the specs or improve/change them as they see it fit. If I'm
payin' for a product ( especially from a brand ) I expect it to do its
job better than others. I wouldn't of expected this from WD ..
--
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: [usb-storage] Re: usb3 fails to write when using usb3 hub in usb3 port

2012-09-29 Thread Peter Stuge
Adrian Sandu wrote:
 I wouldn't of expected this from WD ..

Like with Theodore's problem you don't really know for sure where the
problem was in your setup.

Any combination of USB controller hardware in PC, cable, and
electronics in drive enclosure can have caused your problem.

External disk drive now cost *less* than the exact same model
internal drive, so you are actually *getting paid* to receive
interface electronics, power supply, some plastic, metal and
rubber that makes up the enclosure, cabling, and packaging.

Guess if those parts are of the very highest quality, or optimized
for cost.


//Peter
--
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: [usb-storage] Re: usb3 fails to write when using usb3 hub in usb3 port

2012-09-29 Thread Theodore Kilgore


On Sun, 30 Sep 2012, Adrian Sandu wrote:

  We are working with computers. Weird stuff is not supposed to happen. But
  it does. Occasionally, this needs to be remembered, as it does
  occasionally cause real-world problems and is often the likely explanation
  for what is otherwise inexplicable. Thus, sooner or later some old geezer
  comes along and reminds people that Murphy is still around to do his
  mischief. I am glad that my suggestions turned out to be helpful.
 
 I can't thank you people enough .. I just hope that this thread will
 help someone else in the future ( feel free to add this to your list
 of stories ! :) )
 I just hate it when hardware (or in my case, cable ) makes don't stick
 to the specs or improve/change them as they see it fit. If I'm
 payin' for a product ( especially from a brand ) I expect it to do its
 job better than others. I wouldn't of expected this from WD ..

Oh? Why not? Of course, perhaps Seagate stuff is always better. Or 
Microsoft. Or Apple. Or ...??? (:-)

Specs and standards are for violating, you know. Or that is what some 
people think. It has been that way from the beginning of time. But what 
would be the solution? To have neither specs nor standards? One 
wouldn't expect that to work out too well, either.

Peter Stuge's comments are quite relevant, too. He is probably right about 
the category of external hard drives, these days. Indeed, they seem too 
good of a bargain. But maybe we are the ones who are fooled and it is the 
internal hard drives which are overpriced. Who knows? Anyway, one of the 
things which makes life really complicated for too many of us is, the 
statement that you get what you pay for is not necessarily true, either. 
It happens sometimes that some fly-by-night or Brand X company is making 
and selling the best product on the market in some category, but they 
can't charge nearly as much money as the so-called reputable producers and 
vendors precisely because they have no brand recognition. So one never 
knows.

Cheers,

Theodore Kilgore
--
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 v7 2/6] scsi: sr: support runtime pm

2012-09-29 Thread Rafael J. Wysocki
On Saturday, September 29, 2012, Aaron Lu wrote:
 [Adding more people and list back in]
 
 On 09/29/2012 05:46 AM, Rafael J. Wysocki wrote:
  On Friday, September 28, 2012, Aaron Lu wrote:
  On 09/28/2012 07:15 AM, Rafael J. Wysocki wrote:
  On Thursday, September 27, 2012, Aaron Lu wrote:
  On 09/27/2012 05:37 AM, Rafael J. Wysocki wrote:
 
  Say the user has pressed the eject button.  What does need to happen so 
  that
  the tray is physically ejected?
 
  The tray is ejected by the ODD itself, host does not have to do anything.
 
  There is a command(PREVENT_MEDIUM_REMOVAL) to lock the door so that when
  user presses the eject button, the tray will not be ejected. This command
  is usually sent when we have a disc inside and a user space program
  opened the underlying block device(e.g. /dev/sr0) to read/write data.
 
  And host can also eject the tray by sending a START_STOP_UNIT command
  with param LoEj set to 1 and we have a function called sr_tray_move to
  do just this. And this is also what I've used to eject the tray after
  user wakes up the ODD, as when user presses the eject button when the
  ODD is in zero power state, it can't eject the tray as usual, so host
  software will need to do this, that's the reason I need to know such
  information:
  When ODD is resumed, is it because user wakes it up?
 
  But START_STOP_UNIT eventually causes ata_scsi_start_stop_xlat() to be
 
  You are following ata case, while the ODD is an atapi device :-)
  The translation function is atapi_xlat, but that doesn't affect the idea
  here.
 
  executed, so I wonder if we really need to go up through the SCSI stack
  to send that command to the drive from there?  It should be possible
  to issue STANDBY/READ VERIFY to the device directly from libata if
  an eject event is signaled through a GPE.
 
  Yes, this is possible.
  Though it doesn't feel very cool, since I have no idea if the ODD is a
  tray type or slot type in ATA layer and I'll blindly send this command
  to it then, not a problem maybe.
  
  It would be good to verify if that works for slot devices, if possible.
 
 The ACPI GPE event is triggered when user inserts a disc into a slot
 type ODD, and if I send an eject command to it, the disc will be
 ejected, which is wrong.
 
 I need to know the loading mechanism(tray type or slot type) of the ODD
 to decide if I should send this command.
 
  
  And what do you think of moving the acpi notification code to sr?
  http://marc.info/?l=linux-pmm=134873904332704w=4
  
  I don't think this is a good idea, quite frankly.  sr seems to be a too
  generic place for that.
 
 Does this mean sr can only have code that is useful to all devices it
 manages? i.e. If a piece of code enables a feature for a special kind of
 ODD(like the sata based ZPODD), it shouldn't be done in sr?

If the feature is specific to one special kind of ODD only, then I don't
think sr is the right place to add support for it.

  Ideally, the whole ZPODD handling should not be visible to the SCSI layer,
 
 I can see 2 problems:
 - Don't know its loading machanism so we have the problem above;

Does using the need_eject flag address this problem somehow?

 - Need to send command to find out if ODD is zero power ready somewhere
   in ata layer, this implies the device is doing IO after it is runtime
   suspended in scsi layer.

There's nothing wrong with accessig suspended devices as long as we know
that they will respond. :-)

  perhaps except the no_polling flag disabling the polling that may be
  useful for other purposes in principle.
 
 I hope so, let's hear what other people has to say.
 
  
  I'm not sure if it's possible at this point, but if not we need to know
  very precisely why not.
 
 There is nothing in theory stopping us from doing this in ata layer.
 For the loading mechanism, we can always send an ATAPI command to figure
 it out.
 
 So gentlemen, I need your opinions on where this ZPODD code should live
 before I can continue this work, thanks.

I would _try_ to add it at the ATA level.

Thanks,
Rafael
--
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 v7 2/6] scsi: sr: support runtime pm

2012-09-29 Thread Rafael J. Wysocki
On Saturday, September 29, 2012, Alan Stern wrote:
 On Sat, 29 Sep 2012, Aaron Lu wrote:
 
   I don't think this is a good idea, quite frankly.  sr seems to be a too
   generic place for that.
  
  Does this mean sr can only have code that is useful to all devices it
  manages? i.e. If a piece of code enables a feature for a special kind of
  ODD(like the sata based ZPODD), it shouldn't be done in sr?
 
 Drivers are allowed to have special features and quirks that apply only 
 to some devices.
 
  There is nothing in theory stopping us from doing this in ata layer.
  For the loading mechanism, we can always send an ATAPI command to figure
  it out.
  
  So gentlemen, I need your opinions on where this ZPODD code should live
  before I can continue this work, thanks.
 
 Can arbitrary SCSI devices be ZP, or does this notion apply only to
 ATAPI-based drives?  That's the key question, and the answer determines
 where the ZP support belongs.

I agree.  That said for now I'm not aware of any other ZP devices.  It also
is unclear whether or not their requirements would be the same for the
ZPODD devices. 

 On the other hand, the sr driver certainly deserves to have some form 
 of runtime PM support, even for devices that aren't ZP.

Yes, it does, but it is unclear to me at this point what it should do in its
callbacks.

Thanks,
Rafael
--
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 v7 2/6] scsi: sr: support runtime pm

2012-09-29 Thread Rafael J. Wysocki
On Saturday, September 29, 2012, Aaron Lu wrote:
 On 09/29/2012 10:29 PM, Alan Stern wrote:
  On Sat, 29 Sep 2012, Aaron Lu wrote:
  
  I don't think this is a good idea, quite frankly.  sr seems to be a too
  generic place for that.
 
  Does this mean sr can only have code that is useful to all devices it
  manages? i.e. If a piece of code enables a feature for a special kind of
  ODD(like the sata based ZPODD), it shouldn't be done in sr?
  
  Drivers are allowed to have special features and quirks that apply only 
  to some devices.
 
 I think SATA based zero power capable ODDs are the some devices.
 
  
  There is nothing in theory stopping us from doing this in ata layer.
  For the loading mechanism, we can always send an ATAPI command to figure
  it out.
 
  So gentlemen, I need your opinions on where this ZPODD code should live
  before I can continue this work, thanks.
  
  Can arbitrary SCSI devices be ZP, or does this notion apply only to
  ATAPI-based drives?  That's the key question, and the answer determines
  where the ZP support belongs.
 
 I don't know if arbitrary SCSI devices can be ZP or not, the SPC spec
 doesn't seem to define such a power state.
 
 ZPODD is defined for sata based ATAPI ODD which supports device
 attention, but doesn't specify how the ODD is powered off and how the
 device attention pin notifies OS. On x86 systems, these are implemented
 by ACPI.
 
 Though SCSI devices may not have a general notion of ZP, the fact that
 ZPODD are managed by sr driver is enough to make the decision that ZPODD
 code can live in sr?

Well, only a part of it is handled by sr, the high-level part so to speak.
The low-level handling is done by the ATA layer.  Now, since sr is the
high-level part and is supposed to be generic, I don't think it's appropriate
to make it care about some low-level things specific to ATA (because there is
another layer of code supposed to handle those).

  On the other hand, the sr driver certainly deserves to have some form 
  of runtime PM support, even for devices that aren't ZP.
 
 Agree.
 
 And the following codes need to find a home:
 - Code used to handle ACPI wake notification(currently done in ATA, but
   causes the annoying need_eject flag in scsi_device);

And quite frankly I'd more and more convinced that this flag isn't really
necessary.

What you really want to achieve is to eject the tray of a tray-type ODD
if the eject is signaled through a GPE.  I don't see anything for sr to
do in that.  Moreover, you probably would like to do that even if the
drive is not powered down, right?

I wonder if this mechanism can be used for user space notification
without polling regardless of whether or not the zero-power feature is
used?

 - Code to check if the ODD is ready to be powered off per the ZPODD
   spec.

If that can be done at the ATA level, I'd prefer it too.

Thanks,
Rafael
--
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][SCSI] mpt3sas: Paer 1 of MPI API headers

2012-09-29 Thread Matthew Wilcox
On Sat, Sep 29, 2012 at 10:52:50PM +0200, Bj??rn Mork wrote:
 sreekanth.re...@lsi.com writes:
  This patch contains MPI API headers
 
 Why can't this and the other headers be shared between the mpt2sas and
 mpt3sas drivers?  Looks like you are duplicating a lot of code already
 present in drivers/scsi/mpt2sas.  Why?  That's a recipe for maintenance
 hell...

I would go further and ask why this needs a new driver; why can't mpt2sas
be enhanced to drive the 12Gbit cards?

-- 
Matthew Wilcox  Intel Open Source Technology Centre
Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours.  We can't possibly take such
a retrograde step.
--
To unsubscribe from this list: send the line unsubscribe linux-scsi in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html