5380 driver update from from osymh@gemini.oscs.montana.edu (Michael L. Hitch)
This commit is contained in:
parent
e846c118d8
commit
fb2022076c
@ -38,7 +38,7 @@
|
||||
* from: Utah $Hdr: machdep.c 1.63 91/04/24$
|
||||
*
|
||||
* @(#)machdep.c 7.16 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.27 1994/05/25 07:58:30 chopps Exp $
|
||||
* $Id: machdep.c,v 1.28 1994/05/29 04:49:51 chopps Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -1425,8 +1425,16 @@ intrhand(sr)
|
||||
if (wesc_dmaintr())
|
||||
goto intports_done;
|
||||
#endif
|
||||
#if (NOTGSC + NWSTSC + NIVSC) > 0
|
||||
if (sciintr())
|
||||
#if NWSTSC > 0
|
||||
if (wstsc_intr())
|
||||
goto intports_done;
|
||||
#endif
|
||||
#if NOTGSSC > 0
|
||||
if (otgssc_intr())
|
||||
goto intports_done;
|
||||
#endif
|
||||
#if NIVSC > 0
|
||||
if (ivsc_intr())
|
||||
goto intports_done;
|
||||
#endif
|
||||
#if NLE > 0
|
||||
|
@ -1,7 +1,7 @@
|
||||
#
|
||||
# GENERIC AMIGA
|
||||
#
|
||||
# $Id: GENERIC,v 1.12 1994/05/22 19:33:23 chopps Exp $
|
||||
# $Id: GENERIC,v 1.13 1994/05/29 04:50:03 chopps Exp $
|
||||
#
|
||||
# This configuration file contains all possible options
|
||||
#
|
||||
@ -29,10 +29,10 @@ gvpbus0 at ztwobus0
|
||||
gtsc0 at gvpbus0 # GVP series II scsi
|
||||
ahsc0 at mainbus0 # A3000 scsi
|
||||
atzsc0 at ztwobus0
|
||||
#wstsc0 at ztwobus0 # Wordsync II scsi
|
||||
#ivsc0 at ztwobus0 # IVS scsi
|
||||
#mlhsc0 at ztwobus0 # Hacker scsi
|
||||
#otgsc0 at ztwobus0 # 12 gauge scsi
|
||||
wstsc0 at ztwobus0 # Wordsync II scsi
|
||||
ivsc0 at ztwobus0 # IVS scsi
|
||||
mlhsc0 at ztwobus0 # Hacker scsi
|
||||
otgsc0 at ztwobus0 # 12 gauge scsi
|
||||
zssc0 at ztwobus0 # Zeus scsi
|
||||
mgnsc0 at ztwobus0 # Magnum scsi
|
||||
wesc0 at zthreebus0 # Warp Engine scsi
|
||||
@ -41,10 +41,10 @@ idesc0 at mainbus0 # A4000(A1200?) IDE
|
||||
scsibus0 at gtsc0
|
||||
scsibus1 at ahsc0
|
||||
scsibus2 at atzsc0
|
||||
#scsibus2 at wstsc0
|
||||
#scsibus3 at ivsc0
|
||||
#scsibus4 at mlhsc0
|
||||
#scsibus5 at otgsc0
|
||||
scsibus2 at wstsc0
|
||||
scsibus3 at ivsc0
|
||||
scsibus4 at mlhsc0
|
||||
scsibus5 at otgsc0
|
||||
scsibus6 at zssc0
|
||||
scsibus7 at mgnsc0
|
||||
scsibus8 at wesc0
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: files.amiga,v 1.7 1994/05/29 01:44:37 chopps Exp $
|
||||
# $Id: files.amiga,v 1.8 1994/05/29 04:50:04 chopps Exp $
|
||||
#
|
||||
|
||||
maxusers 2 8 64
|
||||
@ -116,7 +116,7 @@ file arch/amiga/dev/wesc.c wesc needs-flag
|
||||
|
||||
# ncr 5380 controllers
|
||||
define sci
|
||||
file arch/amiga/dev/ncrd.c sci
|
||||
file arch/amiga/dev/sci.c sci
|
||||
|
||||
# Supra Wordsync II
|
||||
device wstsc at ztwobus: scsi, sci
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: files.amiga.newconf,v 1.7 1994/05/29 01:44:37 chopps Exp $
|
||||
# $Id: files.amiga.newconf,v 1.8 1994/05/29 04:50:04 chopps Exp $
|
||||
#
|
||||
|
||||
maxusers 2 8 64
|
||||
@ -116,7 +116,7 @@ file arch/amiga/dev/wesc.c wesc needs-flag
|
||||
|
||||
# ncr 5380 controllers
|
||||
define sci
|
||||
file arch/amiga/dev/ncrd.c sci
|
||||
file arch/amiga/dev/sci.c sci
|
||||
|
||||
# Supra Wordsync II
|
||||
device wstsc at ztwobus: scsi, sci
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994 Michael L. Hitch
|
||||
* Copyright (c) 1982, 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -31,19 +32,205 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ivsdma.c
|
||||
* $Id: ivsc.c,v 1.1 1994/05/08 05:53:23 chopps Exp $
|
||||
* $Id: ivsc.c,v 1.2 1994/05/29 04:50:12 chopps Exp $
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <vm/vm.h> /* XXXX Kludge for IVS Vector - mlh */
|
||||
#include <scsi/scsi_all.h>
|
||||
#include <scsi/scsiconf.h>
|
||||
#include <amiga/amiga/custom.h>
|
||||
#include <amiga/amiga/device.h>
|
||||
#include <amiga/dev/scireg.h>
|
||||
#include <amiga/dev/scivar.h>
|
||||
#include <amiga/dev/ztwobusvar.h>
|
||||
|
||||
int ivscprint __P((void *auxp, char *));
|
||||
void ivscattach __P((struct device *, struct device *, void *));
|
||||
int ivscmatch __P((struct device *, struct cfdata *, void *));
|
||||
|
||||
int ivsc_intr __P((void));
|
||||
#ifdef notyet
|
||||
int ivsc_dma_xfer_in __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
int ivsc_dma_xfer_out __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
#endif
|
||||
|
||||
struct scsi_adapter ivsc_scsiswitch = {
|
||||
sci_scsicmd,
|
||||
sci_minphys,
|
||||
0, /* no lun support */
|
||||
0, /* no lun support */
|
||||
sci_adinfo,
|
||||
"ivsc",
|
||||
};
|
||||
|
||||
struct scsi_device ivsc_scsidev = {
|
||||
NULL, /* use default error handler */
|
||||
NULL, /* do not have a start functio */
|
||||
NULL, /* have no async handler */
|
||||
NULL, /* Use default done routine */
|
||||
"ivsc",
|
||||
0,
|
||||
};
|
||||
|
||||
#define QPRINTF
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int sci_debug;
|
||||
#endif
|
||||
|
||||
extern int sci_data_wait;
|
||||
|
||||
struct cfdriver ivsccd = {
|
||||
NULL, "ivsc", ivscmatch, ivscattach,
|
||||
DV_DULL, sizeof(struct sci_softc), NULL, 0 };
|
||||
|
||||
/*
|
||||
* dummy IVS 5380 DMA driver
|
||||
* if this is an IVS board
|
||||
*/
|
||||
int
|
||||
ivscmatch(pdp, cdp, auxp)
|
||||
struct device *pdp;
|
||||
struct cfdata *cdp;
|
||||
void *auxp;
|
||||
{
|
||||
struct ztwobus_args *zap;
|
||||
|
||||
#include "ivsscsi.h"
|
||||
zap = auxp;
|
||||
|
||||
#if NIVSSCSI > 0
|
||||
/*
|
||||
* Check manufacturer and product id.
|
||||
*/
|
||||
if (zap->manid != 2112 || /* If manufacturer is IVS */
|
||||
(zap->prodid != 52 && /* product = Trumpcard */
|
||||
zap->prodid != 243)) /* product = Vector SCSI */
|
||||
return(0); /* didn't match */
|
||||
if (zap->prodid == 243) {
|
||||
/*
|
||||
* XXXX Ouch! board addresss isn't Zorro II or Zorro III!
|
||||
* XXXX Kludge it up until I can do it better (MLH).
|
||||
*
|
||||
* XXXX pa 0x00f00000 shouldn't be used for anything
|
||||
*/
|
||||
if (pmap_extract(kernel_pmap, ztwomap(0x00f00000)) == 0x00f00000) {
|
||||
physaccess(ztwomap(0x00f00000),zap->pa,
|
||||
NBPG, PG_W|PG_CI);
|
||||
zap->va = ztwomap(0x00f00000) + ((int)zap->pa & PGOFSET);
|
||||
#ifdef DEBUG
|
||||
printf("IVS Vector: mapped to %x kva %x\n",
|
||||
ztwomap(0x00f00000), zap->va);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
printf("Unable to map IVS Vector SCSI\n");
|
||||
return (0);
|
||||
}
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
void
|
||||
ivsdmainit ()
|
||||
ivscattach(pdp, dp, auxp)
|
||||
struct device *pdp, *dp;
|
||||
void *auxp;
|
||||
{
|
||||
volatile u_char *rp;
|
||||
struct sci_softc *sc;
|
||||
struct ztwobus_args *zap;
|
||||
|
||||
zap = auxp;
|
||||
|
||||
sc = (struct sci_softc *)dp;
|
||||
rp = zap->va + 0x40;
|
||||
sc->sci_data = rp;
|
||||
sc->sci_odata = rp;
|
||||
sc->sci_icmd = rp + 2;
|
||||
sc->sci_mode = rp + 4;
|
||||
sc->sci_tcmd = rp + 6;
|
||||
sc->sci_bus_csr = rp + 8;
|
||||
sc->sci_sel_enb = rp + 8;
|
||||
sc->sci_csr = rp + 10;
|
||||
sc->sci_dma_send = rp + 10;
|
||||
sc->sci_idata = rp + 12;
|
||||
sc->sci_trecv = rp + 12;
|
||||
sc->sci_iack = rp + 14;
|
||||
sc->sci_irecv = rp + 14;
|
||||
|
||||
#ifdef notyet
|
||||
sc->dma_xfer_in = ivsc_dma_xfer_in;
|
||||
sc->dma_xfer_out = ivsc_dma_xfer_out;
|
||||
#endif
|
||||
|
||||
scireset(sc);
|
||||
|
||||
sc->sc_link.adapter_softc = sc;
|
||||
sc->sc_link.adapter_targ = 7;
|
||||
sc->sc_link.adapter = &ivsc_scsiswitch;
|
||||
sc->sc_link.device = &ivsc_scsidev;
|
||||
TAILQ_INIT(&sc->sc_xslist);
|
||||
|
||||
custom.intreq = INTF_PORTS;
|
||||
custom.intena = INTF_SETCLR | INTF_PORTS;
|
||||
|
||||
/*
|
||||
* attach all scsi units on us
|
||||
*/
|
||||
config_found(dp, &sc->sc_link, ivscprint);
|
||||
}
|
||||
|
||||
/*
|
||||
* print diag if pnp is NULL else just extra
|
||||
*/
|
||||
int
|
||||
ivscprint(auxp, pnp)
|
||||
void *auxp;
|
||||
char *pnp;
|
||||
{
|
||||
if (pnp == NULL)
|
||||
return(UNCONF);
|
||||
return(QUIET);
|
||||
}
|
||||
|
||||
#ifdef notyet
|
||||
int
|
||||
ivsc_dma_xfer_in (dev, len, buf, phase)
|
||||
struct sci_softc *dev;
|
||||
int len;
|
||||
register u_char *buf;
|
||||
int phase;
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
ivsc_dma_xfer_out (dev, len, buf, phase)
|
||||
struct sci_softc *dev;
|
||||
int len;
|
||||
register u_char *buf;
|
||||
int phase;
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
ivsc_intr()
|
||||
{
|
||||
struct sci_softc *dev;
|
||||
int i, found;
|
||||
u_char stat;
|
||||
|
||||
found = 0;
|
||||
for (i = 0; i < ivsccd.cd_ndevs; i++) {
|
||||
dev = ivsccd.cd_devs[i];
|
||||
if (dev == NULL)
|
||||
continue;
|
||||
if ((*dev->sci_csr & SCI_CSR_INT) == 0)
|
||||
continue;
|
||||
++found;
|
||||
stat = *dev->sci_iack;
|
||||
}
|
||||
return (found);
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994 Michael L. Hitch
|
||||
* Copyright (c) 1982, 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -30,47 +31,141 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)mlhdma.c
|
||||
* $Id: mlhsc.c,v 1.1 1994/05/08 05:53:28 chopps Exp $
|
||||
* @(#)dma.c
|
||||
* $Id: mlhsc.c,v 1.2 1994/05/29 04:50:16 chopps Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* dummy MLH 5380 DMA driver
|
||||
*/
|
||||
|
||||
#include "mlhscsi.h"
|
||||
|
||||
#if NMLHSCSI > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <amiga/dev/device.h>
|
||||
#include <amiga/dev/scivar.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <scsi/scsi_all.h>
|
||||
#include <scsi/scsiconf.h>
|
||||
#include <amiga/amiga/device.h>
|
||||
#include <amiga/dev/scireg.h>
|
||||
#include <amiga/dev/scivar.h>
|
||||
#include <amiga/dev/ztwobusvar.h>
|
||||
|
||||
int mlhscprint __P((void *auxp, char *));
|
||||
void mlhscattach __P((struct device *, struct device *, void *));
|
||||
int mlhscmatch __P((struct device *, struct cfdata *, void *));
|
||||
|
||||
int mlhsc_dma_xfer_in __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
int mlhsc_dma_xfer_out __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
|
||||
struct scsi_adapter mlhsc_scsiswitch = {
|
||||
sci_scsicmd,
|
||||
sci_minphys,
|
||||
0, /* no lun support */
|
||||
0, /* no lun support */
|
||||
sci_adinfo,
|
||||
"mlhsc",
|
||||
};
|
||||
|
||||
struct scsi_device mlhsc_scsidev = {
|
||||
NULL, /* use default error handler */
|
||||
NULL, /* do not have a start functio */
|
||||
NULL, /* have no async handler */
|
||||
NULL, /* Use default done routine */
|
||||
"mlhsc",
|
||||
0,
|
||||
};
|
||||
|
||||
#define QPRINTF
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int sci_debug;
|
||||
#endif
|
||||
#define HIST(h,w)
|
||||
|
||||
extern int sci_data_wait;
|
||||
|
||||
static int dma_xfer_in __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
static int dma_xfer_out __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
struct cfdriver mlhsccd = {
|
||||
NULL, "mlhsc", mlhscmatch, mlhscattach,
|
||||
DV_DULL, sizeof(struct sci_softc), NULL, 0 };
|
||||
|
||||
void
|
||||
mlhdmainit (dev)
|
||||
struct sci_softc *dev;
|
||||
/*
|
||||
* if we are my Hacker's SCSI board we are here.
|
||||
*/
|
||||
int
|
||||
mlhscmatch(pdp, cdp, auxp)
|
||||
struct device *pdp;
|
||||
struct cfdata *cdp;
|
||||
void *auxp;
|
||||
{
|
||||
dev->dma_xfer_in = dma_xfer_in;
|
||||
dev->dma_xfer_out = dma_xfer_out;
|
||||
struct ztwobus_args *zap;
|
||||
|
||||
zap = auxp;
|
||||
|
||||
/*
|
||||
* Check manufacturer and product id.
|
||||
*/
|
||||
if (zap->manid == 2011 && zap->prodid == 1)
|
||||
return(1);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int
|
||||
dma_xfer_in (dev, len, buf, phase)
|
||||
void
|
||||
mlhscattach(pdp, dp, auxp)
|
||||
struct device *pdp, *dp;
|
||||
void *auxp;
|
||||
{
|
||||
volatile u_char *rp;
|
||||
struct sci_softc *sc;
|
||||
struct ztwobus_args *zap;
|
||||
|
||||
zap = auxp;
|
||||
|
||||
sc = (struct sci_softc *)dp;
|
||||
rp = zap->va;
|
||||
sc->sci_data = rp + 1;
|
||||
sc->sci_odata = rp + 1;
|
||||
sc->sci_icmd = rp + 3;
|
||||
sc->sci_mode = rp + 5;
|
||||
sc->sci_tcmd = rp + 7;
|
||||
sc->sci_bus_csr = rp + 9;
|
||||
sc->sci_sel_enb = rp + 9;
|
||||
sc->sci_csr = rp + 11;
|
||||
sc->sci_dma_send = rp + 11;
|
||||
sc->sci_idata = rp + 13;
|
||||
sc->sci_trecv = rp + 13;
|
||||
sc->sci_iack = rp + 15;
|
||||
sc->sci_irecv = rp + 15;
|
||||
|
||||
sc->dma_xfer_in = mlhsc_dma_xfer_in;
|
||||
sc->dma_xfer_out = mlhsc_dma_xfer_out;
|
||||
|
||||
scireset(sc);
|
||||
|
||||
sc->sc_link.adapter_softc = sc;
|
||||
sc->sc_link.adapter_targ = 7;
|
||||
sc->sc_link.adapter = &mlhsc_scsiswitch;
|
||||
sc->sc_link.device = &mlhsc_scsidev;
|
||||
TAILQ_INIT(&sc->sc_xslist);
|
||||
|
||||
/*
|
||||
* attach all scsi units on us
|
||||
*/
|
||||
config_found(dp, &sc->sc_link, mlhscprint);
|
||||
}
|
||||
|
||||
/*
|
||||
* print diag if pnp is NULL else just extra
|
||||
*/
|
||||
int
|
||||
mlhscprint(auxp, pnp)
|
||||
void *auxp;
|
||||
char *pnp;
|
||||
{
|
||||
if (pnp == NULL)
|
||||
return(UNCONF);
|
||||
return(QUIET);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
mlhsc_dma_xfer_in (dev, len, buf, phase)
|
||||
struct sci_softc *dev;
|
||||
int len;
|
||||
register u_char *buf;
|
||||
@ -79,11 +174,7 @@ dma_xfer_in (dev, len, buf, phase)
|
||||
int wait = sci_data_wait;
|
||||
u_char csr;
|
||||
u_char *obp = buf;
|
||||
#if 1
|
||||
volatile register u_char *sci_dma = dev->sci_data + 16;
|
||||
#else
|
||||
volatile register u_char *sci_dma = dev->sci_data + 12;
|
||||
#endif
|
||||
volatile register u_char *sci_csr = dev->sci_csr;
|
||||
volatile register u_char *sci_icmd = dev->sci_icmd;
|
||||
|
||||
@ -107,140 +198,75 @@ dma_xfer_in (dev, len, buf, phase)
|
||||
printf("mlhdma_in fail: l%d i%x w%d\n",
|
||||
len, csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
*buf++ = *sci_dma; *buf++ = *sci_dma;
|
||||
len -= 128;
|
||||
}
|
||||
while (len > 0) {
|
||||
@ -255,7 +281,6 @@ dma_xfer_in (dev, len, buf, phase)
|
||||
printf("mlhdma_in fail: l%d i%x w%d\n",
|
||||
len, csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
@ -269,13 +294,12 @@ dma_xfer_in (dev, len, buf, phase)
|
||||
len, obp[0], obp[1], obp[2], obp[3], obp[4], obp[5],
|
||||
obp[6], obp[7], obp[8], obp[9]));
|
||||
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
dma_xfer_out (dev, len, buf, phase)
|
||||
int
|
||||
mlhsc_dma_xfer_out (dev, len, buf, phase)
|
||||
struct sci_softc *dev;
|
||||
int len;
|
||||
register u_char *buf;
|
||||
@ -312,76 +336,43 @@ dma_xfer_out (dev, len, buf, phase)
|
||||
printf("mlhdma_out fail: l%d i%x w%d\n",
|
||||
len, csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
*sci_dma = *buf++; *sci_dma = *buf++;
|
||||
len -= 64;
|
||||
}
|
||||
while (len > 0) {
|
||||
@ -396,7 +387,6 @@ dma_xfer_out (dev, len, buf, phase)
|
||||
printf("mlhdma_out fail: l%d i%x w%d\n",
|
||||
len, csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
@ -410,8 +400,6 @@ dma_xfer_out (dev, len, buf, phase)
|
||||
while ((*sci_csr & (SCI_CSR_DREQ|SCI_CSR_PHASE_MATCH)) ==
|
||||
SCI_CSR_PHASE_MATCH && --wait);
|
||||
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994 Michael L. Hitch
|
||||
* Copyright (c) 1982, 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -31,46 +32,140 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)csa12gdma.c
|
||||
* $Id: otgsc.c,v 1.1 1994/05/08 05:53:30 chopps Exp $
|
||||
* $Id: otgsc.c,v 1.2 1994/05/29 04:50:19 chopps Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* dummy CSA 12 Gauge 5380 DMA driver
|
||||
*/
|
||||
|
||||
#include "csa12gscsi.h"
|
||||
|
||||
#if NCSA12GSCSI > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <amiga/dev/device.h>
|
||||
#include <amiga/dev/scivar.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <scsi/scsi_all.h>
|
||||
#include <scsi/scsiconf.h>
|
||||
#include <amiga/amiga/device.h>
|
||||
#include <amiga/dev/scireg.h>
|
||||
#include <amiga/dev/scivar.h>
|
||||
#include <amiga/dev/ztwobusvar.h>
|
||||
|
||||
int otgscprint __P((void *auxp, char *));
|
||||
void otgscattach __P((struct device *, struct device *, void *));
|
||||
int otgscmatch __P((struct device *, struct cfdata *, void *));
|
||||
|
||||
int otgsc_dma_xfer_in __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
int otgsc_dma_xfer_out __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
|
||||
struct scsi_adapter otgsc_scsiswitch = {
|
||||
sci_scsicmd,
|
||||
sci_minphys,
|
||||
0, /* no lun support */
|
||||
0, /* no lun support */
|
||||
sci_adinfo,
|
||||
"otgsc",
|
||||
};
|
||||
|
||||
struct scsi_device otgsc_scsidev = {
|
||||
NULL, /* use default error handler */
|
||||
NULL, /* do not have a start functio */
|
||||
NULL, /* have no async handler */
|
||||
NULL, /* Use default done routine */
|
||||
"otgsc",
|
||||
0,
|
||||
};
|
||||
|
||||
#define QPRINTF
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int sci_debug;
|
||||
#endif
|
||||
#define HIST(h,w)
|
||||
|
||||
extern int sci_data_wait;
|
||||
|
||||
static int dma_xfer_in __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
static int dma_xfer_out __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
struct cfdriver otgsccd = {
|
||||
NULL, "otgsc", otgscmatch, otgscattach,
|
||||
DV_DULL, sizeof(struct sci_softc), NULL, 0 };
|
||||
|
||||
void
|
||||
csa12gdmainit (dev)
|
||||
struct sci_softc *dev;
|
||||
/*
|
||||
* if we are my Hacker's SCSI board we are here.
|
||||
*/
|
||||
int
|
||||
otgscmatch(pdp, cdp, auxp)
|
||||
struct device *pdp;
|
||||
struct cfdata *cdp;
|
||||
void *auxp;
|
||||
{
|
||||
dev->dma_xfer_in = dma_xfer_in;
|
||||
dev->dma_xfer_out = dma_xfer_out;
|
||||
struct ztwobus_args *zap;
|
||||
|
||||
zap = auxp;
|
||||
|
||||
/*
|
||||
* Check manufacturer and product id.
|
||||
*/
|
||||
if (zap->manid == 2011 && zap->prodid == 1)
|
||||
return(1);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int
|
||||
dma_xfer_in (dev, len, buf, phase)
|
||||
void
|
||||
otgscattach(pdp, dp, auxp)
|
||||
struct device *pdp, *dp;
|
||||
void *auxp;
|
||||
{
|
||||
volatile u_char *rp;
|
||||
struct sci_softc *sc;
|
||||
struct ztwobus_args *zap;
|
||||
|
||||
zap = auxp;
|
||||
|
||||
sc = (struct sci_softc *)dp;
|
||||
rp = zap->va + 0x2000;
|
||||
sc->sci_data = rp;
|
||||
sc->sci_odata = rp;
|
||||
sc->sci_icmd = rp + 0x10;
|
||||
sc->sci_mode = rp + 0x20;
|
||||
sc->sci_tcmd = rp + 0x30;
|
||||
sc->sci_bus_csr = rp + 0x40;
|
||||
sc->sci_sel_enb = rp + 0x40;
|
||||
sc->sci_csr = rp + 0x50;
|
||||
sc->sci_dma_send = rp + 0x50;
|
||||
sc->sci_idata = rp + 0x60;
|
||||
sc->sci_trecv = rp + 0x60;
|
||||
sc->sci_iack = rp + 0x70;
|
||||
sc->sci_irecv = rp + 0x70;
|
||||
|
||||
sc->dma_xfer_in = otgsc_dma_xfer_in;
|
||||
sc->dma_xfer_out = otgsc_dma_xfer_out;
|
||||
|
||||
scireset(sc);
|
||||
|
||||
sc->sc_link.adapter_softc = sc;
|
||||
sc->sc_link.adapter_targ = 7;
|
||||
sc->sc_link.adapter = &otgsc_scsiswitch;
|
||||
sc->sc_link.device = &otgsc_scsidev;
|
||||
TAILQ_INIT(&sc->sc_xslist);
|
||||
|
||||
/*
|
||||
* attach all scsi units on us
|
||||
*/
|
||||
config_found(dp, &sc->sc_link, otgscprint);
|
||||
}
|
||||
|
||||
/*
|
||||
* print diag if pnp is NULL else just extra
|
||||
*/
|
||||
int
|
||||
otgscprint(auxp, pnp)
|
||||
void *auxp;
|
||||
char *pnp;
|
||||
{
|
||||
if (pnp == NULL)
|
||||
return(UNCONF);
|
||||
return(QUIET);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
otgsc_dma_xfer_in (dev, len, buf, phase)
|
||||
struct sci_softc *dev;
|
||||
int len;
|
||||
register u_char *buf;
|
||||
@ -83,7 +178,7 @@ dma_xfer_in (dev, len, buf, phase)
|
||||
volatile register u_char *sci_csr = dev->sci_csr;
|
||||
volatile register u_char *sci_icmd = dev->sci_icmd;
|
||||
|
||||
QPRINTF(("csa12gdma_in %d, csr=%02x\n", len, *dev->sci_bus_csr));
|
||||
QPRINTF(("otgsc_dma_in %d, csr=%02x\n", len, *dev->sci_bus_csr));
|
||||
|
||||
*dev->sci_tcmd = phase;
|
||||
*dev->sci_mode |= SCI_MODE_DMA;
|
||||
@ -98,10 +193,9 @@ dma_xfer_in (dev, len, buf, phase)
|
||||
|| --wait < 0) {
|
||||
#ifdef DEBUG
|
||||
if (sci_debug)
|
||||
printf("csa12g_in fail: l%d i%x w%d\n",
|
||||
printf("otgsc_dma_in fail: l%d i%x w%d\n",
|
||||
len, csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
@ -111,18 +205,16 @@ dma_xfer_in (dev, len, buf, phase)
|
||||
len--;
|
||||
}
|
||||
|
||||
QPRINTF(("csa12gdma_in {%d} %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
QPRINTF(("otgsc_dma_in {%d} %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
len, obp[0], obp[1], obp[2], obp[3], obp[4], obp[5],
|
||||
obp[6], obp[7], obp[8], obp[9]));
|
||||
|
||||
/* this leaves with one csr to be read */
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
dma_xfer_out (dev, len, buf, phase)
|
||||
int
|
||||
otgsc_dma_xfer_out (dev, len, buf, phase)
|
||||
struct sci_softc *dev;
|
||||
int len;
|
||||
register u_char *buf;
|
||||
@ -135,9 +227,9 @@ dma_xfer_out (dev, len, buf, phase)
|
||||
volatile register u_char *sci_csr = dev->sci_csr;
|
||||
volatile register u_char *sci_icmd = dev->sci_icmd;
|
||||
|
||||
QPRINTF(("csa12gdma_out %d, csr=%02x\n", len, *dev->sci_bus_csr));
|
||||
QPRINTF(("otgsc_dma_out %d, csr=%02x\n", len, *dev->sci_bus_csr));
|
||||
|
||||
QPRINTF(("csa12gdma_out {%d} %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
QPRINTF(("otgsc_dma_out {%d} %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||
len, buf[0], buf[1], buf[2], buf[3], buf[4], buf[5],
|
||||
buf[6], buf[7], buf[8], buf[9]));
|
||||
|
||||
@ -154,10 +246,9 @@ dma_xfer_out (dev, len, buf, phase)
|
||||
|| --wait < 0) {
|
||||
#ifdef DEBUG
|
||||
if (sci_debug)
|
||||
printf("csa12gdma_out fail: l%d i%x w%d\n",
|
||||
printf("otgsc_dma_out fail: l%d i%x w%d\n",
|
||||
len, csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
@ -172,8 +263,27 @@ dma_xfer_out (dev, len, buf, phase)
|
||||
SCI_CSR_PHASE_MATCH && --wait);
|
||||
|
||||
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
otgsc_intr()
|
||||
{
|
||||
struct sci_softc *dev;
|
||||
int i, found;
|
||||
u_char stat;
|
||||
|
||||
found = 0;
|
||||
for (i = 0; i < otgsccd.cd_ndevs; i++) {
|
||||
dev = otgsccd.cd_devs[i];
|
||||
if (dev == NULL)
|
||||
continue;
|
||||
if ((*dev->sci_csr & SCI_CSR_INT) == 0)
|
||||
continue;
|
||||
++found;
|
||||
stat = *dev->sci_iack;
|
||||
*dev->sci_mode = 0;
|
||||
}
|
||||
return (found);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)scireg.h 7.3 (Berkeley) 2/5/91
|
||||
* $Id: scireg.h,v 1.1 1994/02/28 06:06:24 chopps Exp $
|
||||
* $Id: scireg.h,v 1.2 1994/05/29 04:50:23 chopps Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -42,6 +42,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0 /* for reference */
|
||||
typedef struct {
|
||||
unsigned char pad0[1];
|
||||
volatile unsigned char sci_data; /* r: Current data */
|
||||
@ -72,6 +73,7 @@ typedef struct {
|
||||
volatile unsigned char sci_iack; /* r: Interrupt Acknowledge */
|
||||
#define sci_irecv sci_iack /* w: Start dma receive, initiator */
|
||||
} sci_regmap_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initiator command register
|
||||
|
@ -34,13 +34,23 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)scivar.h 7.1 (Berkeley) 5/8/90
|
||||
* $Id: scivar.h,v 1.2 1994/05/08 05:53:42 chopps Exp $
|
||||
* $Id: scivar.h,v 1.3 1994/05/29 04:50:24 chopps Exp $
|
||||
*/
|
||||
#ifndef _SCIVAR_H_
|
||||
#define _SCIVAR_H_
|
||||
|
||||
struct sci_pending {
|
||||
TAILQ_ENTRY(sci_pending) link;
|
||||
struct scsi_xfer *xs;
|
||||
};
|
||||
|
||||
|
||||
struct sci_softc {
|
||||
struct amiga_ctlr *sc_ac;
|
||||
struct devqueue sc_dq;
|
||||
struct devqueue sc_sq;
|
||||
struct device sc_dev;
|
||||
struct scsi_link sc_link; /* proto for sub devices */
|
||||
TAILQ_HEAD(,sci_pending) sc_xslist;
|
||||
struct sci_pending sc_xsstore[8][8];
|
||||
struct scsi_xfer *sc_xs; /* transfer from high level code */
|
||||
|
||||
volatile u_char *sci_data; /* r: Current data */
|
||||
volatile u_char *sci_odata; /* w: Out data */
|
||||
@ -83,3 +93,52 @@ struct sci_softc {
|
||||
#define SYNC_SENT 1 /* we sent sync request, no answer yet */
|
||||
#define SYNC_DONE 2 /* target accepted our (or inferior) settings,
|
||||
or it rejected the request and we stay async *
|
||||
|
||||
#define PHASE 0x07 /* mask for psns/pctl phase */
|
||||
#define DATA_OUT_PHASE 0x00
|
||||
#define DATA_IN_PHASE 0x01
|
||||
#define CMD_PHASE 0x02
|
||||
#define STATUS_PHASE 0x03
|
||||
#define BUS_FREE_PHASE 0x04
|
||||
#define ARB_SEL_PHASE 0x05 /* Fuji chip combines arbitration with sel. */
|
||||
#define MESG_OUT_PHASE 0x06
|
||||
#define MESG_IN_PHASE 0x07
|
||||
|
||||
#define MSG_CMD_COMPLETE 0x00
|
||||
#define MSG_EXT_MESSAGE 0x01
|
||||
#define MSG_SAVE_DATA_PTR 0x02
|
||||
#define MSG_RESTORE_PTR 0x03
|
||||
#define MSG_DISCONNECT 0x04
|
||||
#define MSG_INIT_DETECT_ERROR 0x05
|
||||
#define MSG_ABORT 0x06
|
||||
#define MSG_REJECT 0x07
|
||||
#define MSG_NOOP 0x08
|
||||
#define MSG_PARITY_ERROR 0x09
|
||||
#define MSG_BUS_DEVICE_RESET 0x0C
|
||||
#define MSG_IDENTIFY 0x80
|
||||
#define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */
|
||||
#define MSG_SYNC_REQ 0x01
|
||||
|
||||
|
||||
#define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
|
||||
#define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */
|
||||
#define STS_BUSY 0x08
|
||||
#define STS_INTERMED 0x10 /* Intermediate status sent */
|
||||
#define STS_EXT 0x80 /* Extended status valid */
|
||||
|
||||
/*
|
||||
* XXXX
|
||||
*/
|
||||
struct scsi_fmt_cdb {
|
||||
int len; /* cdb length (in bytes) */
|
||||
u_char cdb[28]; /* cdb to use on next read/write */
|
||||
};
|
||||
|
||||
struct buf;
|
||||
struct scsi_xfer;
|
||||
|
||||
void sci_minphys __P((struct buf *bp));
|
||||
u_int sci_adinfo __P((void));
|
||||
int sci_scsicmd __P((struct scsi_xfer *));
|
||||
|
||||
#endif /* _SCIVAR_H_ */
|
||||
|
@ -1,4 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1994 Michael L. Hitch
|
||||
* Copyright (c) 1982, 1990 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
@ -31,65 +32,156 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)supradma.c
|
||||
* $Id: wstsc.c,v 1.1 1994/05/08 05:53:50 chopps Exp $
|
||||
* $Id: wstsc.c,v 1.2 1994/05/29 04:50:25 chopps Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* dummy Supra 5380 DMA driver
|
||||
*/
|
||||
|
||||
#include "suprascsi.h"
|
||||
|
||||
#if NSUPRASCSI > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <amiga/dev/device.h>
|
||||
#include <amiga/dev/scivar.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
#include <scsi/scsi_all.h>
|
||||
#include <scsi/scsiconf.h>
|
||||
#include <amiga/amiga/device.h>
|
||||
#include <amiga/dev/scireg.h>
|
||||
#include <amiga/dev/scivar.h>
|
||||
#include <amiga/dev/ztwobusvar.h>
|
||||
|
||||
int supradma_pseudo = 0; /* 0=none, 1=byte, 2=word */
|
||||
int wstscprint __P((void *auxp, char *));
|
||||
void wstscattach __P((struct device *, struct device *, void *));
|
||||
int wstscmatch __P((struct device *, struct cfdata *, void *));
|
||||
|
||||
int wstsc_dma_xfer_in __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
int wstsc_dma_xfer_out __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
int wstsc_dma_xfer_in2 __P((struct sci_softc *dev, int len,
|
||||
register u_short *buf, int phase));
|
||||
int wstsc_dma_xfer_out2 __P((struct sci_softc *dev, int len,
|
||||
register u_short *buf, int phase));
|
||||
|
||||
struct scsi_adapter wstsc_scsiswitch = {
|
||||
sci_scsicmd,
|
||||
sci_minphys,
|
||||
0, /* no lun support */
|
||||
0, /* no lun support */
|
||||
sci_adinfo,
|
||||
"wstsc",
|
||||
};
|
||||
|
||||
struct scsi_device wstsc_scsidev = {
|
||||
NULL, /* use default error handler */
|
||||
NULL, /* do not have a start functio */
|
||||
NULL, /* have no async handler */
|
||||
NULL, /* Use default done routine */
|
||||
"wstsc",
|
||||
0,
|
||||
};
|
||||
|
||||
#define QPRINTF
|
||||
|
||||
#ifdef DEBUG
|
||||
extern int sci_debug;
|
||||
#define QUASEL
|
||||
#endif
|
||||
#define HIST(h,w)
|
||||
|
||||
#ifdef QUASEL
|
||||
#define QPRINTF(a) if (sci_debug > 1) printf a
|
||||
#else
|
||||
#define QPRINTF
|
||||
#endif
|
||||
|
||||
extern int sci_data_wait;
|
||||
|
||||
static int dma_xfer_in __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
static int dma_xfer_out __P((struct sci_softc *dev, int len,
|
||||
register u_char *buf, int phase));
|
||||
static int dma_xfer_in2 __P((struct sci_softc *dev, int len,
|
||||
register u_short *buf, int phase));
|
||||
static int dma_xfer_out2 __P((struct sci_softc *dev, int len,
|
||||
register u_short *buf, int phase));
|
||||
static int supra_intr __P((struct sci_softc *dev));
|
||||
int supradma_pseudo = 0; /* 0=none, 1=byte, 2=word */
|
||||
|
||||
void
|
||||
supradmainit (dev)
|
||||
struct sci_softc *dev;
|
||||
struct cfdriver wstsccd = {
|
||||
NULL, "wstsc", wstscmatch, wstscattach,
|
||||
DV_DULL, sizeof(struct sci_softc), NULL, 0 };
|
||||
|
||||
/*
|
||||
* if this a Supra WordSync board
|
||||
*/
|
||||
int
|
||||
wstscmatch(pdp, cdp, auxp)
|
||||
struct device *pdp;
|
||||
struct cfdata *cdp;
|
||||
void *auxp;
|
||||
{
|
||||
if (supradma_pseudo == 2) {
|
||||
dev->dma_xfer_in = dma_xfer_in2;
|
||||
dev->dma_xfer_out = dma_xfer_out2;
|
||||
} else if (supradma_pseudo == 1) {
|
||||
dev->dma_xfer_in = dma_xfer_in;
|
||||
dev->dma_xfer_out = dma_xfer_out;
|
||||
}
|
||||
dev->dma_intr = supra_intr;
|
||||
struct ztwobus_args *zap;
|
||||
|
||||
zap = auxp;
|
||||
|
||||
/*
|
||||
* Check manufacturer and product id.
|
||||
*/
|
||||
if (zap->manid == 1056 && zap->prodid == 12) /* add other boards? */
|
||||
return(1);
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int
|
||||
dma_xfer_in (dev, len, buf, phase)
|
||||
void
|
||||
wstscattach(pdp, dp, auxp)
|
||||
struct device *pdp, *dp;
|
||||
void *auxp;
|
||||
{
|
||||
volatile u_char *rp;
|
||||
struct sci_softc *sc;
|
||||
struct ztwobus_args *zap;
|
||||
|
||||
zap = auxp;
|
||||
|
||||
sc = (struct sci_softc *)dp;
|
||||
rp = zap->va;
|
||||
/*
|
||||
* set up 5380 register pointers
|
||||
* (Needs check on which Supra board this is - for now,
|
||||
* just do the WordSync)
|
||||
*/
|
||||
sc->sci_data = rp + 0;
|
||||
sc->sci_odata = rp + 0;
|
||||
sc->sci_icmd = rp + 2;
|
||||
sc->sci_mode = rp + 4;
|
||||
sc->sci_tcmd = rp + 6;
|
||||
sc->sci_bus_csr = rp + 8;
|
||||
sc->sci_sel_enb = rp + 8;
|
||||
sc->sci_csr = rp + 10;
|
||||
sc->sci_dma_send = rp + 10;
|
||||
sc->sci_idata = rp + 12;
|
||||
sc->sci_trecv = rp + 12;
|
||||
sc->sci_iack = rp + 14;
|
||||
sc->sci_irecv = rp + 14;
|
||||
|
||||
if (supradma_pseudo == 2) {
|
||||
sc->dma_xfer_in = wstsc_dma_xfer_in2;
|
||||
sc->dma_xfer_out = wstsc_dma_xfer_out2;
|
||||
}
|
||||
else if (supradma_pseudo == 1) {
|
||||
sc->dma_xfer_in = wstsc_dma_xfer_in;
|
||||
sc->dma_xfer_out = wstsc_dma_xfer_out;
|
||||
}
|
||||
|
||||
scireset(sc);
|
||||
|
||||
sc->sc_link.adapter_softc = sc;
|
||||
sc->sc_link.adapter_targ = 7;
|
||||
sc->sc_link.adapter = &wstsc_scsiswitch;
|
||||
sc->sc_link.device = &wstsc_scsidev;
|
||||
TAILQ_INIT(&sc->sc_xslist);
|
||||
|
||||
/*
|
||||
* attach all scsi units on us
|
||||
*/
|
||||
config_found(dp, &sc->sc_link, wstscprint);
|
||||
}
|
||||
|
||||
/*
|
||||
* print diag if pnp is NULL else just extra
|
||||
*/
|
||||
int
|
||||
wstscprint(auxp, pnp)
|
||||
void *auxp;
|
||||
char *pnp;
|
||||
{
|
||||
if (pnp == NULL)
|
||||
return(UNCONF);
|
||||
return(QUIET);
|
||||
}
|
||||
|
||||
int
|
||||
wstsc_dma_xfer_in (dev, len, buf, phase)
|
||||
struct sci_softc *dev;
|
||||
int len;
|
||||
register u_char *buf;
|
||||
@ -120,7 +212,6 @@ dma_xfer_in (dev, len, buf, phase)
|
||||
printf("supradma2_in fail: l%d i%x w%d\n",
|
||||
len, *dev->sci_bus_csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode = 0;
|
||||
return 0;
|
||||
}
|
||||
@ -205,7 +296,6 @@ dma_xfer_in (dev, len, buf, phase)
|
||||
printf("supradma1_in fail: l%d i%x w%d\n",
|
||||
len, *dev->sci_bus_csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode = 0;
|
||||
return 0;
|
||||
}
|
||||
@ -219,13 +309,12 @@ dma_xfer_in (dev, len, buf, phase)
|
||||
len, obp[0], obp[1], obp[2], obp[3], obp[4], obp[5],
|
||||
obp[6], obp[7], obp[8], obp[9]));
|
||||
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
dma_xfer_out (dev, len, buf, phase)
|
||||
int
|
||||
wstsc_dma_xfer_out (dev, len, buf, phase)
|
||||
struct sci_softc *dev;
|
||||
int len;
|
||||
register u_char *buf;
|
||||
@ -259,7 +348,6 @@ dma_xfer_out (dev, len, buf, phase)
|
||||
printf("supradma_out fail: l%d i%x w%d\n",
|
||||
len, csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode = 0;
|
||||
return 0;
|
||||
}
|
||||
@ -274,15 +362,14 @@ dma_xfer_out (dev, len, buf, phase)
|
||||
SCI_CSR_PHASE_MATCH && --wait);
|
||||
|
||||
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode = 0;
|
||||
*dev->sci_icmd = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
dma_xfer_in2 (dev, len, buf, phase)
|
||||
int
|
||||
wstsc_dma_xfer_in2 (dev, len, buf, phase)
|
||||
struct sci_softc *dev;
|
||||
int len;
|
||||
register u_short *buf;
|
||||
@ -313,7 +400,6 @@ dma_xfer_in2 (dev, len, buf, phase)
|
||||
printf("supradma2_in2 fail: l%d i%x w%d\n",
|
||||
len, *dev->sci_bus_csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
@ -370,7 +456,6 @@ dma_xfer_in2 (dev, len, buf, phase)
|
||||
printf("supradma1_in2 fail: l%d i%x w%d\n",
|
||||
len, *dev->sci_bus_csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode &= ~SCI_MODE_DMA;
|
||||
return 0;
|
||||
}
|
||||
@ -388,14 +473,13 @@ dma_xfer_in2 (dev, len, buf, phase)
|
||||
len, obp[0], obp[1], obp[2], obp[3], obp[4], obp[5],
|
||||
obp[6], obp[7], obp[8], obp[9]));
|
||||
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_irecv = 0;
|
||||
*dev->sci_mode = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
dma_xfer_out2 (dev, len, buf, phase)
|
||||
int
|
||||
wstsc_dma_xfer_out2 (dev, len, buf, phase)
|
||||
struct sci_softc *dev;
|
||||
int len;
|
||||
register u_short *buf;
|
||||
@ -430,7 +514,6 @@ dma_xfer_out2 (dev, len, buf, phase)
|
||||
printf("supradma_out2 fail: l%d i%x w%d\n",
|
||||
len, csr, wait);
|
||||
#endif
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_mode = 0;
|
||||
return 0;
|
||||
}
|
||||
@ -472,7 +555,6 @@ dma_xfer_out2 (dev, len, buf, phase)
|
||||
#endif
|
||||
|
||||
|
||||
HIST(ixin_wait, wait)
|
||||
*dev->sci_irecv = 0;
|
||||
*dev->sci_icmd &= ~SCI_ICMD_ACK;
|
||||
*dev->sci_mode = 0;
|
||||
@ -480,18 +562,22 @@ dma_xfer_out2 (dev, len, buf, phase)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
supra_intr (dev)
|
||||
struct sci_softc *dev;
|
||||
int
|
||||
wstsc_intr()
|
||||
{
|
||||
if (*(dev->sci_csr + 0x10) & SCI_CSR_INT) {
|
||||
char dummy;
|
||||
#if 0
|
||||
printf ("supra_intr\n");
|
||||
#endif
|
||||
dummy = *(dev->sci_iack + 0x10);
|
||||
return (1);
|
||||
struct sci_softc *dev;
|
||||
int i, found;
|
||||
u_char stat;
|
||||
|
||||
found = 0;
|
||||
for (i = 0; i < wstsccd.cd_ndevs; i++) {
|
||||
dev = wstsccd.cd_devs[i];
|
||||
if (dev == NULL)
|
||||
continue;
|
||||
if ((*(dev->sci_csr + 0x10) & SCI_CSR_INT) == 0)
|
||||
continue;
|
||||
++found;
|
||||
stat = *(dev->sci_iack + 0x10);
|
||||
}
|
||||
return (0);
|
||||
return (found);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user