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 /* 23*0Sstevel@tonic-gate * Copyright (c) 1996-1998 by Sun Microsystems, Inc. 24*0Sstevel@tonic-gate * All rights reserved. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_SCSI_IMPL_MODE_H 28*0Sstevel@tonic-gate #define _SYS_SCSI_IMPL_MODE_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifdef __cplusplus 33*0Sstevel@tonic-gate extern "C" { 34*0Sstevel@tonic-gate #endif 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate /* 37*0Sstevel@tonic-gate * Defines and Structures for SCSI Mode Sense/Select data 38*0Sstevel@tonic-gate * 39*0Sstevel@tonic-gate * Implementation Specific variations 40*0Sstevel@tonic-gate */ 41*0Sstevel@tonic-gate 42*0Sstevel@tonic-gate /* 43*0Sstevel@tonic-gate * Variations to Sequential Access device mode header 44*0Sstevel@tonic-gate */ 45*0Sstevel@tonic-gate struct modeheader_seq { 46*0Sstevel@tonic-gate uchar_t datalen; /* sense data length */ 47*0Sstevel@tonic-gate uchar_t mediumtype; /* medium type */ 48*0Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 49*0Sstevel@tonic-gate uchar_t speed :4, /* speed */ 50*0Sstevel@tonic-gate bufm :3, /* buffered mode */ 51*0Sstevel@tonic-gate wp :1; /* write protected */ 52*0Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 53*0Sstevel@tonic-gate uchar_t wp :1, /* write protected */ 54*0Sstevel@tonic-gate bufm :3, /* buffered mode */ 55*0Sstevel@tonic-gate speed :4; /* speed */ 56*0Sstevel@tonic-gate #else 57*0Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 58*0Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 59*0Sstevel@tonic-gate uchar_t bd_len; /* block length in bytes */ 60*0Sstevel@tonic-gate struct block_descriptor blk_desc; 61*0Sstevel@tonic-gate }; 62*0Sstevel@tonic-gate 63*0Sstevel@tonic-gate /* 64*0Sstevel@tonic-gate * Variations to Direct Access device pages 65*0Sstevel@tonic-gate */ 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate /* 68*0Sstevel@tonic-gate * Page 1: CCS error recovery page was a little different than SCSI-2/3 69*0Sstevel@tonic-gate */ 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate #define PAGELENGTH_DAD_MODE_ERR_RECOV_CCS 0x06 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate struct mode_err_recov_ccs { 74*0Sstevel@tonic-gate struct mode_page mode_page; /* common mode page header */ 75*0Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 76*0Sstevel@tonic-gate uchar_t dcr : 1, /* disable correction */ 77*0Sstevel@tonic-gate dte : 1, /* disable transfer on error */ 78*0Sstevel@tonic-gate per : 1, /* post error */ 79*0Sstevel@tonic-gate eec : 1, /* enable early correction */ 80*0Sstevel@tonic-gate rc : 1, /* read continuous */ 81*0Sstevel@tonic-gate tb : 1, /* transfer block */ 82*0Sstevel@tonic-gate arre : 1, /* auto read realloc enabled */ 83*0Sstevel@tonic-gate awre : 1; /* auto write realloc enabled */ 84*0Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 85*0Sstevel@tonic-gate uchar_t awre : 1, /* auto write realloc enabled */ 86*0Sstevel@tonic-gate arre : 1, /* auto read realloc enabled */ 87*0Sstevel@tonic-gate tb : 1, /* transfer block */ 88*0Sstevel@tonic-gate rc : 1, /* read continuous */ 89*0Sstevel@tonic-gate eec : 1, /* enable early correction */ 90*0Sstevel@tonic-gate per : 1, /* post error */ 91*0Sstevel@tonic-gate dte : 1, /* disable transfer on error */ 92*0Sstevel@tonic-gate dcr : 1; /* disable correction */ 93*0Sstevel@tonic-gate #else 94*0Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 95*0Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 96*0Sstevel@tonic-gate uchar_t retry_count; 97*0Sstevel@tonic-gate uchar_t correction_span; 98*0Sstevel@tonic-gate uchar_t head_offset_count; 99*0Sstevel@tonic-gate uchar_t strobe_offset_count; 100*0Sstevel@tonic-gate uchar_t recovery_time_limit; 101*0Sstevel@tonic-gate }; 102*0Sstevel@tonic-gate 103*0Sstevel@tonic-gate /* 104*0Sstevel@tonic-gate * Page 3: CCS Direct Access Device Format Parameters 105*0Sstevel@tonic-gate * 106*0Sstevel@tonic-gate * The 0x8 bit in the Drive Type byte is used in CCS 107*0Sstevel@tonic-gate * as an INHIBIT SAVE bit. This bit is not in SCSI-2/3. 108*0Sstevel@tonic-gate */ 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate #define _reserved_ins ins 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate /* 113*0Sstevel@tonic-gate * Page 8: SCSI-2 Cache page was a little different than SCSI-3 114*0Sstevel@tonic-gate */ 115*0Sstevel@tonic-gate 116*0Sstevel@tonic-gate #define PAGELENGTH_DAD_MODE_CACHE 0x0A 117*0Sstevel@tonic-gate 118*0Sstevel@tonic-gate struct mode_cache { 119*0Sstevel@tonic-gate struct mode_page mode_page; /* common mode page header */ 120*0Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 121*0Sstevel@tonic-gate uchar_t rcd : 1, /* Read Cache Disable */ 122*0Sstevel@tonic-gate mf : 1, /* Multiplication Factor */ 123*0Sstevel@tonic-gate wce : 1, /* Write Cache Enable */ 124*0Sstevel@tonic-gate : 5; 125*0Sstevel@tonic-gate uchar_t write_reten_pri : 4, /* Write Retention Priority */ 126*0Sstevel@tonic-gate read_reten_pri : 4; /* Demand Read Retention Priority */ 127*0Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 128*0Sstevel@tonic-gate uchar_t : 5, 129*0Sstevel@tonic-gate wce : 1, /* Write Cache Enable */ 130*0Sstevel@tonic-gate mf : 1, /* Multiplication Factor */ 131*0Sstevel@tonic-gate rcd : 1; /* Read Cache Disable */ 132*0Sstevel@tonic-gate uchar_t read_reten_pri : 4, /* Demand Read Retention Priority */ 133*0Sstevel@tonic-gate write_reten_pri : 4; /* Write Retention Priority */ 134*0Sstevel@tonic-gate #else 135*0Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 136*0Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 137*0Sstevel@tonic-gate ushort_t dis_prefetch_len; /* Disable prefetch xfer length */ 138*0Sstevel@tonic-gate ushort_t min_prefetch; /* minimum prefetch length */ 139*0Sstevel@tonic-gate ushort_t max_prefetch; /* maximum prefetch length */ 140*0Sstevel@tonic-gate ushort_t prefetch_ceiling; /* max prefetch ceiling */ 141*0Sstevel@tonic-gate }; 142*0Sstevel@tonic-gate 143*0Sstevel@tonic-gate /* 144*0Sstevel@tonic-gate * Page 0x38 - This is the CCS Cache Page 145*0Sstevel@tonic-gate */ 146*0Sstevel@tonic-gate 147*0Sstevel@tonic-gate struct mode_cache_ccs { 148*0Sstevel@tonic-gate struct mode_page mode_page; /* common mode page header */ 149*0Sstevel@tonic-gate uchar_t mode; /* Cache control and size */ 150*0Sstevel@tonic-gate uchar_t threshold; /* Prefetch threshold */ 151*0Sstevel@tonic-gate uchar_t max_prefetch; /* Max. prefetch */ 152*0Sstevel@tonic-gate uchar_t max_multiplier; /* Max. prefetch multiplier */ 153*0Sstevel@tonic-gate uchar_t min_prefetch; /* Min. prefetch */ 154*0Sstevel@tonic-gate uchar_t min_multiplier; /* Min. prefetch multiplier */ 155*0Sstevel@tonic-gate uchar_t rsvd2[8]; 156*0Sstevel@tonic-gate }; 157*0Sstevel@tonic-gate 158*0Sstevel@tonic-gate /* 159*0Sstevel@tonic-gate * Page A: SCSI-2 control page was a little different than SCSI-3 160*0Sstevel@tonic-gate */ 161*0Sstevel@tonic-gate 162*0Sstevel@tonic-gate #define PAGELENGTH_MODE_CONTROL 0x06 163*0Sstevel@tonic-gate 164*0Sstevel@tonic-gate struct mode_control { 165*0Sstevel@tonic-gate struct mode_page mode_page; /* common mode page header */ 166*0Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 167*0Sstevel@tonic-gate uchar_t rlec : 1, /* Report Log Exception bit */ 168*0Sstevel@tonic-gate : 7; 169*0Sstevel@tonic-gate uchar_t qdisable: 1, /* Queue disable */ 170*0Sstevel@tonic-gate que_err : 1, /* Queue error */ 171*0Sstevel@tonic-gate : 2, 172*0Sstevel@tonic-gate que_mod : 4; /* Queue algorithm modifier */ 173*0Sstevel@tonic-gate uchar_t eanp : 1, 174*0Sstevel@tonic-gate uaaenp : 1, 175*0Sstevel@tonic-gate raenp : 1, 176*0Sstevel@tonic-gate : 4, 177*0Sstevel@tonic-gate eeca : 1; 178*0Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 179*0Sstevel@tonic-gate uchar_t : 7, 180*0Sstevel@tonic-gate rlec : 1; /* Report Log Exception bit */ 181*0Sstevel@tonic-gate uchar_t que_mod : 4, /* Queue algorithm modifier */ 182*0Sstevel@tonic-gate : 2, 183*0Sstevel@tonic-gate que_err : 1, /* Queue error */ 184*0Sstevel@tonic-gate qdisable: 1; /* Queue disable */ 185*0Sstevel@tonic-gate uchar_t eeca : 1, 186*0Sstevel@tonic-gate : 4, 187*0Sstevel@tonic-gate raenp : 1, 188*0Sstevel@tonic-gate uaaenp : 1, 189*0Sstevel@tonic-gate eanp : 1; 190*0Sstevel@tonic-gate #else 191*0Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 192*0Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 193*0Sstevel@tonic-gate uchar_t reserved; 194*0Sstevel@tonic-gate ushort_t ready_aen_holdoff; 195*0Sstevel@tonic-gate }; 196*0Sstevel@tonic-gate 197*0Sstevel@tonic-gate 198*0Sstevel@tonic-gate /* 199*0Sstevel@tonic-gate * Emulex MD21 Unique Mode Select/Sense structure. 200*0Sstevel@tonic-gate * This is apparently not used, although the MD21 201*0Sstevel@tonic-gate * documentation refers to it. 202*0Sstevel@tonic-gate * 203*0Sstevel@tonic-gate * The medium_type in the mode header must be 0x80 204*0Sstevel@tonic-gate * to indicate a vendor unique format. There is then 205*0Sstevel@tonic-gate * a standard block descriptor page, which must be 206*0Sstevel@tonic-gate * zeros (although the block descriptor length is set 207*0Sstevel@tonic-gate * appropriately in the mode header). 208*0Sstevel@tonic-gate * 209*0Sstevel@tonic-gate * After this stuff, comes the vendor unique ESDI 210*0Sstevel@tonic-gate * format parameters for the MD21. 211*0Sstevel@tonic-gate * 212*0Sstevel@tonic-gate * Notes: 213*0Sstevel@tonic-gate * 214*0Sstevel@tonic-gate * 1) The logical number of sectors/track should be the 215*0Sstevel@tonic-gate * number of physical sectors/track less the number spare 216*0Sstevel@tonic-gate * sectors/track. 217*0Sstevel@tonic-gate * 218*0Sstevel@tonic-gate * 2) The logical number of cylinders should be the 219*0Sstevel@tonic-gate * number of physical cylinders less three (3) reserved 220*0Sstevel@tonic-gate * for use by the drive, and less any alternate cylinders 221*0Sstevel@tonic-gate * allocated. 222*0Sstevel@tonic-gate * 223*0Sstevel@tonic-gate * 3) head skew- see MD21 manual. 224*0Sstevel@tonic-gate */ 225*0Sstevel@tonic-gate 226*0Sstevel@tonic-gate struct emulex_format_params { 227*0Sstevel@tonic-gate uchar_t alt_cyl; /* number of alternate cylinders */ 228*0Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 229*0Sstevel@tonic-gate uchar_t : 1, 230*0Sstevel@tonic-gate sst : 2, /* spare sectors per track */ 231*0Sstevel@tonic-gate ssz : 1, /* sector size. 1 == 256 bps, 0 == 512 bps */ 232*0Sstevel@tonic-gate nheads : 4; /* number of heads */ 233*0Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 234*0Sstevel@tonic-gate uchar_t nheads : 4, /* number of heads */ 235*0Sstevel@tonic-gate ssz : 1, /* sector size. 1 == 256 bps, 0 == 512 bps */ 236*0Sstevel@tonic-gate sst : 2, /* spare sectors per track */ 237*0Sstevel@tonic-gate : 1; 238*0Sstevel@tonic-gate #else 239*0Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 240*0Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 241*0Sstevel@tonic-gate uchar_t nsect; /* logical sectors/track */ 242*0Sstevel@tonic-gate uchar_t ncyl_hi; /* logical number of cylinders, msb */ 243*0Sstevel@tonic-gate uchar_t ncyl_lo; /* logical number of cylinders, lsb */ 244*0Sstevel@tonic-gate uchar_t head_skew; /* head skew */ 245*0Sstevel@tonic-gate uchar_t reserved[3]; 246*0Sstevel@tonic-gate }; 247*0Sstevel@tonic-gate 248*0Sstevel@tonic-gate /* 249*0Sstevel@tonic-gate * Page 0x31: CD-ROM speed page 250*0Sstevel@tonic-gate */ 251*0Sstevel@tonic-gate 252*0Sstevel@tonic-gate #define CDROM_MODE_SPEED 0x31 253*0Sstevel@tonic-gate 254*0Sstevel@tonic-gate struct mode_speed { 255*0Sstevel@tonic-gate struct mode_page mode_page; /* common mode page header */ 256*0Sstevel@tonic-gate uchar_t speed; /* drive speed */ 257*0Sstevel@tonic-gate uchar_t reserved; 258*0Sstevel@tonic-gate }; 259*0Sstevel@tonic-gate 260*0Sstevel@tonic-gate /* 261*0Sstevel@tonic-gate * Definitions for drive speed supported are in cdio.h 262*0Sstevel@tonic-gate */ 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gate #ifdef __cplusplus 265*0Sstevel@tonic-gate } 266*0Sstevel@tonic-gate #endif 267*0Sstevel@tonic-gate 268*0Sstevel@tonic-gate #endif /* _SYS_SCSI_IMPL_MODE_H */ 269