Update for bcopy/bzero -> memcpy/memset changes.

This commit is contained in:
thorpej 1998-10-01 20:05:09 +00:00
parent 629696b60c
commit 8253135408
5 changed files with 74 additions and 62 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie.c,v 1.27 1998/08/15 03:02:44 mycroft Exp $ */
/* $NetBSD: if_ie.c,v 1.28 1998/10/01 20:05:09 thorpej Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
@ -398,18 +398,18 @@ ie_setupram(sc)
/* SCP (address already chosen). */
scp = sc->scp;
(sc->sc_bzero)((char *) scp, sizeof(*scp));
(sc->sc_memset)((char *) scp, 0, sizeof(*scp));
/* ISCP */
off -= sizeof(*iscp);
iscp = (volatile void *) (sc->buf_area + off);
(sc->sc_bzero)((char *) iscp, sizeof(*iscp));
(sc->sc_memset)((char *) iscp, 0, sizeof(*iscp));
sc->iscp = iscp;
/* SCB */
off -= sizeof(*scb);
scb = (volatile void *) (sc->buf_area + off);
(sc->sc_bzero)((char *) scb, sizeof(*scb));
(sc->sc_memset)((char *) scb, 0, sizeof(*scb));
sc->scb = scb;
/* Remainder is for buffers, etc. */
@ -936,7 +936,7 @@ ieget(sc, ehp, to_bpf)
/*
* Snarf the Ethernet header.
*/
(sc->sc_bcopy)((caddr_t)sc->cbuffs[head], (caddr_t)ehp, sizeof *ehp);
(sc->sc_memcpy)((caddr_t)ehp, (caddr_t)sc->cbuffs[head], sizeof(*ehp));
/*
* As quickly as possible, check if this packet is for us.
@ -1000,8 +1000,9 @@ ieget(sc, ehp, to_bpf)
int thismblen = m->m_len - thismboff;
len = min(thisrblen, thismblen);
(sc->sc_bcopy)((caddr_t)(sc->cbuffs[head] + thisrboff),
mtod(m, caddr_t) + thismboff, (u_int)len);
(sc->sc_memcpy)(mtod(m, caddr_t) + thismboff,
(caddr_t)(sc->cbuffs[head] + thisrboff),
(u_int)len);
resid -= len;
if (len == thismblen) {
@ -1195,7 +1196,7 @@ iestart(ifp)
buffer = sc->xmit_cbuffs[sc->xchead];
for (m = m0; m != 0; m = m->m_next) {
(sc->sc_bcopy)(mtod(m, caddr_t), buffer, m->m_len);
(sc->sc_memcpy)(buffer, mtod(m, caddr_t), m->m_len);
buffer += m->m_len;
}
len = max(m0->m_pkthdr.len, ETHER_MIN_LEN);
@ -1373,7 +1374,7 @@ iememinit(sc)
/* First, zero all the memory. */
ptr = sc->buf_area;
(sc->sc_bzero)(ptr, sc->buf_area_sz);
(sc->sc_memset)(ptr, 0, sc->buf_area_sz);
/* Allocate tx/rx buffers. */
for (i = 0; i < NTXBUF; i++) {
@ -1482,7 +1483,8 @@ mc_setup(sc, ptr)
cmd->com.ie_cmd_cmd = IE_CMD_MCAST | IE_CMD_LAST;
cmd->com.ie_cmd_link = SWAP(0xffff);
(sc->sc_bcopy)((caddr_t)sc->mcast_addrs, (caddr_t)cmd->ie_mcast_addrs,
(sc->sc_memcpy)((caddr_t)cmd->ie_mcast_addrs,
(caddr_t)sc->mcast_addrs,
sc->mcast_count * sizeof *sc->mcast_addrs);
cmd->ie_mcast_bytes =
@ -1571,8 +1573,8 @@ ieinit(sc)
cmd->com.ie_cmd_cmd = IE_CMD_IASETUP | IE_CMD_LAST;
cmd->com.ie_cmd_link = SWAP(0xffff);
(sc->sc_bcopy)(LLADDR(ifp->if_sadl),
(caddr_t)&cmd->ie_address, sizeof(cmd->ie_address));
(sc->sc_memcpy)((caddr_t)&cmd->ie_address,
LLADDR(ifp->if_sadl), sizeof(cmd->ie_address));
if (cmd_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
!(cmd->com.ie_cmd_status & IE_STAT_OK)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie_obio.c,v 1.14 1998/07/05 00:51:14 jonathan Exp $ */
/* $NetBSD: if_ie_obio.c,v 1.15 1998/10/01 20:05:10 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -115,8 +115,8 @@ ie_obio_attach(parent, self, args)
sc->reset_586 = ie_obreset;
sc->chan_attn = ie_obattend;
sc->run_586 = ie_obrun;
sc->sc_bcopy = bcopy;
sc->sc_bzero = bzero;
sc->sc_memcpy = memcpy;
sc->sc_memset = memset;
/* Map in the control registers. */
sc->sc_reg = bus_mapin(ca->ca_bustype,

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie_sebuf.c,v 1.5 1998/07/05 00:51:14 jonathan Exp $ */
/* $NetBSD: if_ie_sebuf.c,v 1.6 1998/10/01 20:05:10 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -78,8 +78,8 @@ static void ie_sebuf_run __P((struct ie_softc *));
* zero/copy functions: OBIO can use the normal functions, but VME
* must do only byte or half-word (16 bit) accesses...
*/
static void wcopy __P((const void *vb1, void *vb2, u_int l));
static void wzero __P((void *vb, u_int l));
static void *wmemcpy __P((void *dst, const void *src, size_t size));
static void *wmemset __P((void *dst, int val, size_t size));
/*
@ -126,8 +126,8 @@ ie_sebuf_attach(parent, self, args)
sc->reset_586 = ie_sebuf_reset;
sc->chan_attn = ie_sebuf_attend;
sc->run_586 = ie_sebuf_run;
sc->sc_bcopy = wcopy;
sc->sc_bzero = wzero;
sc->sc_memcpy = wmemcpy;
sc->sc_memset = wmemset;
/* Control regs mapped by parent. */
sc->sc_reg = aa->regs;
@ -152,7 +152,7 @@ ie_sebuf_attach(parent, self, args)
sc->sc_maddr = aa->buf;
/* Clear the memory. */
(sc->sc_bzero)(sc->sc_maddr, sc->sc_msize);
(sc->sc_memset)(sc->sc_maddr, 0, sc->sc_msize);
/*
* XXX: Unfortunately, the common driver code
@ -230,52 +230,55 @@ ie_sebuf_run(sc)
}
/*
* wcopy/wzero - like bcopy/bzero but largest access is 16-bits,
* wmemcpy/wmemset - like memcpy/memset but largest access is 16-bits,
* and also does byte swaps...
* XXX - Would be nice to have asm versions in some library...
*/
static void
wzero(vb, l)
static void *
wmemset(vb, val, l)
void *vb;
u_int l;
int val;
size_t l;
{
u_char *b = vb;
u_char *be = b + l;
u_short *sp;
if (l == 0)
return;
return (vb);
/* front, */
if ((u_long)b & 1)
*b++ = 0;
*b++ = val;
/* back, */
if (b != be && ((u_long)be & 1) != 0) {
be--;
*be = 0;
*be = val;
}
/* and middle. */
sp = (u_short *)b;
while (sp != (u_short *)be)
*sp++ = 0;
*sp++ = val;
return (vb);
}
static void
wcopy(vb1, vb2, l)
const void *vb1;
void *vb2;
u_int l;
static void *
wmemcpy(dst, src, l)
void *dst;
const void *src;
size_t l;
{
const u_char *b1e, *b1 = vb1;
u_char *b2 = vb2;
const u_char *b1e, *b1 = src;
u_char *b2 = dst;
u_short *sp;
int bstore = 0;
if (l == 0)
return;
return (dst);
/* front, */
if ((u_long)b1 & 1) {
@ -303,4 +306,6 @@ wcopy(vb1, vb2, l)
/* and back. */
if (l & 1)
*b2 = *b1e;
return (dst);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie_vme.c,v 1.12 1998/07/05 00:51:14 jonathan Exp $ */
/* $NetBSD: if_ie_vme.c,v 1.13 1998/10/01 20:05:11 thorpej Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -76,8 +76,8 @@ static void ie_vmerun __P((struct ie_softc *));
* zero/copy functions: OBIO can use the normal functions, but VME
* must do only byte or half-word (16 bit) accesses...
*/
static void wcopy __P((const void *vb1, void *vb2, u_int l));
static void wzero __P((void *vb, u_int l));
static void *wmemcpy __P((void *dst, const void *src, size_t size));
static void *wmemset __P((void *dst, int val, size_t size));
/*
@ -136,8 +136,8 @@ ie_vme_attach(parent, self, args)
sc->reset_586 = ie_vmereset;
sc->chan_attn = ie_vmeattend;
sc->run_586 = ie_vmerun;
sc->sc_bcopy = wcopy;
sc->sc_bzero = wzero;
sc->sc_memcpy = wmemcpy;
sc->sc_memset = wmemset;
/*
* There is 64K of memory on the VME board.
@ -171,7 +171,7 @@ ie_vme_attach(parent, self, args)
iev->pectrl |= IEVME_PARACK; /* clear to start */
for (lcv = 0; lcv < IEVME_MAPSZ; lcv++)
iev->pgmap[lcv] = IEVME_SBORDR | IEVME_OBMEM | lcv;
(sc->sc_bzero)(sc->sc_maddr, sc->sc_msize);
(sc->sc_memset)(sc->sc_maddr, 0, sc->sc_msize);
/*
* Set the System Configuration Pointer (SCP).
@ -235,52 +235,55 @@ ie_vmerun(sc)
}
/*
* wcopy/wzero - like bcopy/bzero but largest access is 16-bits,
* wmemcpy/wmemset - like memcpy/memset but largest access is 16-bits,
* and also does byte swaps...
* XXX - Would be nice to have asm versions in some library...
*/
static void
wzero(vb, l)
static void *
wmemset(vb, val, l)
void *vb;
u_int l;
int val;
size_t l;
{
u_char *b = vb;
u_char *be = b + l;
u_short *sp;
if (l == 0)
return;
return (vb);
/* front, */
if ((u_long)b & 1)
*b++ = 0;
*b++ = val;
/* back, */
if (b != be && ((u_long)be & 1) != 0) {
be--;
*be = 0;
*be = val;
}
/* and middle. */
sp = (u_short *)b;
while (sp != (u_short *)be)
*sp++ = 0;
*sp++ = val;
return (vb);
}
static void
wcopy(vb1, vb2, l)
const void *vb1;
void *vb2;
u_int l;
static void *
wmemcpy(dst, src, l)
void *dst;
const void *src;
size_t l;
{
const u_char *b1e, *b1 = vb1;
u_char *b2 = vb2;
const u_char *b1e, *b1 = src;
u_char *b2 = dst;
u_short *sp;
int bstore = 0;
if (l == 0)
return;
return (dst);
/* front, */
if ((u_long)b1 & 1) {
@ -308,4 +311,6 @@ wcopy(vb1, vb2, l)
/* and back. */
if (l & 1)
*b2 = *b1e;
return (dst);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ievar.h,v 1.9 1997/03/15 18:10:53 is Exp $ */
/* $NetBSD: if_ievar.h,v 1.10 1998/10/01 20:05:11 thorpej Exp $ */
/*
* Machine-dependent glue for the Intel Ethernet (ie) driver.
@ -69,8 +69,8 @@ struct ie_softc {
void (*reset_586) __P((struct ie_softc *));
void (*chan_attn) __P((struct ie_softc *));
void (*run_586) __P((struct ie_softc *));
void (*sc_bcopy) __P((const void *, void *, u_int));
void (*sc_bzero) __P((void *, u_int));
void *(*sc_memcpy) __P((void *, const void *, size_t));
void *(*sc_memset) __P((void *, int, size_t));
caddr_t sc_iobase; /* KVA of base of 24bit addr space */
caddr_t sc_maddr; /* KVA of base of chip's RAM */