1/* 2 * Aic7xxx register and scratch ram definitions. 3 * 4 * Copyright (c) 1994-2000 Justin Gibbs. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions, and the following disclaimer, 12 * without modification. 13 * 2. The name of the author may not be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * Alternatively, this software may be distributed under the terms of the 17 * GNU Public License ("GPL"). 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 * SUCH DAMAGE. 30 * 31 * $Id: //depot/src/aic7xxx/aic7xxx.reg#9 $ 32 * 33 * $FreeBSD$ 34 */ 35 36/* 37 * This file is processed by the aic7xxx_asm utility for use in assembling 38 * firmware for the aic7xxx family of SCSI host adapters as well as to generate 39 * a C header file for use in the kernel portion of the Aic7xxx driver. 40 * 41 * All page numbers refer to the Adaptec AIC-7770 Data Book available from 42 * Adaptec's Technical Documents Department 1-800-934-2766 43 */ 44 45/* 46 * SCSI Sequence Control (p. 3-11). 47 * Each bit, when set starts a specific SCSI sequence on the bus 48 */ 49register SCSISEQ { 50 address 0x000 51 access_mode RW 52 bit TEMODE 0x80 53 bit ENSELO 0x40 54 bit ENSELI 0x20 55 bit ENRSELI 0x10 56 bit ENAUTOATNO 0x08 57 bit ENAUTOATNI 0x04 58 bit ENAUTOATNP 0x02 59 bit SCSIRSTO 0x01 60} 61 62/* 63 * SCSI Transfer Control 0 Register (pp. 3-13). 64 * Controls the SCSI module data path. 65 */ 66register SXFRCTL0 { 67 address 0x001 68 access_mode RW 69 bit DFON 0x80 70 bit DFPEXP 0x40 71 bit FAST20 0x20 72 bit CLRSTCNT 0x10 73 bit SPIOEN 0x08 74 bit SCAMEN 0x04 75 bit CLRCHN 0x02 76} 77 78/* 79 * SCSI Transfer Control 1 Register (pp. 3-14,15). 80 * Controls the SCSI module data path. 81 */ 82register SXFRCTL1 { 83 address 0x002 84 access_mode RW 85 bit BITBUCKET 0x80 86 bit SWRAPEN 0x40 87 bit ENSPCHK 0x20 88 mask STIMESEL 0x18 89 bit ENSTIMER 0x04 90 bit ACTNEGEN 0x02 91 bit STPWEN 0x01 /* Powered Termination */ 92} 93 94/* 95 * SCSI Control Signal Read Register (p. 3-15). 96 * Reads the actual state of the SCSI bus pins 97 */ 98register SCSISIGI { 99 address 0x003 100 access_mode RO 101 bit CDI 0x80 102 bit IOI 0x40 103 bit MSGI 0x20 104 bit ATNI 0x10 105 bit SELI 0x08 106 bit BSYI 0x04 107 bit REQI 0x02 108 bit ACKI 0x01 109/* 110 * Possible phases in SCSISIGI 111 */ 112 mask PHASE_MASK CDI|IOI|MSGI 113 mask P_DATAOUT 0x00 114 mask P_DATAIN IOI 115 mask P_DATAOUT_DT P_DATAOUT|MSGI 116 mask P_DATAIN_DT P_DATAIN|MSGI 117 mask P_COMMAND CDI 118 mask P_MESGOUT CDI|MSGI 119 mask P_STATUS CDI|IOI 120 mask P_MESGIN CDI|IOI|MSGI 121} 122 123/* 124 * SCSI Control Signal Write Register (p. 3-16). 125 * Writing to this register modifies the control signals on the bus. Only 126 * those signals that are allowed in the current mode (Initiator/Target) are 127 * asserted. 128 */ 129register SCSISIGO { 130 address 0x003 131 access_mode WO 132 bit CDO 0x80 133 bit IOO 0x40 134 bit MSGO 0x20 135 bit ATNO 0x10 136 bit SELO 0x08 137 bit BSYO 0x04 138 bit REQO 0x02 139 bit ACKO 0x01 140/* 141 * Possible phases to write into SCSISIG0 142 */ 143 mask PHASE_MASK CDI|IOI|MSGI 144 mask P_DATAOUT 0x00 145 mask P_DATAIN IOI 146 mask P_COMMAND CDI 147 mask P_MESGOUT CDI|MSGI 148 mask P_STATUS CDI|IOI 149 mask P_MESGIN CDI|IOI|MSGI 150} 151 152/* 153 * SCSI Rate Control (p. 3-17). 154 * Contents of this register determine the Synchronous SCSI data transfer 155 * rate and the maximum synchronous Req/Ack offset. An offset of 0 in the 156 * SOFS (3:0) bits disables synchronous data transfers. Any offset value 157 * greater than 0 enables synchronous transfers. 158 */ 159register SCSIRATE { 160 address 0x004 161 access_mode RW 162 bit WIDEXFER 0x80 /* Wide transfer control */ 163 bit ENABLE_CRC 0x40 /* CRC for D-Phases */ 164 bit SINGLE_EDGE 0x10 /* Disable DT Transfers */ 165 mask SXFR 0x70 /* Sync transfer rate */ 166 mask SXFR_ULTRA2 0x0f /* Sync transfer rate */ 167 mask SOFS 0x0f /* Sync offset */ 168} 169 170/* 171 * SCSI ID (p. 3-18). 172 * Contains the ID of the board and the current target on the 173 * selected channel. 174 */ 175register SCSIID { 176 address 0x005 177 access_mode RW 178 mask TID 0xf0 /* Target ID mask */ 179 mask TWIN_TID 0x70 180 bit TWIN_CHNLB 0x80 181 mask OID 0x0f /* Our ID mask */ 182 /* 183 * SCSI Maximum Offset (p. 4-61 aic7890/91 Data Book) 184 * The aic7890/91 allow an offset of up to 127 transfers in both wide 185 * and narrow mode. 186 */ 187 alias SCSIOFFSET 188 mask SOFS_ULTRA2 0x7f /* Sync offset U2 chips */ 189} 190 191/* 192 * SCSI Latched Data (p. 3-19). 193 * Read/Write latches used to transfer data on the SCSI bus during 194 * Automatic or Manual PIO mode. SCSIDATH can be used for the 195 * upper byte of a 16bit wide asynchronouse data phase transfer. 196 */ 197register SCSIDATL { 198 address 0x006 199 access_mode RW 200} 201 202register SCSIDATH { 203 address 0x007 204 access_mode RW 205} 206 207/* 208 * SCSI Transfer Count (pp. 3-19,20) 209 * These registers count down the number of bytes transferred 210 * across the SCSI bus. The counter is decremented only once 211 * the data has been safely transferred. SDONE in SSTAT0 is 212 * set when STCNT goes to 0 213 */ 214register STCNT { 215 address 0x008 216 size 3 217 access_mode RW 218} 219 220/* ALT_MODE register on Ultra160 chips */ 221register OPTIONMODE { 222 address 0x008 223 access_mode RW 224 bit AUTORATEEN 0x80 225 bit AUTOACKEN 0x40 226 bit ATNMGMNTEN 0x20 227 bit BUSFREEREV 0x10 228 bit EXPPHASEDIS 0x08 229 bit SCSIDATL_IMGEN 0x04 230 bit AUTO_MSGOUT_DE 0x02 231 bit DIS_MSGIN_DUALEDGE 0x01 232 mask OPTIONMODE_DEFAULTS AUTO_MSGOUT_DE|DIS_MSGIN_DUALEDGE 233} 234 235/* ALT_MODE register on Ultra160 chips */ 236register TARGCRCCNT { 237 address 0x00a 238 size 2 239 access_mode RW 240} 241 242/* 243 * Clear SCSI Interrupt 0 (p. 3-20) 244 * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT0. 245 */ 246register CLRSINT0 { 247 address 0x00b 248 access_mode WO 249 bit CLRSELDO 0x40 250 bit CLRSELDI 0x20 251 bit CLRSELINGO 0x10 252 bit CLRSWRAP 0x08 253 bit CLRIOERR 0x08 /* Ultra2 Only */ 254 bit CLRSPIORDY 0x02 255} 256 257/* 258 * SCSI Status 0 (p. 3-21) 259 * Contains one set of SCSI Interrupt codes 260 * These are most likely of interest to the sequencer 261 */ 262register SSTAT0 { 263 address 0x00b 264 access_mode RO 265 bit TARGET 0x80 /* Board acting as target */ 266 bit SELDO 0x40 /* Selection Done */ 267 bit SELDI 0x20 /* Board has been selected */ 268 bit SELINGO 0x10 /* Selection In Progress */ 269 bit SWRAP 0x08 /* 24bit counter wrap */ 270 bit IOERR 0x08 /* LVD Tranceiver mode changed */ 271 bit SDONE 0x04 /* STCNT = 0x000000 */ 272 bit SPIORDY 0x02 /* SCSI PIO Ready */ 273 bit DMADONE 0x01 /* DMA transfer completed */ 274} 275 276/* 277 * Clear SCSI Interrupt 1 (p. 3-23) 278 * Writing a 1 to a bit clears the associated SCSI Interrupt in SSTAT1. 279 */ 280register CLRSINT1 { 281 address 0x00c 282 access_mode WO 283 bit CLRSELTIMEO 0x80 284 bit CLRATNO 0x40 285 bit CLRSCSIRSTI 0x20 286 bit CLRBUSFREE 0x08 287 bit CLRSCSIPERR 0x04 288 bit CLRPHASECHG 0x02 289 bit CLRREQINIT 0x01 290} 291 292/* 293 * SCSI Status 1 (p. 3-24) 294 */ 295register SSTAT1 { 296 address 0x00c 297 access_mode RO 298 bit SELTO 0x80 299 bit ATNTARG 0x40 300 bit SCSIRSTI 0x20 301 bit PHASEMIS 0x10 302 bit BUSFREE 0x08 303 bit SCSIPERR 0x04 304 bit PHASECHG 0x02 305 bit REQINIT 0x01 306} 307 308/* 309 * SCSI Status 2 (pp. 3-25,26) 310 */ 311register SSTAT2 { 312 address 0x00d 313 access_mode RO 314 bit OVERRUN 0x80 315 bit SHVALID 0x40 /* Shaddow Layer non-zero */ 316 bit EXP_ACTIVE 0x10 /* SCSI Expander Active */ 317 bit CRCVALERR 0x08 /* CRC doesn't match (U3 only) */ 318 bit CRCENDERR 0x04 /* No terminal CRC packet (U3 only) */ 319 bit CRCREQERR 0x02 /* Illegal CRC packet req (U3 only) */ 320 bit DUAL_EDGE_ERR 0x01 /* Incorrect data phase (U3 only) */ 321 mask SFCNT 0x1f 322} 323 324/* 325 * SCSI Status 3 (p. 3-26) 326 */ 327register SSTAT3 { 328 address 0x00e 329 access_mode RO 330 mask SCSICNT 0xf0 331 mask OFFCNT 0x0f 332} 333 334/* 335 * SCSI ID for the aic7890/91 chips 336 */ 337register SCSIID_ULTRA2 { 338 address 0x00f 339 access_mode RW 340 mask TID 0xf0 /* Target ID mask */ 341 mask OID 0x0f /* Our ID mask */ 342} 343 344/* 345 * SCSI Interrupt Mode 1 (p. 3-28) 346 * Setting any bit will enable the corresponding function 347 * in SIMODE0 to interrupt via the IRQ pin. 348 */ 349register SIMODE0 { 350 address 0x010 351 access_mode RW 352 bit ENSELDO 0x40 353 bit ENSELDI 0x20 354 bit ENSELINGO 0x10 355 bit ENSWRAP 0x08 356 bit ENIOERR 0x08 /* LVD Tranceiver mode changes */ 357 bit ENSDONE 0x04 358 bit ENSPIORDY 0x02 359 bit ENDMADONE 0x01 360} 361 362/* 363 * SCSI Interrupt Mode 1 (pp. 3-28,29) 364 * Setting any bit will enable the corresponding function 365 * in SIMODE1 to interrupt via the IRQ pin. 366 */ 367register SIMODE1 { 368 address 0x011 369 access_mode RW 370 bit ENSELTIMO 0x80 371 bit ENATNTARG 0x40 372 bit ENSCSIRST 0x20 373 bit ENPHASEMIS 0x10 374 bit ENBUSFREE 0x08 375 bit ENSCSIPERR 0x04 376 bit ENPHASECHG 0x02 377 bit ENREQINIT 0x01 378} 379 380/* 381 * SCSI Data Bus (High) (p. 3-29) 382 * This register reads data on the SCSI Data bus directly. 383 */ 384register SCSIBUSL { 385 address 0x012 386 access_mode RW 387} 388 389register SCSIBUSH { 390 address 0x013 391 access_mode RW 392} 393 394/* 395 * SCSI/Host Address (p. 3-30) 396 * These registers hold the host address for the byte about to be 397 * transferred on the SCSI bus. They are counted up in the same 398 * manner as STCNT is counted down. SHADDR should always be used 399 * to determine the address of the last byte transferred since HADDR 400 * can be skewed by write ahead. 401 */ 402register SHADDR { 403 address 0x014 404 size 4 405 access_mode RO 406} 407 408/* 409 * Selection Timeout Timer (p. 3-30) 410 */ 411register SELTIMER { 412 address 0x018 413 access_mode RW 414 bit STAGE6 0x20 415 bit STAGE5 0x10 416 bit STAGE4 0x08 417 bit STAGE3 0x04 418 bit STAGE2 0x02 419 bit STAGE1 0x01 420 alias TARGIDIN 421} 422 423/* 424 * Selection/Reselection ID (p. 3-31) 425 * Upper four bits are the device id. The ONEBIT is set when the re/selecting 426 * device did not set its own ID. 427 */ 428register SELID { 429 address 0x019 430 access_mode RW 431 mask SELID_MASK 0xf0 432 bit ONEBIT 0x08 433} 434 435register SCAMCTL { 436 address 0x01a 437 access_mode RW 438 bit ENSCAMSELO 0x80 439 bit CLRSCAMSELID 0x40 440 bit ALTSTIM 0x20 441 bit DFLTTID 0x10 442 mask SCAMLVL 0x03 443} 444 445/* 446 * Target Mode Selecting in ID bitmask (aic7890/91/96/97) 447 */ 448register TARGID { 449 address 0x01b 450 size 2 451 access_mode RW 452} 453 454/* 455 * Serial Port I/O Cabability register (p. 4-95 aic7860 Data Book) 456 * Indicates if external logic has been attached to the chip to 457 * perform the tasks of accessing a serial eeprom, testing termination 458 * strength, and performing cable detection. On the aic7860, most of 459 * these features are handled on chip, but on the aic7855 an attached 460 * aic3800 does the grunt work. 461 */ 462register SPIOCAP { 463 address 0x01b 464 access_mode RW 465 bit SOFT1 0x80 466 bit SOFT0 0x40 467 bit SOFTCMDEN 0x20 468 bit HAS_BRDCTL 0x10 /* External Board control */ 469 bit SEEPROM 0x08 /* External serial eeprom logic */ 470 bit EEPROM 0x04 /* Writable external BIOS ROM */ 471 bit ROM 0x02 /* Logic for accessing external ROM */ 472 bit SSPIOCPS 0x01 /* Termination and cable detection */ 473} 474 475register BRDCTL { 476 address 0x01d 477 bit BRDDAT7 0x80 478 bit BRDDAT6 0x40 479 bit BRDDAT5 0x20 480 bit BRDSTB 0x10 481 bit BRDCS 0x08 482 bit BRDRW 0x04 483 bit BRDCTL1 0x02 484 bit BRDCTL0 0x01 485 /* 7890 Definitions */ 486 bit BRDDAT4 0x10 487 bit BRDDAT3 0x08 488 bit BRDDAT2 0x04 489 bit BRDRW_ULTRA2 0x02 490 bit BRDSTB_ULTRA2 0x01 491} 492 493/* 494 * Serial EEPROM Control (p. 4-92 in 7870 Databook) 495 * Controls the reading and writing of an external serial 1-bit 496 * EEPROM Device. In order to access the serial EEPROM, you must 497 * first set the SEEMS bit that generates a request to the memory 498 * port for access to the serial EEPROM device. When the memory 499 * port is not busy servicing another request, it reconfigures 500 * to allow access to the serial EEPROM. When this happens, SEERDY 501 * gets set high to verify that the memory port access has been 502 * granted. 503 * 504 * After successful arbitration for the memory port, the SEECS bit of 505 * the SEECTL register is connected to the chip select. The SEECK, 506 * SEEDO, and SEEDI are connected to the clock, data out, and data in 507 * lines respectively. The SEERDY bit of SEECTL is useful in that it 508 * gives us an 800 nsec timer. After a write to the SEECTL register, 509 * the SEERDY goes high 800 nsec later. The one exception to this is 510 * when we first request access to the memory port. The SEERDY goes 511 * high to signify that access has been granted and, for this case, has 512 * no implied timing. 513 * 514 * See 93cx6.c for detailed information on the protocol necessary to 515 * read the serial EEPROM. 516 */ 517register SEECTL { 518 address 0x01e 519 bit EXTARBACK 0x80 520 bit EXTARBREQ 0x40 521 bit SEEMS 0x20 522 bit SEERDY 0x10 523 bit SEECS 0x08 524 bit SEECK 0x04 525 bit SEEDO 0x02 526 bit SEEDI 0x01 527} 528/* 529 * SCSI Block Control (p. 3-32) 530 * Controls Bus type and channel selection. In a twin channel configuration 531 * addresses 0x00-0x1e are gated to the appropriate channel based on this 532 * register. SELWIDE allows for the coexistence of 8bit and 16bit devices 533 * on a wide bus. 534 */ 535register SBLKCTL { 536 address 0x01f 537 access_mode RW 538 bit DIAGLEDEN 0x80 /* Aic78X0 only */ 539 bit DIAGLEDON 0x40 /* Aic78X0 only */ 540 bit AUTOFLUSHDIS 0x20 541 bit SELBUSB 0x08 542 bit ENAB40 0x08 /* LVD transceiver active */ 543 bit ENAB20 0x04 /* SE/HVD transceiver active */ 544 bit SELWIDE 0x02 545 bit XCVR 0x01 /* External transceiver active */ 546} 547 548/* 549 * Sequencer Control (p. 3-33) 550 * Error detection mode and speed configuration 551 */ 552register SEQCTL { 553 address 0x060 554 access_mode RW 555 bit PERRORDIS 0x80 556 bit PAUSEDIS 0x40 557 bit FAILDIS 0x20 558 bit FASTMODE 0x10 559 bit BRKADRINTEN 0x08 560 bit STEP 0x04 561 bit SEQRESET 0x02 562 bit LOADRAM 0x01 563} 564 565/* 566 * Sequencer RAM Data (p. 3-34) 567 * Single byte window into the Scratch Ram area starting at the address 568 * specified by SEQADDR0 and SEQADDR1. To write a full word, simply write 569 * four bytes in succession. The SEQADDRs will increment after the most 570 * significant byte is written 571 */ 572register SEQRAM { 573 address 0x061 574 access_mode RW 575} 576 577/* 578 * Sequencer Address Registers (p. 3-35) 579 * Only the first bit of SEQADDR1 holds addressing information 580 */ 581register SEQADDR0 { 582 address 0x062 583 access_mode RW 584} 585 586register SEQADDR1 { 587 address 0x063 588 access_mode RW 589 mask SEQADDR1_MASK 0x01 590} 591 592/* 593 * Accumulator 594 * We cheat by passing arguments in the Accumulator up to the kernel driver 595 */ 596register ACCUM { 597 address 0x064 598 access_mode RW 599 accumulator 600} 601 602register SINDEX { 603 address 0x065 604 access_mode RW 605 sindex 606} 607 608register DINDEX { 609 address 0x066 610 access_mode RW 611} 612 613register ALLONES { 614 address 0x069 615 access_mode RO 616 allones 617} 618 619register ALLZEROS { 620 address 0x06a 621 access_mode RO 622 allzeros 623} 624 625register NONE { 626 address 0x06a 627 access_mode WO 628 none 629} 630 631register FLAGS { 632 address 0x06b 633 access_mode RO 634 bit ZERO 0x02 635 bit CARRY 0x01 636} 637 638register SINDIR { 639 address 0x06c 640 access_mode RO 641} 642 643register DINDIR { 644 address 0x06d 645 access_mode WO 646} 647 648register FUNCTION1 { 649 address 0x06e 650 access_mode RW 651} 652 653register STACK { 654 address 0x06f 655 access_mode RO 656} 657 658/* 659 * Board Control (p. 3-43) 660 */ 661register BCTL { 662 address 0x084 663 access_mode RW 664 bit ACE 0x08 665 bit ENABLE 0x01 666} 667 668/* 669 * On the aic78X0 chips, Board Control is replaced by the DSCommand 670 * register (p. 4-64) 671 */ 672register DSCOMMAND0 { 673 address 0x084 674 access_mode RW 675 bit CACHETHEN 0x80 /* Cache Threshold enable */ 676 bit DPARCKEN 0x40 /* Data Parity Check Enable */ 677 bit MPARCKEN 0x20 /* Memory Parity Check Enable */ 678 bit EXTREQLCK 0x10 /* External Request Lock */ 679 /* aic7890/91/96/97 only */ 680 bit INTSCBRAMSEL 0x08 /* Internal SCB RAM Select */ 681 bit RAMPS 0x04 /* External SCB RAM Present */ 682 bit USCBSIZE32 0x02 /* Use 32byte SCB Page Size */ 683 bit CIOPARCKEN 0x01 /* Internal bus parity error enable */ 684} 685 686/* 687 * Bus On/Off Time (p. 3-44) 688 */ 689register BUSTIME { 690 address 0x085 691 access_mode RW 692 mask BOFF 0xf0 693 mask BON 0x0f 694} 695 696/* 697 * Bus Speed (p. 3-45) aic7770 only 698 */ 699register BUSSPD { 700 address 0x086 701 access_mode RW 702 mask DFTHRSH 0xc0 703 mask STBOFF 0x38 704 mask STBON 0x07 705 mask DFTHRSH_100 0xc0 706 mask DFTHRSH_75 0x80 707} 708 709/* aic7850/55/60/70/80/95 only */ 710register DSPCISTATUS { 711 address 0x086 712 mask DFTHRSH_100 0xc0 713} 714 715/* aic7890/91/96/97 only */ 716register HS_MAILBOX { 717 address 0x086 718 mask HOST_MAILBOX 0xF0 719 mask SEQ_MAILBOX 0x0F 720 mask HOST_TQINPOS 0x80 /* Boundary at either 0 or 128 */ 721} 722 723const HOST_MAILBOX_SHIFT 4 724const SEQ_MAILBOX_SHIFT 0 725 726/* 727 * Host Control (p. 3-47) R/W 728 * Overall host control of the device. 729 */ 730register HCNTRL { 731 address 0x087 732 access_mode RW 733 bit POWRDN 0x40 734 bit SWINT 0x10 735 bit IRQMS 0x08 736 bit PAUSE 0x04 737 bit INTEN 0x02 738 bit CHIPRST 0x01 739 bit CHIPRSTACK 0x01 740} 741 742/* 743 * Host Address (p. 3-48) 744 * This register contains the address of the byte about 745 * to be transferred across the host bus. 746 */ 747register HADDR { 748 address 0x088 749 size 4 750 access_mode RW 751} 752 753register HCNT { 754 address 0x08c 755 size 3 756 access_mode RW 757} 758 759/* 760 * SCB Pointer (p. 3-49) 761 * Gate one of the SCBs into the SCBARRAY window. 762 */ 763register SCBPTR { 764 address 0x090 765 access_mode RW 766} 767 768/* 769 * Interrupt Status (p. 3-50) 770 * Status for system interrupts 771 */ 772register INTSTAT { 773 address 0x091 774 access_mode RW 775 bit BRKADRINT 0x08 776 bit SCSIINT 0x04 777 bit CMDCMPLT 0x02 778 bit SEQINT 0x01 779 mask BAD_PHASE SEQINT /* unknown scsi bus phase */ 780 mask SEND_REJECT 0x10|SEQINT /* sending a message reject */ 781 mask NO_IDENT 0x20|SEQINT /* no IDENTIFY after reconnect*/ 782 mask NO_MATCH 0x30|SEQINT /* no cmd match for reconnect */ 783 mask IGN_WIDE_RES 0x40|SEQINT /* Complex IGN Wide Res Msg */ 784 mask RESIDUAL 0x50|SEQINT /* Residual byte count != 0 */ 785 mask HOST_MSG_LOOP 0x60|SEQINT /* 786 * The bus is ready for the 787 * host to perform another 788 * message transaction. This 789 * mechanism is used for things 790 * like sync/wide negotiation 791 * that require a kernel based 792 * message state engine. 793 */ 794 mask BAD_STATUS 0x70|SEQINT /* Bad status from target */ 795 mask PERR_DETECTED 0x80|SEQINT /* 796 * Either the phase_lock 797 * or inb_next routine has 798 * noticed a parity error. 799 */ 800 mask DATA_OVERRUN 0x90|SEQINT /* 801 * Target attempted to write 802 * beyond the bounds of its 803 * command. 804 */ 805 mask MKMSG_FAILED 0xa0|SEQINT /* 806 * Target completed command 807 * without honoring our ATN 808 * request to issue a message. 809 */ 810 mask MISSED_BUSFREE 0xb0|SEQINT /* 811 * The sequencer never saw 812 * the bus go free after 813 * either a command complete 814 * or disconnect message. 815 */ 816 mask SCB_MISMATCH 0xc0|SEQINT /* 817 * Downloaded SCB's tag does 818 * not match the entry we 819 * intended to download. 820 */ 821 mask ABORT_QINSCB 0xd0|SEQINT /* 822 * An SCB was aborted 823 * during download. 824 * Informational. 825 */ 826 mask NO_FREE_SCB 0xe0|SEQINT /* 827 * get_free_or_disc_scb failed. 828 */ 829 mask OUT_OF_RANGE 0xf0|SEQINT 830 831 mask SEQINT_MASK 0xf0|SEQINT /* SEQINT Status Codes */ 832 mask INT_PEND (BRKADRINT|SEQINT|SCSIINT|CMDCMPLT) 833} 834 835/* 836 * Hard Error (p. 3-53) 837 * Reporting of catastrophic errors. You usually cannot recover from 838 * these without a full board reset. 839 */ 840register ERROR { 841 address 0x092 842 access_mode RO 843 bit CIOPARERR 0x80 /* Ultra2 only */ 844 bit PCIERRSTAT 0x40 /* PCI only */ 845 bit MPARERR 0x20 /* PCI only */ 846 bit DPARERR 0x10 /* PCI only */ 847 bit SQPARERR 0x08 848 bit ILLOPCODE 0x04 849 bit ILLSADDR 0x02 850 bit ILLHADDR 0x01 851} 852 853/* 854 * Clear Interrupt Status (p. 3-52) 855 */ 856register CLRINT { 857 address 0x092 858 access_mode WO 859 bit CLRPARERR 0x10 /* PCI only */ 860 bit CLRBRKADRINT 0x08 861 bit CLRSCSIINT 0x04 862 bit CLRCMDINT 0x02 863 bit CLRSEQINT 0x01 864} 865 866register DFCNTRL { 867 address 0x093 868 access_mode RW 869 bit PRELOADEN 0x80 /* aic7890 only */ 870 bit WIDEODD 0x40 871 bit SCSIEN 0x20 872 bit SDMAEN 0x10 873 bit SDMAENACK 0x10 874 bit HDMAEN 0x08 875 bit HDMAENACK 0x08 876 bit DIRECTION 0x04 877 bit FIFOFLUSH 0x02 878 bit FIFORESET 0x01 879} 880 881register DFSTATUS { 882 address 0x094 883 access_mode RO 884 bit PRELOAD_AVAIL 0x80 885 bit DWORDEMP 0x20 886 bit MREQPEND 0x10 887 bit HDONE 0x08 888 bit DFTHRESH 0x04 889 bit FIFOFULL 0x02 890 bit FIFOEMP 0x01 891} 892 893register DFWADDR { 894 address 0x95 895 access_mode RW 896} 897 898register DFRADDR { 899 address 0x97 900 access_mode RW 901} 902 903register DFDAT { 904 address 0x099 905 access_mode RW 906} 907 908/* 909 * SCB Auto Increment (p. 3-59) 910 * Byte offset into the SCB Array and an optional bit to allow auto 911 * incrementing of the address during download and upload operations 912 */ 913register SCBCNT { 914 address 0x09a 915 access_mode RW 916 bit SCBAUTO 0x80 917 mask SCBCNT_MASK 0x1f 918} 919 920/* 921 * Queue In FIFO (p. 3-60) 922 * Input queue for queued SCBs (commands that the seqencer has yet to start) 923 */ 924register QINFIFO { 925 address 0x09b 926 access_mode RW 927} 928 929/* 930 * Queue In Count (p. 3-60) 931 * Number of queued SCBs 932 */ 933register QINCNT { 934 address 0x09c 935 access_mode RO 936} 937 938/* 939 * Queue Out FIFO (p. 3-61) 940 * Queue of SCBs that have completed and await the host 941 */ 942register QOUTFIFO { 943 address 0x09d 944 access_mode WO 945} 946 947register CRCCONTROL1 { 948 address 0x09d 949 access_mode RW 950 bit CRCONSEEN 0x80 951 bit CRCVALCHKEN 0x40 952 bit CRCENDCHKEN 0x20 953 bit CRCREQCHKEN 0x10 954 bit TARGCRCENDEN 0x08 955 bit TARGCRCCNTEN 0x04 956} 957 958 959/* 960 * Queue Out Count (p. 3-61) 961 * Number of queued SCBs in the Out FIFO 962 */ 963register QOUTCNT { 964 address 0x09e 965 access_mode RO 966} 967 968register SCSIPHASE { 969 address 0x09e 970 access_mode RO 971 bit STATUS_PHASE 0x20 972 bit COMMAND_PHASE 0x10 973 bit MSG_IN_PHASE 0x08 974 bit MSG_OUT_PHASE 0x04 975 bit DATA_IN_PHASE 0x02 976 bit DATA_OUT_PHASE 0x01 977} 978 979/* 980 * Special Function 981 */ 982register SFUNCT { 983 address 0x09f 984 access_mode RW 985 bit ALT_MODE 0x80 986} 987 988/* 989 * SCB Definition (p. 5-4) 990 */ 991scb { 992 address 0x0a0 993 SCB_CDB_PTR { 994 size 4 995 alias SCB_RESIDUAL_DATACNT 996 alias SCB_CDB_STORE 997 alias SCB_TARGET_INFO 998 } 999 SCB_RESIDUAL_SGPTR { 1000 size 4 1001 } 1002 SCB_SCSI_STATUS { 1003 size 1 1004 } 1005 SCB_CDB_STORE_PAD { 1006 size 3 1007 } 1008 SCB_DATAPTR { 1009 size 4 1010 } 1011 SCB_DATACNT { 1012 /* 1013 * The last byte is really the high address bits for 1014 * the data address. 1015 */ 1016 size 4 1017 bit SG_LAST_SEG 0x80 /* In the fourth byte */ 1018 mask SG_HIGH_ADDR_BITS 0x7F /* In the fourth byte */ 1019 } 1020 SCB_SGPTR { 1021 size 4 1022 bit SG_RESID_VALID 0x04 /* In the first byte */ 1023 bit SG_FULL_RESID 0x02 /* In the first byte */ 1024 bit SG_LIST_NULL 0x01 /* In the first byte */ 1025 } 1026 SCB_CONTROL { 1027 size 1 1028 bit TARGET_SCB 0x80 1029 bit DISCENB 0x40 1030 bit TAG_ENB 0x20 1031 bit MK_MESSAGE 0x10 1032 bit ULTRAENB 0x08 1033 bit DISCONNECTED 0x04 1034 mask SCB_TAG_TYPE 0x03 1035 } 1036 SCB_SCSIID { 1037 size 1 1038 bit TWIN_CHNLB 0x80 1039 mask TWIN_TID 0x70 1040 mask TID 0xf0 1041 mask OID 0x0f 1042 } 1043 SCB_LUN { 1044 mask LID 0xff 1045 size 1 1046 } 1047 SCB_TAG { 1048 size 1 1049 } 1050 SCB_CDB_LEN { 1051 size 1 1052 } 1053 SCB_SCSIRATE { 1054 size 1 1055 } 1056 SCB_SCSIOFFSET { 1057 size 1 1058 } 1059 SCB_NEXT { 1060 size 1 1061 } 1062 SCB_64_SPARE { 1063 size 16 1064 } 1065 SCB_64_BTT { 1066 size 16 1067 } 1068} 1069 1070const SCB_UPLOAD_SIZE 32 1071const SCB_DOWNLOAD_SIZE 32 1072const SCB_DOWNLOAD_SIZE_64 48 1073 1074const SG_SIZEOF 0x08 /* sizeof(struct ahc_dma) */ 1075 1076/* --------------------- AHA-2840-only definitions -------------------- */ 1077 1078register SEECTL_2840 { 1079 address 0x0c0 1080 access_mode RW 1081 bit CS_2840 0x04 1082 bit CK_2840 0x02 1083 bit DO_2840 0x01 1084} 1085 1086register STATUS_2840 { 1087 address 0x0c1 1088 access_mode RW 1089 bit EEPROM_TF 0x80 1090 mask BIOS_SEL 0x60 1091 mask ADSEL 0x1e 1092 bit DI_2840 0x01 1093} 1094 1095/* --------------------- AIC-7870-only definitions -------------------- */ 1096 1097register CCHADDR { 1098 address 0x0E0 1099 size 8 1100} 1101 1102register CCHCNT { 1103 address 0x0E8 1104} 1105 1106register CCSGRAM { 1107 address 0x0E9 1108} 1109 1110register CCSGADDR { 1111 address 0x0EA 1112} 1113 1114register CCSGCTL { 1115 address 0x0EB 1116 bit CCSGDONE 0x80 1117 bit CCSGEN 0x08 1118 bit SG_FETCH_NEEDED 0x02 /* Bit used for software state */ 1119 bit CCSGRESET 0x01 1120} 1121 1122register CCSCBCNT { 1123 address 0xEF 1124} 1125 1126register CCSCBCTL { 1127 address 0x0EE 1128 bit CCSCBDONE 0x80 1129 bit ARRDONE 0x40 /* SCB Array prefetch done */ 1130 bit CCARREN 0x10 1131 bit CCSCBEN 0x08 1132 bit CCSCBDIR 0x04 1133 bit CCSCBRESET 0x01 1134} 1135 1136register CCSCBADDR { 1137 address 0x0ED 1138} 1139 1140register CCSCBRAM { 1141 address 0xEC 1142} 1143 1144/* 1145 * SCB bank address (7895/7896/97 only) 1146 */ 1147register SCBBADDR { 1148 address 0x0F0 1149 access_mode RW 1150} 1151 1152register CCSCBPTR { 1153 address 0x0F1 1154} 1155 1156register HNSCB_QOFF { 1157 address 0x0F4 1158} 1159 1160register SNSCB_QOFF { 1161 address 0x0F6 1162} 1163 1164register SDSCB_QOFF { 1165 address 0x0F8 1166} 1167 1168register QOFF_CTLSTA { 1169 address 0x0FA 1170 bit SCB_AVAIL 0x40 1171 bit SNSCB_ROLLOVER 0x20 1172 bit SDSCB_ROLLOVER 0x10 1173 mask SCB_QSIZE 0x07 1174 mask SCB_QSIZE_256 0x06 1175} 1176 1177register DFF_THRSH { 1178 address 0x0FB 1179 mask WR_DFTHRSH 0x70 1180 mask RD_DFTHRSH 0x07 1181 mask RD_DFTHRSH_MIN 0x00 1182 mask RD_DFTHRSH_25 0x01 1183 mask RD_DFTHRSH_50 0x02 1184 mask RD_DFTHRSH_63 0x03 1185 mask RD_DFTHRSH_75 0x04 1186 mask RD_DFTHRSH_85 0x05 1187 mask RD_DFTHRSH_90 0x06 1188 mask RD_DFTHRSH_MAX 0x07 1189 mask WR_DFTHRSH_MIN 0x00 1190 mask WR_DFTHRSH_25 0x10 1191 mask WR_DFTHRSH_50 0x20 1192 mask WR_DFTHRSH_63 0x30 1193 mask WR_DFTHRSH_75 0x40 1194 mask WR_DFTHRSH_85 0x50 1195 mask WR_DFTHRSH_90 0x60 1196 mask WR_DFTHRSH_MAX 0x70 1197} 1198 1199register SG_CACHE_PRE { 1200 access_mode WO 1201 address 0x0fc 1202 mask SG_ADDR_MASK 0xf8 1203 bit ODD_SEG 0x04 1204 bit LAST_SEG 0x02 1205 bit LAST_SEG_DONE 0x01 1206} 1207 1208register SG_CACHE_SHADOW { 1209 access_mode RO 1210 address 0x0fc 1211 mask SG_ADDR_MASK 0xf8 1212 bit ODD_SEG 0x04 1213 bit LAST_SEG 0x02 1214 bit LAST_SEG_DONE 0x01 1215} 1216/* ---------------------- Scratch RAM Offsets ------------------------- */ 1217/* These offsets are either to values that are initialized by the board's 1218 * BIOS or are specified by the sequencer code. 1219 * 1220 * The host adapter card (at least the BIOS) uses 20-2f for SCSI 1221 * device information, 32-33 and 5a-5f as well. As it turns out, the 1222 * BIOS trashes 20-2f, writing the synchronous negotiation results 1223 * on top of the BIOS values, so we re-use those for our per-target 1224 * scratchspace (actually a value that can be copied directly into 1225 * SCSIRATE). The kernel driver will enable synchronous negotiation 1226 * for all targets that have a value other than 0 in the lower four 1227 * bits of the target scratch space. This should work regardless of 1228 * whether the bios has been installed. 1229 */ 1230 1231scratch_ram { 1232 address 0x020 1233 1234 /* 1235 * 1 byte per target starting at this address for configuration values 1236 */ 1237 CMDSIZE_TABLE { 1238 alias TARG_SCSIRATE 1239 size 8 1240 } 1241 BUSY_TARGETS { 1242 size 8 1243 } 1244 /* 1245 * Bit vector of targets that have ULTRA enabled as set by 1246 * the BIOS. The Sequencer relies on a per-SCB field to 1247 * control whether to enable Ultra transfers or not. During 1248 * initialization, we read this field and reuse it for 2 1249 * entries in the busy target table. 1250 */ 1251 ULTRA_ENB { 1252 size 2 1253 } 1254 /* 1255 * Bit vector of targets that have disconnection disabled as set by 1256 * the BIOS. The Sequencer relies in a per-SCB field to control the 1257 * disconnect priveldge. During initialization, we read this field 1258 * and reuse it for 2 entries in the busy target table. 1259 */ 1260 DISC_DSB { 1261 size 2 1262 } 1263 BUSY_TARGETS_TAIL { 1264 size 4 1265 } 1266 /* 1267 * Partial transfer past cacheline end to be 1268 * transferred using an extra S/G. 1269 */ 1270 MWI_RESIDUAL { 1271 size 1 1272 } 1273 /* 1274 * SCBID of the next SCB to be started by the controller. 1275 */ 1276 NEXT_QUEUED_SCB { 1277 size 1 1278 } 1279 /* 1280 * Single byte buffer used to designate the type or message 1281 * to send to a target. 1282 */ 1283 MSG_OUT { 1284 size 1 1285 } 1286 /* Parameters for DMA Logic */ 1287 DMAPARAMS { 1288 size 1 1289 bit PRELOADEN 0x80 1290 bit WIDEODD 0x40 1291 bit SCSIEN 0x20 1292 bit SDMAEN 0x10 1293 bit SDMAENACK 0x10 1294 bit HDMAEN 0x08 1295 bit HDMAENACK 0x08 1296 bit DIRECTION 0x04 1297 bit FIFOFLUSH 0x02 1298 bit FIFORESET 0x01 1299 } 1300 SEQ_FLAGS { 1301 size 1 1302 bit IDENTIFY_SEEN 0x80 1303 bit TARGET_CMD_IS_TAGGED 0x40 1304 bit DPHASE 0x20 1305 /* Target flags */ 1306 bit TARG_CMD_PENDING 0x10 1307 bit CMDPHASE_PENDING 0x08 1308 bit DPHASE_PENDING 0x04 1309 bit SPHASE_PENDING 0x02 1310 bit NO_DISCONNECT 0x01 1311 } 1312 /* 1313 * Temporary storage for the 1314 * target/channel/lun of a 1315 * reconnecting target 1316 */ 1317 SAVED_SCSIID { 1318 size 1 1319 } 1320 SAVED_LUN { 1321 size 1 1322 } 1323 /* 1324 * The last bus phase as seen by the sequencer. 1325 */ 1326 LASTPHASE { 1327 size 1 1328 bit CDI 0x80 1329 bit IOI 0x40 1330 bit MSGI 0x20 1331 mask PHASE_MASK CDI|IOI|MSGI 1332 mask P_DATAOUT 0x00 1333 mask P_DATAIN IOI 1334 mask P_COMMAND CDI 1335 mask P_MESGOUT CDI|MSGI 1336 mask P_STATUS CDI|IOI 1337 mask P_MESGIN CDI|IOI|MSGI 1338 mask P_BUSFREE 0x01 1339 } 1340 /* 1341 * head of list of SCBs awaiting 1342 * selection 1343 */ 1344 WAITING_SCBH { 1345 size 1 1346 } 1347 /* 1348 * head of list of SCBs that are 1349 * disconnected. Used for SCB 1350 * paging. 1351 */ 1352 DISCONNECTED_SCBH { 1353 size 1 1354 } 1355 /* 1356 * head of list of SCBs that are 1357 * not in use. Used for SCB paging. 1358 */ 1359 FREE_SCBH { 1360 size 1 1361 } 1362 /* 1363 * Address of the hardware scb array in the host. 1364 */ 1365 HSCB_ADDR { 1366 size 4 1367 } 1368 /* 1369 * Base address of our shared data with the kernel driver in host 1370 * memory. This includes the qoutfifo and target mode 1371 * incoming command queue. 1372 */ 1373 SHARED_DATA_ADDR { 1374 size 4 1375 } 1376 KERNEL_QINPOS { 1377 size 1 1378 } 1379 QINPOS { 1380 size 1 1381 } 1382 QOUTPOS { 1383 size 1 1384 } 1385 /* 1386 * Kernel and sequencer offsets into the queue of 1387 * incoming target mode command descriptors. The 1388 * queue is full when the KERNEL_TQINPOS == TQINPOS. 1389 */ 1390 KERNEL_TQINPOS { 1391 size 1 1392 } 1393 TQINPOS { 1394 size 1 1395 } 1396 ARG_1 { 1397 size 1 1398 mask SEND_MSG 0x80 1399 mask SEND_SENSE 0x40 1400 mask SEND_REJ 0x20 1401 mask MSGOUT_PHASEMIS 0x10 1402 mask EXIT_MSG_LOOP 0x08 1403 mask CONT_MSG_LOOP 0x04 1404 mask CONT_TARG_SESSION 0x02 1405 alias RETURN_1 1406 } 1407 ARG_2 { 1408 size 1 1409 alias RETURN_2 1410 } 1411 1412 /* 1413 * Snapshot of MSG_OUT taken after each message is sent. 1414 */ 1415 LAST_MSG { 1416 size 1 1417 } 1418 1419 /* 1420 * Interrupt kernel for a message to this target on 1421 * the next transaction. This is usually used for 1422 * negotiation requests. 1423 */ 1424 TARGET_MSG_REQUEST { 1425 size 2 1426 } 1427 1428 /* 1429 * Sequences the kernel driver has okayed for us. This allows 1430 * the driver to do things like prevent initiator or target 1431 * operations. 1432 */ 1433 SCSISEQ_TEMPLATE { 1434 size 1 1435 bit ENSELO 0x40 1436 bit ENSELI 0x20 1437 bit ENRSELI 0x10 1438 bit ENAUTOATNO 0x08 1439 bit ENAUTOATNI 0x04 1440 bit ENAUTOATNP 0x02 1441 } 1442 1443 /* 1444 * Track whether the transfer byte count for 1445 * the current data phase is odd. 1446 */ 1447 DATA_COUNT_ODD { 1448 size 1 1449 } 1450 1451 /* 1452 * The initiator specified tag for this target mode transaction. 1453 */ 1454 INITIATOR_TAG { 1455 size 1 1456 } 1457 1458 /* 1459 * These are reserved registers in the card's scratch ram. Some of 1460 * the values are specified in the AHA2742 technical reference manual 1461 * and are initialized by the BIOS at boot time. 1462 */ 1463 SCSICONF { 1464 address 0x05a 1465 size 1 1466 bit TERM_ENB 0x80 1467 bit RESET_SCSI 0x40 1468 bit ENSPCHK 0x20 1469 mask HSCSIID 0x07 /* our SCSI ID */ 1470 mask HWSCSIID 0x0f /* our SCSI ID if Wide Bus */ 1471 } 1472 INTDEF { 1473 address 0x05c 1474 size 1 1475 bit EDGE_TRIG 0x80 1476 mask VECTOR 0x0f 1477 } 1478 HOSTCONF { 1479 address 0x05d 1480 size 1 1481 } 1482 HA_274_BIOSCTRL { 1483 address 0x05f 1484 size 1 1485 mask BIOSMODE 0x30 1486 mask BIOSDISABLED 0x30 1487 bit CHANNEL_B_PRIMARY 0x08 1488 } 1489 /* 1490 * Per target SCSI offset values for Ultra2 controllers. 1491 */ 1492 TARG_OFFSET { 1493 address 0x070 1494 size 16 1495 } 1496} 1497 1498const TID_SHIFT 4 1499const SCB_LIST_NULL 0xff 1500const TARGET_CMD_CMPLT 0xfe 1501 1502const CCSGADDR_MAX 0x80 1503const CCSGRAM_MAXSEGS 16 1504 1505/* WDTR Message values */ 1506const BUS_8_BIT 0x00 1507const BUS_16_BIT 0x01 1508const BUS_32_BIT 0x02 1509 1510/* Offset maximums */ 1511const MAX_OFFSET_8BIT 0x0f 1512const MAX_OFFSET_16BIT 0x08 1513const MAX_OFFSET_ULTRA2 0x7f 1514const HOST_MSG 0xff 1515 1516/* Target mode command processing constants */ 1517const CMD_GROUP_CODE_SHIFT 0x05 1518 1519const STATUS_BUSY 0x08 1520const STATUS_QUEUE_FULL 0x28 1521const SCB_TARGET_PHASES 0 1522const SCB_TARGET_DATA_DIR 1 1523const SCB_TARGET_STATUS 2 1524const SCB_INITIATOR_TAG 3 1525const TARGET_DATA_IN 1 1526 1527/* 1528 * Downloaded (kernel inserted) constants 1529 */ 1530/* Offsets into the SCBID array where different data is stored */ 1531const QOUTFIFO_OFFSET download 1532const QINFIFO_OFFSET download 1533const CACHESIZE_MASK download 1534const INVERTED_CACHESIZE_MASK download 1535const SG_PREFETCH_CNT download 1536const SG_PREFETCH_ALIGN_MASK download 1537const SG_PREFETCH_ADDR_MASK download 1538