version 1.7, 2003/08/07 16:31:14 |
version 1.7.8.1, 2005/04/29 11:29:14 |
Line 78 __KERNEL_RCSID(0, "$NetBSD$"); |
|
Line 78 __KERNEL_RCSID(0, "$NetBSD$"); |
|
static int dmc_timeout = 20; |
static int dmc_timeout = 20; |
|
|
#define NRCV 7 |
#define NRCV 7 |
#define NXMT 3 |
#define NXMT 3 |
#define NCMDS (NRCV+NXMT+4) /* size of command queue */ |
#define NCMDS (NRCV+NXMT+4) /* size of command queue */ |
|
|
#define DMC_WBYTE(csr, val) \ |
#define DMC_WBYTE(csr, val) \ |
Line 198 CFATTACH_DECL(dmc, sizeof(struct dmc_sof |
|
Line 198 CFATTACH_DECL(dmc, sizeof(struct dmc_sof |
|
(qp)->qp_next = (head); \ |
(qp)->qp_next = (head); \ |
(head) = (qp); \ |
(head) = (qp); \ |
if ((tail) == (struct dmc_command *) 0) \ |
if ((tail) == (struct dmc_command *) 0) \ |
(tail) = (head) |
(tail) = (head) |
|
|
#define QUEUE_AT_TAIL(qp, head, tail) \ |
#define QUEUE_AT_TAIL(qp, head, tail) \ |
if ((tail)) \ |
if ((tail)) \ |
Line 313 dmcinit(struct ifnet *ifp) |
|
Line 313 dmcinit(struct ifnet *ifp) |
|
* Check to see that an address has been set |
* Check to see that an address has been set |
* (both local and destination for an address family). |
* (both local and destination for an address family). |
*/ |
*/ |
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) |
IFADDR_FOREACH(ifa, ifp) |
if (ifa->ifa_addr->sa_family && ifa->ifa_dstaddr->sa_family) |
if (ifa->ifa_addr->sa_family && ifa->ifa_dstaddr->sa_family) |
break; |
break; |
if (ifa == (struct ifaddr *) 0) |
if (ifa == (struct ifaddr *) 0) |
Line 358 dmcinit(struct ifnet *ifp) |
|
Line 358 dmcinit(struct ifnet *ifp) |
|
rp->ubinfo = ifrw->ifrw_info; |
rp->ubinfo = ifrw->ifrw_info; |
rp->cc = DMCMTU + sizeof (struct dmc_header); |
rp->cc = DMCMTU + sizeof (struct dmc_header); |
rp->flags = DBUF_OURS|DBUF_RCV; |
rp->flags = DBUF_OURS|DBUF_RCV; |
ifrw++; |
ifrw++; |
} |
} |
/* transmits */ |
/* transmits */ |
ifxp = &sc->sc_ifw[0]; |
ifxp = &sc->sc_ifw[0]; |
Line 366 dmcinit(struct ifnet *ifp) |
|
Line 366 dmcinit(struct ifnet *ifp) |
|
rp->ubinfo = ifxp->ifw_info; |
rp->ubinfo = ifxp->ifw_info; |
rp->cc = 0; |
rp->cc = 0; |
rp->flags = DBUF_OURS|DBUF_XMIT; |
rp->flags = DBUF_OURS|DBUF_XMIT; |
ifxp++; |
ifxp++; |
} |
} |
|
|
/* set up command queues */ |
/* set up command queues */ |
Line 447 dmcstart(struct ifnet *ifp) |
|
Line 447 dmcstart(struct ifnet *ifp) |
|
rp->cc &= DMC_CCOUNT; |
rp->cc &= DMC_CCOUNT; |
if (++sc->sc_oused == 1) |
if (++sc->sc_oused == 1) |
sc->sc_if.if_timer = dmc_timeout; |
sc->sc_if.if_timer = dmc_timeout; |
dmcload(sc, DMC_WRITE, rp->ubinfo, |
dmcload(sc, DMC_WRITE, rp->ubinfo, |
rp->cc | ((rp->ubinfo>>2)&DMC_XMEM)); |
rp->cc | ((rp->ubinfo>>2)&DMC_XMEM)); |
} |
} |
n++; |
n++; |
Line 474 dmcload(struct dmc_softc *sc, int type, |
|
Line 474 dmcload(struct dmc_softc *sc, int type, |
|
qp->qp_cmd = (type | DMC_RQI); |
qp->qp_cmd = (type | DMC_RQI); |
qp->qp_ubaddr = w0; |
qp->qp_ubaddr = w0; |
qp->qp_cc = w1; |
qp->qp_cc = w1; |
|
|
if (sc->sc_qactive) { /* command in progress */ |
if (sc->sc_qactive) { /* command in progress */ |
if (type == DMC_READ) { |
if (type == DMC_READ) { |
QUEUE_AT_HEAD(qp, sc->sc_qhead, sc->sc_qtail); |
QUEUE_AT_HEAD(qp, sc->sc_qhead, sc->sc_qtail); |
Line 548 dmcrint(void *arg) |
|
Line 548 dmcrint(void *arg) |
|
void |
void |
dmcxint(void *a) |
dmcxint(void *a) |
{ |
{ |
struct dmc_softc *sc = a; |
struct dmc_softc *sc = a; |
|
|
struct ifnet *ifp; |
struct ifnet *ifp; |
struct mbuf *m; |
struct mbuf *m; |
Line 574 dmcxint(void *a) |
|
Line 574 dmcxint(void *a) |
|
|
|
case DMC_OUR: |
case DMC_OUR: |
/* |
/* |
* A read has completed. |
* A read has completed. |
* Pass packet to type specific |
* Pass packet to type specific |
* higher-level input routine. |
* higher-level input routine. |
*/ |
*/ |
Line 648 dmcxint(void *a) |
|
Line 648 dmcxint(void *a) |
|
/* is this needed? */ |
/* is this needed? */ |
rp->ubinfo = ifrw->ifrw_info; |
rp->ubinfo = ifrw->ifrw_info; |
|
|
dmcload(sc, DMC_READ, rp->ubinfo, |
dmcload(sc, DMC_READ, rp->ubinfo, |
((rp->ubinfo >> 2) & DMC_XMEM) | rp->cc); |
((rp->ubinfo >> 2) & DMC_XMEM) | rp->cc); |
break; |
break; |
|
|
Line 748 dmcxint(void *a) |
|
Line 748 dmcxint(void *a) |
|
break; |
break; |
|
|
default: |
default: |
printf("%s: bad control %o\n", |
printf("%s: bad control %o\n", |
sc->sc_dev.dv_xname, cmd); |
sc->sc_dev.dv_xname, cmd); |
break; |
break; |
} |
} |
Line 845 dmcioctl(struct ifnet *ifp, u_long cmd, |
|
Line 845 dmcioctl(struct ifnet *ifp, u_long cmd, |
|
case SIOCSIFADDR: |
case SIOCSIFADDR: |
ifp->if_flags |= IFF_UP; |
ifp->if_flags |= IFF_UP; |
if ((ifp->if_flags & IFF_RUNNING) == 0) |
if ((ifp->if_flags & IFF_RUNNING) == 0) |
dmcinit(ifp); |
dmcinit(ifp); |
break; |
break; |
|
|
case SIOCSIFDSTADDR: |
case SIOCSIFDSTADDR: |
if ((ifp->if_flags & IFF_RUNNING) == 0) |
if ((ifp->if_flags & IFF_RUNNING) == 0) |
dmcinit(ifp); |
dmcinit(ifp); |
break; |
break; |
|
|
case SIOCSIFFLAGS: |
case SIOCSIFFLAGS: |
if ((ifp->if_flags & IFF_UP) == 0 && |
if ((ifp->if_flags & IFF_UP) == 0 && |
sc->sc_flag & DMC_RUNNING) |
sc->sc_flag & DMC_RUNNING) |
|
|
dmcrestart(struct dmc_softc *sc) |
dmcrestart(struct dmc_softc *sc) |
{ |
{ |
int s, i; |
int s, i; |
|
|
#ifdef DMCDEBUG |
#ifdef DMCDEBUG |
/* dump base table */ |
/* dump base table */ |
printf("%s base table:\n", sc->sc_dev.dv_xname); |
printf("%s base table:\n", sc->sc_dev.dv_xname); |