summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>1998-09-11 12:06:59 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>1998-09-11 12:06:59 +0000
commitbda603bd61572eba5ccc500aadea950ab93662d0 (patch)
tree53af8001cd857aacc5ca089d9fed184bca9415a2
parente1ea743aa76da3731c586f7e8ae512a83dbc34be (diff)
Add a third parameter to epconfig to get the MAC address if it's a pcmcia
card and support it. Use NULL otherwise. Update the ep based drivers.
-rw-r--r--sys/dev/ic/elink3.c37
-rw-r--r--sys/dev/ic/elink3var.h5
-rw-r--r--sys/dev/isa/if_ep_isa.c6
-rw-r--r--sys/dev/isa/if_ep_isapnp.c4
-rw-r--r--sys/dev/pci/if_ep_pci.c4
5 files changed, 31 insertions, 25 deletions
diff --git a/sys/dev/ic/elink3.c b/sys/dev/ic/elink3.c
index 40e4410296b..a1aea691c21 100644
--- a/sys/dev/ic/elink3.c
+++ b/sys/dev/ic/elink3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elink3.c,v 1.25 1998/04/28 07:39:53 deraadt Exp $ */
+/* $OpenBSD: elink3.c,v 1.26 1998/09/11 12:06:54 fgsch Exp $ */
/* $NetBSD: elink3.c,v 1.32 1997/05/14 00:22:00 thorpej Exp $ */
/*
@@ -197,9 +197,10 @@ ep_complete_cmd(sc, cmd, arg)
* Back-end attach and configure.
*/
void
-epconfig(sc, chipset)
+epconfig(sc, chipset, enaddr)
struct ep_softc *sc;
u_short chipset;
+ u_int8_t *enaddr;
{
struct ifnet *ifp = &sc->sc_arpcom.ac_if;
bus_space_tag_t iot = sc->sc_iot;
@@ -215,20 +216,24 @@ epconfig(sc, chipset)
*/
GO_WINDOW(0);
- /*
- * Read the station address from the eeprom
- */
- for (i = 0; i < 3; i++) {
- u_int16_t x;
- if (epbusyeeprom(sc))
- return; /* XXX why is eeprom busy? */
- bus_space_write_2(iot, ioh, EP_W0_EEPROM_COMMAND,
- READ_EEPROM | i);
- if (epbusyeeprom(sc))
- return; /* XXX why is eeprom busy? */
- x = bus_space_read_2(iot, ioh, EP_W0_EEPROM_DATA);
- sc->sc_arpcom.ac_enaddr[(i << 1)] = x >> 8;
- sc->sc_arpcom.ac_enaddr[(i << 1) + 1] = x;
+ if (enaddr == NULL) {
+ /*
+ * Read the station address from the eeprom
+ */
+ for (i = 0; i < 3; i++) {
+ u_int16_t x;
+ if (epbusyeeprom(sc))
+ return; /* XXX why is eeprom busy? */
+ bus_space_write_2(iot, ioh, EP_W0_EEPROM_COMMAND,
+ READ_EEPROM | i);
+ if (epbusyeeprom(sc))
+ return; /* XXX why is eeprom busy? */
+ x = bus_space_read_2(iot, ioh, EP_W0_EEPROM_DATA);
+ sc->sc_arpcom.ac_enaddr[(i << 1)] = x >> 8;
+ sc->sc_arpcom.ac_enaddr[(i << 1) + 1] = x;
+ }
+ } else {
+ bcopy(enaddr, sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN);
}
printf(": address %s, ", ether_sprintf(sc->sc_arpcom.ac_enaddr));
diff --git a/sys/dev/ic/elink3var.h b/sys/dev/ic/elink3var.h
index a826a7c0dc0..98a76dd3951 100644
--- a/sys/dev/ic/elink3var.h
+++ b/sys/dev/ic/elink3var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: elink3var.h,v 1.9 1997/10/30 23:58:18 niklas Exp $ */
+/* $OpenBSD: elink3var.h,v 1.10 1998/09/11 12:06:56 fgsch Exp $ */
/* $NetBSD: elink3var.h,v 1.12 1997/03/30 22:47:11 jonathan Exp $ */
/*
@@ -71,6 +71,7 @@ struct ep_softc {
#define EP_FLAGS_SNOOPING 0x0800
#define EP_FLAGS_100MBIT 0x1000
#define EP_FLAGS_POWERMGMT 0x2000
+#define EP_FLAGS_MII 0x4000
u_short ep_chipset; /* Chipset family on this board */
#define EP_CHIPSET_UNKNOWN 0x00 /* unknown (assume 3c509) */
@@ -94,6 +95,6 @@ struct ep_softc {
};
u_int16_t epreadeeprom __P((bus_space_tag_t, bus_space_handle_t, int));
-void epconfig __P((struct ep_softc *, u_short));
+void epconfig __P((struct ep_softc *, u_short, u_int8_t *));
int epintr __P((void *));
void epstop __P((struct ep_softc *));
diff --git a/sys/dev/isa/if_ep_isa.c b/sys/dev/isa/if_ep_isa.c
index 4390cc6b81d..ea5b21f412d 100644
--- a/sys/dev/isa/if_ep_isa.c
+++ b/sys/dev/isa/if_ep_isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ep_isa.c,v 1.14 1998/06/02 20:29:02 deraadt Exp $ */
+/* $OpenBSD: if_ep_isa.c,v 1.15 1998/09/11 12:06:57 fgsch Exp $ */
/* $NetBSD: if_ep_isa.c,v 1.5 1996/05/12 23:52:36 mycroft Exp $ */
/*
@@ -285,13 +285,13 @@ ep_isa_attach(parent, self, aux)
chipset = (int)(long)ia->ia_aux;
if ((chipset & 0xfff0) == PROD_ID_3C509) {
- epconfig(sc, EP_CHIPSET_3C509);
+ epconfig(sc, EP_CHIPSET_3C509, NULL);
} else {
/*
* XXX: Maybe a 3c515, but the check in ep_isa_probe looks
* at the moment only for a 3c509.
*/
- epconfig(sc, EP_CHIPSET_UNKNOWN);
+ epconfig(sc, EP_CHIPSET_UNKNOWN, NULL);
}
sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
diff --git a/sys/dev/isa/if_ep_isapnp.c b/sys/dev/isa/if_ep_isapnp.c
index 67b3c02235e..3f86363e31d 100644
--- a/sys/dev/isa/if_ep_isapnp.c
+++ b/sys/dev/isa/if_ep_isapnp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ep_isapnp.c,v 1.2 1998/03/23 03:06:07 deraadt Exp $ */
+/* $OpenBSD: if_ep_isapnp.c,v 1.3 1998/09/11 12:06:57 fgsch Exp $ */
/* $NetBSD: if_ep_isapnp.c,v 1.5 1996/05/12 23:52:36 mycroft Exp $ */
/*
@@ -115,7 +115,7 @@ ep_isapnp_attach(parent, self, aux)
sc->bustype = EP_BUS_ISA;
/* Should look at ia->ia_devident... */
- epconfig(sc, EP_CHIPSET_3C509);
+ epconfig(sc, EP_CHIPSET_3C509, NULL);
sc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
IPL_NET, epintr, sc, sc->sc_dev.dv_xname);
diff --git a/sys/dev/pci/if_ep_pci.c b/sys/dev/pci/if_ep_pci.c
index afe86e0bb8d..a952a021143 100644
--- a/sys/dev/pci/if_ep_pci.c
+++ b/sys/dev/pci/if_ep_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ep_pci.c,v 1.15 1998/09/02 03:01:05 jason Exp $ */
+/* $OpenBSD: if_ep_pci.c,v 1.16 1998/09/11 12:06:58 fgsch Exp $ */
/* $NetBSD: if_ep_pci.c,v 1.13 1996/10/21 22:56:38 thorpej Exp $ */
/*
@@ -140,7 +140,7 @@ ep_pci_attach(parent, self, aux)
GO_WINDOW(0);
- epconfig(sc, EP_CHIPSET_VORTEX);
+ epconfig(sc, EP_CHIPSET_VORTEX, NULL);
/* Enable the card. */
pci_conf_write(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG,