1 1.2.2.2 thorpej /* $NetBSD: scsipi_all.h,v 1.2.2.2 1997/08/27 23:33:22 thorpej Exp $ */ 2 1.2.2.2 thorpej 3 1.2.2.2 thorpej /* 4 1.2.2.2 thorpej * SCSI and SCSI-like general interface description 5 1.2.2.2 thorpej */ 6 1.2.2.2 thorpej 7 1.2.2.2 thorpej /* 8 1.2.2.2 thorpej * Largely written by Julian Elischer (julian (at) tfs.com) 9 1.2.2.2 thorpej * for TRW Financial Systems. 10 1.2.2.2 thorpej * 11 1.2.2.2 thorpej * TRW Financial Systems, in accordance with their agreement with Carnegie 12 1.2.2.2 thorpej * Mellon University, makes this software available to CMU to distribute 13 1.2.2.2 thorpej * or use in any manner that they see fit as long as this message is kept with 14 1.2.2.2 thorpej * the software. For this reason TFS also grants any other persons or 15 1.2.2.2 thorpej * organisations permission to use or modify this software. 16 1.2.2.2 thorpej * 17 1.2.2.2 thorpej * TFS supplies this software to be publicly redistributed 18 1.2.2.2 thorpej * on the understanding that TFS is not responsible for the correct 19 1.2.2.2 thorpej * functioning of this software in any circumstances. 20 1.2.2.2 thorpej * 21 1.2.2.2 thorpej * Ported to run under 386BSD by Julian Elischer (julian (at) tfs.com) Sept 1992 22 1.2.2.2 thorpej */ 23 1.2.2.2 thorpej 24 1.2.2.2 thorpej #ifndef _SCSI_PI_ALL_H 25 1.2.2.2 thorpej #define _SCSI_PI_ALL_H 1 26 1.2.2.2 thorpej 27 1.2.2.2 thorpej /* 28 1.2.2.2 thorpej * SCSI-like command format and opcode 29 1.2.2.2 thorpej */ 30 1.2.2.2 thorpej 31 1.2.2.2 thorpej #define TEST_UNIT_READY 0x00 32 1.2.2.2 thorpej struct scsipi_test_unit_ready { 33 1.2.2.2 thorpej u_int8_t opcode; 34 1.2.2.2 thorpej u_int8_t byte2; 35 1.2.2.2 thorpej u_int8_t unused[3]; 36 1.2.2.2 thorpej u_int8_t control; 37 1.2.2.2 thorpej }; 38 1.2.2.2 thorpej 39 1.2.2.2 thorpej #define REQUEST_SENSE 0x03 40 1.2.2.2 thorpej struct scsipi_sense { 41 1.2.2.2 thorpej u_int8_t opcode; 42 1.2.2.2 thorpej u_int8_t byte2; 43 1.2.2.2 thorpej u_int8_t unused[2]; 44 1.2.2.2 thorpej u_int8_t length; 45 1.2.2.2 thorpej u_int8_t control; 46 1.2.2.2 thorpej }; 47 1.2.2.2 thorpej 48 1.2.2.2 thorpej #define INQUIRY 0x12 49 1.2.2.2 thorpej struct scsipi_inquiry { 50 1.2.2.2 thorpej u_int8_t opcode; 51 1.2.2.2 thorpej u_int8_t byte2; 52 1.2.2.2 thorpej u_int8_t unused[2]; 53 1.2.2.2 thorpej u_int8_t length; 54 1.2.2.2 thorpej u_int8_t control; 55 1.2.2.2 thorpej }; 56 1.2.2.2 thorpej 57 1.2.2.2 thorpej #define PREVENT_ALLOW 0x1e 58 1.2.2.2 thorpej struct scsipi_prevent { 59 1.2.2.2 thorpej u_int8_t opcode; 60 1.2.2.2 thorpej u_int8_t byte2; 61 1.2.2.2 thorpej u_int8_t unused[2]; 62 1.2.2.2 thorpej u_int8_t how; 63 1.2.2.2 thorpej u_int8_t control; 64 1.2.2.2 thorpej }; 65 1.2.2.2 thorpej #define PR_PREVENT 0x01 66 1.2.2.2 thorpej #define PR_ALLOW 0x00 67 1.2.2.2 thorpej 68 1.2.2.2 thorpej /* 69 1.2.2.2 thorpej * inquiry and sense data format 70 1.2.2.2 thorpej */ 71 1.2.2.2 thorpej 72 1.2.2.2 thorpej struct scsipi_sense_data { 73 1.2.2.2 thorpej /* 1*/ u_int8_t error_code; 74 1.2.2.2 thorpej #define SSD_ERRCODE 0x7F 75 1.2.2.2 thorpej #define SSD_ERRCODE_VALID 0x80 76 1.2.2.2 thorpej /* 2*/ u_int8_t segment; 77 1.2.2.2 thorpej /* 3*/ u_int8_t flags; 78 1.2.2.2 thorpej #define SSD_KEY 0x0F 79 1.2.2.2 thorpej #define SSD_ILI 0x20 80 1.2.2.2 thorpej #define SSD_EOM 0x40 81 1.2.2.2 thorpej #define SSD_FILEMARK 0x80 82 1.2.2.2 thorpej /* 7*/ u_int8_t info[4]; 83 1.2.2.2 thorpej /* 8*/ u_int8_t extra_len; 84 1.2.2.2 thorpej /*12*/ u_int8_t cmd_spec_info[4]; 85 1.2.2.2 thorpej /*13*/ u_int8_t add_sense_code; 86 1.2.2.2 thorpej /*14*/ u_int8_t add_sense_code_qual; 87 1.2.2.2 thorpej /*15*/ u_int8_t fru; 88 1.2.2.2 thorpej /*16*/ u_int8_t sense_key_spec_1; 89 1.2.2.2 thorpej #define SSD_SCS_VALID 0x80 90 1.2.2.2 thorpej /*17*/ u_int8_t sense_key_spec_2; 91 1.2.2.2 thorpej /*18*/ u_int8_t sense_key_spec_3; 92 1.2.2.2 thorpej /*32*/ u_int8_t extra_bytes[14]; 93 1.2.2.2 thorpej }; 94 1.2.2.2 thorpej 95 1.2.2.2 thorpej struct scsipi_sense_data_unextended { 96 1.2.2.2 thorpej /* 1*/ u_int8_t error_code; 97 1.2.2.2 thorpej /* 4*/ u_int8_t block[3]; 98 1.2.2.2 thorpej }; 99 1.2.2.2 thorpej 100 1.2.2.2 thorpej #define T_DIRECT 0 101 1.2.2.2 thorpej #define T_SEQUENTIAL 1 102 1.2.2.2 thorpej #define T_PRINTER 2 103 1.2.2.2 thorpej #define T_PROCESSOR 3 104 1.2.2.2 thorpej #define T_WORM 4 105 1.2.2.2 thorpej #define T_CDROM 5 106 1.2.2.2 thorpej #define T_SCANNER 6 107 1.2.2.2 thorpej #define T_OPTICAL 7 108 1.2.2.2 thorpej #define T_NODEVICE 0x1F 109 1.2.2.2 thorpej 110 1.2.2.2 thorpej #define T_CHANGER 8 111 1.2.2.2 thorpej #define T_COMM 9 112 1.2.2.2 thorpej 113 1.2.2.2 thorpej #define T_REMOV 1 114 1.2.2.2 thorpej #define T_FIXED 0 115 1.2.2.2 thorpej 116 1.2.2.2 thorpej /* 117 1.2.2.2 thorpej * XXX 118 1.2.2.2 thorpej * Actually I think some SCSI driver expects this structure to be 32 bytes, so 119 1.2.2.2 thorpej * don't change it unless you really know what you are doing 120 1.2.2.2 thorpej */ 121 1.2.2.2 thorpej 122 1.2.2.2 thorpej struct scsipi_inquiry_data { 123 1.2.2.2 thorpej u_int8_t device; 124 1.2.2.2 thorpej #define SID_TYPE 0x1F 125 1.2.2.2 thorpej #define SID_QUAL 0xE0 126 1.2.2.2 thorpej #define SID_QUAL_LU_OK 0x00 127 1.2.2.2 thorpej #define SID_QUAL_LU_OFFLINE 0x20 128 1.2.2.2 thorpej #define SID_QUAL_RSVD 0x40 129 1.2.2.2 thorpej #define SID_QUAL_BAD_LU 0x60 130 1.2.2.2 thorpej u_int8_t dev_qual2; 131 1.2.2.2 thorpej #define SID_QUAL2 0x7F 132 1.2.2.2 thorpej #define SID_REMOVABLE 0x80 133 1.2.2.2 thorpej u_int8_t version; 134 1.2.2.2 thorpej #define SID_ANSII 0x07 135 1.2.2.2 thorpej #define SID_ECMA 0x38 136 1.2.2.2 thorpej #define SID_ISO 0xC0 137 1.2.2.2 thorpej u_int8_t response_format; 138 1.2.2.2 thorpej u_int8_t additional_length; 139 1.2.2.2 thorpej u_int8_t unused[2]; 140 1.2.2.2 thorpej u_int8_t flags; 141 1.2.2.2 thorpej #define SID_SftRe 0x01 142 1.2.2.2 thorpej #define SID_CmdQue 0x02 143 1.2.2.2 thorpej #define SID_Linked 0x08 144 1.2.2.2 thorpej #define SID_Sync 0x10 145 1.2.2.2 thorpej #define SID_WBus16 0x20 146 1.2.2.2 thorpej #define SID_WBus32 0x40 147 1.2.2.2 thorpej #define SID_RelAdr 0x80 148 1.2.2.2 thorpej char vendor[8]; 149 1.2.2.2 thorpej char product[16]; 150 1.2.2.2 thorpej char revision[4]; 151 1.2.2.2 thorpej u_int8_t extra[8]; 152 1.2.2.2 thorpej }; 153 1.2.2.2 thorpej 154 1.2.2.2 thorpej #endif /* _SCSI_PI_ALL_H */ 155