| 1 | #pragma pack(1) | 
|---|
| 2 |  | 
|---|
| 3 | /* SRB command */ | 
|---|
| 4 | #define SRB_Inquiry     0x00 | 
|---|
| 5 | #define SRB_Device      0x01 | 
|---|
| 6 | #define SRB_Command     0x02 | 
|---|
| 7 | #define SRB_Abort       0x03 | 
|---|
| 8 | #define SRB_Reset       0x04 | 
|---|
| 9 | #define SRB_Param       0x05 | 
|---|
| 10 |  | 
|---|
| 11 | /* SRB status */ | 
|---|
| 12 | #define SRB_Busy        0x00    /* SCSI request in progress */ | 
|---|
| 13 | #define SRB_Done        0x01    /* SCSI request completed without error */ | 
|---|
| 14 | #define SRB_Aborted     0x02    /* SCSI aborted by host */ | 
|---|
| 15 | #define SRB_BadAbort    0x03    /* Unable to abort SCSI request */ | 
|---|
| 16 | #define SRB_Error       0x04    /* SCSI request completed with error */ | 
|---|
| 17 | #define SRB_BusyPost    0x10    /* SCSI request in progress with POST - Nokia */ | 
|---|
| 18 | #define SRB_InvalidCmd  0x80    /* Invalid SCSI request */ | 
|---|
| 19 | #define SRB_InvalidHA   0x81    /* Invalid Hhost adapter number */ | 
|---|
| 20 | #define SRB_BadDevice   0x82    /* SCSI device not installed */ | 
|---|
| 21 |  | 
|---|
| 22 | /* SRB flags */ | 
|---|
| 23 | #define SRB_Post        0x01    /* Post vector valid */ | 
|---|
| 24 | #define SRB_Link        0x02    /* Link vector valid */ | 
|---|
| 25 | #define SRB_SG          0x04    /* Nokia: scatter/gather */ | 
|---|
| 26 | /* S/G: n * (4 bytes length, 4 bytes addr) */ | 
|---|
| 27 | /* No of s/g items not limited by HA spec. */ | 
|---|
| 28 | #define SRB_NoCheck     0x00    /* determined by command, not checked  */ | 
|---|
| 29 | #define SRB_Read        0x08    /* target to host, length checked  */ | 
|---|
| 30 | #define SRB_Write       0x10    /* host to target, length checked  */ | 
|---|
| 31 | #define SRB_NoTransfer  0x18    /* no data transfer  */ | 
|---|
| 32 | #define SRB_DirMask     0x18    /* bit mask */ | 
|---|
| 33 |  | 
|---|
| 34 | /* SRB host adapter status */ | 
|---|
| 35 | #define SRB_NoError     0x00    /* No host adapter detected error */ | 
|---|
| 36 | #define SRB_Timeout     0x11    /* Selection timeout */ | 
|---|
| 37 | #define SRB_DataLength  0x12    /* Data over/underrun */ | 
|---|
| 38 | #define SRB_BusFree     0x13    /* Unexpected bus free */ | 
|---|
| 39 | #define SRB_BusSequence 0x14    /* Target bus sequence failure */ | 
|---|
| 40 |  | 
|---|
| 41 | /* SRB target status field */ | 
|---|
| 42 | #define SRB_NoStatus    0x00    /* No target status */ | 
|---|
| 43 | #define SRB_CheckStatus 0x02    /* Check status (sense data valid) */ | 
|---|
| 44 | #define SRB_LUN_Busy    0x08    /* Specified LUN is busy */ | 
|---|
| 45 | #define SRB_Reserved    0x18    /* Reservation conflict */ | 
|---|
| 46 |  | 
|---|
| 47 | #define MaxCDBStatus    64      /* max size of CDB + status */ | 
|---|
| 48 |  | 
|---|
| 49 | typedef struct SRBOS2 SRBOS2; | 
|---|
| 50 | typedef struct SRBOS2 { | 
|---|
| 51 | unsigned char   cmd,                            /* 00 */ | 
|---|
| 52 | status,                         /* 01 */ | 
|---|
| 53 | ha_num,                         /* 02 */ | 
|---|
| 54 | flags;                          /* 03 */ | 
|---|
| 55 | unsigned long   res_04_07;                      /* 04..07 */ | 
|---|
| 56 | union {                                         /* 08 */ | 
|---|
| 57 |  | 
|---|
| 58 | /* SRB_Inquiry */ | 
|---|
| 59 | struct { | 
|---|
| 60 | unsigned char   num_ha,         /* 08 */ | 
|---|
| 61 | ha_target,      /* 09 */ | 
|---|
| 62 | aspimgr_id[16], /* 0A..19 */ | 
|---|
| 63 | host_id[16],    /* 1A..29 */ | 
|---|
| 64 | unique_id[16];  /* 2A..39 */ | 
|---|
| 65 | } inq; | 
|---|
| 66 |  | 
|---|
| 67 | /* SRB_Device */ | 
|---|
| 68 | struct { | 
|---|
| 69 | unsigned char   target,         /* 08 */ | 
|---|
| 70 | lun,            /* 09 */ | 
|---|
| 71 | devtype;        /* 0A */ | 
|---|
| 72 | } dev; | 
|---|
| 73 |  | 
|---|
| 74 | /* SRB_Command */ | 
|---|
| 75 | struct { | 
|---|
| 76 | unsigned char   target,         /* 08 */ | 
|---|
| 77 | lun;            /* 09 */ | 
|---|
| 78 | unsigned long   data_len;       /* 0A..0D */ | 
|---|
| 79 | unsigned char   sense_len;      /* 0E */ | 
|---|
| 80 | void * _Seg16     data_ptr;       /* 0F..12 */ | 
|---|
| 81 | void * _Seg16     link_ptr;       /* 13..16 */ | 
|---|
| 82 | unsigned char   cdb_len,        /* 17 */ | 
|---|
| 83 | ha_status,      /* 18 */ | 
|---|
| 84 | target_status;  /* 19 */ | 
|---|
| 85 | void    (* _Seg16 post) (SRBOS2 *);  /* 1A..1D */ | 
|---|
| 86 | unsigned char   res_1E_29[12];  /* 1E..29 */ | 
|---|
| 87 | unsigned char   res_2A_3F[22];  /* 2A..3F */ | 
|---|
| 88 | unsigned char   cdb_st[64];     /* 40..7F CDB+status */ | 
|---|
| 89 | unsigned char   res_80_BF[64];  /* 80..BF */ | 
|---|
| 90 | } cmd; | 
|---|
| 91 |  | 
|---|
| 92 | /* SRB_Abort */ | 
|---|
| 93 | struct { | 
|---|
| 94 | void * _Seg16     srb;            /* 08..0B */ | 
|---|
| 95 | } abt; | 
|---|
| 96 |  | 
|---|
| 97 | /* SRB_Reset */ | 
|---|
| 98 | struct { | 
|---|
| 99 | unsigned char   target,         /* 08 */ | 
|---|
| 100 | lun,            /* 09 */ | 
|---|
| 101 | res_0A_17[14],  /* 0A..17 */ | 
|---|
| 102 | ha_status,      /* 18 */ | 
|---|
| 103 | target_status;  /* 19 */ | 
|---|
| 104 | } res; | 
|---|
| 105 |  | 
|---|
| 106 | /* SRB_Param - unused by ASPI4OS2 */ | 
|---|
| 107 | struct { | 
|---|
| 108 | unsigned char   unique[16];     /* 08..17 */ | 
|---|
| 109 | } par; | 
|---|
| 110 |  | 
|---|
| 111 | } u; | 
|---|
| 112 | } SRBOS2; | 
|---|
| 113 |  | 
|---|
| 114 |  | 
|---|
| 115 | // SCSI sense codes | 
|---|
| 116 | // Note! This list may not be complete. I did this compilation for use with tape drives. | 
|---|
| 117 |  | 
|---|
| 118 | #define Sense_Current   0x70;   // Current Error | 
|---|
| 119 | #define Sense_Deferred  0x71;   // Deferred Error | 
|---|
| 120 | #define Sense_Filemark  0x80;   // Filemark detected | 
|---|
| 121 | #define Sense_EOM       0x40;   // End of medium detected | 
|---|
| 122 | #define Sense_ILI       0x20;   // Incorrect length indicator | 
|---|
| 123 |  | 
|---|
| 124 | // Sense Keys | 
|---|
| 125 |  | 
|---|
| 126 | #define SK_NoSense      0x00;   // No Sense | 
|---|
| 127 | #define SK_RcvrdErr     0x01;   // Recovered Error | 
|---|
| 128 | #define SK_NotReady     0x02;   // Not ready | 
|---|
| 129 | #define SK_MedErr       0x03;   // Medium Error | 
|---|
| 130 | #define SK_HWErr        0x04;   // Hardware Error | 
|---|
| 131 | #define SK_IllReq       0x05;   // Illegal Request | 
|---|
| 132 | #define SK_UnitAtt      0x06;   // Unit attention | 
|---|
| 133 | #define SK_DataProt     0x07:   // Data Protect | 
|---|
| 134 | #define SK_BlankChk     0x08:   // Blank Check | 
|---|
| 135 | #define SK_VndSpec      0x09;   // Vendor Specific | 
|---|
| 136 | #define SK_CopyAbort    0x0A;   // Copy Aborted | 
|---|
| 137 | #define SK_AbtdCmd      0x0B;   // Aborted Command | 
|---|
| 138 | #define SK_Equal        0x0C;   // Equal | 
|---|
| 139 | #define SK_VolOvfl      0x0D;   // Volume Overflow | 
|---|
| 140 | #define SK_MisComp      0x0E;   // Miscompare | 
|---|
| 141 | #define SK_Reserved     0x0F;   // Reserved | 
|---|
| 142 |  | 
|---|
| 143 |  | 
|---|