Print this page
4031 scsa1394 violates DDI scsi_pkt(9S) allocation rules


   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _SYS_1394_TARGETS_SCSA1394_IMPL_H
  27 #define _SYS_1394_TARGETS_SCSA1394_IMPL_H
  28 
  29 #pragma ident   "%Z%%M% %I%     %E% SMI"
  30 
  31 /*
  32  * scsa1394 definitions
  33  */
  34 
  35 #include <sys/1394/t1394.h>
  36 #include <sys/sbp2/driver.h>
  37 #include <sys/scsi/scsi.h>
  38 #include <sys/cdio.h>
  39 #include <sys/1394/targets/scsa1394/cmd.h>
  40 
  41 #ifdef  __cplusplus
  42 extern "C" {
  43 #endif
  44 
  45 /*
  46  * each lun uses a worker thread for various deferred processing
  47  */
  48 typedef enum {
  49         SCSA1394_THR_INIT,                      /* initial state */
  50         SCSA1394_THR_RUN,                       /* thread is running */


 170 typedef struct scsa1394_state {
 171         kmutex_t                s_mutex;        /* structure mutex */
 172         dev_info_t              *s_dip;         /* device information */
 173         int                     s_instance;     /* instance number */
 174         scsa1394_dev_state_t    s_dev_state;    /* device state */
 175         t1394_handle_t          s_t1394_hdl;    /* 1394 handle */
 176         t1394_attachinfo_t      s_attachinfo;   /* 1394 attach info */
 177         t1394_targetinfo_t      s_targetinfo;   /* 1394 target info */
 178         ddi_callback_id_t       s_reset_cb_id;  /* reset event cb id */
 179         ddi_callback_id_t       s_remove_cb_id; /* remove event cb id */
 180         ddi_callback_id_t       s_insert_cb_id; /* insert event cb id */
 181         boolean_t               s_event_entered; /* event serialization */
 182         kcondvar_t              s_event_cv;     /* event serialization cv */
 183         ddi_dma_attr_t          s_buf_dma_attr; /* data buffer DMA attrs */
 184         ddi_dma_attr_t          s_pt_dma_attr;  /* page table DMA attrs */
 185         scsi_hba_tran_t         *s_tran;        /* SCSA HBA tran structure */
 186         sbp2_tgt_t              *s_tgt;         /* SBP-2 target */
 187         sbp2_cfgrom_t           *s_cfgrom;      /* Config ROM */
 188         int                     s_nluns;        /* # of logical units */
 189         scsa1394_lun_t          *s_lun;         /* logical units */
 190         kmem_cache_t            *s_cmd_cache;   /* command kmem cache */
 191         ddi_taskq_t             *s_taskq;       /* common taskq for all luns */
 192         boolean_t               s_symbios;      /* need Symbios workaround? */
 193         boolean_t               s_disconnect_warned; /* disconnect warning */
 194         size_t                  s_totalsec;     /* total sectors */
 195         size_t                  s_secsz;        /* sector size */
 196         scsa1394_inst_stat_t    s_stat;         /* statistics */
 197 } scsa1394_state_t;
 198 
 199 _NOTE(MUTEX_PROTECTS_DATA(scsa1394_state::s_mutex, scsa1394_state))
 200 _NOTE(SCHEME_PROTECTS_DATA("stable data", scsa1394_state::{
 201     s_dip s_instance s_t1394_hdl s_attachinfo s_reset_cb_id s_remove_cb_id
 202     s_insert_cb_id s_buf_dma_attr s_pt_dma_attr s_tran s_tgt s_cfgrom
 203     s_nluns s_lun s_cmd_cache s_taskq s_symbios s_targetinfo
 204     s_totalsec s_secsz}))
 205 _NOTE(SCHEME_PROTECTS_DATA("statistics", scsa1394_state::s_stat))
 206 
 207 _NOTE(LOCK_ORDER(scsa1394_state::s_mutex scsa1394_lun::l_mutex))
 208 
 209 /* for sbp2_bus_buf.bb_hdl */
 210 typedef struct scsa1394_bus_buf {




   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #ifndef _SYS_1394_TARGETS_SCSA1394_IMPL_H
  27 #define _SYS_1394_TARGETS_SCSA1394_IMPL_H
  28 


  29 /*
  30  * scsa1394 definitions
  31  */
  32 
  33 #include <sys/1394/t1394.h>
  34 #include <sys/sbp2/driver.h>
  35 #include <sys/scsi/scsi.h>
  36 #include <sys/cdio.h>
  37 #include <sys/1394/targets/scsa1394/cmd.h>
  38 
  39 #ifdef  __cplusplus
  40 extern "C" {
  41 #endif
  42 
  43 /*
  44  * each lun uses a worker thread for various deferred processing
  45  */
  46 typedef enum {
  47         SCSA1394_THR_INIT,                      /* initial state */
  48         SCSA1394_THR_RUN,                       /* thread is running */


 168 typedef struct scsa1394_state {
 169         kmutex_t                s_mutex;        /* structure mutex */
 170         dev_info_t              *s_dip;         /* device information */
 171         int                     s_instance;     /* instance number */
 172         scsa1394_dev_state_t    s_dev_state;    /* device state */
 173         t1394_handle_t          s_t1394_hdl;    /* 1394 handle */
 174         t1394_attachinfo_t      s_attachinfo;   /* 1394 attach info */
 175         t1394_targetinfo_t      s_targetinfo;   /* 1394 target info */
 176         ddi_callback_id_t       s_reset_cb_id;  /* reset event cb id */
 177         ddi_callback_id_t       s_remove_cb_id; /* remove event cb id */
 178         ddi_callback_id_t       s_insert_cb_id; /* insert event cb id */
 179         boolean_t               s_event_entered; /* event serialization */
 180         kcondvar_t              s_event_cv;     /* event serialization cv */
 181         ddi_dma_attr_t          s_buf_dma_attr; /* data buffer DMA attrs */
 182         ddi_dma_attr_t          s_pt_dma_attr;  /* page table DMA attrs */
 183         scsi_hba_tran_t         *s_tran;        /* SCSA HBA tran structure */
 184         sbp2_tgt_t              *s_tgt;         /* SBP-2 target */
 185         sbp2_cfgrom_t           *s_cfgrom;      /* Config ROM */
 186         int                     s_nluns;        /* # of logical units */
 187         scsa1394_lun_t          *s_lun;         /* logical units */

 188         ddi_taskq_t             *s_taskq;       /* common taskq for all luns */
 189         boolean_t               s_symbios;      /* need Symbios workaround? */
 190         boolean_t               s_disconnect_warned; /* disconnect warning */
 191         size_t                  s_totalsec;     /* total sectors */
 192         size_t                  s_secsz;        /* sector size */
 193         scsa1394_inst_stat_t    s_stat;         /* statistics */
 194 } scsa1394_state_t;
 195 
 196 _NOTE(MUTEX_PROTECTS_DATA(scsa1394_state::s_mutex, scsa1394_state))
 197 _NOTE(SCHEME_PROTECTS_DATA("stable data", scsa1394_state::{
 198     s_dip s_instance s_t1394_hdl s_attachinfo s_reset_cb_id s_remove_cb_id
 199     s_insert_cb_id s_buf_dma_attr s_pt_dma_attr s_tran s_tgt s_cfgrom
 200     s_nluns s_lun s_cmd_cache s_taskq s_symbios s_targetinfo
 201     s_totalsec s_secsz}))
 202 _NOTE(SCHEME_PROTECTS_DATA("statistics", scsa1394_state::s_stat))
 203 
 204 _NOTE(LOCK_ORDER(scsa1394_state::s_mutex scsa1394_lun::l_mutex))
 205 
 206 /* for sbp2_bus_buf.bb_hdl */
 207 typedef struct scsa1394_bus_buf {