1 #ifndef __ASPI16_H_ 2 #define __ASPI16_H_ 3 4 #define PACKED __attribute__((packed)) 5 #define FAR 6 typedef unsigned char BYTE; 7 typedef unsigned short WORD; 8 typedef unsigned long DWORD; 9 10 //***************************************************************************** 11 // %%% SCSI MISCELLANEOUS EQUATES %%% 12 //***************************************************************************** 13 14 #define SENSE_LEN 14 // Default sense buffer length 15 #define SRB_DIR_SCSI 0x00 // Direction determined by SCSI 16 #define SRB_POSTING 0x01 // Enable ASPI posting 17 #define SRB_ENABLE_RESIDUAL_COUNT 0x04 // Enable residual byte count reporting 18 #define SRB_DIR_IN 0x08 // Transfer from SCSI target to host 19 #define SRB_DIR_OUT 0x10 // Transfer from host to SCSI target 20 21 //***************************************************************************** 22 // %%% ASPI Command Definitions %%% 23 //***************************************************************************** 24 25 #define SC_HA_INQUIRY 0x00 // Host adapter inquiry 26 #define SC_GET_DEV_TYPE 0x01 // Get device type 27 #define SC_EXEC_SCSI_CMD 0x02 // Execute SCSI command 28 #define SC_ABORT_SRB 0x03 // Abort an SRB 29 #define SC_RESET_DEV 0x04 // SCSI bus device reset 30 #define SC_SET_HA_PARMS 0x05 // Set HA parameters 31 #define SC_GET_DISK_INFO 0x06 // Get Disk information 32 33 //***************************************************************************** 34 // %%% SRB Status %%% 35 //***************************************************************************** 36 37 #define SS_PENDING 0x00 // SRB being processed 38 #define SS_COMP 0x01 // SRB completed without error 39 #define SS_ABORTED 0x02 // SRB aborted 40 #define SS_ABORT_FAIL 0x03 // Unable to abort SRB 41 #define SS_ERR 0x04 // SRB completed with error 42 43 #define SS_INVALID_CMD 0x80 // Invalid ASPI command 44 #define SS_INVALID_HA 0x81 // Invalid host adapter number 45 #define SS_NO_DEVICE 0x82 // SCSI device not installed 46 47 //***************************************************************************** 48 // %%% Host Adapter Status %%% 49 //***************************************************************************** 50 51 #define HASTAT_OK 0x00 // Host adapter did not detect an // error 52 #define HASTAT_SEL_TO 0x11 // Selection Timeout 53 #define HASTAT_DO_DU 0x12 // Data overrun data underrun 54 #define HASTAT_BUS_FREE 0x13 // Unexpected bus free 55 #define HASTAT_PHASE_ERR 0x14 // Target bus phase sequence // failure 56 #define HASTAT_TIMEOUT 0x09 // Timed out while SRB was waiting to beprocessed. 57 #define HASTAT_COMMAND_TIMEOUT 0x0B // Adapter timed out processing SRB. 58 #define HASTAT_MESSAGE_REJECT 0x0D // While processing SRB, the // adapter received a MESSAGE 59 #define HASTAT_BUS_RESET 0x0E // A bus reset was detected. 60 #define HASTAT_PARITY_ERROR 0x0F // A parity error was detected. 61 #define HASTAT_REQUEST_SENSE_FAILED 0x10 // The adapter failed in issuing 62 63 typedef struct { 64 65 BYTE Cmd; // 00/000 ASPI command code = SC_EXEC_SCSI_CMD 66 BYTE Status; // 01/001 ASPI command status byte 67 BYTE HaId; // 02/002 ASPI host adapter number 68 BYTE Flags; // 03/003 ASPI request flags 69 DWORD Hdr_Rsvd; // 04/004 Reserved, MUST = 0 70 71 union { 72 73 struct { 74 75 BYTE Count; // 08/008 Number of host adapters present 76 BYTE SCSI_ID; // 09/009 SCSI ID of host adapter 77 BYTE ManagerId[16]; // 0A/010 String describing the manager 78 BYTE Identifier[16]; // 1A/026 String describing the host adapter 79 BYTE Unique[16]; // 2A/042 Host Adapter Unique parameters 80 BYTE ExtBuffer[8]; // 3A/058 Extended inquiry data 81 82 } PACKED HAInquiry; 83 84 struct { 85 86 BYTE Target; // 08/008 Target's SCSI ID 87 BYTE Lun; // 09/009 Target's LUN number 88 BYTE DeviceType; // 0A/010 Target's peripheral device type 89 90 } PACKED GetDeviceType; 91 92 struct { 93 94 BYTE Target; // 08/008 Target's SCSI ID 95 BYTE Lun; // 09/009 Target's LUN number 96 DWORD BufLen; // 0A/010 Data Allocation Length 97 BYTE SenseLen; // 0E/014 Sense Allocation Length 98 BYTE FAR *BufPointer; // 0F/015 Data Buffer Pointer 99 DWORD Rsvd1; // 13/019 Reserved, MUST = 0 100 BYTE CDBLen; // 17/023 CDB Length = 6/10/12 101 BYTE HaStat; // 18/024 Host Adapter Status 102 BYTE TargStat; // 19/025 Target Status 103 VOID FAR *PostProc; // 1A/026 Post routine 104 BYTE Rsvd2[34]; // 1E/030 Reserved, MUST = 0 105 106 union { 107 108 struct { 109 110 BYTE CDBByte[6]; // 40/064 SCSI CDB 111 BYTE SenseArea[SENSE_LEN+2]; // 46/070 Request Sense buffer 112 113 } PACKED _6; 114 115 struct { 116 117 BYTE CDBByte[10]; // 40/064 SCSI CDB 118 BYTE SenseArea[SENSE_LEN+2]; // 4A/074 Request Sense buffer 119 120 } PACKED _10; 121 122 struct { 123 124 BYTE CDBByte[12]; // 40/064 SCSI CDB 125 BYTE SenseArea[SENSE_LEN+2]; // 4C/076 Request Sense buffer 126 127 } PACKED _12; 128 129 } PACKED CmdLen; 130 131 } PACKED ExecSCSICmd; 132 133 struct { 134 135 VOID FAR *SRBToAbort; // 08/008 Pointer to SRB to abort 136 137 } PACKED Abort; 138 139 struct { 140 141 BYTE Target; // 08/008 Target's SCSI ID 142 BYTE Lun; // 09/009 Target's LUN number 143 BYTE ResetRsvd1[14]; // 0A/010 Reserved, MUST = 0 144 BYTE HaStat; // 18/024 Host Adapter Status 145 BYTE TargStat; // 19/025 Target Status 146 VOID FAR *PostProc; // 1A/026 Post routine 147 BYTE ResetRsvd2[34]; // 1E/030 Reserved, MUST = 0 148 149 } Reset; 150 151 } PACKED Type; 152 153 } PACKED SRB; 154 155 #endif //__ASPI16_H_ 156