Annotation of uae/src/include/scg/scgcmd.h, revision 1.1

1.1     ! root        1: /* @(#)scgcmd.h        2.14 98/11/29 Copyright 1986 J. Schilling */
        !             2: /*
        !             3:  *     Definitions for the SCSI general driver 'scg'
        !             4:  *
        !             5:  *     Copyright (c) 1986 J. Schilling
        !             6:  */
        !             7: /*
        !             8:  * This program is free software; you can redistribute it and/or modify
        !             9:  * it under the terms of the GNU General Public License as published by
        !            10:  * the Free Software Foundation; either version 2, or (at your option)
        !            11:  * any later version.
        !            12:  *
        !            13:  * This program is distributed in the hope that it will be useful,
        !            14:  * but WITHOUT ANY WARRANTY; without even the implied warranty of
        !            15:  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        !            16:  * GNU General Public License for more details.
        !            17:  *
        !            18:  * You should have received a copy of the GNU General Public License
        !            19:  * along with this program; see the file COPYING.  If not, write to
        !            20:  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
        !            21:  */
        !            22: 
        !            23: #ifndef        _SCGCMD_H
        !            24: #define        _SCGCMD_H
        !            25: 
        !            26: #include "scg/utypes.h"
        !            27: #include "scg/btorder.h"
        !            28: 
        !            29: #if    defined(_BIT_FIELDS_LTOH)       /* Intel byteorder */
        !            30: #elif  defined(_BIT_FIELDS_HTOL)       /* Motorola byteorder */
        !            31: #else 
        !            32: /*
        !            33:  * #error will not work for all compilers (e.g. sunos4)
        !            34:  * The following line will abort compilation on all compilers
        !            35:  * if none of the above is defines. And that's  what we want.
        !            36:  */
        !            37: error  One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
        !            38: #endif
        !            39: 
        !            40: /*
        !            41:  * SCSI status completion block.
        !            42:  */
        !            43: #define        SCSI_EXTENDED_STATUS
        !            44: 
        !            45: #if    defined(_BIT_FIELDS_LTOH)       /* Intel byteorder */
        !            46: 
        !            47: struct scsi_status {
        !            48:        Ucbit   vu_00   : 1;    /* vendor unique */
        !            49:        Ucbit   chk     : 1;    /* check condition: sense data available */
        !            50:        Ucbit   cm      : 1;    /* condition met */
        !            51:        Ucbit   busy    : 1;    /* device busy or reserved */
        !            52:        Ucbit   is      : 1;    /* intermediate status sent */
        !            53:        Ucbit   vu_05   : 1;    /* vendor unique */
        !            54: #define st_scsi2       vu_05   /* SCSI-2 modifier bit */
        !            55:        Ucbit   vu_06   : 1;    /* vendor unique */
        !            56:        Ucbit   st_rsvd : 1;    /* reserved */
        !            57: 
        !            58: #ifdef SCSI_EXTENDED_STATUS
        !            59: #define        ext_st1 st_rsvd         /* extended status (next byte valid) */
        !            60:        /* byte 1 */
        !            61:        Ucbit   ha_er   : 1;    /* host adapter detected error */
        !            62:        Ucbit   reserved: 6;    /* reserved */
        !            63:        Ucbit   ext_st2 : 1;    /* extended status (next byte valid) */
        !            64:        /* byte 2 */
        !            65:        u_char  byte2;          /* third byte */
        !            66: #endif /* SCSI_EXTENDED_STATUS */
        !            67: };
        !            68: 
        !            69: #else  /* Motorola byteorder */
        !            70: 
        !            71: struct scsi_status {
        !            72:        Ucbit   st_rsvd : 1;    /* reserved */
        !            73:        Ucbit   vu_06   : 1;    /* vendor unique */
        !            74:        Ucbit   vu_05   : 1;    /* vendor unique */
        !            75: #define st_scsi2       vu_05   /* SCSI-2 modifier bit */
        !            76:        Ucbit   is      : 1;    /* intermediate status sent */
        !            77:        Ucbit   busy    : 1;    /* device busy or reserved */
        !            78:        Ucbit   cm      : 1;    /* condition met */
        !            79:        Ucbit   chk     : 1;    /* check condition: sense data available */
        !            80:        Ucbit   vu_00   : 1;    /* vendor unique */
        !            81: #ifdef SCSI_EXTENDED_STATUS
        !            82: #define        ext_st1 st_rsvd         /* extended status (next byte valid) */
        !            83:        /* byte 1 */
        !            84:        Ucbit   ext_st2 : 1;    /* extended status (next byte valid) */
        !            85:        Ucbit   reserved: 6;    /* reserved */
        !            86:        Ucbit   ha_er   : 1;    /* host adapter detected error */
        !            87:        /* byte 2 */
        !            88:        u_char  byte2;          /* third byte */
        !            89: #endif /* SCSI_EXTENDED_STATUS */
        !            90: };
        !            91: #endif
        !            92: 
        !            93: /*
        !            94:  * OLD Standard (Non Extended) SCSI Sense. Used mainly by the
        !            95:  * Adaptec ACB 4000 which is the only controller that
        !            96:  * does not support the Extended sense format.
        !            97:  */
        !            98: #if    defined(_BIT_FIELDS_LTOH)       /* Intel byteorder */
        !            99: 
        !           100: struct scsi_sense {            /* scsi sense for error classes 0-6 */
        !           101:        Ucbit   code    : 7;    /* error class/code */
        !           102:        Ucbit   adr_val : 1;    /* sense data is valid */
        !           103: #ifdef comment
        !           104:        Ucbit   high_addr:5;    /* high byte of block addr */
        !           105:        Ucbit   rsvd    : 3;
        !           106: #else
        !           107:        u_char  high_addr;      /* high byte of block addr */
        !           108: #endif
        !           109:        u_char  mid_addr;       /* middle byte of block addr */
        !           110:        u_char  low_addr;       /* low byte of block addr */
        !           111: };
        !           112: 
        !           113: #else  /* Motorola byteorder */
        !           114: 
        !           115: struct scsi_sense {            /* scsi sense for error classes 0-6 */
        !           116:        Ucbit   adr_val : 1;    /* sense data is valid */
        !           117:        Ucbit   code    : 7;    /* error class/code */
        !           118: #ifdef comment
        !           119:        Ucbit   rsvd    : 3;
        !           120:        Ucbit   high_addr:5;    /* high byte of block addr */
        !           121: #else
        !           122:        u_char  high_addr;      /* high byte of block addr */
        !           123: #endif
        !           124:        u_char  mid_addr;       /* middle byte of block addr */
        !           125:        u_char  low_addr;       /* low byte of block addr */
        !           126: };
        !           127: #endif
        !           128: 
        !           129: /*
        !           130:  * SCSI extended sense parameter block.
        !           131:  */
        !           132: #ifdef comment
        !           133: #define SC_CLASS_EXTENDED_SENSE 0x7     /* indicates extended sense */
        !           134: #endif
        !           135: 
        !           136: #if    defined(_BIT_FIELDS_LTOH)       /* Intel byteorder */
        !           137: 
        !           138: struct scsi_ext_sense {        /* scsi extended sense for error class 7 */
        !           139:        /* byte 0 */
        !           140:        Ucbit   type    : 7;    /* fixed at 0x70 */
        !           141:        Ucbit   adr_val : 1;    /* sense data is valid */
        !           142:        /* byte 1 */
        !           143:        u_char  seg_num;        /* segment number, applies to copy cmd only */
        !           144:        /* byte 2 */
        !           145:        Ucbit   key     : 4;    /* sense key, see below */
        !           146:        Ucbit           : 1;    /* reserved */
        !           147:        Ucbit   ili     : 1;    /* incorrect length indicator */
        !           148:        Ucbit   eom     : 1;    /* end of media */
        !           149:        Ucbit   fil_mk  : 1;    /* file mark on device */
        !           150:        /* bytes 3 through 7 */
        !           151:        u_char  info_1;         /* information byte 1 */
        !           152:        u_char  info_2;         /* information byte 2 */
        !           153:        u_char  info_3;         /* information byte 3 */
        !           154:        u_char  info_4;         /* information byte 4 */
        !           155:        u_char  add_len;        /* number of additional bytes */
        !           156:        /* bytes 8 through 13, CCS additions */
        !           157:        u_char  optional_8;     /* CCS search and copy only */
        !           158:        u_char  optional_9;     /* CCS search and copy only */
        !           159:        u_char  optional_10;    /* CCS search and copy only */
        !           160:        u_char  optional_11;    /* CCS search and copy only */
        !           161:        u_char  sense_code;     /* sense code */
        !           162:        u_char  qual_code;      /* sense code qualifier */
        !           163:        u_char  fru_code;       /* Field replacable unit code */
        !           164:        Ucbit   bptr    : 3;    /* bit pointer for failure (if bpv) */
        !           165:        Ucbit   bpv     : 1;    /* bit pointer is valid */
        !           166:        Ucbit           : 2;
        !           167:        Ucbit   cd      : 1;    /* pointers refer to command not data */
        !           168:        Ucbit   sksv    : 1;    /* sense key specific valid */
        !           169:        u_char  field_ptr[2];   /* field pointer for failure */
        !           170:        u_char  add_info[2];    /* round up to 20 bytes */
        !           171: };
        !           172: 
        !           173: #else  /* Motorola byteorder */
        !           174: 
        !           175: struct scsi_ext_sense {        /* scsi extended sense for error class 7 */
        !           176:        /* byte 0 */
        !           177:        Ucbit   adr_val : 1;    /* sense data is valid */
        !           178:        Ucbit   type    : 7;    /* fixed at 0x70 */
        !           179:        /* byte 1 */
        !           180:        u_char  seg_num;        /* segment number, applies to copy cmd only */
        !           181:        /* byte 2 */
        !           182:        Ucbit   fil_mk  : 1;    /* file mark on device */
        !           183:        Ucbit   eom     : 1;    /* end of media */
        !           184:        Ucbit   ili     : 1;    /* incorrect length indicator */
        !           185:        Ucbit           : 1;    /* reserved */
        !           186:        Ucbit   key     : 4;    /* sense key, see below */
        !           187:        /* bytes 3 through 7 */
        !           188:        u_char  info_1;         /* information byte 1 */
        !           189:        u_char  info_2;         /* information byte 2 */
        !           190:        u_char  info_3;         /* information byte 3 */
        !           191:        u_char  info_4;         /* information byte 4 */
        !           192:        u_char  add_len;        /* number of additional bytes */
        !           193:        /* bytes 8 through 13, CCS additions */
        !           194:        u_char  optional_8;     /* CCS search and copy only */
        !           195:        u_char  optional_9;     /* CCS search and copy only */
        !           196:        u_char  optional_10;    /* CCS search and copy only */
        !           197:        u_char  optional_11;    /* CCS search and copy only */
        !           198:        u_char  sense_code;     /* sense code */
        !           199:        u_char  qual_code;      /* sense code qualifier */
        !           200:        u_char  fru_code;       /* Field replacable unit code */
        !           201:        Ucbit   sksv    : 1;    /* sense key specific valid */
        !           202:        Ucbit   cd      : 1;    /* pointers refer to command not data */
        !           203:        Ucbit           : 2;
        !           204:        Ucbit   bpv     : 1;    /* bit pointer is valid */
        !           205:        Ucbit   bptr    : 3;    /* bit pointer for failure (if bpv) */
        !           206:        u_char  field_ptr[2];   /* field pointer for failure */
        !           207:        u_char  add_info[2];    /* round up to 20 bytes */
        !           208: };
        !           209: #endif
        !           210: 
        !           211: /*
        !           212:  * SCSI Operation codes. 
        !           213:  */
        !           214: #define SC_TEST_UNIT_READY     0x00
        !           215: #define SC_REZERO_UNIT         0x01
        !           216: #define SC_REQUEST_SENSE       0x03
        !           217: #define SC_FORMAT              0x04
        !           218: #define SC_FORMAT_TRACK                0x06
        !           219: #define SC_REASSIGN_BLOCK      0x07            /* CCS only */
        !           220: #define SC_SEEK                        0x0b
        !           221: #define SC_TRANSLATE           0x0f            /* ACB4000 only */
        !           222: #define SC_INQUIRY             0x12            /* CCS only */
        !           223: #define SC_MODE_SELECT         0x15
        !           224: #define SC_RESERVE             0x16
        !           225: #define SC_RELEASE             0x17
        !           226: #define SC_MODE_SENSE          0x1a
        !           227: #define SC_START               0x1b
        !           228: #define SC_READ_DEFECT_LIST    0x37            /* CCS only, group 1 */
        !           229: #define SC_READ_BUFFER          0x3c            /* CCS only, group 1 */
        !           230:        /*
        !           231:         * Note, these two commands use identical command blocks for all
        !           232:         * controllers except the Adaptec ACB 4000 which sets bit 1 of byte 1.
        !           233:         */
        !           234: #define SC_READ                        0x08
        !           235: #define SC_WRITE               0x0a
        !           236: #define SC_EREAD               0x28            /* 10 byte read */
        !           237: #define SC_EWRITE              0x2a            /* 10 byte write */
        !           238: #define SC_WRITE_VERIFY                0x2e            /* 10 byte write+verify */
        !           239: #define SC_WRITE_FILE_MARK     0x10
        !           240: #define SC_UNKNOWN             0xff            /* cmd list terminator */
        !           241: 
        !           242: 
        !           243: /*
        !           244:  * Messages that SCSI can send.
        !           245:  */
        !           246: #define SC_COMMAND_COMPLETE    0x00
        !           247: #define SC_SYNCHRONOUS         0x01
        !           248: #define SC_SAVE_DATA_PTR       0x02
        !           249: #define SC_RESTORE_PTRS                0x03
        !           250: #define SC_DISCONNECT          0x04
        !           251: #define SC_ABORT               0x06
        !           252: #define SC_MSG_REJECT          0x07
        !           253: #define SC_NO_OP               0x08
        !           254: #define SC_PARITY              0x09
        !           255: #define SC_IDENTIFY            0x80
        !           256: #define SC_DR_IDENTIFY         0xc0
        !           257: #define SC_DEVICE_RESET                0x0c
        !           258: 
        !           259: /*
        !           260:  * Standard SCSI control blocks.
        !           261:  * These go in or out over the SCSI bus.
        !           262:  */
        !           263: 
        !           264: #if    defined(_BIT_FIELDS_LTOH)       /* Intel byteorder */
        !           265: 
        !           266: struct scsi_g0cdb {            /* scsi group 0 command description block */
        !           267:        u_char  cmd;            /* command code */
        !           268:        Ucbit   high_addr : 5;  /* high part of block address */
        !           269:        Ucbit   lun       : 3;  /* logical unit number */
        !           270:        u_char  mid_addr;       /* middle part of block address */
        !           271:        u_char  low_addr;       /* low part of block address */
        !           272:        u_char  count;          /* transfer length */
        !           273:        Ucbit   link      : 1;  /* link (another command follows) */
        !           274:        Ucbit   fr        : 1;  /* flag request (interrupt at completion) */
        !           275:        Ucbit   rsvd      : 4;  /* reserved */
        !           276:        Ucbit   vu_56     : 1;  /* vendor unique (byte 5 bit 6) */
        !           277:        Ucbit   vu_57     : 1;  /* vendor unique (byte 5 bit 7) */
        !           278: };
        !           279: 
        !           280: #else  /* Motorola byteorder */
        !           281: 
        !           282: struct scsi_g0cdb {            /* scsi group 0 command description block */
        !           283:        u_char  cmd;            /* command code */
        !           284:        Ucbit   lun       : 3;  /* logical unit number */
        !           285:        Ucbit   high_addr : 5;  /* high part of block address */
        !           286:        u_char  mid_addr;       /* middle part of block address */
        !           287:        u_char  low_addr;       /* low part of block address */
        !           288:        u_char  count;          /* transfer length */
        !           289:        Ucbit   vu_57     : 1;  /* vendor unique (byte 5 bit 7) */
        !           290:        Ucbit   vu_56     : 1;  /* vendor unique (byte 5 bit 6) */
        !           291:        Ucbit   rsvd      : 4;  /* reserved */
        !           292:        Ucbit   fr        : 1;  /* flag request (interrupt at completion) */
        !           293:        Ucbit   link      : 1;  /* link (another command follows) */
        !           294: };
        !           295: #endif
        !           296: 
        !           297: #if    defined(_BIT_FIELDS_LTOH)       /* Intel byteorder */
        !           298: 
        !           299: struct scsi_g1cdb {            /* scsi group 1 command description block */
        !           300:        u_char  cmd;            /* command code */
        !           301:        Ucbit   reladr    : 1;  /* address is relative */
        !           302:        Ucbit   res       : 4;  /* reserved bits 1-4 of byte 1 */
        !           303:        Ucbit   lun       : 3;  /* logical unit number */
        !           304:        u_char  addr[4];        /* logical block address */
        !           305:        u_char  res6;           /* reserved byte 6 */
        !           306:        u_char  count[2];       /* transfer length */
        !           307:        Ucbit   link      : 1;  /* link (another command follows) */
        !           308:        Ucbit   fr        : 1;  /* flag request (interrupt at completion) */
        !           309:        Ucbit   rsvd      : 4;  /* reserved */
        !           310:        Ucbit   vu_96     : 1;  /* vendor unique (byte 5 bit 6) */
        !           311:        Ucbit   vu_97     : 1;  /* vendor unique (byte 5 bit 7) */
        !           312: };
        !           313: 
        !           314: #else  /* Motorola byteorder */
        !           315: 
        !           316: struct scsi_g1cdb {            /* scsi group 1 command description block */
        !           317:        u_char  cmd;            /* command code */
        !           318:        Ucbit   lun       : 3;  /* logical unit number */
        !           319:        Ucbit   res       : 4;  /* reserved bits 1-4 of byte 1 */
        !           320:        Ucbit   reladr    : 1;  /* address is relative */
        !           321:        u_char  addr[4];        /* logical block address */
        !           322:        u_char  res6;           /* reserved byte 6 */
        !           323:        u_char  count[2];       /* transfer length */
        !           324:        Ucbit   vu_97     : 1;  /* vendor unique (byte 5 bit 7) */
        !           325:        Ucbit   vu_96     : 1;  /* vendor unique (byte 5 bit 6) */
        !           326:        Ucbit   rsvd      : 4;  /* reserved */
        !           327:        Ucbit   fr        : 1;  /* flag request (interrupt at completion) */
        !           328:        Ucbit   link      : 1;  /* link (another command follows) */
        !           329: };
        !           330: #endif
        !           331: 
        !           332: #if    defined(_BIT_FIELDS_LTOH)       /* Intel byteorder */
        !           333: 
        !           334: struct scsi_g5cdb {            /* scsi group 5 command description block */
        !           335:        u_char  cmd;            /* command code */
        !           336:        Ucbit   reladr    : 1;  /* address is relative */
        !           337:        Ucbit   res       : 4;  /* reserved bits 1-4 of byte 1 */
        !           338:        Ucbit   lun       : 3;  /* logical unit number */
        !           339:        u_char  addr[4];        /* logical block address */
        !           340:        u_char  count[4];       /* transfer length */
        !           341:        u_char  res10;          /* reserved byte 10 */
        !           342:        Ucbit   link      : 1;  /* link (another command follows) */
        !           343:        Ucbit   fr        : 1;  /* flag request (interrupt at completion) */
        !           344:        Ucbit   rsvd      : 4;  /* reserved */
        !           345:        Ucbit   vu_B6     : 1;  /* vendor unique (byte B bit 6) */
        !           346:        Ucbit   vu_B7     : 1;  /* vendor unique (byte B bit 7) */
        !           347: };
        !           348: 
        !           349: #else  /* Motorola byteorder */
        !           350: 
        !           351: struct scsi_g5cdb {            /* scsi group 5 command description block */
        !           352:        u_char  cmd;            /* command code */
        !           353:        Ucbit   lun       : 3;  /* logical unit number */
        !           354:        Ucbit   res       : 4;  /* reserved bits 1-4 of byte 1 */
        !           355:        Ucbit   reladr    : 1;  /* address is relative */
        !           356:        u_char  addr[4];        /* logical block address */
        !           357:        u_char  count[4];       /* transfer length */
        !           358:        u_char  res10;          /* reserved byte 10 */
        !           359:        Ucbit   vu_B7     : 1;  /* vendor unique (byte B bit 7) */
        !           360:        Ucbit   vu_B6     : 1;  /* vendor unique (byte B bit 6) */
        !           361:        Ucbit   rsvd      : 4;  /* reserved */
        !           362:        Ucbit   fr        : 1;  /* flag request (interrupt at completion) */
        !           363:        Ucbit   link      : 1;  /* link (another command follows) */
        !           364: };
        !           365: #endif
        !           366: 
        !           367: #define        SC_G0_CDBLEN    6       /* Len of Group 0 commands */
        !           368: #define        SC_G1_CDBLEN    10      /* Len of Group 1 commands */
        !           369: #define        SC_G5_CDBLEN    12      /* Len of Group 5 commands */
        !           370: 
        !           371: #define        SCG_MAX_CMD     24      /* 24 bytes max. size is supported */
        !           372: #define        SCG_MAX_STATUS  3       /* XXX (sollte 4 allign.) Mamimum Status Len */
        !           373: #define        SCG_MAX_SENSE   32      /* Mamimum Sense Len for auto Req. Sense */
        !           374: 
        !           375: #define        DEF_SENSE_LEN   16      /* Default Sense Len */
        !           376: #define        CCS_SENSE_LEN   18      /* Sense Len for CCS compatible devices */
        !           377: 
        !           378: struct scg_cmd {
        !           379:        caddr_t addr;                   /* Address of data in user space */
        !           380:        int     size;                   /* DMA count for data transfer */
        !           381:        int     flags;                  /* see below for definition */
        !           382:        int     cdb_len;                /* Size of SCSI command in bytes */
        !           383:                                        /* NOTE: rel 4 uses this field only */
        !           384:                                        /* with commands not in group 1 or 2*/
        !           385:        int     sense_len;              /* for intr() if -1 don't get sense */
        !           386:        int     timeout;                /* timeout in seconds */
        !           387:                                        /* NOTE: actual resolution depends */
        !           388:                                        /* on driver implementation */
        !           389:        int     kdebug;                 /* driver kernel debug level */
        !           390:        int     resid;                  /* Bytes not transfered */
        !           391:        int     error;                  /* Error code from scgintr() */
        !           392:        int     ux_errno;               /* UNIX error code */
        !           393: #ifdef comment
        !           394: XXX    struct  scsi_status scb; ???    /* Status returnd by command */
        !           395: #endif
        !           396:        union {
        !           397:                struct  scsi_status Scb;/* Status returnd by command */
        !           398:                u_char  cmd_scb[SCG_MAX_STATUS];
        !           399:        } u_scb;
        !           400: #define        scb     u_scb.Scb
        !           401: #ifdef comment
        !           402: XXX    struct  scsi_sense sense; ???   /* Sense bytes from command */
        !           403: #endif
        !           404:        union {
        !           405:                struct  scsi_sense Sense;/* Sense bytes from command */
        !           406:                u_char  cmd_sense[SCG_MAX_SENSE];
        !           407:        } u_sense;
        !           408: #define        sense   u_sense.Sense
        !           409:        int     sense_count;            /* Number of bytes valid in sense */
        !           410:        int     target;                 /* SCSI target id */
        !           411:        union {                         /* SCSI command descriptor block */
        !           412:                struct  scsi_g0cdb g0_cdb;
        !           413:                struct  scsi_g1cdb g1_cdb;
        !           414:                struct  scsi_g5cdb g5_cdb;
        !           415:                u_char  cmd_cdb[SCG_MAX_CMD];
        !           416:        } cdb;                          /* 24 bytes max. size is supported */
        !           417: };
        !           418: 
        !           419: #define        dma_read        flags           /* 1 if DMA to Sun, 0 otherwise */
        !           420: 
        !           421: /*
        !           422:  * definition for flags field in scg_cmd struct
        !           423:  */
        !           424: #define        SCG_RECV_DATA   0x0001          /* DMA direction to Sun */
        !           425: #define        SCG_DISRE_ENA   0x0002          /* enable disconnect/reconnect */
        !           426: #define        SCG_SILENT      0x0004          /* be silent on errors */
        !           427: #define        SCG_CMD_RETRY   0x0008          /* enable retries */
        !           428: #define        SCG_NOPARITY    0x0010          /* disable parity for this command */
        !           429: 
        !           430: /*
        !           431:  * definition for error field in scg_cmd struct
        !           432:  *
        !           433:  * The codes refer to SCSI general errors, not to device
        !           434:  * specific errors.  Device specific errors are discovered
        !           435:  * by checking the sense data.
        !           436:  * The distinction between retryable and fatal is somewhat ad hoc.
        !           437:  */
        !           438: #define SCG_NO_ERROR   0               /* cdb transported without error */
        !           439: #define SCG_RETRYABLE  1               /* any other case */
        !           440: #define SCG_FATAL      2               /* could not select target */
        !           441: #define SCG_TIMEOUT    3               /* driver timed out */
        !           442: 
        !           443: #define        g0_cdbaddr(cdb, a)      ((cdb)->high_addr = (a) >> 16,\
        !           444:                                 (cdb)->mid_addr = ((a) >> 8) & 0xFF,\
        !           445:                                 (cdb)->low_addr = (a) & 0xFF)
        !           446: 
        !           447: #define        g1_cdbaddr(cdb, a)      ((cdb)->addr[0] = (a) >> 24,\
        !           448:                                 (cdb)->addr[1] = ((a) >> 16)& 0xFF,\
        !           449:                                 (cdb)->addr[2] = ((a) >> 8) & 0xFF,\
        !           450:                                 (cdb)->addr[3] = (a) & 0xFF)
        !           451: 
        !           452: #define g5_cdbaddr(cdb, a)     g1_cdbaddr(cdb, a)
        !           453: 
        !           454: #define        g0_cdblen(cdb, len)     ((cdb)->count = (len))
        !           455: 
        !           456: #define        g1_cdblen(cdb, len)     ((cdb)->count[0] = ((len) >> 8) & 0xFF,\
        !           457:                                 (cdb)->count[1] = (len) & 0xFF)
        !           458: 
        !           459: #define g5_cdblen(cdb, len)    ((cdb)->count[0] = (len) >> 24L,\
        !           460:                                 (cdb)->count[1] = ((len) >> 16L)& 0xFF,\
        !           461:                                 (cdb)->count[2] = ((len) >> 8L) & 0xFF,\
        !           462:                                 (cdb)->count[3] = (len) & 0xFF)
        !           463: 
        !           464: #define        i_to_long(a, i)         (((u_char *)(a))[0] = ((i) >> 24)& 0xFF,\
        !           465:                                 ((u_char *)(a))[1] = ((i) >> 16)& 0xFF,\
        !           466:                                 ((u_char *)(a))[2] = ((i) >> 8) & 0xFF,\
        !           467:                                 ((u_char *)(a))[3] = (i) & 0xFF)
        !           468: 
        !           469: #define        i_to_3_byte(a, i)       (((u_char *)(a))[0] = ((i) >> 16)& 0xFF,\
        !           470:                                 ((u_char *)(a))[1] = ((i) >> 8) & 0xFF,\
        !           471:                                 ((u_char *)(a))[2] = (i) & 0xFF)
        !           472: 
        !           473: #define        i_to_4_byte(a, i)       (((u_char *)(a))[0] = ((i) >> 24)& 0xFF,\
        !           474:                                 ((u_char *)(a))[1] = ((i) >> 16)& 0xFF,\
        !           475:                                 ((u_char *)(a))[2] = ((i) >> 8) & 0xFF,\
        !           476:                                 ((u_char *)(a))[3] = (i) & 0xFF)
        !           477: 
        !           478: #define        i_to_short(a, i)        (((u_char *)(a))[0] = ((i) >> 8) & 0xFF,\
        !           479:                                 ((u_char *)(a))[1] = (i) & 0xFF)
        !           480: 
        !           481: #define        a_to_u_short(a) ((unsigned short) \
        !           482:                        ((((unsigned char*) a)[1]       & 0xFF) | \
        !           483:                         (((unsigned char*) a)[0] << 8  & 0xFF00)))
        !           484: 
        !           485: #define        a_to_3_byte(a)  ((unsigned long) \
        !           486:                        ((((unsigned char*) a)[2]       & 0xFF) | \
        !           487:                         (((unsigned char*) a)[1] << 8  & 0xFF00) | \
        !           488:                         (((unsigned char*) a)[0] << 16 & 0xFF0000)))
        !           489: 
        !           490: #ifdef __STDC__
        !           491: #define        a_to_u_long(a)  ((unsigned long) \
        !           492:                        ((((unsigned char*) a)[3]       & 0xFF) | \
        !           493:                         (((unsigned char*) a)[2] << 8  & 0xFF00) | \
        !           494:                         (((unsigned char*) a)[1] << 16 & 0xFF0000) | \
        !           495:                         (((unsigned char*) a)[0] << 24 & 0xFF000000UL)))
        !           496: #else
        !           497: #define        a_to_u_long(a)  ((unsigned long) \
        !           498:                        ((((unsigned char*) a)[3]       & 0xFF) | \
        !           499:                         (((unsigned char*) a)[2] << 8  & 0xFF00) | \
        !           500:                         (((unsigned char*) a)[1] << 16 & 0xFF0000) | \
        !           501:                         (((unsigned char*) a)[0] << 24 & 0xFF000000)))
        !           502: #endif
        !           503: 
        !           504: 
        !           505: /* Peripheral Device Type */
        !           506: 
        !           507: #define        SC_DASD                 0x00
        !           508: #define        SC_SEQD                 0x01
        !           509: #define        SC_PRTD                 0x02 
        !           510: #define        SC_PROCD                0x03 
        !           511: #define        SC_OPTD                 0x04
        !           512: #define        SC_ROMD                 0x05
        !           513: #define        SC_SCAN                 0x06
        !           514: #define        SC_OMEM                 0x07
        !           515: #define        SC_JUKE                 0x08
        !           516: #define        SC_COMM                 0x09
        !           517: #define        SC_NOTPR                0x7F
        !           518: 
        !           519: #endif /* _SCGCMD_H */

unix.superglobalmegacorp.com

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