Deleted Added
full compact
aic7xxx.seq (9810) aic7xxx.seq (9917)
1##+M#########################################################################
2# Adaptec 274x/284x/294x device driver for Linux and FreeBSD.
3#
4# Copyright (c) 1994 John Aycock
5# The University of Calgary Department of Computer Science.
6# All rights reserved.
7#
8# Modifications/enhancements:

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

36# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37# SUCH DAMAGE.
38#
39# FreeBSD, Twin, Wide, 2 command per target support, tagged queuing and other
40# optimizations provided by Justin T. Gibbs (gibbs@FreeBSD.org)
41#
42##-M#########################################################################
43
1##+M#########################################################################
2# Adaptec 274x/284x/294x device driver for Linux and FreeBSD.
3#
4# Copyright (c) 1994 John Aycock
5# The University of Calgary Department of Computer Science.
6# All rights reserved.
7#
8# Modifications/enhancements:

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

36# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37# SUCH DAMAGE.
38#
39# FreeBSD, Twin, Wide, 2 command per target support, tagged queuing and other
40# optimizations provided by Justin T. Gibbs (gibbs@FreeBSD.org)
41#
42##-M#########################################################################
43
44VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 1.17 1995/07/04 20:58:57 gibbs Exp $"
44VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 1.18 1995/07/31 08:21:59 gibbs Exp $"
45
46SCBMASK = 0x1f
47
48SCSISEQ = 0x00
49ENRSELI = 0x10
50SXFRCTL0 = 0x01
51SXFRCTL1 = 0x02
52SCSISIGI = 0x03

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

263WAITING_SCBT = 0x58 # tail of list of SCBs awaiting
264 # selection
265SCB_LIST_NULL = 0xff
266
267
268# Poll QINCNT for work - the lower bits contain
269# the number of entries in the Queue In FIFO.
270#
45
46SCBMASK = 0x1f
47
48SCSISEQ = 0x00
49ENRSELI = 0x10
50SXFRCTL0 = 0x01
51SXFRCTL1 = 0x02
52SCSISIGI = 0x03

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

263WAITING_SCBT = 0x58 # tail of list of SCBs awaiting
264 # selection
265SCB_LIST_NULL = 0xff
266
267
268# Poll QINCNT for work - the lower bits contain
269# the number of entries in the Queue In FIFO.
270#
271start:
272 cmp WAITING_SCBH,SCB_LIST_NULL jne start_waiting
273poll_for_work:
274 test FLAGS,TWIN_BUS jz start2 # Are we a twin channel device?
275# For fairness, we check the other bus first, since we just finished a
276# transaction on the current channel.
277 xor SBLKCTL,0x08 # Toggle to the other bus
278 test SSTAT0,SELDI jnz reselect
271poll_for_work:
272 test FLAGS,TWIN_BUS jz start2 # Are we a twin channel device?
273# For fairness, we check the other bus first, since we just finished a
274# transaction on the current channel.
275 xor SBLKCTL,0x08 # Toggle to the other bus
276 test SSTAT0,SELDI jnz reselect
279 test SSTAT0,SELDO jnz select
280 xor SBLKCTL,0x08 # Toggle to the original bus
281start2:
282 test SSTAT0,SELDI jnz reselect
277 xor SBLKCTL,0x08 # Toggle to the original bus
278start2:
279 test SSTAT0,SELDI jnz reselect
283 test SSTAT0,SELDO jnz select
284 cmp WAITING_SCBH,SCB_LIST_NULL jne start_waiting
285 test QINCNT,SCBMASK jz poll_for_work
286
287# We have at least one queued SCB now and we don't have any
288# SCBs in the list of SCBs awaiting selection. Set the SCB
289# pointer from the FIFO so we see the right bank of SCB
290# registers, then set SCSI options and set the initiator and
291# target SCSI IDs.

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

383
384 test SCBARRAY+11,0xff jnz identify # 0 Length Command?
385
386# The kernel has sent us an SCB with no command attached. This implies
387# that the kernel wants to send a message of some sort to this target,
388# so we interrupt the driver, allow it to fill the message buffer, and
389# then go back into the arbitration loop
390 mvi INTSTAT,AWAITING_MSG
280 cmp WAITING_SCBH,SCB_LIST_NULL jne start_waiting
281 test QINCNT,SCBMASK jz poll_for_work
282
283# We have at least one queued SCB now and we don't have any
284# SCBs in the list of SCBs awaiting selection. Set the SCB
285# pointer from the FIFO so we see the right bank of SCB
286# registers, then set SCSI options and set the initiator and
287# target SCSI IDs.

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

379
380 test SCBARRAY+11,0xff jnz identify # 0 Length Command?
381
382# The kernel has sent us an SCB with no command attached. This implies
383# that the kernel wants to send a message of some sort to this target,
384# so we interrupt the driver, allow it to fill the message buffer, and
385# then go back into the arbitration loop
386 mvi INTSTAT,AWAITING_MSG
391 jmp poll_for_work
387 jmp wait_for_selection
392
393identify:
394 mov SCBARRAY+1 call disconnect # disconnect ok?
395
396 and SINDEX,0x7,SCBARRAY+1 # lun
397 or SINDEX,A # return value from disconnect
398 or SINDEX,0x80 call mk_mesg # IDENTIFY message
399

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

413
414 add MSG_LEN,-MSG_START+0,DINDEX # update message length
415
416mk_tag_done:
417
418 mov DINDEX call mk_dtr # build DTR message if needed
419
420!message:
388
389identify:
390 mov SCBARRAY+1 call disconnect # disconnect ok?
391
392 and SINDEX,0x7,SCBARRAY+1 # lun
393 or SINDEX,A # return value from disconnect
394 or SINDEX,0x80 call mk_mesg # IDENTIFY message
395

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

409
410 add MSG_LEN,-MSG_START+0,DINDEX # update message length
411
412mk_tag_done:
413
414 mov DINDEX call mk_dtr # build DTR message if needed
415
416!message:
421 jmp poll_for_work
417wait_for_selection:
418 test SSTAT0,SELDI jnz reselect
419 test SSTAT0,SELDO jnz select
420 jmp wait_for_selection
422
423# Reselection has been initiated by a target. Make a note that we've been
424# reselected, but haven't seen an IDENTIFY message from the target
425# yet.
426#
427reselect:
428 mov SELID call initialize_scsiid
429 and FLAGS,0x3f # reselected, no IDENTIFY

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

701clear_a:
702 xor ACTIVE_A,A
703
704 test SCBARRAY+11,0xff jnz complete # Immediate message complete
705# Pause the sequencer until the driver gets around to handling the command
706# complete. This is so that any action that might require carefull timing
707# with the completion of this command can occur.
708 mvi INTSTAT,IMMEDDONE
421
422# Reselection has been initiated by a target. Make a note that we've been
423# reselected, but haven't seen an IDENTIFY message from the target
424# yet.
425#
426reselect:
427 mov SELID call initialize_scsiid
428 and FLAGS,0x3f # reselected, no IDENTIFY

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

700clear_a:
701 xor ACTIVE_A,A
702
703 test SCBARRAY+11,0xff jnz complete # Immediate message complete
704# Pause the sequencer until the driver gets around to handling the command
705# complete. This is so that any action that might require carefull timing
706# with the completion of this command can occur.
707 mvi INTSTAT,IMMEDDONE
709 jmp start
708 jmp poll_for_work
710complete:
711 mov QOUTFIFO,SCBPTR
712 mvi INTSTAT,CMDCMPLT
713 jmp p_mesgin_done
714
715# If we have a residual count, interrupt and tell the host. Other
716# alternatives are to pause the sequencer on all command completes (yuck),
717# dma the resid directly to the host (slick, but a ton of instructions), or

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

878#
879p_busfree:
880 mvi CLRSINT1,0x40 # CLRATNO
881 clr SIGSTATE
882
883# if this is an immediate command, perform a psuedo command complete to
884# notify the driver.
885 test SCBARRAY+11,0xff jz status_ok
709complete:
710 mov QOUTFIFO,SCBPTR
711 mvi INTSTAT,CMDCMPLT
712 jmp p_mesgin_done
713
714# If we have a residual count, interrupt and tell the host. Other
715# alternatives are to pause the sequencer on all command completes (yuck),
716# dma the resid directly to the host (slick, but a ton of instructions), or

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

877#
878p_busfree:
879 mvi CLRSINT1,0x40 # CLRATNO
880 clr SIGSTATE
881
882# if this is an immediate command, perform a psuedo command complete to
883# notify the driver.
884 test SCBARRAY+11,0xff jz status_ok
886 jmp start
885 jmp poll_for_work
887
888# Instead of a generic bcopy routine that requires an argument, we unroll
889# the two cases that are actually used, and call them explicitly. This
890# not only reduces the overhead of doing a bcopy by 2/3rds, but ends up
891# saving space in the program since you don't have to put the argument
892# into the accumulator before the call. Both functions expect DINDEX to
893# contain the destination address and SINDEX to contain the source
894# address.

--- 405 unchanged lines hidden ---
886
887# Instead of a generic bcopy routine that requires an argument, we unroll
888# the two cases that are actually used, and call them explicitly. This
889# not only reduces the overhead of doing a bcopy by 2/3rds, but ends up
890# saving space in the program since you don't have to put the argument
891# into the accumulator before the call. Both functions expect DINDEX to
892# contain the destination address and SINDEX to contain the source
893# address.

--- 405 unchanged lines hidden ---