1 /* 2 Copyright 1999, Be Incorporated. All Rights Reserved. 3 This file may be used under the terms of the Be Sample Code License. 4 */ 5 6 /* 7 ** 53c8xx Driver - Data structures and shared constants 8 */ 9 10 /* status codes signaled from SCRIPTS to driver */ 11 #define status_ready 0x10 // idle loop interrupted by driver 12 #define status_reselected 0x11 // select or idle interrupted by reselection 13 #define status_timeout 0x12 // select timed out 14 #define status_selected 0x13 // select succeeded 15 #define status_complete 0x14 // transaction completed 16 #define status_disconnect 0x15 // device disconnected in the middle 17 #define status_badstatus 0x16 // snafu in the status phase 18 #define status_overrun 0x17 // data overrun occurred 19 #define status_underrun 0x18 // data underrun occurred 20 #define status_badphase 0x19 // weird phase transition occurred 21 #define status_badmsg 0x1a // bad msg received 22 #define status_badextmsg 0x1b // bad extended msg received 23 #define status_selftest 0x1c // used by selftest stub 24 #define status_iocomplete 0x1d 25 #define status_syncin 0x1e 26 #define status_widein 0x1f 27 #define status_ignore_residue 0x20 28 29 /* status codes private to driver */ 30 #define status_inactive 0x00 // no request pending 31 #define status_queued 0x01 // start request is in the startqueue 32 #define status_selecting 0x02 // attempting to select 33 #define status_active 0x03 // SCRIPTS is handling it 34 #define status_waiting 0x04 // Waiting for reselection 35 36 #define OP_NDATA_IN 0x09000000L 37 #define OP_NDATA_OUT 0x08000000L 38 #define OP_WDATA_IN 0x01000000L 39 #define OP_WDATA_OUT 0x00000000L 40 41 #define OP_END 0x98080000L 42 #define ARG_END (status_iocomplete) 43 44 typedef struct 45 { 46 uint32 count; 47 uint32 address; 48 } SymInd; 49 50 #define PATCH_DATAIN ((Ent_do_datain/4) + 1) 51 #define PATCH_DATAOUT ((Ent_do_dataout/4) + 1) 52 53 54 #define ctxt_device 0 55 #define ctxt_sendmsg 1 56 #define ctxt_recvmsg 2 57 #define ctxt_extdmsg 3 58 #define ctxt_syncmsg 4 59 #define ctxt_status 5 60 #define ctxt_command 6 61 #define ctxt_widemsg 7 62 #define ctxt_program 8 63 64 typedef struct 65 { 66 uchar _command[12]; /* 0 - 11 */ 67 uchar _syncmsg[2]; /* 12 - 13 */ 68 uchar _widemsg[2]; /* 14 - 15 */ 69 uchar _sendmsg[8]; /* 16 - 23 */ 70 uchar _recvmsg[1]; /* 24 */ 71 uchar _extdmsg[1]; /* 25 */ 72 uchar _status[1]; /* 26 */ 73 uchar _padding[1]; /* 27 */ 74 75 SymInd device; /* 28 */ 76 SymInd sendmsg; /* 36 */ 77 SymInd recvmsg; /* 44 */ 78 SymInd extdmsg; /* 52 */ 79 SymInd syncmsg; /* 60 */ 80 SymInd status; /* 68 */ 81 SymInd command; /* 76 */ 82 SymInd widemsg; /* 84 */ 83 84 /* MUST be dword aligned! */ 85 SymInd table[131]; /* 92 --- 129 entries, 1 eot, 1 scratch */ 86 } SymPriv; 87 88 #define ADJUST_PRIV_TO_DSA 28 89 #define ADJUST_PRIV_TO_TABLE 92 90 91 typedef struct _SymTarg 92 { 93 struct _Symbios *adapter; 94 struct _SymTarg *next; 95 96 uchar device[4]; /* symbios register defs for the device */ 97 int sem_targ; /* mutex allowing only one req per target */ 98 int sem_done; /* notification semaphore */ 99 CCB_SCSIIO *ccb; /* ccb for the current request for this target or NULL */ 100 101 SymPriv *priv; /* priv data area within ccb */ 102 uint32 priv_phys; /* physical address of priv */ 103 uint32 table_phys; /* physical address of sgtable */ 104 uint32 datain_phys; 105 uint32 dataout_phys; 106 107 int inbound; /* read data from device */ 108 109 uint32 period; /* sync period */ 110 uint32 offset; /* sync offset */ 111 uint32 wide; 112 113 uint32 flags; 114 uint32 status; 115 uint32 id; 116 } SymTarg; 117 118 #define tf_ask_sync 0x0001 119 #define tf_ask_wide 0x0002 120 #define tf_is_sync 0x0010 121 #define tf_is_wide 0x0020 122 #define tf_ignore 0x0100 123 124 typedef struct _Symbios 125 { 126 uint32 num; /* card number */ 127 uint32 iobase; /* io base address */ 128 uint32 irq; /* assigned irq */ 129 130 char *name; /* device type name */ 131 uint32 host_targ_id; 132 uint32 max_targ_id; 133 int reset; 134 135 int registered; 136 137 uint32 *script; /* 1 page of on/offboard scripts ram */ 138 uint32 sram_phys; /* physical address thereof */ 139 140 SymTarg targ[16]; /* one targ descriptor per target */ 141 spinlock hwlock; /* lock protecting register access */ 142 143 SymTarg *startqueue; /* target being started */ 144 SymTarg *startqueuetail; 145 SymTarg *active; /* target currently being interacted with */ 146 /* null if IDLE, == startqueue if starting */ 147 148 enum { 149 OFFLINE, IDLE, START, ACTIVE, TEST 150 } status; 151 152 struct { 153 uint period; /* negotiated period */ 154 uint period_ns; /* configured period in ns */ 155 uchar scntl3; /* values for scntl3 SCF and CCF bits */ 156 uchar sxfer; /* values for xfer TP2-0 bits */ 157 } syncinfo[16]; 158 uint32 syncsize; /* number of syncinfo entries to look at */ 159 uint32 idmask; 160 161 uint32 scntl3; 162 uint32 sclk; /* SCLK in KHz */ 163 uint32 maxoffset; 164 165 uint32 op_in; 166 uint32 op_out; 167 } Symbios; 168