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.

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/scsi/adapters/mpt_sas3/mptsas3_raid.c
          +++ new/usr/src/uts/common/io/scsi/adapters/mpt_sas3/mptsas3_raid.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  24   24   * Use is subject to license terms.
       25 + * Copyright (c) 2014, Tegile Systems Inc. All rights reserved.
  25   26   */
  26   27  
  27   28  /*
  28   29   * Copyright (c) 2000 to 2010, LSI Corporation.
  29   30   * All rights reserved.
  30   31   *
  31   32   * Redistribution and use in source and binary forms of all code within
  32   33   * this file that is exclusively owned by LSI, with or without
  33   34   * modification, is permitted provided that, in addition to the CDDL 1.0
  34   35   * License requirements, the following conditions are met:
↓ open down ↓ 30 lines elided ↑ open up ↑
  65   66  /*
  66   67   * standard header files
  67   68   */
  68   69  #include <sys/note.h>
  69   70  #include <sys/scsi/scsi.h>
  70   71  #include <sys/byteorder.h>
  71   72  #include <sys/raidioctl.h>
  72   73  
  73   74  #pragma pack(1)
  74   75  
  75      -#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_type.h>
  76      -#include <sys/scsi/adapters/mpt_sas/mpi/mpi2.h>
  77      -#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_cnfg.h>
  78      -#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_init.h>
  79      -#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_ioc.h>
  80      -#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_raid.h>
  81      -#include <sys/scsi/adapters/mpt_sas/mpi/mpi2_tool.h>
       76 +#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_type.h>
       77 +#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2.h>
       78 +#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_cnfg.h>
       79 +#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_init.h>
       80 +#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_ioc.h>
       81 +#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_raid.h>
       82 +#include <sys/scsi/adapters/mpt_sas3/mpi/mpi2_tool.h>
  82   83  
  83   84  #pragma pack()
  84   85  
  85   86  /*
  86   87   * private header files.
  87   88   */
  88      -#include <sys/scsi/adapters/mpt_sas/mptsas_var.h>
       89 +#include <sys/scsi/adapters/mpt_sas3/mptsas3_var.h>
  89   90  
  90   91  static int mptsas_get_raid_wwid(mptsas_t *mpt, mptsas_raidvol_t *raidvol);
  91   92  
  92   93  extern int mptsas_check_dma_handle(ddi_dma_handle_t handle);
  93   94  extern int mptsas_check_acc_handle(ddi_acc_handle_t handle);
  94   95  extern mptsas_target_t *mptsas_tgt_alloc(mptsas_t *, uint16_t,
  95   96      uint64_t, uint32_t, mptsas_phymask_t, uint8_t);
  96   97  
  97   98  static int
  98   99  mptsas_raidconf_page_0_cb(mptsas_t *mpt, caddr_t page_memp,
↓ open down ↓ 460 lines elided ↑ open up ↑
 559  560  
 560  561  /*
 561  562   * RAID Action for System Shutdown. This request uses the dedicated TM slot to
 562  563   * avoid a call to mptsas_save_cmd.  Since Solaris requires that the mutex is
 563  564   * not held during the mptsas_quiesce function, this RAID action must not use
 564  565   * the normal code path of requests and replies.
 565  566   */
 566  567  void
 567  568  mptsas_raid_action_system_shutdown(mptsas_t *mpt)
 568  569  {
      570 +        mptsas_reply_pqueue_t           *rpqp;
 569  571          pMpi2RaidActionRequest_t        action;
 570  572          uint8_t                         ir_active = FALSE, reply_type;
 571  573          uint8_t                         function, found_reply = FALSE;
 572  574          uint16_t                        SMID, action_type;
 573  575          mptsas_slots_t                  *slots = mpt->m_active;
 574  576          int                             config, vol;
 575  577          mptsas_cmd_t                    *cmd;
 576      -        uint32_t                        request_desc_low, reply_addr;
      578 +        uint32_t                        reply_addr;
      579 +        uint64_t                        request_desc;
 577  580          int                             cnt;
 578  581          pMpi2ReplyDescriptorsUnion_t    reply_desc_union;
 579  582          pMPI2DefaultReply_t             reply;
 580  583          pMpi2AddressReplyDescriptor_t   address_reply;
 581  584  
 582  585          /*
 583  586           * Before doing the system shutdown RAID Action, make sure that the IOC
 584  587           * supports IR and make sure there is a valid volume for the request.
 585  588           */
 586  589          if (mpt->m_ir_capable) {
↓ open down ↓ 35 lines elided ↑ open up ↑
 622  625           * Form message for raid action.
 623  626           */
 624  627          action = (pMpi2RaidActionRequest_t)(mpt->m_req_frame +
 625  628              (mpt->m_req_frame_size * cmd->cmd_slot));
 626  629          bzero(action, mpt->m_req_frame_size);
 627  630          action->Function = MPI2_FUNCTION_RAID_ACTION;
 628  631          action->Action = MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED;
 629  632  
 630  633          /*
 631  634           * Send RAID Action.
      635 +         * Defaults to MSIxIndex of 0, so check reply q 0 below.
 632  636           */
 633  637          (void) ddi_dma_sync(mpt->m_dma_req_frame_hdl, 0, 0,
 634  638              DDI_DMA_SYNC_FORDEV);
 635      -        request_desc_low = (cmd->cmd_slot << 16) +
      639 +        request_desc = (cmd->cmd_slot << 16) +
 636  640              MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE;
 637      -        MPTSAS_START_CMD(mpt, request_desc_low, 0);
      641 +        MPTSAS_START_CMD(mpt, request_desc);
 638  642  
 639  643          /*
 640  644           * Even though reply does not matter because the system is shutting
 641  645           * down, wait no more than 5 seconds here to get the reply just because
 642  646           * we don't want to leave it hanging if it's coming.  Poll because
 643  647           * interrupts are disabled when this function is called.
 644  648           */
      649 +        rpqp = mpt->m_rep_post_queues;
 645  650          for (cnt = 0; cnt < 5000; cnt++) {
 646  651                  /*
 647  652                   * Check for a reply.
 648  653                   */
 649  654                  (void) ddi_dma_sync(mpt->m_dma_post_queue_hdl, 0, 0,
 650  655                      DDI_DMA_SYNC_FORCPU);
 651  656  
 652  657                  reply_desc_union = (pMpi2ReplyDescriptorsUnion_t)
 653      -                    MPTSAS_GET_NEXT_REPLY(mpt, mpt->m_post_index);
      658 +                    MPTSAS_GET_NEXT_REPLY(rpqp, rpqp->rpq_index);
 654  659  
 655  660                  if (ddi_get32(mpt->m_acc_post_queue_hdl,
 656  661                      &reply_desc_union->Words.Low) == 0xFFFFFFFF ||
 657  662                      ddi_get32(mpt->m_acc_post_queue_hdl,
 658  663                      &reply_desc_union->Words.High) == 0xFFFFFFFF) {
 659  664                          drv_usecwait(1000);
 660  665                          continue;
 661  666                  }
 662  667  
 663  668                  /*
↓ open down ↓ 54 lines elided ↑ open up ↑
 718  723                      MPI2_RAID_ACTION_SYSTEM_SHUTDOWN_INITIATED) {
 719  724                          goto clear_and_continue;
 720  725                  }
 721  726                  found_reply = TRUE;
 722  727  
 723  728  clear_and_continue:
 724  729                  /*
 725  730                   * Clear the reply descriptor for re-use and increment index.
 726  731                   */
 727  732                  ddi_put64(mpt->m_acc_post_queue_hdl,
 728      -                    &((uint64_t *)(void *)mpt->m_post_queue)[mpt->m_post_index],
      733 +                    &((uint64_t *)(void *)rpqp->rpq_queue)[rpqp->rpq_index],
 729  734                      0xFFFFFFFFFFFFFFFF);
 730  735                  (void) ddi_dma_sync(mpt->m_dma_post_queue_hdl, 0, 0,
 731  736                      DDI_DMA_SYNC_FORDEV);
 732  737  
 733  738                  /*
 734      -                 * Update the global reply index and keep looking for the
      739 +                 * Update the reply index and keep looking for the
 735  740                   * reply if not found yet.
 736  741                   */
 737      -                if (++mpt->m_post_index == mpt->m_post_queue_depth) {
 738      -                        mpt->m_post_index = 0;
      742 +                if (++rpqp->rpq_index == mpt->m_post_queue_depth) {
      743 +                        rpqp->rpq_index = 0;
 739  744                  }
      745 +
 740  746                  ddi_put32(mpt->m_datap, &mpt->m_reg->ReplyPostHostIndex,
 741      -                    mpt->m_post_index);
      747 +                    rpqp->rpq_index);
 742  748                  if (!found_reply) {
 743  749                          continue;
 744  750                  }
 745  751  
 746  752                  break;
 747  753          }
 748  754  
 749  755          /*
 750  756           * clear the used slot as the last step.
 751  757           */
↓ open down ↓ 34 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX