summaryrefslogtreecommitdiff
path: root/sys/arch/amiga/dev/sbic.c
diff options
context:
space:
mode:
authorNiklas Hallqvist <niklas@cvs.openbsd.org>1996-05-02 06:44:48 +0000
committerNiklas Hallqvist <niklas@cvs.openbsd.org>1996-05-02 06:44:48 +0000
commita1ab0133973a053ec8cb7034b5f525c772d2c6d6 (patch)
tree348052b6165a33d50f05b52e0989ec9095b81452 /sys/arch/amiga/dev/sbic.c
parent357d854e83a35ee1bdb134546c9f0e8b086a8833 (diff)
Sync with NetBSD 9600430. The port has gone over a major -Wall treat
Diffstat (limited to 'sys/arch/amiga/dev/sbic.c')
-rw-r--r--sys/arch/amiga/dev/sbic.c146
1 files changed, 70 insertions, 76 deletions
diff --git a/sys/arch/amiga/dev/sbic.c b/sys/arch/amiga/dev/sbic.c
index 8e40232e6ed..650a57242d6 100644
--- a/sys/arch/amiga/dev/sbic.c
+++ b/sys/arch/amiga/dev/sbic.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sbic.c,v 1.4 1996/04/21 22:15:43 deraadt Exp $ */
-/* $NetBSD: sbic.c,v 1.22 1996/03/23 15:09:54 is Exp $ */
+/* $OpenBSD: sbic.c,v 1.5 1996/05/02 06:44:26 niklas Exp $ */
+/* $NetBSD: sbic.c,v 1.23 1996/04/21 21:12:21 veego Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -85,8 +85,6 @@
#define b_cylin b_resid
#define SBIC_WAIT(regs, until, timeo) sbicwait(regs, until, timeo, __LINE__)
-extern u_int kvtop();
-
int sbicicmd __P((struct sbic_softc *, int, int, void *, int, void *, int));
int sbicgo __P((struct sbic_softc *, struct scsi_xfer *));
int sbicdmaok __P((struct sbic_softc *, struct scsi_xfer *));
@@ -97,7 +95,6 @@ int sbicxfstart __P((sbic_regmap_p, int, u_char, int));
int sbicxfout __P((sbic_regmap_p regs, int, void *, int));
int sbicfromscsiperiod __P((struct sbic_softc *, sbic_regmap_p, int));
int sbictoscsiperiod __P((struct sbic_softc *, sbic_regmap_p, int));
-int sbicintr __P((struct sbic_softc *));
int sbicpoll __P((struct sbic_softc *));
int sbicnextstate __P((struct sbic_softc *, u_char, u_char));
int sbicmsgin __P((struct sbic_softc *));
@@ -111,6 +108,10 @@ void sbic_scsidone __P((struct sbic_acb *, int));
void sbic_sched __P((struct sbic_softc *));
void sbic_save_ptrs __P((struct sbic_softc *, sbic_regmap_p,int,int));
void sbic_load_ptrs __P((struct sbic_softc *, sbic_regmap_p,int,int));
+#ifdef DEBUG
+void sbicdumpstate __P((void));
+void sbic_dump_acb __P((struct sbic_acb *));
+#endif
/*
* Synch xfer parameters, and timing conversions
@@ -148,7 +149,6 @@ int report_sense = 0;
int data_pointer_debug = 0;
u_char debug_asr, debug_csr, routine;
void sbictimeout __P((struct sbic_softc *dev));
-void sbic_dump __P((struct sbic_softc *dev));
#define CSR_TRACE_SIZE 32
#if CSR_TRACE_SIZE
@@ -156,9 +156,9 @@ void sbic_dump __P((struct sbic_softc *dev));
int s = splbio(); \
csr_trace[csr_traceptr].whr = (w); csr_trace[csr_traceptr].csr = (c); \
csr_trace[csr_traceptr].asr = (a); csr_trace[csr_traceptr].xtn = (x); \
- dma_cachectl(&csr_trace[csr_traceptr], sizeof(csr_trace[0])); \
+ dma_cachectl((caddr_t)&csr_trace[csr_traceptr], sizeof(csr_trace[0])); \
csr_traceptr = (csr_traceptr + 1) & (CSR_TRACE_SIZE - 1); \
-/* dma_cachectl(&csr_traceptr, sizeof(csr_traceptr));*/ \
+/* dma_cachectl((caddr_t)&csr_traceptr, sizeof(csr_traceptr));*/ \
splx(s); \
} while (0)
int csr_traceptr;
@@ -170,7 +170,7 @@ struct {
u_char xtn;
} csr_trace[CSR_TRACE_SIZE];
#else
-#define CSR_TRACE
+#define CSR_TRACE(w,c,a,x)
#endif
#define SBIC_TRACE_SIZE 0
@@ -196,14 +196,14 @@ struct {
int csr;
} sbic_trace[SBIC_TRACE_SIZE];
#else
-#define SBIC_TRACE
+#define SBIC_TRACE(dev)
#endif
-#else
-#define QPRINTF
-#define CSR_TRACE
-#define SBIC_TRACE
-#endif
+#else /* DEBUG */
+#define QPRINTF(a)
+#define CSR_TRACE(w,c,a,x)
+#define SBIC_TRACE(dev)
+#endif /* DEBUG */
/*
* default minphys routine for sbic based controllers
@@ -228,13 +228,9 @@ sbic_save_ptrs(dev, regs, target, lun)
sbic_regmap_p regs;
int target, lun;
{
- int count, asr, csr, s;
- unsigned long ptr;
- char *vptr;
+ int count, asr, s;
struct sbic_acb* acb;
- extern vm_offset_t vm_first_phys;
-
SBIC_TRACE(dev);
if( !dev->sc_cur ) return;
if( !(dev->sc_flags & SBICF_INDMA) ) return; /* DMA not active */
@@ -266,7 +262,7 @@ sbic_save_ptrs(dev, regs, target, lun)
#ifdef DEBUG
if(!count && sbic_debug) printf("%dcount0",target);
if(data_pointer_debug == -1)
- printf("SBIC saving target %d data pointers from (%x,%x)%xASR:%02x",
+ printf("SBIC saving target %d data pointers from (%p,%x)%xASR:%02x",
target, dev->sc_cur->dc_addr, dev->sc_cur->dc_count,
acb->sc_dmacmd, asr);
#endif
@@ -280,7 +276,7 @@ sbic_save_ptrs(dev, regs, target, lun)
acb->sc_tcnt = dev->sc_tcnt = count;
#ifdef DEBUG
if(data_pointer_debug)
- printf(" at (%x,%x):%x\n",
+ printf(" at (%p,%x):%x\n",
dev->sc_cur->dc_addr, dev->sc_cur->dc_count,count);
sbicdma_saves++;
#endif
@@ -297,7 +293,7 @@ void sbic_load_ptrs(dev, regs, target, lun)
sbic_regmap_p regs;
int target, lun;
{
- int i, s, asr, count;
+ int s, count;
char* vaddr, * paddr;
struct sbic_acb *acb;
@@ -347,7 +343,7 @@ void sbic_load_ptrs(dev, regs, target, lun)
#ifdef DEBUG
if(data_pointer_debug)
- printf("DMA recalc:kv(%x,%x)pa(%x,%x)\n",
+ printf("DMA recalc:kv(%p,%x)pa(%p,%lx)\n",
acb->sc_kv.dc_addr,
acb->sc_kv.dc_count,
acb->sc_pa.dc_addr,
@@ -357,7 +353,7 @@ void sbic_load_ptrs(dev, regs, target, lun)
splx(s);
#ifdef DEBUG
if(data_pointer_debug)
- printf("SBIC restoring target %d data pointers at (%x,%x)%x\n",
+ printf("SBIC restoring target %d data pointers at (%p,%x)%x\n",
target, dev->sc_cur->dc_addr, dev->sc_cur->dc_count,
dev->sc_dmacmd);
#endif
@@ -547,7 +543,7 @@ sbic_scsidone(acb, stat)
struct scsi_xfer *xs;
struct scsi_link *slp;
struct sbic_softc *dev;
- int s, dosched = 0;
+ int dosched = 0;
xs = acb->xs;
slp = xs->sc_link;
@@ -600,7 +596,7 @@ sbic_scsidone(acb, stat)
acb->clen = sizeof(*ss);
acb->sc_kv.dc_addr = (char *)&xs->sense;
acb->sc_kv.dc_count = sizeof(struct scsi_sense_data);
- acb->pa_addr = (char *)kvtop(&xs->sense); /* XXX check */
+ acb->pa_addr = (char *)kvtop((u_char *)&xs->sense); /* XXX check */
acb->flags = ACB_ACTIVE | ACB_CHKSENSE | ACB_DATAIN;
TAILQ_INSERT_HEAD(&dev->ready_list, acb, chain);
dev->sc_tinfo[slp->target].lubusy &=
@@ -708,14 +704,14 @@ sbicdmaok(dev, xs)
/*
* try to get one
*/
- else if (dev->sc_tinfo[xs->sc_link->target].bounce
- = (char *)alloc_z2mem(MAXPHYS)) {
+ else if ((dev->sc_tinfo[xs->sc_link->target].bounce
+ = (char *)alloc_z2mem(MAXPHYS))) {
if (isztwomem(dev->sc_tinfo[xs->sc_link->target].bounce))
printf("alloc ZII target %d bounce pa 0x%x\n",
xs->sc_link->target,
kvtop(dev->sc_tinfo[xs->sc_link->target].bounce));
else if (dev->sc_tinfo[xs->sc_link->target].bounce)
- printf("alloc CHIP target %d bounce pa 0x%x\n",
+ printf("alloc CHIP target %d bounce pa 0x%p\n",
xs->sc_link->target,
PREP_DMA_MEM(dev->sc_tinfo[xs->sc_link->target].bounce));
return(1);
@@ -838,8 +834,7 @@ sbicinit(dev)
struct sbic_softc *dev;
{
sbic_regmap_p regs;
- u_int my_id, i, s;
- u_char csr;
+ u_int i;
struct sbic_acb *acb;
u_int inhibit_sync;
@@ -893,9 +888,12 @@ sbicreset(dev)
struct sbic_softc *dev;
{
sbic_regmap_p regs;
- u_int my_id, i, s;
+ u_int my_id, s;
u_char csr;
+#if 0
+ u_int i;
struct sbic_acb *acb;
+#endif
regs = dev->sc_sbicp;
#if 0
@@ -1228,7 +1226,7 @@ sbicxfout(regs, len, bp, phase)
void *bp;
int phase;
{
- u_char orig_csr, csr, asr, *buf;
+ u_char orig_csr, asr, *buf;
int wait;
buf = bp;
@@ -1282,7 +1280,7 @@ sbicxfin(regs, len, bp)
int len;
void *bp;
{
- int wait, read;
+ int wait;
u_char *obp, *buf;
u_char orig_csr, csr, asr;
@@ -1363,12 +1361,9 @@ sbicicmd(dev, target, lun, cbuf, clen, buf, len)
{
sbic_regmap_p regs;
u_char phase, csr, asr;
- int wait, newtarget, cmd_sent, parity_err;
+ int wait, i;
struct sbic_acb *acb;
- int discon;
- int i;
-
#define CSR_LOG_BUF_SIZE 0
#if CSR_LOG_BUF_SIZE
int bufptr;
@@ -1444,7 +1439,7 @@ sbicicmd(dev, target, lun, cbuf, clen, buf, len)
if (phase == 0x60) {
GET_SBIC_tlun (regs, dev->sc_stat[0]);
i = 0; /* done */
-/* break; /* Bypass all the state gobldygook */
+/* break; */ /* Bypass all the state gobldygook */
} else {
#ifdef DEBUG
if(reselect_debug>1)
@@ -1656,8 +1651,8 @@ sbicgo(dev, xs)
struct sbic_softc *dev;
struct scsi_xfer *xs;
{
- int i, dmaflags, count, wait, usedma;
- u_char csr, asr, cmd, *addr;
+ int i, dmaflags, count, usedma;
+ u_char csr, asr, *addr;
sbic_regmap_p regs;
struct sbic_acb *acb;
@@ -1712,7 +1707,7 @@ sbicgo(dev, xs)
addr = acb->sc_kv.dc_addr;
count = acb->sc_kv.dc_count;
if (count && (char *)kvtop(addr) != acb->sc_pa.dc_addr) { /* XXXX check */
- printf("sbic: DMA buffer mapping changed %x->%x\n",
+ printf("sbic: DMA buffer mapping changed %p->%x\n",
acb->sc_pa.dc_addr, kvtop(addr));
#ifdef DDB
Debugger();
@@ -1735,7 +1730,7 @@ sbicgo(dev, xs)
if(!dev->sc_tinfo[dev->target].bounce) {
printf("sbicgo: HELP! no bounce allocated for %d\n",
dev->target);
- printf("xfer: (%x->%x,%x)\n", acb->sc_dmausrbuf,
+ printf("xfer: (%p->%p,%lx)\n", acb->sc_dmausrbuf,
acb->sc_usrbufpa, acb->sc_dmausrlen);
dev->sc_tinfo[xs->sc_link->target].bounce
= (char *)alloc_z2mem(MAXPHYS);
@@ -1744,7 +1739,7 @@ sbicgo(dev, xs)
xs->sc_link->target,
kvtop(dev->sc_tinfo[xs->sc_link->target].bounce));
else if (dev->sc_tinfo[xs->sc_link->target].bounce)
- printf("alloc CHIP target %d bounce pa 0x%x\n",
+ printf("alloc CHIP target %d bounce pa 0x%p\n",
xs->sc_link->target,
PREP_DMA_MEM(dev->sc_tinfo[xs->sc_link->target].bounce));
@@ -1796,7 +1791,7 @@ sbicgo(dev, xs)
} else
dev->sc_dmacmd = 0; /* Don't use DMA */
dev->sc_flags |= SBICF_INDMA;
-/* SBIC_TC_PUT(regs, dev->sc_tcnt); /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
+/* SBIC_TC_PUT(regs, dev->sc_tcnt); */ /* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX */
SBIC_TRACE(dev);
sbic_save_ptrs(dev, regs, dev->target, dev->lun);
@@ -1816,7 +1811,7 @@ sbicgo(dev, xs)
*/
#ifdef DEBUG
if( data_pointer_debug > 1 )
- printf("sbicgo dmago:%d(%x:%x)\n",
+ printf("sbicgo dmago:%d(%p:%lx)\n",
dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
debug_asr = asr;
debug_csr = csr;
@@ -1865,11 +1860,8 @@ sbicintr(dev)
struct sbic_softc *dev;
{
sbic_regmap_p regs;
- struct dma_chain *df, *dl;
- u_char asr, csr, *tmpaddr;
- struct sbic_acb *acb;
- int i, newtarget, newlun;
- unsigned tcnt;
+ u_char asr, csr;
+ int i;
regs = dev->sc_sbicp;
@@ -1917,9 +1909,7 @@ sbicpoll(dev)
{
sbic_regmap_p regs;
u_char asr, csr;
- struct sbic_pending* pendp;
int i;
- unsigned tcnt;
SBIC_TRACE(dev);
regs = dev->sc_sbicp;
@@ -2253,11 +2243,13 @@ sbicnextstate(dev, csr, asr)
u_char csr, asr;
{
sbic_regmap_p regs;
- struct dma_chain *df, *dl;
struct sbic_acb *acb;
int i, newtarget, newlun, wait;
+#if 0
unsigned tcnt;
+#endif
+ i = 0;
SBIC_TRACE(dev);
regs = dev->sc_sbicp;
acb = dev->sc_nexus;
@@ -2299,19 +2291,19 @@ sbicnextstate(dev, csr, asr)
#endif
#ifdef DEBUG
if( data_pointer_debug > 1 )
- printf("next dmastop: %d(%x:%x)\n",
+ printf("next dmastop: %d(%p:%lx)\n",
dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
dev->sc_dmatimo = 0;
#endif
dev->sc_dmastop(dev); /* was dmafree */
if (acb->flags & ACB_BBUF) {
if ((u_char *)kvtop(acb->sc_dmausrbuf) != acb->sc_usrbufpa)
- printf("%s: WARNING - buffer mapping changed %x->%x\n",
+ printf("%s: WARNING - buffer mapping changed %p->%x\n",
dev->sc_dev.dv_xname, acb->sc_usrbufpa,
kvtop(acb->sc_dmausrbuf));
#ifdef DEBUG
if(data_pointer_debug)
- printf("sbicgo:copying %x bytes from target %d bounce %x\n",
+ printf("sbicgo:copying %lx bytes from target %d bounce %x\n",
acb->sc_dmausrlen,
dev->target,
kvtop(dev->sc_tinfo[dev->target].bounce));
@@ -2385,7 +2377,7 @@ sbicnextstate(dev, csr, asr)
#endif
#ifdef DEBUG
if( data_pointer_debug > 1 )
- printf("next dmanext: %d(%x:%x)\n",
+ printf("next dmanext: %d(%p:%lx)\n",
dev->target,dev->sc_cur->dc_addr,
dev->sc_tcnt);
dev->sc_dmatimo = 1;
@@ -2483,9 +2475,9 @@ sbicnextstate(dev, csr, asr)
} else {
GET_SBIC_csr(regs,csr);
CSR_TRACE('n',csr,asr,newtarget);
- if (csr == SBIC_CSR_MIS|MESG_IN_PHASE ||
- csr == SBIC_CSR_MIS_1|MESG_IN_PHASE ||
- csr == SBIC_CSR_MIS_2|MESG_IN_PHASE) {
+ if (csr == (SBIC_CSR_MIS | MESG_IN_PHASE) ||
+ csr == (SBIC_CSR_MIS_1 | MESG_IN_PHASE) ||
+ csr == (SBIC_CSR_MIS_2 | MESG_IN_PHASE)) {
sbicmsgin(dev);
newlun = dev->sc_msg[0] & 7;
} else {
@@ -2535,7 +2527,7 @@ sbicnextstate(dev, csr, asr)
break;
}
if (acb == NULL) {
- printf("%s: reselect %s targ %d not in nexus_list %x\n",
+ printf("%s: reselect %s targ %d not in nexus_list %p\n",
dev->sc_dev.dv_xname,
csr == SBIC_CSR_RSLT_NI ? "NI" : "IFY", newtarget,
&dev->nexus_list.tqh_first);
@@ -2556,7 +2548,7 @@ sbicnextstate(dev, csr, asr)
#endif
#ifdef DEBUG
if( data_pointer_debug > 1 )
- printf("next dmastop: %d(%x:%x)\n",
+ printf("next dmastop: %d(%p:%lx)\n",
dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
dev->sc_dmatimo = 0;
#endif
@@ -2580,7 +2572,7 @@ sbicnextstate(dev, csr, asr)
~(SBICF_INDMA | SBICF_DCFLUSH);
#ifdef DEBUG
if( data_pointer_debug > 1 )
- printf("next dmastop: %d(%x:%x)\n",
+ printf("next dmastop: %d(%p:%lx)\n",
dev->target,dev->sc_cur->dc_addr,dev->sc_tcnt);
dev->sc_dmatimo = 0;
#endif
@@ -2674,7 +2666,8 @@ sbicfromscsiperiod(dev, regs, p)
#ifdef DEBUG
-void sbicdumpstate()
+void
+sbicdumpstate()
{
u_char csr, asr;
@@ -2689,7 +2682,8 @@ void sbicdumpstate()
}
-void sbictimeout(dev)
+void
+sbictimeout(dev)
struct sbic_softc *dev;
{
int s, asr;
@@ -2721,7 +2715,7 @@ sbic_dump_acb(acb)
u_char *b = (u_char *) &acb->cmd;
int i;
- printf("acb@%x ", acb);
+ printf("acb@%p ", acb);
if (acb->xs == NULL) {
printf("<unused>\n");
return;
@@ -2731,10 +2725,10 @@ sbic_dump_acb(acb)
for (i = acb->clen; i; --i)
printf(" %02x", *b++);
printf("\n");
- printf(" xs: %08x data %8x:%04x ", acb->xs, acb->xs->data,
+ printf(" xs: %8p data %8p:%04x ", acb->xs, acb->xs->data,
acb->xs->datalen);
- printf("va %8x:%04x ", acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
- printf("pa %8x:%04x tcnt %x\n", acb->sc_pa.dc_addr, acb->sc_pa.dc_count,
+ printf("va %8p:%04x ", acb->sc_kv.dc_addr, acb->sc_kv.dc_count);
+ printf("pa %8p:%04x tcnt %lx\n", acb->sc_pa.dc_addr, acb->sc_pa.dc_count,
acb->sc_tcnt);
}
@@ -2857,23 +2851,23 @@ sbic_dump(dev)
GET_SBIC_csr(regs, csr);
else
csr = 0;
- printf("%s@%x regs %x asr %x csr %x\n", dev->sc_dev.dv_xname,
+ printf("%s@%p regs %x asr %x csr %x\n", dev->sc_dev.dv_xname,
dev, regs, asr, csr);
- if (acb = dev->free_list.tqh_first) {
+ if ((acb = dev->free_list.tqh_first)) {
printf("Free list:\n");
while (acb) {
sbic_dump_acb(acb);
acb = acb->chain.tqe_next;
}
}
- if (acb = dev->ready_list.tqh_first) {
+ if ((acb = dev->ready_list.tqh_first)) {
printf("Ready list:\n");
while (acb) {
sbic_dump_acb(acb);
acb = acb->chain.tqe_next;
}
}
- if (acb = dev->nexus_list.tqh_first) {
+ if ((acb = dev->nexus_list.tqh_first)) {
printf("Nexus list:\n");
while (acb) {
sbic_dump_acb(acb);
@@ -2884,7 +2878,7 @@ sbic_dump(dev)
printf("nexus:\n");
sbic_dump_acb(dev->sc_nexus);
}
- printf("sc_xs %x targ %d lun %d flags %x tcnt %x dmacmd %x mask %x\n",
+ printf("sc_xs %p targ %d lun %d flags %x tcnt %lx dmacmd %x mask %lx\n",
dev->sc_xs, dev->target, dev->lun, dev->sc_flags, dev->sc_tcnt,
dev->sc_dmacmd, dev->sc_dmamask);
for (i = 0; i < 8; ++i) {