aic7xxx.seq (13690) | aic7xxx.seq (14449) |
---|---|
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.29 1996/01/11 06:17:46 gibbs Exp $" | 44VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 1.30 1996/01/29 03:12:02 gibbs Exp $" |
45 46#include "../../dev/aic7xxx/aic7xxx_reg.h" 47 48/* 49 * We can't just use ACCUM in the sequencer code because it 50 * must be treated specially by the assembler, and it currently 51 * looks for the symbol 'A'. This is the only register defined in 52 * the assembler's symbol space. --- 11 unchanged lines hidden (view full) --- 64 * use byte 27 of the SCB as a psuedo-next pointer and to thread a list 65 * of SCBs that are awaiting selection. Since 0-0xfe are valid SCB offsets, 66 * SCB_LIST_NULL is 0xff which is out of range. The kernel driver must 67 * add an entry to this list everytime a request sense occurs. The sequencer 68 * will automatically consume the entries. 69 */ 70 71/* | 45 46#include "../../dev/aic7xxx/aic7xxx_reg.h" 47 48/* 49 * We can't just use ACCUM in the sequencer code because it 50 * must be treated specially by the assembler, and it currently 51 * looks for the symbol 'A'. This is the only register defined in 52 * the assembler's symbol space. --- 11 unchanged lines hidden (view full) --- 64 * use byte 27 of the SCB as a psuedo-next pointer and to thread a list 65 * of SCBs that are awaiting selection. Since 0-0xfe are valid SCB offsets, 66 * SCB_LIST_NULL is 0xff which is out of range. The kernel driver must 67 * add an entry to this list everytime a request sense occurs. The sequencer 68 * will automatically consume the entries. 69 */ 70 71/* |
72 * Initialize any state valid during the idle loop here. This code is 73 * executed on startup and after every bus free. | 72 * We assume that the kernel driver may reset us at any time, even in the 73 * middle of a DMA, so clear DFCNTRL too. |
74 */ | 74 */ |
75reset: 76 clr DFCNTRL 77 clr SCSISIGO /* De-assert BSY */ 78/* 79 * We jump to start after every bus free. 80 */ |
|
75start: 76 mvi SCSISEQ,ENRSELI /* Always allow reselection */ 77poll_for_work: 78 /* 79 * Are we a twin channel device? 80 * For fairness, we check the other bus first, 81 * since we just finished a transaction on the 82 * current channel. --- 285 unchanged lines hidden (view full) --- 368 /* Turn off DMA preserving WIDEODD */ 369 and DFCNTRL,WIDEODD 370dma_finish2: 371 test DFCNTRL,HDMAENACK jnz dma_finish2 372 373/* 374 * Copy data from FIFO into SCB data pointer and data count. This assumes 375 * that the struct scatterlist has this structure (this and sizeof(struct | 81start: 82 mvi SCSISEQ,ENRSELI /* Always allow reselection */ 83poll_for_work: 84 /* 85 * Are we a twin channel device? 86 * For fairness, we check the other bus first, 87 * since we just finished a transaction on the 88 * current channel. --- 285 unchanged lines hidden (view full) --- 374 /* Turn off DMA preserving WIDEODD */ 375 and DFCNTRL,WIDEODD 376dma_finish2: 377 test DFCNTRL,HDMAENACK jnz dma_finish2 378 379/* 380 * Copy data from FIFO into SCB data pointer and data count. This assumes 381 * that the struct scatterlist has this structure (this and sizeof(struct |
376 * scatterlist) == 12 are asserted in aic7xxx.c): | 382 * scatterlist) == 12 are asserted in aic7xxx.c for the Linux driver): |
377 * 378 * struct scatterlist { 379 * char *address; four bytes, little-endian order 380 * ... four bytes, ignored 381 * unsigned short length; two bytes, little-endian order 382 * } 383 * 384 * | 383 * 384 * struct scatterlist { 385 * char *address; four bytes, little-endian order 386 * ... four bytes, ignored 387 * unsigned short length; two bytes, little-endian order 388 * } 389 * 390 * |
385 * Not in FreeBSD. the scatter list entry is only 8 bytes. | 391 * In FreeBSD, the scatter list entry is only 8 bytes. |
386 * 387 * struct ahc_dma_seg { 388 * physaddr addr; four bytes, little-endian order 389 * long len; four bytes, little endian order 390 * }; 391 */ 392 | 392 * 393 * struct ahc_dma_seg { 394 * physaddr addr; four bytes, little-endian order 395 * long len; four bytes, little endian order 396 * }; 397 */ 398 |
393/* 394 * For Linux, we must throw away four bytes since there is a 32bit gap 395 * in the middle of a struct scatterlist 396 */ 397#ifdef linux | |
398 mov HADDR0,DFDAT 399 mov HADDR1,DFDAT 400 mov HADDR2,DFDAT 401 mov HADDR3,DFDAT | 399 mov HADDR0,DFDAT 400 mov HADDR1,DFDAT 401 mov HADDR2,DFDAT 402 mov HADDR3,DFDAT |
403/* 404 * For Linux, we must throw away four bytes since there is a 32bit gap 405 * in the middle of a struct scatterlist. 406 */ 407#ifdef linux |
|
402 mov NONE,DFDAT 403 mov NONE,DFDAT 404 mov NONE,DFDAT 405 mov NONE,DFDAT | 408 mov NONE,DFDAT 409 mov NONE,DFDAT 410 mov NONE,DFDAT 411 mov NONE,DFDAT |
412#endif |
|
406 mov HCNT0,DFDAT 407 mov HCNT1,DFDAT 408 mov HCNT2,DFDAT | 413 mov HCNT0,DFDAT 414 mov HCNT1,DFDAT 415 mov HCNT2,DFDAT |
409#else 410/* 411 * For FreeBSD, just copy it wholesale 412 */ 413 mov HADDR0,DFDAT 414 mov HADDR1,DFDAT 415 mov HADDR2,DFDAT 416 mov HADDR3,DFDAT 417 mov HCNT0,DFDAT 418 mov HCNT1,DFDAT 419 mov HCNT2,DFDAT 420#endif | |
421 422/* Load STCNT as well. It is a mirror of HCNT */ 423 mov STCNT0,HCNT0 424 mov STCNT1,HCNT1 425 mov STCNT2,HCNT2 426 test SSTAT1,PHASEMIS jz data_phase_loop 427 428data_phase_finish: --- 353 unchanged lines hidden (view full) --- 782 783/* 784 * Bus free phase. It might be useful to interrupt the device 785 * driver if we aren't expecting this. For now, make sure that 786 * ATN isn't being asserted and look for a new command. 787 */ 788p_busfree: 789 mvi CLRSINT1,CLRATNO | 416 417/* Load STCNT as well. It is a mirror of HCNT */ 418 mov STCNT0,HCNT0 419 mov STCNT1,HCNT1 420 mov STCNT2,HCNT2 421 test SSTAT1,PHASEMIS jz data_phase_loop 422 423data_phase_finish: --- 353 unchanged lines hidden (view full) --- 777 778/* 779 * Bus free phase. It might be useful to interrupt the device 780 * driver if we aren't expecting this. For now, make sure that 781 * ATN isn't being asserted and look for a new command. 782 */ 783p_busfree: 784 mvi CLRSINT1,CLRATNO |
785 clr LASTPHASE |
|
790 791/* 792 * if this is an immediate command, perform a psuedo command complete to 793 * notify the driver. 794 */ 795 test SCB_CMDLEN,0xff jz status_ok 796 jmp start 797 | 786 787/* 788 * if this is an immediate command, perform a psuedo command complete to 789 * notify the driver. 790 */ 791 test SCB_CMDLEN,0xff jz status_ok 792 jmp start 793 |
798#if 0 | |
799/* | 794/* |
800 * Instead of a generic bcopy routine that requires an argument, we unroll 801 * the cases that are actually used, and call them explicitly. This 802 * not only reduces the overhead of doing a bcopy, but ends up saving space 803 * in the program since you don't have to put the argument into the accumulator 804 * before the call. Both functions expect DINDEX to contain the destination 805 * address and SINDEX to contain the source address. 806 */ 807bcopy_7: 808 mov DINDIR,SINDIR 809 mov DINDIR,SINDIR 810bcopy_5: 811 mov DINDIR,SINDIR 812bcopy_4: 813 mov DINDIR,SINDIR 814bcopy_3: 815 mov DINDIR,SINDIR 816 mov DINDIR,SINDIR 817 mov DINDIR,SINDIR ret 818#endif 819 820/* | |
821 * Locking the driver out, build a one-byte message passed in SINDEX 822 * if there is no active message already. SINDEX is returned intact. 823 */ 824mk_mesg: 825 mvi SEQCTL,0x50 /* PAUSEDIS|FASTMODE */ 826 test MSG_LEN,0xff jz mk_mesg1 /* Should always succeed */ 827 828 /* --- 257 unchanged lines hidden --- | 795 * Locking the driver out, build a one-byte message passed in SINDEX 796 * if there is no active message already. SINDEX is returned intact. 797 */ 798mk_mesg: 799 mvi SEQCTL,0x50 /* PAUSEDIS|FASTMODE */ 800 test MSG_LEN,0xff jz mk_mesg1 /* Should always succeed */ 801 802 /* --- 257 unchanged lines hidden --- |