Annotation of linux/kernel/blk_drv/scsi/scsi.h, revision 1.1.1.2

1.1       root        1: /*
                      2:  *     scsi.h Copyright (C) 1992 Drew Eckhardt 
                      3:  *     generic SCSI package header file by
                      4:  *             Drew Eckhardt 
                      5:  *
                      6:  *     <[email protected]>
                      7:  */
                      8: 
                      9: #ifndef _SCSI_H
                     10:        #define _SCSI_H
                     11: /*
1.1.1.2 ! root       12:        $Header: /usr/src/linux/kernel/blk_drv/scsi/RCS/scsi.h,v 1.1 1992/07/24 06:27:38 root Exp root $
1.1       root       13: 
                     14:        For documentation on the OPCODES, MESSAGES, and SENSE values,
                     15:        please consult the SCSI standard.
                     16: 
                     17: */
                     18: 
                     19: /*
                     20:        SCSI opcodes
                     21: */
                     22: 
                     23: #define TEST_UNIT_READY        0x00
                     24: #define REZERO_UNIT            0x01
                     25: #define REQUEST_SENSE          0x03
                     26: #define FORMAT_UNIT            0x04
                     27: #define REASSIGN_BLOCKS                0x07
                     28: #define READ_6                 0x08
                     29: #define WRITE_6                        0x0a
                     30: #define SEEK_6                 0x0b
                     31: #define INQUIRY                        0x12
                     32: #define MODE_SELECT            0x15
                     33: #define RESERVE                        0x16
                     34: #define RELEASE                        0x17
                     35: #define COPY                   0x18
                     36: #define MODE_SENSE             0x1a
                     37: #define START_STOP             0x1b
                     38: #define RECIEVE_DAIGNOSTIC     0x1c
                     39: #define SEND_DIAGNOSTIC                0x1d
                     40: #define ALLOW_MEDIUM_REMOVAL   0x1e
                     41: 
                     42: #define READ_CAPACITY          0x25
                     43: #define READ_10                        0x28
                     44: #define WRITE_10               0x2a
                     45: #define SEEK_10                        0x2b
                     46: #define WRITE_VERIFY           0x2e
                     47: #define VERIFY                 0x2f
                     48: #define SEARCH_HIGH            0x30
                     49: #define SEARCH_EQUAL           0x31
                     50: #define SEARCH_LOW             0x32
                     51: #define SET_LIMITS             0x33
                     52: #define COMPARE                        0x39
                     53: #define COPY_VERIFY            0x3a
                     54: 
                     55: #define COMMAND_SIZE(opcode) ((opcode) ? ((opcode) > 0x20 ? 10 : 6) : 0)
                     56: 
                     57: /*
                     58:        MESSAGE CODES
                     59: */
                     60: 
                     61: #define COMMAND_COMPLETE       0x00
                     62: #define EXTENDED_MESSAGE       0x01
                     63: #define SAVE_POINTERS          0x02
                     64: #define RESTORE_POINTERS       0x03
                     65: #define DISCONNECT             0x04
                     66: #define INITIATOR_ERROR                0x05
                     67: #define ABORT                  0x06
                     68: #define MESSAGE_REJECT         0x07
                     69: #define NOP                    0x08
                     70: #define MSG_PARITY_ERROR       0x09
                     71: #define LINKED_CMD_COMPLETE    0x0a
                     72: #define LINKED_FLG_CMD_COMPLETE        0x0b
                     73: #define BUS_DEVICE_RESET       0x0c
1.1.1.2 ! root       74: #define IDENTIFY_BASE          0x80
        !            75: #define IDENTIFY(can_disconnect, lun)   (IDENTIFY_BASE |\
        !            76:                                         ((can_disconnect) ?  0x40 : 0) |\
        !            77:                                         ((lun) & 0x07)) 
        !            78: 
        !            79:                                 
1.1       root       80: /*
                     81:        Status codes
                     82: */
                     83: 
                     84: #define GOOD                   0x00
                     85: #define CHECK_CONDITION                0x01
                     86: #define CONDITION_GOOD         0x02
                     87: #define BUSY                   0x04
                     88: #define INTERMEDIATE_GOOD      0x08
                     89: #define INTERMEDIATE_C_GOOD    0x0a
                     90: #define RESERVATION_CONFLICT   0x0c
                     91: 
                     92: #define STATUS_MASK            0x1e
                     93:        
                     94: /*
                     95:        the return of the status word will be in the following format :
                     96:        The low byte is the status returned by the SCSI command, 
                     97:        with vendor specific bits masked.
                     98: 
                     99:        The next byte is the message which followed the SCSI status.
                    100:        This allows a stos to be used, since the Intel is a little
                    101:        endian machine.
                    102: 
                    103:        The final byte is a host return code, which is one of the following.
                    104: 
                    105:        IE 
                    106:        lsb             msb
                    107:        status  msg     host code       
                    108: 
                    109:         Our errors returned by OUR driver, NOT SCSI message.  Orr'd with
                    110:         SCSI message passed back to driver <IF any>.
                    111: */
                    112: 
                    113: /*     NO error                                                        */
                    114: #define DID_OK                         0x00
                    115: /*     Couldn't connect before timeout period                          */
                    116: #define DID_NO_CONNECT         0x01
                    117: /*     BUS stayed busy through time out period                         */
                    118: #define DID_BUS_BUSY           0x02
                    119: /*     TIMED OUT for other reason                                      */
                    120: #define DID_TIME_OUT           0x03
                    121: /*     BAD target.                                                     */
                    122: #define DID_BAD_TARGET         0x04
                    123: /*     Told to abort for some other reason                             */
                    124: #define        DID_ABORT               0x05
                    125: /*
                    126:        Parity error
                    127: */
                    128: #define DID_PARITY             0x06
                    129: /*
                    130:        Internal error
                    131: */
                    132: #define DID_ERROR              0x07    
                    133: /*
                    134:        Reset by somebody.
                    135: */
                    136: #define DID_RESET              0x08
1.1.1.2 ! root      137: /*
        !           138:        Got an interrupt we weren't expecting.
        !           139: */
        !           140: #define        DID_BAD_INTR            0x09
1.1       root      141: 
                    142: /*
                    143:        Driver status
                    144: */ 
                    145: #define DRIVER_OK              0x00
                    146: 
                    147: /*
                    148:        These indicate the error that occured, and what is available.
                    149: */
                    150: 
                    151: #define DRIVER_BUSY            0x01
                    152: #define DRIVER_SOFT            0x02
                    153: #define DRIVER_MEDIA           0x03
                    154: #define DRIVER_ERROR           0x04    
                    155: 
                    156: #define DRIVER_INVALID         0x05
                    157: #define DRIVER_TIMEOUT         0x06
                    158: #define DRIVER_HARD            0x07
                    159: 
                    160: #define SUGGEST_RETRY          0x08
                    161: #define SUGGEST_ABORT          0x09 
                    162: #define SUGGEST_REMAP          0x0a
                    163: #define SUGGEST_DIE            0x0b
                    164: 
                    165: #define DRIVER_SENSE           0x10
                    166: 
                    167: #define DRIVER_MASK 0x0f
                    168: #define SUGGEST_MASK 0xf0
                    169: 
                    170: /*
                    171: 
                    172:        SENSE KEYS
                    173: */
                    174: 
                    175: #define NO_SENSE               0x00
                    176: #define RECOVERED_ERROR                0x01
                    177: #define NOT_READY              0x02
                    178: #define MEDIUM_ERROR           0x03
                    179: #define        HARDWARE_ERROR          0x04
                    180: #define ILLEGAL_REQUEST                0x05
                    181: #define UNIT_ATTENTION         0x06
                    182: #define DATA_PROTECT           0x07
                    183: #define BLANK_CHECK            0x08
                    184: #define COPY_ABORTED           0x0a
                    185: #define ABORTED_COMMAND                0x0b
                    186: #define        VOLUME_OVERFLOW         0x0d
                    187: #define MISCOMPARE             0x0e
                    188: 
                    189: 
                    190: /*
                    191:        DEVICE TYPES
                    192: 
                    193: */
                    194: 
                    195: #define TYPE_DISK      0x00
                    196: #define TYPE_TAPE      0x01
                    197: #define TYPE_WORM      0x04    /* Treated as ROM by our system */
                    198: #define TYPE_ROM       0x05
                    199: #define TYPE_NO_LUN    0x7f
                    200: /*
                    201:        Every SCSI command starts with a one byte OP-code.
                    202:        The next byte's high three bits are the LUN of the
                    203:        device.  Any multi-byte quantities are stored high byte
                    204:        first, and may have a 5 bit MSB in the same byte
                    205:        as the LUN.
                    206: */
                    207: 
                    208: 
                    209: /*
                    210:        The scsi_device struct contains what we know about each given scsi
                    211:        device.
                    212: */
                    213: 
                    214: typedef struct scsi_device {
                    215:        unsigned char host_no, id, lun;
                    216:        unsigned writeable:1;
                    217:        unsigned removable:1; 
                    218:        unsigned random:1;
                    219:        } Scsi_Device;
                    220: /*
                    221:        Use these to separate status msg and our bytes
                    222: */
                    223: 
                    224: #define status_byte(result) (((result) >> 1) & 0xf)
                    225: #define msg_byte(result) (((result) >> 8) & 0xff)
                    226: #define host_byte(result) (((result) >> 16) & 0xff)
                    227: #define driver_byte(result) (((result) >> 24) & 0xff)
                    228: #define sugestion(result) (driver_byte(result) & SUGGEST_MASK)
                    229: 
                    230: #define sense_class(sense) (((sense) >> 4) & 0x7)
                    231: #define sense_error(sense) ((sense) & 0xf)
                    232: #define sense_valid(sense) ((sense) & 0x80);
                    233: 
                    234: /*
                    235:        These are the SCSI devices available on the system.
                    236: */
                    237: 
1.1.1.2 ! root      238: #define MAX_SCSI_DEVICE 4
1.1       root      239: extern int NR_SCSI_DEVICES;
                    240: extern Scsi_Device scsi_devices[MAX_SCSI_DEVICE];
                    241: /*
                    242:        scsi_abort aborts the current command that is executing on host host.
                    243:        The error code, if non zero is returned in the host byte, otherwise 
                    244:        DID_ABORT is returned in the hostbyte.
                    245: */
                    246: 
                    247: extern int scsi_abort (int host, int code);
                    248: 
                    249: /*
                    250:        Initializes all SCSI devices.  This scans all scsi busses.
                    251: */
                    252: 
                    253: extern void scsi_dev_init (void);
                    254: 
                    255: /*
                    256:        You guesed it.  This sends a command to the selected SCSI host 
                    257: */
                    258: 
                    259: 
                    260: 
                    261: extern void scsi_do_cmd (int host,  unsigned char target, const void *cmnd ,
                    262:                   void *buffer, unsigned bufflen, void (*done)(int,int),
                    263:                   int timeout, unsigned  char *sense_buffer, int retries);
                    264: 
1.1.1.2 ! root      265: extern int scsi_reset (int host);
1.1       root      266: #endif

unix.superglobalmegacorp.com

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