Deleted Added
full compact
aic7xxx.seq (5647) aic7xxx.seq (5775)
1# @(#)aic7xxx.seq 1.32 94/11/29 jda
2#
3# Adaptec 274x/284x/294x device driver for Linux and FreeBSD.
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

--- 7 unchanged lines hidden (view full) ---

16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19#
20
21# FreeBSD, Twin, Wide, 2 command per target support, and other optimizations
22# provided by Justin T. Gibbs (gibbs@FreeBSD.org)
23#
1# @(#)aic7xxx.seq 1.32 94/11/29 jda
2#
3# Adaptec 274x/284x/294x device driver for Linux and FreeBSD.
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

--- 7 unchanged lines hidden (view full) ---

16# You should have received a copy of the GNU General Public License
17# along with this program; if not, write to the Free Software
18# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19#
20
21# FreeBSD, Twin, Wide, 2 command per target support, and other optimizations
22# provided by Justin T. Gibbs (gibbs@FreeBSD.org)
23#
24# $Id$
24# $Id: aic7xxx.seq,v 1.5 1995/01/16 16:31:21 gibbs Exp $
25
26VERSION AIC7XXX_SEQ_VERSION 1.5
27
28SCBMASK = 0x1f
29
30SCSISEQ = 0x00
31SXFRCTL0 = 0x01
32SXFRCTL1 = 0x02

--- 164 unchanged lines hidden (view full) ---

197ACTIVE_A = 0x58
198ACTIVE_B = 0x59
199
200# Poll QINCNT for work - the lower bits contain
201# the number of entries in the Queue In FIFO.
202#
203start:
204 test FLAGS,SENSE jnz start_sense
25
26VERSION AIC7XXX_SEQ_VERSION 1.5
27
28SCBMASK = 0x1f
29
30SCSISEQ = 0x00
31SXFRCTL0 = 0x01
32SXFRCTL1 = 0x02

--- 164 unchanged lines hidden (view full) ---

197ACTIVE_A = 0x58
198ACTIVE_B = 0x59
199
200# Poll QINCNT for work - the lower bits contain
201# the number of entries in the Queue In FIFO.
202#
203start:
204 test FLAGS,SENSE jnz start_sense
205start_nosense:
205 test FLAGS,TWIN_BUS jz start2 # Are we a twin channel device?
206# For fairness, we check the other bus first, since we just finished a
207# transaction on the current channel.
208 xor SBLKCTL,0x08 # Toggle to the other bus
209 test SCSISIGI,0x4 jnz reselect # BSYI
210 xor SBLKCTL,0x08 # Toggle to the original bus
211start2:
212 test SCSISIGI,0x4 jnz reselect # BSYI
206 test FLAGS,TWIN_BUS jz start2 # Are we a twin channel device?
207# For fairness, we check the other bus first, since we just finished a
208# transaction on the current channel.
209 xor SBLKCTL,0x08 # Toggle to the other bus
210 test SCSISIGI,0x4 jnz reselect # BSYI
211 xor SBLKCTL,0x08 # Toggle to the original bus
212start2:
213 test SCSISIGI,0x4 jnz reselect # BSYI
213 test QINCNT,SCBMASK jz start
214 test QINCNT,SCBMASK jz start_nosense
214
215# We have at least one queued SCB now. Set the SCB pointer
216# from the FIFO so we see the right bank of SCB registers,
217# then set SCSI options and set the initiator and target
218# SCSI IDs.
219#
220 mov SCBPTR,QINFIFO
221
222# If the control byte of this SCB has the NEEDDMA flag set, we have
223# yet to DMA it from host memory
224
225test SCBARRAY+0,NEEDDMA jz test_busy
226 clr HCNT+2
227 clr HCNT+1
228 mvi HCNT+0,SCB_SIZEOF
229
215
216# We have at least one queued SCB now. Set the SCB pointer
217# from the FIFO so we see the right bank of SCB registers,
218# then set SCSI options and set the initiator and target
219# SCSI IDs.
220#
221 mov SCBPTR,QINFIFO
222
223# If the control byte of this SCB has the NEEDDMA flag set, we have
224# yet to DMA it from host memory
225
226test SCBARRAY+0,NEEDDMA jz test_busy
227 clr HCNT+2
228 clr HCNT+1
229 mvi HCNT+0,SCB_SIZEOF
230
230 mvi A,4
231 mvi DINDEX,HADDR
231 mvi DINDEX,HADDR
232 mvi SCBARRAY+26 call bcopy
232 mvi SCBARRAY+26 call bcopy_4
233
234 mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET
235
236# Wait for DMA from host memory to data FIFO to complete, then disable
237# DMA and wait for it to acknowledge that it's off.
238#
239scb_load1:
240 test DFSTATUS,0x8 jz scb_load1 # HDONE

--- 18 unchanged lines hidden (view full) ---

259 mov SCBARRAY+11, DFDAT
260 mov SCBARRAY+12, DFDAT
261 mov SCBARRAY+13, DFDAT
262 mov SCBARRAY+14, DFDAT
263 mov SCBARRAY+15, DFDAT
264 mov SCBARRAY+16, DFDAT
265 mov SCBARRAY+17, DFDAT
266 mov SCBARRAY+18, DFDAT
233
234 mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET
235
236# Wait for DMA from host memory to data FIFO to complete, then disable
237# DMA and wait for it to acknowledge that it's off.
238#
239scb_load1:
240 test DFSTATUS,0x8 jz scb_load1 # HDONE

--- 18 unchanged lines hidden (view full) ---

259 mov SCBARRAY+11, DFDAT
260 mov SCBARRAY+12, DFDAT
261 mov SCBARRAY+13, DFDAT
262 mov SCBARRAY+14, DFDAT
263 mov SCBARRAY+15, DFDAT
264 mov SCBARRAY+16, DFDAT
265 mov SCBARRAY+17, DFDAT
266 mov SCBARRAY+18, DFDAT
267 and SCBARRAY+0, 0xf7
268
269# See if there is not already an active SCB for this target. This code
270# locks out on a per target basis instead of target/lun. Although this
271# is not ideal for devices that have multiple luns active at the same
272# time, it is faster than looping through all SCB's looking for active
273# commands. It may be benificial to make findscb a more general procedure
274# to see if the added cost of the search is negligible. This code also
275# assumes that the kernel driver will clear the active flags on board

--- 11 unchanged lines hidden (view full) ---

287start_sense:
288# Clear the SENSE flag first, then do a normal start_scb
289 and FLAGS,0xef
290 jmp start_scb
291
292# Place the currently active back on the queue for later processing
293requeue:
294 mov QINFIFO, SCBPTR
267
268# See if there is not already an active SCB for this target. This code
269# locks out on a per target basis instead of target/lun. Although this
270# is not ideal for devices that have multiple luns active at the same
271# time, it is faster than looping through all SCB's looking for active
272# commands. It may be benificial to make findscb a more general procedure
273# to see if the added cost of the search is negligible. This code also
274# assumes that the kernel driver will clear the active flags on board

--- 11 unchanged lines hidden (view full) ---

286start_sense:
287# Clear the SENSE flag first, then do a normal start_scb
288 and FLAGS,0xef
289 jmp start_scb
290
291# Place the currently active back on the queue for later processing
292requeue:
293 mov QINFIFO, SCBPTR
295 jmp start
294 jmp start_nosense
296
297test_a:
298 test ACTIVE_A,A jnz requeue
299 or ACTIVE_A,A # Mark the current target as busy
300
301start_scb:
302 or SCBARRAY+0,NEEDDMA
303 and SINDEX,0x08,SCBARRAY+1

--- 107 unchanged lines hidden (view full) ---

411
412 mvi INTSTAT,BAD_PHASE # unknown - signal driver
413
414p_dataout:
415 mvi 0 call scsisig # !CDO|!IOO|!MSGO
416 call assert
417 call sg_load
418
295
296test_a:
297 test ACTIVE_A,A jnz requeue
298 or ACTIVE_A,A # Mark the current target as busy
299
300start_scb:
301 or SCBARRAY+0,NEEDDMA
302 and SINDEX,0x08,SCBARRAY+1

--- 107 unchanged lines hidden (view full) ---

410
411 mvi INTSTAT,BAD_PHASE # unknown - signal driver
412
413p_dataout:
414 mvi 0 call scsisig # !CDO|!IOO|!MSGO
415 call assert
416 call sg_load
417
419 mvi A,3
420 mvi DINDEX,HCNT
421 mvi SCBARRAY+23 call bcopy
418 mvi DINDEX,HADDR
419 mvi SCBARRAY+19 call bcopy_4
422
420
423 mvi A,3
421# mvi DINDEX,HCNT # implicit since HCNT is next to HADDR
422 mvi SCBARRAY+23 call bcopy_3
423
424 mvi DINDEX,STCNT
424 mvi DINDEX,STCNT
425 mvi SCBARRAY+23 call bcopy
425 mvi SCBARRAY+23 call bcopy_3
426
426
427 mvi A,4
428 mvi DINDEX,HADDR
429 mvi SCBARRAY+19 call bcopy
430
431 mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN|
432 # DIRECTION|FIFORESET
433
434# After a DMA finishes, save the final transfer pointer and count
435# back into the SCB, in case a device disconnects in the middle of
436# a transfer. Use SHADDR and STCNT instead of HADDR and HCNT, since
437# it's a reflection of how many bytes were transferred on the SCSI
438# (as opposed to the host) bus.
439#
427 mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN|
428 # DIRECTION|FIFORESET
429
430# After a DMA finishes, save the final transfer pointer and count
431# back into the SCB, in case a device disconnects in the middle of
432# a transfer. Use SHADDR and STCNT instead of HADDR and HCNT, since
433# it's a reflection of how many bytes were transferred on the SCSI
434# (as opposed to the host) bus.
435#
440 mvi A,3
441 mvi DINDEX,SCBARRAY+23
436 mvi DINDEX,SCBARRAY+23
442 mvi STCNT call bcopy
437 mvi STCNT call bcopy_3
443
438
444 mvi A,4
445 mvi DINDEX,SCBARRAY+19
439 mvi DINDEX,SCBARRAY+19
446 mvi SHADDR call bcopy
440 mvi SHADDR call bcopy_4
447
448 call sg_advance
449 mov SCBARRAY+18,SG_COUNT # residual S/G count
450
451 jmp ITloop
452
453p_datain:
454 mvi 0x40 call scsisig # !CDO|IOO|!MSGO
455 call assert
456 call sg_load
457
441
442 call sg_advance
443 mov SCBARRAY+18,SG_COUNT # residual S/G count
444
445 jmp ITloop
446
447p_datain:
448 mvi 0x40 call scsisig # !CDO|IOO|!MSGO
449 call assert
450 call sg_load
451
458 mvi A,3
459 mvi DINDEX,HCNT
460 mvi SCBARRAY+23 call bcopy
452 mvi DINDEX,HADDR
453 mvi SCBARRAY+19 call bcopy_4
461
454
462 mvi A,3
455# mvi DINDEX,HCNT # implicit since HCNT is next to HADDR
456 mvi SCBARRAY+23 call bcopy_3
457
463 mvi DINDEX,STCNT
458 mvi DINDEX,STCNT
464 mvi SCBARRAY+23 call bcopy
459 mvi SCBARRAY+23 call bcopy_3
465
460
466 mvi A,4
467 mvi DINDEX,HADDR
468 mvi SCBARRAY+19 call bcopy
469
470 mvi 0x39 call dma # SCSIEN|SDMAEN|HDMAEN|
471 # !DIRECTION|FIFORESET
461 mvi 0x39 call dma # SCSIEN|SDMAEN|HDMAEN|
462 # !DIRECTION|FIFORESET
472 mvi A,3
473 mvi DINDEX,SCBARRAY+23
463 mvi DINDEX,SCBARRAY+23
474 mvi STCNT call bcopy
464 mvi STCNT call bcopy_3
475
465
476 mvi A,4
477 mvi DINDEX,SCBARRAY+19
466 mvi DINDEX,SCBARRAY+19
478 mvi SHADDR call bcopy
467 mvi SHADDR call bcopy_4
479
480 call sg_advance
481 mov SCBARRAY+18,SG_COUNT # residual S/G count
482
483 jmp ITloop
484
485# Command phase. Set up the DMA registers and let 'er rip - the
486# two bytes after the SCB SCSI_cmd_length are zeroed by the driver,
487# so we can copy those three bytes directly into HCNT.
488#
489p_command:
490 mvi 0x80 call scsisig # CDO|!IOO|!MSGO
491 call assert
492
468
469 call sg_advance
470 mov SCBARRAY+18,SG_COUNT # residual S/G count
471
472 jmp ITloop
473
474# Command phase. Set up the DMA registers and let 'er rip - the
475# two bytes after the SCB SCSI_cmd_length are zeroed by the driver,
476# so we can copy those three bytes directly into HCNT.
477#
478p_command:
479 mvi 0x80 call scsisig # CDO|!IOO|!MSGO
480 call assert
481
493 mvi A,3
494 mvi DINDEX,HCNT
495 mvi SCBARRAY+11 call bcopy
482 mvi DINDEX,HADDR
483 mvi SCBARRAY+7 call bcopy_4
496
484
497 mvi A,3
485# mvi DINDEX,HCNT # implicit since HCNT is next to HADDR
486 mvi SCBARRAY+11 call bcopy_3
487
498 mvi DINDEX,STCNT
488 mvi DINDEX,STCNT
499 mvi SCBARRAY+11 call bcopy
489 mvi SCBARRAY+11 call bcopy_3
500
490
501 mvi A,4
502 mvi DINDEX,HADDR
503 mvi SCBARRAY+7 call bcopy
504
505 mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN|
506 # DIRECTION|FIFORESET
507 jmp ITloop
508
509# Status phase. Wait for the data byte to appear, then read it
510# and store it into the SCB.
511#
512p_status:

--- 260 unchanged lines hidden (view full) ---

773# driver if we aren't expecting this. For now, make sure that
774# ATN isn't being asserted and look for a new command.
775#
776p_busfree:
777 mvi CLRSINT1,0x40 # CLRATNO
778 clr SIGSTATE
779 jmp start
780
491 mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN|
492 # DIRECTION|FIFORESET
493 jmp ITloop
494
495# Status phase. Wait for the data byte to appear, then read it
496# and store it into the SCB.
497#
498p_status:

--- 260 unchanged lines hidden (view full) ---

759# driver if we aren't expecting this. For now, make sure that
760# ATN isn't being asserted and look for a new command.
761#
762p_busfree:
763 mvi CLRSINT1,0x40 # CLRATNO
764 clr SIGSTATE
765 jmp start
766
781# Bcopy: number of bytes to transfer should be in A, DINDEX should
782# contain the destination address, and SINDEX should contain the
783# source address. All input parameters are trashed on return.
784#
785bcopy:
767# Instead of a generic bcopy routine that requires an argument, we unroll
768# the two cases that are actually used, and call them explicitly. This
769# not only reduces the overhead of doing a bcopy by 2/3rds, but ends up
770# saving space in the program since you don't have to put the argument
771# into the accumulator before the call. Both functions expect DINDEX to
772# contain the destination address and SINDEX to contain the source
773# address.
774bcopy_3:
786 mov DINDIR,SINDIR
775 mov DINDIR,SINDIR
787 dec A
788 cmp ALLZEROS,A jne bcopy
789 ret
776 mov DINDIR,SINDIR
777 mov DINDIR,SINDIR ret
790
778
779bcopy_4:
780 mov DINDIR,SINDIR
781 mov DINDIR,SINDIR
782 mov DINDIR,SINDIR
783 mov DINDIR,SINDIR ret
784
785
791# Locking the driver out, build a one-byte message passed in SINDEX
792# if there is no active message already. SINDEX is returned intact.
793#
794mk_mesg:
795 mvi SEQCTL,0x50 # PAUSEDIS|FASTMODE
796 test FLAGS,ACTIVE_MSG jnz mk_mesg1 # active message?
797
798 or FLAGS,ACTIVE_MSG # if not, there is now
799 mvi MSG_LEN,1 # length = 1
800 mov MSG_START+0,SINDEX # 1-byte message
801
802mk_mesg1:
786# Locking the driver out, build a one-byte message passed in SINDEX
787# if there is no active message already. SINDEX is returned intact.
788#
789mk_mesg:
790 mvi SEQCTL,0x50 # PAUSEDIS|FASTMODE
791 test FLAGS,ACTIVE_MSG jnz mk_mesg1 # active message?
792
793 or FLAGS,ACTIVE_MSG # if not, there is now
794 mvi MSG_LEN,1 # length = 1
795 mov MSG_START+0,SINDEX # 1-byte message
796
797mk_mesg1:
803 mvi SEQCTL,0x10 # !PAUSEDIS|FASTMODE
804 ret
798 mvi SEQCTL,0x10 ret # !PAUSEDIS|FASTMODE
805
806# Input byte in Automatic PIO mode. The address to store the byte
807# in should be in SINDEX. DINDEX will be used by this routine.
808#
809inb:
810 test SSTAT0,0x2 jz inb # SPIORDY
811 mov DINDEX,SINDEX
812 call one_stcnt # xfer one byte

--- 95 unchanged lines hidden (view full) ---

908# the SCB's residual S/G count field after sg_advance is called. Make
909# sure that the DMA enables are actually off first lest we get an ILLSADDR.
910#
911dma5:
912 clr DFCNTRL # disable DMA
913dma6:
914 test DFCNTRL,0x38 jnz dma6 # SCSIENACK|SDMAENACK|HDMAENACK
915
799
800# Input byte in Automatic PIO mode. The address to store the byte
801# in should be in SINDEX. DINDEX will be used by this routine.
802#
803inb:
804 test SSTAT0,0x2 jz inb # SPIORDY
805 mov DINDEX,SINDEX
806 call one_stcnt # xfer one byte

--- 95 unchanged lines hidden (view full) ---

902# the SCB's residual S/G count field after sg_advance is called. Make
903# sure that the DMA enables are actually off first lest we get an ILLSADDR.
904#
905dma5:
906 clr DFCNTRL # disable DMA
907dma6:
908 test DFCNTRL,0x38 jnz dma6 # SCSIENACK|SDMAENACK|HDMAENACK
909
916 mvi A,3
917 mvi DINDEX,SCBARRAY+15
910 mvi DINDEX,SCBARRAY+15
918 mvi STCNT call bcopy
911 mvi STCNT call bcopy_3
919
920 ret
921
922# Common SCSI initialization for selection and reselection. Expects
923# the target SCSI ID to be in the upper four bits of SINDEX, and A's
924# contents are stomped on return.
925#
926initialize:
912
913 ret
914
915# Common SCSI initialization for selection and reselection. Expects
916# the target SCSI ID to be in the upper four bits of SINDEX, and A's
917# contents are stomped on return.
918#
919initialize:
927 and SCSIID,0xf0,SINDEX # target ID
928 test SBLKCTL,0x08 jnz initialize_b
929 mvi SINDEX,SCSICONF_A
930 test FLAGS,WIDE_BUS jnz initialize_wide
931 and A,0x7,SCSICONF_A # SCSI_ID_A[210]
932 jmp initialize_2
933initialize_b:
934 and A,0x7,SCSICONF_B # SCSI_ID_B[210]
935 mvi SCSICONF_B jmp initialize_2
920 and SINDEX,0xf0 # Get target ID
921 and A,0x0f,SCSIID
922 or SINDEX,A
923 mov SCSIID,SINDEX
936
924
937initialize_wide:
938 and A,0x0f,SCSICONF_B # SCSI_ID_B[210]
939
940initialize_2:
941 or SCSIID,A
942
943# Esundry initialization.
944#
945 clr DROPATN
946 clr SIGSTATE
947
925# Esundry initialization.
926#
927 clr DROPATN
928 clr SIGSTATE
929
948# Turn on Automatic PIO mode now, before we expect to see an REQ
930# Turn on Automatic PIO mode now, before we expect to see a REQ
949# from the target. It shouldn't hurt anything to leave it on. Set
950# CLRCHN here before the target has entered a data transfer mode -
951# with synchronous SCSI, if you do it later, you blow away some
952# data in the SCSI FIFO that the target has already sent to you.
953#
931# from the target. It shouldn't hurt anything to leave it on. Set
932# CLRCHN here before the target has entered a data transfer mode -
933# with synchronous SCSI, if you do it later, you blow away some
934# data in the SCSI FIFO that the target has already sent to you.
935#
954# DFON is a 7870 bit enabling digital filtering of REQ and ACK signals.
955#
956 mvi SXFRCTL0,0x8a # DFON|SPIOEN|CLRCHN
957
936 mvi SXFRCTL0,0x8a # DFON|SPIOEN|CLRCHN
937
958# Set SCSI bus parity checking and the selection timeout value,
959# and enable the hardware selection timer. Set the SELTO interrupt
960# to signal the driver.
961#
962# STPWEN is 7870-specific, enabling an external termination power source.
963#
964 and A,0x38,SINDIR # PARITY_ENB|SEL_TIM[10]
965 or SXFRCTL1,0x7,A # ENSTIMER|ACTBEGEB|STPWEN
966 mvi SIMODE1,0x84 # ENSELTIMO|ENSCSIPERR
967
968# Initialize scatter-gather pointers by setting up the working copy
969# in scratch RAM.
970#
971 call sg_scb2ram
972
973# Initialize SCSIRATE with the appropriate value for this target.
974#
975 call ndx_dtr
938# Initialize scatter-gather pointers by setting up the working copy
939# in scratch RAM.
940#
941 call sg_scb2ram
942
943# Initialize SCSIRATE with the appropriate value for this target.
944#
945 call ndx_dtr
976 mov SCSIRATE,SINDIR
977 ret
946 mov SCSIRATE,SINDIR ret
978
979# Assert that if we've been reselected, then we've seen an IDENTIFY
980# message.
981#
982assert:
983 test FLAGS,RESELECTED jz assert1 # reselected?
984 test FLAGS,IDENTIFY_SEEN jnz assert1 # seen IDENTIFY?
985

--- 59 unchanged lines hidden (view full) ---

1045 call scsisig
1046 ret
1047
1048# Make a working copy of the scatter-gather parameters in the SCB.
1049#
1050sg_scb2ram:
1051 mov SG_COUNT,SCBARRAY+2
1052
947
948# Assert that if we've been reselected, then we've seen an IDENTIFY
949# message.
950#
951assert:
952 test FLAGS,RESELECTED jz assert1 # reselected?
953 test FLAGS,IDENTIFY_SEEN jnz assert1 # seen IDENTIFY?
954

--- 59 unchanged lines hidden (view full) ---

1014 call scsisig
1015 ret
1016
1017# Make a working copy of the scatter-gather parameters in the SCB.
1018#
1019sg_scb2ram:
1020 mov SG_COUNT,SCBARRAY+2
1021
1053 mvi A,4
1054 mvi DINDEX,SG_NEXT
1022 mvi DINDEX,SG_NEXT
1055 mvi SCBARRAY+3 call bcopy
1023 mvi SCBARRAY+3 call bcopy_4
1056
1057 mvi SG_NOLOAD,0x80
1058 test SCBARRAY+0,0x10 jnz sg_scb2ram1 # don't reload s/g?
1059 clr SG_NOLOAD
1060
1061sg_scb2ram1:
1062 ret
1063
1064# Copying RAM values back to SCB, for Save Data Pointers message.
1065#
1066sg_ram2scb:
1067 mov SCBARRAY+2,SG_COUNT
1068
1024
1025 mvi SG_NOLOAD,0x80
1026 test SCBARRAY+0,0x10 jnz sg_scb2ram1 # don't reload s/g?
1027 clr SG_NOLOAD
1028
1029sg_scb2ram1:
1030 ret
1031
1032# Copying RAM values back to SCB, for Save Data Pointers message.
1033#
1034sg_ram2scb:
1035 mov SCBARRAY+2,SG_COUNT
1036
1069 mvi A,4
1070 mvi DINDEX,SCBARRAY+3
1037 mvi DINDEX,SCBARRAY+3
1071 mvi SG_NEXT call bcopy
1038 mvi SG_NEXT call bcopy_4
1072
1073 and SCBARRAY+0,0xef,SCBARRAY+0
1074 test SG_NOLOAD,0x80 jz sg_ram2scb1 # reload s/g?
1075 or SCBARRAY+0,SG_LOAD
1076
1077sg_ram2scb1:
1078 ret
1079

--- 6 unchanged lines hidden (view full) ---

1086sg_load:
1087 test SG_COUNT,0xff jz sg_load3 # SG being used?
1088 test SG_NOLOAD,0x80 jnz sg_load3 # don't reload s/g?
1089
1090 clr HCNT+2
1091 clr HCNT+1
1092 mvi HCNT+0,SG_SIZEOF
1093
1039
1040 and SCBARRAY+0,0xef,SCBARRAY+0
1041 test SG_NOLOAD,0x80 jz sg_ram2scb1 # reload s/g?
1042 or SCBARRAY+0,SG_LOAD
1043
1044sg_ram2scb1:
1045 ret
1046

--- 6 unchanged lines hidden (view full) ---

1053sg_load:
1054 test SG_COUNT,0xff jz sg_load3 # SG being used?
1055 test SG_NOLOAD,0x80 jnz sg_load3 # don't reload s/g?
1056
1057 clr HCNT+2
1058 clr HCNT+1
1059 mvi HCNT+0,SG_SIZEOF
1060
1094 mvi A,4
1095 mvi DINDEX,HADDR
1061 mvi DINDEX,HADDR
1096 mvi SG_NEXT call bcopy
1062 mvi SG_NEXT call bcopy_4
1097
1098 mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET
1099
1100# Wait for DMA from host memory to data FIFO to complete, then disable
1101# DMA and wait for it to acknowledge that it's off.
1102#
1103sg_load1:
1104 test DFSTATUS,0x8 jz sg_load1 # HDONE

--- 56 unchanged lines hidden (view full) ---

1161
1162 clr SG_NOLOAD # reload s/g next time
1163 dec SG_COUNT # one less segment to go
1164
1165 clr A # add sizeof(struct scatter)
1166 add SG_NEXT+0,SG_SIZEOF,SG_NEXT+0
1167 adc SG_NEXT+1,A,SG_NEXT+1
1168 adc SG_NEXT+2,A,SG_NEXT+2
1063
1064 mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET
1065
1066# Wait for DMA from host memory to data FIFO to complete, then disable
1067# DMA and wait for it to acknowledge that it's off.
1068#
1069sg_load1:
1070 test DFSTATUS,0x8 jz sg_load1 # HDONE

--- 56 unchanged lines hidden (view full) ---

1127
1128 clr SG_NOLOAD # reload s/g next time
1129 dec SG_COUNT # one less segment to go
1130
1131 clr A # add sizeof(struct scatter)
1132 add SG_NEXT+0,SG_SIZEOF,SG_NEXT+0
1133 adc SG_NEXT+1,A,SG_NEXT+1
1134 adc SG_NEXT+2,A,SG_NEXT+2
1169 adc SG_NEXT+3,A,SG_NEXT+3
1135 adc SG_NEXT+3,A,SG_NEXT+3 ret
1170
1136
1171 ret
1172
1173sg_advance1:
1174 mvi SG_NOLOAD,0x80 # don't reload s/g next time
1175sg_advance2:
1176 ret
1177
1178# Add the array base SYNCNEG to the target offset (the target address
1179# is in SCSIID), and return the result in SINDEX. The accumulator
1180# contains the 3->8 decoding of the target ID on return.

--- 23 unchanged lines hidden (view full) ---

1204mk_wdtr_16bit:
1205 mvi ARG_1,BUS_16_BIT
1206mk_wdtr:
1207 mvi DINDIR,1 # extended message
1208 mvi DINDIR,2 # extended message length = 2
1209 mvi DINDIR,3 # WDTR code
1210 mov DINDIR,ARG_1 # bus width
1211
1137sg_advance1:
1138 mvi SG_NOLOAD,0x80 # don't reload s/g next time
1139sg_advance2:
1140 ret
1141
1142# Add the array base SYNCNEG to the target offset (the target address
1143# is in SCSIID), and return the result in SINDEX. The accumulator
1144# contains the 3->8 decoding of the target ID on return.

--- 23 unchanged lines hidden (view full) ---

1168mk_wdtr_16bit:
1169 mvi ARG_1,BUS_16_BIT
1170mk_wdtr:
1171 mvi DINDIR,1 # extended message
1172 mvi DINDIR,2 # extended message length = 2
1173 mvi DINDIR,3 # WDTR code
1174 mov DINDIR,ARG_1 # bus width
1175
1212 add MSG_LEN,-MSG_START+0,DINDEX # update message length
1213 ret
1176 add MSG_LEN,-MSG_START+0,DINDEX ret # update message length
1214
1215mk_sdtr:
1216 mvi DINDIR,1 # extended message
1217 mvi DINDIR,3 # extended message length = 3
1218 mvi DINDIR,1 # SDTR code
1219 call sdtr_to_rate
1220 mov DINDIR,RETURN_1 # REQ/ACK transfer period
1221 and DINDIR,0xf,SINDIR # Sync Offset
1222
1177
1178mk_sdtr:
1179 mvi DINDIR,1 # extended message
1180 mvi DINDIR,3 # extended message length = 3
1181 mvi DINDIR,1 # SDTR code
1182 call sdtr_to_rate
1183 mov DINDIR,RETURN_1 # REQ/ACK transfer period
1184 and DINDIR,0xf,SINDIR # Sync Offset
1185
1223 add MSG_LEN,-MSG_START+0,DINDEX # update message length
1224 ret
1186 add MSG_LEN,-MSG_START+0,DINDEX ret # update message length
1225
1226# Tag Message if Tag enabled in SCB control block. Use SCBPTR as the tag
1227# value
1228
1229#mk_tag:
1230# test SCBARRAY+0,0x10 jz mk_tag_done # Tag Enabled?
1231# and A,0x03,SCBARRYA+0
1232# or A,0x20

--- 34 unchanged lines hidden ---
1187
1188# Tag Message if Tag enabled in SCB control block. Use SCBPTR as the tag
1189# value
1190
1191#mk_tag:
1192# test SCBARRAY+0,0x10 jz mk_tag_done # Tag Enabled?
1193# and A,0x03,SCBARRYA+0
1194# or A,0x20

--- 34 unchanged lines hidden ---