Print this page
hg changesets 607a5b46a793..b706c96317c3
Fix ncpus for early boot config
Purge the ack to the interrupt before exiting mptsas_intr()
Changes from code review
Update tx waitq's code.
Create 2 threads, divide the workflow and deliver
to the hardware from the threads.
Added code to support using MSI-X interrupts across multiple
reply queues. Not tested with anything other than 3008 yet.
Changes to enable driver to compile.
Header paths, object lists, etc.

@@ -20,10 +20,11 @@
  */
 
 /*
  * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
+ * Copyright (c) 2014, Tegile Systems Inc. All rights reserved.
  */
 
 /*
  * Copyright (c) 2000 to 2010, LSI Corporation.
  * All rights reserved.

@@ -70,24 +71,24 @@
 #include <sys/byteorder.h>
 #include <sys/raidioctl.h>
 
 #pragma pack(1)
 
-#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_type.h>
-#include <sys/scsi/adapters/mpt_sas/mpi/mpi2.h>
-#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_cnfg.h>
-#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_init.h>
-#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_ioc.h>
-#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_raid.h>
-#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_tool.h>
+#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_type.h>
+#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2.h>
+#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_cnfg.h>
+#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_init.h>
+#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_ioc.h>
+#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_raid.h>
+#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_tool.h>
 
 #pragma pack()
 
 /*
  * private header files.
  */
-#include <sys/scsi/adapters/mpt_sas/mptsas_var.h>
+#include <sys/scsi/adapters/mpt_sas3/mptsas3_var.h>
 
 static int mptsas_get_raid_wwid(mptsas_t *mpt, mptsas_raidvol_t *raidvol);
 
 extern int mptsas_check_dma_handle(ddi_dma_handle_t handle);
 extern int mptsas_check_acc_handle(ddi_acc_handle_t handle);

@@ -564,18 +565,20 @@
  * the normal code path of requests and replies.
  */
 void
 mptsas_raid_action_system_shutdown(mptsas_t *mpt)
 {
+        mptsas_reply_pqueue_t           *rpqp;
         pMpi2RaidActionRequest_t        action;
         uint8_t                         ir_active = FALSE, reply_type;
         uint8_t                         function, found_reply = FALSE;
         uint16_t                        SMID, action_type;
         mptsas_slots_t                  *slots = mpt->m_active;
         int                             config, vol;
         mptsas_cmd_t                    *cmd;
-        uint32_t                        request_desc_low, reply_addr;
+        uint32_t                        reply_addr;
+        uint64_t                        request_desc;
         int                             cnt;
         pMpi2ReplyDescriptorsUnion_t    reply_desc_union;
         pMPI2DefaultReply_t             reply;
         pMpi2AddressReplyDescriptor_t   address_reply;
 

@@ -627,32 +630,34 @@
         action->Function = MPI2_FUNCTION_RAID_ACTION;
         action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED;
 
         /*
          * Send RAID Action.
+         * Defaults to MSIxIndex of 0, so check reply q 0 below.
          */
         (void) ddi_dma_sync(mpt->m_dma_req_frame_hdl, 0, 0,
             DDI_DMA_SYNC_FORDEV);
-        request_desc_low = (cmd->cmd_slot << 16) +
+        request_desc = (cmd->cmd_slot << 16) +
             MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
-        MPTSAS_START_CMD(mpt, request_desc_low, 0);
+        MPTSAS_START_CMD(mpt, request_desc);
 
         /*
          * Even though reply does not matter because the system is shutting
          * down, wait no more than 5 seconds here to get the reply just because
          * we don't want to leave it hanging if it's coming.  Poll because
          * interrupts are disabled when this function is called.
          */
+        rpqp = mpt->m_rep_post_queues;
         for (cnt = 0; cnt < 5000; cnt++) {
                 /*
                  * Check for a reply.
                  */
                 (void) ddi_dma_sync(mpt->m_dma_post_queue_hdl, 0, 0,
                     DDI_DMA_SYNC_FORCPU);
 
                 reply_desc_union = (pMpi2ReplyDescriptorsUnion_t)
-                    MPTSAS_GET_NEXT_REPLY(mpt, mpt->m_post_index);
+                    MPTSAS_GET_NEXT_REPLY(rpqp, rpqp->rpq_index);
 
                 if (ddi_get32(mpt->m_acc_post_queue_hdl,
                     &reply_desc_union->Words.Low) == 0xFFFFFFFF ||
                     ddi_get32(mpt->m_acc_post_queue_hdl,
                     &reply_desc_union->Words.High) == 0xFFFFFFFF) {

@@ -723,24 +728,25 @@
 clear_and_continue:
                 /*
                  * Clear the reply descriptor for re-use and increment index.
                  */
                 ddi_put64(mpt->m_acc_post_queue_hdl,
-                    &((uint64_t *)(void *)mpt->m_post_queue)[mpt->m_post_index],
+                    &((uint64_t *)(void *)rpqp->rpq_queue)[rpqp->rpq_index],
                     0xFFFFFFFFFFFFFFFF);
                 (void) ddi_dma_sync(mpt->m_dma_post_queue_hdl, 0, 0,
                     DDI_DMA_SYNC_FORDEV);
 
                 /*
-                 * Update the global reply index and keep looking for the
+                 * Update the reply index and keep looking for the
                  * reply if not found yet.
                  */
-                if (++mpt->m_post_index == mpt->m_post_queue_depth) {
-                        mpt->m_post_index = 0;
+                if (++rpqp->rpq_index == mpt->m_post_queue_depth) {
+                        rpqp->rpq_index = 0;
                 }
+
                 ddi_put32(mpt->m_datap, &mpt->m_reg->ReplyPostHostIndex,
-                    mpt->m_post_index);
+                    rpqp->rpq_index);
                 if (!found_reply) {
                         continue;
                 }
 
                 break;