fix handling of volatile and remove bogus casts.

This commit is contained in:
christos 2005-05-31 00:46:46 +00:00
parent 6b23a10118
commit eb3c841970
2 changed files with 36 additions and 33 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fwohci.c,v 1.86 2005/05/22 15:54:46 christos Exp $ */
/* $NetBSD: fwohci.c,v 1.87 2005/05/31 00:46:46 christos Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.86 2005/05/22 15:54:46 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: fwohci.c,v 1.87 2005/05/31 00:46:46 christos Exp $");
#define FWOHCI_WAIT_DEBUG 1
@ -144,11 +144,12 @@ int fwohci_itd_construct(struct fwohci_it_ctx *, struct fwohci_it_dmabuf *,
void fwohci_itd_destruct(struct fwohci_it_dmabuf *);
static int fwohci_itd_dmabuf_alloc(struct fwohci_it_dmabuf *);
static void fwohci_itd_dmabuf_free(struct fwohci_it_dmabuf *);
int fwohci_itd_link(struct fwohci_it_dmabuf *, struct fwohci_it_dmabuf *);
int fwohci_itd_unlink(struct fwohci_it_dmabuf *);
int fwohci_itd_writedata(struct fwohci_it_dmabuf *, int,
int fwohci_itd_link(volatile struct fwohci_it_dmabuf *,
volatile struct fwohci_it_dmabuf *);
int fwohci_itd_unlink(volatile struct fwohci_it_dmabuf *);
int fwohci_itd_writedata(volatile struct fwohci_it_dmabuf *, int,
struct ieee1394_it_datalist *);
int fwohci_itd_isfilled(struct fwohci_it_dmabuf *);
int fwohci_itd_isfilled(volatile struct fwohci_it_dmabuf *);
static int fwohci_buf_alloc(struct fwohci_softc *, struct fwohci_buf *);
static void fwohci_buf_free(struct fwohci_softc *, struct fwohci_buf *);
@ -596,8 +597,9 @@ fwohci_thread_init(void *arg)
sc->sc_shutdownhook = shutdownhook_establish(fwohci_shutdown, sc);
sc->sc_powerhook = powerhook_establish(fwohci_power, sc);
sc->sc_sc1394.sc1394_if = config_found(&sc->sc_sc1394.sc1394_dev, "fw",
fwohci_print);
sc->sc_sc1394.sc1394_if = config_found(&sc->sc_sc1394.sc1394_dev,
/*XXXUNCONST*/
__UNCONST("fw"), fwohci_print);
#if NFWISO > 0
fwiso_register_if(&sc->sc_sc1394);
@ -4943,7 +4945,7 @@ fwohci_ir_intr(struct fwohci_softc *sc, struct fwohci_ir_ctx *irc)
#ifdef FWOHCI_WAIT_DEBUG
irc->irc_cycle[1] = fwohci_cycletimer(irc->irc_sc);
#endif
wakeup((void *)irc->irc_waitchan);
wakeup(irc->irc_waitchan);
}
selwakeup(&irc->irc_sel);
return;
@ -5680,7 +5682,7 @@ fwohci_it_ctx_writedata(ieee1394_it_tag_t it, int ndata,
struct fwohci_it_ctx *itc = (struct fwohci_it_ctx *)it;
int rv;
int writepkt = 0;
struct fwohci_it_dmabuf *itd;
volatile struct fwohci_it_dmabuf *itd;
int i = 0;
itd = itc->itc_buf_end;
@ -5699,7 +5701,7 @@ fwohci_it_ctx_writedata(ieee1394_it_tag_t it, int ndata,
itc->itc_buf_cnt);
itc->itc_waitchan = itc;
if (tsleep((void *)itc->itc_waitchan,
if (tsleep(itc->itc_waitchan,
PCATCH, "fwohci it", 0) == EWOULDBLOCK) {
itc->itc_waitchan = NULL;
printf("fwohci0 signal\n");
@ -5745,7 +5747,7 @@ fwohci_it_ctx_writedata(ieee1394_it_tag_t it, int ndata,
#endif
if (itc->itc_buf_linkend != itc->itc_buf_end
&& fwohci_itd_hasdata(itc->itc_buf_end)) {
struct fwohci_it_dmabuf *itdn = itc->itc_buf_linkend;
volatile struct fwohci_it_dmabuf *itdn = itc->itc_buf_linkend;
INC_BUF(itc, itdn);
printf("connecting %d after %d\n",
@ -5793,8 +5795,8 @@ fwohci_it_ctx_run(struct fwohci_it_ctx *itc)
{
struct fwohci_softc *sc = itc->itc_sc;
int ctx = itc->itc_num;
struct fwohci_it_dmabuf *itd
= (struct fwohci_it_dmabuf *)itc->itc_buf_start;
volatile struct fwohci_it_dmabuf *itd =
(volatile struct fwohci_it_dmabuf *)itc->itc_buf_start;
u_int32_t reg;
int i;
@ -5811,7 +5813,7 @@ fwohci_it_ctx_run(struct fwohci_it_ctx *itc)
itd->itd_lastdesc->fd_branch = 0;
if (itc->itc_buf_cnt > 1) {
struct fwohci_it_dmabuf *itdn = itd;
volatile struct fwohci_it_dmabuf *itdn = itd;
#if 0
INC_BUF(itc, itdn);
@ -6008,7 +6010,7 @@ fwohci_it_ctx_flush(ieee1394_it_tag_t it)
static void
fwohci_it_intr(struct fwohci_softc *sc, struct fwohci_it_ctx *itc)
{
struct fwohci_it_dmabuf *itd, *newstartbuf;
volatile struct fwohci_it_dmabuf *itd, *newstartbuf;
u_int16_t scratchval;
u_int32_t reg;
@ -6061,10 +6063,11 @@ fwohci_it_intr(struct fwohci_softc *sc, struct fwohci_it_ctx *itc)
itc->itc_buf_start->itd_num, itc->itc_buf_end->itd_num,
itc->itc_buf_cnt);
{
u_int32_t reg
u_int32_t xreg
= OHCI_CSR_READ(sc, OHCI_REG_IsochronousCycleTimer);
printf("\t\tIsoCounter 0x%08x, %d %d %d\n", reg,
(reg >> 25) & 0xfe, (reg >> 12) & 0x1fff, reg & 0xfff);
(xreg >> 25) & 0xfe, (xreg >> 12) & 0x1fff,
xreg & 0xfff);
}
printf("\t\tbranch of lastdesc 0x%08x\n",
itc->itc_buf_start->itd_lastdesc->fd_branch);
@ -6083,7 +6086,7 @@ fwohci_it_intr(struct fwohci_softc *sc, struct fwohci_it_ctx *itc)
INC_BUF(itc, newstartbuf);
}
itd = (struct fwohci_it_dmabuf *)itc->itc_buf_start;
itd = itc->itc_buf_start;
itc->itc_buf_start = newstartbuf;
while (itd != newstartbuf) {
itc->itc_outpkt += itd->itd_npacket;
@ -6133,7 +6136,7 @@ fwohci_it_intr(struct fwohci_softc *sc, struct fwohci_it_ctx *itc)
/* send message */
if (itc->itc_waitchan != NULL) {
wakeup((void *)itc->itc_waitchan);
wakeup(itc->itc_waitchan);
}
return;
@ -6189,7 +6192,7 @@ fwohci_it_intr(struct fwohci_softc *sc, struct fwohci_it_ctx *itc)
/* link if some valid DMA buffers exist */
if (itc->itc_buf_cnt > 1
&& itc->itc_buf_linkend != itc->itc_buf_end) {
struct fwohci_it_dmabuf *itdprev;
volatile struct fwohci_it_dmabuf *itdprev;
int i;
DPRINTF(("CTX %d: start linkend dataend bufs %d, %d, %d, %d\n",
@ -6242,7 +6245,7 @@ fwohci_it_intr(struct fwohci_softc *sc, struct fwohci_it_ctx *itc)
itc->itc_buf_cnt));
}
} else {
struct fwohci_it_dmabuf *le;
volatile struct fwohci_it_dmabuf *le;
le = itc->itc_buf_linkend;
@ -6261,7 +6264,7 @@ fwohci_it_intr(struct fwohci_softc *sc, struct fwohci_it_ctx *itc)
/* send message */
if (itc->itc_waitchan != NULL) {
/* */
wakeup((void *)itc->itc_waitchan);
wakeup(itc->itc_waitchan);
}
}
@ -6589,7 +6592,8 @@ fwohci_itd_dmabuf_free(struct fwohci_it_dmabuf *itd)
* error happens, return a negative value.
*/
int
fwohci_itd_link(struct fwohci_it_dmabuf *itd, struct fwohci_it_dmabuf *itdc)
fwohci_itd_link(volatile struct fwohci_it_dmabuf *itd,
volatile struct fwohci_it_dmabuf *itdc)
{
struct fwohci_desc *fd1, *fdc;
@ -6656,7 +6660,7 @@ fwohci_itd_link(struct fwohci_it_dmabuf *itd, struct fwohci_it_dmabuf *itdc)
* arguent.
*/
int
fwohci_itd_unlink(struct fwohci_it_dmabuf *itd)
fwohci_itd_unlink(volatile struct fwohci_it_dmabuf *itd)
{
struct fwohci_desc *fd;
@ -6693,7 +6697,7 @@ fwohci_itd_unlink(struct fwohci_it_dmabuf *itd)
* negative value if an error happens
*/
int
fwohci_itd_writedata(struct fwohci_it_dmabuf *itd, int ndata,
fwohci_itd_writedata(volatile struct fwohci_it_dmabuf *itd, int ndata,
struct ieee1394_it_datalist *itdata)
{
int writepkt;
@ -6848,7 +6852,7 @@ fwohci_itd_writedata(struct fwohci_it_dmabuf *itd, int ndata,
int
fwohci_itd_isfilled(struct fwohci_it_dmabuf *itd)
fwohci_itd_isfilled(volatile struct fwohci_it_dmabuf *itd)
{
return itd->itd_npacket*2 > itd->itd_maxpacket ? 1 : 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fwohcivar.h,v 1.22 2005/02/27 00:27:17 perry Exp $ */
/* $NetBSD: fwohcivar.h,v 1.23 2005/05/31 00:46:46 christos Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -250,15 +250,14 @@ struct fwohci_it_ctx {
#if 1
volatile struct fwohci_it_dmabuf *itc_buf_start;
struct fwohci_it_dmabuf *itc_buf_end;
struct fwohci_it_dmabuf *itc_buf_linkend;
#endif
volatile int16_t itc_buf_cnt; /* # buffers which contain data */
#if 0
volatile struct fwohci_it_dmabuf *itc_buf_end;
volatile struct fwohci_it_dmabuf *itc_buf_linkend;
#else
int16_t itc_bufidx_start;
int16_t itc_bufidx_end;
int16_t itc_bufidx_linkend;
#endif
volatile int16_t itc_buf_cnt; /* # buffers which contain data */
/* data for descriptor */
bus_dma_segment_t itc_dseg;