17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 52c9565cfSls24207 * Common Development and Distribution License (the "License"). 62c9565cfSls24207 * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21*35d37d44SJeffry Molanus 227c478bd9Sstevel@tonic-gate /* 232ee4dfc7SJane Chu * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 25*35d37d44SJeffry Molanus * Copyright 2017 Nexenta Systems, Inc. 267c478bd9Sstevel@tonic-gate */ 277c478bd9Sstevel@tonic-gate 287c478bd9Sstevel@tonic-gate #ifndef _SYS_SCSI_GENERIC_MODE_H 297c478bd9Sstevel@tonic-gate #define _SYS_SCSI_GENERIC_MODE_H 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #ifdef __cplusplus 327c478bd9Sstevel@tonic-gate extern "C" { 337c478bd9Sstevel@tonic-gate #endif 347c478bd9Sstevel@tonic-gate 357c478bd9Sstevel@tonic-gate /* 367c478bd9Sstevel@tonic-gate * 377c478bd9Sstevel@tonic-gate * Defines and Structures for SCSI Mode Sense/Select data - generic 387c478bd9Sstevel@tonic-gate * 397c478bd9Sstevel@tonic-gate */ 407c478bd9Sstevel@tonic-gate 417c478bd9Sstevel@tonic-gate /* 427c478bd9Sstevel@tonic-gate * Structures and defines common for all device types 437c478bd9Sstevel@tonic-gate */ 447c478bd9Sstevel@tonic-gate 457c478bd9Sstevel@tonic-gate /* 467c478bd9Sstevel@tonic-gate * Mode Sense/Select Header - Group 0 (6-byte). 477c478bd9Sstevel@tonic-gate * 487c478bd9Sstevel@tonic-gate * Mode Sense/Select data consists of a header, followed by zero or more 497c478bd9Sstevel@tonic-gate * block descriptors, followed by zero or more mode pages. 507c478bd9Sstevel@tonic-gate * 517c478bd9Sstevel@tonic-gate */ 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate struct mode_header { 547c478bd9Sstevel@tonic-gate uchar_t length; /* number of bytes following */ 557c478bd9Sstevel@tonic-gate uchar_t medium_type; /* device specific */ 567c478bd9Sstevel@tonic-gate uchar_t device_specific; /* device specific parameters */ 577c478bd9Sstevel@tonic-gate uchar_t bdesc_length; /* length of block descriptor(s), if any */ 587c478bd9Sstevel@tonic-gate }; 597c478bd9Sstevel@tonic-gate 607c478bd9Sstevel@tonic-gate #define MODE_HEADER_LENGTH (sizeof (struct mode_header)) 617c478bd9Sstevel@tonic-gate 627c478bd9Sstevel@tonic-gate /* 637c478bd9Sstevel@tonic-gate * Mode Sense/Select Header - Group 1 (10-bytes) 647c478bd9Sstevel@tonic-gate */ 657c478bd9Sstevel@tonic-gate 667c478bd9Sstevel@tonic-gate struct mode_header_g1 { 677c478bd9Sstevel@tonic-gate ushort_t length; /* number of bytes following */ 687c478bd9Sstevel@tonic-gate uchar_t medium_type; /* device specific */ 697c478bd9Sstevel@tonic-gate uchar_t device_specific; /* device specific parameters */ 707c478bd9Sstevel@tonic-gate uchar_t reserved[2]; /* device specific parameters */ 717c478bd9Sstevel@tonic-gate ushort_t bdesc_length; /* len of block descriptor(s), if any */ 727c478bd9Sstevel@tonic-gate }; 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate #define MODE_HEADER_LENGTH_G1 (sizeof (struct mode_header_g1)) 757c478bd9Sstevel@tonic-gate 767c478bd9Sstevel@tonic-gate /* 777c478bd9Sstevel@tonic-gate * Block Descriptor. Zero, one, or more may normally follow the mode header. 787c478bd9Sstevel@tonic-gate * 797c478bd9Sstevel@tonic-gate * The density code is device specific. 807c478bd9Sstevel@tonic-gate * 817c478bd9Sstevel@tonic-gate * The 24-bit value described by blks_{hi, mid, lo} describes the number of 827c478bd9Sstevel@tonic-gate * blocks which this block descriptor applies to. A value of zero means 837c478bd9Sstevel@tonic-gate * 'the rest of the blocks on the device'. 847c478bd9Sstevel@tonic-gate * 857c478bd9Sstevel@tonic-gate * The 24-bit value described by blksize_{hi, mid, lo} describes the blocksize 867c478bd9Sstevel@tonic-gate * (in bytes) applicable for this block descriptor. For Sequential Access 877c478bd9Sstevel@tonic-gate * devices, if this value is zero, the block size will be derived from 887c478bd9Sstevel@tonic-gate * the transfer length in I/O operations. 897c478bd9Sstevel@tonic-gate * 907c478bd9Sstevel@tonic-gate */ 917c478bd9Sstevel@tonic-gate 927c478bd9Sstevel@tonic-gate struct block_descriptor { 937c478bd9Sstevel@tonic-gate uchar_t density_code; /* device specific */ 947c478bd9Sstevel@tonic-gate uchar_t blks_hi; /* hi */ 957c478bd9Sstevel@tonic-gate uchar_t blks_mid; /* mid */ 967c478bd9Sstevel@tonic-gate uchar_t blks_lo; /* low */ 977c478bd9Sstevel@tonic-gate uchar_t reserved; /* reserved */ 987c478bd9Sstevel@tonic-gate uchar_t blksize_hi; /* hi */ 997c478bd9Sstevel@tonic-gate uchar_t blksize_mid; /* mid */ 1007c478bd9Sstevel@tonic-gate uchar_t blksize_lo; /* low */ 1017c478bd9Sstevel@tonic-gate }; 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate #define MODE_BLK_DESC_LENGTH (sizeof (struct block_descriptor)) 1047c478bd9Sstevel@tonic-gate #define MODE_PARAM_LENGTH (MODE_HEADER_LENGTH + MODE_BLK_DESC_LENGTH) 1057c478bd9Sstevel@tonic-gate 1067c478bd9Sstevel@tonic-gate /* 1077c478bd9Sstevel@tonic-gate * Define a macro to take an address of a mode header to the address 1087c478bd9Sstevel@tonic-gate * of the nth (0..n) block_descriptor, or NULL if there either aren't any 1097c478bd9Sstevel@tonic-gate * block descriptors or the nth block descriptor doesn't exist. 1107c478bd9Sstevel@tonic-gate */ 1117c478bd9Sstevel@tonic-gate 1127c478bd9Sstevel@tonic-gate #define BLOCK_DESCRIPTOR_ADDR(mhdr, bdnum) \ 1137c478bd9Sstevel@tonic-gate ((mhdr)->bdesc_length && ((unsigned)(bdnum)) < \ 1147c478bd9Sstevel@tonic-gate ((mhdr)->bdesc_length/(sizeof (struct block_descriptor)))) ? \ 1157c478bd9Sstevel@tonic-gate ((struct block_descriptor *)(((ulong_t)(mhdr))+MODE_HEADER_LENGTH+ \ 1167c478bd9Sstevel@tonic-gate ((bdnum) * sizeof (struct block_descriptor)))) : \ 1177c478bd9Sstevel@tonic-gate ((struct block_descriptor *)0) 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate /* 1207c478bd9Sstevel@tonic-gate * Mode page header. Zero or more Mode Pages follow either the block 1217c478bd9Sstevel@tonic-gate * descriptors (if any), or the Mode Header. 1227c478bd9Sstevel@tonic-gate * 1237c478bd9Sstevel@tonic-gate * The 'ps' bit must be zero for mode select operations. 1247c478bd9Sstevel@tonic-gate * 1257c478bd9Sstevel@tonic-gate */ 1267c478bd9Sstevel@tonic-gate 1277c478bd9Sstevel@tonic-gate struct mode_page { 1287c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 1297c478bd9Sstevel@tonic-gate uchar_t code :6, /* page code number */ 1307c478bd9Sstevel@tonic-gate :1, /* reserved */ 1317c478bd9Sstevel@tonic-gate ps :1; /* 'Parameter Saveable' bit */ 1327c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 1337c478bd9Sstevel@tonic-gate uchar_t ps :1, /* 'Parameter Saveable' bit */ 1347c478bd9Sstevel@tonic-gate :1, /* reserved */ 1357c478bd9Sstevel@tonic-gate code :6; /* page code number */ 1367c478bd9Sstevel@tonic-gate #else 1377c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 1387c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 1397c478bd9Sstevel@tonic-gate uchar_t length; /* length of bytes to follow */ 1407c478bd9Sstevel@tonic-gate /* 1417c478bd9Sstevel@tonic-gate * Mode Page specific data follows right after this... 1427c478bd9Sstevel@tonic-gate */ 1437c478bd9Sstevel@tonic-gate }; 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate /* 1467c478bd9Sstevel@tonic-gate * Define a macro to retrieve the first mode page. Could be more 1477c478bd9Sstevel@tonic-gate * general (for multiple mode pages). 1487c478bd9Sstevel@tonic-gate */ 1497c478bd9Sstevel@tonic-gate 1507c478bd9Sstevel@tonic-gate #define MODE_PAGE_ADDR(mhdr, type) \ 1517c478bd9Sstevel@tonic-gate ((type *)(((ulong_t)(mhdr))+MODE_HEADER_LENGTH+(mhdr)->bdesc_length)) 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate /* 154*35d37d44SJeffry Molanus * Page Control field (bits 7 and 6) follows the following specification: 155*35d37d44SJeffry Molanus * 156*35d37d44SJeffry Molanus * Value Meaning 157*35d37d44SJeffry Molanus * ---------------------------------------------------------------------- 158*35d37d44SJeffry Molanus * 00b current values 159*35d37d44SJeffry Molanus * 01b changeable values 160*35d37d44SJeffry Molanus * 10b default values 161*35d37d44SJeffry Molanus * 11b saved values 162*35d37d44SJeffry Molanus */ 163*35d37d44SJeffry Molanus 164*35d37d44SJeffry Molanus #define MODEPAGE_CURRENT 0x00 165*35d37d44SJeffry Molanus #define MODEPAGE_CHANGEABLE 0x40 166*35d37d44SJeffry Molanus #define MODEPAGE_DEFAULT 0x80 167*35d37d44SJeffry Molanus #define MODEPAGE_SAVED 0xC0 168*35d37d44SJeffry Molanus 169*35d37d44SJeffry Molanus /* 1707c478bd9Sstevel@tonic-gate * Page codes follow the following specification: 1717c478bd9Sstevel@tonic-gate * 1727c478bd9Sstevel@tonic-gate * Code Value(s) What 1737c478bd9Sstevel@tonic-gate * ---------------------------------------------------------------------- 1747c478bd9Sstevel@tonic-gate * 0x00 Vendor Unique (does not require page format) 1757c478bd9Sstevel@tonic-gate * 1767c478bd9Sstevel@tonic-gate * 0x02, 0x09, 0x0A pages for all Device Types 1777c478bd9Sstevel@tonic-gate * 0x1A, 0x1C 1787c478bd9Sstevel@tonic-gate * 1797c478bd9Sstevel@tonic-gate * 0x01, 0x03-0x08, pages for specific Device Type 1807c478bd9Sstevel@tonic-gate * 0x0B-0x19, 0x1B, 1817c478bd9Sstevel@tonic-gate * 0x1D-0x1F 1827c478bd9Sstevel@tonic-gate * 1837c478bd9Sstevel@tonic-gate * 0x20-0x3E Vendor Unique (requires page format) 1847c478bd9Sstevel@tonic-gate * 1857c478bd9Sstevel@tonic-gate * 0x3F Return all pages (valid for Mode Sense only) 1867c478bd9Sstevel@tonic-gate * 1877c478bd9Sstevel@tonic-gate */ 1887c478bd9Sstevel@tonic-gate 1897c478bd9Sstevel@tonic-gate /* 1907c478bd9Sstevel@tonic-gate * Page codes and page length values (all device types) 1917c478bd9Sstevel@tonic-gate */ 1927c478bd9Sstevel@tonic-gate 1937c478bd9Sstevel@tonic-gate #define MODEPAGE_DISCO_RECO 0x02 1947c478bd9Sstevel@tonic-gate #define MODEPAGE_CACHING 0x08 1957c478bd9Sstevel@tonic-gate #define MODEPAGE_PDEVICE 0x09 1967c478bd9Sstevel@tonic-gate #define MODEPAGE_CTRL_MODE 0x0A 1977c478bd9Sstevel@tonic-gate #define MODEPAGE_POWER_COND 0x1A 1987c478bd9Sstevel@tonic-gate #define MODEPAGE_INFO_EXCPT 0x1C 1997c478bd9Sstevel@tonic-gate 2007c478bd9Sstevel@tonic-gate #define MODEPAGE_ALLPAGES 0x3F 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate /* 2037c478bd9Sstevel@tonic-gate * Mode Select/Sense page structures (for all device types) 2047c478bd9Sstevel@tonic-gate */ 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gate /* 2077c478bd9Sstevel@tonic-gate * Disconnect/Reconnect Page 2087c478bd9Sstevel@tonic-gate */ 2097c478bd9Sstevel@tonic-gate 2107c478bd9Sstevel@tonic-gate struct mode_disco_reco { 2117c478bd9Sstevel@tonic-gate struct mode_page mode_page; /* common mode page header */ 2127c478bd9Sstevel@tonic-gate uchar_t buffer_full_ratio; /* write, how full before reconnect? */ 2137c478bd9Sstevel@tonic-gate uchar_t buffer_empty_ratio; /* read, how full before reconnect? */ 2147c478bd9Sstevel@tonic-gate ushort_t bus_inactivity_limit; /* how much bus quiet time for BSY- */ 2157c478bd9Sstevel@tonic-gate ushort_t disconect_time_limit; /* min to remain disconnected */ 2167c478bd9Sstevel@tonic-gate ushort_t connect_time_limit; /* min to remain connected */ 2177c478bd9Sstevel@tonic-gate ushort_t max_burst_size; /* max data burst size */ 2187c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 2197c478bd9Sstevel@tonic-gate uchar_t dtdc : 3, /* data transfer disconenct control */ 2207c478bd9Sstevel@tonic-gate dimm : 1, /* disconnect immediate */ 2217c478bd9Sstevel@tonic-gate fastat : 1, /* fair for status */ 2227c478bd9Sstevel@tonic-gate fawrt : 1, /* fair for write */ 2237c478bd9Sstevel@tonic-gate fard : 1, /* fair for read */ 2247c478bd9Sstevel@tonic-gate emdp : 1; /* enable modify data pointers */ 2257c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 2267c478bd9Sstevel@tonic-gate uchar_t emdp : 1, /* enable modify data pointers */ 2277c478bd9Sstevel@tonic-gate fard : 1, /* fair for read */ 2287c478bd9Sstevel@tonic-gate fawrt : 1, /* fair for write */ 2297c478bd9Sstevel@tonic-gate fastat : 1, /* fair for status */ 2307c478bd9Sstevel@tonic-gate dimm : 1, /* disconnect immediate */ 2317c478bd9Sstevel@tonic-gate dtdc : 3; /* data transfer disconenct control */ 2327c478bd9Sstevel@tonic-gate #else 2337c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 2347c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 2357c478bd9Sstevel@tonic-gate uchar_t reserved; 2367c478bd9Sstevel@tonic-gate ushort_t first_burst_sz; /* first burst size */ 2377c478bd9Sstevel@tonic-gate }; 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate #define DTDC_DATADONE 0x01 2407c478bd9Sstevel@tonic-gate /* 2417c478bd9Sstevel@tonic-gate * Target may not disconnect once 2427c478bd9Sstevel@tonic-gate * data transfer is started until 2437c478bd9Sstevel@tonic-gate * all data successfully transferred. 2447c478bd9Sstevel@tonic-gate */ 2457c478bd9Sstevel@tonic-gate 2467c478bd9Sstevel@tonic-gate #define DTDC_CMDDONE 0x03 2477c478bd9Sstevel@tonic-gate /* 2487c478bd9Sstevel@tonic-gate * Target may not disconnect once 2497c478bd9Sstevel@tonic-gate * data transfer is started until 2507c478bd9Sstevel@tonic-gate * command completed. 2517c478bd9Sstevel@tonic-gate */ 2527c478bd9Sstevel@tonic-gate /* 2537c478bd9Sstevel@tonic-gate * Caching Page 2547c478bd9Sstevel@tonic-gate */ 2557c478bd9Sstevel@tonic-gate 2567c478bd9Sstevel@tonic-gate struct mode_caching { 2577c478bd9Sstevel@tonic-gate struct mode_page mode_page; /* common mode page header */ 2587c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 2597c478bd9Sstevel@tonic-gate uchar_t rcd : 1, /* Read Cache Disable */ 2607c478bd9Sstevel@tonic-gate mf : 1, /* Multiplication Factor */ 2617c478bd9Sstevel@tonic-gate wce : 1, /* Write Cache Enable */ 2627c478bd9Sstevel@tonic-gate : 5; /* Reserved */ 2637c478bd9Sstevel@tonic-gate uchar_t write_ret_prio : 4, /* Write Retention Priority */ 2647c478bd9Sstevel@tonic-gate dmd_rd_ret_prio : 4; /* Demand Read Retention Priority */ 2657c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 2667c478bd9Sstevel@tonic-gate uchar_t : 5, /* Reserved */ 2677c478bd9Sstevel@tonic-gate wce : 1, /* Write Cache Enable */ 2687c478bd9Sstevel@tonic-gate mf : 1, /* Multiplication Factor */ 2697c478bd9Sstevel@tonic-gate rcd : 1; /* Read Cache Disable */ 2707c478bd9Sstevel@tonic-gate uchar_t dmd_rd_ret_prio : 4, /* Demand Read Retention Priority */ 2717c478bd9Sstevel@tonic-gate write_ret_prio : 4; /* Write Retention Priority */ 2727c478bd9Sstevel@tonic-gate #else 2737c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 2747c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 2757c478bd9Sstevel@tonic-gate ushort_t pf_dsbl_trans_len; /* Disable prefetch transfer length */ 2767c478bd9Sstevel@tonic-gate ushort_t min_prefetch; /* Minimum Prefetch */ 2777c478bd9Sstevel@tonic-gate ushort_t max_prefetch; /* Maximum Prefetch */ 2787c478bd9Sstevel@tonic-gate ushort_t max_prefetch_ceiling; /* Maximum Prefetch Ceiling */ 2797c478bd9Sstevel@tonic-gate }; 2807c478bd9Sstevel@tonic-gate 2817c478bd9Sstevel@tonic-gate /* 2827c478bd9Sstevel@tonic-gate * Peripheral Device Page 2837c478bd9Sstevel@tonic-gate */ 2847c478bd9Sstevel@tonic-gate 2857c478bd9Sstevel@tonic-gate struct mode_pdevice { 2867c478bd9Sstevel@tonic-gate struct mode_page mode_page; /* common mode page header */ 2877c478bd9Sstevel@tonic-gate ushort_t if_ident; /* interface identifier */ 2887c478bd9Sstevel@tonic-gate uchar_t reserved[4]; /* reserved */ 2897c478bd9Sstevel@tonic-gate uchar_t vendor_uniqe[1]; /* vendor unique data */ 2907c478bd9Sstevel@tonic-gate }; 2917c478bd9Sstevel@tonic-gate 2927c478bd9Sstevel@tonic-gate #define PDEV_SCSI 0x0000 /* scsi interface */ 2937c478bd9Sstevel@tonic-gate #define PDEV_SMD 0x0001 /* SMD interface */ 2947c478bd9Sstevel@tonic-gate #define PDEV_ESDI 0x0002 /* ESDI interface */ 2957c478bd9Sstevel@tonic-gate #define PDEV_IPI2 0x0003 /* IPI-2 interface */ 2967c478bd9Sstevel@tonic-gate #define PDEV_IPI3 0x0004 /* IPI-3 interface */ 2977c478bd9Sstevel@tonic-gate 2987c478bd9Sstevel@tonic-gate /* 2997c478bd9Sstevel@tonic-gate * Control Mode Page 3007c478bd9Sstevel@tonic-gate * 3017c478bd9Sstevel@tonic-gate * Note: This structure is incompatible with previous SCSI 3027c478bd9Sstevel@tonic-gate * implementations. See <scsi/impl/mode.h> for an 3037c478bd9Sstevel@tonic-gate * alternative form of this structure. They can be 3047c478bd9Sstevel@tonic-gate * distinguished by the length of data returned 3057c478bd9Sstevel@tonic-gate * from a MODE SENSE command. 3067c478bd9Sstevel@tonic-gate */ 3077c478bd9Sstevel@tonic-gate 3087c478bd9Sstevel@tonic-gate #define PAGELENGTH_MODE_CONTROL_SCSI3 0x0A 3097c478bd9Sstevel@tonic-gate 3107c478bd9Sstevel@tonic-gate struct mode_control_scsi3 { 3117c478bd9Sstevel@tonic-gate struct mode_page mode_page; /* common mode page header */ 3127c478bd9Sstevel@tonic-gate #if defined(_BIT_FIELDS_LTOH) 3137c478bd9Sstevel@tonic-gate uchar_t rlec : 1, /* Report Log Exception bit */ 3147c478bd9Sstevel@tonic-gate gltsd : 1, /* global logging target save disable */ 3157c478bd9Sstevel@tonic-gate d_sense : 1, /* Use descriptor sense data (SPC-3) */ 3167c478bd9Sstevel@tonic-gate : 5; 3177c478bd9Sstevel@tonic-gate uchar_t qdisable: 1, /* Queue disable */ 3187c478bd9Sstevel@tonic-gate que_err : 1, /* Queue error */ 3197c478bd9Sstevel@tonic-gate : 2, 3207c478bd9Sstevel@tonic-gate que_mod : 4; /* Queue algorithm modifier */ 3217c478bd9Sstevel@tonic-gate uchar_t eanp : 1, /* Enable AEN permission */ 3227c478bd9Sstevel@tonic-gate uaaenp : 1, /* Unit attention AEN permission */ 3237c478bd9Sstevel@tonic-gate raenp : 1, /* Ready AEN permission */ 3247c478bd9Sstevel@tonic-gate : 1, 3257c478bd9Sstevel@tonic-gate bybths : 1, /* By both RESET signal */ 3267c478bd9Sstevel@tonic-gate byprtm : 1, /* By port message */ 3277c478bd9Sstevel@tonic-gate rac : 1, /* report a check */ 3287c478bd9Sstevel@tonic-gate eeca : 1; /* enable extended contingent */ 3297c478bd9Sstevel@tonic-gate /* allegiance (only pre-SCSI-3) */ 3307c478bd9Sstevel@tonic-gate #elif defined(_BIT_FIELDS_HTOL) 3317c478bd9Sstevel@tonic-gate uchar_t : 5, 3327c478bd9Sstevel@tonic-gate d_sense : 1, /* Use descriptor sense data (SPC-3) */ 3337c478bd9Sstevel@tonic-gate gltsd : 1, /* global logging target save disable */ 3347c478bd9Sstevel@tonic-gate rlec : 1; /* Report Log Exception bit */ 3357c478bd9Sstevel@tonic-gate uchar_t que_mod : 4, /* Queue algorithm modifier */ 3367c478bd9Sstevel@tonic-gate : 2, 3377c478bd9Sstevel@tonic-gate que_err : 1, /* Queue error */ 3387c478bd9Sstevel@tonic-gate qdisable: 1; /* Queue disable */ 3397c478bd9Sstevel@tonic-gate uchar_t eeca : 1, /* enable extended contingent */ 3407c478bd9Sstevel@tonic-gate /* allegiance (only pre-SCSI-3) */ 3417c478bd9Sstevel@tonic-gate rac : 1, /* report a check */ 3427c478bd9Sstevel@tonic-gate byprtm : 1, /* By port message */ 3437c478bd9Sstevel@tonic-gate bybths : 1, /* By both RESET signal */ 3447c478bd9Sstevel@tonic-gate : 1, 3457c478bd9Sstevel@tonic-gate raenp : 1, /* Ready AEN permission */ 3467c478bd9Sstevel@tonic-gate uaaenp : 1, /* Unit attention AEN permission */ 3477c478bd9Sstevel@tonic-gate eanp : 1; /* Enable AEN permission */ 3487c478bd9Sstevel@tonic-gate #else 3497c478bd9Sstevel@tonic-gate #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 3507c478bd9Sstevel@tonic-gate #endif /* _BIT_FIELDS_LTOH */ 3517c478bd9Sstevel@tonic-gate uchar_t reserved; 3527c478bd9Sstevel@tonic-gate ushort_t ready_aen_holdoff; /* Ready AEN holdoff period */ 3537c478bd9Sstevel@tonic-gate ushort_t busy_timeout; /* Busy timeout period */ 3547c478bd9Sstevel@tonic-gate uchar_t reserved_2[2]; 3557c478bd9Sstevel@tonic-gate }; 3567c478bd9Sstevel@tonic-gate 3575c46c6a0Spd144616 #ifdef __lock_lint 3585c46c6a0Spd144616 _NOTE(SCHEME_PROTECTS_DATA("Unshared SCSI payload", \ 3595c46c6a0Spd144616 mode_control_scsi3)) 3605c46c6a0Spd144616 #endif 3615c46c6a0Spd144616 3627c478bd9Sstevel@tonic-gate #define CTRL_QMOD_RESTRICT 0x0 3637c478bd9Sstevel@tonic-gate #define CTRL_QMOD_UNRESTRICT 0x1 3647c478bd9Sstevel@tonic-gate 3652c9565cfSls24207 /* 3662c9565cfSls24207 * Informational Exceptions Control Mode Page 3672c9565cfSls24207 */ 3682c9565cfSls24207 3692c9565cfSls24207 #define PAGELENGTH_INFO_EXCPT 0x0A 3702c9565cfSls24207 3712c9565cfSls24207 struct mode_info_excpt_page { 3722c9565cfSls24207 struct mode_page mode_page; /* common mode page header */ 3732c9565cfSls24207 #if defined(_BIT_FIELDS_LTOH) 3742c9565cfSls24207 uchar_t log_err : 1; /* log errors */ 3752c9565cfSls24207 uchar_t : 1; /* reserved */ 3762c9565cfSls24207 uchar_t test : 1; /* create test failure */ 3772c9565cfSls24207 uchar_t dexcpt : 1; /* disable exception */ 3782c9565cfSls24207 uchar_t ewasc : 1; /* enable warning */ 3792c9565cfSls24207 uchar_t ebf : 1; /* enable background function */ 3802c9565cfSls24207 uchar_t : 1; /* reserved */ 3812c9565cfSls24207 uchar_t perf : 1; /* performance */ 3822c9565cfSls24207 uchar_t mrie : 4; /* method of reporting info. excpts. */ 3832c9565cfSls24207 uchar_t : 4; /* reserved */ 3842c9565cfSls24207 #elif defined(_BIT_FIELDS_HTOL) 3852c9565cfSls24207 uchar_t perf : 1; /* performance */ 3862c9565cfSls24207 uchar_t : 1; /* reserved */ 3872c9565cfSls24207 uchar_t ebf : 1; /* enable background function */ 3882c9565cfSls24207 uchar_t ewasc : 1; /* enable warning */ 3892c9565cfSls24207 uchar_t dexcpt : 1; /* disable exception */ 3902c9565cfSls24207 uchar_t test : 1; /* create test failure */ 3912c9565cfSls24207 uchar_t : 1; /* reserved */ 3922c9565cfSls24207 uchar_t log_err : 1; /* log errors */ 3932c9565cfSls24207 uchar_t : 4; /* reserved */ 3942c9565cfSls24207 uchar_t mrie : 4; /* method of reporting info. excpts. */ 3952c9565cfSls24207 #else 3962c9565cfSls24207 #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 3972c9565cfSls24207 #endif 3982c9565cfSls24207 uchar_t interval_timer[4]; /* interval timer */ 3992c9565cfSls24207 uchar_t report_count[4]; /* report count */ 4002c9565cfSls24207 }; 4012c9565cfSls24207 4022c9565cfSls24207 #define MRIE_NO_REPORT 0x0 4032c9565cfSls24207 #define MRIE_ASYNCH 0x1 4042c9565cfSls24207 #define MRIE_UNIT_ATTN 0x2 4052c9565cfSls24207 #define MRIE_COND_RECVD_ERR 0x3 4062c9565cfSls24207 #define MRIE_UNCOND_RECVD_ERR 0x4 4072c9565cfSls24207 #define MRIE_NO_SENSE 0x5 4082c9565cfSls24207 #define MRIE_ONLY_ON_REQUEST 0x6 4092c9565cfSls24207 4102ee4dfc7SJane Chu struct mode_info_power_cond { 4112ee4dfc7SJane Chu struct mode_page mode_page; /* common mode page header */ 4122ee4dfc7SJane Chu uchar_t reserved; 4132ee4dfc7SJane Chu #if defined(_BIT_FIELDS_LTOH) 4142ee4dfc7SJane Chu uchar_t standby :1, /* standby bit */ 4152ee4dfc7SJane Chu idle :1, /* idle bit */ 4162ee4dfc7SJane Chu :6; /* reserved */ 4172ee4dfc7SJane Chu #elif defined(_BIT_FIELDS_HTOL) 4182ee4dfc7SJane Chu uchar_t :6, /* reserved */ 4192ee4dfc7SJane Chu idle :1, /* idle bit */ 4202ee4dfc7SJane Chu standby :1; /* standby bit */ 4212ee4dfc7SJane Chu #else 4222ee4dfc7SJane Chu #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 4232ee4dfc7SJane Chu #endif 4242ee4dfc7SJane Chu uchar_t idle_cond_timer_high; 4252ee4dfc7SJane Chu uchar_t idle_cond_timer_low; 4262ee4dfc7SJane Chu uchar_t standby_cond_timer[4]; 4272ee4dfc7SJane Chu }; 4282ee4dfc7SJane Chu 4292ee4dfc7SJane Chu struct parameter_control { 4302ee4dfc7SJane Chu #if defined(_BIT_FIELDS_LTOH) 4312ee4dfc7SJane Chu uchar_t fmt_link:2, /* format and link bit */ 4322ee4dfc7SJane Chu tmc :2, /* tmc bit */ 4332ee4dfc7SJane Chu etc :1, /* etc bit */ 4342ee4dfc7SJane Chu tsd :1, /* tsd bit */ 4352ee4dfc7SJane Chu reserv :1, /* obsolete */ 4362ee4dfc7SJane Chu du :1; /* du bit */ 4372ee4dfc7SJane Chu #elif defined(_BIT_FIELDS_HTOL) 4382ee4dfc7SJane Chu uchar_t du :1, /* du bit */ 4392ee4dfc7SJane Chu reserv :1, /* obsolete */ 4402ee4dfc7SJane Chu tsd :1, /* tsd bit */ 4412ee4dfc7SJane Chu etc :1, /* etc bit */ 4422ee4dfc7SJane Chu tmc :2, /* tmc bit */ 4432ee4dfc7SJane Chu fmt_link:2; /* format and link bit */ 4442ee4dfc7SJane Chu #else 4452ee4dfc7SJane Chu #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 4462ee4dfc7SJane Chu #endif 4472ee4dfc7SJane Chu }; 4482ee4dfc7SJane Chu 4492ee4dfc7SJane Chu struct start_stop_cycle_counter_log { 4502ee4dfc7SJane Chu #if defined(_BIT_FIELDS_LTOH) 4512ee4dfc7SJane Chu uchar_t code :6, /* page code bit */ 4522ee4dfc7SJane Chu spf :1, /* spf bit */ 4532ee4dfc7SJane Chu ds :1; /* ds bit */ 4542ee4dfc7SJane Chu #elif defined(_BIT_FIELDS_HTOL) 4552ee4dfc7SJane Chu uchar_t ds :1, /* ds bit */ 4562ee4dfc7SJane Chu spf :1, /* spf bit */ 4572ee4dfc7SJane Chu code :6; /* page code bit */ 4582ee4dfc7SJane Chu #else 4592ee4dfc7SJane Chu #error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined 4602ee4dfc7SJane Chu #endif 4612ee4dfc7SJane Chu uchar_t sub_page_code; 4622ee4dfc7SJane Chu uchar_t page_len_high; 4632ee4dfc7SJane Chu uchar_t page_len_low; 4642ee4dfc7SJane Chu 4652ee4dfc7SJane Chu uchar_t manufactor_date_high; 4662ee4dfc7SJane Chu uchar_t manufactor_date_low; 4672ee4dfc7SJane Chu struct parameter_control param_1; 4682ee4dfc7SJane Chu uchar_t param_len_1; 4692ee4dfc7SJane Chu uchar_t year_manu[4]; 4702ee4dfc7SJane Chu uchar_t week_manu[2]; 4712ee4dfc7SJane Chu 4722ee4dfc7SJane Chu uchar_t account_date_high; 4732ee4dfc7SJane Chu uchar_t account_date_low; 4742ee4dfc7SJane Chu struct parameter_control param_2; 4752ee4dfc7SJane Chu uchar_t param_len_2; 4762ee4dfc7SJane Chu uchar_t year_account[4]; 4772ee4dfc7SJane Chu uchar_t week_account[2]; 4782ee4dfc7SJane Chu 4792ee4dfc7SJane Chu uchar_t lifetime_code_high; 4802ee4dfc7SJane Chu uchar_t lifetime_code_low; 4812ee4dfc7SJane Chu struct parameter_control param_3; 4822ee4dfc7SJane Chu uchar_t param_len_3; 4832ee4dfc7SJane Chu uchar_t cycle_lifetime[4]; 4842ee4dfc7SJane Chu 4852ee4dfc7SJane Chu uchar_t cycle_code_high; 4862ee4dfc7SJane Chu uchar_t cycle_code_low; 4872ee4dfc7SJane Chu struct parameter_control param_4; 4882ee4dfc7SJane Chu uchar_t param_len_4; 4892ee4dfc7SJane Chu uchar_t cycle_accumulated[4]; 4902ee4dfc7SJane Chu }; 4912ee4dfc7SJane Chu 4922ee4dfc7SJane Chu 4937c478bd9Sstevel@tonic-gate #ifdef __cplusplus 4947c478bd9Sstevel@tonic-gate } 4957c478bd9Sstevel@tonic-gate #endif 4967c478bd9Sstevel@tonic-gate 4977c478bd9Sstevel@tonic-gate /* 4987c478bd9Sstevel@tonic-gate * Include known generic device specific mode definitions and structures 4997c478bd9Sstevel@tonic-gate */ 5007c478bd9Sstevel@tonic-gate 5017c478bd9Sstevel@tonic-gate #include <sys/scsi/generic/dad_mode.h> 5027c478bd9Sstevel@tonic-gate 5037c478bd9Sstevel@tonic-gate /* 5047c478bd9Sstevel@tonic-gate * Include implementation specific mode information 5057c478bd9Sstevel@tonic-gate */ 5067c478bd9Sstevel@tonic-gate 5077c478bd9Sstevel@tonic-gate #include <sys/scsi/impl/mode.h> 5087c478bd9Sstevel@tonic-gate 5097c478bd9Sstevel@tonic-gate #endif /* _SYS_SCSI_GENERIC_MODE_H */ 510