Make Econet code compile again.
This commit is contained in:
parent
913883b2cd
commit
12052c1959
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_eca.c,v 1.9 2008/12/16 22:35:21 christos Exp $ */
|
||||
/* $NetBSD: if_eca.c,v 1.10 2009/01/07 20:56:40 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Ben Harris
|
||||
|
@ -29,7 +29,7 @@
|
|||
|
||||
#include <sys/param.h>
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_eca.c,v 1.9 2008/12/16 22:35:21 christos Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_eca.c,v 1.10 2009/01/07 20:56:40 bjh21 Exp $");
|
||||
|
||||
#include <sys/device.h>
|
||||
#include <sys/malloc.h>
|
||||
|
@ -120,8 +120,8 @@ eca_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_ec.ec_claimwire = eca_claimwire;
|
||||
sc->sc_ec.ec_txframe = eca_txframe;
|
||||
|
||||
sc->sc_rx_soft = softintr_establish(IPL_SOFTNET, eca_gotframe, sc);
|
||||
sc->sc_tx_soft = softintr_establish(IPL_SOFTNET, eca_txdone, sc);
|
||||
sc->sc_rx_soft = softint_establish(IPL_SOFTNET, eca_gotframe, sc);
|
||||
sc->sc_tx_soft = softint_establish(IPL_SOFTNET, eca_txdone, sc);
|
||||
if (sc->sc_rx_soft == NULL || sc->sc_tx_soft == NULL) {
|
||||
printf("\n%s: failed to establish software interrupt\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
|
@ -232,7 +232,7 @@ eca_txframe(struct ifnet *ifp, struct mbuf *m)
|
|||
sc->sc_fiqstate.efs_fiqhandler = eca_fiqhandler_tx;
|
||||
sc->sc_transmitting = 1;
|
||||
sc->sc_txmbuf = m;
|
||||
fr.fr_r8 = (register_t)sc->sc_ioh.a1;
|
||||
fr.fr_r8 = (register_t)sc->sc_ioh;
|
||||
fr.fr_r9 = (register_t)sc->sc_txmbuf->m_data;
|
||||
fr.fr_r10 = (register_t)sc->sc_txmbuf->m_len;
|
||||
fr.fr_r11 = (register_t)&sc->sc_fiqstate;
|
||||
|
@ -289,7 +289,7 @@ eca_tx_downgrade(void)
|
|||
ioc_fiq_setmask(IOC_FIQ_BIT(FIQ_EFIQ));
|
||||
/* End code from eca_init_rx_hard(). */
|
||||
|
||||
softintr_schedule(sc->sc_tx_soft);
|
||||
softint_schedule(sc->sc_tx_soft);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -358,7 +358,7 @@ eca_init_rx_soft(struct eca_softc *sc)
|
|||
struct fiqregs *fr = &sc->sc_fiqstate.efs_rx_fiqregs;
|
||||
|
||||
memset(fr, 0, sizeof(*fr));
|
||||
fr->fr_r8 = (register_t)sc->sc_ioh.a1;
|
||||
fr->fr_r8 = (register_t)sc->sc_ioh;
|
||||
fr->fr_r9 = (register_t)sc->sc_rcvmbuf->m_data;
|
||||
fr->fr_r10 = (register_t)ECO_ADDR_LEN;
|
||||
fr->fr_r11 = (register_t)&sc->sc_fiqstate;
|
||||
|
@ -438,7 +438,7 @@ eca_rx_downgrade(void)
|
|||
struct eca_softc *sc = eca_fiqowner;
|
||||
|
||||
sc->sc_sr2 = bus_space_read_1(sc->sc_iot, sc->sc_ioh, MC6854_SR2);
|
||||
softintr_schedule(sc->sc_rx_soft);
|
||||
softint_schedule(sc->sc_rx_soft);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -473,7 +473,8 @@ eca_gotframe(void *arg)
|
|||
if (eca_init_rxbuf(sc, M_DONTWAIT) == 0) {
|
||||
ifp->if_ipackets++; /* XXX packet vs frame? */
|
||||
/* Trim the tail of the mbuf chain. */
|
||||
mtail->m_len = (void *)(fr.fr_r9) - mtail->m_data;
|
||||
mtail->m_len =
|
||||
(char *)(fr.fr_r9) - mtod(mtail, char *);
|
||||
m_freem(mtail->m_next);
|
||||
mtail->m_next = NULL;
|
||||
/* Set up the header of the chain. */
|
||||
|
@ -492,7 +493,7 @@ eca_gotframe(void *arg)
|
|||
mtail = sc->sc_fiqstate.efs_rx_curmbuf;
|
||||
log(LOG_ERR, "%s: Rx overrun (state = %d, len = %ld)\n",
|
||||
sc->sc_dev.dv_xname, sc->sc_ec.ec_state,
|
||||
(void *)(fr.fr_r9) - mtail->m_data);
|
||||
(char *)(fr.fr_r9) - mtod(mtail, char *));
|
||||
ifp->if_ierrors++;
|
||||
|
||||
/* Discard the rest of the frame. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_ecosubr.c,v 1.30 2008/12/17 20:51:36 cegger Exp $ */
|
||||
/* $NetBSD: if_ecosubr.c,v 1.31 2009/01/07 20:56:40 bjh21 Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 Ben Harris
|
||||
|
@ -58,7 +58,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ecosubr.c,v 1.30 2008/12/17 20:51:36 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_ecosubr.c,v 1.31 2009/01/07 20:56:40 bjh21 Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
#include "opt_inet.h"
|
||||
|
@ -98,7 +98,7 @@ struct eco_retryparms {
|
|||
/* Default broadcast address */
|
||||
static const uint8_t eco_broadcastaddr[] = { 0xff, 0xff };
|
||||
|
||||
static int eco_output(struct ifnet *, struct mbuf *, struct sockaddr *,
|
||||
static int eco_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
|
||||
struct rtentry *);
|
||||
static void eco_input(struct ifnet *, struct mbuf *);
|
||||
static void eco_start(struct ifnet *);
|
||||
|
@ -129,9 +129,7 @@ eco_ifattach(struct ifnet *ifp, const uint8_t *lla)
|
|||
ifp->if_ioctl = eco_ioctl;
|
||||
|
||||
/* ifp->if_baudrate...; */
|
||||
if_alloc_sadl(ifp);
|
||||
(void)sockaddr_dl_setaddr(ifp->if_sadl, ifp->if_sadl->sdl_len, lla,
|
||||
ifp->if_addrlen);
|
||||
if_set_sadl(ifp, lla, ECO_ADDR_LEN, FALSE);
|
||||
|
||||
ifp->if_broadcastaddr = eco_broadcastaddr;
|
||||
|
||||
|
@ -167,7 +165,7 @@ eco_stop(struct ifnet *ifp, int disable)
|
|||
}
|
||||
|
||||
static int
|
||||
eco_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
||||
eco_output(struct ifnet *ifp, struct mbuf *m0, const struct sockaddr *dst,
|
||||
struct rtentry *rt0)
|
||||
{
|
||||
struct eco_header ehdr, *eh;
|
||||
|
@ -181,6 +179,7 @@ eco_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
|||
#ifdef INET
|
||||
struct mbuf *m1;
|
||||
struct arphdr *ah;
|
||||
void *tha;
|
||||
struct eco_arp *ecah;
|
||||
#endif
|
||||
ALTQ_DECL(struct altq_pktattr pktattr;)
|
||||
|
@ -264,8 +263,11 @@ eco_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
|||
if (m->m_flags & M_BCAST)
|
||||
memcpy(ehdr.eco_dhost, eco_broadcastaddr,
|
||||
ECO_ADDR_LEN);
|
||||
else
|
||||
memcpy(ehdr.eco_dhost, ar_tha(ah), ECO_ADDR_LEN);
|
||||
else {
|
||||
tha = ar_tha(ah);
|
||||
KASSERT(tha != NULL);
|
||||
memcpy(ehdr.eco_dhost, tha, ECO_ADDR_LEN);
|
||||
}
|
||||
|
||||
MGETHDR(m1, M_DONTWAIT, MT_DATA);
|
||||
if (m1 == NULL)
|
||||
|
@ -286,8 +288,7 @@ eco_output(struct ifnet *ifp, struct mbuf *m0, struct sockaddr *dst,
|
|||
hdrcmplt = 1;
|
||||
/* FALLTHROUGH */
|
||||
case AF_UNSPEC:
|
||||
eh = (struct eco_header *)dst->sa_data;
|
||||
ehdr = *eh;
|
||||
ehdr = *(struct eco_header const *)dst->sa_data;
|
||||
break;
|
||||
default:
|
||||
log(LOG_ERR, "%s: can't handle af%d\n", ifp->if_xname,
|
||||
|
@ -365,6 +366,7 @@ eco_input(struct ifnet *ifp, struct mbuf *m)
|
|||
struct arphdr *ah;
|
||||
struct eco_arp *ecah;
|
||||
struct mbuf *m1;
|
||||
void *tha;
|
||||
#endif
|
||||
|
||||
#ifdef PFIL_HOOKS
|
||||
|
@ -423,8 +425,10 @@ eco_input(struct ifnet *ifp, struct mbuf *m)
|
|||
ah->ar_op = htons(ARPOP_REQUEST);
|
||||
else
|
||||
ah->ar_op = htons(ARPOP_REPLY);
|
||||
tha = ar_tha(ah);
|
||||
KASSERT(tha != NULL);
|
||||
memcpy(ar_sha(ah), eh->eco_shost, ah->ar_hln);
|
||||
memcpy(ar_tha(ah), eh->eco_dhost, ah->ar_hln);
|
||||
memcpy(tha, eh->eco_dhost, ah->ar_hln);
|
||||
memcpy(ar_spa(ah), ecah->ecar_spa, ah->ar_pln);
|
||||
memcpy(ar_tpa(ah), ecah->ecar_tpa, ah->ar_pln);
|
||||
m_freem(m);
|
||||
|
@ -521,7 +525,6 @@ eco_start(struct ifnet *ifp)
|
|||
static int
|
||||
eco_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
||||
{
|
||||
struct ifreq *ifr = (struct ifreq *)data;
|
||||
struct ifaddr *ifa = (struct ifaddr *)data;
|
||||
int error;
|
||||
|
||||
|
@ -542,7 +545,7 @@ eco_ioctl(struct ifnet *ifp, u_long cmd, void *data)
|
|||
}
|
||||
return 0;
|
||||
case SIOCSIFMTU:
|
||||
if ((error = ifioctl_common(ifp, command, data)) != ENETRESET)
|
||||
if ((error = ifioctl_common(ifp, cmd, data)) != ENETRESET)
|
||||
return error;
|
||||
else if (ifp->if_flags & IFF_UP)
|
||||
return (*ifp->if_init)(ifp);
|
||||
|
@ -739,7 +742,7 @@ eco_immediate(struct ifnet *ifp, struct mbuf *m)
|
|||
ECO_ADDR_LEN);
|
||||
memcpy(reh->eco_shost, CLLADDR(ifp->if_sadl),
|
||||
ECO_ADDR_LEN);
|
||||
memcpy(mtod(n, void *) + ECO_SHDR_LEN, machinepeek_data,
|
||||
memcpy(mtod(n, char *) + ECO_SHDR_LEN, machinepeek_data,
|
||||
sizeof(machinepeek_data));
|
||||
m_freem(m);
|
||||
return n;
|
||||
|
|
Loading…
Reference in New Issue