aic7xxx.seq (4866) | aic7xxx.seq (5326) |
---|---|
1# @(#)aic7xxx.seq 1.31 94/11/25 jda 2# 3# Adaptec 274x device driver for Linux. 4# Copyright (c) 1994 The University of Calgary Department of Computer Science. 5# 6# This program is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 2 of the License, or --- 50 unchanged lines hidden (view full) --- 59INTSTAT = 0x91 60DFCNTRL = 0x93 61DFSTATUS = 0x94 62DFDAT = 0x99 63QINFIFO = 0x9b 64QINCNT = 0x9c 65QOUTFIFO = 0x9d 66 | 1# @(#)aic7xxx.seq 1.31 94/11/25 jda 2# 3# Adaptec 274x device driver for Linux. 4# Copyright (c) 1994 The University of Calgary Department of Computer Science. 5# 6# This program is free software; you can redistribute it and/or modify 7# it under the terms of the GNU General Public License as published by 8# the Free Software Foundation; either version 2 of the License, or --- 50 unchanged lines hidden (view full) --- 59INTSTAT = 0x91 60DFCNTRL = 0x93 61DFSTATUS = 0x94 62DFDAT = 0x99 63QINFIFO = 0x9b 64QINCNT = 0x9c 65QOUTFIFO = 0x9d 66 |
67SCSICONF = 0x5a | 67SCSICONF_A = 0x5a 68SCSICONF_B = 0x5b |
68 69# The two reserved bytes at SCBARRAY+1[23] are expected to be set to 70# zero, and the reserved bit in SCBARRAY+0 is used as an internal flag 71# to indicate whether or not to reload scatter-gather parameters after 72# a disconnect. 73# 74SCBARRAY+0 = 0xa0 75SCBARRAY+1 = 0xa1 --- 17 unchanged lines hidden (view full) --- 93SIGNAL_0 = 0x01 # unknown scsi bus phase 94SIGNAL_1 = 0x11 # message reject 95SIGNAL_2 = 0x21 # no IDENTIFY after reconnect 96SIGNAL_3 = 0x31 # no cmd match for reconnect 97SIGNAL_4 = 0x41 # SDTR -> SCSIRATE conversion 98STATUS_ERROR = 0x51 99 100# The host adapter card (at least the BIOS) uses 20-2f for SCSI | 69 70# The two reserved bytes at SCBARRAY+1[23] are expected to be set to 71# zero, and the reserved bit in SCBARRAY+0 is used as an internal flag 72# to indicate whether or not to reload scatter-gather parameters after 73# a disconnect. 74# 75SCBARRAY+0 = 0xa0 76SCBARRAY+1 = 0xa1 --- 17 unchanged lines hidden (view full) --- 94SIGNAL_0 = 0x01 # unknown scsi bus phase 95SIGNAL_1 = 0x11 # message reject 96SIGNAL_2 = 0x21 # no IDENTIFY after reconnect 97SIGNAL_3 = 0x31 # no cmd match for reconnect 98SIGNAL_4 = 0x41 # SDTR -> SCSIRATE conversion 99STATUS_ERROR = 0x51 100 101# The host adapter card (at least the BIOS) uses 20-2f for SCSI |
101# device information, 32-33 and 5a-5f as well. Since we don't support 102# wide or twin-bus SCSI, 28-2f can be reclaimed. As it turns out, the 103# BIOS trashes 20-27 anyway, writing the synchronous negotiation results | 102# device information, 32-33 and 5a-5f as well. As it turns out, the 103# BIOS trashes 20-2f, writing the synchronous negotiation results |
104# on top of the BIOS values, so we re-use those for our per-target 105# scratchspace (actually a value that can be copied directly into | 104# on top of the BIOS values, so we re-use those for our per-target 105# scratchspace (actually a value that can be copied directly into |
106# SCSIRATE). This implies, since we can't get the BIOS config values, 107# that all targets will be negotiated with for synchronous transfer. 108# NEEDSDTR has one bit per target indicating if an SDTR message is 109# needed for that device - this will be set initially, as well as 110# after a bus reset condition. | 106# SCSIRATE). The kernel driver will enable synchronous negotiation 107# for all targets that have a value other than 0 in the lower four 108# bits of the target scratch space. This should work irregardless of 109# whether the bios has been installed. NEEDSDTR has one bit per target 110# indicating if an SDTR message is needed for that device - this will 111# be set initially (based on a search through the target scratch space), 112# as well as after a bus reset condition. |
111# 112# The high bit of DROPATN is set if ATN should be dropped before the ACK 113# when outb is called. REJBYTE contains the first byte of a MESSAGE IN 114# message, so the driver can report an intelligible error if a message is 115# rejected. 116# 117# RESELECT's high bit is true if we are currently handling a reselect; 118# its next-highest bit is true ONLY IF we've seen an IDENTIFY message 119# from the reselecting target. If we haven't had IDENTIFY, then we have 120# no idea what the lun is, and we can't select the right SCB register 121# bank, so force a kernel panic if the target attempts a data in/out or 122# command phase instead of corrupting something. 123# 124# Note that SG_NEXT occupies four bytes. 125# 126SYNCNEG = 0x20 | 113# 114# The high bit of DROPATN is set if ATN should be dropped before the ACK 115# when outb is called. REJBYTE contains the first byte of a MESSAGE IN 116# message, so the driver can report an intelligible error if a message is 117# rejected. 118# 119# RESELECT's high bit is true if we are currently handling a reselect; 120# its next-highest bit is true ONLY IF we've seen an IDENTIFY message 121# from the reselecting target. If we haven't had IDENTIFY, then we have 122# no idea what the lun is, and we can't select the right SCB register 123# bank, so force a kernel panic if the target attempts a data in/out or 124# command phase instead of corrupting something. 125# 126# Note that SG_NEXT occupies four bytes. 127# 128SYNCNEG = 0x20 |
127DISC_DSB_A = 0x32 | |
128 129DROPATN = 0x30 130REJBYTE = 0x31 | 129 130DROPATN = 0x30 131REJBYTE = 0x31 |
132DISC_DSB_A = 0x32 133DISC_DSB_B = 0x33 |
|
131RESELECT = 0x34 132 133MSG_FLAGS = 0x35 134MSG_LEN = 0x36 135MSG_START+0 = 0x37 136MSG_START+1 = 0x38 137MSG_START+2 = 0x39 138MSG_START+3 = 0x3a 139MSG_START+4 = 0x3b 140MSG_START+5 = 0x3c 141-MSG_START+0 = 0xc9 # 2's complement of MSG_START+0 142 143ARG_1 = 0x4c # sdtr conversion args & return | 134RESELECT = 0x34 135 136MSG_FLAGS = 0x35 137MSG_LEN = 0x36 138MSG_START+0 = 0x37 139MSG_START+1 = 0x38 140MSG_START+2 = 0x39 141MSG_START+3 = 0x3a 142MSG_START+4 = 0x3b 143MSG_START+5 = 0x3c 144-MSG_START+0 = 0xc9 # 2's complement of MSG_START+0 145 146ARG_1 = 0x4c # sdtr conversion args & return |
144ARG_2 = 0x4d | |
145RETURN_1 = 0x4c 146 | 147RETURN_1 = 0x4c 148 |
147SIGSTATE = 0x4e # value written to SCSISIGO 148NEEDSDTR = 0x4f # send SDTR message, 1 bit/trgt | 149SIGSTATE = 0x4d # value written to SCSISIGO 150NEEDSDTR_A = 0x4e # send SDTR message, 1 bit/trgt 151NEEDSDTR_B = 0x4f |
149 150SG_SIZEOF = 0x8 # sizeof(struct scatterlist) 151SG_NOLOAD = 0x50 # load SG pointer/length? 152SG_COUNT = 0x51 # working value of SG count 153SG_NEXT = 0x52 # working value of SG pointer 154SG_NEXT+0 = 0x52 155SG_NEXT+1 = 0x53 156SG_NEXT+2 = 0x54 157SG_NEXT+3 = 0x55 158 159SCBCOUNT = 0x56 # the actual number of SCBs | 152 153SG_SIZEOF = 0x8 # sizeof(struct scatterlist) 154SG_NOLOAD = 0x50 # load SG pointer/length? 155SG_COUNT = 0x51 # working value of SG count 156SG_NEXT = 0x52 # working value of SG pointer 157SG_NEXT+0 = 0x52 158SG_NEXT+1 = 0x53 159SG_NEXT+2 = 0x54 160SG_NEXT+3 = 0x55 161 162SCBCOUNT = 0x56 # the actual number of SCBs |
160ACTIVE_A = 0x57 | 163FLAGS = 0x57 # Device configuration flags 164TWIN_BUS = 0x01 165WIDE_BUS = 0x02 |
161 | 166 |
167ACTIVE_A = 0x58 168ACTIVE_B = 0x59 169 |
|
162# Poll QINCNT for work - the lower bits contain 163# the number of entries in the Queue In FIFO. 164# 165start: | 170# Poll QINCNT for work - the lower bits contain 171# the number of entries in the Queue In FIFO. 172# 173start: |
174 test FLAGS,TWIN_BUS jz start2 # Are we a twin channel device? 175# For fairness, we check the other bus first, since we just finished a 176# transaction on the current channel. 177 xor SBLKCTL,0x08 # Toggle to the other bus |
|
166 test SCSISIGI,0x4 jnz reselect # BSYI | 178 test SCSISIGI,0x4 jnz reselect # BSYI |
179 xor SBLKCTL,0x08 # Toggle to the original bus 180start2: 181 test SCSISIGI,0x4 jnz reselect # BSYI |
|
167 test QINCNT,SCBMASK jz start 168 169# We have at least one queued SCB now. Set the SCB pointer 170# from the FIFO so we see the right bank of SCB registers, 171# then set SCSI options and set the initiator and target 172# SCSI IDs. 173# 174 mov SCBPTR,QINFIFO 175 176# See if there is not already an active SCB for this target. This code | 182 test QINCNT,SCBMASK jz start 183 184# We have at least one queued SCB now. Set the SCB pointer 185# from the FIFO so we see the right bank of SCB registers, 186# then set SCSI options and set the initiator and target 187# SCSI IDs. 188# 189 mov SCBPTR,QINFIFO 190 191# See if there is not already an active SCB for this target. This code |
177# will have to be modified when we add support for dual and wide busses. | 192# locks out on a per target basis instead of target/lun. Although this 193# is not ideal for devices that have multiple luns active at the same 194# time, it is faster than looping through all SCB's looking for active 195# commands. It may be benificial to make findscb a more general procedure 196# to see if the added cost of the search is negligible. This code also 197# assumes that the kernel driver will clear the active flags on board 198# initialization, board reset, and a target's SELTO. |
178 179 and FUNCTION1,0x70,SCBARRAY+1 180 mov A,FUNCTION1 | 199 200 and FUNCTION1,0x70,SCBARRAY+1 201 mov A,FUNCTION1 |
181 test ACTIVE_A,A jz active | 202 test SCBARRAY+1,0x88 jz test_a # Id < 8 && A channel 203 204 test ACTIVE_B,A jnz requeue 205 or ACTIVE_B,A # Mark the current target as busy 206 jmp start_scb 207 |
182# Place the currently active back on the queue for later processing | 208# Place the currently active back on the queue for later processing |
209requeue: |
|
183 mov QINFIFO, SCBPTR 184 jmp start 185 | 210 mov QINFIFO, SCBPTR 211 jmp start 212 |
186# Mark the current target as busy and get working on the SCB 187active: 188 or ACTIVE_A,A | 213test_a: 214 test ACTIVE_A,A jnz requeue 215 or ACTIVE_A,A # Mark the current target as busy 216 217start_scb: 218 and A,0x08,SCBARRAY+1 219 mov SBLKCTL,A # select channel, !wide |
189 mov SCBARRAY+1 call initialize 190 clr SG_NOLOAD 191 clr RESELECT 192 193# As soon as we get a successful selection, the target should go 194# into the message out phase since we have ATN asserted. Prepare 195# the message to send, locking out the device driver. If the device 196# driver hasn't beaten us with an ABORT or RESET message, then tack --- 283 unchanged lines hidden (view full) --- 480 mvi A call inb_first # read the 1st message byte 481 mvi REJBYTE,A # save it for the driver 482 483 cmp ALLZEROS,A jne p_mesgin1 484 485# We got a "command complete" message, so put the SCB pointer 486# into the Queue Out, and trigger a completion interrupt. 487# Check status for non zero return and interrupt driver if needed | 220 mov SCBARRAY+1 call initialize 221 clr SG_NOLOAD 222 clr RESELECT 223 224# As soon as we get a successful selection, the target should go 225# into the message out phase since we have ATN asserted. Prepare 226# the message to send, locking out the device driver. If the device 227# driver hasn't beaten us with an ABORT or RESET message, then tack --- 283 unchanged lines hidden (view full) --- 511 mvi A call inb_first # read the 1st message byte 512 mvi REJBYTE,A # save it for the driver 513 514 cmp ALLZEROS,A jne p_mesgin1 515 516# We got a "command complete" message, so put the SCB pointer 517# into the Queue Out, and trigger a completion interrupt. 518# Check status for non zero return and interrupt driver if needed |
488# This allows the driver to do a sense command to find out the 489# source of error. We don't bother to post to the QOUTFIFO in 490# the error case since it would require extra work in the kernel 491# driver to ensure that the entry was removed before the command 492# complete code tried processing it. | 519# This allows the driver to interpret errors only when they occur 520# instead of always uploading the scb. If the status is SCSI_CHECK, 521# the driver will download a new scb requesting sense, to replace 522# the old one and the sequencer code will imediately jump to start 523# working on it. If the kernel driver does not wish to request sense, 524# the sequencer program counter is incremented by 1, preventing another run 525# on the current SCB and the command is allowed to complete. We don't 526# bother to post to the QOUTFIFO in the error case since it would require 527# extra work in the kernel driver to ensure that the entry was removed 528# before the command complete code tried processing it. |
493 | 529 |
494# First, mark this target as free. 495 and FUNCTION1,0x70,SCBARRAY+1 496 mov A,FUNCTION1 497 xor ACTIVE_A,A 498 | |
499 test SCBARRAY+14,0xff jz status_ok # 0 Status? 500 call inb_last # ack & turn auto PIO back on 501 mvi INTSTAT,STATUS_ERROR # let driver know | 530 test SCBARRAY+14,0xff jz status_ok # 0 Status? 531 call inb_last # ack & turn auto PIO back on 532 mvi INTSTAT,STATUS_ERROR # let driver know |
502 jmp ITloop | 533 jmp start_scb 534 |
503status_ok: | 535status_ok: |
536 537# First, mark this target as free. 538 and FUNCTION1,0x70,SCBARRAY+1 539 mov A,FUNCTION1 540 test SCBARRAY+1,0x88 jz clear_a 541 xor ACTIVE_B,A 542 jmp complete 543 544clear_a: 545 xor ACTIVE_A,A 546 547complete: |
|
504 mov QOUTFIFO,SCBPTR | 548 mov QOUTFIFO,SCBPTR |
505 mvi INTSTAT,0x2 # CMDCMPLT | 549 mvi INTSTAT,0x02 # CMDCMPLT |
506 jmp p_mesgin_done 507 508# Is it an extended message? We only support the synchronous data 509# transfer request message, which will probably be in response to 510# an SDTR message out from us. If it's not an SDTR, reject it - 511# apparently this can be done after any message in byte, according 512# to the SCSI-2 spec. 513# --- 4 unchanged lines hidden (view full) --- 518 cmp A,1 jne p_mesgin2 # extended message code? 519 520 mvi A call inb_next 521 cmp A,3 jne p_mesginN # extended mesg length = 3 522 mvi A call inb_next 523 cmp A,1 jne p_mesginN # SDTR code 524 525 mvi ARG_1 call inb_next # xfer period | 550 jmp p_mesgin_done 551 552# Is it an extended message? We only support the synchronous data 553# transfer request message, which will probably be in response to 554# an SDTR message out from us. If it's not an SDTR, reject it - 555# apparently this can be done after any message in byte, according 556# to the SCSI-2 spec. 557# --- 4 unchanged lines hidden (view full) --- 562 cmp A,1 jne p_mesgin2 # extended message code? 563 564 mvi A call inb_next 565 cmp A,3 jne p_mesginN # extended mesg length = 3 566 mvi A call inb_next 567 cmp A,1 jne p_mesginN # SDTR code 568 569 mvi ARG_1 call inb_next # xfer period |
526 mvi ARG_2 call inb_next # REQ/ACK offset | 570 mvi A call inb_next # REQ/ACK offset |
527 mvi INTSTAT,SIGNAL_4 # call driver to convert 528 529 call ndx_sdtr # index sync config for target 530 mov DINDEX,SINDEX | 571 mvi INTSTAT,SIGNAL_4 # call driver to convert 572 573 call ndx_sdtr # index sync config for target 574 mov DINDEX,SINDEX |
531 mov DINDIR,RETURN_1 # save returned value 532 | |
533 not A # turn off "need sdtr" flag | 575 not A # turn off "need sdtr" flag |
534 and NEEDSDTR,A | 576 test SBLKCTL,0x08 jnz p_mesgin1_b 577 test SCSIID,0x80 jnz p_mesgin1_b 578 and NEEDSDTR_A,A 579 jmp p_mesgin1_save |
535 | 580 |
581p_mesgin1_b: 582 and NEEDSDTR_B,A 583 584p_mesgin1_save: 585 and A,0x80,SINDIR # get the WIDEXFER flag 586 or RETURN_1,A # Set WIDEXFER if necessary 587 mov DINDIR,RETURN_1 # save returned value 588 |
|
536# Even though the SCSI-2 specification says that a device responding 537# to our SDTR message should honor our parameters for transmitting 538# to us, it doesn't seem to work too well in real life. In particular, 539# a lot of CD-ROM and tape units don't function: try using the SDTR 540# parameters the device sent us for both transmitting and receiving. 541# 542 mov SCSIRATE,RETURN_1 543 jmp p_mesgin_done --- 38 unchanged lines hidden (view full) --- 582 mov A call findSCB # switch to correct SCB 583 584# If a active message is present after calling findSCB, then either it 585# or the driver is trying to abort the command. Either way, something 586# untoward has happened and we should just leave it alone. 587# 588 test MSG_FLAGS,0x80 jnz p_mesgin_done 589 | 589# Even though the SCSI-2 specification says that a device responding 590# to our SDTR message should honor our parameters for transmitting 591# to us, it doesn't seem to work too well in real life. In particular, 592# a lot of CD-ROM and tape units don't function: try using the SDTR 593# parameters the device sent us for both transmitting and receiving. 594# 595 mov SCSIRATE,RETURN_1 596 jmp p_mesgin_done --- 38 unchanged lines hidden (view full) --- 635 mov A call findSCB # switch to correct SCB 636 637# If a active message is present after calling findSCB, then either it 638# or the driver is trying to abort the command. Either way, something 639# untoward has happened and we should just leave it alone. 640# 641 test MSG_FLAGS,0x80 jnz p_mesgin_done 642 |
590 xor SCBARRAY+0,0x4 # clear disconnect bit in SCB | 643 and SCBARRAY+0,0xfb # clear disconnect bit in SCB |
591 mvi RESELECT,0xc0 # make note of IDENTIFY 592 593 call sg_scb2ram # implied restore pointers 594 # required on reselect 595 jmp p_mesgin_done 596 597# Message reject? If we have an outstanding SDTR negotiation, assume 598# that it's a response from the target selecting asynchronous transfer, 599# otherwise just ignore it since we have no clue what it pertains to. 600# 601# XXX - I don't have a device that responds this way. Does this code 602# actually work? 603# 604p_mesgin6: 605 cmp A,7 jne p_mesgin7 # message reject code? 606 607 and FUNCTION1,0x70,SCSIID # outstanding SDTR message? 608 mov A,FUNCTION1 | 644 mvi RESELECT,0xc0 # make note of IDENTIFY 645 646 call sg_scb2ram # implied restore pointers 647 # required on reselect 648 jmp p_mesgin_done 649 650# Message reject? If we have an outstanding SDTR negotiation, assume 651# that it's a response from the target selecting asynchronous transfer, 652# otherwise just ignore it since we have no clue what it pertains to. 653# 654# XXX - I don't have a device that responds this way. Does this code 655# actually work? 656# 657p_mesgin6: 658 cmp A,7 jne p_mesgin7 # message reject code? 659 660 and FUNCTION1,0x70,SCSIID # outstanding SDTR message? 661 mov A,FUNCTION1 |
609 test NEEDSDTR,A jz p_mesgin_done # no - ignore rejection | 662 663 test SBLKCTL,0x08 jnz p_mesgin6_b 664 test SCSIID,0x80 jnz p_mesgin6_b 665 test NEEDSDTR_A,A jz p_mesgin_done # no - ignore rejection 666 call ndx_sdtr # note use of asynch xfer 667 mov DINDEX,SINDEX 668 clr DINDIR |
610 | 669 |
670 not A 671 and NEEDSDTR_A,A 672 jmp p_mesgin6_done 673 674p_mesgin6_b: 675 test NEEDSDTR_B,A jz p_mesgin_done # no - ignore rejection |
|
611 call ndx_sdtr # note use of asynch xfer 612 mov DINDEX,SINDEX 613 clr DINDIR 614 | 676 call ndx_sdtr # note use of asynch xfer 677 mov DINDEX,SINDEX 678 clr DINDIR 679 |
615 not A # turn off "active sdtr" flag 616 and NEEDSDTR,A | 680 not A 681 and NEEDSDTR_B,A 682 683p_mesgin6_done: |
617 618 clr SCSIRATE # select asynch xfer 619 jmp p_mesgin_done 620 621# [ ADD MORE MESSAGE HANDLING HERE ] 622# 623p_mesgin7: 624 --- 142 unchanged lines hidden (view full) --- 767# the DMA circuitry doesn't ACK when PHASEMIS is active). If we are 768# doing a SCSI->Host transfer, the data FIFO should be flushed auto- 769# magically on STCNT=0 or a phase change, so just wait for FIFO empty 770# status. 771# 772dma3: 773 test SINDEX,0x4 jnz dma5 # DIRECTION 774dma4: | 684 685 clr SCSIRATE # select asynch xfer 686 jmp p_mesgin_done 687 688# [ ADD MORE MESSAGE HANDLING HERE ] 689# 690p_mesgin7: 691 --- 142 unchanged lines hidden (view full) --- 834# the DMA circuitry doesn't ACK when PHASEMIS is active). If we are 835# doing a SCSI->Host transfer, the data FIFO should be flushed auto- 836# magically on STCNT=0 or a phase change, so just wait for FIFO empty 837# status. 838# 839dma3: 840 test SINDEX,0x4 jnz dma5 # DIRECTION 841dma4: |
775 test DFSTATUS,0x1 jz dma4 # FIFOFLUSHACK | 842 test DFSTATUS,0x1 jz dma4 # FIFOEMP |
776 777# Now shut the DMA enables off, and copy STCNT (ie. the underrun 778# amount, if any) to the SCB registers; SG_COUNT will get copied to 779# the SCB's residual S/G count field after sg_advance is called. Make 780# sure that the DMA enables are actually off first lest we get an ILLSADDR. 781# 782dma5: 783 clr DFCNTRL # disable DMA --- 6 unchanged lines hidden (view full) --- 790 791 ret 792 793# Common SCSI initialization for selection and reselection. Expects 794# the target SCSI ID to be in the upper four bits of SINDEX, and A's 795# contents are stomped on return. 796# 797initialize: | 843 844# Now shut the DMA enables off, and copy STCNT (ie. the underrun 845# amount, if any) to the SCB registers; SG_COUNT will get copied to 846# the SCB's residual S/G count field after sg_advance is called. Make 847# sure that the DMA enables are actually off first lest we get an ILLSADDR. 848# 849dma5: 850 clr DFCNTRL # disable DMA --- 6 unchanged lines hidden (view full) --- 857 858 ret 859 860# Common SCSI initialization for selection and reselection. Expects 861# the target SCSI ID to be in the upper four bits of SINDEX, and A's 862# contents are stomped on return. 863# 864initialize: |
798 clr SBLKCTL # channel A, !wide | |
799 and SCSIID,0xf0,SINDEX # target ID | 865 and SCSIID,0xf0,SINDEX # target ID |
800 and A,0x7,SCSICONF # SCSI_ID_A[210] | 866 test SBLKCTL,0x08 jnz initialize_b 867 mvi SINDEX,SCSICONF_A 868 test FLAGS,WIDE_BUS jnz initialize_wide 869 and A,0x7,SCSICONF_A # SCSI_ID_A[210] 870 jmp initialize_2 871initialize_b: 872 and A,0x7,SCSICONF_B # SCSI_ID_B[210] 873 mvi SCSICONF_B jmp initialize_2 874 875initialize_wide: 876 and A, 0xf,SCSICONF_B 877 878initialize_2: |
801 or SCSIID,A 802 803# Esundry initialization. 804# 805 clr DROPATN 806 clr SIGSTATE 807 808# Turn on Automatic PIO mode now, before we expect to see an REQ --- 7 unchanged lines hidden (view full) --- 816 mvi SXFRCTL0,0x8a # DFON|SPIOEN|CLRCHN 817 818# Set SCSI bus parity checking and the selection timeout value, 819# and enable the hardware selection timer. Set the SELTO interrupt 820# to signal the driver. 821# 822# STPWEN is 7870-specific, enabling an external termination power source. 823# | 879 or SCSIID,A 880 881# Esundry initialization. 882# 883 clr DROPATN 884 clr SIGSTATE 885 886# Turn on Automatic PIO mode now, before we expect to see an REQ --- 7 unchanged lines hidden (view full) --- 894 mvi SXFRCTL0,0x8a # DFON|SPIOEN|CLRCHN 895 896# Set SCSI bus parity checking and the selection timeout value, 897# and enable the hardware selection timer. Set the SELTO interrupt 898# to signal the driver. 899# 900# STPWEN is 7870-specific, enabling an external termination power source. 901# |
824 and A,0x38,SCSICONF # PARITY_ENB_A|SEL_TIM_A[10] 825 or SXFRCTL1,0x5,A # ENSTIMER|STPWEN | 902 and A,0x38,SINDIR # PARITY_ENB|SEL_TIM[10] 903 or SXFRCTL1,0x7,A # ENSTIMER|ACTNEGEN|STPWEN |
826 mvi SIMODE1,0x84 # ENSELTIMO|ENSCSIPERR 827 828# Initialize scatter-gather pointers by setting up the working copy 829# in scratch RAM. 830# 831 call sg_scb2ram 832 833# Initialize SCSIRATE with the appropriate value for this target. --- 10 unchanged lines hidden (view full) --- 844 test RESELECT,0x40 jnz assert1 # seen IDENTIFY? 845 846 mvi INTSTAT,SIGNAL_2 # no - cause a kernel panic 847 848assert1: 849 ret 850 851# Find out if disconnection is ok from the information the BIOS has left | 904 mvi SIMODE1,0x84 # ENSELTIMO|ENSCSIPERR 905 906# Initialize scatter-gather pointers by setting up the working copy 907# in scratch RAM. 908# 909 call sg_scb2ram 910 911# Initialize SCSIRATE with the appropriate value for this target. --- 10 unchanged lines hidden (view full) --- 922 test RESELECT,0x40 jnz assert1 # seen IDENTIFY? 923 924 mvi INTSTAT,SIGNAL_2 # no - cause a kernel panic 925 926assert1: 927 ret 928 929# Find out if disconnection is ok from the information the BIOS has left |
852# us. The target ID should be in the upper four bits of SINDEX; A will | 930# us. The tcl from SCBARRAY+1 should be in SINDEX; A will |
853# contain either 0x40 (disconnection ok) or 0x00 (disconnection not ok) 854# on exit. 855# | 931# contain either 0x40 (disconnection ok) or 0x00 (disconnection not ok) 932# on exit. 933# |
856# This is the only place the target ID is limited to three bits, so we 857# can use the FUNCTION1 register. | 934# To allow for wide or twin busses, we check the upper bit of the target ID 935# and the channel ID and look at the appropriate disconnect register. |
858# 859disconnect: 860 and FUNCTION1,0x70,SINDEX # strip off extra just in case 861 mov A,FUNCTION1 | 936# 937disconnect: 938 and FUNCTION1,0x70,SINDEX # strip off extra just in case 939 mov A,FUNCTION1 |
862 test DISC_DSB_A,A jz disconnect1 # bit nonzero if DISabled | 940 test SINDEX, 0x88 jz disconnect_a |
863 | 941 |
942 test DISC_DSB_B,A jz disconnect1 # bit nonzero if DISabled |
|
864 clr A ret | 943 clr A ret |
944 945disconnect_a: 946 test DISC_DSB_A,A jz disconnect1 # bit nonzero if DISabled 947 clr A ret 948 |
|
865disconnect1: 866 mvi A,0x40 ret 867 868# Locate the SCB matching the target ID in SELID and the lun in the lower 869# three bits of SINDEX, and switch the SCB to it. Have the kernel print 870# a warning message if it can't be found, and generate an ABORT message 871# to the target. We keep the value of the t/c/l that we are trying to find 872# in DINDEX so it is not overwritten during our check to see if we are 873# at the last SCB. 874# 875findSCB: 876 and A,0x7,SINDEX # lun in lower three bits | 949disconnect1: 950 mvi A,0x40 ret 951 952# Locate the SCB matching the target ID in SELID and the lun in the lower 953# three bits of SINDEX, and switch the SCB to it. Have the kernel print 954# a warning message if it can't be found, and generate an ABORT message 955# to the target. We keep the value of the t/c/l that we are trying to find 956# in DINDEX so it is not overwritten during our check to see if we are 957# at the last SCB. 958# 959findSCB: 960 and A,0x7,SINDEX # lun in lower three bits |
877 or DINDEX,A,SELID # can I do this? 878 and DINDEX,0xf7 # only channel A implemented 879 | 961 or DINDEX,A,SELID 962 and DINDEX,0xf7 963 and A,0x08,SBLKCTL # B Channel?? 964 or DINDEX,A |
880 clr SINDEX 881 882findSCB1: 883 mov A,DINDEX 884 mov SCBPTR,SINDEX # switch to new SCB 885 cmp SCBARRAY+1,A jne findSCB2 # target ID/channel/lun match? 886 test SCBARRAY+0,0x4 jz findSCB2 # should be disconnected | 965 clr SINDEX 966 967findSCB1: 968 mov A,DINDEX 969 mov SCBPTR,SINDEX # switch to new SCB 970 cmp SCBARRAY+1,A jne findSCB2 # target ID/channel/lun match? 971 test SCBARRAY+0,0x4 jz findSCB2 # should be disconnected |
887 | |
888 ret 889 890findSCB2: 891 inc SINDEX 892 mov A,SCBCOUNT 893 cmp SINDEX,A jne findSCB1 894 895 mvi INTSTAT,SIGNAL_3 # not found - signal kernel --- 128 unchanged lines hidden (view full) --- 1024 ret 1025 1026# Add the array base SYNCNEG to the target offset (the target address 1027# is in SCSIID), and return the result in SINDEX. The accumulator 1028# contains the 3->8 decoding of the target ID on return. 1029# 1030ndx_sdtr: 1031 shr A,SCSIID,4 | 972 ret 973 974findSCB2: 975 inc SINDEX 976 mov A,SCBCOUNT 977 cmp SINDEX,A jne findSCB1 978 979 mvi INTSTAT,SIGNAL_3 # not found - signal kernel --- 128 unchanged lines hidden (view full) --- 1108 ret 1109 1110# Add the array base SYNCNEG to the target offset (the target address 1111# is in SCSIID), and return the result in SINDEX. The accumulator 1112# contains the 3->8 decoding of the target ID on return. 1113# 1114ndx_sdtr: 1115 shr A,SCSIID,4 |
1032 and A,0x7 | 1116 test SBLKCTL,0x08 jz ndx_sdtr_2 1117 or A,0x08 # Channel B entries add 8 1118ndx_sdtr_2: |
1033 add SINDEX,SYNCNEG,A 1034 1035 and FUNCTION1,0x70,SCSIID # 3-bit target address decode 1036 mov A,FUNCTION1 ret 1037 1038# If we need to negotiate transfer parameters, build the SDTR message 1039# starting at the address passed in SINDEX. DINDEX is modified on return. 1040# 1041mk_sdtr: 1042 mov DINDEX,SINDEX # save SINDEX 1043 1044 call ndx_sdtr | 1119 add SINDEX,SYNCNEG,A 1120 1121 and FUNCTION1,0x70,SCSIID # 3-bit target address decode 1122 mov A,FUNCTION1 ret 1123 1124# If we need to negotiate transfer parameters, build the SDTR message 1125# starting at the address passed in SINDEX. DINDEX is modified on return. 1126# 1127mk_sdtr: 1128 mov DINDEX,SINDEX # save SINDEX 1129 1130 call ndx_sdtr |
1045 test NEEDSDTR,A jnz mk_sdtr1 # do we need negotiation? | 1131 test SCBARRAY+1,0x88 jz mk_sdtr1_a 1132 test NEEDSDTR_B,A jnz mk_sdtr1 # do we need negotiation? |
1046 ret | 1133 ret |
1134mk_sdtr1_a: 1135 test NEEDSDTR_A,A jnz mk_sdtr1 # do we need negotiation? 1136 ret |
|
1047 1048mk_sdtr1: 1049 mvi DINDIR,1 # extended message 1050 mvi DINDIR,3 # extended message length = 3 1051 mvi DINDIR,1 # SDTR code 1052 mvi DINDIR,25 # REQ/ACK transfer period 1053 mvi DINDIR,15 # REQ/ACK offset 1054 --- 13 unchanged lines hidden --- | 1137 1138mk_sdtr1: 1139 mvi DINDIR,1 # extended message 1140 mvi DINDIR,3 # extended message length = 3 1141 mvi DINDIR,1 # SDTR code 1142 mvi DINDIR,25 # REQ/ACK transfer period 1143 mvi DINDIR,15 # REQ/ACK offset 1144 --- 13 unchanged lines hidden --- |