VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / scsi / tmscsim.h
1 /***********************************************************************
2 ;*      File Name : TMSCSIM.H                                          *
3 ;*                  TEKRAM DC-390(T) PCI SCSI Bus Master Host Adapter  *
4 ;*                  Device Driver                                      *
5 ;***********************************************************************/
6 /* $Id: tmscsim.h,v 2.15.2.3 2000/11/17 20:52:27 garloff Exp $ */
7
8 #ifndef _TMSCSIM_H
9 #define _TMSCSIM_H
10
11 #include <linux/types.h>
12 #include <linux/config.h>
13
14 #define SCSI_IRQ_NONE 255
15
16 #define MAX_ADAPTER_NUM         4
17 #define MAX_SG_LIST_BUF         16      /* Not used */
18 #define MAX_CMD_PER_LUN         32
19 #define MAX_CMD_QUEUE           MAX_CMD_PER_LUN+MAX_CMD_PER_LUN/2+1     
20 #define MAX_SCSI_ID             8
21 #define MAX_SRB_CNT             MAX_CMD_QUEUE+1 /* Max number of started commands */
22
23 #define SEL_TIMEOUT             153     /* 250 ms selection timeout (@ 40 MHz) */
24
25 #define pci_dma_lo32(a)                 (a & 0xffffffff)
26
27 typedef u8              UCHAR;  /*  8 bits */
28 typedef u16             USHORT; /* 16 bits */
29 typedef u32             UINT;   /* 32 bits */
30 typedef unsigned long   ULONG;  /* 32/64 bits */
31
32
33 /*
34 ;-----------------------------------------------------------------------
35 ; SCSI Request Block
36 ;-----------------------------------------------------------------------
37 */
38 struct dc390_srb
39 {
40 //u8            CmdBlock[12];
41
42 struct dc390_srb        *pNextSRB;
43 struct dc390_dcb        *pSRBDCB;
44 struct scsi_cmnd        *pcmd;
45 struct scatterlist      *pSegmentList;
46
47 /* 0x10: */
48 struct scatterlist Segmentx;    /* make a one entry of S/G list table */
49
50 /* 0x1c: */
51 unsigned long   SGBusAddr;      /*;a segment starting address as seen by AM53C974A*/
52 unsigned long   SGToBeXferLen;  /*; to be xfer length */
53 unsigned long   TotalXferredLen;
54 unsigned long   SavedTotXLen;
55 u32             SRBState;
56
57 /* 0x30: */
58 u8              SRBStatus;
59 u8              SRBFlag;        /*; b0-AutoReqSense,b6-Read,b7-write */
60                                 /*; b4-settimeout,b5-Residual valid */
61 u8              AdaptStatus;
62 u8              TargetStatus;
63
64 u8              ScsiPhase;
65 u8              TagNumber;
66 u8              SGIndex;
67 u8              SGcount;
68
69 /* 0x38: */
70 u8              MsgCnt;
71 u8              EndMessage;
72 u8              RetryCnt;
73 u8              SavedSGCount;                   
74
75 unsigned long   Saved_Ptr;
76
77 /* 0x40: */
78 u8              MsgInBuf[6];
79 u8              MsgOutBuf[6];
80
81 //u8            IORBFlag;       /*;81h-Reset, 2-retry */
82 /* 0x4c: */
83 };
84
85
86 /*
87 ;-----------------------------------------------------------------------
88 ; Device Control Block
89 ;-----------------------------------------------------------------------
90 */
91 struct dc390_dcb
92 {
93 struct dc390_dcb        *pNextDCB;
94 struct dc390_acb        *pDCBACB;
95
96 /* 0x08: */
97 /* Queued SRBs */
98 struct dc390_srb        *pWaitingSRB;
99 struct dc390_srb        *pWaitLast;
100 struct dc390_srb        *pGoingSRB;
101 struct dc390_srb        *pGoingLast;
102 struct dc390_srb        *pActiveSRB;
103 u8              WaitSRBCnt;     /* Not used */
104 u8              GoingSRBCnt;
105
106 u8              DevType;
107 u8              MaxCommand;
108
109 /* 0x20: */
110 u32             TagMask;
111
112 u8              TargetID;       /*; SCSI Target ID  (SCSI Only) */
113 u8              TargetLUN;      /*; SCSI Log.  Unit (SCSI Only) */
114 u8              DevMode;
115 u8              DCBFlag;
116
117 u8              CtrlR1;
118 u8              CtrlR3;
119 u8              CtrlR4;
120 u8              Inquiry7;
121
122 /* 0x2c: */
123 u8              SyncMode;       /*; 0:async mode */
124 u8              NegoPeriod;     /*;for nego. */
125 u8              SyncPeriod;     /*;for reg. */
126 u8              SyncOffset;     /*;for reg. and nego.(low nibble) */
127
128 /* 0x30:*/
129 //u8            InqDataBuf[8];
130 //u8            CapacityBuf[8];
131 ///* 0x40: */
132 };
133
134
135 /*
136 ;-----------------------------------------------------------------------
137 ; Adapter Control Block
138 ;-----------------------------------------------------------------------
139 */
140 struct dc390_acb
141 {
142 struct Scsi_Host *pScsiHost;
143 struct dc390_acb        *pNextACB;
144 u16             IOPortBase;
145 u8              IRQLevel;
146 u8              status;
147
148 u8              SRBCount;
149 u8              AdapterIndex;   /*; nth Adapter this driver */
150 u8              DCBCnt;
151
152 u8              TagMaxNum;
153 u8              ACBFlag;
154 u8              Gmode2;
155 u8              scan_devices;
156
157 struct dc390_dcb        *pLinkDCB;
158 struct dc390_dcb        *pLastDCB;
159 struct dc390_dcb        *pDCBRunRobin;
160
161 struct dc390_dcb        *pActiveDCB;
162 struct dc390_srb        *pFreeSRB;
163 struct dc390_srb        *pTmpSRB;
164
165 u8              msgin123[4];
166 u8              DCBmap[MAX_SCSI_ID];
167 u8              Connected;
168 u8              pad;
169
170 #if defined(USE_SPINLOCKS) && USE_SPINLOCKS > 1 && (defined(CONFIG_SMP) || DEBUG_SPINLOCKS > 0)
171 spinlock_t      lock;
172 #endif
173 u8              sel_timeout;
174 u8              glitch_cfg;
175
176 u8              MsgLen;
177 u8              Ignore_IRQ;     /* Not used */
178
179 struct pci_dev  *pdev;
180
181 unsigned long   Cmds;
182 u32             SelLost;
183 u32             SelConn;
184 u32             CmdInQ;
185 u32             CmdOutOfSRB;
186         
187 struct timer_list       Waiting_Timer;
188
189 struct dc390_srb        TmpSRB;
190 struct dc390_srb        SRB_array[MAX_SRB_CNT];         /* 50 SRBs */
191 };
192
193
194 /*;-----------------------------------------------------------------------*/
195
196
197 #define BIT31   0x80000000
198 #define BIT30   0x40000000
199 #define BIT29   0x20000000
200 #define BIT28   0x10000000
201 #define BIT27   0x08000000
202 #define BIT26   0x04000000
203 #define BIT25   0x02000000
204 #define BIT24   0x01000000
205 #define BIT23   0x00800000
206 #define BIT22   0x00400000
207 #define BIT21   0x00200000
208 #define BIT20   0x00100000
209 #define BIT19   0x00080000
210 #define BIT18   0x00040000
211 #define BIT17   0x00020000
212 #define BIT16   0x00010000
213 #define BIT15   0x00008000
214 #define BIT14   0x00004000
215 #define BIT13   0x00002000
216 #define BIT12   0x00001000
217 #define BIT11   0x00000800
218 #define BIT10   0x00000400
219 #define BIT9    0x00000200
220 #define BIT8    0x00000100
221 #define BIT7    0x00000080
222 #define BIT6    0x00000040
223 #define BIT5    0x00000020
224 #define BIT4    0x00000010
225 #define BIT3    0x00000008
226 #define BIT2    0x00000004
227 #define BIT1    0x00000002
228 #define BIT0    0x00000001
229
230 /*;---UnitCtrlFlag */
231 #define UNIT_ALLOCATED  BIT0
232 #define UNIT_INFO_CHANGED BIT1
233 #define FORMATING_MEDIA BIT2
234 #define UNIT_RETRY      BIT3
235
236 /*;---UnitFlags */
237 #define DASD_SUPPORT    BIT0
238 #define SCSI_SUPPORT    BIT1
239 #define ASPI_SUPPORT    BIT2
240
241 /*;----SRBState machine definition */
242 #define SRB_FREE        0
243 #define SRB_WAIT        BIT0
244 #define SRB_READY       BIT1
245 #define SRB_MSGOUT      BIT2    /*;arbitration+msg_out 1st byte*/
246 #define SRB_MSGIN       BIT3
247 #define SRB_MSGIN_MULTI BIT4
248 #define SRB_COMMAND     BIT5
249 #define SRB_START_      BIT6    /*;arbitration+msg_out+command_out*/
250 #define SRB_DISCONNECT  BIT7
251 #define SRB_DATA_XFER   BIT8
252 #define SRB_XFERPAD     BIT9
253 #define SRB_STATUS      BIT10
254 #define SRB_COMPLETED   BIT11
255 #define SRB_ABORT_SENT  BIT12
256 #define DO_SYNC_NEGO    BIT13
257 #define SRB_UNEXPECT_RESEL BIT14
258
259 /*;---SRBstatus */
260 #define SRB_OK          BIT0
261 #define ABORTION        BIT1
262 #define OVER_RUN        BIT2
263 #define UNDER_RUN       BIT3
264 #define PARITY_ERROR    BIT4
265 #define SRB_ERROR       BIT5
266
267 /*;---ACBFlag */
268 #define RESET_DEV       BIT0
269 #define RESET_DETECT    BIT1
270 #define RESET_DONE      BIT2
271
272 /*;---DCBFlag */
273 #define ABORT_DEV_      BIT0
274
275 /*;---SRBFlag */
276 #define DATAOUT         BIT7
277 #define DATAIN          BIT6
278 #define RESIDUAL_VALID  BIT5
279 #define ENABLE_TIMER    BIT4
280 #define RESET_DEV0      BIT2
281 #define ABORT_DEV       BIT1
282 #define AUTO_REQSENSE   BIT0
283
284 /*;---Adapter status */
285 #define H_STATUS_GOOD    0
286 #define H_SEL_TIMEOUT    0x11
287 #define H_OVER_UNDER_RUN 0x12
288 #define H_UNEXP_BUS_FREE 0x13
289 #define H_TARGET_PHASE_F 0x14
290 #define H_INVALID_CCB_OP 0x16
291 #define H_LINK_CCB_BAD   0x17
292 #define H_BAD_TARGET_DIR 0x18
293 #define H_DUPLICATE_CCB  0x19
294 #define H_BAD_CCB_OR_SG  0x1A
295 #define H_ABORT          0x0FF
296
297 /*; SCSI Status byte codes*/ 
298 /* The values defined in include/scsi/scsi.h, to be shifted << 1 */
299
300 #define SCSI_STAT_UNEXP_BUS_F   0xFD    /*;  Unexpect Bus Free */
301 #define SCSI_STAT_BUS_RST_DETECT 0xFE   /*;  Scsi Bus Reset detected */
302 #define SCSI_STAT_SEL_TIMEOUT   0xFF    /*;  Selection Time out */
303
304 /* cmd->result */
305 #define RES_TARGET              0x000000FF      /* Target State */
306 #define RES_TARGET_LNX          STATUS_MASK     /* Only official ... */
307 #define RES_ENDMSG              0x0000FF00      /* End Message */
308 #define RES_DID                 0x00FF0000      /* DID_ codes */
309 #define RES_DRV                 0xFF000000      /* DRIVER_ codes */
310
311 #define MK_RES(drv,did,msg,tgt) ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt))
312 #define MK_RES_LNX(drv,did,msg,tgt) ((int)(drv)<<24 | (int)(did)<<16 | (int)(msg)<<8 | (int)(tgt)<<1)
313
314 #define SET_RES_TARGET(who,tgt) { who &= ~RES_TARGET; who |= (int)(tgt); }
315 #define SET_RES_TARGET_LNX(who,tgt) { who &= ~RES_TARGET_LNX; who |= (int)(tgt) << 1; }
316 #define SET_RES_MSG(who,msg) { who &= ~RES_ENDMSG; who |= (int)(msg) << 8; }
317 #define SET_RES_DID(who,did) { who &= ~RES_DID; who |= (int)(did) << 16; }
318 #define SET_RES_DRV(who,drv) { who &= ~RES_DRV; who |= (int)(drv) << 24; }
319
320 /*;---Sync_Mode */
321 #define SYNC_DISABLE    0
322 #define SYNC_ENABLE     BIT0
323 #define SYNC_NEGO_DONE  BIT1
324 #define WIDE_ENABLE     BIT2    /* Not used ;-) */
325 #define WIDE_NEGO_DONE  BIT3    /* Not used ;-) */
326 #define EN_TAG_QUEUEING BIT4
327 #define EN_ATN_STOP     BIT5
328
329 #define SYNC_NEGO_OFFSET 15
330
331 /*;---SCSI bus phase*/
332 #define SCSI_DATA_OUT   0
333 #define SCSI_DATA_IN    1
334 #define SCSI_COMMAND    2
335 #define SCSI_STATUS_    3
336 #define SCSI_NOP0       4
337 #define SCSI_NOP1       5
338 #define SCSI_MSG_OUT    6
339 #define SCSI_MSG_IN     7
340
341 /*;----SCSI MSG BYTE*/ /* see scsi/scsi.h */ /* One is missing ! */
342 #define ABORT_TAG       0x0d
343
344 /*
345  *      SISC query queue
346  */
347 typedef struct {
348         dma_addr_t              saved_dma_handle;
349 } dc390_cmd_scp_t;
350
351 /*
352 **  Inquiry Data format
353 */
354
355 typedef struct  _SCSIInqData { /* INQUIRY */
356
357         u8       DevType;               /* Periph Qualifier & Periph Dev Type*/
358         u8       RMB_TypeMod;           /* rem media bit & Dev Type Modifier */
359         u8       Vers;                  /* ISO, ECMA, & ANSI versions        */
360         u8       RDF;                   /* AEN, TRMIOP, & response data format*/
361         u8       AddLen;                /* length of additional data         */
362         u8       Res1;                  /* reserved                          */
363         u8       Res2;                  /* reserved                          */
364         u8       Flags;                 /* RelADr,Wbus32,Wbus16,Sync,etc.    */
365         u8       VendorID[8];           /* Vendor Identification             */
366         u8       ProductID[16];         /* Product Identification            */
367         u8       ProductRev[4];         /* Product Revision                  */
368
369
370 } SCSI_INQDATA, *PSCSI_INQDATA;
371
372
373 /*  Inquiry byte 0 masks */
374
375
376 #define SCSI_DEVTYPE        0x1F      /* Peripheral Device Type             */
377 #define SCSI_PERIPHQUAL     0xE0      /* Peripheral Qualifier               */
378 #define TYPE_NODEV          SCSI_DEVTYPE    /* Unknown or no device type    */
379
380
381 /*  Inquiry byte 1 mask */
382
383 #define SCSI_REMOVABLE_MEDIA  0x80    /* Removable Media bit (1=removable)  */
384
385
386 /*  Peripheral Device Type definitions */
387 /*  see include/scsi/scsi.h for the rest */
388
389 #ifndef TYPE_PRINTER
390 # define TYPE_PRINTER            0x02      /* Printer device               */
391 #endif
392 #ifndef TYPE_COMM
393 # define TYPE_COMM               0x09      /* Communications device        */
394 #endif
395
396 /*
397 ** Inquiry flag definitions (Inq data byte 7)
398 */
399
400 #define SCSI_INQ_RELADR       0x80    /* device supports relative addressing*/
401 #define SCSI_INQ_WBUS32       0x40    /* device supports 32 bit data xfers  */
402 #define SCSI_INQ_WBUS16       0x20    /* device supports 16 bit data xfers  */
403 #define SCSI_INQ_SYNC         0x10    /* device supports synchronous xfer   */
404 #define SCSI_INQ_LINKED       0x08    /* device supports linked commands    */
405 #define SCSI_INQ_CMDQUEUE     0x02    /* device supports command queueing   */
406 #define SCSI_INQ_SFTRE        0x01    /* device supports soft resets */
407
408
409 /*
410 ;==========================================================
411 ; EEPROM byte offset
412 ;==========================================================
413 */
414 typedef  struct  _EEprom
415 {
416 u8      EE_MODE1;
417 u8      EE_SPEED;
418 u8      xx1;
419 u8      xx2;
420 } EEprom, *PEEprom;
421
422 #define REAL_EE_ADAPT_SCSI_ID 64
423 #define REAL_EE_MODE2   65
424 #define REAL_EE_DELAY   66
425 #define REAL_EE_TAG_CMD_NUM     67
426
427 #define EE_ADAPT_SCSI_ID 32
428 #define EE_MODE2        33
429 #define EE_DELAY        34
430 #define EE_TAG_CMD_NUM  35
431
432 #define EE_LEN          40
433
434 /*; EE_MODE1 bits definition*/
435 #define PARITY_CHK_     BIT0
436 #define SYNC_NEGO_      BIT1
437 #define EN_DISCONNECT_  BIT2
438 #define SEND_START_     BIT3
439 #define TAG_QUEUEING_   BIT4
440
441 /*; EE_MODE2 bits definition*/
442 #define MORE2_DRV       BIT0
443 #define GREATER_1G      BIT1
444 #define RST_SCSI_BUS    BIT2
445 #define ACTIVE_NEGATION BIT3
446 #define NO_SEEK         BIT4
447 #define LUN_CHECK       BIT5
448
449 #define ENABLE_CE       1
450 #define DISABLE_CE      0
451 #define EEPROM_READ     0x80
452
453 /*
454 ;==========================================================
455 ;       AMD 53C974 Registers bit Definition
456 ;==========================================================
457 */
458 /*
459 ;====================
460 ; SCSI Register
461 ;====================
462 */
463
464 /*; Command Reg.(+0CH) (rw) */
465 #define DMA_COMMAND             BIT7
466 #define NOP_CMD                 0
467 #define CLEAR_FIFO_CMD          1
468 #define RST_DEVICE_CMD          2
469 #define RST_SCSI_BUS_CMD        3
470
471 #define INFO_XFER_CMD           0x10
472 #define INITIATOR_CMD_CMPLTE    0x11
473 #define MSG_ACCEPTED_CMD        0x12
474 #define XFER_PAD_BYTE           0x18
475 #define SET_ATN_CMD             0x1A
476 #define RESET_ATN_CMD           0x1B
477
478 #define SEL_WO_ATN              0x41    /* currently not used */
479 #define SEL_W_ATN               0x42
480 #define SEL_W_ATN_STOP          0x43
481 #define SEL_W_ATN3              0x46
482 #define EN_SEL_RESEL            0x44
483 #define DIS_SEL_RESEL           0x45    /* currently not used */
484 #define RESEL                   0x40    /* " */
485 #define RESEL_ATN3              0x47    /* " */
486
487 #define DATA_XFER_CMD           INFO_XFER_CMD
488
489
490 /*; SCSI Status Reg.(+10H) (r) */
491 #define INTERRUPT               BIT7
492 #define ILLEGAL_OP_ERR          BIT6
493 #define PARITY_ERR              BIT5
494 #define COUNT_2_ZERO            BIT4
495 #define GROUP_CODE_VALID        BIT3
496 #define SCSI_PHASE_MASK         (BIT2+BIT1+BIT0) 
497 /* BIT2: MSG phase; BIT1: C/D physe; BIT0: I/O phase */
498
499 /*; Interrupt Status Reg.(+14H) (r) */
500 #define SCSI_RESET              BIT7
501 #define INVALID_CMD             BIT6
502 #define DISCONNECTED            BIT5
503 #define SERVICE_REQUEST         BIT4
504 #define SUCCESSFUL_OP           BIT3
505 #define RESELECTED              BIT2
506 #define SEL_ATTENTION           BIT1
507 #define SELECTED                BIT0
508
509 /*; Internal State Reg.(+18H) (r) */
510 #define SYNC_OFFSET_FLAG        BIT3
511 #define INTRN_STATE_MASK        (BIT2+BIT1+BIT0)
512 /* 0x04: Sel. successful (w/o stop), 0x01: Sel. successful (w/ stop) */
513
514 /*; Clock Factor Reg.(+24H) (w) */
515 #define CLK_FREQ_40MHZ          0
516 #define CLK_FREQ_35MHZ          (BIT2+BIT1+BIT0)
517 #define CLK_FREQ_30MHZ          (BIT2+BIT1)
518 #define CLK_FREQ_25MHZ          (BIT2+BIT0)
519 #define CLK_FREQ_20MHZ          BIT2
520 #define CLK_FREQ_15MHZ          (BIT1+BIT0)
521 #define CLK_FREQ_10MHZ          BIT1
522
523 /*; Control Reg. 1(+20H) (rw) */
524 #define EXTENDED_TIMING         BIT7
525 #define DIS_INT_ON_SCSI_RST     BIT6
526 #define PARITY_ERR_REPO         BIT4
527 #define SCSI_ID_ON_BUS          (BIT2+BIT1+BIT0) /* host adapter ID */
528
529 /*; Control Reg. 2(+2CH) (rw) */
530 #define EN_FEATURE              BIT6
531 #define EN_SCSI2_CMD            BIT3
532
533 /*; Control Reg. 3(+30H) (rw) */
534 #define ID_MSG_CHECK            BIT7
535 #define EN_QTAG_MSG             BIT6
536 #define EN_GRP2_CMD             BIT5
537 #define FAST_SCSI               BIT4    /* ;10MB/SEC */
538 #define FAST_CLK                BIT3    /* ;25 - 40 MHZ */
539
540 /*; Control Reg. 4(+34H) (rw) */
541 #define EATER_12NS              0
542 #define EATER_25NS              BIT7
543 #define EATER_35NS              BIT6
544 #define EATER_0NS               (BIT7+BIT6)
545 #define REDUCED_POWER           BIT5
546 #define CTRL4_RESERVED          BIT4    /* must be 1 acc. to AM53C974.c */
547 #define NEGATE_REQACKDATA       BIT2
548 #define NEGATE_REQACK           BIT3
549
550 #define GLITCH_TO_NS(x) (((~x>>6 & 2) >> 1) | ((x>>6 & 1) << 1 ^ (x>>6 & 2)))
551 #define NS_TO_GLITCH(y) (((~y<<7) | ~((y<<6) ^ ((y<<5 & 1<<6) | ~0x40))) & 0xc0)
552
553 /*
554 ;====================
555 ; DMA Register
556 ;====================
557 */
558 /*; DMA Command Reg.(+40H) (rw) */
559 #define READ_DIRECTION          BIT7
560 #define WRITE_DIRECTION         0
561 #define EN_DMA_INT              BIT6
562 #define EN_PAGE_INT             BIT5    /* page transfer interrupt enable */
563 #define MAP_TO_MDL              BIT4
564 #define DIAGNOSTIC              BIT2
565 #define DMA_IDLE_CMD            0
566 #define DMA_BLAST_CMD           BIT0
567 #define DMA_ABORT_CMD           BIT1
568 #define DMA_START_CMD           (BIT1+BIT0)
569
570 /*; DMA Status Reg.(+54H) (r) */
571 #define PCI_MS_ABORT            BIT6
572 #define BLAST_COMPLETE          BIT5
573 #define SCSI_INTERRUPT          BIT4
574 #define DMA_XFER_DONE           BIT3
575 #define DMA_XFER_ABORT          BIT2
576 #define DMA_XFER_ERROR          BIT1
577 #define POWER_DOWN              BIT0
578
579 /*; DMA SCSI Bus and Ctrl.(+70H) */
580 #define EN_INT_ON_PCI_ABORT     BIT25
581 #define WRT_ERASE_DMA_STAT      BIT24
582 #define PW_DOWN_CTRL            BIT21
583 #define SCSI_BUSY               BIT20
584 #define SCLK                    BIT19
585 #define SCAM                    BIT18
586 #define SCSI_LINES              0x0003ffff
587
588 /*
589 ;==========================================================
590 ; SCSI Chip register address offset
591 ;==========================================================
592 ;Registers are rw unless declared otherwise 
593 */
594 #define CtcReg_Low      0x00    /* r    curr. transfer count */
595 #define CtcReg_Mid      0x04    /* r */
596 #define CtcReg_High     0x38    /* r */
597 #define ScsiFifo        0x08
598 #define ScsiCmd         0x0C
599 #define Scsi_Status     0x10    /* r */
600 #define INT_Status      0x14    /* r */
601 #define Sync_Period     0x18    /* w */
602 #define Sync_Offset     0x1C    /* w */
603 #define Clk_Factor      0x24    /* w */
604 #define CtrlReg1        0x20    
605 #define CtrlReg2        0x2C
606 #define CtrlReg3        0x30
607 #define CtrlReg4        0x34
608 #define DMA_Cmd         0x40
609 #define DMA_XferCnt     0x44    /* rw   starting transfer count (32 bit) */
610 #define DMA_XferAddr    0x48    /* rw   starting physical address (32 bit) */
611 #define DMA_Wk_ByteCntr 0x4C    /* r    working byte counter */
612 #define DMA_Wk_AddrCntr 0x50    /* r    working address counter */
613 #define DMA_Status      0x54    /* r */
614 #define DMA_MDL_Addr    0x58    /* rw   starting MDL address */
615 #define DMA_Wk_MDL_Cntr 0x5C    /* r    working MDL counter */
616 #define DMA_ScsiBusCtrl 0x70    /* rw   SCSI Bus, PCI/DMA Ctrl */
617
618 #define StcReg_Low      CtcReg_Low      /* w    start transfer count */
619 #define StcReg_Mid      CtcReg_Mid      /* w */
620 #define StcReg_High     CtcReg_High     /* w */
621 #define Scsi_Dest_ID    Scsi_Status     /* w */
622 #define Scsi_TimeOut    INT_Status      /* w */
623 #define Intern_State    Sync_Period     /* r */
624 #define Current_Fifo    Sync_Offset     /* r    Curr. FIFO / int. state */
625
626
627 #define DC390_read8(address)                    \
628         (inb (pACB->IOPortBase + (address)))
629
630 #define DC390_read8_(address, base)             \
631         (inb ((u16)(base) + (address)))
632
633 #define DC390_read16(address)                   \
634         (inw (pACB->IOPortBase + (address)))
635
636 #define DC390_read32(address)                   \
637         (inl (pACB->IOPortBase + (address)))
638
639 #define DC390_write8(address,value)             \
640         outb ((value), pACB->IOPortBase + (address))
641
642 #define DC390_write8_(address,value,base)       \
643         outb ((value), (u16)(base) + (address))
644
645 #define DC390_write16(address,value)            \
646         outw ((value), pACB->IOPortBase + (address))
647
648 #define DC390_write32(address,value)            \
649         outl ((value), pACB->IOPortBase + (address))
650
651
652 #endif /* _TMSCSIM_H */