aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Paul <wpaul@FreeBSD.org>1999-07-24 20:52:57 +0000
committerBill Paul <wpaul@FreeBSD.org>1999-07-24 20:52:57 +0000
commitd2aaa9a7a676061ed5020a8b941b11e08b79a2c8 (patch)
tree136a21cd99659bee184fbab2c0840a1c3799dde9
parenta1a10fdfc0dfbc37a8bab199f9c01b90b73ee171 (diff)
downloadsrc-d2aaa9a7a676061ed5020a8b941b11e08b79a2c8.tar.gz
src-d2aaa9a7a676061ed5020a8b941b11e08b79a2c8.zip
Convert the ASIX and Macronix drivers to newbus.
Notes
Notes: svn path=/head/; revision=49066
-rw-r--r--sys/pci/if_ax.c349
-rw-r--r--sys/pci/if_axreg.h7
-rw-r--r--sys/pci/if_mx.c363
-rw-r--r--sys/pci/if_mxreg.h6
4 files changed, 384 insertions, 341 deletions
diff --git a/sys/pci/if_ax.c b/sys/pci/if_ax.c
index 7a80ea3253d7..e9612ee3e220 100644
--- a/sys/pci/if_ax.c
+++ b/sys/pci/if_ax.c
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_ax.c,v 1.10 1999/07/02 04:17:12 peter Exp $
+ * $Id: if_ax.c,v 1.11 1999/07/06 19:23:22 des Exp $
*/
/*
@@ -75,6 +75,9 @@
#include <machine/bus_pio.h>
#include <machine/bus_memio.h>
#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/bus.h>
+#include <sys/rman.h>
#include <pci/pcireg.h>
#include <pci/pcivar.h>
@@ -87,7 +90,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: if_ax.c,v 1.10 1999/07/02 04:17:12 peter Exp $";
+ "$Id: if_ax.c,v 1.11 1999/07/06 19:23:22 des Exp $";
#endif
/*
@@ -117,12 +120,13 @@ static struct ax_type ax_phys[] = {
{ 0, 0, "<MII-compliant physical interface>" }
};
-static unsigned long ax_count = 0;
-static const char *ax_probe __P((pcici_t, pcidi_t));
-static void ax_attach __P((pcici_t, int));
+static int ax_probe __P((device_t));
+static int ax_attach __P((device_t));
+static int ax_detach __P((device_t));
static int ax_newbuf __P((struct ax_softc *,
- struct ax_chain_onefrag *));
+ struct ax_chain_onefrag *,
+ struct mbuf *));
static int ax_encap __P((struct ax_softc *, struct ax_chain *,
struct mbuf *));
@@ -136,7 +140,7 @@ static int ax_ioctl __P((struct ifnet *, u_long, caddr_t));
static void ax_init __P((void *));
static void ax_stop __P((struct ax_softc *));
static void ax_watchdog __P((struct ifnet *));
-static void ax_shutdown __P((int, void *));
+static void ax_shutdown __P((device_t));
static int ax_ifmedia_upd __P((struct ifnet *));
static void ax_ifmedia_sts __P((struct ifnet *, struct ifmediareq *));
@@ -168,6 +172,33 @@ static void ax_reset __P((struct ax_softc *));
static int ax_list_rx_init __P((struct ax_softc *));
static int ax_list_tx_init __P((struct ax_softc *));
+#ifdef AX_USEIOSPACE
+#define AX_RES SYS_RES_IOPORT
+#define AX_RID AX_PCI_LOIO
+#else
+#define AX_RES SYS_RES_IOPORT
+#define AX_RID AX_PCI_LOIO
+#endif
+
+static device_method_t ax_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, ax_probe),
+ DEVMETHOD(device_attach, ax_attach),
+ DEVMETHOD(device_detach, ax_detach),
+ DEVMETHOD(device_shutdown, ax_shutdown),
+ { 0, 0 }
+};
+
+static driver_t ax_driver = {
+ "ax",
+ ax_methods,
+ sizeof(struct ax_softc)
+};
+
+static devclass_t ax_devclass;
+
+DRIVER_MODULE(ax, pci, ax_driver, ax_devclass, 0, 0);
+
#define AX_SETBIT(sc, reg, x) \
CSR_WRITE_4(sc, reg, \
CSR_READ_4(sc, reg) | x)
@@ -1044,10 +1075,8 @@ static void ax_reset(sc)
* Probe for an ASIX chip. Check the PCI vendor and device
* IDs against our list and return a device name if we find a match.
*/
-static const char *
-ax_probe(config_id, device_id)
- pcici_t config_id;
- pcidi_t device_id;
+int ax_probe(dev)
+ device_t dev;
{
struct ax_type *t;
u_int32_t rev;
@@ -1055,33 +1084,29 @@ ax_probe(config_id, device_id)
t = ax_devs;
while(t->ax_name != NULL) {
- if ((device_id & 0xFFFF) == t->ax_vid &&
- ((device_id >> 16) & 0xFFFF) == t->ax_did) {
+ if ((pci_get_vendor(dev) == t->ax_vid) &&
+ (pci_get_device(dev) == t->ax_did)) {
/* Check the PCI revision */
- rev = pci_conf_read(config_id, AX_PCI_REVID) & 0xFF;
+ rev = pci_read_config(dev, AX_PCI_REVID, 4) & 0xFF;
if (rev >= AX_REVISION_88141)
t++;
- return(t->ax_name);
+ device_set_desc(dev, t->ax_name);
+ return(0);
}
t++;
}
- return(NULL);
+ return(ENXIO);
}
/*
* Attach the interface. Allocate softc structures, do ifmedia
* setup and ethernet/BPF attach.
*/
-static void
-ax_attach(config_id, unit)
- pcici_t config_id;
- int unit;
+static int ax_attach(dev)
+ device_t dev;
{
int s, i;
-#ifndef AX_USEIOSPACE
- vm_offset_t pbase, vbase;
-#endif
u_char eaddr[ETHER_ADDR_LEN];
u_int32_t command;
struct ax_softc *sc;
@@ -1091,93 +1116,97 @@ ax_attach(config_id, unit)
caddr_t roundptr;
struct ax_type *p;
u_int16_t phy_vid, phy_did, phy_sts;
+ int unit, error = 0, rid;
s = splimp();
- sc = malloc(sizeof(struct ax_softc), M_DEVBUF, M_NOWAIT);
- if (sc == NULL) {
- printf("ax%d: no memory for softc struct!\n", unit);
- goto fail;
- }
+ sc = device_get_softc(dev);
+ unit = device_get_unit(dev);
bzero(sc, sizeof(struct ax_softc));
/*
* Handle power management nonsense.
*/
- command = pci_conf_read(config_id, AX_PCI_CAPID) & 0x000000FF;
+ command = pci_read_config(dev, AX_PCI_CAPID, 4) & 0x000000FF;
if (command == 0x01) {
- command = pci_conf_read(config_id, AX_PCI_PWRMGMTCTRL);
+ command = pci_read_config(dev, AX_PCI_PWRMGMTCTRL, 4);
if (command & AX_PSTATE_MASK) {
u_int32_t iobase, membase, irq;
/* Save important PCI config data. */
- iobase = pci_conf_read(config_id, AX_PCI_LOIO);
- membase = pci_conf_read(config_id, AX_PCI_LOMEM);
- irq = pci_conf_read(config_id, AX_PCI_INTLINE);
+ iobase = pci_read_config(dev, AX_PCI_LOIO, 4);
+ membase = pci_read_config(dev, AX_PCI_LOMEM, 4);
+ irq = pci_read_config(dev, AX_PCI_INTLINE, 4);
/* Reset the power state. */
printf("ax%d: chip is in D%d power mode "
"-- setting to D0\n", unit, command & AX_PSTATE_MASK);
command &= 0xFFFFFFFC;
- pci_conf_write(config_id, AX_PCI_PWRMGMTCTRL, command);
+ pci_write_config(dev, AX_PCI_PWRMGMTCTRL, command, 4);
/* Restore PCI config data. */
- pci_conf_write(config_id, AX_PCI_LOIO, iobase);
- pci_conf_write(config_id, AX_PCI_LOMEM, membase);
- pci_conf_write(config_id, AX_PCI_INTLINE, irq);
+ pci_write_config(dev, AX_PCI_LOIO, iobase, 4);
+ pci_write_config(dev, AX_PCI_LOMEM, membase, 4);
+ pci_write_config(dev, AX_PCI_INTLINE, irq, 4);
}
}
/*
* Map control/status registers.
*/
- command = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG);
+ command = pci_read_config(dev, PCI_COMMAND_STATUS_REG, 4);
command |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
- pci_conf_write(config_id, PCI_COMMAND_STATUS_REG, command);
- command = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG);
+ pci_write_config(dev, PCI_COMMAND_STATUS_REG, command, 4);
+ command = pci_read_config(dev, PCI_COMMAND_STATUS_REG, 4);
#ifdef AX_USEIOSPACE
if (!(command & PCIM_CMD_PORTEN)) {
printf("ax%d: failed to enable I/O ports!\n", unit);
- free(sc, M_DEVBUF);
+ error = ENXIO;;
goto fail;
}
-
- if (!pci_map_port(config_id, AX_PCI_LOIO,
- (pci_port_t *)&(sc->ax_bhandle))) {
- printf ("ax%d: couldn't map ports\n", unit);
- goto fail;
- }
-#ifdef __i386__
- sc->ax_btag = I386_BUS_SPACE_IO;
-#endif
-#ifdef __alpha__
- sc->ax_btag = ALPHA_BUS_SPACE_IO;
-#endif
#else
if (!(command & PCIM_CMD_MEMEN)) {
printf("ax%d: failed to enable memory mapping!\n", unit);
+ error = ENXIO;;
goto fail;
}
+#endif
+
+ rid = AX_RID;
+ sc->ax_res = bus_alloc_resource(dev, AX_RES, &rid,
+ 0, ~0, 1, RF_ACTIVE);
- if (!pci_map_mem(config_id, AX_PCI_LOMEM, &vbase, &pbase)) {
- printf ("ax%d: couldn't map memory\n", unit);
+ if (sc->ax_res == NULL) {
+ printf("ax%d: couldn't map ports/memory\n", unit);
+ error = ENXIO;
goto fail;
}
-#ifdef __i386__
- sc->ax_btag = I386_BUS_SPACE_MEM;
-#endif
-#ifdef __alpha__
- sc->ax_btag = ALPHA_BUS_SPACE_MEM;
-#endif
- sc->ax_bhandle = vbase;
-#endif
+
+ sc->ax_btag = rman_get_bustag(sc->ax_res);
+ sc->ax_bhandle = rman_get_bushandle(sc->ax_res);
/* Allocate interrupt */
- if (!pci_map_int(config_id, ax_intr, sc, &net_imask)) {
+ rid = 0;
+ sc->ax_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
+ RF_SHAREABLE | RF_ACTIVE);
+
+ if (sc->ax_irq == NULL) {
printf("ax%d: couldn't map interrupt\n", unit);
+ bus_release_resource(dev, AX_RES, AX_RID, sc->ax_res);
+ error = ENXIO;
+ goto fail;
+ }
+
+ error = bus_setup_intr(dev, sc->ax_irq, INTR_TYPE_NET,
+ ax_intr, sc, &sc->ax_intrhand);
+
+ if (error) {
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ax_res);
+ bus_release_resource(dev, AX_RES, AX_RID, sc->ax_res);
+ printf("ax%d: couldn't set up irq\n", unit);
goto fail;
}
@@ -1200,8 +1229,11 @@ ax_attach(config_id, unit)
sc->ax_ldata_ptr = malloc(sizeof(struct ax_list_data) + 8,
M_DEVBUF, M_NOWAIT);
if (sc->ax_ldata_ptr == NULL) {
- free(sc, M_DEVBUF);
printf("ax%d: no memory for list buffers!\n", unit);
+ bus_teardown_intr(dev, sc->ax_irq, sc->ax_intrhand);
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ax_res);
+ bus_release_resource(dev, AX_RES, AX_RID, sc->ax_res);
+ error = ENXIO;
goto fail;
}
@@ -1282,7 +1314,13 @@ ax_attach(config_id, unit)
if (sc->ax_pinfo != NULL) {
ax_getmode_mii(sc);
- ax_autoneg_mii(sc, AX_FLAG_FORCEDELAY, 1);
+ if (cold) {
+ ax_autoneg_mii(sc, AX_FLAG_FORCEDELAY, 1);
+ ax_stop(sc);
+ } else {
+ ax_init(sc);
+ ax_autoneg_mii(sc, AX_FLAG_SCHEDDELAY, 1);
+ }
} else {
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL);
@@ -1298,8 +1336,6 @@ ax_attach(config_id, unit)
}
media = sc->ifmedia.ifm_media;
- ax_stop(sc);
-
ifmedia_set(&sc->ifmedia, media);
/*
@@ -1311,11 +1347,37 @@ ax_attach(config_id, unit)
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
- at_shutdown(ax_shutdown, sc, SHUTDOWN_POST_SYNC);
fail:
splx(s);
- return;
+ return(error);
+}
+
+static int ax_detach(dev)
+ device_t dev;
+{
+ struct ax_softc *sc;
+ struct ifnet *ifp;
+ int s;
+
+ s = splimp();
+
+ sc = device_get_softc(dev);
+ ifp = &sc->arpcom.ac_if;
+
+ ax_stop(sc);
+ if_detach(ifp);
+
+ bus_teardown_intr(dev, sc->ax_irq, sc->ax_intrhand);
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ax_res);
+ bus_release_resource(dev, AX_RES, AX_RID, sc->ax_res);
+
+ free(sc->ax_ldata_ptr, M_DEVBUF);
+ ifmedia_removeall(&sc->ifmedia);
+
+ splx(s);
+
+ return(0);
}
/*
@@ -1365,18 +1427,18 @@ static int ax_list_rx_init(sc)
for (i = 0; i < AX_RX_LIST_CNT; i++) {
cd->ax_rx_chain[i].ax_ptr =
(volatile struct ax_desc *)&ld->ax_rx_list[i];
- if (ax_newbuf(sc, &cd->ax_rx_chain[i]) == ENOBUFS)
+ if (ax_newbuf(sc, &cd->ax_rx_chain[i], NULL) == ENOBUFS)
return(ENOBUFS);
if (i == (AX_RX_LIST_CNT - 1)) {
cd->ax_rx_chain[i].ax_nextdesc =
- &cd->ax_rx_chain[0];
+ &cd->ax_rx_chain[0];
ld->ax_rx_list[i].ax_next =
- vtophys(&ld->ax_rx_list[0]);
+ vtophys(&ld->ax_rx_list[0]);
} else {
cd->ax_rx_chain[i].ax_nextdesc =
- &cd->ax_rx_chain[i + 1];
+ &cd->ax_rx_chain[i + 1];
ld->ax_rx_list[i].ax_next =
- vtophys(&ld->ax_rx_list[i + 1]);
+ vtophys(&ld->ax_rx_list[i + 1]);
}
}
@@ -1392,27 +1454,36 @@ static int ax_list_rx_init(sc)
* MCLBYTES is 2048, so we have to subtract one otherwise we'll
* overflow the field and make a mess.
*/
-static int ax_newbuf(sc, c)
+static int ax_newbuf(sc, c, m)
struct ax_softc *sc;
struct ax_chain_onefrag *c;
+ struct mbuf *m;
{
struct mbuf *m_new = NULL;
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL) {
- printf("ax%d: no memory for rx list -- packet dropped!\n",
- sc->ax_unit);
- return(ENOBUFS);
- }
+ if (m == NULL) {
+ MGETHDR(m_new, M_DONTWAIT, MT_DATA);
+ if (m_new == NULL) {
+ printf("ax%d: no memory for rx list "
+ "-- packet dropped!\n", sc->ax_unit);
+ return(ENOBUFS);
+ }
- MCLGET(m_new, M_DONTWAIT);
- if (!(m_new->m_flags & M_EXT)) {
- printf("ax%d: no memory for rx list -- packet dropped!\n",
- sc->ax_unit);
- m_freem(m_new);
- return(ENOBUFS);
+ MCLGET(m_new, M_DONTWAIT);
+ if (!(m_new->m_flags & M_EXT)) {
+ printf("ax%d: no memory for rx list "
+ "-- packet dropped!\n", sc->ax_unit);
+ m_freem(m_new);
+ return(ENOBUFS);
+ }
+ m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
+ } else {
+ m_new = m;
+ m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
+ m_new->m_data = m_new->m_ext.ext_buf;
}
+ m_adj(m_new, sizeof(u_int64_t));
c->ax_mbuf = m_new;
c->ax_ptr->ax_status = AX_RXSTAT;
c->ax_ptr->ax_data = vtophys(mtod(m_new, caddr_t));
@@ -1439,11 +1510,11 @@ static void ax_rxeof(sc)
while(!((rxstat = sc->ax_cdata.ax_rx_head->ax_ptr->ax_status) &
AX_RXSTAT_OWN)) {
-#ifdef __alpha__
struct mbuf *m0 = NULL;
-#endif
+
cur_rx = sc->ax_cdata.ax_rx_head;
sc->ax_cdata.ax_rx_head = cur_rx->ax_nextdesc;
+ m = cur_rx->ax_mbuf;
/*
* If an error occurs, update stats, clear the
@@ -1455,90 +1526,24 @@ static void ax_rxeof(sc)
ifp->if_ierrors++;
if (rxstat & AX_RXSTAT_COLLSEEN)
ifp->if_collisions++;
- cur_rx->ax_ptr->ax_status = AX_RXSTAT;
- cur_rx->ax_ptr->ax_ctl = (MCLBYTES - 1);
+ ax_newbuf(sc, cur_rx, m);
continue;
}
/* No errors; receive the packet. */
- m = cur_rx->ax_mbuf;
total_len = AX_RXBYTES(cur_rx->ax_ptr->ax_status);
total_len -= ETHER_CRC_LEN;
-#ifdef __alpha__
- /*
- * Try to conjure up a new mbuf cluster. If that
- * fails, it means we have an out of memory condition and
- * should leave the buffer in place and continue. This will
- * result in a lost packet, but there's little else we
- * can do in this situation.
- */
- if (ax_newbuf(sc, cur_rx) == ENOBUFS) {
- ifp->if_ierrors++;
- cur_rx->ax_ptr->ax_status = AX_RXSTAT;
- cur_rx->ax_ptr->ax_ctl = (MCLBYTES - 1);
- continue;
- }
-
- /*
- * Sadly, the ASIX chip doesn't decode the last few
- * bits of the RX DMA buffer address, so we have to
- * cheat in order to obtain proper payload alignment
- * on the alpha.
- */
- MGETHDR(m0, M_DONTWAIT, MT_DATA);
+ m0 = m_devget(mtod(m, char *) - ETHER_ALIGN,
+ total_len + ETHER_ALIGN, 0, ifp, NULL);
+ ax_newbuf(sc, cur_rx, m);
if (m0 == NULL) {
ifp->if_ierrors++;
- cur_rx->ax_ptr->ax_status = AX_RXSTAT;
- cur_rx->ax_ptr->ax_ctl = (MCLBYTES - 1);
continue;
}
-
- m0->m_data += 2;
- if (total_len <= (MHLEN - 2)) {
- bcopy(mtod(m, caddr_t), mtod(m0, caddr_t), total_len); m_freem(m);
- m = m0;
- m->m_pkthdr.len = m->m_len = total_len;
- } else {
- bcopy(mtod(m, caddr_t), mtod(m0, caddr_t), (MHLEN - 2));
- m->m_len = total_len - (MHLEN - 2);
- m->m_data += (MHLEN - 2);
- m0->m_next = m;
- m0->m_len = (MHLEN - 2);
- m = m0;
- m->m_pkthdr.len = total_len;
- }
- m->m_pkthdr.rcvif = ifp;
-#else
- if (total_len < MINCLSIZE) {
- m = m_devget(mtod(cur_rx->ax_mbuf, char *),
- total_len, 0, ifp, NULL);
- cur_rx->ax_ptr->ax_status = AX_RXSTAT;
- cur_rx->ax_ptr->ax_ctl = (MCLBYTES - 1);
- if (m == NULL) {
- ifp->if_ierrors++;
- continue;
- }
- } else {
- m = cur_rx->ax_mbuf;
- /*
- * Try to conjure up a new mbuf cluster. If that
- * fails, it means we have an out of memory condition and
- * should leave the buffer in place and continue. This will
- * result in a lost packet, but there's little else we
- * can do in this situation.
- */
- if (ax_newbuf(sc, cur_rx) == ENOBUFS) {
- ifp->if_ierrors++;
- cur_rx->ax_ptr->ax_status = AX_RXSTAT;
- cur_rx->ax_ptr->ax_ctl = (MCLBYTES - 1);
- continue;
- }
- m->m_pkthdr.rcvif = ifp;
- m->m_pkthdr.len = m->m_len = total_len;
- }
-#endif
+ m_adj(m0, ETHER_ALIGN);
+ m = m0;
ifp->if_ipackets++;
eh = mtod(m, struct ether_header *);
@@ -2146,6 +2151,8 @@ static void ax_watchdog(ifp)
if (sc->ax_autoneg) {
ax_autoneg_mii(sc, AX_FLAG_DELAYTIMEO, 1);
+ if (!(ifp->if_flags & IFF_UP))
+ ax_stop(sc);
return;
}
@@ -2220,22 +2227,14 @@ static void ax_stop(sc)
* Stop all chip I/O so that the kernel's probe routines don't
* get confused by errant DMAs when rebooting.
*/
-static void ax_shutdown(howto, arg)
- int howto;
- void *arg;
+static void ax_shutdown(dev)
+ device_t dev;
{
- struct ax_softc *sc = (struct ax_softc *)arg;
+ struct ax_softc *sc;
+
+ sc = device_get_softc(dev);
ax_stop(sc);
return;
}
-
-static struct pci_device ax_device = {
- "ax",
- ax_probe,
- ax_attach,
- &ax_count,
- NULL
-};
-COMPAT_PCI_DRIVER(ax, ax_device);
diff --git a/sys/pci/if_axreg.h b/sys/pci/if_axreg.h
index 294d2ce8af4d..0e17fa5aa72f 100644
--- a/sys/pci/if_axreg.h
+++ b/sys/pci/if_axreg.h
@@ -346,6 +346,9 @@ struct ax_softc {
struct ifmedia ifmedia; /* media info */
bus_space_handle_t ax_bhandle; /* bus space handle */
bus_space_tag_t ax_btag; /* bus space tag */
+ void *ax_intrhand;
+ struct resource *ax_irq;
+ struct resource *ax_res;
struct ax_type *ax_info; /* ASIX adapter info */
struct ax_type *ax_pinfo; /* phy info */
u_int8_t ax_unit; /* interface number */
@@ -377,6 +380,7 @@ struct ax_softc {
bus_space_read_1(sc->ax_btag, sc->ax_bhandle, reg)
#define AX_TIMEOUT 1000
+#define ETHER_ALIGN 2
/*
* General constants that are fun to know.
@@ -567,5 +571,6 @@ struct ax_softc {
#ifdef __alpha__
#undef vtophys
-#define vtophys(va) alpha_XXX_dmamap((vm_offset_t)va)
+#define vtophys(va) (pmap_kextract(((vm_offset_t) (va))) \
+ + 1*1024*1024*1024)
#endif
diff --git a/sys/pci/if_mx.c b/sys/pci/if_mx.c
index ce9338b62965..5dca10c5bc58 100644
--- a/sys/pci/if_mx.c
+++ b/sys/pci/if_mx.c
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_mx.c,v 1.20 1999/07/02 04:17:13 peter Exp $
+ * $Id: if_mx.c,v 1.21 1999/07/06 19:23:26 des Exp $
*/
/*
@@ -82,6 +82,9 @@
#include <machine/bus_pio.h>
#include <machine/bus_memio.h>
#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/bus.h>
+#include <sys/rman.h>
#include <pci/pcireg.h>
#include <pci/pcivar.h>
@@ -94,7 +97,7 @@
#ifndef lint
static const char rcsid[] =
- "$Id: if_mx.c,v 1.20 1999/07/02 04:17:13 peter Exp $";
+ "$Id: if_mx.c,v 1.21 1999/07/06 19:23:26 des Exp $";
#endif
/*
@@ -134,12 +137,13 @@ static struct mx_type mx_phys[] = {
{ 0, 0, "<MII-compliant physical interface>" }
};
-static unsigned long mx_count = 0;
-static const char *mx_probe __P((pcici_t, pcidi_t));
-static void mx_attach __P((pcici_t, int));
-static struct mx_type *mx_devtype __P((pcici_t, pcidi_t));
+static int mx_probe __P((device_t));
+static int mx_attach __P((device_t));
+static int mx_detach __P((device_t));
+static struct mx_type *mx_devtype __P((device_t));
static int mx_newbuf __P((struct mx_softc *,
- struct mx_chain_onefrag *));
+ struct mx_chain_onefrag *,
+ struct mbuf *));
static int mx_encap __P((struct mx_softc *, struct mx_chain *,
struct mbuf *));
@@ -153,7 +157,7 @@ static int mx_ioctl __P((struct ifnet *, u_long, caddr_t));
static void mx_init __P((void *));
static void mx_stop __P((struct mx_softc *));
static void mx_watchdog __P((struct ifnet *));
-static void mx_shutdown __P((int, void *));
+static void mx_shutdown __P((device_t));
static int mx_ifmedia_upd __P((struct ifnet *));
static void mx_ifmedia_sts __P((struct ifnet *, struct ifmediareq *));
@@ -186,6 +190,33 @@ static void mx_reset __P((struct mx_softc *));
static int mx_list_rx_init __P((struct mx_softc *));
static int mx_list_tx_init __P((struct mx_softc *));
+#ifdef MX_USEIOSPACE
+#define MX_RES SYS_RES_IOPORT
+#define MX_RID MX_PCI_LOIO
+#else
+#define MX_RES SYS_RES_MEMORY
+#define MX_RID MX_PCI_LOMEM
+#endif
+
+static device_method_t mx_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, mx_probe),
+ DEVMETHOD(device_attach, mx_attach),
+ DEVMETHOD(device_detach, mx_detach),
+ DEVMETHOD(device_shutdown, mx_shutdown),
+ { 0, 0 }
+};
+
+static driver_t mx_driver = {
+ "mx",
+ mx_methods,
+ sizeof(struct mx_softc)
+};
+
+static devclass_t mx_devclass;
+
+DRIVER_MODULE(mx, pci, mx_driver, mx_devclass, 0, 0);
+
#define MX_SETBIT(sc, reg, x) \
CSR_WRITE_4(sc, reg, \
CSR_READ_4(sc, reg) | x)
@@ -1242,9 +1273,8 @@ static void mx_reset(sc)
return;
}
-static struct mx_type *mx_devtype(config_id, device_id)
- pcici_t config_id;
- pcidi_t device_id;
+static struct mx_type *mx_devtype(dev)
+ device_t dev;
{
struct mx_type *t;
u_int32_t rev;
@@ -1252,18 +1282,18 @@ static struct mx_type *mx_devtype(config_id, device_id)
t = mx_devs;
while(t->mx_name != NULL) {
- if ((device_id & 0xFFFF) == t->mx_vid &&
- ((device_id >> 16) & 0xFFFF) == t->mx_did) {
+ if ((pci_get_vendor(dev) == t->mx_vid) &&
+ (pci_get_device(dev) == t->mx_did)) {
/* Check the PCI revision */
- rev = pci_conf_read(config_id, MX_PCI_REVID) & 0xFF;
+ rev = pci_read_config(dev, MX_PCI_REVID, 4) & 0xFF;
if (t->mx_did == MX_DEVICEID_98713 &&
- rev >= MX_REVISION_98713A)
+ rev >= MX_REVISION_98713A)
t++;
if (t->mx_did == CP_DEVICEID_98713 &&
- rev >= MX_REVISION_98713A)
+ rev >= MX_REVISION_98713A)
t++;
if (t->mx_did == MX_DEVICEID_987x5 &&
- rev >= MX_REVISION_98725)
+ rev >= MX_REVISION_98725)
t++;
return(t);
}
@@ -1283,34 +1313,29 @@ static struct mx_type *mx_devtype(config_id, device_id)
* lets us tell the user exactly what type of device they have
* in the probe output.
*/
-static const char *
-mx_probe(config_id, device_id)
- pcici_t config_id;
- pcidi_t device_id;
+int mx_probe(dev)
+ device_t dev;
{
struct mx_type *t;
- t = mx_devtype(config_id, device_id);
+ t = mx_devtype(dev);
- if (t != NULL)
- return(t->mx_name);
+ if (t != NULL) {
+ device_set_desc(dev, t->mx_name);
+ return(0);
+ }
- return(NULL);
+ return(ENXIO);
}
/*
* Attach the interface. Allocate softc structures, do ifmedia
* setup and ethernet/BPF attach.
*/
-static void
-mx_attach(config_id, unit)
- pcici_t config_id;
- int unit;
+int mx_attach(dev)
+ device_t dev;
{
int s, i;
-#ifndef MX_USEIOSPACE
- vm_offset_t pbase, vbase;
-#endif
u_char eaddr[ETHER_ADDR_LEN];
u_int32_t command;
struct mx_softc *sc;
@@ -1321,99 +1346,103 @@ mx_attach(config_id, unit)
struct mx_type *p;
u_int16_t phy_vid, phy_did, phy_sts, mac_offset = 0;
u_int32_t revision, pci_id;
+ int unit, error = 0, rid;
s = splimp();
- sc = malloc(sizeof(struct mx_softc), M_DEVBUF, M_NOWAIT);
- if (sc == NULL) {
- printf("mx%d: no memory for softc struct!\n", unit);
- goto fail;
- }
+ sc = device_get_softc(dev);
+ unit = device_get_unit(dev);
bzero(sc, sizeof(struct mx_softc));
/*
* Handle power management nonsense.
*/
- command = pci_conf_read(config_id, MX_PCI_CAPID) & 0x000000FF;
+ command = pci_read_config(dev, MX_PCI_CAPID, 4) & 0x000000FF;
if (command == 0x01) {
- command = pci_conf_read(config_id, MX_PCI_PWRMGMTCTRL);
+ command = pci_read_config(dev, MX_PCI_PWRMGMTCTRL, 4);
if (command & MX_PSTATE_MASK) {
u_int32_t iobase, membase, irq;
/* Save important PCI config data. */
- iobase = pci_conf_read(config_id, MX_PCI_LOIO);
- membase = pci_conf_read(config_id, MX_PCI_LOMEM);
- irq = pci_conf_read(config_id, MX_PCI_INTLINE);
+ iobase = pci_read_config(dev, MX_PCI_LOIO, 4);
+ membase = pci_read_config(dev, MX_PCI_LOMEM, 4);
+ irq = pci_read_config(dev, MX_PCI_INTLINE, 4);
/* Reset the power state. */
printf("mx%d: chip is in D%d power mode "
"-- setting to D0\n", unit, command & MX_PSTATE_MASK);
command &= 0xFFFFFFFC;
- pci_conf_write(config_id, MX_PCI_PWRMGMTCTRL, command);
+ pci_write_config(dev, MX_PCI_PWRMGMTCTRL, command, 4);
/* Restore PCI config data. */
- pci_conf_write(config_id, MX_PCI_LOIO, iobase);
- pci_conf_write(config_id, MX_PCI_LOMEM, membase);
- pci_conf_write(config_id, MX_PCI_INTLINE, irq);
+ pci_write_config(dev, MX_PCI_LOIO, iobase, 4);
+ pci_write_config(dev, MX_PCI_LOMEM, membase, 4);
+ pci_write_config(dev, MX_PCI_INTLINE, irq, 4);
}
}
/*
* Map control/status registers.
*/
- command = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG);
+ command = pci_read_config(dev, PCI_COMMAND_STATUS_REG, 4);
command |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
- pci_conf_write(config_id, PCI_COMMAND_STATUS_REG, command);
- command = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG);
+ pci_write_config(dev, PCI_COMMAND_STATUS_REG, command, 4);
+ command = pci_read_config(dev, PCI_COMMAND_STATUS_REG, 4);
#ifdef MX_USEIOSPACE
if (!(command & PCIM_CMD_PORTEN)) {
printf("mx%d: failed to enable I/O ports!\n", unit);
- free(sc, M_DEVBUF);
+ error = ENXIO;
goto fail;
}
-
- if (!pci_map_port(config_id, MX_PCI_LOIO,
- (pci_port_t *)&(sc->mx_bhandle))) {
- printf ("mx%d: couldn't map ports\n", unit);
- goto fail;
- }
-#ifdef __i386__
- sc->mx_btag = I386_BUS_SPACE_IO;
-#endif
-#ifdef __alpha__
- sc->mx_btag = ALPHA_BUS_SPACE_IO;
-#endif
#else
if (!(command & PCIM_CMD_MEMEN)) {
printf("mx%d: failed to enable memory mapping!\n", unit);
+ error = ENXIO;
goto fail;
}
+#endif
- if (!pci_map_mem(config_id, MX_PCI_LOMEM, &vbase, &pbase)) {
- printf ("mx%d: couldn't map memory\n", unit);
+ rid = MX_RID;
+ sc->mx_res = bus_alloc_resource(dev, MX_RES, &rid,
+ 0, ~0, 1, RF_ACTIVE);
+
+ if (sc->mx_res == NULL) {
+ printf("mx%d: couldn't map ports/memory\n", unit);
+ error = ENXIO;
goto fail;
}
-#ifdef __i386__
- sc->mx_btag = I386_BUS_SPACE_MEM;
-#endif
-#ifdef __alpha__
- sc->mx_btag = ALPHA_BUS_SPACE_MEM;
-#endif
- sc->mx_bhandle = vbase;
-#endif
+
+ sc->mx_btag = rman_get_bustag(sc->mx_res);
+ sc->mx_bhandle = rman_get_bushandle(sc->mx_res);
/* Allocate interrupt */
- if (!pci_map_int(config_id, mx_intr, sc, &net_imask)) {
+ rid = 0;
+ sc->mx_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
+ RF_SHAREABLE | RF_ACTIVE);
+
+ if (sc->mx_irq == NULL) {
printf("mx%d: couldn't map interrupt\n", unit);
+ bus_release_resource(dev, MX_RES, MX_RID, sc->mx_res);
+ error = ENXIO;
goto fail;
}
+ error = bus_setup_intr(dev, sc->mx_irq, INTR_TYPE_NET,
+ mx_intr, sc, &sc->mx_intrhand);
+
+ if (error) {
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->mx_irq);
+ bus_release_resource(dev, MX_RES, MX_RID, sc->mx_res);
+ printf("mx%d: couldn't set up irq\n", unit);
+ goto fail;
+ }
+
/* Need this info to decide on a chip type. */
- revision = pci_conf_read(config_id, MX_PCI_REVID) & 0x000000FF;
- pci_id = (pci_conf_read(config_id,MX_PCI_VENDOR_ID) >> 16) & 0x0000FFFF;
+ revision = pci_read_config(dev, MX_PCI_REVID, 4) & 0x000000FF;
+ pci_id = (pci_read_config(dev,MX_PCI_VENDOR_ID, 4) >> 16) & 0x0000FFFF;
if (pci_id == MX_DEVICEID_98713 && revision < MX_REVISION_98713A)
sc->mx_type = MX_TYPE_98713;
@@ -1425,11 +1454,11 @@ mx_attach(config_id, unit)
sc->mx_type = MX_TYPE_987x5;
/* Save the cache line size. */
- sc->mx_cachesize = pci_conf_read(config_id, MX_PCI_CACHELEN) & 0xFF;
+ sc->mx_cachesize = pci_read_config(dev, MX_PCI_CACHELEN, 4) & 0xFF;
/* Save the device info; the PNIC II requires special handling. */
- pci_id = pci_conf_read(config_id,MX_PCI_VENDOR_ID);
- sc->mx_info = mx_devtype(config_id, pci_id);
+ pci_id = pci_read_config(dev,MX_PCI_VENDOR_ID, 4);
+ sc->mx_info = mx_devtype(dev);
/* Reset the adapter. */
mx_reset(sc);
@@ -1452,8 +1481,11 @@ mx_attach(config_id, unit)
sc->mx_ldata_ptr = malloc(sizeof(struct mx_list_data) + 8,
M_DEVBUF, M_NOWAIT);
if (sc->mx_ldata_ptr == NULL) {
- free(sc, M_DEVBUF);
printf("mx%d: no memory for list buffers!\n", unit);
+ bus_teardown_intr(dev, sc->mx_irq, sc->mx_intrhand);
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->mx_irq);
+ bus_release_resource(dev, MX_RES, MX_RID, sc->mx_res);
+ error = ENXIO;
goto fail;
}
@@ -1536,7 +1568,13 @@ mx_attach(config_id, unit)
if (sc->mx_type == MX_TYPE_98713 && sc->mx_pinfo != NULL) {
mx_getmode_mii(sc);
- mx_autoneg_mii(sc, MX_FLAG_FORCEDELAY, 1);
+ if (cold) {
+ mx_autoneg_mii(sc, MX_FLAG_FORCEDELAY, 1);
+ mx_stop(sc);
+ } else {
+ mx_init(sc);
+ mx_autoneg_mii(sc, MX_FLAG_SCHEDDELAY, 1);
+ }
} else {
ifmedia_add(&sc->ifmedia,
IFM_ETHER|IFM_10_T|IFM_HDX, 0, NULL);
@@ -1549,12 +1587,16 @@ mx_attach(config_id, unit)
IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_100_TX, 0, NULL);
ifmedia_add(&sc->ifmedia, IFM_ETHER|IFM_AUTO, 0, NULL);
- mx_autoneg(sc, MX_FLAG_FORCEDELAY, 1);
+ if (cold) {
+ mx_autoneg(sc, MX_FLAG_FORCEDELAY, 1);
+ mx_stop(sc);
+ } else {
+ mx_init(sc);
+ mx_autoneg(sc, MX_FLAG_SCHEDDELAY, 1);
+ }
}
media = sc->ifmedia.ifm_media;
- mx_stop(sc);
-
ifmedia_set(&sc->ifmedia, media);
/*
@@ -1566,11 +1608,38 @@ mx_attach(config_id, unit)
#if NBPF > 0
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
#endif
- at_shutdown(mx_shutdown, sc, SHUTDOWN_POST_SYNC);
fail:
splx(s);
- return;
+
+ return(error);
+}
+
+static int mx_detach(dev)
+ device_t dev;
+{
+ struct mx_softc *sc;
+ struct ifnet *ifp;
+ int s;
+
+ s = splimp();
+
+ sc = device_get_softc(dev);
+ ifp = &sc->arpcom.ac_if;
+
+ mx_stop(sc);
+ if_detach(ifp);
+
+ bus_teardown_intr(dev, sc->mx_irq, sc->mx_intrhand);
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->mx_irq);
+ bus_release_resource(dev, MX_RES, MX_RID, sc->mx_res);
+
+ free(sc->mx_ldata_ptr, M_DEVBUF);
+ ifmedia_removeall(&sc->ifmedia);
+
+ splx(s);
+
+ return(0);
}
/*
@@ -1620,16 +1689,18 @@ static int mx_list_rx_init(sc)
for (i = 0; i < MX_RX_LIST_CNT; i++) {
cd->mx_rx_chain[i].mx_ptr =
(struct mx_desc *)&ld->mx_rx_list[i];
- if (mx_newbuf(sc, &cd->mx_rx_chain[i]) == ENOBUFS)
+ if (mx_newbuf(sc, &cd->mx_rx_chain[i], NULL) == ENOBUFS)
return(ENOBUFS);
if (i == (MX_RX_LIST_CNT - 1)) {
- cd->mx_rx_chain[i].mx_nextdesc = &cd->mx_rx_chain[0];
+ cd->mx_rx_chain[i].mx_nextdesc =
+ &cd->mx_rx_chain[0];
ld->mx_rx_list[i].mx_next =
- vtophys(&ld->mx_rx_list[0]);
+ vtophys(&ld->mx_rx_list[0]);
} else {
- cd->mx_rx_chain[i].mx_nextdesc = &cd->mx_rx_chain[i + 1];
+ cd->mx_rx_chain[i].mx_nextdesc =
+ &cd->mx_rx_chain[i + 1];
ld->mx_rx_list[i].mx_next =
- vtophys(&ld->mx_rx_list[i + 1]);
+ vtophys(&ld->mx_rx_list[i + 1]);
}
}
@@ -1645,27 +1716,37 @@ static int mx_list_rx_init(sc)
* MCLBYTES is 2048, so we have to subtract one otherwise we'll
* overflow the field and make a mess.
*/
-static int mx_newbuf(sc, c)
+static int mx_newbuf(sc, c, m)
struct mx_softc *sc;
struct mx_chain_onefrag *c;
+ struct mbuf *m;
{
struct mbuf *m_new = NULL;
- MGETHDR(m_new, M_DONTWAIT, MT_DATA);
- if (m_new == NULL) {
- printf("mx%d: no memory for rx list -- packet dropped!\n",
- sc->mx_unit);
- return(ENOBUFS);
- }
+ if (m == NULL) {
+ MGETHDR(m_new, M_DONTWAIT, MT_DATA);
+ if (m_new == NULL) {
+ printf("mx%d: no memory for rx list "
+ "-- packet dropped!\n", sc->mx_unit);
+ return(ENOBUFS);
+ }
- MCLGET(m_new, M_DONTWAIT);
- if (!(m_new->m_flags & M_EXT)) {
- printf("mx%d: no memory for rx list -- packet dropped!\n",
- sc->mx_unit);
- m_freem(m_new);
- return(ENOBUFS);
+ MCLGET(m_new, M_DONTWAIT);
+ if (!(m_new->m_flags & M_EXT)) {
+ printf("mx%d: no memory for rx list "
+ "-- packet dropped!\n", sc->mx_unit);
+ m_freem(m_new);
+ return(ENOBUFS);
+ }
+ m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
+ } else {
+ m_new = m;
+ m_new->m_len = m_new->m_pkthdr.len = MCLBYTES;
+ m_new->m_data = m_new->m_ext.ext_buf;
}
+ m_adj(m_new, sizeof(u_int64_t));
+
c->mx_mbuf = m_new;
c->mx_ptr->mx_status = MX_RXSTAT;
c->mx_ptr->mx_data = vtophys(mtod(m_new, caddr_t));
@@ -1692,11 +1773,11 @@ static void mx_rxeof(sc)
while(!((rxstat = sc->mx_cdata.mx_rx_head->mx_ptr->mx_status) &
MX_RXSTAT_OWN)) {
-#ifdef __alpha__
struct mbuf *m0 = NULL;
-#endif
+
cur_rx = sc->mx_cdata.mx_rx_head;
sc->mx_cdata.mx_rx_head = cur_rx->mx_nextdesc;
+ m = cur_rx->mx_mbuf;
/*
* If an error occurs, update stats, clear the
@@ -1708,14 +1789,11 @@ static void mx_rxeof(sc)
ifp->if_ierrors++;
if (rxstat & MX_RXSTAT_COLLSEEN)
ifp->if_collisions++;
- cur_rx->mx_ptr->mx_status = MX_RXSTAT;
- cur_rx->mx_ptr->mx_ctl =
- MX_RXCTL_RLINK | (MCLBYTES - 1);
+ mx_newbuf(sc, cur_rx, m);
continue;
}
/* No errors; receive the packet. */
- m = cur_rx->mx_mbuf;
total_len = MX_RXBYTES(cur_rx->mx_ptr->mx_status);
/*
@@ -1727,55 +1805,18 @@ static void mx_rxeof(sc)
*/
total_len -= ETHER_CRC_LEN;
- /*
- * Try to conjure up a new mbuf cluster. If that
- * fails, it means we have an out of memory condition and
- * should leave the buffer in place and continue. This will
- * result in a lost packet, but there's little else we
- * can do in this situation.
- */
- if (mx_newbuf(sc, cur_rx) == ENOBUFS) {
- ifp->if_ierrors++;
- cur_rx->mx_ptr->mx_status = MX_RXSTAT;
- cur_rx->mx_ptr->mx_ctl =
- MX_RXCTL_RLINK | (MCLBYTES - 1);
- continue;
- }
-
-#ifdef __alpha__
- /*
- * Deal with alignment on alpha.
- */
- MGETHDR(m0, M_DONTWAIT, MT_DATA);
+ m0 = m_devget(mtod(m, char *) - ETHER_ALIGN,
+ total_len + ETHER_ALIGN, 0, ifp, NULL);
+ mx_newbuf(sc, cur_rx, m);
if (m0 == NULL) {
ifp->if_ierrors++;
- cur_rx->mx_ptr->mx_status = MX_RXSTAT;
- cur_rx->mx_ptr->mx_ctl =
- MX_RXCTL_RLINK | (MCLBYTES - 1);
- bzero((char *)mtod(cur_rx->mx_mbuf, char *), MCLBYTES);
continue;
}
+ m_adj(m0, ETHER_ALIGN);
+ m = m0;
- m0->m_data += 2;
- if (total_len <= (MHLEN - 2)) {
- bcopy(mtod(m, caddr_t), mtod(m0, caddr_t), total_len); m_freem(m);
- m = m0;
- m->m_pkthdr.len = m->m_len = total_len;
- } else {
- bcopy(mtod(m, caddr_t), mtod(m0, caddr_t), (MHLEN - 2));
- m->m_len = total_len - (MHLEN - 2);
- m->m_data += (MHLEN - 2);
- m0->m_next = m;
- m0->m_len = (MHLEN - 2);
- m = m0;
- m->m_pkthdr.len = total_len;
- }
-#else
- m->m_pkthdr.len = m->m_len = total_len;
-#endif
ifp->if_ipackets++;
eh = mtod(m, struct ether_header *);
- m->m_pkthdr.rcvif = ifp;
#if NBPF > 0
/*
@@ -2421,6 +2462,8 @@ static void mx_watchdog(ifp)
mx_autoneg_mii(sc, MX_FLAG_DELAYTIMEO, 1);
else
mx_autoneg(sc, MX_FLAG_DELAYTIMEO, 1);
+ if (!(ifp->if_flags & IFF_UP))
+ mx_stop(sc);
return;
}
@@ -2500,22 +2543,14 @@ static void mx_stop(sc)
* Stop all chip I/O so that the kernel's probe routines don't
* get confused by errant DMAs when rebooting.
*/
-static void mx_shutdown(howto, arg)
- int howto;
- void *arg;
+static void mx_shutdown(dev)
+ device_t dev;
{
- struct mx_softc *sc = (struct mx_softc *)arg;
+ struct mx_softc *sc;
+
+ sc = device_get_softc(dev);
mx_stop(sc);
return;
}
-
-static struct pci_device mx_device = {
- "mx",
- mx_probe,
- mx_attach,
- &mx_count,
- NULL
-};
-COMPAT_PCI_DRIVER(mx, mx_device);
diff --git a/sys/pci/if_mxreg.h b/sys/pci/if_mxreg.h
index 69721ad18505..5755826ee512 100644
--- a/sys/pci/if_mxreg.h
+++ b/sys/pci/if_mxreg.h
@@ -29,7 +29,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: if_mxreg.h,v 1.6 1999/05/26 23:01:48 gallatin Exp $
+ * $Id: if_mxreg.h,v 1.7 1999/05/28 18:43:14 wpaul Exp $
*/
/*
@@ -482,6 +482,9 @@ struct mx_softc {
struct ifmedia ifmedia; /* media info */
bus_space_handle_t mx_bhandle; /* bus space handle */
bus_space_tag_t mx_btag; /* bus space tag */
+ void *mx_intrhand;
+ struct resource *mx_irq;
+ struct resource *mx_res;
struct mx_type *mx_info; /* Macronix adapter info */
struct mx_type *mx_pinfo; /* phy info */
u_int8_t mx_unit; /* interface number */
@@ -514,6 +517,7 @@ struct mx_softc {
bus_space_read_1(sc->mx_btag, sc->mx_bhandle, reg)
#define MX_TIMEOUT 1000
+#define ETHER_ALIGN 2
/*
* General constants that are fun to know.