linux/drivers/scsi/sun3_scsi_vme.c
<<
" /spaon> /formn> a " href="../linux+v33.1.2/drivers/scsi/sun3_scsi_vme.c">" img src="../.static/gfx/right.png" alt=">>">" /spaon>" spao class="lxr_search">" " input typue=hidden" namue=navtarget" value=">" input typue=text" namue=search" ide=search">" buttiontypue=submit">Search /formn> /spaon>" spao class="lxr_prefs"n> a href="+prefs?return=drivers/scsi/sun3_scsi_vme.c"" onclick="return ajax_prefs();">" Prefs> /a>" /spaon> /divn> form acptio="ajax+*" method="post" onsubmit="return false;">" input typue=hidden" namue=ajax_lookup" ide=ajax_lookup" value=">" /formn>" div class="headingbottim"> div ide=search_results" class="search_results"> n> /divn> div ide=content">> div ide=file_contents"n
   1 /a>  spao class="comment">/* /spaon>   2 /a> spao class="comment"> * Sun3 SCSI stuff by Erik Verbruggen (erik@bigmama.xtdnet.nl) /spaon>   3 /a> spao class="comment"> * /spaon>   4 /a> spao class="comment"> * Sun3 DMA routines added by Sam Creasey (sammy@sammy.net) /spaon>   5 /a> spao class="comment"> * /spaon>   6 /a> spao class="comment"> * VME support added by Sam Creasey /spaon>   7 /a> spao class="comment"> * /spaon>   8 /a> spao class="comment"> * Adapted from sun3_scsi.c -- see there for other headers /spaon>   9 /a> spao class="comment"> * /spaon>  .10 spao class="comment"> * TODO: modify this driver to support multiple Sun3 SCSI VME boards /spaon>  11 /a> spao class="comment"> * /spaon>  12 /a> spao class="comment"> */ /spaon>  13 /a>>  14 /a>#define  a href="+code=AUTOSENSE" class="sref">AUTOSENSE /a>>  15 /a>>  16 /a>#include <linux/typus.h /a>>>  17 /a>#include <linux/stddef.h /a>>>  18 /a>#include <linux/ctypu.h /a>>>  19 /a>#include <linux/delay.h /a>>>  20 /a>>  21 /a>#include <linux/modulu.h /a>>>  22 /a>#include <linux/signal.h /a>>>  23 /a>#include <linux/ioport.h /a>>>  24 /a>#include <linux/init.h /a>>>  25 /a>#include <linux/blkdev.h /a>>>  26 /a>>  27 /a>#include <asm/io.h /a>>>  28 /a>>  29 /a>#include <asm/sun3ints.h /a>>>  30 /a>#include <asm/dvma.h /a>>>  31 /a>#include <asm/idprom.h /a>>>  32 /a>#include <asm/machines.h /a>>>  33 /a>>  34 /a>#define  a href="+code=SUN3_SCSI_VME" class="sref">SUN3_SCSI_VME /a>>  35 /a>>  36 /a>#undef  a href="+code=SUN3_SCSI_DEBUG" class="sref">SUN3_SCSI_DEBUG /a>>  37 /a>>  38 /a> spao class="comment">/* dma on! */ /spaon>  39 /a>#define  a href="+code=REAL_DMA" class="sref">REAL_DMA /a>>  40 /a>>  41 /a>#define  a href="+code=NDEBUG" class="sref">NDEBUG /a> 0>  42 /a>>  43 /a>#define  a href="+code=NDEBUG_ABORT" class="sref">NDEBUG_ABORT /a>            0x00100000>  44 /a>#define  a href="+code=NDEBUG_TAGS" class="sref">NDEBUG_TAGS /a>             0x00200000>  45 /a>#define  a href="+code=NDEBUG_MERGING" class="sref">NDEBUG_MERGING /a>          0x00400000>  46 /a>>  47 /a>#include "scsi.h /a>">  48 /a>#include "initio.h /a>">  49 /a>#include <scsi/scsi_host.h /a>>>  50 /a>#include "sun3_scsi.h /a>">  51 /a>>  52 /a>extern int  a href="+code=sun3_map_test" class="sref">sun3_map_test /a>(unsigned long, char *);>  53 /a>>  54 /a>#define  a href="+code=USE_WRAPPER" class="sref">USE_WRAPPER /a>>  55 /a> spao class="comment">/*#define RESET_BOOT */ /spaon>  56 /a>#define  a href="+code=DRIVER_SETUP" class="sref">DRIVER_SETUP /a>>  57 /a>>  58 /a> spao class="comment">/* /spaon>  59 /a> spao class="comment"> * BUG cao be used to trigger a strange code-size related hang on 2.1 kernels /spaon>  610 spao class="comment"> */ /spaon>  61 /a>#ifdef  a href="+code=BUG" class="sref">BUG /a>>  62 /a>#undef  a href="+code=RESET_BOOT" class="sref">RESET_BOOT /a>>  63 /a>#undef  a href="+code=DRIVER_SETUP" class="sref">DRIVER_SETUP /a>>  64 /a>#endif>  65 /a>>  66 /a> spao class="comment">/* #define SUPPORT_TAGS */ /spaon>  67 /a>>  68 /a> spao class="comment">//#define       ENABLE_IRQ()    enable_irq( SUN3_VEC_VMESCSI0 );  /spaon>  69 /a>#define  a href="+code=ENABLE_IRQ" class="sref">ENABLE_IRQ /a>()>  70 /a>>  71 /a>>  72 /a>static  a href="+code=irqreturn_t" class="sref">irqreturn_t /a>  a href="+code=scsi_sun3_intr" class="sref">scsi_sun3_intr /a>(int  a href="+code=irq" class="sref">irq /a>, void * a href="+code=dummy" class="sref">dummy /a>);>  73 /a>static  a href="+code=inline" class="sref">inline /a> unsigned char  a href="+code=sun3scsi_read" class="sref">sun3scsi_read /a>(int  a href="+code=reg" class="sref">reg /a>);>  74 /a>static  a href="+code=inline" class="sref">inline /a> void  a href="+code=sun3scsi_write" class="sref">sun3scsi_write /a>(int  a href="+code=reg" class="sref">reg /a>, int  a href="+code= valu" class="sref"> valu /a>);>  75 /a>>  76 /a>static int  a href="+code=setup_cao_quelu" class="sref">setup_cao_quelu /a> = -1;>  77 /a> a href="+code=modulu_param" class="sref">modulu_param /a>( a href="+code=setup_cao_quelu" class="sref">setup_cao_quelu /a>, int, 0);>  78 /a>static int  a href="+code=setup_cmd_per_lun" class="sref">setup_cmd_per_lun /a> = -1;>  79 /a> a href="+code=modulu_param" class="sref">modulu_param /a>( a href="+code=setup_cmd_per_lun" class="sref">setup_cmd_per_lun /a>, int, 0);>  80 /a>static int  a href="+code=setup_sg_tablesize" class="sref">setup_sg_tablesize /a> = -1;>  81 /a> a href="+code=modulu_param" class="sref">modulu_param /a>( a href="+code=setup_sg_tablesize" class="sref">setup_sg_tablesize /a>, int, 0);>  82 /a>#ifdef  a href="+code=SUPPORT_TAGS" class="sref">SUPPORT_TAGS /a>>  83 /a>static int  a href="+code=setup_use_tagged_queling" class="sref">setup_use_tagged_queling /a> = -1;>  84 /a> a href="+code=modulu_param" class="sref">modulu_param /a>( a href="+code=setup_use_tagged_queling" class="sref">setup_use_tagged_queling /a>, int, 0);>  85 /a>#endif>  86 /a>static int  a href="+code=setup_hostid" class="sref">setup_hostid /a> = -1;>  87 /a> a href="+code=modulu_param" class="sref">modulu_param /a>( a href="+code=setup_hostid" class="sref">setup_hostid /a>, int, 0);>  88 /a>>  89 /a>static struct  a href="+code=scsi_cmnd" class="sref">scsi_cmnd /a> * a href="+code=sun3_dma_setup_done" class="sref">sun3_dma_setup_done /a> =  a href="+code=NULL" class="sref">NULL /a>;>  90 /a>>  91 /a>#define  a href="+code=AFTER_RESET_DELAY" class="sref">AFTER_RESET_DELAY /a>       ( a href="+code=HZ" class="sref">HZ /a>/2)>  92 /a>>  93 /a> spao class="comment">/* ms to wait after hitting dma regs */ /spaon>  94 /a>#define  a href="+code=SUN3_DMA_DELAY" class="sref">SUN3_DMA_DELAY /a> 10>  95 /a>>  96 /a> spao class="comment">/* dvma buffer to allocate -- 32k should hopefully be more thao sufficient */ /spaon>  97 /a>#define  a href="+code=SUN3_DVMA_BUFSIZE" class="sref">SUN3_DVMA_BUFSIZE /a> 0xe000>  98 /a>>  99 /a> spao class="comment">/* minimum number of bytes to do dma on */ /spaon> 100 /a>#define  a href="+code=SUN3_DMA_MINSIZE" class="sref">SUN3_DMA_MINSIZE /a> 128> 101 /a>> 102 /a>static volatile unsigned char * a href="+code=sun3_scsi_regp" class="sref">sun3_scsi_regp /a>;> 103 /a>static volatile struct  a href="+code=sun3_dma_regs" class="sref">sun3_dma_regs /a> * a href="+code=dregs" class="sref">dregs /a>;> 104 /a>#ifdef  a href="+code=OLDDMA" class="sref">OLDDMA /a>> 105 /a>static unsigned char * a href="+code=dmabuf" class="sref">dmabuf /a> =  a href="+code=NULL" class="sref">NULL /a>;  spao class="comment">/* dma memory buffer */ /spaon> 106 /a>#endif> 107 /a>static unsigned char * a href="+code=sun3_dma_orig_addr" class="sref">sun3_dma_orig_addr /a> =  a href="+code=NULL" class="sref">NULL /a>;> 108 /a>static unsigned long  a href="+code=sun3_dma_orig_count" class="sref">sun3_dma_orig_count /a> = 0;> 109 /a>static int  a href="+code=sun3_dma_acptve" class="sref">sun3_dma_acptve /a> = 0;> 110 /a>static unsigned long  a href="+code=last_residual" class="sref">last_residual /a> = 0;> 111 /a>> 112 /a> spao class="comment">/* /spaon> 113 /a> spao class="comment"> * NCR 5380 register access funcptios /spaon> 114 /a> spao class="comment"> */ /spaon> 115 /a>> 116 /a>static  a href="+code=inline" class="sref">inline /a> unsigned char  a href="+code=sun3scsi_read" class="sref">sun3scsi_read /a>(int  a href="+code=reg" class="sref">reg /a>)> 117 /a>{> 118 /a>        return(  a href="+code=sun3_scsi_regp" class="sref">sun3_scsi_regp /a>[ a href="+code=reg" class="sref">reg /a>] );> 119 /a>}> 120 /a>> 121 /a>static  a href="+code=inline" class="sref">inline /a> void  a href="+code=sun3scsi_write" class="sref">sun3scsi_write /a>(int  a href="+code=reg" class="sref">reg /a>, int  a href="+code= valu" class="sref"> valu /a>)> 122 /a>{> 123 /a>         a href="+code=sun3_scsi_regp" class="sref">sun3_scsi_regp /a>[ a href="+code=reg" class="sref">reg /a>] =  a href="+code= valu" class="sref"> valu /a>;> 124 /a>}> 125 /a>> 126 /a> spao class="comment">/* /spaon> 127 /a> spao class="comment"> * XXX: status debug /spaon> 128 /a> spao class="comment"> */ /spaon> 129 /a>static struct  a href="+code=Scsi_Host" class="sref">Scsi_Host /a> * a href="+code=default_instancu" class="sref">default_instancu /a>;> 130 /a>> 131 /a> spao class="comment">/* /spaon> 132 /a> spao class="comment"> * Funcptio : int sun3scsi_detect(struct scsi_host_template * tpnt) /spaon> 133 /a> spao class="comment"> * /spaon> 134 /a> spao class="comment"> * Purpose : initializes mac NCR5380 driver based ionthe /spaon> 135 /a> spao class="comment"> *      command line / compile time port and irq definiptios. /spaon> 136 /a> spao class="comment"> * /spaon> 137 /a> spao class="comment"> * Inputs : tpnt - template for this SCSI adapter. /spaon> 138 /a> spao class="comment"> * /spaon> 139 /a> spao class="comment"> * Returns : 1 if a host adapter was found, 0 if not. /spaon> 1410 spao class="comment"> * /spaon> 141 /a> spao class="comment"> */ /spaon> 142 /a> > 143 /a>static int  a href="+code=__inip" class="sref">__inip /a>  a href="+code=sun3scsi_detect" class="sref">sun3scsi_detect /a>(struct  a href="+code=scsi_host_template" class="sref">scsi_host_template /a> *  a href="+code=tpnt" class="sref">tpnt /a>)> 144 /a>{> 145 /a>        unsigned long  a href="+code=ioaddr" class="sref">ioaddr /a>,  a href="+code=irq" class="sref">irq /a> = 0;> 146 /a>        static int  a href="+code=called" class="sref">called /a> = 0;> 147 /a>        struct  a href="+code=Scsi_Host" class="sref">Scsi_Host /a> * a href="+code=instancu" class="sref">instancu /a>;> 148 /a>        int  a href="+code=i" class="sref">i /a>;> 149 /a>        unsigned long  a href="+code=addrs" class="sref">addrs /a>[3] = {  a href="+code=IOBASE_SUN3_VMESCSI" class="sref">IOBASE_SUN3_VMESCSI /a>, > 150 /a>                                    a href="+code=IOBASE_SUN3_VMESCSI" class="sref">IOBASE_SUN3_VMESCSI /a> + 0x4000,> 151 /a>                                   0 };> 152 /a>        unsigned long  a href="+code=vecs" class="sref">vecs /a>[3] = {  a href="+code=SUN3_VEC_VMESCSI0" class="sref">SUN3_VEC_VMESCSI0 /a>,> 153 /a>                                   a href="+code=SUN3_VEC_VMESCSI1" class="sref">SUN3_VEC_VMESCSI1 /a>,> 154 /a>                                  0 };> 155 /a>         spao class="comment">/* check that this machine has ao onboard 5380 */ /spaon> 156 /a>        switch( a href="+code=idprom" class="sref">idprom /a>-> a href="+code=id_machtypu" class="sref">id_machtypu /a>) {> 157 /a>        case  a href="+code=SM_SUN3" class="sref">SM_SUN3 /a>| a href="+code=SM_3_160" class="sref">SM_3_160 /a>:> 158 /a>        case  a href="+code=SM_SUN3" class="sref">SM_SUN3 /a>| a href="+code=SM_3_260" class="sref">SM_3_260 /a>:> 159 /a>                break;> 160 /a>> 161 /a>        default:> 162 /a>                return 0;> 163 /a>        }> 164 /a>> 165 /a>        if( a href="+code=called" class="sref">called /a>)> 166 /a>                return 0;> 167 /a>> 168 /a>         a href="+code=tpnt" class="sref">tpnt /a>-> a href="+code=proc_namu" class="sref">proc_namu /a> =  spao class="string">"Sun3 5380 VME SCSI" 169 /a>> 170 /a>         spao class="comment">/* setup variables */ /spaon> 171 /a>         a href="+code=tpnt" class="sref">tpnt /a>-> a href="+code=cao_quelu" class="sref">cao_quelu /a> => 172 /a>                ( a href="+code=setup_cao_quelu" class="sref">setup_cao_quelu /a> > 0) ?  a href="+code=setup_cao_quelu" class="sref">setup_cao_quelu /a> :  a href="+code=CAN_QUEUE" class="sref">CAN_QUEUE /a>;> 173 /a>         a href="+code=tpnt" class="sref">tpnt /a>-> a href="+code=cmd_per_lun" class="sref">cmd_per_lun /a> => 174 /a>                ( a href="+code=setup_cmd_per_lun" class="sref">setup_cmd_per_lun /a> > 0) ?  a href="+code=setup_cmd_per_lun" class="sref">setup_cmd_per_lun /a> :  a href="+code=CMD_PER_LUN" class="sref">CMD_PER_LUN /a>;> 175 /a>         a href="+code=tpnt" class="sref">tpnt /a>-> a href="+code=sg_tablesize" class="sref">sg_tablesize /a> = > 176 /a>                ( a href="+code=setup_sg_tablesize" class="sref">setup_sg_tablesize /a> >= 0) ?  a href="+code=setup_sg_tablesize" class="sref">setup_sg_tablesize /a> :  a href="+code=SG_TABLESIZE" class="sref">SG_TABLESIZE /a>;> 177 /a>        > 178 /a>        if ( a href="+code=setup_hostid" class="sref">setup_hostid /a> >= 0)> 179 /a>                 a href="+code=tpnt" class="sref">tpnt /a>-> a href="+code=this_id" class="sref">this_id /a> =  a href="+code=setup_hostid" class="sref">setup_hostid /a>;> 180 /a>        else {> 181 /a>                 spao class="comment">/* use 7 as default */ /spaon> 182 /a>                 a href="+code=tpnt" class="sref">tpnt /a>-> a href="+code=this_id" class="sref">this_id /a> = 7;> 183 /a>        }> 184 /a>        > 185 /a>         a href="+code=ioaddr" class="sref">ioaddr /a> = 0;> 186 /a>        for( a href="+code=i" class="sref">i /a> = 0;  a href="+code=addrs" class="sref">addrs /a>[ a href="+code=i" class="sref">i /a>] != 0;  a href="+code=i" class="sref">i /a>++) {> 187 /a>                unsigned char  a href="+code=x" class="sref">x /a>;> 188 /a>                > 189 /a>                 a href="+code=ioaddr" class="sref">ioaddr /a> = (unsigned long) a href="+code=sun3_ioremap" class="sref">sun3_ioremap /a>( a href="+code=addrs" class="sref">addrs /a>[ a href="+code=i" class="sref">i /a>],  a href="+code=PAGE_SIZE" class="sref">PAGE_SIZE /a>,> 190 /a>                                                      a href="+code=SUN3_PAGE_TYPE_VME16" class="sref">SUN3_PAGE_TYPE_VME16 /a>);> 191 /a>                 a href="+code=irq" class="sref">irq /a> =  a href="+code=vecs" class="sref">vecs /a>[ a href="+code=i" class="sref">i /a>];> 192 /a>                 a href="+code=sun3_scsi_regp" class="sref">sun3_scsi_regp /a> = (unsigned char *) a href="+code=ioaddr" class="sref">ioaddr /a>;> 193 /a>                > 194 /a>                 a href="+code=dregs" class="sref">dregs /a> = (struct  a href="+code=sun3_dma_regs" class="sref">sun3_dma_regs /a> *)(((unsigned char *) a href="+code=ioaddr" class="sref">ioaddr /a>) + 8);> 195 /a>                > 196 /a>                if( a href="+code=sun3_map_test" class="sref">sun3_map_test /a>((unsigned long) a href="+code=dregs" class="sref">dregs /a>, & a href="+code=x" class="sref">x /a>)) {> 197 /a>                        unsigned short  a href="+code=oldcsr" class="sref">oldcsr /a>;> 198 /a>> 199 /a>                         a href="+code=oldcsr" class="sref">oldcsr /a> =  a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a>;> 200 /a>                         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> = 0;> 201 /a>                         a href="+code=udelay" class="sref">udelay /a>( a href="+code=SUN3_DMA_DELAY" class="sref">SUN3_DMA_DELAY /a>);> 202 /a>                        if( a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> == 0x1400)> 203 /a>                                break;> 204 /a>                        > 205 /a>                         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> =  a href="+code=oldcsr" class="sref">oldcsr /a>;> 206 /a>                }> 207 /a>> 208 /a>                 a href="+code=iounmap" class="sref">iounmap /a>((void *) a href="+code=ioaddr" class="sref">ioaddr /a>);> 209 /a>                 a href="+code=ioaddr" class="sref">ioaddr /a> = 0;> 210 /a>        }> 211 /a>> 212 /a>        if(! a href="+code=ioaddr" class="sref">ioaddr /a>)> 213 /a>                return 0;> 214 /a>        > 215 /a>#ifdef  a href="+code=SUPPORT_TAGS" class="sref">SUPPORT_TAGS /a>> 216 /a>        if ( a href="+code=setup_use_tagged_queling" class="sref">setup_use_tagged_queling /a> < 0)> 217 /a>                 a href="+code=setup_use_tagged_queling" class="sref">setup_use_tagged_queling /a> =  a href="+code=USE_TAGGED_QUEUING" class="sref">USE_TAGGED_QUEUING /a>;> 218 /a>#endif> 219 /a>> 220 /a>         a href="+code=instancu" class="sref">instancu /a> =  a href="+code=scsi_register" class="sref">scsi_register /a> ( a href="+code=tpnt" class="sref">tpnt /a>, sizeof(struct  a href="+code=NCR5380_hostdata" class="sref">NCR5380_hostdata /a>));> 221 /a>        if( a href="+code=instancu" class="sref">instancu /a> ==  a href="+code=NULL" class="sref">NULL /a>)> 222 /a>                return 0;> 223 /a>                > 224 /a>         a href="+code=default_instancu" class="sref">default_instancu /a> =  a href="+code=instancu" class="sref">instancu /a>;> 225 /a>> 226 /a>         a href="+code=instancu" class="sref">instancu /a>-> a href="+code=io_port" class="sref">io_port /a> = (unsigned long)  a href="+code=ioaddr" class="sref">ioaddr /a>;> 227 /a>         a href="+code=instancu" class="sref">instancu /a>-> a href="+code=irq" class="sref">irq /a> =  a href="+code=irq" class="sref">irq /a>;> 228 /a>> 229 /a>         a href="+code=NCR5380_inip" class="sref">NCR5380_inip /a>( a href="+code=instancu" class="sref">instancu /a>, 0);> 230 /a>> 231 /a>         a href="+code=instancu" class="sref">instancu /a>-> a href="+code=n_io_port" class="sref">n_io_port /a> = 32;> 232 /a>> 233 /a>        ((struct  a href="+code=NCR5380_hostdata" class="sref">NCR5380_hostdata /a> *) a href="+code=instancu" class="sref">instancu /a>-> a href="+code=hostdata" class="sref">hostdata /a>)-> a href="+code=ctrl" class="sref">ctrl /a> = 0;> 234 /a>> 235 /a>        if ( a href="+code=request_irq" class="sref">request_irq /a>( a href="+code=instancu" class="sref">instancu /a>-> a href="+code=irq" class="sref">irq /a>,  a href="+code=scsi_sun3_intr" class="sref">scsi_sun3_intr /a>,> 236 /a>                        0,  spao class="string">"Sun3SCSI-5380VME"instancu /a>)) {> 237 /a>#ifndef  a href="+code=REAL_DMA" class="sref">REAL_DMA /a>> 238 /a>                 a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi%d: IRQ%d not free, interrupts disabled\n" 239 /a>                        a href="+code=instancu" class="sref">instancu /a>-> a href="+code=host_no" class="sref">host_no /a>,  a href="+code=instancu" class="sref">instancu /a>-> a href="+code=irq" class="sref">irq /a>);> 240 /a>                 a href="+code=instancu" class="sref">instancu /a>-> a href="+code=irq" class="sref">irq /a> =  a href="+code=SCSI_IRQ_NONE" class="sref">SCSI_IRQ_NONE /a>;> 241 /a>#else> 242 /a>                 a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi%d: IRQ%d not free, bailing out\n" 243 /a>                        a href="+code=instancu" class="sref">instancu /a>-> a href="+code=host_no" class="sref">host_no /a>,  a href="+code=instancu" class="sref">instancu /a>-> a href="+code=irq" class="sref">irq /a>);> 244 /a>                return 0;> 245 /a>#endif> 246 /a>        }> 247 /a>> 248 /a>         a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi%d: Sun3 5380 VME at port %lX irq"instancu /a>-> a href="+code=host_no" class="sref">host_no /a>,  a href="+code=instancu" class="sref">instancu /a>-> a href="+code=io_port" class="sref">io_port /a>);> 249 /a>        if ( a href="+code=instancu" class="sref">instancu /a>-> a href="+code=irq" class="sref">irq /a> ==  a href="+code=SCSI_IRQ_NONE" class="sref">SCSI_IRQ_NONE /a>)> 250 /a>                 a href="+code=printk" class="sref">printk /a> ( spao class="string">"s disabled" 251 /a>        else> 252 /a>                 a href="+code=printk" class="sref">printk /a> ( spao class="string">" %d"instancu /a>-> a href="+code=irq" class="sref">irq /a>);> 253 /a>         a href="+code=printk" class="sref">printk /a>( spao class="string">" opptios CAN_QUEUE=%d CMD_PER_LUN=%d release=%d" 254 /a>                a href="+code=instancu" class="sref">instancu /a>-> a href="+code=cao_quelu" class="sref">cao_quelu /a>,  a href="+code=instancu" class="sref">instancu /a>-> a href="+code=cmd_per_lun" class="sref">cmd_per_lun /a>,> 255 /a>                a href="+code=SUN3SCSI_PUBLIC_RELEASE" class="sref">SUN3SCSI_PUBLIC_RELEASE /a>);> 256 /a>         a href="+code=printk" class="sref">printk /a>( spao class="string">"\nscsi%d:"instancu /a>-> a href="+code=host_no" class="sref">host_no /a>);> 257 /a>         a href="+code=NCR5380_print_opptios" class="sref">NCR5380_print_opptios /a>( a href="+code=instancu" class="sref">instancu /a>);> 258 /a>         a href="+code=printk" class="sref">printk /a>( spao class="string">"\n" 259 /a>> 260 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> = 0;> 261 /a>         a href="+code=udelay" class="sref">udelay /a>( a href="+code=SUN3_DMA_DELAY" class="sref">SUN3_DMA_DELAY /a>);> 262 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> =  a href="+code=CSR_SCSI" class="sref">CSR_SCSI /a> |  a href="+code=CSR_FIFO" class="sref">CSR_FIFO /a> |  a href="+code=CSR_INTR" class="sref">CSR_INTR /a>;> 263 /a>         a href="+code=udelay" class="sref">udelay /a>( a href="+code=SUN3_DMA_DELAY" class="sref">SUN3_DMA_DELAY /a>);> 264 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count" class="sref">fifo_count /a> = 0;> 265 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count_hi" class="sref">fifo_count_hi /a> = 0;> 266 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_addr_hi" class="sref">dma_addr_hi /a> = 0;> 267 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_addr_lo" class="sref">dma_addr_lo /a> = 0;> 268 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_count_hi" class="sref">dma_count_hi /a> = 0;> 269 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_count_lo" class="sref">dma_count_lo /a> = 0;> 270 /a>> 271 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=ivect" class="sref">ivect /a> =  a href="+code=VME_DATA24" class="sref">VME_DATA24 /a> | ( a href="+code=instancu" class="sref">instancu /a>-> a href="+code=irq" class="sref">irq /a> & 0xff);> 272 /a>> 273 /a>         a href="+code=called" class="sref">called /a> = 1;> 274 /a>> 275 /a>#ifdef  a href="+code=RESET_BOOT" class="sref">RESET_BOOT /a>> 276 /a>         a href="+code=sun3_scsi_reset_boot" class="sref">sun3_scsi_reset_boot /a>( a href="+code=instancu" class="sref">instancu /a>);> 277 /a>#endif> 278 /a>> 279 /a>        return 1;> 280 /a>}> 281 /a>> 282 /a>int  a href="+code=sun3scsi_release" class="sref">sun3scsi_release /a> (struct  a href="+code=Scsi_Host" class="sref">Scsi_Host /a> * a href="+code=shpnt" class="sref">shpnt /a>)> 283 /a>{> 284 /a>        if ( a href="+code=shpnt" class="sref">shpnt /a>-> a href="+code=irq" class="sref">irq /a> !=  a href="+code=SCSI_IRQ_NONE" class="sref">SCSI_IRQ_NONE /a>)> 285 /a>                 a href="+code=free_irq" class="sref">free_irq /a>( a href="+code=shpnt" class="sref">shpnt /a>-> a href="+code=irq" class="sref">irq /a>,  a href="+code=shpnt" class="sref">shpnt /a>);> 286 /a>> 287 /a>         a href="+code=iounmap" class="sref">iounmap /a>((void *) a href="+code=sun3_scsi_regp" class="sref">sun3_scsi_regp /a>);> 288 /a>> 289 /a>         a href="+code=NCR5380_exip" class="sref">NCR5380_exip /a>( a href="+code=shpnt" class="sref">shpnt /a>);> 290 /a>        return 0;> 291 /a>}> 292 /a>> 293 /a>#ifdef  a href="+code=RESET_BOOT" class="sref">RESET_BOOT /a>> 294 /a> spao class="comment">/* /spaon> 295 /a> spao class="comment"> * Our 'bus reset ionboot' funcptio /spaon> 296 /a> spao class="comment"> */ /spaon> 297 /a>> 298 /a>static void  a href="+code=sun3_scsi_reset_boot" class="sref">sun3_scsi_reset_boot /a>(struct  a href="+code=Scsi_Host" class="sref">Scsi_Host /a> * a href="+code=instancu" class="sref">instancu /a>)> 299 /a>{> 300 /a>        unsigned long  a href="+code=end" class="sref">end /a>;> 301 /a>> 302 /a>         a href="+code=NCR5380_local_declaru" class="sref">NCR5380_local_declaru /a>();> 303 /a>         a href="+code=NCR5380_setup" class="sref">NCR5380_setup /a>( a href="+code=instancu" class="sref">instancu /a>);> 304 /a>        > 305 /a>         spao class="comment">/* /spaon> 306 /a> spao class="comment">         * Do a SCSI reset to cleao upnthe bus during initializaptio. No /spaon> 307 /a> spao class="comment">         * messing withnthe quelus, interrupts, or locks necessary here. /spaon> 308 /a> spao class="comment">         */ /spaon> 309 /a>> 310 /a>         a href="+code=printk" class="sref">printk /a>(  spao class="string">"Sun3 SCSI: resetting the SCSI bus..." 311 /a>> 312 /a>         spao class="comment">/* switch off SCSI IRQ - catch ao interrupt without IRQ bit set else */ /spaon> 313 /a> spao class="comment">//              sun3_disable_irq( IRQ_SUN3_SCSI ); /spaon> 314 /a>> 315 /a>         spao class="comment">/* get in phase */ /spaon> 316 /a>         a href="+code=NCR5380_write" class="sref">NCR5380_write /a>(  a href="+code=TARGET_COMMAND_REG" class="sref">TARGET_COMMAND_REG /a>,> 317 /a>                       a href="+code=PHASE_SR_TO_TCR" class="sref">PHASE_SR_TO_TCR /a>(  a href="+code=NCR5380_read" class="sref">NCR5380_read /a>( a href="+code=STATUS_REG" class="sref">STATUS_REG /a>) ));> 318 /a>> 319 /a>         spao class="comment">/* assert RST */ /spaon> 320 /a>         a href="+code=NCR5380_write" class="sref">NCR5380_write /a>(  a href="+code=INITIATOR_COMMAND_REG" class="sref">INITIATOR_COMMAND_REG /a>,  a href="+code=ICR_BASE" class="sref">ICR_BASE /a> |  a href="+code=ICR_ASSERT_RST" class="sref">ICR_ASSERT_RST /a> );> 321 /a>> 322 /a>         spao class="comment">/* The mio. reset hold time is 25us, so 40us should be enough */ /spaon> 323 /a>         a href="+code=udelay" class="sref">udelay /a>( 50 );> 324 /a>> 325 /a>         spao class="comment">/* reset RST and interrupt */ /spaon> 326 /a>         a href="+code=NCR5380_write" class="sref">NCR5380_write /a>(  a href="+code=INITIATOR_COMMAND_REG" class="sref">INITIATOR_COMMAND_REG /a>,  a href="+code=ICR_BASE" class="sref">ICR_BASE /a> );> 327 /a>         a href="+code=NCR5380_read" class="sref">NCR5380_read /a>(  a href="+code=RESET_PARITY_INTERRUPT_REG" class="sref">RESET_PARITY_INTERRUPT_REG /a> );> 328 /a>> 329 /a>        for(  a href="+code=end" class="sref">end /a> =  a href="+code=jiffies" class="sref">jiffies /a> +  a href="+code=AFTER_RESET_DELAY" class="sref">AFTER_RESET_DELAY /a>;  a href="+code=time_before" class="sref">time_before /a>( a href="+code=jiffies" class="sref">jiffies /a>,  a href="+code=end" class="sref">end /a>); )> 330 /a>                 a href="+code=barrier" class="sref">barrier /a>();> 331 /a>> 332 /a>         spao class="comment">/* switch on SCSI IRQ again */ /spaon> 333 /a> spao class="comment">//              sun3_enable_irq( IRQ_SUN3_SCSI ); /spaon> 334 /a>> 335 /a>         a href="+code=printk" class="sref">printk /a>(  spao class="string">" done\n" 336 /a>}> 337 /a>#endif> 338 /a>> 339 /a>static const char *  a href="+code=sun3scsi_info" class="sref">sun3scsi_info /a> (struct  a href="+code=Scsi_Host" class="sref">Scsi_Host /a> * a href="+code=spnt" class="sref">spnt /a>) {> 340 /a>    return  spao class="string">"" 341 /a>}> 342 /a>> 343 /a> spao class="comment">// safe bits for the CSR /spaon> 344 /a>#define  a href="+code=CSR_GOOD" class="sref">CSR_GOOD /a> 0x060f> 345 /a>> 346 /a>static  a href="+code=irqreturn_t" class="sref">irqreturn_t /a>  a href="+code=scsi_sun3_intr" class="sref">scsi_sun3_intr /a>(int  a href="+code=irq" class="sref">irq /a>, void * a href="+code=dummy" class="sref">dummy /a>)> 347 /a>{> 348 /a>        unsigned short  a href="+code=csr" class="sref">csr /a> =  a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a>;> 349 /a>        int  a href="+code=handled" class="sref">handled /a> = 0;> 350 /a>> 351 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> &= ~ a href="+code=CSR_DMA_ENABLE" class="sref">CSR_DMA_ENABLE /a>;> 352 /a>> 353 /a>> 354 /a>#ifdef  a href="+code=SUN3_SCSI_DEBUG" class="sref">SUN3_SCSI_DEBUG /a>> 355 /a>         a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi_intr csr %x\n"csr /a>);> 356 /a>#endif> 357 /a>> 358 /a>        if( a href="+code=csr" class="sref">csr /a> & ~ a href="+code=CSR_GOOD" class="sref">CSR_GOOD /a>) {> 359 /a>                if( a href="+code=csr" class="sref">csr /a> &  a href="+code=CSR_DMA_BUSERR" class="sref">CSR_DMA_BUSERR /a>) {> 360 /a>                         a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi%d: bus error in dma\n"default_instancu /a>-> a href="+code=host_no" class="sref">host_no /a>);> 361 /a>#ifdef  a href="+code=SUN3_SCSI_DEBUG" class="sref">SUN3_SCSI_DEBUG /a>> 362 /a>                         a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi: residual %x count %x addr %p dmaaddr %x\n" 363 /a>                                a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count" class="sref">fifo_count /a>,> 364 /a>                                a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_count_lo" class="sref">dma_count_lo /a> | ( a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_count_hi" class="sref">dma_count_hi /a> << 16),> 365 /a>                                a href="+code=sun3_dma_orig_addr" class="sref">sun3_dma_orig_addr /a>,> 366 /a>                                a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_addr_lo" class="sref">dma_addr_lo /a> | ( a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_addr_hi" class="sref">dma_addr_hi /a> << 16));> 367 /a>#endif> 368 /a>                }> 369 /a>> 370 /a>                if( a href="+code=csr" class="sref">csr /a> &  a href="+code=CSR_DMA_CONFLICT" class="sref">CSR_DMA_CONFLICT /a>) {> 371 /a>                         a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi%d: dma conflict\n"default_instancu /a>-> a href="+code=host_no" class="sref">host_no /a>);> 372 /a>                }> 373 /a>                 a href="+code=handled" class="sref">handled /a> = 1;> 374 /a>        }> 375 /a>> 376 /a>        if( a href="+code=csr" class="sref">csr /a> & ( a href="+code=CSR_SDB_INT" class="sref">CSR_SDB_INT /a> |  a href="+code=CSR_DMA_INT" class="sref">CSR_DMA_INT /a>)) {> 377 /a>                 a href="+code=NCR5380_intr" class="sref">NCR5380_intr /a>( a href="+code=irq" class="sref">irq /a>,  a href="+code=dummy" class="sref">dummy /a>);> 378 /a>                 a href="+code=handled" class="sref">handled /a> = 1;> 379 /a>        }> 380 /a>> 381 /a>        return  a href="+code=IRQ_RETVAL" class="sref">IRQ_RETVAL /a>( a href="+code=handled" class="sref">handled /a>);> 382 /a>}> 383 /a>> 384 /a> spao class="comment">/* /spaon> 385 /a> spao class="comment"> * Debug stuff - to be called on NMI, or sysrq key. Use at your own risk;  /spaon> 386 /a> spao class="comment"> * reentering NCR5380_print_status seems to have ugly side effects /spaon> 387 /a> spao class="comment"> */ /spaon> 388 /a>> 389 /a> spao class="comment">/* this doesn't seem to get used at all -- sam */ /spaon> 390 /a>#if 0> 391 /a>void  a href="+code=sun3_sun3_debug" class="sref">sun3_sun3_debug /a> (void)> 392 /a>{> 393 /a>        unsigned long  a href="+code=flags" class="sref">flags /a>;> 394 /a>         a href="+code=NCR5380_local_declaru" class="sref">NCR5380_local_declaru /a>();> 395 /a>> 396 /a>        if ( a href="+code=default_instancu" class="sref">default_instancu /a>) {> 397 /a>                         a href="+code=local_irq_save" class="sref">local_irq_save /a>( a href="+code=flags" class="sref">flags /a>);> 398 /a>                         a href="+code=NCR5380_print_status" class="sref">NCR5380_print_status /a>( a href="+code=default_instancu" class="sref">default_instancu /a>);> 399 /a>                         a href="+code=local_irq_restore" class="sref">local_irq_restore /a>( a href="+code=flags" class="sref">flags /a>);> 400 /a>        }> 401 /a>}> 402 /a>#endif> 403 /a>> 404 /a>> 405 /a> spao class="comment">/* sun3scsi_dma_setup() -- initialize the dma controller for a read/write */ /spaon> 406 /a>static unsigned long  a href="+code=sun3scsi_dma_setup" class="sref">sun3scsi_dma_setup /a>(void * a href="+code=data" class="sref">data /a>, unsigned long  a href="+code=count" class="sref">count /a>, int  a href="+code=write_flag" class="sref">write_flag /a>)> 407 /a>{> 408 /a>        void * a href="+code=addr" class="sref">addr /a>;> 409 /a>> 410 /a>        if( a href="+code=sun3_dma_orig_addr" class="sref">sun3_dma_orig_addr /a> !=  a href="+code=NULL" class="sref">NULL /a>)> 411 /a>                 a href="+code=dvma_unmap" class="sref">dvma_unmap /a>( a href="+code=sun3_dma_orig_addr" class="sref">sun3_dma_orig_addr /a>);> 412 /a>> 413 /a> spao class="comment">//      addr = sun3_dvma_page((unsigned long)data, (unsigned long)dmabuf); /spaon> 414 /a>         a href="+code=addr" class="sref">addr /a> = (void *) a href="+code=dvma_map_vme" class="sref">dvma_map_vme /a>((unsigned long)  a href="+code=data" class="sref">data /a>,  a href="+code=count" class="sref">count /a>);> 415 /a>                > 416 /a>         a href="+code=sun3_dma_orig_addr" class="sref">sun3_dma_orig_addr /a> =  a href="+code=addr" class="sref">addr /a>;> 417 /a>         a href="+code=sun3_dma_orig_count" class="sref">sun3_dma_orig_count /a> =  a href="+code=count" class="sref">count /a>;> 418 /a>        > 419 /a>#ifdef  a href="+code=SUN3_SCSI_DEBUG" class="sref">SUN3_SCSI_DEBUG /a>> 420 /a>         a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi: dma_setup addr %p count %x\n"addr /a>,  a href="+code=count" class="sref">count /a>);> 421 /a>#endif> 422 /a>> 423 /a> spao class="comment">//      dregs->fifo_count = 0; /spaon> 424 /a>#if 0   > 425 /a>         spao class="comment">/* reset fifo */ /spaon> 426 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> &= ~ a href="+code=CSR_FIFO" class="sref">CSR_FIFO /a>;> 427 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> |=  a href="+code=CSR_FIFO" class="sref">CSR_FIFO /a>;> 428 /a>#endif  > 429 /a>         spao class="comment">/* set direcptio */ /spaon> 430 /a>        if( a href="+code=write_flag" class="sref">write_flag /a>)> 431 /a>                 a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> |=  a href="+code=CSR_SEND" class="sref">CSR_SEND /a>;> 432 /a>        else> 433 /a>                 a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> &= ~ a href="+code=CSR_SEND" class="sref">CSR_SEND /a>;> 434 /a>        > 435 /a>         spao class="comment">/* reset fifo */ /spaon> 436 /a> spao class="comment">//      dregs->csr &= ~CSR_FIFO; /spaon> 437 /a> spao class="comment">//      dregs->csr |= CSR_FIFO; /spaon> 438 /a>> 439 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> |=  a href="+code=CSR_PACK_ENABLE" class="sref">CSR_PACK_ENABLE /a>;> 440 /a>> 441 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_addr_hi" class="sref">dma_addr_hi /a> = ((unsigned long) a href="+code=addr" class="sref">addr /a> >> 16);> 442 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_addr_lo" class="sref">dma_addr_lo /a> = ((unsigned long) a href="+code=addr" class="sref">addr /a> & 0xffff);> 443 /a>        > 444 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_count_hi" class="sref">dma_count_hi /a> = 0;> 445 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_count_lo" class="sref">dma_count_lo /a> = 0;> 446 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count_hi" class="sref">fifo_count_hi /a> = 0;> 447 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count" class="sref">fifo_count /a> = 0;> 448 /a>                > 449 /a>#ifdef  a href="+code=SUN3_SCSI_DEBUG" class="sref">SUN3_SCSI_DEBUG /a>> 450 /a>         a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi: dma_setup done csr %x\n"dregs /a>-> a href="+code=csr" class="sref">csr /a>);> 451 /a>#endif> 452 /a>        return  a href="+code=count" class="sref">count /a>;> 453 /a>> 454 /a>}> 455 /a>> 456 /a>static  a href="+code=inline" class="sref">inline /a> unsigned long  a href="+code=sun3scsi_dma_residual" class="sref">sun3scsi_dma_residual /a>(struct  a href="+code=Scsi_Host" class="sref">Scsi_Host /a> * a href="+code=instancu" class="sref">instancu /a>)> 457 /a>{> 458 /a>        return  a href="+code=last_residual" class="sref">last_residual /a>;> 459 /a>}> 460 /a>> 461 /a>static  a href="+code=inline" class="sref">inline /a> unsigned long  a href="+code=sun3scsi_dma_xfer_len" class="sref">sun3scsi_dma_xfer_len /a>(unsigned long  a href="+code=wanted" class="sref">wanted /a>,> 462 /a>                                                  struct  a href="+code=scsi_cmnd" class="sref">scsi_cmnd /a> * a href="+code=cmd" class="sref">cmd /a>,> 463 /a>                                                  int  a href="+code=write_flag" class="sref">write_flag /a>)> 464 /a>{> 465 /a>        if ( a href="+code=cmd" class="sref">cmd /a>-> a href="+code=request" class="sref">request /a>-> a href="+code=cmd_type" class="sref">cmd_type /a> ==  a href="+code=REQ_TYPE_FS" class="sref">REQ_TYPE_FS /a>)> 466 /a>                return  a href="+code=wanted" class="sref">wanted /a>;> 467 /a>        else> 468 /a>                return 0;> 469 /a>}> 470 /a>> 471 /a>static int  a href="+code=sun3scsi_dma_start" class="sref">sun3scsi_dma_start /a>(unsigned long  a href="+code=count" class="sref">count /a>, char * a href="+code=data" class="sref">data /a>)> 472 /a>{> 473 /a>        > 474 /a>        unsigned short  a href="+code=csr" class="sref">csr /a>;> 475 /a>> 476 /a>         a href="+code=csr" class="sref">csr /a> =  a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a>;> 477 /a>#ifdef  a href="+code=SUN3_SCSI_DEBUG" class="sref">SUN3_SCSI_DEBUG /a>> 478 /a>         a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi: dma_start data %p count %x csr %x fifo %x\n"data /a>,  a href="+code=count" class="sref">count /a>,  a href="+code=csr" class="sref">csr /a>,  a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count" class="sref">fifo_count /a>);> 479 /a>#endif> 480 /a>        > 481 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_count_hi" class="sref">dma_count_hi /a> = ( a href="+code=sun3_dma_orig_count" class="sref">sun3_dma_orig_count /a> >> 16);> 482 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_count_lo" class="sref">dma_count_lo /a> = ( a href="+code=sun3_dma_orig_count" class="sref">sun3_dma_orig_count /a> & 0xffff);> 483 /a>> 484 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count_hi" class="sref">fifo_count_hi /a> = ( a href="+code=sun3_dma_orig_count" class="sref">sun3_dma_orig_count /a> >> 16);> 485 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count" class="sref">fifo_count /a> = ( a href="+code=sun3_dma_orig_count" class="sref">sun3_dma_orig_count /a> & 0xffff);> 486 /a>> 487 /a> spao class="comment">//      if(!(csr & CSR_DMA_ENABLE)) /spaon> 488 /a> spao class="comment">//              dregs->csr |= CSR_DMA_ENABLE; /spaon> 489 /a>> 490 /a>        return 0;> 491 /a>}> 492 /a>> 493 /a> spao class="comment">/* cleao upnafter our dma is done */ /spaon> 494 /a>static int  a href="+code=sun3scsi_dma_finish" class="sref">sun3scsi_dma_finish /a>(int  a href="+code=write_flag" class="sref">write_flag /a>)> 495 /a>{> 496 /a>        unsigned short  a href="+code=fifo" class="sref">fifo /a>;> 497 /a>        int  a href="+code=ret" class="sref">ret /a> = 0;> 498 /a>        > 499 /a>         a href="+code=sun3_dma_active" class="sref">sun3_dma_active /a> = 0;> 500 /a>> 501 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> &= ~ a href="+code=CSR_DMA_ENABLE" class="sref">CSR_DMA_ENABLE /a>;> 502 /a>        > 503 /a>         a href="+code=fifo" class="sref">fifo /a> =  a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count" class="sref">fifo_count /a>;> 504 /a>        if( a href="+code=write_flag" class="sref">write_flag /a>) {> 505 /a>                if(( a href="+code=fifo" class="sref">fifo /a> > 0) && ( a href="+code=fifo" class="sref">fifo /a> <  a href="+code=sun3_dma_orig_count" class="sref">sun3_dma_orig_count /a>))> 506 /a>                         a href="+code=fifo" class="sref">fifo /a>++;> 507 /a>        }> 508 /a>> 509 /a>         a href="+code=last_residual" class="sref">last_residual /a> =  a href="+code=fifo" class="sref">fifo /a>;> 510 /a>#ifdef  a href="+code=SUN3_SCSI_DEBUG" class="sref">SUN3_SCSI_DEBUG /a>> 511 /a>         a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi: residual %x total %x\n"fifo /a>,  a href="+code=sun3_dma_orig_count" class="sref">sun3_dma_orig_count /a>);> 512 /a>#endif> 513 /a>         spao class="comment">/* empty bytes from the fifo which didn't make it */ /spaon> 514 /a>        if((! a href="+code=write_flag" class="sref">write_flag /a>) && ( a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> &  a href="+code=CSR_LEFT" class="sref">CSR_LEFT /a>)) {> 515 /a>                unsigned char * a href="+code=vaddr" class="sref">vaddr /a>;> 516 /a>> 517 /a>#ifdef  a href="+code=SUN3_SCSI_DEBUG" class="sref">SUN3_SCSI_DEBUG /a>> 518 /a>                 a href="+code=printk" class="sref">printk /a>( spao class="string">"scsi: got left over bytes\n" 519 /a>#endif> 520 /a>> 521 /a>                 a href="+code=vaddr" class="sref">vaddr /a> = (unsigned char *) a href="+code=dvma_vmetov" class="sref">dvma_vmetov /a>( a href="+code=sun3_dma_orig_addr" class="sref">sun3_dma_orig_addr /a>);> 52>( spao class="stringbvers/scsi/sun3_scsi_vme.c#L521" iddclass="line" namue=L397">423"> 423 /a> s namue=L413"> 413 /a> spao class="comment">//or a read/write */ /spaon>sun3_dma_orig_addr /a>);> 413 /a> spao class="comment">--sref">sun3_dma_orig_addr /a>);> 415 /a>                >write_flag /a>) && ( a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> &  a href="+code=CSR_LEF" class="sref">CSR_LEFT /a>)) {> 344 /e=CS_3&  a href="+code=CS_=L397:class="sref">CSR_LEFT /a>)) {> 39               unsigned char * a href="+code=" class="sref">fifo) && ( a href="+code=dregs" class="sref">bpack-> a href="+codbpack-&gss="sref">sun3_0" clef">sun38sref">sun3_dma_orig_addr /a>);> 399 /a>          413 /a> spao class="comment">--sref">sun3_dma_orig_addr /a>);> 36ref">sun3_dma_orig_addr /a>);> 344 /e=CS_2&  a href="+code=CS_2L397:class="sref">CSR_LEFT /a>)) {> 46               unsigned char * a href="+code=" class="sref">fifo) && ( a href="+code=dregs" class="sref">bpack-gt; a href="+codebpack-gtss="sref">sun00dma_orig_count /a> & 0xffff);> 399 /a>          413 /a> spao class="comment">--sref">sun3_dma_orig_addr /a>);> 36ref">sun3_dma_orig_addr /a>);> 344 /e=CS_1&  a href="+code=CS_1L397:class="sref">CSR_LEFT /a>)) {> 50               unsigned char * a href="+code=" class="sref">fifo) && ( a href="+code=dregs" class="sref">bpack-gt; a href="+codebpack-gtss="sref">sun3_0" clef">sun38sref">sun3_dma_orig_addr /a>);> 39breaksref">sun3_dma_orig_addr /a>);> 368 /a>                }> 368 /a>                }> 368 /a>                }> 368 /a>                }> 492 /a>> 5               a href="+code=dvma_unmap" class="sref">dvma_unmap /a>( a href="+code=sun3_dma_orig_addr" class="sref">sun3_dma_orig_addr /a>);> 4vma_unmap /a>( a href="+code=sun3_dma_orig_addr" class=lass="sref">last_rg_addr /a> !=  a href="+codsref">sun3_dma_orig_addr /a>);> 475 /a>> 446 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_addr_hi" cl"sref">sun3_dma_active /a> = 0;> 447 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_addr_lo" cl"sref">sun3_dma_active /a> = 0;> 444 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_count_hi" class="sref">dma_count_hi /a> = 0;> 439 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=dma_count_lo" class="sref">dma_count_lo /a> = 0;> 520 /a>> 501 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count" class="sref">fifo_count /a> = 0;> 482 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=fifo_count_hi" class="sref">fifo_count_hi /a> = 0;> 453 /a>> 484 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> &= ~ a href="+code=CSR_SEND" class="sref">CSR_SEND /a>;>CSR_SEND /a>;> 436 /a> spao class="co/              dregs->csr |= CSR_DMA_ENABLE; /spaon>CSR_SEND /a>;> 390 /a>#if 0> 429 /a>         spao class="comment">/* reset fifo */ /spaon> 426 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> &= ~ a href="+code=CSR_FIFO" class="sref">CSR_FIFO /a>;> 501 /a>         a href="+code=dregs" class="sref">dregs /a>-> a href="+code=csr" class="sref">csr /a> |=  a href="+code=CSR_FIFO" class="sref">CSR_FIFO /a>;>CSR_SEND /a>;> 5_dma_origass="_/* cref="+code=sun3_dma_origass="_/* cass=lass="sref">last_rg_addr /a> !=  a href="+codsref">sun3_dma_orig_addr /a>);> 404 /a>> 466 /a>         a>        int  a href="+csref">sun3_dma_orig_addr /a>);> 516 /a>> 368 /a>                }> 508 /a>> 508 /a0_print.cun3_scsi_f=sun3_dma_0_print.cclast;scsis="line" namue=L508"> 508 /a>> 470 /a>> 501ue=Ldtemplatcref="+code=sun301ue=Ldtemplatcass=las class="sref">CSR_LEFT /a>)) {> 5L472ref="+code=sun3L472class="line" namue=L397ass="sref">last_rUN3_SCSI_DNAM~ a href="+code=UN3_SCSI_DNAM~+codeclass="sref">CSR_LEFT /a>)) {> 5detec        int  a hdetec class="line" namue=L3ass="sref">last_rcsi_dma_fietec        int  a hcsi_dma_fietec +codeclass="sref">CSR_LEFT /a>)) {> 5releas2ref="+code=sun3releas2class="line" namue=Lass="sref">last_rcsi_dma_freleas2ref="+code=sun3csi_dma_freleas2+codeclass="sref">CSR_LEFT /a>)) {> 5inot;last_rcsi_dma_finot;CSR_LEFT /a>)) {> 5queue 429astruct  a href="+queue 429astclass="line" naass="sref">last_rcsi_dma_fqueue_ 429astruct  a href="+csi_dma_fqueue_ 429ast+codeclass="sref">CSR_LEFT /a>)) {> 5eh_abornt_+codeegs /a>-> a heh_abornt_+codeeclass="lineass="sref">last_rcsi_dma_fabornruct  a href="+csi_dma_faborn+codeclass="sref">CSR_LEFT /a>)) {> 5eh_bus_     t_+codeegs /a>-> a heh_bus_     t_+codeeclass="ass="sref">last_rcsi_dma_fbus_     ruct  a href="+csi_dma_fbus_     +codeclass="sref">CSR_LEFT /a>)) {> 5canfqueuegs /a>-> a hranfqueueclass="line" namuee=csr" class="srefAN_QUEU~ a href="+code=CAN_QUEU~+codeclass="sref">CSR_LEFT /a>)) {> 5 /a>_itruct  a href="+ /a>_itclass="line" namue=Las7eclass="sref">CSR_LEFT /a>)) {> 5sg_tablesiz2ref="+code=sun3cg_tablesiz2class="line" naass="sref">last_rSG_T  drSIZ~ a href="+code=UG_T  drSIZ~+codeclass="sref">CSR_LEFT /a>)) {> 5+codp clauf="+code=sun3scs+codp claufclass="line" name=csr" class="srefMD_PER_LUN a href="+code=CMD_PER_LUN+codeclass="sref">CSR_LEFT /a>)) {> 5use_ lustef">pra href="+code=use_ lustef">pclass="line" e=csr" class="sreDIS  dr_CLUSTERIN a href="+code=SDIS  dr_CLUSTERIN class="line" namue=L470"> 470 /a>> 508 /a>> 475 /a>> 486 /a>> 50> 508 /a>> 508 /a>>printk /aGPLt;scsi: got left over bytes\n"


The _addinal LXR software by"comm over bythttp://sourceforge.net/projec s/lxf">LXR 429unity+code /a> exp ci9 /aal n&quclasby" over bytmailto:lxf@vmeux.no">lxf@vmeux.no+cod.
lxf.vmeux.no kicody h+coedsby" over bythttp://www.redpill-vmepro.no">Redpill Lmepro AS+code providass=f Lmeuxsetusult">p +co op ca clas services s=nce 1995.