542         int             fm_capabilities;
 543         /*
 544          * Driver resources unroll flags.  The flag is set for resources that
 545          * are needed to be free'd at detach() time.
 546          */
 547         struct _unroll {
 548                 uint8_t softs;          /* The software state was allocated. */
 549                 uint8_t regs;           /* Controller registers mapped. */
 550                 uint8_t intr;           /* Interrupt handler added. */
 551                 uint8_t reqs;           /* Request structs allocated. */
 552                 uint8_t mutexs;         /* Mutex's allocated. */
 553                 uint8_t taskq;          /* Task q's created. */
 554                 uint8_t tran;           /* Tran struct allocated */
 555                 uint8_t tranSetup;      /* Tran attached to the ddi. */
 556                 uint8_t devctl;         /* Device nodes for cfgadm created. */
 557                 uint8_t scsictl;        /* Device nodes for cfgadm created. */
 558                 uint8_t ioctl;          /* Device nodes for ioctl's created. */
 559                 uint8_t timer;          /* Timer started. */
 560                 uint8_t aenPend;        /* AEN cmd pending f/w. */
 561                 uint8_t mapUpdate_pend; /* LD MAP update cmd pending f/w. */
 562                 uint8_t soft_isr;
 563                 uint8_t ldlist_buff;
 564                 uint8_t pdlist_buff;
 565                 uint8_t syncCmd;
 566                 uint8_t verBuff;
 567                 uint8_t alloc_space_mfi;
 568                 uint8_t alloc_space_mpi2;
 569         } unroll;
 570 
 571 
 572         /* function template pointer */
 573         struct mrsas_function_template *func_ptr;
 574 
 575 
 576         /* MSI interrupts specific */
 577         ddi_intr_handle_t *intr_htable;         /* Interrupt handle array */
 578         size_t          intr_htable_size;       /* Int. handle array size */
 579         int             intr_type;
 580         int             intr_cnt;
 581         uint_t          intr_pri;
 582         int             intr_cap;
 583 
 584         ddi_taskq_t     *taskq;
 585         struct mrsas_ld *mr_ld_list;
 586         kmutex_t        config_dev_mtx;
 587         /* ThunderBolt (TB) specific */
 588         ddi_softintr_t  tbolt_soft_intr_id;
 
 646 };
 647 
 648 /*
 649  * ### Helper routines ###
 650  */
 651 
 652 /*
 653  * con_log() - console log routine
 654  * @param level         : indicates the severity of the message.
 655  * @fparam mt           : format string
 656  *
 657  * con_log displays the error messages on the console based on the current
 658  * debug level. Also it attaches the appropriate kernel severity level with
 659  * the message.
 660  *
 661  *
 662  * console messages debug levels
 663  */
 664 #define CL_NONE         0       /* No debug information */
 665 #define CL_ANN          1       /* print unconditionally, announcements */
 666 #define CL_ANN1         2       /* No o/p  */
 667 #define CL_DLEVEL1      3       /* debug level 1, informative */
 668 #define CL_DLEVEL2      4       /* debug level 2, verbose */
 669 #define CL_DLEVEL3      5       /* debug level 3, very verbose */
 670 
 671 #ifdef __SUNPRO_C
 672 #define __func__ ""
 673 #endif
 674 
 675 #define con_log(level, fmt) { if (debug_level_g >= level) cmn_err fmt; }
 676 
 677 /*
 678  * ### SCSA definitions ###
 679  */
 680 #define PKT2TGT(pkt)    ((pkt)->pkt_address.a_target)
 681 #define PKT2LUN(pkt)    ((pkt)->pkt_address.a_lun)
 682 #define PKT2TRAN(pkt)   ((pkt)->pkt_adress.a_hba_tran)
 683 #define ADDR2TRAN(ap)   ((ap)->a_hba_tran)
 684 
 685 #define TRAN2MR(tran)   (struct mrsas_instance *)(tran)->tran_hba_private)
 686 #define ADDR2MR(ap)     (TRAN2MR(ADDR2TRAN(ap))
 
1944         uint16_t        host_no;
1945         uint16_t        cmd_status;
1946         uint32_t        seq_num;
1947         uint32_t        class_locale_word;
1948 };
1949 
1950 #pragma pack()
1951 
1952 #ifndef DDI_VENDOR_LSI
1953 #define DDI_VENDOR_LSI          "LSI"
1954 #endif /* DDI_VENDOR_LSI */
1955 
1956 int     mrsas_config_scsi_device(struct mrsas_instance *,
1957                     struct scsi_device *, dev_info_t **);
1958 
1959 #ifdef PDSUPPORT
1960 int     mrsas_tbolt_config_pd(struct mrsas_instance *, uint16_t,
1961                         uint8_t, dev_info_t **);
1962 #endif
1963 
1964 dev_info_t *mrsas_find_child(struct mrsas_instance *, uint16_t,
1965                         uint8_t);
1966 int     mrsas_service_evt(struct mrsas_instance *, int, int, int,
1967                         uint64_t);
1968 void return_raid_msg_pkt(struct mrsas_instance *, struct mrsas_cmd *);
1969 struct mrsas_cmd *get_raid_msg_mfi_pkt(struct mrsas_instance *);
1970 void return_raid_msg_mfi_pkt(struct mrsas_instance *, struct mrsas_cmd *);
1971 
1972 int     alloc_space_for_mpi2(struct mrsas_instance *);
1973 void    fill_up_drv_ver(struct mrsas_drv_ver *dv);
1974 
1975 int     mrsas_issue_init_mpi2(struct mrsas_instance *);
1976 struct scsi_pkt *mrsas_tbolt_tran_init_pkt(struct scsi_address *, register
1977                     struct scsi_pkt *, struct buf *, int, int, int, int,
1978                     int (*)(), caddr_t);
1979 int     mrsas_tbolt_tran_start(struct scsi_address *,
1980                     register struct scsi_pkt *);
1981 uint32_t tbolt_read_fw_status_reg(struct mrsas_instance *);
1982 void    tbolt_issue_cmd(struct mrsas_cmd *, struct mrsas_instance *);
1983 int     tbolt_issue_cmd_in_poll_mode(struct mrsas_instance *,
1984                     struct mrsas_cmd *);
1985 int     tbolt_issue_cmd_in_sync_mode(struct mrsas_instance *,
1986                     struct mrsas_cmd *);
1987 void    tbolt_enable_intr(struct mrsas_instance *);
  
 | 
 
 
 542         int             fm_capabilities;
 543         /*
 544          * Driver resources unroll flags.  The flag is set for resources that
 545          * are needed to be free'd at detach() time.
 546          */
 547         struct _unroll {
 548                 uint8_t softs;          /* The software state was allocated. */
 549                 uint8_t regs;           /* Controller registers mapped. */
 550                 uint8_t intr;           /* Interrupt handler added. */
 551                 uint8_t reqs;           /* Request structs allocated. */
 552                 uint8_t mutexs;         /* Mutex's allocated. */
 553                 uint8_t taskq;          /* Task q's created. */
 554                 uint8_t tran;           /* Tran struct allocated */
 555                 uint8_t tranSetup;      /* Tran attached to the ddi. */
 556                 uint8_t devctl;         /* Device nodes for cfgadm created. */
 557                 uint8_t scsictl;        /* Device nodes for cfgadm created. */
 558                 uint8_t ioctl;          /* Device nodes for ioctl's created. */
 559                 uint8_t timer;          /* Timer started. */
 560                 uint8_t aenPend;        /* AEN cmd pending f/w. */
 561                 uint8_t mapUpdate_pend; /* LD MAP update cmd pending f/w. */
 562                 uint8_t soft_isr;       /* Soft interrupt handler allocated. */
 563                 uint8_t ldlist_buff;    /* Logical disk list allocated. */
 564                 uint8_t pdlist_buff;    /* Physical disk list allocated. */
 565                 uint8_t syncCmd;        /* Sync map command allocated. */
 566                 uint8_t verBuff;        /* 2108 MFI buffer allocated. */
 567                 uint8_t alloc_space_mfi;  /* Allocated space for 2108 MFI. */
 568                 uint8_t alloc_space_mpi2; /* Allocated space for 2208 MPI2. */
 569         } unroll;
 570 
 571 
 572         /* function template pointer */
 573         struct mrsas_function_template *func_ptr;
 574 
 575 
 576         /* MSI interrupts specific */
 577         ddi_intr_handle_t *intr_htable;         /* Interrupt handle array */
 578         size_t          intr_htable_size;       /* Int. handle array size */
 579         int             intr_type;
 580         int             intr_cnt;
 581         uint_t          intr_pri;
 582         int             intr_cap;
 583 
 584         ddi_taskq_t     *taskq;
 585         struct mrsas_ld *mr_ld_list;
 586         kmutex_t        config_dev_mtx;
 587         /* ThunderBolt (TB) specific */
 588         ddi_softintr_t  tbolt_soft_intr_id;
 
 646 };
 647 
 648 /*
 649  * ### Helper routines ###
 650  */
 651 
 652 /*
 653  * con_log() - console log routine
 654  * @param level         : indicates the severity of the message.
 655  * @fparam mt           : format string
 656  *
 657  * con_log displays the error messages on the console based on the current
 658  * debug level. Also it attaches the appropriate kernel severity level with
 659  * the message.
 660  *
 661  *
 662  * console messages debug levels
 663  */
 664 #define CL_NONE         0       /* No debug information */
 665 #define CL_ANN          1       /* print unconditionally, announcements */
 666 #define CL_ANN1         2       /* No-op  */
 667 #define CL_DLEVEL1      3       /* debug level 1, informative */
 668 #define CL_DLEVEL2      4       /* debug level 2, verbose */
 669 #define CL_DLEVEL3      5       /* debug level 3, very verbose */
 670 
 671 #ifdef __SUNPRO_C
 672 #define __func__ ""
 673 #endif
 674 
 675 #define con_log(level, fmt) { if (debug_level_g >= level) cmn_err fmt; }
 676 
 677 /*
 678  * ### SCSA definitions ###
 679  */
 680 #define PKT2TGT(pkt)    ((pkt)->pkt_address.a_target)
 681 #define PKT2LUN(pkt)    ((pkt)->pkt_address.a_lun)
 682 #define PKT2TRAN(pkt)   ((pkt)->pkt_adress.a_hba_tran)
 683 #define ADDR2TRAN(ap)   ((ap)->a_hba_tran)
 684 
 685 #define TRAN2MR(tran)   (struct mrsas_instance *)(tran)->tran_hba_private)
 686 #define ADDR2MR(ap)     (TRAN2MR(ADDR2TRAN(ap))
 
1944         uint16_t        host_no;
1945         uint16_t        cmd_status;
1946         uint32_t        seq_num;
1947         uint32_t        class_locale_word;
1948 };
1949 
1950 #pragma pack()
1951 
1952 #ifndef DDI_VENDOR_LSI
1953 #define DDI_VENDOR_LSI          "LSI"
1954 #endif /* DDI_VENDOR_LSI */
1955 
1956 int mrsas_config_scsi_device(struct mrsas_instance *,
1957     struct scsi_device *, dev_info_t **);
1958 
1959 #ifdef PDSUPPORT
1960 int mrsas_tbolt_config_pd(struct mrsas_instance *, uint16_t,
1961     uint8_t, dev_info_t **);
1962 #endif
1963 
1964 dev_info_t *mrsas_find_child(struct mrsas_instance *, uint16_t, uint8_t);
1965 int mrsas_service_evt(struct mrsas_instance *, int, int, int, uint64_t);
1966 void return_raid_msg_pkt(struct mrsas_instance *, struct mrsas_cmd *);
1967 struct mrsas_cmd *get_raid_msg_mfi_pkt(struct mrsas_instance *);
1968 void return_raid_msg_mfi_pkt(struct mrsas_instance *, struct mrsas_cmd *);
1969 
1970 int     alloc_space_for_mpi2(struct mrsas_instance *);
1971 void    fill_up_drv_ver(struct mrsas_drv_ver *dv);
1972 
1973 int     mrsas_issue_init_mpi2(struct mrsas_instance *);
1974 struct scsi_pkt *mrsas_tbolt_tran_init_pkt(struct scsi_address *, register
1975                     struct scsi_pkt *, struct buf *, int, int, int, int,
1976                     int (*)(), caddr_t);
1977 int     mrsas_tbolt_tran_start(struct scsi_address *,
1978                     register struct scsi_pkt *);
1979 uint32_t tbolt_read_fw_status_reg(struct mrsas_instance *);
1980 void    tbolt_issue_cmd(struct mrsas_cmd *, struct mrsas_instance *);
1981 int     tbolt_issue_cmd_in_poll_mode(struct mrsas_instance *,
1982                     struct mrsas_cmd *);
1983 int     tbolt_issue_cmd_in_sync_mode(struct mrsas_instance *,
1984                     struct mrsas_cmd *);
1985 void    tbolt_enable_intr(struct mrsas_instance *);
  
 |