The cam_sim structure was being deallocated unconditionally by device
[dragonfly.git] / sys / dev / disk / aic7xxx / aic79xx.reg
1 /*
2  * Aic79xx register and scratch ram definitions.
3  *
4  * Copyright (c) 1994-2001 Justin T. Gibbs.
5  * Copyright (c) 2000-2002 Adaptec Inc.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions, and the following disclaimer,
13  *    without modification.
14  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
15  *    substantially similar to the "NO WARRANTY" disclaimer below
16  *    ("Disclaimer") and any redistribution must be conditioned upon
17  *    including a substantially similar Disclaimer requirement for further
18  *    binary redistribution.
19  * 3. Neither the names of the above-listed copyright holders nor the names
20  *    of any contributors may be used to endorse or promote products derived
21  *    from this software without specific prior written permission.
22  *
23  * Alternatively, this software may be distributed under the terms of the
24  * GNU General Public License ("GPL") version 2 as published by the Free
25  * Software Foundation.
26  *
27  * NO WARRANTY
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
31  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32  * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
36  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
37  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38  * POSSIBILITY OF SUCH DAMAGES.
39  *
40  * $FreeBSD: src/sys/dev/aic7xxx/aic79xx.reg,v 1.2.2.6 2003/06/10 03:26:07 gibbs Exp $
41  * $DragonFly: src/sys/dev/disk/aic7xxx/aic79xx.reg,v 1.2 2003/06/17 04:28:21 dillon Exp $
42  */
43 VERSION = "$Id: //depot/aic7xxx/aic7xxx/aic79xx.reg#70 $"
44
45 /*
46  * This file is processed by the aic7xxx_asm utility for use in assembling
47  * firmware for the aic79xx family of SCSI host adapters as well as to generate
48  * a C header file for use in the kernel portion of the Aic79xx driver.
49  */
50
51 /* Register window Modes */
52 #define M_DFF0          0
53 #define M_DFF1          1
54 #define M_CCHAN         2
55 #define M_SCSI          3
56 #define M_CFG           4
57 #define M_DST_SHIFT     4
58
59 #define MK_MODE(src, dst) ((src) | ((dst) << M_DST_SHIFT))
60 #define SET_MODE(src, dst)                                              \
61         SET_SRC_MODE    src;                                            \
62         SET_DST_MODE    dst;                                            \
63         if ((ahd->bugs & AHD_SET_MODE_BUG) != 0) {                      \
64                 mvi     MK_MODE(src, dst) call set_mode_work_around;    \
65         } else {                                                        \
66                 mvi     MODE_PTR, MK_MODE(src, dst);                    \
67         }
68
69 #define TOGGLE_DFF_MODE                                                 \
70         if ((ahd->bugs & AHD_SET_MODE_BUG) != 0) {                      \
71                 call    toggle_dff_mode_work_around;                    \
72         } else {                                                        \
73                 xor     MODE_PTR, MK_MODE(M_DFF1, M_DFF1);              \
74         }
75         
76 #define RESTORE_MODE(mode)                                              \
77         if ((ahd->bugs & AHD_SET_MODE_BUG) != 0) {                      \
78                 mov     mode call set_mode_work_around;                 \
79         } else {                                                        \
80                 mov     MODE_PTR, mode;                                 \
81         }
82
83 #define SET_SEQINTCODE(code)                                            \
84         if ((ahd->bugs & AHD_INTCOLLISION_BUG) != 0) {                  \
85                 mvi     code call set_seqint_work_around;               \
86         } else {                                                        \
87                 mvi     SEQINTCODE, code;                               \
88         }
89
90 /*
91  * Mode Pointer
92  * Controls which of the 5, 512byte, address spaces should be used
93  * as the source and destination of any register accesses in our
94  * register window.
95  */
96 register MODE_PTR {
97         address                 0x000
98         access_mode     RW
99         field   DST_MODE        0x70
100         field   SRC_MODE        0x07
101         mode_pointer
102 }
103
104 const SRC_MODE_SHIFT    0
105 const DST_MODE_SHIFT    4
106
107 /*
108  * Host Interrupt Status
109  */
110 register INTSTAT {
111         address                 0x001
112         access_mode     RW
113         field   HWERRINT        0x80
114         field   BRKADRINT       0x40
115         field   SWTMINT         0x20
116         field   PCIINT          0x10
117         field   SCSIINT         0x08
118         field   SEQINT          0x04
119         field   CMDCMPLT        0x02
120         field   SPLTINT         0x01
121         mask    INT_PEND 0xFF
122 }
123
124 /*
125  * Sequencer Interrupt Code
126  */
127 register SEQINTCODE {
128         address                 0x002
129         access_mode     RW
130         field {
131                 NO_SEQINT,                      /* No seqint pending. */
132                 BAD_PHASE,                      /* unknown scsi bus phase */
133                 SEND_REJECT,                    /* sending a message reject */
134                 PROTO_VIOLATION,                /* Protocol Violation */
135                 NO_MATCH,                       /* no cmd match for reconnect */
136                 IGN_WIDE_RES,                   /* Complex IGN Wide Res Msg */
137                 PDATA_REINIT,                   /*
138                                                  * Returned to data phase
139                                                  * that requires data
140                                                  * transfer pointers to be
141                                                  * recalculated from the
142                                                  * transfer residual.
143                                                  */
144                 HOST_MSG_LOOP,                  /*
145                                                  * The bus is ready for the
146                                                  * host to perform another
147                                                  * message transaction.  This
148                                                  * mechanism is used for things
149                                                  * like sync/wide negotiation
150                                                  * that require a kernel based
151                                                  * message state engine.
152                                                  */
153                 BAD_STATUS,                     /* Bad status from target */
154                 DATA_OVERRUN,                   /*
155                                                  * Target attempted to write
156                                                  * beyond the bounds of its
157                                                  * command.
158                                                  */
159                 MKMSG_FAILED,                   /*
160                                                  * Target completed command
161                                                  * without honoring our ATN
162                                                  * request to issue a message. 
163                                                  */
164                 MISSED_BUSFREE,                 /*
165                                                  * The sequencer never saw
166                                                  * the bus go free after
167                                                  * either a command complete
168                                                  * or disconnect message.
169                                                  */
170                 DUMP_CARD_STATE,
171                 ILLEGAL_PHASE,
172                 INVALID_SEQINT,
173                 CFG4ISTAT_INTR,
174                 STATUS_OVERRUN,
175                 CFG4OVERRUN,
176                 ENTERING_NONPACK,
177                 TASKMGMT_FUNC_COMPLETE,         /*
178                                                  * Task management function
179                                                  * request completed with
180                                                  * an expected busfree.
181                                                  */
182                 TASKMGMT_CMD_CMPLT_OKAY,        /*
183                                                  * A command with a non-zero
184                                                  * task management function
185                                                  * has completed via the normal
186                                                  * command completion method
187                                                  * for commands with a zero
188                                                  * task management function.
189                                                  * This happens when an attempt
190                                                  * to abort a command loses
191                                                  * the race for the command to
192                                                  * complete normally.
193                                                  */
194                 TRACEPOINT0,
195                 TRACEPOINT1,
196                 TRACEPOINT2,
197                 TRACEPOINT3,
198                 SAW_HWERR,
199                 BAD_SCB_STATUS
200         }
201 }
202
203 /*
204  * Clear Host Interrupt
205  */
206 register CLRINT {
207         address                 0x003
208         access_mode     WO
209         field   CLRHWERRINT     0x80 /* Rev B or greater */
210         field   CLRBRKADRINT    0x40
211         field   CLRSWTMINT      0x20
212         field   CLRPCIINT       0x10
213         field   CLRSCSIINT      0x08
214         field   CLRSEQINT       0x04
215         field   CLRCMDINT       0x02
216         field   CLRSPLTINT      0x01
217 }
218
219 /*
220  * Error Register
221  */
222 register ERROR {
223         address                 0x004
224         access_mode     RO
225         field   CIOPARERR       0x80
226         field   CIOACCESFAIL    0x40 /* Rev B or greater */
227         field   MPARERR         0x20
228         field   DPARERR         0x10
229         field   SQPARERR        0x08
230         field   ILLOPCODE       0x04
231         field   DSCTMOUT        0x02
232 }
233
234 /*
235  * Clear Error
236  */
237 register CLRERR {
238         address                 0x004
239         access_mode     WO
240         field   CLRCIOPARERR    0x80
241         field   CLRCIOACCESFAIL 0x40 /* Rev B or greater */
242         field   CLRMPARERR      0x20
243         field   CLRDPARERR      0x10
244         field   CLRSQPARERR     0x08
245         field   CLRILLOPCODE    0x04
246         field   CLRDSCTMOUT     0x02
247 }
248
249 /*
250  * Host Control Register
251  * Overall host control of the device.
252  */
253 register HCNTRL {
254         address                 0x005
255         access_mode     RW
256         field   SEQ_RESET       0x80 /* Rev B or greater */
257         field   POWRDN          0x40
258         field   SWINT           0x10
259         field   SWTIMER_START_B 0x08 /* Rev B or greater */
260         field   PAUSE           0x04
261         field   INTEN           0x02
262         field   CHIPRST         0x01
263         field   CHIPRSTACK      0x01
264 }
265
266 /*
267  * Host New SCB Queue Offset
268  */
269 register HNSCB_QOFF {
270         address                 0x006
271         access_mode     RW
272         size            2
273 }
274
275 /*
276  * Host Empty SCB Queue Offset
277  */
278 register HESCB_QOFF {
279         address                 0x008
280         access_mode     RW
281 }
282
283 /*
284  * Host Mailbox
285  */
286 register HS_MAILBOX {
287         address                 0x00B
288         access_mode     RW
289         mask    HOST_TQINPOS    0x80    /* Boundary at either 0 or 128 */
290         mask    ENINT_COALESCE  0x40    /* Perform interrupt coalescing */
291 }
292
293 /*
294  * Sequencer Interupt Status
295  */
296 register SEQINTSTAT {
297         address                 0x00C
298         access_mode     RO
299         field   SEQ_SWTMRTO     0x10
300         field   SEQ_SEQINT      0x08
301         field   SEQ_SCSIINT     0x04
302         field   SEQ_PCIINT      0x02
303         field   SEQ_SPLTINT     0x01
304 }
305
306 /*
307  * Clear SEQ Interrupt
308  */
309 register CLRSEQINTSTAT {
310         address                 0x00C
311         access_mode     WO
312         field   CLRSEQ_SWTMRTO  0x10
313         field   CLRSEQ_SEQINT   0x08
314         field   CLRSEQ_SCSIINT  0x04
315         field   CLRSEQ_PCIINT   0x02
316         field   CLRSEQ_SPLTINT  0x01
317 }
318
319 /*
320  * Software Timer
321  */
322 register SWTIMER {
323         address                 0x00E
324         access_mode     RW
325         size            2
326 }
327
328 /*
329  * SEQ New SCB Queue Offset
330  */
331 register SNSCB_QOFF {
332         address                 0x010
333         access_mode     RW
334         size            2
335         modes           M_CCHAN
336 }
337
338 /*
339  * SEQ Empty SCB Queue Offset
340  */
341 register SESCB_QOFF {
342         address                 0x012
343         access_mode     RW
344         modes           M_CCHAN
345 }
346
347 /*
348  * SEQ Done SCB Queue Offset
349  */
350 register SDSCB_QOFF {
351         address                 0x014
352         access_mode     RW
353         modes           M_CCHAN
354         size            2
355 }
356
357 /*
358  * Queue Offset Control & Status
359  */
360 register QOFF_CTLSTA {
361         address                 0x016
362         access_mode     RW
363         modes           M_CCHAN
364         field   EMPTY_SCB_AVAIL 0x80
365         field   NEW_SCB_AVAIL   0x40
366         field   SDSCB_ROLLOVR   0x20
367         field   HS_MAILBOX_ACT  0x10
368         field   SCB_QSIZE       0x0F {
369                 SCB_QSIZE_4,
370                 SCB_QSIZE_8,
371                 SCB_QSIZE_16,
372                 SCB_QSIZE_32,
373                 SCB_QSIZE_64,
374                 SCB_QSIZE_128,
375                 SCB_QSIZE_256,
376                 SCB_QSIZE_512,
377                 SCB_QSIZE_1024,
378                 SCB_QSIZE_2048,
379                 SCB_QSIZE_4096,
380                 SCB_QSIZE_8192,
381                 SCB_QSIZE_16384
382         }
383 }
384
385 /*
386  * Interrupt Control
387  */
388 register INTCTL {
389         address                 0x018
390         access_mode     RW
391         field   SWTMINTMASK     0x80
392         field   SWTMINTEN       0x40
393         field   SWTIMER_START   0x20
394         field   AUTOCLRCMDINT   0x10
395         field   PCIINTEN        0x08
396         field   SCSIINTEN       0x04
397         field   SEQINTEN        0x02
398         field   SPLTINTEN       0x01
399 }
400
401 /*
402  * Data FIFO Control
403  */
404 register DFCNTRL {
405         address                 0x019
406         access_mode     RW
407         modes           M_DFF0, M_DFF1
408         field   PRELOADEN       0x80
409         field   SCSIENWRDIS     0x40    /* Rev B only. */
410         field   SCSIEN          0x20
411         field   SCSIENACK       0x20
412         field   HDMAEN          0x08
413         field   HDMAENACK       0x08
414         field   DIRECTION       0x04
415         field   DIRECTIONACK    0x04
416         field   FIFOFLUSH       0x02
417         field   FIFOFLUSHACK    0x02
418         field   DIRECTIONEN     0x01
419 }
420
421 /*
422  * Device Space Command 0
423  */
424 register DSCOMMAND0 {
425         address                 0x019
426         access_mode     RW
427         modes           M_CFG
428         field   CACHETHEN       0x80    /* Cache Threshold enable */
429         field   DPARCKEN        0x40    /* Data Parity Check Enable */
430         field   MPARCKEN        0x20    /* Memory Parity Check Enable */
431         field   EXTREQLCK       0x10    /* External Request Lock */
432         field   DISABLE_TWATE   0x02    /* Rev B or greater */
433         field   CIOPARCKEN      0x01    /* Internal bus parity error enable */
434 }
435
436 /*
437  * Data FIFO Status
438  */
439 register DFSTATUS {
440         address                 0x01A
441         access_mode     RO
442         modes           M_DFF0, M_DFF1
443         field   PRELOAD_AVAIL           0x80
444         field   PKT_PRELOAD_AVAIL       0x40
445         field   MREQPEND                0x10
446         field   HDONE                   0x08
447         field   DFTHRESH                0x04
448         field   FIFOFULL                0x02
449         field   FIFOEMP                 0x01
450 }
451
452 /*
453  * S/G Cache Pointer
454  */
455 register SG_CACHE_PRE {
456         address                 0x01B
457         access_mode     WO
458         modes           M_DFF0, M_DFF1
459         field   SG_ADDR_MASK    0xf8
460         field   ODD_SEG         0x04
461         field   LAST_SEG        0x02
462 }
463
464 register SG_CACHE_SHADOW {
465         address                 0x01B
466         access_mode     RO
467         modes           M_DFF0, M_DFF1
468         field   SG_ADDR_MASK    0xf8
469         field   ODD_SEG         0x04
470         field   LAST_SEG        0x02
471         field   LAST_SEG_DONE   0x01
472 }
473
474 /*
475  * Arbiter Control
476  */
477 register ARBCTL {
478         address                 0x01B
479         access_mode     RW
480         modes           M_CFG
481         field   RESET_HARB      0x80
482         field   RETRY_SWEN      0x08
483         field   USE_TIME        0x07
484 }
485
486 /*
487  * Data Channel Host Address
488  */
489 register HADDR {
490         address                 0x070
491         access_mode     RW
492         size            8
493         modes           M_DFF0, M_DFF1
494 }
495
496 /*
497  * Host Overlay DMA Address
498  */
499 register HODMAADR {
500         address                 0x070
501         access_mode     RW
502         size            8
503         modes           M_SCSI
504 }
505
506 /*
507  * PCI PLL Delay.
508  */
509 register PLLDELAY {
510         address                 0x070
511         access_mode     RW
512         size            1
513         modes           M_CFG
514         field   SPLIT_DROP_REQ  0x80
515 }
516
517 /*
518  * Data Channel Host Count
519  */
520 register HCNT {
521         address                 0x078
522         access_mode     RW
523         size            3
524         modes           M_DFF0, M_DFF1
525 }
526
527 /*
528  * Host Overlay DMA Count
529  */
530 register HODMACNT {
531         address                 0x078
532         access_mode     RW
533         size            2
534         modes           M_SCSI
535 }
536
537 /*
538  * Host Overlay DMA Enable
539  */
540 register HODMAEN {
541         address                 0x07A
542         access_mode     RW
543         modes           M_SCSI
544 }
545
546 /*
547  * Scatter/Gather Host Address
548  */
549 register SGHADDR {
550         address                 0x07C
551         access_mode     RW
552         size            8
553         modes           M_DFF0, M_DFF1
554 }
555
556 /*
557  * SCB Host Address
558  */
559 register SCBHADDR {
560         address                 0x07C
561         access_mode     RW
562         size            8
563         modes           M_CCHAN
564 }
565
566 /*
567  * Scatter/Gather Host Count
568  */
569 register SGHCNT {
570         address                 0x084
571         access_mode     RW
572         modes           M_DFF0, M_DFF1
573 }
574
575 /*
576  * SCB Host Count
577  */
578 register SCBHCNT {
579         address                 0x084
580         access_mode     RW
581         modes           M_CCHAN
582 }
583
584 /*
585  * Data FIFO Threshold
586  */
587 register DFF_THRSH {
588         address                 0x088
589         access_mode     RW
590         modes           M_CFG
591         field   WR_DFTHRSH      0x70 {
592                 WR_DFTHRSH_MIN,
593                 WR_DFTHRSH_25,
594                 WR_DFTHRSH_50,
595                 WR_DFTHRSH_63,
596                 WR_DFTHRSH_75,
597                 WR_DFTHRSH_85,
598                 WR_DFTHRSH_90,
599                 WR_DFTHRSH_MAX
600         }
601         field   RD_DFTHRSH      0x07 {
602                 RD_DFTHRSH_MIN,
603                 RD_DFTHRSH_25,
604                 RD_DFTHRSH_50,
605                 RD_DFTHRSH_63,
606                 RD_DFTHRSH_75,
607                 RD_DFTHRSH_85,
608                 RD_DFTHRSH_90,
609                 RD_DFTHRSH_MAX
610         }
611 }
612
613 /*
614  * ROM Address
615  */
616 register ROMADDR {
617         address                 0x08A
618         access_mode     RW
619         size            3
620 }
621
622 /*
623  * ROM Control
624  */
625 register ROMCNTRL {
626         address                 0x08D
627         access_mode     RW
628         field   ROMOP           0xE0
629         field   ROMSPD          0x18
630         field   REPEAT          0x02
631         field   RDY             0x01
632 }
633
634 /*
635  * ROM Data
636  */
637 register ROMDATA {
638         address                 0x08E
639         access_mode     RW
640 }
641
642 /*
643  * Data Channel Receive Message 0
644  */
645 register DCHRXMSG0 {
646         address                 0x090
647         access_mode     RO
648         modes           M_DFF0, M_DFF1
649         field           CDNUM   0xF8
650         field           CFNUM   0x07
651 }
652
653 /*
654  * CMC Recieve Message 0
655  */
656 register CMCRXMSG0 {
657         address                 0x090
658         access_mode     RO
659         modes           M_CCHAN
660         field           CDNUM   0xF8
661         field           CFNUM   0x07
662 }
663
664 /*
665  * Overlay Recieve Message 0
666  */
667 register OVLYRXMSG0 {
668         address                 0x090
669         access_mode     RO
670         modes           M_SCSI
671         field           CDNUM   0xF8
672         field           CFNUM   0x07
673 }
674
675 /*
676  * Relaxed Order Enable
677  */
678 register ROENABLE {
679         address                 0x090
680         access_mode     RW
681         modes           M_CFG
682         field   MSIROEN         0x20
683         field   OVLYROEN        0x10
684         field   CMCROEN         0x08
685         field   SGROEN          0x04
686         field   DCH1ROEN        0x02
687         field   DCH0ROEN        0x01
688 }
689
690 /*
691  * Data Channel Receive Message 1
692  */
693 register DCHRXMSG1 {
694         address                 0x091
695         access_mode     RO
696         modes           M_DFF0, M_DFF1
697         field   CBNUM           0xFF
698 }
699
700 /*
701  * CMC Recieve Message 1
702  */
703 register CMCRXMSG1 {
704         address                 0x091
705         access_mode     RO
706         modes           M_CCHAN
707         field   CBNUM           0xFF
708 }
709
710 /*
711  * Overlay Recieve Message 1
712  */
713 register OVLYRXMSG1 {
714         address                 0x091
715         access_mode     RO
716         modes           M_SCSI
717         field   CBNUM           0xFF
718 }
719
720 /*
721  * No Snoop Enable
722  */
723 register NSENABLE {
724         address                 0x091
725         access_mode     RW
726         modes           M_CFG
727         field   MSINSEN         0x20
728         field   OVLYNSEN        0x10
729         field   CMCNSEN         0x08
730         field   SGNSEN          0x04
731         field   DCH1NSEN        0x02
732         field   DCH0NSEN        0x01
733 }
734
735 /*
736  * Data Channel Receive Message 2
737  */
738 register DCHRXMSG2 {
739         address                 0x092
740         access_mode     RO
741         modes           M_DFF0, M_DFF1
742         field   MINDEX          0xFF
743 }
744
745 /*
746  * CMC Recieve Message 2
747  */
748 register CMCRXMSG2 {
749         address                 0x092
750         access_mode     RO
751         modes           M_CCHAN
752         field   MINDEX          0xFF
753 }
754
755 /*
756  * Overlay Recieve Message 2
757  */
758 register OVLYRXMSG2 {
759         address                 0x092
760         access_mode     RO
761         modes           M_SCSI
762         field   MINDEX          0xFF
763 }
764
765 /*
766  * Outstanding Split Transactions
767  */
768 register OST {
769         address                 0x092
770         access_mode     RW
771         modes           M_CFG
772 }
773
774 /*
775  * Data Channel Receive Message 3
776  */
777 register DCHRXMSG3 {
778         address                 0x093
779         access_mode     RO
780         modes           M_DFF0, M_DFF1
781         field   MCLASS          0x0F
782 }
783
784 /*
785  * CMC Recieve Message 3
786  */
787 register CMCRXMSG3 {
788         address                 0x093
789         access_mode     RO
790         modes           M_CCHAN
791         field   MCLASS          0x0F
792 }
793
794 /*
795  * Overlay Recieve Message 3
796  */
797 register OVLYRXMSG3 {
798         address                 0x093
799         access_mode     RO
800         modes           M_SCSI
801         field   MCLASS          0x0F
802 }
803
804 /*
805  * PCI-X Control
806  */
807 register PCIXCTL {
808         address                 0x093
809         access_mode     RW
810         modes           M_CFG
811         field   SERRPULSE       0x80
812         field   UNEXPSCIEN      0x20
813         field   SPLTSMADIS      0x10
814         field   SPLTSTADIS      0x08
815         field   SRSPDPEEN       0x04
816         field   TSCSERREN       0x02
817         field   CMPABCDIS       0x01
818 }
819
820 /*
821  * CMC Sequencer Byte Count
822  */
823 register CMCSEQBCNT {
824         address                 0x094
825         access_mode     RO
826         modes           M_CCHAN
827 }
828
829 /*
830  * Overlay Sequencer Byte Count
831  */
832 register OVLYSEQBCNT {
833         address                 0x094
834         access_mode     RO
835         modes           M_SCSI
836 }
837
838 /*
839  * Data Channel Sequencer Byte Count
840  */
841 register DCHSEQBCNT {
842         address                 0x094
843         access_mode     RO
844         size            2
845         modes           M_DFF0, M_DFF1
846 }
847
848 /*
849  * Data Channel Split Status 0
850  */
851 register DCHSPLTSTAT0 {
852         address                 0x096
853         access_mode     RW
854         modes           M_DFF0, M_DFF1
855         field   STAETERM        0x80
856         field   SCBCERR         0x40
857         field   SCADERR         0x20
858         field   SCDATBUCKET     0x10
859         field   CNTNOTCMPLT     0x08
860         field   RXOVRUN         0x04
861         field   RXSCEMSG        0x02
862         field   RXSPLTRSP       0x01
863 }
864
865 /*
866  * CMC Split Status 0
867  */
868 register CMCSPLTSTAT0 {
869         address                 0x096
870         access_mode     RW
871         modes           M_CCHAN
872         field   STAETERM        0x80
873         field   SCBCERR         0x40
874         field   SCADERR         0x20
875         field   SCDATBUCKET     0x10
876         field   CNTNOTCMPLT     0x08
877         field   RXOVRUN         0x04
878         field   RXSCEMSG        0x02
879         field   RXSPLTRSP       0x01
880 }
881
882 /*
883  * Overlay Split Status 0
884  */
885 register OVLYSPLTSTAT0 {
886         address                 0x096
887         access_mode     RW
888         modes           M_SCSI
889         field   STAETERM        0x80
890         field   SCBCERR         0x40
891         field   SCADERR         0x20
892         field   SCDATBUCKET     0x10
893         field   CNTNOTCMPLT     0x08
894         field   RXOVRUN         0x04
895         field   RXSCEMSG        0x02
896         field   RXSPLTRSP       0x01
897 }
898
899 /*
900  * Data Channel Split Status 1
901  */
902 register DCHSPLTSTAT1 {
903         address                 0x097
904         access_mode     RW
905         modes           M_DFF0, M_DFF1
906         field   RXDATABUCKET    0x01
907 }
908
909 /*
910  * CMC Split Status 1
911  */
912 register CMCSPLTSTAT1 {
913         address                 0x097
914         access_mode     RW
915         modes           M_CCHAN
916         field   RXDATABUCKET    0x01
917 }
918
919 /*
920  * Overlay Split Status 1
921  */
922 register OVLYSPLTSTAT1 {
923         address                 0x097
924         access_mode     RW
925         modes           M_SCSI
926         field   RXDATABUCKET    0x01
927 }
928
929 /*
930  * S/G Receive Message 0
931  */
932 register SGRXMSG0 {
933         address                 0x098
934         access_mode     RO
935         modes           M_DFF0, M_DFF1
936         field           CDNUM   0xF8
937         field           CFNUM   0x07
938 }
939
940 /*
941  * S/G Receive Message 1
942  */
943 register SGRXMSG1 {
944         address                 0x099
945         access_mode     RO
946         modes           M_DFF0, M_DFF1
947         field   CBNUM           0xFF
948 }
949
950 /*
951  * S/G Receive Message 2
952  */
953 register SGRXMSG2 {
954         address                 0x09A
955         access_mode     RO
956         modes           M_DFF0, M_DFF1
957         field   MINDEX          0xFF
958 }
959
960 /*
961  * S/G Receive Message 3
962  */
963 register SGRXMSG3 {
964         address                 0x09B
965         access_mode     RO
966         modes           M_DFF0, M_DFF1
967         field   MCLASS          0x0F
968 }
969
970 /*
971  * Slave Split Out Address 0
972  */
973 register SLVSPLTOUTADR0 {
974         address                 0x098
975         access_mode     RO
976         modes           M_SCSI
977         field   LOWER_ADDR      0x7F
978 }
979
980 /*
981  * Slave Split Out Address 1
982  */
983 register SLVSPLTOUTADR1 {
984         address                 0x099
985         access_mode     RO
986         modes           M_SCSI
987         field   REQ_DNUM        0xF8
988         field   REQ_FNUM        0x07
989 }
990
991 /*
992  * Slave Split Out Address 2
993  */
994 register SLVSPLTOUTADR2 {
995         address                 0x09A
996         access_mode     RO
997         modes           M_SCSI
998         field   REQ_BNUM        0xFF
999 }
1000
1001 /*
1002  * Slave Split Out Address 3
1003  */
1004 register SLVSPLTOUTADR3 {
1005         address                 0x09B
1006         access_mode     RO
1007         modes           M_SCSI
1008         field   RLXORD          020
1009         field   TAG_NUM         0x1F
1010 }
1011
1012 /*
1013  * SG Sequencer Byte Count
1014  */
1015 register SGSEQBCNT {
1016         address                 0x09C
1017         access_mode     RO
1018         modes           M_DFF0, M_DFF1
1019 }
1020
1021 /*
1022  * Slave Split Out Attribute 0
1023  */
1024 register SLVSPLTOUTATTR0 {
1025         address                 0x09C
1026         access_mode     RO
1027         modes           M_SCSI
1028         field   LOWER_BCNT      0xFF
1029 }
1030
1031 /*
1032  * Slave Split Out Attribute 1
1033  */
1034 register SLVSPLTOUTATTR1 {
1035         address                 0x09D
1036         access_mode     RO
1037         modes           M_SCSI
1038         field   CMPLT_DNUM      0xF8
1039         field   CMPLT_FNUM      0x07
1040 }
1041
1042 /*
1043  * Slave Split Out Attribute 2
1044  */
1045 register SLVSPLTOUTATTR2 {
1046         address                 0x09E
1047         access_mode     RO
1048         size            2
1049         modes           M_SCSI
1050         field   CMPLT_BNUM      0xFF
1051 }
1052 /*
1053  * S/G Split Status 0
1054  */
1055 register SGSPLTSTAT0 {
1056         address                 0x09E
1057         access_mode     RW
1058         modes           M_DFF0, M_DFF1
1059         field   STAETERM        0x80
1060         field   SCBCERR         0x40
1061         field   SCADERR         0x20
1062         field   SCDATBUCKET     0x10
1063         field   CNTNOTCMPLT     0x08
1064         field   RXOVRUN         0x04
1065         field   RXSCEMSG        0x02
1066         field   RXSPLTRSP       0x01
1067 }
1068
1069 /*
1070  * S/G Split Status 1
1071  */
1072 register SGSPLTSTAT1 {
1073         address                 0x09F
1074         access_mode     RW
1075         modes           M_DFF0, M_DFF1
1076         field   RXDATABUCKET    0x01
1077 }
1078
1079 /*
1080  * Special Function
1081  */
1082 register SFUNCT {
1083         address                 0x09f
1084         access_mode     RW
1085         modes           M_CFG
1086         field   TEST_GROUP      0xF0
1087         field   TEST_NUM        0x0F
1088 }
1089
1090 /*
1091  * Data FIFO 0 PCI Status 
1092  */
1093 register DF0PCISTAT {
1094         address                 0x0A0
1095         access_mode     RW
1096         modes           M_CFG
1097         field   DPE             0x80
1098         field   SSE             0x40
1099         field   RMA             0x20
1100         field   RTA             0x10
1101         field   SCAAPERR        0x08
1102         field   RDPERR          0x04
1103         field   TWATERR         0x02
1104         field   DPR             0x01
1105 }
1106
1107 /*
1108  * Data FIFO 1 PCI Status 
1109  */
1110 register DF1PCISTAT {
1111         address                 0x0A1
1112         access_mode     RW
1113         modes           M_CFG
1114         field   DPE             0x80
1115         field   SSE             0x40
1116         field   RMA             0x20
1117         field   RTA             0x10
1118         field   SCAAPERR        0x08
1119         field   RDPERR          0x04
1120         field   TWATERR         0x02
1121         field   DPR             0x01
1122 }
1123
1124 /*
1125  * S/G PCI Status 
1126  */
1127 register SGPCISTAT {
1128         address                 0x0A2
1129         access_mode     RW
1130         modes           M_CFG
1131         field   DPE             0x80
1132         field   SSE             0x40
1133         field   RMA             0x20
1134         field   RTA             0x10
1135         field   SCAAPERR        0x08
1136         field   RDPERR          0x04
1137         field   DPR             0x01
1138 }
1139
1140 /*
1141  * CMC PCI Status 
1142  */
1143 register CMCPCISTAT {
1144         address                 0x0A3
1145         access_mode     RW
1146         modes           M_CFG
1147         field   DPE             0x80
1148         field   SSE             0x40
1149         field   RMA             0x20
1150         field   RTA             0x10
1151         field   SCAAPERR        0x08
1152         field   RDPERR          0x04
1153         field   TWATERR         0x02
1154         field   DPR             0x01
1155 }
1156
1157 /*
1158  * Overlay PCI Status 
1159  */
1160 register OVLYPCISTAT {
1161         address                 0x0A4
1162         access_mode     RW
1163         modes           M_CFG
1164         field   DPE             0x80
1165         field   SSE             0x40
1166         field   RMA             0x20
1167         field   RTA             0x10
1168         field   SCAAPERR        0x08
1169         field   RDPERR          0x04
1170         field   DPR             0x01
1171 }
1172
1173 /*
1174  * PCI Status for MSI Master DMA Transfer
1175  */
1176 register MSIPCISTAT {
1177         address                 0x0A6
1178         access_mode     RW
1179         modes           M_CFG
1180         field   SSE             0x40
1181         field   RMA             0x20
1182         field   RTA             0x10
1183         field   CLRPENDMSI      0x08
1184         field   TWATERR         0x02
1185         field   DPR             0x01
1186 }
1187
1188 /*
1189  * PCI Status for Target
1190  */
1191 register TARGPCISTAT {
1192         address                 0x0A7
1193         access_mode     RW
1194         modes           M_CFG
1195         field   DPE             0x80
1196         field   SSE             0x40
1197         field   STA             0x08
1198         field   TWATERR         0x02
1199 }
1200
1201 /*
1202  * LQ Packet In
1203  * The last LQ Packet recieved
1204  */
1205 register LQIN {
1206         address                 0x020
1207         access_mode     RW
1208         size            20
1209         modes           M_DFF0, M_DFF1, M_SCSI
1210 }
1211
1212 /*
1213  * SCB Type Pointer
1214  * SCB offset for Target Mode SCB type information
1215  */
1216 register TYPEPTR {
1217         address                 0x020
1218         access_mode     RW
1219         modes           M_CFG
1220 }
1221
1222 /*
1223  * Queue Tag Pointer
1224  * SCB offset to the Two Byte tag identifier used for target mode.
1225  */
1226 register TAGPTR {
1227         address                 0x021
1228         access_mode     RW
1229         modes           M_CFG
1230 }
1231
1232 /*
1233  * Logical Unit Number Pointer
1234  * SCB offset to the LSB (little endian) of the lun field.
1235  */
1236 register LUNPTR {
1237         address                 0x022
1238         access_mode     RW
1239         modes           M_CFG
1240 }
1241
1242 /*
1243  * Data Length Pointer
1244  * SCB offset for the 4 byte data length field in target mode.
1245  */
1246 register DATALENPTR {
1247         address                 0x023
1248         access_mode     RW
1249         modes           M_CFG
1250 }
1251
1252 /*
1253  * Status Length Pointer
1254  * SCB offset to the two byte status field in target SCBs.
1255  */
1256 register STATLENPTR {
1257         address                 0x024
1258         access_mode     RW
1259         modes           M_CFG
1260 }
1261
1262 /*
1263  * Command Length Pointer
1264  * Scb offset for the CDB length field in initiator SCBs.
1265  */
1266 register CMDLENPTR {
1267         address                 0x025
1268         access_mode     RW
1269         modes           M_CFG
1270 }
1271
1272 /*
1273  * Task Attribute Pointer
1274  * Scb offset for the byte field specifying the attribute byte
1275  * to be used in command packets.
1276  */ 
1277 register ATTRPTR {
1278         address                 0x026
1279         access_mode     RW
1280         modes           M_CFG
1281 }
1282
1283 /*
1284  * Task Management Flags Pointer
1285  * Scb offset for the byte field specifying the attribute flags
1286  * byte to be used in command packets.
1287  */ 
1288 register FLAGPTR {
1289         address                 0x027
1290         access_mode     RW
1291         modes           M_CFG
1292 }
1293
1294 /*
1295  * Command Pointer
1296  * Scb offset for the first byte in the CDB for initiator SCBs.
1297  */
1298 register CMDPTR {
1299         address                 0x028
1300         access_mode     RW
1301         modes           M_CFG
1302 }
1303
1304 /*
1305  * Queue Next Pointer
1306  * Scb offset for the 2 byte "next scb link".
1307  */
1308 register QNEXTPTR {
1309         address                 0x029
1310         access_mode     RW
1311         modes           M_CFG
1312 }
1313
1314 /*
1315  * SCSI ID Pointer
1316  * Scb offset to the value to place in the SCSIID register
1317  * during target mode connections.
1318  */
1319 register IDPTR {
1320         address                 0x02A
1321         access_mode     RW
1322         modes           M_CFG
1323 }
1324
1325 /*
1326  * Command Aborted Byte Pointer
1327  * Offset to the SCB flags field that includes the
1328  * "SCB aborted" status bit.
1329  */
1330 register ABRTBYTEPTR {
1331         address                 0x02B
1332         access_mode     RW
1333         modes           M_CFG
1334 }
1335
1336 /*
1337  * Command Aborted Bit Pointer
1338  * Bit offset in the SCB flags field for "SCB aborted" status.
1339  */
1340 register ABRTBITPTR {
1341         address                 0x02C
1342         access_mode     RW
1343         modes           M_CFG
1344 }
1345
1346 /*
1347  * Rev B or greater.
1348  */
1349 register MAXCMDBYTES {
1350         address                 0x02D
1351         access_mode     RW
1352         modes           M_CFG
1353 }
1354
1355 /*
1356  * Rev B or greater.
1357  */
1358 register MAXCMD2RCV {
1359         address                 0x02E
1360         access_mode     RW
1361         modes           M_CFG
1362 }
1363
1364 /*
1365  * Rev B or greater.
1366  */
1367 register SHORTTHRESH {
1368         address                 0x02F
1369         access_mode     RW
1370         modes           M_CFG
1371 }
1372
1373 /*
1374  * Logical Unit Number Length
1375  * The length, in bytes, of the SCB lun field.
1376  */
1377 register LUNLEN {
1378         address                 0x030
1379         access_mode     RW
1380         modes           M_CFG
1381         mask            ILUNLEN 0x0F
1382         mask            TLUNLEN 0xF0
1383 }
1384 const LUNLEN_SINGLE_LEVEL_LUN 0xF
1385
1386 /*
1387  * CDB Limit
1388  * The size, in bytes, of the embedded CDB field in initator SCBs.
1389  */
1390 register CDBLIMIT {
1391         address                 0x031
1392         access_mode     RW
1393         modes           M_CFG
1394 }
1395
1396 /*
1397  * Maximum Commands
1398  * The maximum number of commands to issue during a
1399  * single packetized connection.
1400  */
1401 register MAXCMD {
1402         address                 0x032
1403         access_mode     RW
1404         modes           M_CFG
1405 }
1406
1407 /*
1408  * Maximum Command Counter
1409  * The number of commands already sent during this connection
1410  */
1411 register MAXCMDCNT {
1412         address                 0x033
1413         access_mode     RW
1414         modes           M_CFG
1415 }
1416
1417 /*
1418  * LQ Packet Reserved Bytes
1419  * The bytes to be sent in the currently reserved fileds
1420  * of all LQ packets.
1421  */
1422 register LQRSVD01 {
1423         address                 0x034
1424         access_mode     RW
1425         modes           M_SCSI
1426 }
1427 register LQRSVD16 {
1428         address                 0x035
1429         access_mode     RW
1430         modes           M_SCSI
1431 }
1432 register LQRSVD17 {
1433         address                 0x036
1434         access_mode     RW
1435         modes           M_SCSI
1436 }
1437
1438 /*
1439  * Command Reserved 0
1440  * The byte to be sent for the reserved byte 0 of
1441  * outgoing command packets.
1442  */
1443 register CMDRSVD0 {
1444         address                 0x037
1445         access_mode     RW
1446         modes           M_CFG
1447 }
1448
1449 /*
1450  * LQ Manager Control 0
1451  */
1452 register LQCTL0 {
1453         address                 0x038
1454         access_mode     RW
1455         modes           M_CFG
1456         field   LQITARGCLT      0xC0
1457         field   LQIINITGCLT     0x30
1458         field   LQ0TARGCLT      0x0C
1459         field   LQ0INITGCLT     0x03
1460 }
1461
1462 /*
1463  * LQ Manager Control 1
1464  */
1465 register LQCTL1 {
1466         address                 0x038
1467         access_mode     RW
1468         modes           M_DFF0, M_DFF1, M_SCSI
1469         field   PCI2PCI         0x04
1470         field   SINGLECMD       0x02
1471         field   ABORTPENDING    0x01
1472 }
1473
1474 /*
1475  * LQ Manager Control 2
1476  */
1477 register LQCTL2 {
1478         address                 0x039
1479         access_mode     RW
1480         modes           M_DFF0, M_DFF1, M_SCSI
1481         field   LQIRETRY        0x80
1482         field   LQICONTINUE     0x40
1483         field   LQITOIDLE       0x20
1484         field   LQIPAUSE        0x10
1485         field   LQORETRY        0x08
1486         field   LQOCONTINUE     0x04
1487         field   LQOTOIDLE       0x02
1488         field   LQOPAUSE        0x01
1489 }
1490
1491 /*
1492  * SCSI RAM BIST0
1493  */
1494 register SCSBIST0 {
1495         address                 0x039
1496         access_mode     RW
1497         modes           M_CFG
1498         field   GSBISTERR       0x40
1499         field   GSBISTDONE      0x20
1500         field   GSBISTRUN       0x10
1501         field   OSBISTERR       0x04
1502         field   OSBISTDONE      0x02
1503         field   OSBISTRUN       0x01
1504 }
1505
1506 /*
1507  * SCSI Sequence Control0
1508  */
1509 register SCSISEQ0 {
1510         address                 0x03A
1511         access_mode     RW
1512         modes           M_DFF0, M_DFF1, M_SCSI
1513         field   TEMODEO         0x80
1514         field   ENSELO          0x40
1515         field   ENARBO          0x20
1516         field   FORCEBUSFREE    0x10
1517         field   SCSIRSTO        0x01
1518 }
1519
1520 /*
1521  * SCSI RAM BIST 1
1522  */
1523 register SCSBIST1 {
1524         address                 0x03A
1525         access_mode     RW
1526         modes           M_CFG
1527         field   NTBISTERR       0x04
1528         field   NTBISTDONE      0x02
1529         field   NTBISTRUN       0x01
1530 }
1531
1532 /*
1533  * SCSI Sequence Control 1
1534  */
1535 register SCSISEQ1 {
1536         address                 0x03B
1537         access_mode     RW
1538         modes           M_DFF0, M_DFF1, M_SCSI
1539         field   MANUALCTL       0x40
1540         field   ENSELI          0x20
1541         field   ENRSELI         0x10
1542         field   MANUALP         0x0C
1543         field   ENAUTOATNP      0x02
1544         field   ALTSTIM         0x01
1545 }
1546
1547 /*
1548  * SCSI Transfer Control 0
1549  */
1550 register SXFRCTL0 {
1551         address                 0x03C
1552         access_mode     RW
1553         modes           M_SCSI
1554         field   DFON            0x80
1555         field   DFPEXP          0x40
1556         field   BIOSCANCELEN    0x10
1557         field   SPIOEN          0x08
1558 }
1559
1560 /*
1561  * SCSI Transfer Control 1
1562  */
1563 register SXFRCTL1 {
1564         address                 0x03D
1565         access_mode     RW
1566         modes           M_SCSI
1567         field   BITBUCKET       0x80
1568         field   ENSACHK         0x40
1569         field   ENSPCHK         0x20
1570         field   STIMESEL        0x18
1571         field   ENSTIMER        0x04
1572         field   ACTNEGEN        0x02
1573         field   STPWEN          0x01
1574 }
1575
1576 /*
1577  * SCSI Transfer Control 2
1578  */
1579 register SXFRCTL2 {
1580         address                 0x03E
1581         access_mode     RW
1582         modes           M_SCSI
1583         field   AUTORSTDIS      0x10
1584         field   CMDDMAEN        0x08
1585         field   ASU             0x07
1586 }
1587
1588 /*
1589  * SCSI Bus Initiator IDs
1590  * Bitmask of observed initiators on the bus.
1591  */
1592 register BUSINITID {
1593         address                 0x03C
1594         access_mode     RW
1595         modes           M_CFG
1596         size            2
1597 }
1598
1599 /*
1600  * Data Length Counters
1601  * Packet byte counter.
1602  */
1603 register DLCOUNT {
1604         address                 0x03C
1605         access_mode     RW
1606         modes           M_DFF0, M_DFF1
1607         size            3
1608 }
1609
1610 /*
1611  * Data FIFO Status
1612  */
1613 register DFFSTAT {
1614         address                 0x03F
1615         access_mode     RW
1616         modes           M_SCSI
1617         field   FIFO1FREE       0x20
1618         field   FIFO0FREE       0x10
1619         /*
1620          * On the B, this enum only works
1621          * in the read direction.  For writes,
1622          * you must use the B version of the
1623          * CURRFIFO_0 definition which is defined
1624          * as a constant outside of this register
1625          * definition to avoid confusing the
1626          * register pretty printing code.
1627          */
1628         enum    CURRFIFO        0x03 {
1629                 CURRFIFO_0,
1630                 CURRFIFO_1,
1631                 CURRFIFO_NONE   0x3
1632         }
1633 }
1634
1635 const B_CURRFIFO_0 0x2
1636
1637 /*
1638  * SCSI Bus Target IDs
1639  * Bitmask of observed targets on the bus.
1640  */
1641 register BUSTARGID {
1642         address                 0x03E
1643         access_mode     RW
1644         modes           M_CFG
1645         size            2
1646 }
1647
1648 /*
1649  * SCSI Control Signal Out
1650  */
1651 register SCSISIGO {
1652         address                 0x040
1653         access_mode     RW
1654         modes           M_DFF0, M_DFF1, M_SCSI
1655         field   CDO             0x80
1656         field   IOO             0x40
1657         field   MSGO            0x20
1658         field   ATNO            0x10
1659         field   SELO            0x08
1660         field   BSYO            0x04
1661         field   REQO            0x02
1662         field   ACKO            0x01
1663 /*
1664  * Possible phases to write into SCSISIG0
1665  */
1666         enum    PHASE_MASK  CDO|IOO|MSGO {
1667                 P_DATAOUT       0x0,
1668                 P_DATAIN        IOO,
1669                 P_DATAOUT_DT    P_DATAOUT|MSGO,
1670                 P_DATAIN_DT     P_DATAIN|MSGO,
1671                 P_COMMAND       CDO,
1672                 P_MESGOUT       CDO|MSGO,
1673                 P_STATUS        CDO|IOO,
1674                 P_MESGIN        CDO|IOO|MSGO
1675         }
1676 }
1677
1678 register SCSISIGI {
1679         address                 0x041
1680         access_mode     RO
1681         modes           M_DFF0, M_DFF1, M_SCSI
1682         field   CDI             0x80
1683         field   IOI             0x40
1684         field   MSGI            0x20
1685         field   ATNI            0x10
1686         field   SELI            0x08
1687         field   BSYI            0x04
1688         field   REQI            0x02
1689         field   ACKI            0x01
1690 /*
1691  * Possible phases in SCSISIGI
1692  */
1693         enum    PHASE_MASK  CDO|IOO|MSGO {
1694                 P_DATAOUT       0x0,
1695                 P_DATAIN        IOO,
1696                 P_DATAOUT_DT    P_DATAOUT|MSGO,
1697                 P_DATAIN_DT     P_DATAIN|MSGO,
1698                 P_COMMAND       CDO,
1699                 P_MESGOUT       CDO|MSGO,
1700                 P_STATUS        CDO|IOO,
1701                 P_MESGIN        CDO|IOO|MSGO
1702         }
1703 }
1704
1705 /*
1706  * Multiple Target IDs
1707  * Bitmask of ids to respond as a target.
1708  */
1709 register MULTARGID {
1710         address                 0x040
1711         access_mode     RW
1712         modes           M_CFG
1713         size            2
1714 }
1715
1716 /*
1717  * SCSI Phase
1718  */
1719 register SCSIPHASE {
1720         address                 0x042
1721         access_mode     RO
1722         modes           M_DFF0, M_DFF1, M_SCSI
1723         field   STATUS_PHASE    0x20
1724         field   COMMAND_PHASE   0x10
1725         field   MSG_IN_PHASE    0x08
1726         field   MSG_OUT_PHASE   0x04
1727         field   DATA_PHASE_MASK 0x03 {
1728                 DATA_OUT_PHASE  0x01,
1729                 DATA_IN_PHASE   0x02
1730         }
1731 }
1732
1733 /*
1734  * SCSI Data 0 Image
1735  */
1736 register SCSIDAT0_IMG {
1737         address                 0x043
1738         access_mode     RW
1739         modes           M_DFF0, M_DFF1, M_SCSI
1740 }
1741
1742 /*
1743  * SCSI Latched Data
1744  */
1745 register SCSIDAT {
1746         address                 0x044
1747         access_mode     RW
1748         modes           M_DFF0, M_DFF1, M_SCSI
1749         size            2
1750 }
1751
1752 /*
1753  * SCSI Data Bus
1754  */
1755 register SCSIBUS {
1756         address                 0x046
1757         access_mode     RW
1758         modes           M_DFF0, M_DFF1, M_SCSI
1759         size            2
1760 }
1761
1762 /*
1763  * Target ID In
1764  */
1765 register TARGIDIN {
1766         address                 0x048
1767         access_mode     RO
1768         modes           M_DFF0, M_DFF1, M_SCSI
1769         field   CLKOUT          0x80
1770         field   TARGID          0x0F
1771 }
1772
1773 /*
1774  * Selection/Reselection ID
1775  * Upper four bits are the device id.  The ONEBIT is set when the re/selecting
1776  * device did not set its own ID.
1777  */
1778 register SELID {
1779         address                 0x049
1780         access_mode     RW
1781         modes           M_DFF0, M_DFF1, M_SCSI
1782         field   SELID_MASK      0xf0
1783         field   ONEBIT          0x08
1784 }
1785
1786 /*
1787  * SCSI Block Control
1788  * Controls Bus type and channel selection.  SELWIDE allows for the
1789  * coexistence of 8bit and 16bit devices on a wide bus.
1790  */
1791 register SBLKCTL {
1792         address                 0x04A
1793         access_mode     RW
1794         modes           M_DFF0, M_DFF1, M_SCSI
1795         field   DIAGLEDEN       0x80
1796         field   DIAGLEDON       0x40
1797         field   ENAB40          0x08    /* LVD transceiver active */
1798         field   ENAB20          0x04    /* SE/HVD transceiver active */
1799         field   SELWIDE         0x02
1800 }
1801
1802 /*
1803  * Option Mode
1804  */
1805 register OPTIONMODE {
1806         address                 0x04A
1807         access_mode     RW
1808         modes           M_CFG
1809         field   BIOSCANCTL              0x80
1810         field   AUTOACKEN               0x40
1811         field   BIASCANCTL              0x20
1812         field   BUSFREEREV              0x10
1813         field   ENDGFORMCHK             0x04
1814         field   AUTO_MSGOUT_DE          0x02
1815         mask    OPTIONMODE_DEFAULTS     AUTO_MSGOUT_DE
1816 }
1817
1818 /*
1819  * SCSI Status 0
1820  */
1821 register SSTAT0 {
1822         address                 0x04B
1823         access_mode     RO
1824         modes           M_DFF0, M_DFF1, M_SCSI
1825         field   TARGET          0x80    /* Board acting as target */
1826         field   SELDO           0x40    /* Selection Done */
1827         field   SELDI           0x20    /* Board has been selected */
1828         field   SELINGO         0x10    /* Selection In Progress */
1829         field   IOERR           0x08    /* LVD Tranceiver mode changed */
1830         field   OVERRUN         0x04    /* SCSI Offset overrun detected */
1831         field   SPIORDY         0x02    /* SCSI PIO Ready */
1832         field   ARBDO           0x01    /* Arbitration Done Out */
1833 }
1834
1835 /*
1836  * Clear SCSI Interrupt 0
1837  * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT0.
1838  */
1839 register CLRSINT0 {
1840         address                 0x04B
1841         access_mode     WO
1842         modes           M_DFF0, M_DFF1, M_SCSI
1843         field   CLRSELDO        0x40
1844         field   CLRSELDI        0x20
1845         field   CLRSELINGO      0x10
1846         field   CLRIOERR        0x08
1847         field   CLROVERRUN      0x04
1848         field   CLRSPIORDY      0x02
1849         field   CLRARBDO        0x01
1850 }
1851
1852 /*
1853  * SCSI Interrupt Mode 0
1854  * Setting any bit will enable the corresponding function
1855  * in SIMODE0 to interrupt via the IRQ pin.
1856  */
1857 register SIMODE0 {
1858         address                 0x04B
1859         access_mode     RW
1860         modes           M_CFG
1861         field   ENSELDO         0x40
1862         field   ENSELDI         0x20
1863         field   ENSELINGO       0x10
1864         field   ENIOERR         0x08
1865         field   ENOVERRUN       0x04
1866         field   ENSPIORDY       0x02
1867         field   ENARBDO         0x01
1868 }
1869
1870 /*
1871  * SCSI Status 1
1872  */
1873 register SSTAT1 {
1874         address                 0x04C
1875         access_mode     RO
1876         modes           M_DFF0, M_DFF1, M_SCSI
1877         field   SELTO           0x80
1878         field   ATNTARG         0x40
1879         field   SCSIRSTI        0x20
1880         field   PHASEMIS        0x10
1881         field   BUSFREE         0x08
1882         field   SCSIPERR        0x04
1883         field   STRB2FAST       0x02
1884         field   REQINIT         0x01
1885 }
1886
1887 /*
1888  * Clear SCSI Interrupt 1
1889  * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT1.
1890  */
1891 register CLRSINT1 {
1892         address                 0x04C
1893         access_mode     WO
1894         modes           M_DFF0, M_DFF1, M_SCSI
1895         field   CLRSELTIMEO     0x80
1896         field   CLRATNO         0x40
1897         field   CLRSCSIRSTI     0x20
1898         field   CLRBUSFREE      0x08
1899         field   CLRSCSIPERR     0x04
1900         field   CLRSTRB2FAST    0x02
1901         field   CLRREQINIT      0x01
1902 }
1903
1904 /*
1905  * SCSI Status 2
1906  */
1907 register SSTAT2 {
1908         address                 0x04d
1909         access_mode     RO
1910         modes           M_DFF0, M_DFF1, M_SCSI
1911         field   BUSFREETIME     0xc0 {
1912                 BUSFREE_LQO     0x40,
1913                 BUSFREE_DFF0    0x80,
1914                 BUSFREE_DFF1    0xC0
1915         }
1916         field   NONPACKREQ      0x20
1917         field   EXP_ACTIVE      0x10    /* SCSI Expander Active */
1918         field   BSYX            0x08    /* Busy Expander */
1919         field   WIDE_RES        0x04    /* Modes 0 and 1 only */
1920         field   SDONE           0x02    /* Modes 0 and 1 only */
1921         field   DMADONE         0x01    /* Modes 0 and 1 only */
1922 }
1923
1924 /*
1925  * Clear SCSI Interrupt 2
1926  */
1927 register CLRSINT2 {
1928         address                 0x04D
1929         access_mode     WO
1930         modes           M_DFF0, M_DFF1, M_SCSI
1931         field   CLRNONPACKREQ   0x20
1932         field   CLRWIDE_RES     0x04    /* Modes 0 and 1 only */
1933         field   CLRSDONE        0x02    /* Modes 0 and 1 only */
1934         field   CLRDMADONE      0x01    /* Modes 0 and 1 only */
1935 }
1936
1937 /*
1938  * SCSI Interrupt Mode 2
1939  */
1940 register SIMODE2 {
1941         address                 0x04D
1942         access_mode     RW
1943         modes           M_CFG
1944         field   ENWIDE_RES      0x04
1945         field   ENSDONE         0x02
1946         field   ENDMADONE       0x01
1947 }
1948
1949 /*
1950  * Physical Error Diagnosis
1951  */
1952 register PERRDIAG {
1953         address                 0x04E
1954         access_mode     RO
1955         modes           M_DFF0, M_DFF1, M_SCSI
1956         field   HIZERO          0x80
1957         field   HIPERR          0x40
1958         field   PREVPHASE       0x20
1959         field   PARITYERR       0x10
1960         field   AIPERR          0x08
1961         field   CRCERR          0x04
1962         field   DGFORMERR       0x02
1963         field   DTERR           0x01
1964 }
1965
1966 /*
1967  * LQI Manager Current State
1968  */
1969 register LQISTATE {
1970         address                 0x04E
1971         access_mode     RO
1972         modes           M_CFG
1973 }
1974
1975 /*
1976  * SCSI Offset Count
1977  */
1978 register SOFFCNT {
1979         address                 0x04F
1980         access_mode     RO
1981         modes           M_DFF0, M_DFF1, M_SCSI
1982 }
1983
1984 /*
1985  * LQO Manager Current State
1986  */
1987 register LQOSTATE {
1988         address                 0x04F
1989         access_mode     RO
1990         modes           M_CFG
1991 }
1992
1993 /*
1994  * LQI Manager Status
1995  */
1996 register LQISTAT0 {
1997         address                 0x050
1998         access_mode     RO
1999         modes           M_DFF0, M_DFF1, M_SCSI
2000         field   LQIATNQAS       0x20
2001         field   LQICRCT1        0x10
2002         field   LQICRCT2        0x08
2003         field   LQIBADLQT       0x04
2004         field   LQIATNLQ        0x02
2005         field   LQIATNCMD       0x01
2006 }
2007
2008 /*
2009  * Clear LQI Interrupts 0
2010  */
2011 register CLRLQIINT0 {
2012         address                 0x050
2013         access_mode     WO
2014         modes           M_DFF0, M_DFF1, M_SCSI
2015         field   CLRLQIATNQAS    0x20
2016         field   CLRLQICRCT1     0x10
2017         field   CLRLQICRCT2     0x08
2018         field   CLRLQIBADLQT    0x04
2019         field   CLRLQIATNLQ     0x02
2020         field   CLRLQIATNCMD    0x01
2021 }
2022
2023 /*
2024  * LQI Manager Interrupt Mode 0
2025  */
2026 register LQIMODE0 {
2027         address                 0x050
2028         access_mode     RW
2029         modes           M_CFG
2030         field   ENLQIATNQASK    0x20
2031         field   ENLQICRCT1      0x10
2032         field   ENLQICRCT2      0x08
2033         field   ENLQIBADLQT     0x04
2034         field   ENLQIATNLQ      0x02
2035         field   ENLQIATNCMD     0x01
2036 }
2037
2038 /*
2039  * LQI Manager Status 1
2040  */
2041 register LQISTAT1 {
2042         address                 0x051
2043         access_mode     RO
2044         modes           M_DFF0, M_DFF1, M_SCSI
2045         field   LQIPHASE_LQ     0x80
2046         field   LQIPHASE_NLQ    0x40
2047         field   LQIABORT        0x20
2048         field   LQICRCI_LQ      0x10
2049         field   LQICRCI_NLQ     0x08
2050         field   LQIBADLQI       0x04
2051         field   LQIOVERI_LQ     0x02
2052         field   LQIOVERI_NLQ    0x01
2053 }
2054
2055 /*
2056  * Clear LQI Manager Interrupts1
2057  */
2058 register CLRLQIINT1 {
2059         address                 0x051
2060         access_mode     WO
2061         modes           M_DFF0, M_DFF1, M_SCSI
2062         field   CLRLQIPHASE_LQ  0x80
2063         field   CLRLQIPHASE_NLQ 0x40
2064         field   CLRLIQABORT     0x20
2065         field   CLRLQICRCI_LQ   0x10
2066         field   CLRLQICRCI_NLQ  0x08
2067         field   CLRLQIBADLQI    0x04
2068         field   CLRLQIOVERI_LQ  0x02
2069         field   CLRLQIOVERI_NLQ 0x01
2070 }
2071
2072 /*
2073  * LQI Manager Interrupt Mode 1
2074  */
2075 register LQIMODE1 {
2076         address                 0x051
2077         access_mode     RW
2078         modes           M_CFG
2079         field   ENLQIPHASE_LQ   0x80    /* LQIPHASE1 */
2080         field   ENLQIPHASE_NLQ  0x40    /* LQIPHASE2 */
2081         field   ENLIQABORT      0x20
2082         field   ENLQICRCI_LQ    0x10    /* LQICRCI1 */
2083         field   ENLQICRCI_NLQ   0x08    /* LQICRCI2 */
2084         field   ENLQIBADLQI     0x04
2085         field   ENLQIOVERI_LQ   0x02    /* LQIOVERI1 */
2086         field   ENLQIOVERI_NLQ  0x01    /* LQIOVERI2 */
2087 }
2088
2089 /*
2090  * LQI Manager Status 2
2091  */
2092 register LQISTAT2 {
2093         address                 0x052
2094         access_mode     RO
2095         modes           M_DFF0, M_DFF1, M_SCSI
2096         field   PACKETIZED      0x80
2097         field   LQIPHASE_OUTPKT 0x40
2098         field   LQIWORKONLQ     0x20
2099         field   LQIWAITFIFO     0x10
2100         field   LQISTOPPKT      0x08
2101         field   LQISTOPLQ       0x04
2102         field   LQISTOPCMD      0x02
2103         field   LQIGSAVAIL      0x01
2104 }
2105
2106 /*
2107  * SCSI Status 3
2108  */
2109 register SSTAT3 {
2110         address                 0x053
2111         access_mode     RO
2112         modes           M_DFF0, M_DFF1, M_SCSI
2113         field   NTRAMPERR       0x02
2114         field   OSRAMPERR       0x01
2115 }
2116
2117 /*
2118  * Clear SCSI Status 3
2119  */
2120 register CLRSINT3 {
2121         address                 0x053
2122         access_mode     WO
2123         modes           M_DFF0, M_DFF1, M_SCSI
2124         field   CLRNTRAMPERR    0x02
2125         field   CLROSRAMPERR    0x01
2126 }
2127
2128 /*
2129  * SCSI Interrupt Mode 3
2130  */
2131 register SIMODE3 {
2132         address                 0x053
2133         access_mode     RW
2134         modes           M_CFG
2135         field   ENNTRAMPERR     0x02
2136         field   ENOSRAMPERR     0x01
2137 }
2138
2139 /*
2140  * LQO Manager Status 0
2141  */
2142 register LQOSTAT0 {
2143         address                 0x054
2144         access_mode     RO
2145         modes           M_DFF0, M_DFF1, M_SCSI
2146         field   LQOTARGSCBPERR  0x10
2147         field   LQOSTOPT2       0x08
2148         field   LQOATNLQ        0x04
2149         field   LQOATNPKT       0x02
2150         field   LQOTCRC         0x01
2151 }
2152
2153 /*
2154  * Clear LQO Manager interrupt 0
2155  */
2156 register CLRLQOINT0 {
2157         address                 0x054
2158         access_mode     WO
2159         modes           M_DFF0, M_DFF1, M_SCSI
2160         field   CLRLQOTARGSCBPERR       0x10
2161         field   CLRLQOSTOPT2            0x08
2162         field   CLRLQOATNLQ             0x04
2163         field   CLRLQOATNPKT            0x02
2164         field   CLRLQOTCRC              0x01
2165 }
2166
2167 /*
2168  * LQO Manager Interrupt Mode 0
2169  */
2170 register LQOMODE0 {
2171         address                 0x054
2172         access_mode     RW
2173         modes           M_CFG
2174         field   ENLQOTARGSCBPERR        0x10
2175         field   ENLQOSTOPT2             0x08
2176         field   ENLQOATNLQ              0x04
2177         field   ENLQOATNPKT             0x02
2178         field   ENLQOTCRC               0x01
2179 }
2180
2181 /*
2182  * LQO Manager Status 1
2183  */
2184 register LQOSTAT1 {
2185         address                 0x055
2186         access_mode     RO
2187         modes           M_DFF0, M_DFF1, M_SCSI
2188         field   LQOINITSCBPERR  0x10
2189         field   LQOSTOPI2       0x08
2190         field   LQOBADQAS       0x04
2191         field   LQOBUSFREE      0x02
2192         field   LQOPHACHGINPKT  0x01
2193 }
2194
2195 /*
2196  * Clear LOQ Interrupt 1
2197  */
2198 register CLRLQOINT1 {
2199         address                 0x055
2200         access_mode     WO
2201         modes           M_DFF0, M_DFF1, M_SCSI
2202         field   CLRLQOINITSCBPERR       0x10
2203         field   CLRLQOSTOPI2            0x08
2204         field   CLRLQOBADQAS            0x04
2205         field   CLRLQOBUSFREE           0x02
2206         field   CLRLQOPHACHGINPKT       0x01
2207 }
2208
2209 /*
2210  * LQO Manager Interrupt Mode 1
2211  */
2212 register LQOMODE1 {
2213         address                 0x055
2214         access_mode     RW
2215         modes           M_CFG
2216         field   ENLQOINITSCBPERR        0x10
2217         field   ENLQOSTOPI2             0x08
2218         field   ENLQOBADQAS             0x04
2219         field   ENLQOBUSFREE            0x02
2220         field   ENLQOPHACHGINPKT        0x01
2221 }
2222
2223 /*
2224  * LQO Manager Status 2
2225  */
2226 register LQOSTAT2 {
2227         address                 0x056
2228         access_mode     RO
2229         modes           M_DFF0, M_DFF1, M_SCSI
2230         field   LQOPKT          0xE0
2231         field   LQOWAITFIFO     0x10
2232         field   LQOPHACHGOUTPKT 0x02    /* outside of packet boundaries. */
2233         field   LQOSTOP0        0x01    /* Stopped after sending all packets */
2234 }
2235
2236 /*
2237  * Output Synchronizer Space Count
2238  */
2239 register OS_SPACE_CNT {
2240         address                 0x056
2241         access_mode     RO
2242         modes           M_CFG
2243 }
2244
2245 /*
2246  * SCSI Interrupt Mode 1
2247  * Setting any bit will enable the corresponding function
2248  * in SIMODE1 to interrupt via the IRQ pin.
2249  */
2250 register SIMODE1 {
2251         address                 0x057
2252         access_mode     RW
2253         modes           M_DFF0, M_DFF1, M_SCSI
2254         field   ENSELTIMO       0x80
2255         field   ENATNTARG       0x40
2256         field   ENSCSIRST       0x20
2257         field   ENPHASEMIS      0x10
2258         field   ENBUSFREE       0x08
2259         field   ENSCSIPERR      0x04
2260         field   ENSTRB2FAST     0x02
2261         field   ENREQINIT       0x01
2262 }
2263
2264 /*
2265  * Good Status FIFO
2266  */
2267 register GSFIFO {
2268         address                 0x058
2269         access_mode     RO
2270         size            2
2271         modes           M_DFF0, M_DFF1, M_SCSI
2272 }
2273
2274 /*
2275  * Data FIFO SCSI Transfer Control
2276  */
2277 register DFFSXFRCTL {
2278         address                 0x05A
2279         access_mode     RW
2280         modes           M_DFF0, M_DFF1
2281         field   DFFBITBUCKET    0x08
2282         field   CLRSHCNT        0x04
2283         field   CLRCHN          0x02
2284         field   RSTCHN          0x01
2285 }
2286
2287 /*
2288  * Next SCSI Control Block
2289  */
2290 register NEXTSCB {
2291         address                 0x05A
2292         access_mode     RW
2293         size            2
2294         modes           M_SCSI
2295 }
2296
2297 /* Rev B only. */
2298 register LQOSCSCTL {
2299         address                 0x05A
2300         access_mode     RW
2301         size            1
2302         modes           M_CFG
2303         field           LQOH2A_VERSION  0x80
2304         field           LQONOCHKOVER    0x01
2305 }
2306
2307 /*
2308  * SEQ Interrupts
2309  */
2310 register SEQINTSRC {
2311         address                 0x05B
2312         access_mode     RO
2313         modes           M_DFF0, M_DFF1
2314         field   CTXTDONE        0x40
2315         field   SAVEPTRS        0x20
2316         field   CFG4DATA        0x10
2317         field   CFG4ISTAT       0x08
2318         field   CFG4TSTAT       0x04
2319         field   CFG4ICMD        0x02
2320         field   CFG4TCMD        0x01
2321 }
2322
2323 /*
2324  * Clear Arp Interrupts
2325  */
2326 register CLRSEQINTSRC {
2327         address                 0x05B
2328         access_mode     WO
2329         modes           M_DFF0, M_DFF1
2330         field   CLRCTXTDONE     0x40
2331         field   CLRSAVEPTRS     0x20
2332         field   CLRCFG4DATA     0x10
2333         field   CLRCFG4ISTAT    0x08
2334         field   CLRCFG4TSTAT    0x04
2335         field   CLRCFG4ICMD     0x02
2336         field   CLRCFG4TCMD     0x01
2337 }
2338
2339 /*
2340  * SEQ Interrupt Enabled (Shared)
2341  */
2342 register SEQIMODE {
2343         address                 0x05C
2344         access_mode     RW
2345         modes           M_DFF0, M_DFF1
2346         field   ENCTXTDONE      0x40
2347         field   ENSAVEPTRS      0x20
2348         field   ENCFG4DATA      0x10
2349         field   ENCFG4ISTAT     0x08
2350         field   ENCFG4TSTAT     0x04
2351         field   ENCFG4ICMD      0x02
2352         field   ENCFG4TCMD      0x01
2353 }
2354
2355 /*
2356  * Current SCSI Control Block
2357  */
2358 register CURRSCB {
2359         address                 0x05C
2360         access_mode     RW
2361         size            2
2362         modes           M_SCSI
2363 }
2364
2365 /*
2366  * Data FIFO Status
2367  */
2368 register MDFFSTAT {
2369         address                 0x05D
2370         access_mode     RO
2371         modes           M_DFF0, M_DFF1
2372         field   SHCNTNEGATIVE   0x40 /* Rev B or higher */
2373         field   SHCNTMINUS1     0x20 /* Rev B or higher */
2374         field   LASTSDONE       0x10
2375         field   SHVALID         0x08
2376         field   DLZERO          0x04 /* FIFO data ends on packet boundary. */
2377         field   DATAINFIFO      0x02
2378         field   FIFOFREE        0x01
2379 }
2380
2381 /*
2382  * CRC Control
2383  */
2384 register CRCCONTROL {
2385         address                 0x05d
2386         access_mode     RW
2387         modes           M_CFG
2388         field   CRCVALCHKEN             0x40
2389 }
2390
2391 /*
2392  * SCSI Test Control
2393  */
2394 register SCSITEST {
2395         address                 0x05E
2396         access_mode     RW
2397         modes           M_CFG
2398         field   CNTRTEST        0x08
2399         field   SEL_TXPLL_DEBUG 0x04
2400 }
2401
2402 /*
2403  * Data FIFO Queue Tag
2404  */
2405 register DFFTAG {
2406         address                 0x05E
2407         access_mode     RW
2408         size            2
2409         modes           M_DFF0, M_DFF1
2410 }
2411
2412 /*
2413  * Last SCSI Control Block
2414  */
2415 register LASTSCB {
2416         address                 0x05E
2417         access_mode     RW
2418         size            2
2419         modes           M_SCSI
2420 }
2421
2422 /*
2423  * SCSI I/O Cell Power-down Control
2424  */
2425 register IOPDNCTL {
2426         address                 0x05F
2427         access_mode     RW
2428         modes           M_CFG
2429         field   DISABLE_OE      0x80
2430         field   PDN_IDIST       0x04
2431         field   PDN_DIFFSENSE   0x01
2432 }
2433
2434 /*
2435  * Shaddow Host Address.
2436  */
2437 register SHADDR {
2438         address                 0x060
2439         access_mode     RO
2440         size            8
2441         modes           M_DFF0, M_DFF1
2442 }
2443
2444 /*
2445  * Data Group CRC Interval.
2446  */
2447 register DGRPCRCI {
2448         address                 0x060
2449         access_mode     RW
2450         size            2
2451         modes           M_CFG
2452 }
2453
2454 /*
2455  * Data Transfer Negotiation Address
2456  */
2457 register NEGOADDR {
2458         address                 0x060
2459         access_mode     RW
2460         modes           M_SCSI
2461 }
2462
2463 /*
2464  * Data Transfer Negotiation Data - Period Byte
2465  */
2466 register NEGPERIOD {
2467         address                 0x061
2468         access_mode     RW
2469         modes           M_SCSI
2470 }
2471
2472 /*
2473  * Packetized CRC Interval
2474  */
2475 register PACKCRCI {
2476         address                 0x062
2477         access_mode     RW
2478         size            2
2479         modes           M_CFG
2480 }
2481
2482 /*
2483  * Data Transfer Negotiation Data - Offset Byte
2484  */
2485 register NEGOFFSET {
2486         address                 0x062
2487         access_mode     RW
2488         modes           M_SCSI
2489 }
2490
2491 /*
2492  * Data Transfer Negotiation Data - PPR Options
2493  */
2494 register NEGPPROPTS {
2495         address                 0x063
2496         access_mode     RW
2497         modes           M_SCSI
2498         field   PPROPT_PACE     0x08
2499         field   PPROPT_QAS      0x04
2500         field   PPROPT_DT       0x02
2501         field   PPROPT_IUT      0x01
2502 }
2503
2504 /*
2505  * Data Transfer Negotiation Data -  Connection Options
2506  */
2507 register NEGCONOPTS {
2508         address                 0x064
2509         access_mode     RW
2510         modes           M_SCSI
2511         field   ENSNAPSHOT      0x40
2512         field   RTI_WRTDIS      0x20
2513         field   RTI_OVRDTRN     0x10
2514         field   ENSLOWCRC       0x08
2515         field   ENAUTOATNI      0x04
2516         field   ENAUTOATNO      0x02
2517         field   WIDEXFER        0x01
2518 }
2519
2520 /*
2521  * Negotiation Table Annex Column Index.
2522  */
2523 register ANNEXCOL {
2524         address                 0x065
2525         access_mode     RW
2526         modes           M_SCSI
2527 }
2528
2529 register SCSCHKN {
2530         address                 0x066
2531         access_mode     RW
2532         modes           M_CFG
2533         field   STSELSKIDDIS    0x40
2534         field   CURRFIFODEF     0x20
2535         field   WIDERESEN       0x10
2536         field   SDONEMSKDIS     0x08
2537         field   DFFACTCLR       0x04
2538         field   SHVALIDSTDIS    0x02
2539         field   LSTSGCLRDIS     0x01
2540 }
2541
2542 const AHD_ANNEXCOL_PER_DEV0     4
2543 const AHD_NUM_PER_DEV_ANNEXCOLS 4
2544 const AHD_ANNEXCOL_PRECOMP_SLEW 4
2545 const   AHD_PRECOMP_MASK        0x07
2546 const   AHD_PRECOMP_SHIFT       0
2547 const   AHD_PRECOMP_CUTBACK_17  0x04
2548 const   AHD_PRECOMP_CUTBACK_29  0x06
2549 const   AHD_PRECOMP_CUTBACK_37  0x07
2550 const   AHD_SLEWRATE_MASK       0x78
2551 const   AHD_SLEWRATE_SHIFT      3
2552 /*
2553  * Rev A has only a single bit (high bit of field) of slew adjustment.
2554  * Rev B has 4 bits.  The current default happens to be the same for both.
2555  */
2556 const   AHD_SLEWRATE_DEF_REVA   0x08
2557 const   AHD_SLEWRATE_DEF_REVB   0x08
2558
2559 /* Rev A does not have any amplitude setting. */
2560 const AHD_ANNEXCOL_AMPLITUDE    6
2561 const   AHD_AMPLITUDE_MASK      0x7
2562 const   AHD_AMPLITUDE_SHIFT     0
2563 const   AHD_AMPLITUDE_DEF       0x7
2564
2565 /*
2566  * Negotiation Table Annex Data Port.
2567  */
2568 register ANNEXDAT {
2569         address                 0x066
2570         access_mode     RW
2571         modes           M_SCSI
2572 }
2573
2574 /*
2575  * Initiator's Own Id.
2576  * The SCSI ID to use for Selection Out and seen during a reselection..
2577  */
2578 register IOWNID {
2579         address                 0x067
2580         access_mode     RW
2581         modes           M_SCSI
2582 }
2583
2584 /*
2585  * 960MHz Phase-Locked Loop Control 0
2586  */
2587 register PLL960CTL0 {
2588         address                 0x068
2589         access_mode     RW
2590         modes           M_CFG
2591         field   PLL_VCOSEL      0x80
2592         field   PLL_PWDN        0x40
2593         field   PLL_NS          0x30
2594         field   PLL_ENLUD       0x08
2595         field   PLL_ENLPF       0x04
2596         field   PLL_DLPF        0x02
2597         field   PLL_ENFBM       0x01
2598 }
2599
2600 /*
2601  * Target Own Id
2602  */
2603 register TOWNID {
2604         address                 0x069
2605         access_mode     RW
2606         modes           M_SCSI
2607 }
2608
2609 /*
2610  * 960MHz Phase-Locked Loop Control 1
2611  */
2612 register PLL960CTL1 {
2613         address                 0x069
2614         access_mode     RW
2615         modes           M_CFG
2616         field   PLL_CNTEN       0x80
2617         field   PLL_CNTCLR      0x40
2618         field   PLL_RST         0x01
2619 }
2620
2621 /*
2622  * Expander Signature
2623  */
2624 register XSIG {
2625         address                 0x06A
2626         access_mode     RW
2627         modes           M_SCSI
2628 }
2629
2630 /*
2631  * Shadow Byte Count
2632  */
2633 register SHCNT {
2634         address                 0x068
2635         access_mode     RW
2636         size            3
2637         modes           M_DFF0, M_DFF1
2638 }
2639
2640 /*
2641  * Selection Out ID
2642  */
2643 register SELOID {
2644         address                 0x06B
2645         access_mode     RW
2646         modes           M_SCSI
2647 }
2648
2649 /*
2650  * 960-MHz Phase-Locked Loop Test Count
2651  */
2652 register PLL960CNT0 {
2653         address                 0x06A
2654         access_mode     RO
2655         size            2
2656         modes           M_CFG
2657 }
2658
2659 /*
2660  * 400-MHz Phase-Locked Loop Control 0
2661  */
2662 register PLL400CTL0 {
2663         address                 0x06C
2664         access_mode     RW
2665         modes           M_CFG
2666         field   PLL_VCOSEL      0x80
2667         field   PLL_PWDN        0x40
2668         field   PLL_NS          0x30
2669         field   PLL_ENLUD       0x08
2670         field   PLL_ENLPF       0x04
2671         field   PLL_DLPF        0x02
2672         field   PLL_ENFBM       0x01
2673 }
2674
2675 /*
2676  * Arbitration Fairness
2677  */
2678 register FAIRNESS {
2679         address                 0x06C
2680         access_mode     RW
2681         size            2
2682         modes           M_SCSI
2683 }
2684
2685 /*
2686  * 400-MHz Phase-Locked Loop Control 1
2687  */
2688 register PLL400CTL1 {
2689         address                 0x06D
2690         access_mode     RW
2691         modes           M_CFG
2692         field   PLL_CNTEN       0x80
2693         field   PLL_CNTCLR      0x40
2694         field   PLL_RST         0x01
2695 }
2696
2697 /*
2698  * Arbitration Unfairness
2699  */
2700 register UNFAIRNESS {
2701         address                 0x06E
2702         access_mode     RW
2703         size            2
2704         modes           M_SCSI
2705 }
2706
2707 /*
2708  * 400-MHz Phase-Locked Loop Test Count
2709  */
2710 register PLL400CNT0 {
2711         address                 0x06E
2712         access_mode     RO
2713         size            2
2714         modes           M_CFG
2715 }
2716
2717 /*
2718  * SCB Page Pointer
2719  */
2720 register SCBPTR {
2721         address                 0x0A8
2722         access_mode     RW
2723         size            2
2724         modes           M_DFF0, M_DFF1, M_CCHAN, M_SCSI
2725 }
2726
2727 /*
2728  * CMC SCB Array Count
2729  * Number of bytes to transfer between CMC SCB memory and SCBRAM.
2730  * Transfers must be 8byte aligned and sized.
2731  */
2732 register CCSCBACNT {
2733         address                 0x0AB
2734         access_mode     RW
2735         modes           M_CCHAN
2736 }
2737
2738 /*
2739  * SCB Autopointer
2740  * SCB-Next Address Snooping logic.  When an SCB is transferred to
2741  * the card, the next SCB address to be used by the CMC array can
2742  * be autoloaded from that transfer.
2743  */
2744 register SCBAUTOPTR {
2745         address                 0x0AB
2746         access_mode     RW
2747         modes           M_CFG
2748         field   AUSCBPTR_EN     0x80
2749         field   SCBPTR_ADDR     0x38
2750         field   SCBPTR_OFF      0x07
2751 }
2752
2753 /*
2754  * CMC SG Ram Address Pointer
2755  */
2756 register CCSGADDR {
2757         address                 0x0AC
2758         access_mode     RW
2759         modes           M_DFF0, M_DFF1
2760 }
2761
2762 /*
2763  * CMC SCB RAM Address Pointer
2764  */
2765 register CCSCBADDR {
2766         address                 0x0AC
2767         access_mode     RW
2768         modes           M_CCHAN
2769 }
2770
2771 /*
2772  * CMC SCB Ram Back-up Address Pointer
2773  * Indicates the true stop location of transfers halted prior
2774  * to SCBHCNT going to 0.
2775  */
2776 register CCSCBADR_BK {
2777         address                 0x0AC
2778         access_mode     RO
2779         modes           M_CFG
2780 }
2781
2782 /*
2783  * CMC SG Control
2784  */
2785 register CCSGCTL {
2786         address                 0x0AD
2787         access_mode     RW
2788         modes           M_DFF0, M_DFF1
2789         field   CCSGDONE        0x80
2790         field   SG_CACHE_AVAIL  0x10
2791         field   CCSGENACK       0x08
2792         mask    CCSGEN          0x0C
2793         field   SG_FETCH_REQ    0x02
2794         field   CCSGRESET       0x01
2795 }
2796
2797 /*
2798  * CMD SCB Control
2799  */
2800 register CCSCBCTL {
2801         address                 0x0AD
2802         access_mode     RW
2803         modes           M_CCHAN
2804         field   CCSCBDONE       0x80
2805         field   ARRDONE         0x40
2806         field   CCARREN         0x10
2807         field   CCSCBEN         0x08
2808         field   CCSCBDIR        0x04
2809         field   CCSCBRESET      0x01
2810 }
2811
2812 /*
2813  * CMC Ram BIST
2814  */
2815 register CMC_RAMBIST {
2816         address                 0x0AD
2817         access_mode     RW
2818         modes           M_CFG
2819         field   SG_ELEMENT_SIZE         0x80
2820         field   SCBRAMBIST_FAIL         0x40
2821         field   SG_BIST_FAIL            0x20
2822         field   SG_BIST_EN              0x10
2823         field   CMC_BUFFER_BIST_FAIL    0x02
2824         field   CMC_BUFFER_BIST_EN      0x01
2825 }
2826
2827 /*
2828  * CMC SG RAM Data Port
2829  */
2830 register CCSGRAM {
2831         address                 0x0B0
2832         access_mode     RW
2833         modes           M_DFF0, M_DFF1
2834 }
2835
2836 /*
2837  * CMC SCB RAM Data Port
2838  */
2839 register CCSCBRAM {
2840         address                 0x0B0
2841         access_mode     RW
2842         modes           M_CCHAN
2843 }
2844
2845 /*
2846  * Flex DMA Address.
2847  */
2848 register FLEXADR {
2849         address                 0x0B0
2850         access_mode     RW
2851         size            3
2852         modes           M_SCSI
2853 }
2854
2855 /*
2856  * Flex DMA Byte Count
2857  */
2858 register FLEXCNT {
2859         address                 0x0B3
2860         access_mode     RW
2861         size            2
2862         modes           M_SCSI
2863 }
2864
2865 /*
2866  * Flex DMA Status
2867  */
2868 register FLEXDMASTAT {
2869         address                 0x0B5
2870         access_mode     RW
2871         modes           M_SCSI
2872         field   FLEXDMAERR      0x02
2873         field   FLEXDMADONE     0x01
2874 }
2875
2876 /*
2877  * Flex DMA Data Port
2878  */
2879 register FLEXDATA {
2880         address                 0x0B6
2881         access_mode     RW
2882         modes           M_SCSI
2883 }
2884
2885 /*
2886  * Board Data
2887  */
2888 register BRDDAT {
2889         address                 0x0B8
2890         access_mode     RW
2891         modes           M_SCSI
2892 }
2893
2894 /*
2895  * Board Control
2896  */
2897 register BRDCTL {
2898         address                 0x0B9
2899         access_mode     RW
2900         modes           M_SCSI
2901         field   FLXARBACK       0x80
2902         field   FLXARBREQ       0x40
2903         field   BRDADDR         0x38
2904         field   BRDEN           0x04
2905         field   BRDRW           0x02
2906         field   BRDSTB          0x01
2907 }
2908
2909 /*
2910  * Serial EEPROM Address
2911  */
2912 register SEEADR {
2913         address                 0x0BA
2914         access_mode     RW
2915         modes           M_SCSI
2916 }
2917
2918 /*
2919  * Serial EEPROM Data
2920  */
2921 register SEEDAT {
2922         address                 0x0BC
2923         access_mode     RW
2924         size            2
2925         modes           M_SCSI
2926 }
2927
2928 /*
2929  * Serial EEPROM Status
2930  */
2931 register SEESTAT {
2932         address                 0x0BE
2933         access_mode     RO
2934         modes           M_SCSI
2935         field   INIT_DONE       0x80
2936         field   SEEOPCODE       0x70
2937         field   LDALTID_L       0x08
2938         field   SEEARBACK       0x04
2939         field   SEEBUSY         0x02
2940         field   SEESTART        0x01
2941 }
2942
2943 /*
2944  * Serial EEPROM Control
2945  */
2946 register SEECTL {
2947         address                 0x0BE
2948         access_mode     RW
2949         modes           M_SCSI
2950         field   SEEOPCODE       0x70 {
2951                 SEEOP_ERASE     0x70,
2952                 SEEOP_READ      0x60,
2953                 SEEOP_WRITE     0x50,
2954         /*
2955          * The following four commands use special
2956          * addresses for differentiation.
2957          */
2958                 SEEOP_ERAL      0x40
2959         }
2960         mask    SEEOP_EWEN      0x40
2961         mask    SEEOP_WALL      0x40
2962         mask    SEEOP_EWDS      0x40
2963         field   SEERST          0x02
2964         field   SEESTART        0x01
2965 }
2966
2967 const SEEOP_ERAL_ADDR   0x80
2968 const SEEOP_EWEN_ADDR   0xC0
2969 const SEEOP_WRAL_ADDR   0x40
2970 const SEEOP_EWDS_ADDR   0x00
2971
2972 /*
2973  * SCB Counter
2974  */
2975 register SCBCNT {
2976         address                 0x0BF
2977         access_mode     RW
2978         modes           M_SCSI
2979 }
2980
2981 /*
2982  * Data FIFO Write Address
2983  * Pointer to the next QWD location to be written to the data FIFO.
2984  */
2985 register DFWADDR {
2986         address                 0x0C0
2987         access_mode     RW
2988         size            2
2989         modes           M_DFF0, M_DFF1
2990 }
2991
2992 /*
2993  * DSP Filter Control
2994  */
2995 register DSPFLTRCTL {
2996         address                 0x0C0
2997         access_mode     RW
2998         modes           M_CFG
2999         field   FLTRDISABLE     0x20
3000         field   EDGESENSE       0x10
3001         field   DSPFCNTSEL      0x0F
3002 }
3003
3004 /*
3005  * DSP Data Channel Control
3006  */
3007 register DSPDATACTL {
3008         address                 0x0C1
3009         access_mode     RW
3010         modes           M_CFG
3011         field   BYPASSENAB      0x80
3012         field   DESQDIS         0x10
3013         field   RCVROFFSTDIS    0x04
3014         field   XMITOFFSTDIS    0x02
3015 }
3016
3017 /*
3018  * Data FIFO Read Address
3019  * Pointer to the next QWD location to be read from the data FIFO.
3020  */
3021 register DFRADDR {
3022         address                 0x0C2
3023         access_mode     RW
3024         size            2
3025         modes           M_DFF0, M_DFF1
3026 }
3027
3028 /*
3029  * DSP REQ Control
3030  */
3031 register DSPREQCTL {
3032         address                 0x0C2
3033         access_mode     RW
3034         modes           M_CFG
3035         field   MANREQCTL       0xC0
3036         field   MANREQDLY       0x3F
3037 }
3038
3039 /*
3040  * DSP ACK Control
3041  */
3042 register DSPACKCTL {
3043         address                 0x0C3
3044         access_mode     RW
3045         modes           M_CFG
3046         field   MANACKCTL       0xC0
3047         field   MANACKDLY       0x3F
3048 }
3049
3050 /*
3051  * Data FIFO Data
3052  * Read/Write byte port into the data FIFO.  The read and write
3053  * FIFO pointers increment with each read and write respectively
3054  * to this port.
3055  */
3056 register DFDAT {
3057         address                 0x0C4
3058         access_mode     RW
3059         modes           M_DFF0, M_DFF1
3060 }
3061
3062 /*
3063  * DSP Channel Select
3064  */
3065 register DSPSELECT {
3066         address                 0x0C4
3067         access_mode     RW
3068         modes           M_CFG
3069         field   AUTOINCEN       0x80
3070         field   DSPSEL          0x1F
3071 }
3072
3073 const NUMDSPS 0x14
3074
3075 /*
3076  * Write Bias Control
3077  */
3078 register WRTBIASCTL {
3079         address                 0x0C5
3080         access_mode     WO
3081         modes           M_CFG
3082         field   AUTOXBCDIS      0x80
3083         field   XMITMANVAL      0x3F
3084 }
3085
3086 /*
3087  * Currently the WRTBIASCTL is the same as the default.
3088  */
3089 const WRTBIASCTL_HP_DEFAULT 0x0
3090
3091 /*
3092  * Receiver Bias Control
3093  */
3094 register RCVRBIOSCTL {
3095         address                 0x0C6
3096         access_mode     WO
3097         modes           M_CFG
3098         field   AUTORBCDIS      0x80
3099         field   RCVRMANVAL      0x3F
3100 }
3101
3102 /*
3103  * Write Bias Calculator
3104  */
3105 register WRTBIASCALC {
3106         address                 0x0C7
3107         access_mode     RO
3108         modes           M_CFG
3109 }
3110
3111 /*
3112  * Data FIFO Pointers
3113  * Contains the byte offset from DFWADDR and DWRADDR to the current
3114  * FIFO write/read locations.
3115  */
3116 register DFPTRS {
3117         address                 0x0C8
3118         access_mode     RW
3119         modes           M_DFF0, M_DFF1
3120 }
3121
3122 /*
3123  * Receiver Bias Calculator
3124  */
3125 register RCVRBIASCALC {
3126         address                 0x0C8
3127         access_mode     RO
3128         modes           M_CFG
3129 }
3130
3131 /*
3132  * Data FIFO Backup Read Pointer
3133  * Contains the data FIFO address to be restored if the last
3134  * data accessed from the data FIFO was not transferred successfully.
3135  */
3136 register DFBKPTR {
3137         address                 0x0C9
3138         access_mode     RW
3139         size            2
3140         modes           M_DFF0, M_DFF1
3141 }
3142
3143 /*
3144  * Skew Calculator
3145  */
3146 register SKEWCALC {
3147         address                 0x0C9
3148         access_mode     RO
3149         modes           M_CFG
3150 }
3151
3152 /*
3153  * Data FIFO Debug Control
3154  */
3155 register DFDBCTL {
3156         address                         0x0CB
3157         access_mode     RW
3158         modes           M_DFF0, M_DFF1
3159         field   DFF_CIO_WR_RDY          0x20
3160         field   DFF_CIO_RD_RDY          0x10
3161         field   DFF_DIR_ERR             0x08
3162         field   DFF_RAMBIST_FAIL        0x04
3163         field   DFF_RAMBIST_DONE        0x02
3164         field   DFF_RAMBIST_EN          0x01
3165 }
3166
3167 /*
3168  * Data FIFO Space Count
3169  * Number of FIFO locations that are free.
3170  */
3171 register DFSCNT {
3172         address                 0x0CC
3173         access_mode     RO
3174         size            2
3175         modes           M_DFF0, M_DFF1
3176 }
3177
3178 /*
3179  * Data FIFO Byte Count
3180  * Number of filled FIFO locations.
3181  */
3182 register DFBCNT {
3183         address                 0x0CE
3184         access_mode     RO
3185         size            2
3186         modes           M_DFF0, M_DFF1
3187 }
3188
3189 /*
3190  * Sequencer Program Overlay Address.
3191  * Low address must be written prior to high address.
3192  */
3193 register OVLYADDR {
3194         address                 0x0D4
3195         modes           M_SCSI
3196         size            2
3197         access_mode     RW
3198 }
3199
3200 /*
3201  * Sequencer Control 0
3202  * Error detection mode, speed configuration,
3203  * single step, breakpoints and program load.
3204  */
3205 register SEQCTL0 {
3206         address                 0x0D6
3207         access_mode RW
3208         field   PERRORDIS       0x80
3209         field   PAUSEDIS        0x40
3210         field   FAILDIS         0x20
3211         field   FASTMODE        0x10
3212         field   BRKADRINTEN     0x08
3213         field   STEP            0x04
3214         field   SEQRESET        0x02
3215         field   LOADRAM         0x01
3216 }
3217
3218 /*
3219  * Sequencer Control 1
3220  * Instruction RAM Diagnostics
3221  */
3222 register SEQCTL1 {
3223         address                 0x0D7
3224         access_mode RW
3225         field   OVRLAY_DATA_CHK 0x08
3226         field   RAMBIST_DONE    0x04
3227         field   RAMBIST_FAIL    0x02
3228         field   RAMBIST_EN      0x01
3229 }
3230
3231 /*
3232  * Sequencer Flags
3233  * Zero and Carry state of the ALU.
3234  */
3235 register FLAGS {
3236         address                 0x0D8
3237         access_mode RO
3238         field   ZERO            0x02
3239         field   CARRY           0x01
3240 }
3241
3242 /*
3243  * Sequencer Interrupt Control
3244  */ 
3245 register SEQINTCTL {
3246         address                 0x0D9
3247         access_mode RW
3248         field   INTVEC1DSL      0x80
3249         field   INT1_CONTEXT    0x20
3250         field   SCS_SEQ_INT1M1  0x10
3251         field   SCS_SEQ_INT1M0  0x08
3252         field   INTMASK2        0x04
3253         field   INTMASK1        0x02
3254         field   IRET            0x01
3255 }
3256
3257 /*
3258  * Sequencer RAM Data Port
3259  * Single byte window into the Sequencer Instruction Ram area starting
3260  * at the address specified by OVLYADDR.  To write a full instruction word,
3261  * simply write four bytes in succession.  OVLYADDR will increment after the
3262  * most significant instrution byte (the byte with the parity bit) is written.
3263  */
3264 register SEQRAM {
3265         address                 0x0DA
3266         access_mode RW
3267 }
3268
3269 /*
3270  * Sequencer Program Counter
3271  * Low byte must be written prior to high byte.
3272  */
3273 register PRGMCNT {
3274         address                 0x0DE
3275         access_mode     RW
3276         size            2
3277 }
3278
3279 /*
3280  * Accumulator
3281  */
3282 register ACCUM {
3283         address                 0x0E0
3284         access_mode RW
3285         accumulator
3286 }
3287
3288 /*
3289  * Source Index Register
3290  * Incrementing index for reads of SINDIR and the destination (low byte only)
3291  * for any immediate operands passed in jmp, jc, jnc, call instructions.
3292  * Example:
3293  *              mvi     0xFF    call some_routine;
3294  *
3295  *  Will set SINDEX[0] to 0xFF and call the routine "some_routine.
3296  */
3297 register SINDEX {
3298         address                 0x0E2
3299         access_mode     RW
3300         size            2
3301         sindex
3302 }
3303
3304 /*
3305  * Destination Index Register
3306  * Incrementing index for writes to DINDIR.  Can be used as a scratch register.
3307  */
3308 register DINDEX {
3309         address                 0x0E4
3310         access_mode     RW
3311         size            2
3312 }
3313
3314 /*
3315  * Break Address
3316  * Sequencer instruction breakpoint address address.
3317  */
3318 register BRKADDR0 {
3319         address                 0x0E6
3320         access_mode     RW
3321 }
3322
3323 register BRKADDR1 {
3324         address                 0x0E6
3325         access_mode     RW
3326         field   BRKDIS          0x80    /* Disable Breakpoint */
3327 }
3328
3329 /*
3330  * All Ones
3331  * All reads to this register return the value 0xFF.
3332  */
3333 register ALLONES {
3334         address                 0x0E8
3335         access_mode RO
3336         allones
3337 }
3338
3339 /*
3340  * All Zeros
3341  * All reads to this register return the value 0.
3342  */
3343 register ALLZEROS {
3344         address                 0x0EA
3345         access_mode RO
3346         allzeros
3347 }
3348
3349 /*
3350  * No Destination
3351  * Writes to this register have no effect.
3352  */
3353 register NONE {
3354         address                 0x0EA
3355         access_mode WO
3356         none
3357 }
3358
3359 /*
3360  * Source Index Indirect
3361  * Reading this register is equivalent to reading (register_base + SINDEX) and
3362  * incrementing SINDEX by 1.
3363  */
3364 register SINDIR {
3365         address                 0x0EC
3366         access_mode RO
3367 }
3368
3369 /*
3370  * Destination Index Indirect
3371  * Writing this register is equivalent to writing to (register_base + DINDEX)
3372  * and incrementing DINDEX by 1.
3373  */
3374 register DINDIR  {
3375         address                 0x0ED
3376         access_mode WO
3377 }
3378
3379 /*
3380  * Function One
3381  * 2's complement to bit value conversion.  Write the 2's complement value
3382  * (0-7 only) to the top nibble and retrieve the bit indexed by that value
3383  * on the next read of this register. 
3384  * Example:
3385  *      Write   0x60
3386  *      Read    0x40
3387  */
3388 register FUNCTION1 {
3389         address                 0x0F0
3390         access_mode RW
3391 }
3392
3393 /*
3394  * Stack
3395  * Window into the stack.  Each stack location is 10 bits wide reported
3396  * low byte followed by high byte.  There are 8 stack locations.
3397  */
3398 register STACK {
3399         address                 0x0F2
3400         access_mode RW
3401 }
3402
3403 /*
3404  * Interrupt Vector 1 Address
3405  * Interrupt branch address for SCS SEQ_INT1 mode 0 and 1 interrupts.
3406  */
3407 register INTVEC1_ADDR {
3408         address                 0x0F4
3409         access_mode     RW
3410         size            2
3411         modes           M_CFG
3412 }
3413
3414 /*
3415  * Current Address
3416  * Address of the SEQRAM instruction currently executing instruction.
3417  */
3418 register CURADDR {
3419         address                 0x0F4
3420         access_mode     RW
3421         size            2
3422         modes           M_SCSI
3423 }
3424
3425 /*
3426  * Interrupt Vector 2 Address
3427  * Interrupt branch address for HST_SEQ_INT2 interrupts.
3428  */
3429 register INTVEC2_ADDR {
3430         address                 0x0F6
3431         access_mode     RW
3432         size            2
3433         modes           M_CFG
3434 }
3435
3436 /*
3437  * Last Address
3438  * Address of the SEQRAM instruction executed prior to the current instruction.
3439  */
3440 register LASTADDR {
3441         address                 0x0F6
3442         access_mode     RW
3443         size            2
3444         modes           M_SCSI
3445 }
3446
3447 register AHD_PCI_CONFIG_BASE {
3448         address                 0x100
3449         access_mode     RW
3450         size            256
3451         modes           M_CFG
3452 }
3453
3454 /* ---------------------- Scratch RAM Offsets ------------------------- */
3455 scratch_ram {
3456         /* Mode Specific */
3457         address                 0x0A0
3458         size    8
3459         modes   0, 1, 2, 3
3460         REG0 {
3461                 size            2
3462         }
3463         REG1 {
3464                 size            2
3465         }
3466         REG_ISR {
3467                 size            2
3468         }
3469         SG_STATE {
3470                 size            1
3471                 field   SEGS_AVAIL      0x01
3472                 field   LOADING_NEEDED  0x02
3473                 field   FETCH_INPROG    0x04
3474         }
3475         /*
3476          * Track whether the transfer byte count for
3477          * the current data phase is odd.
3478          */
3479         DATA_COUNT_ODD {
3480                 size            1
3481         }
3482 }
3483
3484 scratch_ram {
3485         /* Mode Specific */
3486         address                 0x0F8
3487         size    8
3488         modes   0, 1, 2, 3
3489         LONGJMP_ADDR {
3490                 size            2
3491         }
3492         ACCUM_SAVE {
3493                 size            1
3494         }
3495 }
3496
3497
3498 scratch_ram {
3499         address                 0x100
3500         size    128
3501         modes   0, 1, 2, 3
3502         /*
3503          * Per "other-id" execution queues.  We use an array of
3504          * tail pointers into lists of SCBs sorted by "other-id".
3505          * The execution head pointer threads the head SCBs for
3506          * each list.
3507          */
3508         WAITING_SCB_TAILS {
3509                 size            32
3510         }
3511         WAITING_TID_HEAD {
3512                 size            2
3513         }
3514         WAITING_TID_TAIL {
3515                 size            2
3516         }
3517         /*
3518          * SCBID of the next SCB in the new SCB queue.
3519          */
3520         NEXT_QUEUED_SCB_ADDR {
3521                 size            4
3522         }
3523         /*
3524          * head of list of SCBs that have
3525          * completed but have not been
3526          * put into the qoutfifo.
3527          */
3528         COMPLETE_SCB_HEAD {
3529                 size            2
3530         }
3531         /*
3532          * The list of completed SCBs in
3533          * the active DMA.
3534          */
3535         COMPLETE_SCB_DMAINPROG_HEAD {
3536                 size            2
3537         }
3538         /*
3539          * head of list of SCBs that have
3540          * completed but need to be uploaded
3541          * to the host prior to being completed.
3542          */
3543         COMPLETE_DMA_SCB_HEAD {
3544                 size            2
3545         }
3546         /* Counting semaphore to prevent new select-outs */
3547         QFREEZE_COUNT {
3548                 size            2
3549         }
3550         /*
3551          * Mode to restore on legacy idle loop exit.
3552          */
3553         SAVED_MODE {
3554                 size            1
3555         }
3556         /*
3557          * Single byte buffer used to designate the type or message
3558          * to send to a target.
3559          */
3560         MSG_OUT {
3561                 size            1
3562         }
3563         /* Parameters for DMA Logic */
3564         DMAPARAMS {
3565                 size            1
3566                 field   PRELOADEN       0x80
3567                 field   WIDEODD         0x40
3568                 field   SCSIEN          0x20
3569                 field   SDMAEN          0x10
3570                 field   SDMAENACK       0x10
3571                 field   HDMAEN          0x08
3572                 field   HDMAENACK       0x08
3573                 field   DIRECTION       0x04    /* Set indicates PCI->SCSI */
3574                 field   FIFOFLUSH       0x02
3575                 field   FIFORESET       0x01
3576         }
3577         SEQ_FLAGS {
3578                 size            1
3579                 field   NOT_IDENTIFIED          0x80
3580                 field   NO_CDB_SENT             0x40
3581                 field   TARGET_CMD_IS_TAGGED    0x40
3582                 field   DPHASE                  0x20
3583                 /* Target flags */
3584                 field   TARG_CMD_PENDING        0x10
3585                 field   CMDPHASE_PENDING        0x08
3586                 field   DPHASE_PENDING          0x04
3587                 field   SPHASE_PENDING          0x02
3588                 field   NO_DISCONNECT           0x01
3589         }
3590         /*
3591          * Temporary storage for the
3592          * target/channel/lun of a
3593          * reconnecting target
3594          */
3595         SAVED_SCSIID {
3596                 size            1
3597         }
3598         SAVED_LUN {
3599                 size            1
3600         }
3601         /*
3602          * The last bus phase as seen by the sequencer. 
3603          */
3604         LASTPHASE {
3605                 size            1
3606                 field   CDI             0x80
3607                 field   IOI             0x40
3608                 field   MSGI            0x20
3609                 field   P_BUSFREE       0x01
3610                 enum    PHASE_MASK  CDO|IOO|MSGO {
3611                         P_DATAOUT       0x0,
3612                         P_DATAIN        IOO,
3613                         P_DATAOUT_DT    P_DATAOUT|MSGO,
3614                         P_DATAIN_DT     P_DATAIN|MSGO,
3615                         P_COMMAND       CDO,
3616                         P_MESGOUT       CDO|MSGO,
3617                         P_STATUS        CDO|IOO,
3618                         P_MESGIN        CDO|IOO|MSGO
3619                 }
3620         }
3621         /*
3622          * Value to "or" into the SCBPTR[1] value to
3623          * indicate that an entry in the QINFIFO is valid.
3624          */
3625         QOUTFIFO_ENTRY_VALID_TAG {
3626                 size            1
3627         }
3628         /*
3629          * Base address of our shared data with the kernel driver in host
3630          * memory.  This includes the qoutfifo and target mode
3631          * incoming command queue.
3632          */
3633         SHARED_DATA_ADDR {
3634                 size            4
3635         }
3636         /*
3637          * Pointer to location in host memory for next
3638          * position in the qoutfifo.
3639          */
3640         QOUTFIFO_NEXT_ADDR {
3641                 size            4
3642         }
3643         /*
3644          * Kernel and sequencer offsets into the queue of
3645          * incoming target mode command descriptors.  The
3646          * queue is full when the KERNEL_TQINPOS == TQINPOS.
3647          */
3648         KERNEL_TQINPOS {
3649                 size            1
3650         }
3651         TQINPOS {                
3652                 size            1
3653         }
3654         ARG_1 {
3655                 size            1
3656                 mask    SEND_MSG                0x80
3657                 mask    SEND_SENSE              0x40
3658                 mask    SEND_REJ                0x20
3659                 mask    MSGOUT_PHASEMIS         0x10
3660                 mask    EXIT_MSG_LOOP           0x08
3661                 mask    CONT_MSG_LOOP_WRITE     0x04
3662                 mask    CONT_MSG_LOOP_READ      0x03
3663                 mask    CONT_MSG_LOOP_TARG      0x02
3664                 alias   RETURN_1
3665         }
3666         ARG_2 {
3667                 size            1
3668                 alias   RETURN_2
3669         }
3670
3671         /*
3672          * Snapshot of MSG_OUT taken after each message is sent.
3673          */
3674         LAST_MSG {
3675                 size            1
3676         }
3677
3678         /*
3679          * Sequences the kernel driver has okayed for us.  This allows
3680          * the driver to do things like prevent initiator or target
3681          * operations.
3682          */
3683         SCSISEQ_TEMPLATE {
3684                 size            1
3685                 field   MANUALCTL       0x40
3686                 field   ENSELI          0x20
3687                 field   ENRSELI         0x10
3688                 field   MANUALP         0x0C
3689                 field   ENAUTOATNP      0x02
3690                 field   ALTSTIM         0x01
3691         }
3692
3693         /*
3694          * The initiator specified tag for this target mode transaction.
3695          */
3696         INITIATOR_TAG {
3697                 size            1
3698         }
3699
3700         SEQ_FLAGS2 {
3701                 size            1
3702                 field   TARGET_MSG_PENDING        0x02
3703                 field   SELECTOUT_QFROZEN         0x04
3704         }
3705
3706         ALLOCFIFO_SCBPTR {
3707                 size            2
3708         }
3709
3710         /*
3711          * The maximum amount of time to wait, when interrupt coalescing
3712          * is enabled, before issueing a CMDCMPLT interrupt for a completed
3713          * command.
3714          */
3715         INT_COALESCING_TIMER {
3716                 size            2
3717         }
3718
3719         /*
3720          * The maximum number of commands to coalesce into a single interrupt.
3721          * Actually the 2's complement of that value to simplify sequencer
3722          * code.
3723          */
3724         INT_COALESCING_MAXCMDS {
3725                 size            1
3726         }
3727
3728         /*
3729          * The minimum number of commands still outstanding required
3730          * to continue coalescing (2's complement of value).
3731          */
3732         INT_COALESCING_MINCMDS {
3733                 size            1
3734         }
3735
3736         /*
3737          * Number of commands "in-flight".
3738          */
3739         CMDS_PENDING {
3740                 size            2
3741         }
3742
3743         /*
3744          * The count of commands that have been coalesced.
3745          */
3746         INT_COALESCING_CMDCOUNT {
3747                 size            1
3748         }
3749
3750         /*
3751          * Since the HS_MAIBOX is self clearing, copy its contents to
3752          * this position in scratch ram every time it changes.
3753          */
3754         LOCAL_HS_MAILBOX {
3755                 size            1
3756         }
3757         /*
3758          * Target-mode CDB type to CDB length table used
3759          * in non-packetized operation.
3760          */
3761         CMDSIZE_TABLE {
3762                 size            8
3763         }
3764 }
3765
3766 /************************* Hardware SCB Definition ****************************/
3767 scb {
3768         address                 0x180
3769         size    64
3770         modes   0, 1, 2, 3
3771         SCB_RESIDUAL_DATACNT {
3772                 size    4
3773                 alias   SCB_CDB_STORE
3774                 alias   SCB_HOST_CDB_PTR
3775         }
3776         SCB_RESIDUAL_SGPTR {
3777                 size    4
3778                 field   SG_ADDR_MASK            0xf8    /* In the last byte */
3779                 field   SG_OVERRUN_RESID        0x02    /* In the first byte */
3780                 field   SG_LIST_NULL            0x01    /* In the first byte */
3781         }
3782         SCB_SCSI_STATUS {
3783                 size    1
3784                 alias   SCB_HOST_CDB_LEN
3785         }
3786         SCB_TARGET_PHASES {
3787                 size    1
3788         }
3789         SCB_TARGET_DATA_DIR {
3790                 size    1
3791         }
3792         SCB_TARGET_ITAG {
3793                 size    1
3794         }
3795         SCB_SENSE_BUSADDR {
3796                 /*
3797                  * Only valid if CDB length is less than 13 bytes or
3798                  * we are using a CDB pointer.  Otherwise contains
3799                  * the last 4 bytes of embedded cdb information.
3800                  */
3801                 size    4
3802                 alias   SCB_NEXT_COMPLETE
3803         }
3804         SCB_TAG {
3805                 alias   SCB_FIFO_USE_COUNT
3806                 size    2
3807         }
3808         SCB_CONTROL {
3809                 size    1
3810                 field   TARGET_SCB      0x80
3811                 field   DISCENB         0x40
3812                 field   TAG_ENB         0x20
3813                 field   MK_MESSAGE      0x10
3814                 field   STATUS_RCVD     0x08
3815                 field   DISCONNECTED    0x04
3816                 field   SCB_TAG_TYPE    0x03
3817         }
3818         SCB_SCSIID {
3819                 size    1
3820                 field   TID     0xF0
3821                 field   OID     0x0F
3822         }
3823         SCB_LUN {
3824                 size    1
3825                 field   LID     0xff
3826         }
3827         SCB_TASK_ATTRIBUTE {
3828                 size    1
3829                 /*
3830                  * Overloaded field for non-packetized 
3831                  * ignore wide residue message handling.
3832                  */
3833                 field   SCB_XFERLEN_ODD 0x01
3834         }
3835         SCB_CDB_LEN {
3836                 size    1
3837                 field   SCB_CDB_LEN_PTR 0x80    /* CDB in host memory */
3838         }
3839         SCB_TASK_MANAGEMENT {
3840                 size    1
3841         }
3842         SCB_DATAPTR {
3843                 size    8
3844         }
3845         SCB_DATACNT {
3846                 /*
3847                  * The last byte is really the high address bits for
3848                  * the data address.
3849                  */
3850                 size    4
3851                 field   SG_LAST_SEG             0x80    /* In the fourth byte */
3852                 field   SG_HIGH_ADDR_BITS       0x7F    /* In the fourth byte */
3853         }
3854         SCB_SGPTR {
3855                 size    4
3856                 field   SG_STATUS_VALID 0x04    /* In the first byte */
3857                 field   SG_FULL_RESID   0x02    /* In the first byte */
3858                 field   SG_LIST_NULL    0x01    /* In the first byte */
3859         }
3860         SCB_BUSADDR {
3861                 size    4
3862         }
3863         SCB_NEXT {
3864                 alias   SCB_NEXT_SCB_BUSADDR
3865                 size    2
3866         }
3867         SCB_NEXT2 {
3868                 size    2
3869         }
3870         SCB_SPARE {
3871                 size    8
3872                 alias   SCB_PKT_LUN
3873         }
3874         SCB_DISCONNECTED_LISTS {
3875                 size    8
3876         }
3877 }
3878
3879 /*********************************** Constants ********************************/
3880 const MK_MESSAGE_BIT_OFFSET     4
3881 const TID_SHIFT         4
3882 const TARGET_CMD_CMPLT  0xfe
3883 const INVALID_ADDR      0x80
3884 #define SCB_LIST_NULL   0xff
3885 #define QOUTFIFO_ENTRY_VALID_TOGGLE     0x80
3886
3887 const CCSGADDR_MAX      0x80
3888 const CCSCBADDR_MAX     0x80
3889 const CCSGRAM_MAXSEGS   16
3890
3891 /* Selection Timeout Timer Constants */
3892 const STIMESEL_SHIFT    3
3893 const STIMESEL_MIN      0x18
3894 const STIMESEL_BUG_ADJ  0x8
3895
3896 /* WDTR Message values */
3897 const BUS_8_BIT                 0x00
3898 const BUS_16_BIT                0x01
3899 const BUS_32_BIT                0x02
3900
3901 /* Offset maximums */
3902 const MAX_OFFSET                0xfe
3903 const MAX_OFFSET_PACED          0xfe
3904 const MAX_OFFSET_PACED_BUG      0x7f
3905 /*
3906  * Some 160 devices incorrectly accept 0xfe as a
3907  * sync offset, but will overrun this value.  Limit
3908  * to 0x7f for speed lower than U320 which will
3909  * avoid the persistent sync offset overruns.
3910  */
3911 const MAX_OFFSET_NON_PACED      0x7f
3912 const HOST_MSG                  0xff
3913
3914 /*
3915  * The size of our sense buffers.
3916  * Sense buffer mapping can be handled in either of two ways.
3917  * The first is to allocate a dmamap for each transaction.
3918  * Depending on the architecture, dmamaps can be costly. The
3919  * alternative is to statically map the buffers in much the same
3920  * way we handle our scatter gather lists.  The driver implements
3921  * the later.
3922  */
3923 const AHD_SENSE_BUFSIZE         256
3924
3925 /* Target mode command processing constants */
3926 const CMD_GROUP_CODE_SHIFT      0x05
3927
3928 const STATUS_BUSY               0x08
3929 const STATUS_QUEUE_FULL         0x28
3930 const STATUS_PKT_SENSE          0xFF
3931 const TARGET_DATA_IN            1
3932
3933 const SCB_TRANSFER_SIZE_FULL_LUN        56
3934 const SCB_TRANSFER_SIZE_1BYTE_LUN       48
3935 /* PKT_OVERRUN_BUFSIZE must be a multiple of 256 less than 64K */
3936 const PKT_OVERRUN_BUFSIZE       512
3937
3938 /*
3939  * Timer parameters.
3940  */
3941 const AHD_TIMER_US_PER_TICK     25
3942 const AHD_TIMER_MAX_TICKS       0xFFFF
3943 const AHD_TIMER_MAX_US          (AHD_TIMER_MAX_TICKS * AHD_TIMER_US_PER_TICK)
3944
3945 /*
3946  * Downloaded (kernel inserted) constants
3947  */
3948 const SG_PREFETCH_CNT download
3949 const SG_PREFETCH_CNT_LIMIT download
3950 const SG_PREFETCH_ALIGN_MASK download
3951 const SG_PREFETCH_ADDR_MASK download
3952 const SG_SIZEOF download
3953 const PKT_OVERRUN_BUFOFFSET download
3954 const SCB_TRANSFER_SIZE download
3955
3956 /*
3957  * BIOS SCB offsets
3958  */
3959 const NVRAM_SCB_OFFSET  0x2C