linux/drivers/scsi/a3000.c
<<
>>
Prefs
   1#include <linux/types.h>
   2#include <linux/mm.h>
   3#include <linux/ioport.h>
   4#include <linux/init.h>
   5#include <linux/slab.h>
   6#include <linux/spinlock.h>
   7#include <linux/interrupt.h>
   8#include <linux/platform_device.h>
   9#include <linux/module.h>
  10
  11#include <asm/page.h>
  12#include <asm/pgtable.h>
  13#include <asm/amigaints.h>
  14#include <asm/amigahw.h>
  15
  16#include "scsi.h"
  17#include "wd33c93.h"
  18#include "a3000.h"
  19
  20
  21struct a3000_hostdata {
  22        struct WD33C93_hostdata wh;
  23        struct a3000_scsiregs *regs;
  24};
  25
  26static irqreturn_t a3000_intr(int irq, void *data)
  27{
  28        struct Scsi_Host *instance = data;
  29        struct a3000_hostdata *hdata = shost_priv(instance);
  30        unsigned int status = hdata->regs->ISTR;
  31        unsigned long flags;
  32
  33        if (!(status & ISTR_INT_P))
  34                return IRQ_NONE;
  35        if (status & ISTR_INTS) {
  36                spin_lock_irqsave(instance->host_lock, flags);
  37                wd33c93_intr(instance);
  38                spin_unlock_irqrestore(instance->host_lock, flags);
  39                return IRQ_HANDLED;
  40        }
  41        pr_warning("Non-serviced A3000 SCSI-interrupt? ISTR = %02x\n", status);
  42        return IRQ_NONE;
  43}
  44
  45static int dma_setup(struct scsi_cmnd *cmd, int dir_in)
  46{
  47        struct Scsi_Host *instance = cmd->device->host;
  48        struct a3000_hostdata *hdata = shost_priv(instance);
  49        struct WD33C93_hostdata *wh = &hdata->wh;
  50        struct a3000_scsiregs *regs = hdata->regs;
  51        unsigned short cntr = CNTR_PDMD | CNTR_INTEN;
  52        unsigned long addr = virt_to_bus(cmd->SCp.ptr);
  53
  54        /*
  55         * if the physical address has the wrong alignment, or if
  56         * physical address is bad, or if it is a write and at the
  57         * end of a physical memory chunk, then allocate a bounce
  58         * buffer
  59         */
  60        if (addr & A3000_XFER_MASK) {
  61                wh->dma_bounce_len = (cmd->SCp.this_residual + 511) & ~0x1ff;
  62                wh->dma_bounce_buffer = kmalloc(wh->dma_bounce_len,
  63                                                GFP_KERNEL);
  64
  65                /* can't allocate memory; use PIO */
  66                if (!wh->dma_bounce_buffer) {
  67                        wh->dma_bounce_len = 0;
  68                        return 1;
  69                }
  70
  71                if (!dir_in) {
  72                        /* copy to bounce buffer for a write */
  7de/asm-mips/amigahw.h|includeCNTR_PDMD<5parc64/amigahw.h|id2mo37;02x\n"(cmd->SCp.dma_bounce_len,
  373">  7de/asm-mips/amigahw.h|ia> = (cmd->SCp.GFP_KERNEL);
  69                }
  70
  37           long addr = virt_to_bu if (!wh->dsref">GFP_KERNEL);
  19


  62          short cntr =DDIgt;CNTR_INTEN;
  53
  54        
virt_to_bu if (!wh-&gdirode=dma_bounce_buffdirdr" class="sref">addr< if (!CNTR_INTEN;
  70
virt_to_bu>->regs t;instanceCNTR_INTEN;
  70
       *">       e buffer for a write */
virt_to_bu>->regsinstance< long >
  70
dir_in) {
  7                     
  3sref">instancevirt_to_bu long (cmd->SCp.GFP_KERNEL);
dir_in) {
  36                    
  37          eachn_pusht virt_to_bu long (cmd->SCp.GFP_KERNEL);
  19
  41  mb  3e="                     
virt_to_bu>->regs  41  mb  3e="                     
  64
                }
  70
wh-&gsto href="+code=dma_setuto ss="sL47">  47        struct Scsi_Host *  50        struct scsi_cmndde=n href="+code=Scsie=n ptr"f">dma_bounce_len,
  333333        unsigned int 
dir_in) {
  22        struct a3000_hostdata *hdata = shost_priv(instance);
  23        struct WD33C93_hostdata *wh = &hdata->wh;
  22        struct a3000_scsiregs *regs = hdata->regs;
  15
  51        unsigned short cntr = regs;
  70
wh-&gdirode=dma_bounce_buffdirdr" afor a write */
  32          short cntr =DDIgt;CNTR_INTEN;
  70
virt_to_bu>->regs t;instanceCNTR_INTEN;
  41  mb  3e="                       is updoryd beforeanext llocate memory; use PIO */
  64
wh-&gdirode=dma_bounce_buffdirdr" ass="sref">dir_in) {
  37          >->regs  38          mb
  6whilao">  33        >->regs->status &FE_FLGt;
  333333  38          barri+code=dma_bounce_barri+css="s);for a write */
  61          mb  53
  54        ossiclao-servicedocate memory; use PIO */

  56
  57
virt_to_bu>->regs  19
  41  >->regsvirt_to_bumb  3e="                     
  53
  54        sophysCOa> OL bits (minue physdire 
virt_to_bu>->regs t;instance = CNTR_PDMD | CNTR_INTEN;
virt_to_bumb  3e="                       is updoryd beforeanext llocate memory; use PIO */
/* ,"6
status  if (!wh->dma_bounce_buffer) {
  36) {
  6L37">  36wh-&gdirode=dma_bounce_buffdirdr" css="sss="sref">status de=n href="+code=Scsie=n ptr"d_bounce_buffer) {
virt_to_bumcludecmd->SCp.status  if (!wh->f">dma_bounce_len,
  63                  0.c#L52" id="Lude=n href="+code=Scsie=n ptr" class="sref">cmd->SCp.GFP_KERNEL);
  373">  7dclass="sref">SCkfrea href="+code=inkfrea/a3000.c#L52" id="Lu if (!wh->dsref">GFP_KERNEL);
  673">  7dclass="sref">SC      wh->dma_bounce_bufferCNTR_INTEN;
  373">  7dclass="sref">SC      wh->dma_bounce_len = 0;
  3} elsess="sref">dir_in) {
  68   class="sref">SCkfrea href="+code=inkfrea/a3000.c#L52" id="Lu if (!wh->dsref">GFP_KERNEL);
  673">  7dclass="sref">SC      wh->dma_bounce_bufferCNTR_INTEN;
  333333  38                wh->dma_bounce_len = 0;
  69                }
  43}
  64
  45statisiregsbuual" e href="+code=Scssiregsbuual" e /a300"sref">dma_setup(struct scsi_cmnd *) {
  46{
  47        struct Scsi_Host *instance = cmd->device->host;
  70

  70

  57
  53
instance->GFP_KERNEL);
virt_to_bu _intr" _privl" e     GFP_KERNEL);
virt_to_buestore" class="href="+code=scsiqsave" class="/a3000.c#L52" id="Lue(instance->GFP_KERNEL);

  42        rSUCCES href="+code=ISTSUCCES st" class="sref">host;
  43}
  70
dma_setup(structt_loctemplata href="+code=intructt_loctemplataline"">  45statish" c_siregs" clctemplata href="+code=insh" c_siregs" clctemplataclass="" name="L46">  46{
SCmodula href="+code=inmodulaline" name="L37">  33="sref">instancef">dma_bounce_len,
SCd="L href="+code=ind="Lline" name="L37">  3333="             ing(dma_bounce_len,
SCproc_infoa>. ="sref">instance.f">dma_bounce_len,
SCproc_d="L href="+code=inproc_d="Lline" name="L37"> ="s            ing(dma_bounce_len,
SCqueue  57aa href="+code=scsqueue  57aa line" name="L37="sref">instancef">dma_bounce_len,
SCeh_abort_haa l+code=dma_bounce_eh_abort_haa l+cline" name=="sref">instancef">dma_bounce_len,
SCeh_buual" e _haa l+code=dma_bounce_eh_buual" e _haa l+cline" n="sref">instance< iregsbuual" e href="+code=Scssiregsbuual" e /a30f">dma_bounce_len,
SCeh__privl" e _haa l+code=dma_bounce_eh__privl" e _haa l+cline" ="sref">instancedma_bounce_len,
SCcan queue> * ="sref">instancedma_bounce_len,
SCsiduai href="+code=scssiduai line" name="L37">  3= 7f">dma_bounce_len,
SCsg_t clasiza href="+code=intg_t clasizaline" name="L37="sref">instancedma_bounce_len,
SCde=_per_lu="+code=dma_bounde=_per_lu=line" name="L37"="sref">instancedma_bounce_len,
SCusn_clustera href="+code=pr_wusn_clustera hline" name="L="sref">instance  70
  24};
  70
  45stati__ini       45statish" c_siregs" clcproba href="+code=insh" c_siregs" clcproba/a300"sref">dma_setup(splatass=_>->Scsi_Hostp>-&) {
  46{
  49        sl" ourt;Scsi_Hostl" host;
  50        struct Scsi_Host *host;
  45statierrocode=dma_bounce_errocclasclass="sref">host;
  23        struct a3000_scsiregs *regs;
  41  o_intr"  *line"">  45statiwd *regs;
  22        struct a3000_hostdata *regs;
  25
virt_to_bul" instance-&cmd"fref">status IORESOURCE_MEMGFP_KERNEL);
data)
  6L42">  -sref">instanceregs;
  19
               l"querivmem instancestatus l" ourt;_siza href="+code=inl" ourt;_siza/a3000.c#L52" id="Lul" (
  6L42">  -sref">instanceregs;
  32
  41   *instance = wh =sh" c_siregs" clctemplata href="+code=insh" c_siregs" clctemplataclasf">dma_bounce_len,
  373">  7ddddddddddddsizaof0"sref">dma_setup(struct GFP_KERNEL);
               v(  46{
  36          errocode=dma_bounce_errocclass="-sref">instanceregs;
  3goto"sref">host_lock = regs;
  19
virt_to_bue(instanceinstanceregs;
  70
virt_to_bu>->dL23">  23        struct         sZTWO_VADD t;instanceGFP_KERNEL);
  41  >->regsinstanceregs;
  64
virt_to_bu _ *SCSAS t;wh =>->regsregs;
virt_to_bu _ *SCSCa href="+code=CNTSCa /a30s="lass="sref">wh =>->regsregs;

virt_to_bu *hdata = shost_priv(instance);
virt_to_bu *hdata->SCdo_syn + 511) & ~0x1ff;
virt_to_bu *hdata->SCfaa href="+code=Scsfaa a" clas0> + 511) & ~0x1ff;
  41   *hdata->SCce_lm">S>Sa" class="sref">hdataregs;
virt_to_bu/a> = hdata->hdata< *regs;
  53
shost_priv(status  _ *status _setup" c>status _setuto href="+code=dma_setuto ss="fref">status stdata" FS_12_si/a3000.c#de=dmastdata" FS_12_siclass="sref">instance);
virt_to_buerrocode=dma_bounce_errocclass="               l"querivs="href="+code=scsl"querivs="ass="sref">shost_priQ_NOAMIGA_PORT href="+code=ISTQ_NOAMIGA_PORT a" cfref">status siregsihort status IRQF_SHARE href="+code=CNTIRQF_SHARE clasf">dma_bounce_len,
  373">  7dme="r            ing(virt_to_bue(instance);
virt_to_buerrocode=dma_bounce_errocclasafor a write */
  6goto"sref">host_lockregs;
  19
virt_to_bu>->regs t;instance = CNTR_PDMD | CNTR_INTEN;
  70
virt_to_buerrocode=dma_bounce_errocclass="               " clcadd_>->-&gass="sref">shost_priv(status NULhref="+code=GFP_NULhass=s="sref">instance);
virt_to_buerrocode=dma_bounce_errocclasafor a write */
  3goto"sref">host_lock->CNTR_INTEN;
  25
virt_to_buplatass=_ e _drva> = -&cmd"fref">status e(instance);
virt_to_bu" clcsdan >->-&gass="sref">shost_priv(instance);
  70
host_lock->  70
virt_to_bufreacs="href="+code=scsshost_priQ_NOAMIGA_PORT href="+code=ISTQ_NOAMIGA_PORT a" cfref">status v(instance);
host_lock  70
shost_priv(instance);
host_lock =   70
virt_to_bul"leasevmem instancestatus l" ourt;_siza href="+code=inl" ourt;_siza/a3000.c#L52" id="Lul" instance);
  42        rerrocode=dma_bounce_errocclasclass="sref">host;
                }
  19
  45stati__exi     status sh" c_siregs" clcremova href="+code=insh" c_siregs" clcremova/a300"sref">dma_setup(splatass=_>->Scsi_Hostp>-&) {
dir_in) {
  23        struct Scsi_Host *instance = -&cmd"s="sref">instance);
  23        struct a3000_hostdata *hdata = shost_priv(instance);
  22        sl" ourt;Scsi_Hostl" instance-&cmd"fref">status IORESOURCE_MEMGFP_KERNEL);
  25
virt_to_bu/a> = hdata->regs t; = 0;
-&gass="sref">shost_priv(instance);
virt_to_bufreacs="href="+code=scsshost_priQ_NOAMIGA_PORT href="+code=ISTQ_NOAMIGA_PORT a" cfref">status v(instance);
virt_to_butructt_locpugt;shost_priv(instance);
virt_to_bu>-leasevmem instancestatus l" ourt;_siza href="+code=inl" ourt;_siza/a3000.c#L52" id="Lul" instance);
  53
dma_setup(splatass=_>">  5  5line"ef">status sh" c_siregs" clc>">  5">  5class="s="sref">dir_in) {
SCremova href="+code=inremova/a30L="sref">instance<__exi _ href="+code=dma__exi _ /a3000.c#L52" id="Lush" c_siregs" clcremova href="+code=insh" c_siregs" clcremova/a30)f">dma_bounce_len,
SC>">  5  5class s="s="sref">dir_in) {
  3 class="sref">SCd="L href="+code=ind="Lline" n="s            ing(dma_bounce_len,
  6 class="sref">SCown 5instancef">dma_bounce_len,
dma_bounce_len,
  24};
  70
  45stati__ini       45statish" c_siregs" clcini     ) {
dir_in) {
  42        rplatass=_>">  5cproba href="+code=inplatass=_>">  5cproba/a300lass="sref">wh =sh" c_siregs" clc>">  5">  5clasf">dma_bounce_len,
wh =sh" c_siregs" clcproba href="+code=insh" c_siregs" clcproba/a30s="sref">instance);
                }
wh =modulacini     instance);
  70
  45stati__exi     status sh" c_siregs" clcexi     ) {
dir_in) {
  41  platass=_>">  5cun  5cunwh =sh" c_siregs" clc>">  5">  5class="sref">instance);
                }
host_lockmodulacexi     instance);
  64
host_lockMODULE_DESCRIPTIOhref="+code=CNTRMODULE_DESCRIPTIOh/a3000            ing(instance);
host_lockMODULE_LICENSE href="+code=inMODULE_LICENSE/a3000            ing(instance);
wh =MODULE_ALIA href="+code=ISTMODULE_ALIA /a3000            ing(instance);



The original LXR software by physsref">inshttp:// ourt;assge.net/projects/lxr >LXR 57uni ycmd"fritis xperi7insmailto:lxr@c#Lux.no">lxr@c#Lux.nocmd".
lxr.c#Lux.no kindly t_loyd byssref">inshttp://www.redpill-c#Lpro.no">Redpill L#Lpro A a" cfrprovider of L#Lux nsult oand opera