1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate * 22*0Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 23*0Sstevel@tonic-gate * Use is subject to license terms. 24*0Sstevel@tonic-gate */ 25*0Sstevel@tonic-gate 26*0Sstevel@tonic-gate #ifndef _SYS_USB_SCSA2USB_H 27*0Sstevel@tonic-gate #define _SYS_USB_SCSA2USB_H 28*0Sstevel@tonic-gate 29*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate #ifdef __cplusplus 32*0Sstevel@tonic-gate extern "C" { 33*0Sstevel@tonic-gate #endif 34*0Sstevel@tonic-gate 35*0Sstevel@tonic-gate #include <sys/usb/usba/usbai_private.h> 36*0Sstevel@tonic-gate 37*0Sstevel@tonic-gate /* 38*0Sstevel@tonic-gate * SCSA2USB: This header file contains the internal structures 39*0Sstevel@tonic-gate * and variable definitions used in USB mass storage disk driver. 40*0Sstevel@tonic-gate */ 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate 43*0Sstevel@tonic-gate #define SCSA2USB_INITIAL_ALLOC 4 /* initial soft space alloc */ 44*0Sstevel@tonic-gate 45*0Sstevel@tonic-gate #define MAX_COMPAT_NAMES 1 /* max compatible names for children */ 46*0Sstevel@tonic-gate #define SERIAL_NUM_LEN 64 /* for reading string descriptor */ 47*0Sstevel@tonic-gate #define SCSA2USB_SERIAL_LEN 12 /* len of serial no in scsi_inquiry */ 48*0Sstevel@tonic-gate 49*0Sstevel@tonic-gate #define SCSA2USB_MAX_LUNS 0x10 /* maximum luns supported. */ 50*0Sstevel@tonic-gate 51*0Sstevel@tonic-gate /* 52*0Sstevel@tonic-gate * limit the max transfer size to under <= 64K. Some devices 53*0Sstevel@tonic-gate * have problems with large transfers 54*0Sstevel@tonic-gate */ 55*0Sstevel@tonic-gate #define SCSA2USB_MAX_BULK_XFER_SIZE (64 * 1024) 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gate /* Blacklist some vendors whose devices could cause problems */ 58*0Sstevel@tonic-gate #define MS_HAGIWARA_SYS_COM_VID 0x693 /* VendorId of Hagiwara Sys-Com */ 59*0Sstevel@tonic-gate #define MS_HAGIWARA_SYSCOM_PID1 0x1 /* PID for SmartMedia(SM) device */ 60*0Sstevel@tonic-gate #define MS_HAGIWARA_SYSCOM_PID2 0x3 /* PID for CompactFlash(CF) device */ 61*0Sstevel@tonic-gate #define MS_HAGIWARA_SYSCOM_PID3 0x5 /* PID for SM/CF Combo device */ 62*0Sstevel@tonic-gate #define MS_HAGIWARA_SYSCOM_PID4 0x2 /* PID for new SM device */ 63*0Sstevel@tonic-gate #define MS_HAGIWARA_SYSCOM_PID5 0x4 /* PID for new CF device */ 64*0Sstevel@tonic-gate 65*0Sstevel@tonic-gate #define MS_IOMEGA_VID 0x59b /* VendorId of Iomega */ 66*0Sstevel@tonic-gate #define MS_IOMEGA_PID1_ZIP100 0x1 /* PID of an Older Iomega Zip100 */ 67*0Sstevel@tonic-gate #define MS_IOMEGA_PID2_ZIP100 0x2 /* PID of Newer Iomega Zip100 */ 68*0Sstevel@tonic-gate #define MS_IOMEGA_PID3_ZIP100 0x31 /* PID of Newer Iomega Zip100 */ 69*0Sstevel@tonic-gate #define MS_IOMEGA_PID_ZIP250 0x30 /* PID of Newer Iomega Zip250 */ 70*0Sstevel@tonic-gate #define MS_IOMEGA_PID_CLIK 0x60 /* PID of Iomega Clik! drive */ 71*0Sstevel@tonic-gate 72*0Sstevel@tonic-gate #define MS_MITSUMI_VID 0x3ee /* VendorId of Mitsumi Inc */ 73*0Sstevel@tonic-gate #define MS_MITSUMI_DEVICE_242 0x242 /* bcdDevice of Mitsumi CR-4804TU */ 74*0Sstevel@tonic-gate #define MS_MITSUMI_DEVICE_24 0x24 /* bcdDevice of Mitsumi CR-4802TU */ 75*0Sstevel@tonic-gate 76*0Sstevel@tonic-gate #define MS_YEDATA_VID 0x57b /* VendorId of Y-E Data Corp */ 77*0Sstevel@tonic-gate #define MS_SMSC_VID 0x424 /* Vendor Id of SMSC */ 78*0Sstevel@tonic-gate #define MS_SMSC_PID0 0xfdc /* floppy from SMSC */ 79*0Sstevel@tonic-gate 80*0Sstevel@tonic-gate #define MS_NEODIO_VID 0xaec /* Neodio Technologies Corporation */ 81*0Sstevel@tonic-gate #define MS_NEODIO_DEVICE_3050 0x3050 /* PID of ND3050/Soyo BayOne */ 82*0Sstevel@tonic-gate /* SM/CF/MS/SD */ 83*0Sstevel@tonic-gate #define MS_SONY_FLASH_VID 0x54c /* sony flash device */ 84*0Sstevel@tonic-gate #define MS_SONY_FLASH_PID 0x8b 85*0Sstevel@tonic-gate 86*0Sstevel@tonic-gate #define MS_TREK_FLASH_VID 0xa16 /* Trek flash device */ 87*0Sstevel@tonic-gate #define MS_TREK_FLASH_PID 0x9988 88*0Sstevel@tonic-gate 89*0Sstevel@tonic-gate #define MS_PENN_FLASH_VID 0xd7d /* Penn flash device */ 90*0Sstevel@tonic-gate #define MS_PENN_FLASH_PID 0x1320 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate #define MS_SIMPLETECH_VID 0x7c4 /* VendorId of Simpltech */ 93*0Sstevel@tonic-gate #define MS_SIMPLETECH_PID1 0xa400 /* PID for UCF-100 device */ 94*0Sstevel@tonic-gate 95*0Sstevel@tonic-gate #define MS_ADDONICS_CARD_READER_VID 0x7cc /* addonics */ 96*0Sstevel@tonic-gate #define MS_ADDONICS_CARD_READER_PID 0x320 97*0Sstevel@tonic-gate 98*0Sstevel@tonic-gate 99*0Sstevel@tonic-gate /* 100*0Sstevel@tonic-gate * List the attributes that need special case in the driver 101*0Sstevel@tonic-gate * SCSA2USB_ATTRS_GET_LUN: Bulk Only Transport Get_Max_Lun class specific 102*0Sstevel@tonic-gate * command is not implemented by these devices 103*0Sstevel@tonic-gate * SCSA2USB_ATTRS_PM: Some devices don't like being power managed. 104*0Sstevel@tonic-gate * SCSA2USB_ATTRS_START_STOP: Some devices don't do anything with 105*0Sstevel@tonic-gate * SCMD_START_STOP opcode (for e.g. SmartMedia/CompactFlash/ 106*0Sstevel@tonic-gate * Clik!/MemoryStick/MMC USB readers/writers. 107*0Sstevel@tonic-gate * SCSA2USB_ATTRS_GET_CONF: SCMD_GET_CONFIGURATION is not supported 108*0Sstevel@tonic-gate * SCMD_TEST_UNIT_READY: for floppies this needs to be converted to 109*0Sstevel@tonic-gate * SCMD_START_STOP as floppies don't support this 110*0Sstevel@tonic-gate * SCSA2USB_ATTRS_GET_PERF: SCMD_GET_PERFORMANCE not supported by 111*0Sstevel@tonic-gate * Mitsumi's CD-RW devices. 112*0Sstevel@tonic-gate * SCSA2USB_ATTRS_BIG_TIMEOUT: Mitsumi's CD-RW devices need large 113*0Sstevel@tonic-gate * timeout with SCMD_START_STOP cmd 114*0Sstevel@tonic-gate * SCSA2USB_ATTRS_RMB: Pay attention to the device's RMB setting, 115*0Sstevel@tonic-gate * instead of automatically treating it as removable 116*0Sstevel@tonic-gate * 117*0Sstevel@tonic-gate * NOTE: If a device simply STALLs the GET_MAX_LUN BO class-specific command 118*0Sstevel@tonic-gate * and recovers then it will not be added to the scsa2usb_blacklist[] table 119*0Sstevel@tonic-gate * in scsa2usb.c. The other attributes will not be taken of the table unless 120*0Sstevel@tonic-gate * their inclusion causes a recovery and retries (thus seriously affecting 121*0Sstevel@tonic-gate * the driver performance). 122*0Sstevel@tonic-gate */ 123*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_GET_LUN 0x01 /* GET_MAX_LUN (Bulk Only) */ 124*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_PM 0x02 /* Some don't support PM */ 125*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_START_STOP 0x04 /* SCMD_START_STOP */ 126*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_GET_CONF 0x08 /* SCMD_GET_CONFIGURATION */ 127*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_GET_PERF 0x10 /* SCMD_GET_PERFORMANCE */ 128*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_BIG_TIMEOUT 0x40 /* for SCMD_START_STOP */ 129*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_DOORLOCK 0x80 /* for SCMD_DOORLOCK */ 130*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_RMB 0x100 /* Pay attention to RMB */ 131*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_MODE_SENSE 0x200 /* SCMD_MODE_SENSE */ 132*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_INQUIRY 0x400 /* SCMD_INQUIRY */ 133*0Sstevel@tonic-gate #define SCSA2USB_ATTRS_REDUCED_CMD \ 134*0Sstevel@tonic-gate (SCSA2USB_ATTRS_DOORLOCK|SCSA2USB_ATTRS_MODE_SENSE| \ 135*0Sstevel@tonic-gate SCSA2USB_ATTRS_START_STOP|SCSA2USB_ATTRS_INQUIRY) 136*0Sstevel@tonic-gate 137*0Sstevel@tonic-gate #define SCSA2USB_ALL_ATTRS 0xFFFF /* All of the above */ 138*0Sstevel@tonic-gate 139*0Sstevel@tonic-gate /* max inquiry length */ 140*0Sstevel@tonic-gate #define SCSA2USB_MAX_INQ_LEN (offsetof(struct scsi_inquiry, inq_serial)) 141*0Sstevel@tonic-gate 142*0Sstevel@tonic-gate /* 143*0Sstevel@tonic-gate * PM support 144*0Sstevel@tonic-gate */ 145*0Sstevel@tonic-gate typedef struct scsa2usb_power { 146*0Sstevel@tonic-gate /* device busy accounting */ 147*0Sstevel@tonic-gate int scsa2usb_pm_busy; 148*0Sstevel@tonic-gate /* this is the bit mask of the power states that device has */ 149*0Sstevel@tonic-gate uint8_t scsa2usb_pwr_states; 150*0Sstevel@tonic-gate 151*0Sstevel@tonic-gate uint8_t scsa2usb_wakeup_enabled; 152*0Sstevel@tonic-gate 153*0Sstevel@tonic-gate /* current power level the device is in */ 154*0Sstevel@tonic-gate uint8_t scsa2usb_current_power; 155*0Sstevel@tonic-gate } scsa2usb_power_t; 156*0Sstevel@tonic-gate 157*0Sstevel@tonic-gate /* 158*0Sstevel@tonic-gate * CPR support: 159*0Sstevel@tonic-gate * keep track of the last command issued to the drive. If it 160*0Sstevel@tonic-gate * was TUR or EJECT then allow issuing a CPR suspend. 161*0Sstevel@tonic-gate */ 162*0Sstevel@tonic-gate #define LOEJECT 2 /* eject bit in start/stop cmd */ 163*0Sstevel@tonic-gate 164*0Sstevel@tonic-gate typedef struct scsa2usb_last_cmd { 165*0Sstevel@tonic-gate /* this is the cdb of the last command issued */ 166*0Sstevel@tonic-gate uchar_t cdb[SCSI_CDB_SIZE]; 167*0Sstevel@tonic-gate 168*0Sstevel@tonic-gate /* this is the status of the last command issued */ 169*0Sstevel@tonic-gate uint_t status; 170*0Sstevel@tonic-gate } scsa2usb_last_cmd_t; 171*0Sstevel@tonic-gate 172*0Sstevel@tonic-gate /* 173*0Sstevel@tonic-gate * override values 174*0Sstevel@tonic-gate * These values may be set in scsa2usb.conf for particular devices 175*0Sstevel@tonic-gate */ 176*0Sstevel@tonic-gate typedef struct scsa2usb_ov { 177*0Sstevel@tonic-gate int vid; /* vendor id */ 178*0Sstevel@tonic-gate int pid; /* product id */ 179*0Sstevel@tonic-gate int rev; /* revision */ 180*0Sstevel@tonic-gate int subclass; /* subclass override */ 181*0Sstevel@tonic-gate int protocol; /* protocol override */ 182*0Sstevel@tonic-gate int pmoff; /* power management override */ 183*0Sstevel@tonic-gate int not_removable; /* removable device override */ 184*0Sstevel@tonic-gate int no_modesense; /* no mode sense */ 185*0Sstevel@tonic-gate /* no modesense, doorlock, PM, start/stop */ 186*0Sstevel@tonic-gate int reduced_cmd_support; 187*0Sstevel@tonic-gate } scsa2usb_ov_t; 188*0Sstevel@tonic-gate 189*0Sstevel@tonic-gate 190*0Sstevel@tonic-gate /* 191*0Sstevel@tonic-gate * Per bulk device "state" data structure. 192*0Sstevel@tonic-gate */ 193*0Sstevel@tonic-gate typedef struct scsa2usb_state { 194*0Sstevel@tonic-gate int scsa2usb_instance; /* Instance number */ 195*0Sstevel@tonic-gate int scsa2usb_dev_state; /* USB device state */ 196*0Sstevel@tonic-gate int scsa2usb_flags; /* Per instance flags */ 197*0Sstevel@tonic-gate int scsa2usb_intfc_num; /* Interface number */ 198*0Sstevel@tonic-gate dev_info_t *scsa2usb_dip; /* Per device. info */ 199*0Sstevel@tonic-gate scsa2usb_power_t *scsa2usb_pm; /* PM state info */ 200*0Sstevel@tonic-gate 201*0Sstevel@tonic-gate int scsa2usb_transport_busy; /* ugen/sd traffic */ 202*0Sstevel@tonic-gate int scsa2usb_ugen_open_count; 203*0Sstevel@tonic-gate kcondvar_t scsa2usb_transport_busy_cv; 204*0Sstevel@tonic-gate kthread_t *scsa2usb_busy_thread; 205*0Sstevel@tonic-gate 206*0Sstevel@tonic-gate kmutex_t scsa2usb_mutex; /* Per instance lock */ 207*0Sstevel@tonic-gate 208*0Sstevel@tonic-gate struct scsi_hba_tran *scsa2usb_tran; /* SCSI transport ptr */ 209*0Sstevel@tonic-gate struct scsi_pkt *scsa2usb_cur_pkt; /* SCSI packet ptr */ 210*0Sstevel@tonic-gate 211*0Sstevel@tonic-gate usba_list_entry_t scsa2usb_waitQ[SCSA2USB_MAX_LUNS]; 212*0Sstevel@tonic-gate /* waitQ list */ 213*0Sstevel@tonic-gate struct scsa2usb_cmd *scsa2usb_arq_cmd; /* ARQ cmd */ 214*0Sstevel@tonic-gate struct buf *scsa2usb_arq_bp; /* ARQ buf */ 215*0Sstevel@tonic-gate 216*0Sstevel@tonic-gate dev_info_t *scsa2usb_lun_dip[SCSA2USB_MAX_LUNS]; 217*0Sstevel@tonic-gate /* store devinfo per LUN */ 218*0Sstevel@tonic-gate struct scsi_inquiry scsa2usb_lun_inquiry[SCSA2USB_MAX_LUNS]; 219*0Sstevel@tonic-gate /* store inquiry per LUN */ 220*0Sstevel@tonic-gate usb_if_descr_t scsa2usb_intfc_descr; /* Interface descr */ 221*0Sstevel@tonic-gate usb_ep_descr_t scsa2usb_bulkin_ept; /* Bulk In descriptor */ 222*0Sstevel@tonic-gate usb_ep_descr_t scsa2usb_bulkout_ept; /* Bulkout descriptor */ 223*0Sstevel@tonic-gate usb_ep_descr_t scsa2usb_intr_ept; /* Intr ept descr */ 224*0Sstevel@tonic-gate 225*0Sstevel@tonic-gate usb_pipe_handle_t scsa2usb_default_pipe; /* Default pipe Hndle */ 226*0Sstevel@tonic-gate usb_pipe_handle_t scsa2usb_intr_pipe; /* Intr polling Hndle */ 227*0Sstevel@tonic-gate usb_pipe_handle_t scsa2usb_bulkin_pipe; /* Bulk Inpipe Handle */ 228*0Sstevel@tonic-gate usb_pipe_handle_t scsa2usb_bulkout_pipe; /* Bulk Outpipe Hndle */ 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate uint_t scsa2usb_pipe_state; /* resetting state */ 231*0Sstevel@tonic-gate uint_t scsa2usb_tag; /* current tag */ 232*0Sstevel@tonic-gate uint_t scsa2usb_pkt_state; /* packet state */ 233*0Sstevel@tonic-gate uint_t scsa2usb_n_luns; /* number of luns */ 234*0Sstevel@tonic-gate 235*0Sstevel@tonic-gate usb_log_handle_t scsa2usb_log_handle; /* log handle */ 236*0Sstevel@tonic-gate struct scsa2usb_cpr *scsa2usb_panic_info; /* for cpr info */ 237*0Sstevel@tonic-gate 238*0Sstevel@tonic-gate size_t scsa2usb_lbasize[SCSA2USB_MAX_LUNS]; 239*0Sstevel@tonic-gate /* sector size */ 240*0Sstevel@tonic-gate size_t scsa2usb_totalsec[SCSA2USB_MAX_LUNS]; 241*0Sstevel@tonic-gate /* total sectors */ 242*0Sstevel@tonic-gate size_t scsa2usb_secsz[SCSA2USB_MAX_LUNS]; 243*0Sstevel@tonic-gate /* sector size */ 244*0Sstevel@tonic-gate size_t scsa2usb_max_bulk_xfer_size; /* from HCD */ 245*0Sstevel@tonic-gate 246*0Sstevel@tonic-gate usb_client_dev_data_t *scsa2usb_dev_data; /* USB registration */ 247*0Sstevel@tonic-gate scsa2usb_last_cmd_t scsa2usb_last_cmd; /* last/prev command */ 248*0Sstevel@tonic-gate 249*0Sstevel@tonic-gate uint_t scsa2usb_attrs; /* for bad devices */ 250*0Sstevel@tonic-gate uint_t scsa2usb_cmd_protocol; /* CMD protocol used */ 251*0Sstevel@tonic-gate kthread_t *scsa2usb_work_thread_id; /* handle commands */ 252*0Sstevel@tonic-gate 253*0Sstevel@tonic-gate /* conf file override values */ 254*0Sstevel@tonic-gate uint_t scsa2usb_subclass_override; 255*0Sstevel@tonic-gate uint_t scsa2usb_protocol_override; 256*0Sstevel@tonic-gate char *scsa2usb_override_str; 257*0Sstevel@tonic-gate 258*0Sstevel@tonic-gate /* suppress repetitive disconnect warnings */ 259*0Sstevel@tonic-gate boolean_t scsa2usb_warning_given; 260*0Sstevel@tonic-gate 261*0Sstevel@tonic-gate boolean_t scsa2usb_rcvd_not_ready; /* received NOT */ 262*0Sstevel@tonic-gate /* READY sense data */ 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gate usb_ugen_hdl_t scsa2usb_ugen_hdl; /* ugen support */ 265*0Sstevel@tonic-gate } scsa2usb_state_t; 266*0Sstevel@tonic-gate 267*0Sstevel@tonic-gate 268*0Sstevel@tonic-gate /* for warlock */ 269*0Sstevel@tonic-gate _NOTE(MUTEX_PROTECTS_DATA(scsa2usb_state::scsa2usb_mutex, scsa2usb_state)) 270*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_instance)) 271*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_dip)) 272*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_arq_cmd)) 273*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_arq_bp)) 274*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_bulkin_ept)) 275*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_bulkout_ept)) 276*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_intr_ept)) 277*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_default_pipe)) 278*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_intr_pipe)) 279*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_bulkin_pipe)) 280*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_bulkout_pipe)) 281*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_log_handle)) 282*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_intfc_num)) 283*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_dev_data)) 284*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_state::scsa2usb_ugen_hdl)) 285*0Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", scsa2usb_power_t)) 286*0Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", scsi_hba_tran_t)) 287*0Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unshared data", usb_bulk_req_t)) 288*0Sstevel@tonic-gate 289*0Sstevel@tonic-gate /* scsa2usb_pipe_state values */ 290*0Sstevel@tonic-gate #define SCSA2USB_PIPE_NORMAL 0x00 /* no reset or clearing */ 291*0Sstevel@tonic-gate #define SCSA2USB_PIPE_CLOSING 0x01 /* closing all pipes */ 292*0Sstevel@tonic-gate #define SCSA2USB_PIPE_DEV_RESET 0x02 /* device specific reset */ 293*0Sstevel@tonic-gate 294*0Sstevel@tonic-gate /* pkt xfer state machine */ 295*0Sstevel@tonic-gate #define SCSA2USB_PKT_NONE 0 /* device is idle */ 296*0Sstevel@tonic-gate #define SCSA2USB_PKT_PROCESS_CSW 1 /* device doing status again */ 297*0Sstevel@tonic-gate #define SCSA2USB_PKT_DO_COMP 2 /* device is done xfer */ 298*0Sstevel@tonic-gate 299*0Sstevel@tonic-gate /* scsa2usb_flags values */ 300*0Sstevel@tonic-gate #define SCSA2USB_FLAGS_PIPES_OPENED 0x001 /* usb pipes are open */ 301*0Sstevel@tonic-gate #define SCSA2USB_FLAGS_HBA_ATTACH_SETUP 0x002 /* scsi hba setup done */ 302*0Sstevel@tonic-gate #define SCSA2USB_FLAGS_LOCKS_INIT 0x004 /* basic inits done */ 303*0Sstevel@tonic-gate 304*0Sstevel@tonic-gate /* scsa2usb_cmd_protocol values */ 305*0Sstevel@tonic-gate #define SCSA2USB_UNKNOWN_PROTOCOL 0x0000 /* unknown wire protocol */ 306*0Sstevel@tonic-gate #define SCSA2USB_CB_PROTOCOL 0x0001 /* CBI wire protocol */ 307*0Sstevel@tonic-gate #define SCSA2USB_CBI_PROTOCOL 0x0002 /* CBI w/ intr wire protocol */ 308*0Sstevel@tonic-gate #define SCSA2USB_BULK_ONLY_PROTOCOL 0x0004 /* Bulk Only wire protocol */ 309*0Sstevel@tonic-gate 310*0Sstevel@tonic-gate #define SCSA2USB_SCSI_CMDSET 0x1000 /* SCSI command set followed */ 311*0Sstevel@tonic-gate #define SCSA2USB_ATAPI_CMDSET 0x2000 /* ATAPI command set followed */ 312*0Sstevel@tonic-gate #define SCSA2USB_UFI_CMDSET 0x4000 /* UFI command set followed */ 313*0Sstevel@tonic-gate #define SCSA2USB_CMDSET_MASK 0x7000 /* OR al the above */ 314*0Sstevel@tonic-gate 315*0Sstevel@tonic-gate #define SCSA2USB_IS_UFI_CMDSET(s) \ 316*0Sstevel@tonic-gate (((s)->scsa2usb_cmd_protocol & SCSA2USB_UFI_CMDSET)) 317*0Sstevel@tonic-gate #define SCSA2USB_IS_SCSI_CMDSET(s) \ 318*0Sstevel@tonic-gate (((s)->scsa2usb_cmd_protocol & SCSA2USB_SCSI_CMDSET)) 319*0Sstevel@tonic-gate #define SCSA2USB_IS_ATAPI_CMDSET(s) \ 320*0Sstevel@tonic-gate (((s)->scsa2usb_cmd_protocol & SCSA2USB_ATAPI_CMDSET)) 321*0Sstevel@tonic-gate 322*0Sstevel@tonic-gate #define SCSA2USB_IS_CB(s) \ 323*0Sstevel@tonic-gate (((s)->scsa2usb_cmd_protocol & SCSA2USB_CB_PROTOCOL)) 324*0Sstevel@tonic-gate 325*0Sstevel@tonic-gate #define SCSA2USB_IS_CBI(s) \ 326*0Sstevel@tonic-gate (((s)->scsa2usb_cmd_protocol & SCSA2USB_CBI_PROTOCOL)) 327*0Sstevel@tonic-gate 328*0Sstevel@tonic-gate #define SCSA2USB_IS_BULK_ONLY(s) \ 329*0Sstevel@tonic-gate (((s)->scsa2usb_cmd_protocol & SCSA2USB_BULK_ONLY_PROTOCOL)) 330*0Sstevel@tonic-gate 331*0Sstevel@tonic-gate /* check if it is ok to access the device and send command to it */ 332*0Sstevel@tonic-gate #define SCSA2USB_DEVICE_ACCESS_OK(s) \ 333*0Sstevel@tonic-gate ((s)->scsa2usb_dev_state == USB_DEV_ONLINE) 334*0Sstevel@tonic-gate 335*0Sstevel@tonic-gate /* check if we are in any reset */ 336*0Sstevel@tonic-gate #define SCSA2USB_IN_RESET(s) \ 337*0Sstevel@tonic-gate (((s)->scsa2usb_pipe_state & SCSA2USB_PIPE_DEV_RESET) != 0) 338*0Sstevel@tonic-gate 339*0Sstevel@tonic-gate /* check if the device is busy */ 340*0Sstevel@tonic-gate #define SCSA2USB_BUSY(s) \ 341*0Sstevel@tonic-gate (((s)->scsa2usb_cur_pkt) || \ 342*0Sstevel@tonic-gate ((s)->scsa2usb_pipe_state != SCSA2USB_PIPE_NORMAL) || \ 343*0Sstevel@tonic-gate ((s)->scsa2usb_pkt_state != SCSA2USB_PKT_NONE)) 344*0Sstevel@tonic-gate 345*0Sstevel@tonic-gate /* check if we're doing cpr */ 346*0Sstevel@tonic-gate #define SCSA2USB_CHK_CPR(s) \ 347*0Sstevel@tonic-gate (((s)->scsa2usb_dev_state == USB_DEV_SUSPENDED)) 348*0Sstevel@tonic-gate 349*0Sstevel@tonic-gate /* check if we're either paniced or in cpr state */ 350*0Sstevel@tonic-gate #define SCSA2USB_CHK_PANIC_CPR(s) \ 351*0Sstevel@tonic-gate (ddi_in_panic() || SCSA2USB_CHK_CPR(s)) 352*0Sstevel@tonic-gate 353*0Sstevel@tonic-gate /* reset scsa2usb state after pkt_comp is called */ 354*0Sstevel@tonic-gate #define SCSA2USB_RESET_CUR_PKT(s) \ 355*0Sstevel@tonic-gate (s)->scsa2usb_cur_pkt = NULL; \ 356*0Sstevel@tonic-gate (s)->scsa2usb_pkt_state = SCSA2USB_PKT_NONE; 357*0Sstevel@tonic-gate 358*0Sstevel@tonic-gate /* print a panic sync message to the console */ 359*0Sstevel@tonic-gate #define SCSA2USB_PRINT_SYNC_MSG(m, s) \ 360*0Sstevel@tonic-gate if ((m) == B_TRUE) { \ 361*0Sstevel@tonic-gate USB_DPRINTF_L0(DPRINT_MASK_SCSA, (s)->scsa2usb_log_handle, \ 362*0Sstevel@tonic-gate "syncing not supported"); \ 363*0Sstevel@tonic-gate (m) = B_FALSE; \ 364*0Sstevel@tonic-gate } 365*0Sstevel@tonic-gate 366*0Sstevel@tonic-gate /* Cancel callbacks registered during attach time */ 367*0Sstevel@tonic-gate #define SCSA2USB_CANCEL_CB(id) \ 368*0Sstevel@tonic-gate if ((id)) { \ 369*0Sstevel@tonic-gate (void) callb_delete((id)); \ 370*0Sstevel@tonic-gate (id) = 0; \ 371*0Sstevel@tonic-gate } 372*0Sstevel@tonic-gate 373*0Sstevel@tonic-gate /* Set SCSA2USB_PKT_DO_COMP state if there is active I/O */ 374*0Sstevel@tonic-gate #define SCSA2USB_SET_PKT_DO_COMP_STATE(s) \ 375*0Sstevel@tonic-gate if ((s)->scsa2usb_cur_pkt) { \ 376*0Sstevel@tonic-gate (s)->scsa2usb_pkt_state = SCSA2USB_PKT_DO_COMP; \ 377*0Sstevel@tonic-gate } 378*0Sstevel@tonic-gate 379*0Sstevel@tonic-gate #define SCSA2USB_FREE_MSG(data) \ 380*0Sstevel@tonic-gate if ((data)) { \ 381*0Sstevel@tonic-gate freemsg((data)); \ 382*0Sstevel@tonic-gate } 383*0Sstevel@tonic-gate 384*0Sstevel@tonic-gate #define SCSA2USB_FREE_BULK_REQ(req) \ 385*0Sstevel@tonic-gate if ((req)) { \ 386*0Sstevel@tonic-gate usb_free_bulk_req((req)); /* Free request */ \ 387*0Sstevel@tonic-gate } 388*0Sstevel@tonic-gate 389*0Sstevel@tonic-gate 390*0Sstevel@tonic-gate /* SCSA related */ 391*0Sstevel@tonic-gate #define ADDR2TRAN(ap) ((ap)->a_hba_tran) 392*0Sstevel@tonic-gate #define TRAN2SCSA2USB(tran) ((scsa2usb_state_t *)(tran)->tran_hba_private) 393*0Sstevel@tonic-gate #define ADDR2SCSA2USB(ap) (TRAN2SCSA2USB(ADDR2TRAN(ap))) 394*0Sstevel@tonic-gate 395*0Sstevel@tonic-gate #define PKT_PRIV_LEN 16 396*0Sstevel@tonic-gate 397*0Sstevel@tonic-gate /* 398*0Sstevel@tonic-gate * auto request sense 399*0Sstevel@tonic-gate */ 400*0Sstevel@tonic-gate #define RQ_MAKECOM_COMMON(pktp, flag, cmd) \ 401*0Sstevel@tonic-gate (pktp)->pkt_flags = (flag), \ 402*0Sstevel@tonic-gate ((union scsi_cdb *)(pktp)->pkt_cdbp)->scc_cmd = (cmd), \ 403*0Sstevel@tonic-gate ((union scsi_cdb *)(pktp)->pkt_cdbp)->scc_lun = \ 404*0Sstevel@tonic-gate (pktp)->pkt_address.a_lun 405*0Sstevel@tonic-gate 406*0Sstevel@tonic-gate #define RQ_MAKECOM_G0(pktp, flag, cmd, addr, cnt) \ 407*0Sstevel@tonic-gate RQ_MAKECOM_COMMON((pktp), (flag), (cmd)), \ 408*0Sstevel@tonic-gate FORMG0ADDR(((union scsi_cdb *)(pktp)->pkt_cdbp), (addr)), \ 409*0Sstevel@tonic-gate FORMG0COUNT(((union scsi_cdb *)(pktp)->pkt_cdbp), (cnt)) 410*0Sstevel@tonic-gate 411*0Sstevel@tonic-gate 412*0Sstevel@tonic-gate /* transport related */ 413*0Sstevel@tonic-gate #define SCSA2USB_JUST_ACCEPT 0 414*0Sstevel@tonic-gate #define SCSA2USB_TRANSPORT 1 415*0Sstevel@tonic-gate #define SCSA2USB_REJECT -1 416*0Sstevel@tonic-gate 417*0Sstevel@tonic-gate 418*0Sstevel@tonic-gate /* 419*0Sstevel@tonic-gate * these cmds are not passed on but just accepted 420*0Sstevel@tonic-gate */ 421*0Sstevel@tonic-gate #define SCMD_PERSISTENT_RESERVE_IN 0x5E 422*0Sstevel@tonic-gate #define SCMD_PERSISTENT_RESERVE_OUT 0x5F 423*0Sstevel@tonic-gate 424*0Sstevel@tonic-gate /* 425*0Sstevel@tonic-gate * The scsa2usb_cpr_info data structure is used for cpr related 426*0Sstevel@tonic-gate * callbacks. It is used for panic callbacks as well. 427*0Sstevel@tonic-gate */ 428*0Sstevel@tonic-gate typedef struct scsa2usb_cpr { 429*0Sstevel@tonic-gate callb_cpr_t cpr; /* for cpr related info */ 430*0Sstevel@tonic-gate struct scsa2usb_state *statep; /* for scsa2usb state info */ 431*0Sstevel@tonic-gate kmutex_t lockp; /* mutex used by cpr_info_t */ 432*0Sstevel@tonic-gate } scsa2usb_cpr_t; 433*0Sstevel@tonic-gate 434*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_cpr_t::cpr)) 435*0Sstevel@tonic-gate _NOTE(DATA_READABLE_WITHOUT_LOCK(scsa2usb_cpr_t::statep)) 436*0Sstevel@tonic-gate 437*0Sstevel@tonic-gate /* 438*0Sstevel@tonic-gate * The scsa2usb_cmd data structure is defined here. It gets 439*0Sstevel@tonic-gate * initialized per command that is sent to the device. 440*0Sstevel@tonic-gate */ 441*0Sstevel@tonic-gate typedef struct scsa2usb_cmd { 442*0Sstevel@tonic-gate struct scsi_pkt *cmd_pkt; /* copy of pkt ptr */ 443*0Sstevel@tonic-gate struct buf *cmd_bp; /* copy of bp ptr */ 444*0Sstevel@tonic-gate size_t cmd_xfercount; /* current xfer count */ 445*0Sstevel@tonic-gate size_t cmd_resid_xfercount; /* last xfer resid */ 446*0Sstevel@tonic-gate int cmd_scblen; /* status length */ 447*0Sstevel@tonic-gate int cmd_tag; /* tag */ 448*0Sstevel@tonic-gate int cmd_timeout; /* copy of pkt_time */ 449*0Sstevel@tonic-gate uchar_t cmd_cdb[SCSI_CDB_SIZE]; /* CDB */ 450*0Sstevel@tonic-gate uchar_t cmd_dir; /* direction */ 451*0Sstevel@tonic-gate uchar_t cmd_actual_len; /* cdb len */ 452*0Sstevel@tonic-gate uchar_t cmd_cdblen; /* requested cdb len */ 453*0Sstevel@tonic-gate struct scsi_arq_status cmd_scb; /* status, w/ arq */ 454*0Sstevel@tonic-gate 455*0Sstevel@tonic-gate /* used in multiple xfers */ 456*0Sstevel@tonic-gate size_t cmd_total_xfercount; /* total xfer val */ 457*0Sstevel@tonic-gate size_t cmd_offset; /* offset into buf */ 458*0Sstevel@tonic-gate int cmd_lba; /* current xfer lba */ 459*0Sstevel@tonic-gate int cmd_done; /* command done? */ 460*0Sstevel@tonic-gate int cmd_blksize; /* block size */ 461*0Sstevel@tonic-gate usba_list_entry_t cmd_waitQ; /* waitQ element */ 462*0Sstevel@tonic-gate } scsa2usb_cmd_t; 463*0Sstevel@tonic-gate 464*0Sstevel@tonic-gate /* for warlock */ 465*0Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("unique per packet or safe sharing", 466*0Sstevel@tonic-gate scsi_cdb scsi_status scsi_pkt buf scsa2usb_cmd scsi_arq_status)) 467*0Sstevel@tonic-gate _NOTE(SCHEME_PROTECTS_DATA("stable data", scsi_device scsi_address)) 468*0Sstevel@tonic-gate 469*0Sstevel@tonic-gate /* scsa2usb_cdb position of fields in CDB */ 470*0Sstevel@tonic-gate #define SCSA2USB_OPCODE 0 /* Opcode field */ 471*0Sstevel@tonic-gate #define SCSA2USB_LUN 1 /* LUN field */ 472*0Sstevel@tonic-gate #define SCSA2USB_LBA_0 2 /* LBA[0] field */ 473*0Sstevel@tonic-gate #define SCSA2USB_LBA_1 3 /* LBA[1] field */ 474*0Sstevel@tonic-gate #define SCSA2USB_LBA_2 4 /* LBA[2] field */ 475*0Sstevel@tonic-gate #define SCSA2USB_LBA_3 5 /* LBA[3] field */ 476*0Sstevel@tonic-gate #define SCSA2USB_LEN_0 7 /* LEN[0] field */ 477*0Sstevel@tonic-gate #define SCSA2USB_LEN_1 8 /* LEN[1] field */ 478*0Sstevel@tonic-gate 479*0Sstevel@tonic-gate /* macros to calculate LBA for 6/10/12-byte commands */ 480*0Sstevel@tonic-gate #define SCSA2USB_LBA_6BYTE(pkt) \ 481*0Sstevel@tonic-gate (((pkt)->pkt_cdbp[1] & 0x1f) << 16) + \ 482*0Sstevel@tonic-gate ((pkt)->pkt_cdbp[2] << 8) + (pkt)->pkt_cdbp[3] 483*0Sstevel@tonic-gate #define SCSA2USB_LEN_6BYTE(pkt) (pkt)->pkt_cdbp[4] 484*0Sstevel@tonic-gate 485*0Sstevel@tonic-gate #define SCSA2USB_LEN_10BYTE(pkt) \ 486*0Sstevel@tonic-gate ((pkt)->pkt_cdbp[7] << 8) + (pkt)->pkt_cdbp[8] 487*0Sstevel@tonic-gate #define SCSA2USB_LBA_10BYTE(pkt) \ 488*0Sstevel@tonic-gate ((pkt)->pkt_cdbp[2] << 24) + ((pkt)->pkt_cdbp[3] << 16) + \ 489*0Sstevel@tonic-gate ((pkt)->pkt_cdbp[4] << 8) + (pkt)->pkt_cdbp[5] 490*0Sstevel@tonic-gate 491*0Sstevel@tonic-gate #define SCSA2USB_LEN_12BYTE(pkt) \ 492*0Sstevel@tonic-gate ((pkt)->pkt_cdbp[6] << 24) + ((pkt)->pkt_cdbp[7] << 16) + \ 493*0Sstevel@tonic-gate ((pkt)->pkt_cdbp[8] << 8) + (pkt)->pkt_cdbp[9] 494*0Sstevel@tonic-gate #define SCSA2USB_LBA_12BYTE(pkt) \ 495*0Sstevel@tonic-gate ((pkt)->pkt_cdbp[2] << 24) + ((pkt)->pkt_cdbp[3] << 16) + \ 496*0Sstevel@tonic-gate ((pkt)->pkt_cdbp[4] << 8) + (pkt)->pkt_cdbp[5] 497*0Sstevel@tonic-gate 498*0Sstevel@tonic-gate /* macros to convert a pkt to cmd and vice-versa */ 499*0Sstevel@tonic-gate #define PKT2CMD(pkt) ((scsa2usb_cmd_t *)(pkt)->pkt_ha_private) 500*0Sstevel@tonic-gate #define CMD2PKT(sp) ((sp)->cmd_pkt 501*0Sstevel@tonic-gate 502*0Sstevel@tonic-gate /* bulk pipe default timeout value - how long the command to be tried? */ 503*0Sstevel@tonic-gate #define SCSA2USB_BULK_PIPE_TIMEOUT (2 * USB_PIPE_TIMEOUT) 504*0Sstevel@tonic-gate 505*0Sstevel@tonic-gate /* drain timeout in seconds on the work thread */ 506*0Sstevel@tonic-gate #define SCSA2USB_DRAIN_TIMEOUT 60 507*0Sstevel@tonic-gate 508*0Sstevel@tonic-gate /* 509*0Sstevel@tonic-gate * limit on the number of requests that can be queued per LUN: 510*0Sstevel@tonic-gate * 3 for untagged queueing, 1 for scsiwatch and a margin of 2 511*0Sstevel@tonic-gate */ 512*0Sstevel@tonic-gate #define SCSA2USB_MAX_REQ_PER_LUN 6 513*0Sstevel@tonic-gate 514*0Sstevel@tonic-gate /* 515*0Sstevel@tonic-gate * The following data structure is used to save the values returned 516*0Sstevel@tonic-gate * by the READ_CAPACITY command. lba is the max allowed logical block 517*0Sstevel@tonic-gate * address and blen is max allowed block size. 518*0Sstevel@tonic-gate */ 519*0Sstevel@tonic-gate typedef struct scsa2usb_read_cap { 520*0Sstevel@tonic-gate uchar_t scsa2usb_read_cap_lba3; /* Max lba supported */ 521*0Sstevel@tonic-gate uchar_t scsa2usb_read_cap_lba2; 522*0Sstevel@tonic-gate uchar_t scsa2usb_read_cap_lba1; 523*0Sstevel@tonic-gate uchar_t scsa2usb_read_cap_lba0; 524*0Sstevel@tonic-gate uchar_t scsa2usb_read_cap_blen3; /* Max block size supported */ 525*0Sstevel@tonic-gate uchar_t scsa2usb_read_cap_blen2; 526*0Sstevel@tonic-gate uchar_t scsa2usb_read_cap_blen1; 527*0Sstevel@tonic-gate uchar_t scsa2usb_read_cap_blen0; 528*0Sstevel@tonic-gate } scsa2usb_read_cap_t; 529*0Sstevel@tonic-gate 530*0Sstevel@tonic-gate #define SCSA2USB_MK_32BIT(a, b, c, d) \ 531*0Sstevel@tonic-gate (((a) << 24) | ((b) << 16) | ((c) << 8) | (d)) 532*0Sstevel@tonic-gate 533*0Sstevel@tonic-gate /* position of fields for SCMD_READ_CD CDB */ 534*0Sstevel@tonic-gate #define SCSA2USB_READ_CD_LEN_0 6 /* LEN[0] of SCMD_READ_CD */ 535*0Sstevel@tonic-gate #define SCSA2USB_READ_CD_LEN_1 7 /* LEN[1] of SCMD_READ_CD */ 536*0Sstevel@tonic-gate #define SCSA2USB_READ_CD_LEN_2 8 /* LEN[2] of SCMD_READ_CD */ 537*0Sstevel@tonic-gate 538*0Sstevel@tonic-gate /* macro to calculate LEN for SCMD_READ_CD command */ 539*0Sstevel@tonic-gate #define SCSA2USB_LEN_READ_CD(pkt) \ 540*0Sstevel@tonic-gate (((pkt)->pkt_cdbp[SCSA2USB_READ_CD_LEN_0] << 16) +\ 541*0Sstevel@tonic-gate ((pkt)->pkt_cdbp[SCSA2USB_READ_CD_LEN_1] << 8) +\ 542*0Sstevel@tonic-gate (pkt)->pkt_cdbp[SCSA2USB_READ_CD_LEN_2]) 543*0Sstevel@tonic-gate 544*0Sstevel@tonic-gate /* Figure out Block Size before issuing a WRITE to CD-RW device */ 545*0Sstevel@tonic-gate #define SCSA2USB_CDRW_BLKSZ(bcount, len) ((bcount) / (len)); 546*0Sstevel@tonic-gate #define SCSA2USB_VALID_CDRW_BLKSZ(blksz) \ 547*0Sstevel@tonic-gate (((blksz) == CDROM_BLK_2048) || ((blksz) == CDROM_BLK_2352) || \ 548*0Sstevel@tonic-gate ((blksz) == CDROM_BLK_2336) || ((blksz) == CDROM_BLK_2324) || \ 549*0Sstevel@tonic-gate ((blksz) == 0)) 550*0Sstevel@tonic-gate 551*0Sstevel@tonic-gate /* debug and error msg logging */ 552*0Sstevel@tonic-gate #define DPRINT_MASK_SCSA 0x0001 /* for SCSA */ 553*0Sstevel@tonic-gate #define DPRINT_MASK_ATTA 0x0002 /* for ATTA */ 554*0Sstevel@tonic-gate #define DPRINT_MASK_EVENTS 0x0004 /* for event handling */ 555*0Sstevel@tonic-gate #define DPRINT_MASK_CALLBACKS 0x0008 /* for callbacks */ 556*0Sstevel@tonic-gate #define DPRINT_MASK_TIMEOUT 0x0010 /* for timeouts */ 557*0Sstevel@tonic-gate #define DPRINT_MASK_DUMPING 0x0020 /* for dumping */ 558*0Sstevel@tonic-gate #define DPRINT_MASK_PM 0x0040 /* for pwr mgmt */ 559*0Sstevel@tonic-gate #define DPRINT_MASK_ALL 0xffffffff /* for everything */ 560*0Sstevel@tonic-gate 561*0Sstevel@tonic-gate #ifdef DEBUG 562*0Sstevel@tonic-gate #define SCSA2USB_PRINT_CDB scsa2usb_print_cdb 563*0Sstevel@tonic-gate #else 564*0Sstevel@tonic-gate #define SCSA2USB_PRINT_CDB 0 && 565*0Sstevel@tonic-gate #endif 566*0Sstevel@tonic-gate 567*0Sstevel@tonic-gate /* ugen support */ 568*0Sstevel@tonic-gate #define SCSA2USB_MINOR_UGEN_BITS_MASK 0xff 569*0Sstevel@tonic-gate #define SCSA2USB_MINOR_INSTANCE_MASK ~SCSA2USB_MINOR_UGEN_BITS_MASK 570*0Sstevel@tonic-gate #define SCSA2USB_MINOR_INSTANCE_SHIFT 8 571*0Sstevel@tonic-gate 572*0Sstevel@tonic-gate #define SCSA2USB_MINOR_TO_INSTANCE(minor) \ 573*0Sstevel@tonic-gate (((minor) & SCSA2USB_MINOR_INSTANCE_MASK) >> \ 574*0Sstevel@tonic-gate SCSA2USB_MINOR_INSTANCE_SHIFT) 575*0Sstevel@tonic-gate 576*0Sstevel@tonic-gate #ifdef __cplusplus 577*0Sstevel@tonic-gate } 578*0Sstevel@tonic-gate #endif 579*0Sstevel@tonic-gate 580*0Sstevel@tonic-gate #endif /* _SYS_USB_SCSA2USB_H */ 581