Fixes to make "ie" work (from Chuck Silvers -- Thanks!)

This commit is contained in:
gwr 1994-12-15 21:08:06 +00:00
parent 6b1a9a5ff9
commit 0402f426b8
4 changed files with 50 additions and 66 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie.c,v 1.1 1994/12/12 18:59:07 gwr Exp $ */
/* $NetBSD: if_ie.c,v 1.2 1994/12/15 21:08:06 gwr Exp $ */
/*-
* Copyright (c) 1993, 1994 Charles Hannum.
@ -209,8 +209,6 @@ struct cfdriver iecd = {
u_char *t = (u_char *)&(to), *f = (u_char *)&fval; \
t[0] = f[3]; t[1] = f[2]; t[2] = f[1]; /*t[3] = f[0];*/ \
}
#define MEM sc->sc_maddr
/*
* zero/copy functions: OBIO can use the normal functions, but VME
* must do only byte or half-word (16 bit) accesses...
@ -270,7 +268,7 @@ ie_ack(sc, mask)
* then modified beyond recognition...
*/
void
ieattach(parent, self, aux)
ie_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
@ -314,7 +312,6 @@ ieattach(parent, self, aux)
bpfattach(&ifp->if_bpf, ifp, DLT_EN10MB,
sizeof(struct ether_header));
#endif
}
}
/*
@ -432,9 +429,10 @@ ierint(sc)
} else {
if ((status & IE_FD_RNR) != 0 &&
(scb->ie_status & IE_RU_READY) == 0) {
sc->rframes[0]->ie_fd_next = MK_16(MEM,
sc->rbuffs[0]);
scb->ie_recv_list = MK_16(MEM, sc->rframes[0]);
sc->rframes[0]->ie_fd_next =
MK_16(sc->sc_maddr, sc->rbuffs[0]);
scb->ie_recv_list =
MK_16(sc->sc_maddr, sc->rframes[0]);
command_and_wait(sc, IE_RU_START, 0, 0);
}
break;
@ -514,7 +512,7 @@ iernr(sc)
command_and_wait(sc, IE_RU_DISABLE, 0, 0); /* just in case */
setup_bufs(sc);
sc->scb->ie_recv_list = MK_16(MEM, sc->rframes[0]);
sc->scb->ie_recv_list = MK_16(sc->sc_maddr, sc->rframes[0]);
command_and_wait(sc, IE_RU_START, 0, 0); /* was ENABLE */
ie_ack(sc, IE_ST_WHENCE);
@ -1044,14 +1042,14 @@ iestart(ifp)
IE_XMIT_LAST | SWAP(len);
sc->xmit_buffs[sc->xmit_count]->ie_xmit_next = SWAP(0xffff);
ST_24(sc->xmit_buffs[sc->xmit_count]->ie_xmit_buf,
MK_24(MEM, sc->xmit_cbuffs[sc->xmit_count]));
MK_24(sc->sc_iobase, sc->xmit_cbuffs[sc->xmit_count]));
sc->xmit_cmds[sc->xmit_count]->com.ie_cmd_cmd = IE_CMD_XMIT;
sc->xmit_cmds[sc->xmit_count]->ie_xmit_status = SWAP(0);
sc->xmit_cmds[sc->xmit_count]->ie_xmit_desc =
MK_16(MEM, sc->xmit_buffs[sc->xmit_count]);
MK_16(sc->sc_maddr, sc->xmit_buffs[sc->xmit_count]);
*bptr = MK_16(MEM, sc->xmit_cmds[sc->xmit_count]);
*bptr = MK_16(sc->sc_maddr, sc->xmit_cmds[sc->xmit_count]);
bptr = &sc->xmit_cmds[sc->xmit_count]->com.ie_cmd_link;
} while (++sc->xmit_count < NTXBUF);
@ -1236,7 +1234,7 @@ run_tdr(sc, cmd)
cmd->com.ie_cmd_cmd = IE_CMD_TDR | IE_CMD_LAST;
cmd->com.ie_cmd_link = SWAP(0xffff);
sc->scb->ie_command_list = MK_16(MEM, cmd);
sc->scb->ie_command_list = MK_16(sc->sc_maddr, cmd);
cmd->ie_tdr_time = SWAP(0);
if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
@ -1272,7 +1270,7 @@ start_receiver(sc)
{
int s = splimp();
sc->scb->ie_recv_list = MK_16(MEM, sc->rframes[0]);
sc->scb->ie_recv_list = MK_16(sc->sc_maddr, sc->rframes[0]);
command_and_wait(sc, IE_RU_START, 0, 0);
ie_ack(sc, IE_ST_WHENCE);
@ -1350,7 +1348,7 @@ setup_bufs(sc)
*/
for (n = 0; n < sc->nframes; n++) {
sc->rframes[n]->ie_fd_next =
MK_16(MEM, sc->rframes[(n + 1) % sc->nframes]);
MK_16(sc->sc_maddr, sc->rframes[(n + 1) % sc->nframes]);
}
sc->rframes[sc->nframes - 1]->ie_fd_last |= IE_FD_LAST;
@ -1372,7 +1370,7 @@ setup_bufs(sc)
*/
for (n = 0; n < sc->nrxbuf; n++) {
sc->rbuffs[n]->ie_rbd_next =
MK_16(MEM, sc->rbuffs[(n + 1) % sc->nrxbuf]);
MK_16(sc->sc_maddr, sc->rbuffs[(n + 1) % sc->nrxbuf]);
}
sc->rbuffs[sc->nrxbuf - 1]->ie_rbd_length |= IE_RBD_LAST;
@ -1388,7 +1386,7 @@ setup_bufs(sc)
for (n = 0; n < sc->nrxbuf; n++) {
sc->cbuffs[n] = (char *) ptr; /* XXX why char vs uchar? */
sc->rbuffs[n]->ie_rbd_length = SWAP(IE_RBUF_SIZE);
ST_24(sc->rbuffs[n]->ie_rbd_buffer, MK_24(MEM, ptr));
ST_24(sc->rbuffs[n]->ie_rbd_buffer, MK_24(sc->sc_iobase, ptr));
ptr = Align(ptr + IE_RBUF_SIZE);
}
@ -1403,8 +1401,8 @@ setup_bufs(sc)
sc->rbhead = 0;
sc->rbtail = sc->nrxbuf - 1;
sc->scb->ie_recv_list = MK_16(MEM, sc->rframes[0]);
sc->rframes[0]->ie_fd_buf_desc = MK_16(MEM, sc->rbuffs[0]);
sc->scb->ie_recv_list = MK_16(sc->sc_maddr, sc->rframes[0]);
sc->rframes[0]->ie_fd_buf_desc = MK_16(sc->sc_maddr, sc->rbuffs[0]);
#ifdef IEDEBUG
printf("IE_DEBUG: reserved %d bytes\n", ptr - sc->buf_area);
@ -1432,7 +1430,7 @@ mc_setup(sc, ptr)
cmd->ie_mcast_bytes =
SWAP(sc->mcast_count * ETHER_ADDR_LEN); /* grrr... */
sc->scb->ie_command_list = MK_16(MEM, cmd);
sc->scb->ie_command_list = MK_16(sc->sc_maddr, cmd);
if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
!(cmd->com.ie_cmd_status & IE_STAT_OK)) {
printf("%s: multicast address setup command failed\n",
@ -1470,7 +1468,7 @@ ieinit(sc)
cmd->com.ie_cmd_cmd = IE_CMD_CONFIG | IE_CMD_LAST;
cmd->com.ie_cmd_link = SWAP(0xffff);
scb->ie_command_list = MK_16(MEM, cmd);
scb->ie_command_list = MK_16(sc->sc_maddr, cmd);
if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
!(cmd->com.ie_cmd_status & IE_STAT_OK)) {
@ -1492,7 +1490,7 @@ ieinit(sc)
(sc->memcopy)(sc->sc_arpcom.ac_enaddr,
(caddr_t)&cmd->ie_address, sizeof cmd->ie_address);
scb->ie_command_list = MK_16(MEM, cmd);
scb->ie_command_list = MK_16(sc->sc_maddr, cmd);
if (command_and_wait(sc, IE_CU_START, cmd, IE_STAT_COMPL) ||
!(cmd->com.ie_cmd_status & IE_STAT_OK)) {
printf("%s: individual address setup command failed\n",

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie_subr.c,v 1.2 1994/12/13 18:31:48 gwr Exp $ */
/* $NetBSD: if_ie_subr.c,v 1.3 1994/12/15 21:08:10 gwr Exp $ */
/*
* Copyright (c) 1994 Gordon W. Ross
@ -56,8 +56,9 @@
#include <machine/idprom.h>
/* #include <machine/vme.h> */
#include "if_iereg.h"
#include "i82586.h"
#include "if_ie.h"
#include "if_ie_subr.h"
static void ie_obreset __P((struct ie_softc *));
static void ie_obattend __P((struct ie_softc *));
@ -74,7 +75,7 @@ ie_md_match(parent, vcf, args)
{
struct cfdata *cf = vcf;
struct confargs *ca = args;
int x;
int x, sz;
switch (ca->ca_bustype) {
@ -112,7 +113,7 @@ ie_md_attach(parent, self, args)
{
struct ie_softc *sc = (void *) self;
struct confargs *ca = args;
caddr_t mem, reg;
caddr_t mem, reg, dvma_malloc();
/*
* *note*: we don't detect the difference between a VME3E and
@ -128,6 +129,7 @@ ie_md_attach(parent, self, args)
sc->run_586 = ie_obrun;
sc->memcopy = bcopy;
sc->memzero = bzero;
sc->sc_iobase = (caddr_t)0xf000000; /* XXX */
sc->sc_msize = 0x10000; /* XXX */
/* Map in the control register. */
@ -142,13 +144,13 @@ ie_md_attach(parent, self, args)
panic(": not enough dvma space");
sc->sc_maddr = mem;
sc->scp = (volatile struct ie_sys_conf_ptr *)
(sc->sc_iobase + IE_SCP_ADDR);
/* Install interrupt handler. */
isr_add_autovect(ie_intr, (void *)sc, ca->ca_intpri);
/* XXX - to do... */
printf("unsupported (for now)\n");
return;
break;
#if 0 /* not yet... */
case BUS_VME16: {
@ -176,6 +178,9 @@ ie_md_attach(parent, self, args)
sc->sc_iobase = sc->sc_maddr;
iev->pectrl = iev->pectrl | IEVME_PARACK; /* clear to start */
sc->scp = (volatile struct ie_sys_conf_ptr *)
(sc->sc_iobase + (IE_SCP_ADDR & (IEVME_PAGESIZE - 1)));
/*
* set up mappings, direct map except for last page
* which is mapped at zero and at high address (for
@ -187,26 +192,6 @@ ie_md_attach(parent, self, args)
iev->pgmap[IEVME_MAPSZ - 1] = IEVME_SBORDR | IEVME_OBMEM | 0;
(sc->memzero)(sc->sc_maddr, sc->sc_msize);
/*
* set up pointers to data structures and buffer area.
* scp is in double mapped page... get offset into page
* and add to sc_maddr.
*/
sc->scp = (volatile struct ie_sys_conf_ptr *)
(sc->sc_maddr + (IE_SCP_ADDR & (IEVME_PAGESIZE - 1)));
sc->iscp = (volatile struct ie_int_sys_conf_ptr *)
sc->sc_maddr; /* iscp @ location zero */
sc->scb = (volatile struct ie_sys_ctl_block *)
sc->sc_maddr + sizeof(struct ie_int_sys_conf_ptr);
/* scb follows iscp */
/*
* rest of first page is unused, rest of ram
* for buffers
*/
sc->buf_area = sc->sc_maddr + IEVME_PAGESIZE;
sc->buf_area_sz = sc->sc_msize - IEVME_PAGESIZE;
isr_add_vectored(ieintr, (void *)sc,
ca->ca_intpri,
ca->ca_intvec);
@ -220,6 +205,21 @@ ie_md_attach(parent, self, args)
return;
}
/*
* set up pointers to data structures and buffer area.
*/
sc->iscp = (volatile struct ie_int_sys_conf_ptr *)
sc->sc_maddr;
sc->scb = (volatile struct ie_sys_ctl_block *)
sc->sc_maddr + sizeof(struct ie_int_sys_conf_ptr);
/*
* rest of first page is unused, rest of ram
* for buffers
*/
sc->buf_area = sc->sc_maddr + IEVME_PAGESIZE;
sc->buf_area_sz = sc->sc_msize - IEVME_PAGESIZE;
idprom_etheraddr(sc->sc_addr); /* ethernet addr */
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ie_subr.h,v 1.1 1994/12/12 18:59:11 gwr Exp $ */
/* $NetBSD: if_ie_subr.h,v 1.2 1994/12/15 21:08:11 gwr Exp $ */
/*
* Machine-dependent glue for the Intel Ethernet (ie) driver.
@ -18,13 +18,6 @@ enum ie_hardware {
IE_UNKNOWN
};
const char *ie_hardware_names[] = {
"multibus/vme",
"onboard",
"3e/vme",
"unknown"
};
/*
* Ethernet status, per interface.
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ievar.h,v 1.1 1994/12/12 18:59:11 gwr Exp $ */
/* $NetBSD: if_ievar.h,v 1.2 1994/12/15 21:08:11 gwr Exp $ */
/*
* Machine-dependent glue for the Intel Ethernet (ie) driver.
@ -18,13 +18,6 @@ enum ie_hardware {
IE_UNKNOWN
};
const char *ie_hardware_names[] = {
"multibus/vme",
"onboard",
"3e/vme",
"unknown"
};
/*
* Ethernet status, per interface.
*