Annotation of XNU/iokit/IOKit/scsi/scsi-device/SCSIPublic.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1998-2000 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * The contents of this file constitute Original Code as defined in and
        !             7:  * are subject to the Apple Public Source License Version 1.1 (the
        !             8:  * "License").  You may not use this file except in compliance with the
        !             9:  * License.  Please obtain a copy of the License at
        !            10:  * http://www.apple.com/publicsource and read it before using this file.
        !            11:  * 
        !            12:  * This Original Code and all software distributed under the License are
        !            13:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            14:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            15:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            16:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            17:  * License for the specific language governing rights and limitations
        !            18:  * under the License.
        !            19:  * 
        !            20:  * @APPLE_LICENSE_HEADER_END@
        !            21:  */
        !            22: /*
        !            23:  *
        !            24:  *     SCSIPublic.h
        !            25:  *
        !            26:  */
        !            27: 
        !            28: #ifndef _SCSIPUBLIC_H
        !            29: #define _SCSIPUBLIC_H
        !            30: 
        !            31: typedef struct _SCSIInquiry
        !            32: {
        !            33:     unsigned char   devType;           /*      0 Device type,          */
        !            34:     unsigned char   devTypeMod;                /*      1 Device type modifier  */
        !            35:     unsigned char   version;           /*      2 ISO/ECMA/ANSI version */
        !            36:     unsigned char   format;            /*      3 Response data format  */
        !            37:     unsigned char   length;            /*      4 Additional Length     */
        !            38:     unsigned char   reserved5;         /*      5 Reserved              */
        !            39:     unsigned char   reserved6;         /*      6 Reserved              */
        !            40:     unsigned char   flags;             /*      7 Capability flags      */
        !            41:     unsigned char   vendorName[8];     /*      8-15 Vendor-specific    */
        !            42:     unsigned char   productName[16];   /* 16-31 Product id             */
        !            43:     unsigned char   productRevision[4];        /* 32-35 Product revision       */
        !            44:     unsigned char   vendorSpecific[20];        /* 36-55 Vendor stuff           */
        !            45:     unsigned char   moreReserved[40];  /* 56-95 Reserved               */
        !            46: } SCSIInquiry;
        !            47: 
        !            48: /*
        !            49:  * These are device type qualifiers. We need them to distinguish between "unknown"
        !            50:  * and "missing" devices.
        !            51:  */
        !            52: enum 
        !            53: {
        !            54:     kSCSIDevTypeQualifierConnected     = 0x00, /* Exists and is connected      */
        !            55:     kSCSIDevTypeQualifierNotConnected  = 0x20, /* Logical unit exists  */
        !            56:     kSCSIDevTypeQualifierReserved      = 0x40,
        !            57:     kSCSIDevTypeQualifierMissing       = 0x60, /* No such logical unit */
        !            58:     kSCSIDevTypeQualifierVendorSpecific = 0x80, /* Non-standardized    */
        !            59:     kSCSIDevTypeQualifierMask          = 0xE0,
        !            60: };
        !            61: 
        !            62: enum _SCSIDevFlags 
        !            63: {
        !            64:     kSCSIDevCapRelAdr                  = 0x80,
        !            65:     kSCSIDevCapWBus32                  = 0x40,
        !            66:     kSCSIDevCapWBus16                  = 0x20,
        !            67:     kSCSIDevCapSync                    = 0x10,
        !            68:     kSCSIDevCapLinked                  = 0x08,
        !            69:     kSCSIDevCapCmdQue                  = 0x02,
        !            70:     kSCSIDevCapSftRe                   = 0x01,
        !            71: };
        !            72: 
        !            73: typedef struct _SCSISenseData
        !            74: {
        !            75:     unsigned char   errorCode;             /*     0 Result validity    */
        !            76:     unsigned char   segmentNumber;         /*     1 Segment number     */
        !            77:     unsigned char   senseKey;              /*     2 Sense code, flags  */
        !            78:     unsigned char   info[4];               /*   3-6 Sense-key specific */
        !            79:     unsigned char   additionalSenseLength;  /*     7 Sense length info */
        !            80:     unsigned char   reservedForCopy[4];            /*  8-11 Sense-key specific */
        !            81:     unsigned char   additionalSenseCode;    /*    12 What kind of error        */
        !            82:     unsigned char   additionalSenseQualifier; /*  13 More error info   */
        !            83:     unsigned char   fruCode;               /*    14 Field replacable   */
        !            84:     unsigned char   senseKeySpecific[2];    /* 15-16 Additional info   */
        !            85:     unsigned char   additional[101];       /* 17-26 Additional info    */
        !            86: } SCSISenseData;
        !            87: 
        !            88: /*
        !            89:  * The high-bit of errorCode signals whether there is a logical
        !            90:  * block. The low value signals whether there is a valid sense
        !            91:  */
        !            92: enum _SCSIErrorCode
        !            93: {
        !            94:     kSCSISenseHasLBN                   = 0x80, /* Logical block number set     */
        !            95:     kSCSISenseInfoValid                        = 0x70, /* Is sense key valid?          */
        !            96:     kSCSISenseInfoMask                 = 0x70, /* Mask for sense info          */
        !            97:     kSCSISenseCurrentErr               = 0x70, /* Error code (byte 0 & 0x7F    */
        !            98:     kSCSISenseDeferredErr              = 0x71, /* Error code (byte 0 & 0x7F    */
        !            99: };
        !           100: 
        !           101: /*
        !           102:  * These bits may be set in the sense key
        !           103:  */
        !           104: enum _SCSISenseKeyMasks
        !           105: {
        !           106:     kSCSISenseKeyMask                  = 0x0F,
        !           107:     kSCSISenseILI                      = 0x20, /* Illegal logical Length       */
        !           108:     kSCSISenseEOM                      = 0x40, /* End of media                 */
        !           109:     kSCSISenseFileMark                 = 0x80, /* End of file mark             */
        !           110: };
        !           111: /*
        !           112:  * SCSI sense codes. (Returned after request sense).
        !           113:  */
        !           114: enum _SCSISenseKeys
        !           115: {
        !           116:     kSCSISenseNone                     = 0x00, /* No error                     */
        !           117:     kSCSISenseRecoveredErr             = 0x01, /* Warning                      */
        !           118:     kSCSISenseNotReady                 = 0x02, /* Device not ready             */
        !           119:     kSCSISenseMediumErr                        = 0x03, /* Device medium error          */
        !           120:     kSCSISenseHardwareErr              = 0x04, /* Device hardware error        */
        !           121:     kSCSISenseIllegalReq               = 0x05, /* Illegal request for dev.     */
        !           122:     kSCSISenseUnitAtn                  = 0x06, /* Unit attention (not err)     */
        !           123:     kSCSISenseDataProtect              = 0x07, /* Data protection              */
        !           124:     kSCSISenseBlankCheck               = 0x08, /* Tape-specific error          */
        !           125:     kSCSISenseVendorSpecific           = 0x09, /* Vendor-specific error        */
        !           126:     kSCSISenseCopyAborted              = 0x0a, /* Copy request cancelled       */
        !           127:     kSCSISenseAbortedCmd               = 0x0b, /* Initiator aborted cmd.       */
        !           128:     kSCSISenseEqual                    = 0x0c, /* Comparison equal             */
        !           129:     kSCSISenseVolumeOverflow           = 0x0d, /* Write past end mark          */
        !           130:     kSCSISenseMiscompare               = 0x0e, /* Comparison failed            */
        !           131: };
        !           132: 
        !           133: enum _SCSIStatus
        !           134: {
        !           135:     kSCSIStatusGood                    = 0x00,
        !           136:     kSCSIStatusCheckCondition          = 0x02,
        !           137:     kSCSIStatusConditionMet            = 0x04,
        !           138:     kSCSIStatusBusy                    = 0x08,
        !           139:     kSCSIStatusIntermediate            = 0x10,
        !           140:     kSCSIStatusIntermediateMet         = 0x0a,
        !           141:     kSCSIStatusReservationConfict      = 0x18,
        !           142:     kSCSIStatusCommandTerminated       = 0x22,
        !           143:     kSCSIStatusQueueFull               = 0x28,
        !           144: };
        !           145: 
        !           146: 
        !           147: enum _SCSIDevTypes
        !           148: {
        !           149:     kSCSIDevTypeDirect                 = 0,    /* Hard disk (not CD-ROM)       */
        !           150:     kSCSIDevTypeSequential,                    /* Magtape or DAT               */
        !           151:     kSCSIDevTypePrinter,                       /* Printer                      */
        !           152:     kSCSIDevTypeProcessor,                     /* Attached processor           */
        !           153:     kSCSIDevTypeWorm,                          /* Write-once, read multiple    */
        !           154:     kSCSIDevTypeCDROM,                         /* CD-ROM                       */
        !           155:     kSCSIDevTypeScanner,                       /* Scanner                      */
        !           156:     kSCSIDevTypeOptical,                       /* Optical disk                 */
        !           157:     kSCSIDevTypeChanger,                       /* Jukebox                      */
        !           158:     kSCSIDevTypeComm,                          /* Communication link           */
        !           159:     kSCSIDevTypeGraphicArts0A,
        !           160:     kSCSIDevTypeGraphicArts0B,
        !           161:     kSCSIDevTypeFirstReserved,                 /* Reserved sequence start      */
        !           162:     kSCSIDevTypeUnknownOrMissing       = 0x1F,
        !           163:     kSCSIDevTypeMask                   = 0x1F,
        !           164: };
        !           165: 
        !           166: 
        !           167: /*
        !           168:  * SCSI command codes. Commands defined as ...6, ...10, ...12, are
        !           169:  * six-byte, ten-byte, and twelve-byte variants of the indicated command.
        !           170:  */
        !           171: 
        !           172: /*
        !           173:  * These commands are supported for all devices.
        !           174:  */
        !           175: enum _SCSICmds
        !           176: {
        !           177:      kSCSICmdChangeDefinition          = 0x40,
        !           178:      kSCSICmdCompare                   = 0x39,
        !           179:      kSCSICmdCopy                      = 0x18,
        !           180:      kSCSICmdCopyAndVerify             = 0x3a,
        !           181:      kSCSICmdInquiry                   = 0x12,
        !           182:      kSCSICmdLogSelect                 = 0x4c,
        !           183:      kSCSICmdLogSense                  = 0x4d,
        !           184:      kSCSICmdModeSelect12              = 0x55,
        !           185:      kSCSICmdModeSelect6               = 0x15,
        !           186:      kSCSICmdModeSense12               = 0x5a,
        !           187:      kSCSICmdModeSense6                        = 0x1a,
        !           188:      kSCSICmdReadBuffer                        = 0x3c,
        !           189:      kSCSICmdRecvDiagResult            = 0x1c,
        !           190:      kSCSICmdRequestSense              = 0x03,
        !           191:      kSCSICmdSendDiagnostic            = 0x1d,
        !           192:      kSCSICmdTestUnitReady             = 0x00,
        !           193:      kSCSICmdWriteBuffer               = 0x3b,
        !           194: 
        !           195: /*
        !           196:  * These commands are supported by direct-access devices only.
        !           197:  */
        !           198:      kSCSICmdFormatUnit                        = 0x04,
        !           199:      kSCSICmdLockUnlockCache           = 0x36,
        !           200:      kSCSICmdPrefetch                  = 0x34,
        !           201:      kSCSICmdPreventAllowRemoval       = 0x1e,
        !           202:      kSCSICmdRead6                     = 0x08,
        !           203:      kSCSICmdRead10                    = 0x28,
        !           204:      kSCSICmdReadCapacity              = 0x25,
        !           205:      kSCSICmdReadDefectData            = 0x37,
        !           206:      kSCSICmdReadLong                  = 0x3e,
        !           207:      kSCSICmdReassignBlocks            = 0x07,
        !           208:      kSCSICmdRelease                   = 0x17,
        !           209:      kSCSICmdReserve                   = 0x16,
        !           210:      kSCSICmdRezeroUnit                        = 0x01,
        !           211:      kSCSICmdSearchDataEql             = 0x31,
        !           212:      kSCSICmdSearchDataHigh            = 0x30,
        !           213:      kSCSICmdSearchDataLow             = 0x32,
        !           214:      kSCSICmdSeek6                     = 0x0b,
        !           215:      kSCSICmdSeek10                    = 0x2b,
        !           216:      kSCSICmdSetLimits                 = 0x33,
        !           217:      kSCSICmdStartStopUnit             = 0x1b,
        !           218:      kSCSICmdSynchronizeCache          = 0x35,
        !           219:      kSCSICmdVerify                    = 0x2f,
        !           220:      kSCSICmdWrite6                    = 0x0a,
        !           221:      kSCSICmdWrite10                   = 0x2a,
        !           222:      kSCSICmdWriteAndVerify            = 0x2e,
        !           223:      kSCSICmdWriteLong                 = 0x3f,
        !           224:      kSCSICmdWriteSame                 = 0x41,
        !           225: 
        !           226: /*
        !           227:  * These commands are supported by sequential devices.
        !           228:  */
        !           229:      kSCSICmdRewind                    = 0x01,
        !           230:      kSCSICmdWriteFilemarks            = 0x10,
        !           231:      kSCSICmdSpace                     = 0x11,
        !           232:      kSCSICmdLoadUnload                        = 0x1B,
        !           233: /*
        !           234:  * ANSI SCSI-II for CD-ROM devices.
        !           235:  */
        !           236:      kSCSICmdReadCDTableOfContents     = 0x43,
        !           237: };
        !           238: 
        !           239: /*
        !           240:  * Message codes (for Msg In and Msg Out phases).
        !           241:  */
        !           242: enum _SCSIMsgs
        !           243: {
        !           244:     kSCSIMsgAbort                      = 0x06,
        !           245:     kSCSIMsgAbortTag                   = 0x0d,
        !           246:     kSCSIMsgBusDeviceReset             = 0x0c,
        !           247:     kSCSIMsgClearQueue                 = 0x0e,
        !           248:     kSCSIMsgCmdComplete                        = 0x00,
        !           249:     kSCSIMsgDisconnect                 = 0x04,
        !           250:     kSCSIMsgIdentify                   = 0x80,
        !           251:     kSCSIMsgIgnoreWideResdue           = 0x23,
        !           252:     kSCSIMsgInitiateRecovery           = 0x0f,
        !           253:     kSCSIMsgInitiatorDetectedErr       = 0x05,
        !           254:     kSCSIMsgLinkedCmdComplete          = 0x0a,
        !           255:     kSCSIMsgLinkedCmdCompleteFlag      = 0x0b,
        !           256:     kSCSIMsgParityErr                  = 0x09,
        !           257:     kSCSIMsgRejectMsg                  = 0x07,
        !           258:     kSCSIMsgModifyDataPtr              = 0x00, /* Extended msg */
        !           259:     kSCSIMsgNop                                = 0x08,
        !           260:     kSCSIMsgHeadOfQueueTag             = 0x21, /* Two byte msg */
        !           261:     kSCSIMsgOrderedQueueTag            = 0x22, /* Two byte msg */
        !           262:     kSCSIMsgSimpleQueueTag             = 0x20, /* Two byte msg */
        !           263:     kSCSIMsgReleaseRecovery            = 0x10,
        !           264:     kSCSIMsgRestorePointers            = 0x03,
        !           265:     kSCSIMsgSaveDataPointers           = 0x02,
        !           266:     kSCSIMsgSyncXferReq                        = 0x01, /* Extended msg */
        !           267:     kSCSIMsgWideDataXferReq            = 0x03, /* Extended msg */
        !           268:     kSCSIMsgTerminateIOP               = 0x11,
        !           269:     kSCSIMsgExtended                   = 0x01,
        !           270:     kSCSIMsgEnableDisconnectMask       = 0x40,
        !           271: };
        !           272: 
        !           273: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.