summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/files4
-rw-r--r--sys/dev/ic/dp8390reg.h9
-rw-r--r--sys/dev/ic/ne2000.c7
-rw-r--r--sys/dev/ic/ne2000var.h5
-rw-r--r--sys/dev/isa/files.isa4
-rw-r--r--sys/dev/isa/files.isapnp4
-rw-r--r--sys/dev/isa/if_ne_isa.c37
-rw-r--r--sys/dev/isa/if_ne_isapnp.c37
-rw-r--r--sys/dev/pci/files.pci4
-rw-r--r--sys/dev/pci/if_ne_pci.c122
-rw-r--r--sys/dev/pcmcia/files.pcmcia4
-rw-r--r--sys/dev/pcmcia/if_ne_pcmcia.c38
12 files changed, 219 insertions, 56 deletions
diff --git a/sys/conf/files b/sys/conf/files
index 45befc05042..f54a9d926dd 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -1,4 +1,4 @@
-# $OpenBSD: files,v 1.96 1998/09/28 02:43:22 jason Exp $
+# $OpenBSD: files,v 1.97 1998/11/06 06:32:14 fgsch Exp $
# $NetBSD: files,v 1.87 1996/05/19 17:17:50 jonathan Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@@ -35,6 +35,7 @@ define ncr5380sbc # NCR 5380 SCSI Bus Controller
define ncr53c9x # NCR 53c9x or Emulex ESP SCSI Controller
define pdq # DEC FDDI chipset
define dp8390nic # 8390-family Ethernet controllers
+define rtl80x9 # RealTek 8019/8029 NE2000-compatible
# a wscons output device; used later, but needs to be near the top for
# common file (e.g. vga) definitions.
@@ -170,6 +171,7 @@ file dev/ic/ncr53c9x.c ncr53c9x
file dev/ic/pdq.c pdq
file dev/ic/pdq_ifsubr.c pdq
file dev/ic/dp8390.c dp8390nic
+file dev/ic/rtl80x9.c rtl80x9
file dev/mulaw.c mulaw
file dev/vnd.c vnd needs-flag
file dev/rnd.c
diff --git a/sys/dev/ic/dp8390reg.h b/sys/dev/ic/dp8390reg.h
index d024396ad53..3917d88297a 100644
--- a/sys/dev/ic/dp8390reg.h
+++ b/sys/dev/ic/dp8390reg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: dp8390reg.h,v 1.6 1998/10/04 23:09:56 niklas Exp $ */
+/* $OpenBSD: dp8390reg.h,v 1.7 1998/11/06 06:32:14 fgsch Exp $ */
/* $NetBSD: dp8390reg.h,v 1.3 1997/04/29 04:32:08 scottr Exp $ */
/*
@@ -149,14 +149,15 @@
* 0 0 0
* 0 1 1
* 1 0 2
- * 1 1 reserved
+ * 1 1 3 (only on chips which have extensions to the dp8390)
*/
#define ED_CR_PS0 0x40
#define ED_CR_PS1 0x80
/* bit encoded aliases */
#define ED_CR_PAGE_0 0x00 /* (for consistency) */
-#define ED_CR_PAGE_1 0x40
-#define ED_CR_PAGE_2 0x80
+#define ED_CR_PAGE_1 (ED_CR_PS0)
+#define ED_CR_PAGE_2 (ED_CR_PS1)
+#define ED_CR_PAGE_3 (ED_CR_PS1|ED_CR_PS0)
/*
* Interrupt Status Register (ISR) definitions
diff --git a/sys/dev/ic/ne2000.c b/sys/dev/ic/ne2000.c
index 3df27966112..97c33e106d5 100644
--- a/sys/dev/ic/ne2000.c
+++ b/sys/dev/ic/ne2000.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ne2000.c,v 1.5 1998/10/14 07:34:42 fgsch Exp $ */
+/* $OpenBSD: ne2000.c,v 1.6 1998/11/06 06:32:15 fgsch Exp $ */
/* $NetBSD: ne2000.c,v 1.12 1998/06/10 01:15:50 thorpej Exp $ */
/*-
@@ -103,9 +103,10 @@ struct cfdriver ne_cd = {
};
void
-ne2000_attach(nsc, myea)
+ne2000_attach(nsc, myea, media, nmedia, defmedia)
struct ne2000_softc *nsc;
u_int8_t *myea;
+ int *media, nmedia, defmedia;
{
struct dp8390_softc *dsc = &nsc->sc_dp8390;
bus_space_tag_t nict = dsc->sc_regt;
@@ -252,7 +253,7 @@ ne2000_attach(nsc, myea)
/* Clear any pending interrupts that might have occurred above. */
bus_space_write_1(nict, nich, ED_P0_ISR, 0xff);
- if (dp8390_config(dsc, NULL, 0, 0)) {
+ if (dp8390_config(dsc, media, nmedia, defmedia)) {
printf("%s: setup failed\n", dsc->sc_dev.dv_xname);
return;
}
diff --git a/sys/dev/ic/ne2000var.h b/sys/dev/ic/ne2000var.h
index 3fba7b37e26..3e8d2bd7d38 100644
--- a/sys/dev/ic/ne2000var.h
+++ b/sys/dev/ic/ne2000var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ne2000var.h,v 1.1 1998/09/22 06:38:04 fgsch Exp $ */
+/* $OpenBSD: ne2000var.h,v 1.2 1998/11/06 06:32:15 fgsch Exp $ */
/* $NetBSD: ne2000var.h,v 1.2 1997/10/14 22:54:12 thorpej Exp $ */
/*-
@@ -54,7 +54,8 @@ struct ne2000_softc {
#define NE2000_TYPE_NE1000 1
#define NE2000_TYPE_NE2000 2
-void ne2000_attach __P((struct ne2000_softc *, u_int8_t *));
+void ne2000_attach __P((struct ne2000_softc *, u_int8_t *,
+ int *, int, int));
int ne2000_detect __P((bus_space_tag_t, bus_space_handle_t,
bus_space_tag_t, bus_space_handle_t));
diff --git a/sys/dev/isa/files.isa b/sys/dev/isa/files.isa
index 56c4d63e957..ae8390bf79c 100644
--- a/sys/dev/isa/files.isa
+++ b/sys/dev/isa/files.isa
@@ -1,4 +1,4 @@
-# $OpenBSD: files.isa,v 1.45 1998/09/28 02:26:50 jason Exp $
+# $OpenBSD: files.isa,v 1.46 1998/11/06 06:32:15 fgsch Exp $
# $NetBSD: files.isa,v 1.21 1996/05/16 03:45:55 mycroft Exp $
#
# Config.new file and device description for machine-independent ISA code.
@@ -220,7 +220,7 @@ file dev/isa/if_le.c le_isa | le_pci
file dev/isa/if_le_isa.c le_isa
# Novell NE1000, NE2000, and clones
-attach ne at isa with ne_isa
+attach ne at isa with ne_isa: rtl80x9
file dev/isa/if_ne_isa.c ne_isa
# SMC91Cxx Ethernet Controllers
diff --git a/sys/dev/isa/files.isapnp b/sys/dev/isa/files.isapnp
index 69ba14f2db4..548511d4d89 100644
--- a/sys/dev/isa/files.isapnp
+++ b/sys/dev/isa/files.isapnp
@@ -1,4 +1,4 @@
-# $OpenBSD: files.isapnp,v 1.8 1998/09/22 06:33:18 fgsch Exp $
+# $OpenBSD: files.isapnp,v 1.9 1998/11/06 06:32:15 fgsch Exp $
# $NetBSD: files.isapnp,v 1.7 1997/10/16 17:16:36 matt Exp $
#
# Config file and device description for machine-independent ISAPnP code.
@@ -30,7 +30,7 @@ file dev/isa/if_le_isapnp.c le_isapnp
attach ep at isapnp with ep_isapnp
file dev/isa/if_ep_isapnp.c ep_isapnp
-attach ne at isapnp with ne_isapnp
+attach ne at isapnp with ne_isapnp: rtl80x9
file dev/isa/if_ne_isapnp.c ne_isapnp
# Yamaha OPL3-SA3
diff --git a/sys/dev/isa/if_ne_isa.c b/sys/dev/isa/if_ne_isa.c
index 94e6144d5ae..ae0093eaefe 100644
--- a/sys/dev/isa/if_ne_isa.c
+++ b/sys/dev/isa/if_ne_isa.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ne_isa.c,v 1.1 1998/09/22 06:33:19 fgsch Exp $ */
+/* $OpenBSD: if_ne_isa.c,v 1.2 1998/11/06 06:32:15 fgsch Exp $ */
/* $NetBSD: if_ne_isa.c,v 1.6 1998/07/05 06:49:13 jonathan Exp $ */
/*-
@@ -88,6 +88,9 @@
#include <dev/ic/ne2000reg.h>
#include <dev/ic/ne2000var.h>
+#include <dev/ic/rtl80x9reg.h>
+#include <dev/ic/rtl80x9var.h>
+
#include <dev/isa/isavar.h>
int ne_isa_match __P((struct device *, void *, void *));
@@ -159,10 +162,18 @@ ne_isa_attach(parent, self, aux)
bus_space_handle_t nich;
bus_space_tag_t asict = nict;
bus_space_handle_t asich;
+ void (*npp_init_media) __P((struct dp8390_softc *, int **,
+ int *, int *));
+ int *media, nmedia, defmedia;
const char *typestr;
+ int netype;
printf("\n");
+ npp_init_media = NULL;
+ media = NULL;
+ nmedia = defmedia = 0;
+
/* Map i/o space. */
if (bus_space_map(nict, ia->ia_iobase, NE2000_NPORTS, 0, &nich)) {
printf("%s: can't map i/o space\n", dsc->sc_dev.dv_xname);
@@ -185,13 +196,29 @@ ne_isa_attach(parent, self, aux)
* Detect it again, so we can print some information about the
* interface.
*/
- switch (ne2000_detect(nict, nich, asict, asich)) {
+ netype = ne2000_detect(nict, nich, asict, asich);
+ switch (netype) {
case NE2000_TYPE_NE1000:
typestr = "NE1000";
break;
case NE2000_TYPE_NE2000:
typestr = "NE2000";
+ /*
+ * Check for a RealTek 8019.
+ */
+ bus_space_write_1(nict, nich, ED_P0_CR,
+ ED_CR_PAGE_0 | ED_CR_STP);
+ if (bus_space_read_1(nict, nich, NERTL_RTL0_8019ID0) ==
+ RTL0_8019ID0 &&
+ bus_space_read_1(nict, nich, NERTL_RTL0_8019ID1) ==
+ RTL0_8019ID1) {
+ typestr = "NE2000 (RTL8019)";
+ npp_init_media = rtl80x9_init_media;
+ dsc->sc_mediachange = rtl80x9_mediachange;
+ dsc->sc_mediastatus = rtl80x9_mediastatus;
+ dsc->init_card = rtl80x9_init_card;
+ }
break;
default:
@@ -201,6 +228,10 @@ ne_isa_attach(parent, self, aux)
printf("%s: %s Ethernet\n", dsc->sc_dev.dv_xname, typestr);
+ /* Initialize media, if we have it. */
+ if (npp_init_media != NULL)
+ (*npp_init_media)(dsc, &media, &nmedia, &defmedia);
+
/* This interface is always enabled. */
dsc->sc_enabled = 1;
@@ -208,7 +239,7 @@ ne_isa_attach(parent, self, aux)
* Do generic NE2000 attach. This will read the station address
* from the EEPROM.
*/
- ne2000_attach(nsc, NULL);
+ ne2000_attach(nsc, NULL, media, nmedia, defmedia);
/* Establish the interrupt handler. */
isc->sc_ih = isa_intr_establish(ia->ia_ic, ia->ia_irq, IST_EDGE,
diff --git a/sys/dev/isa/if_ne_isapnp.c b/sys/dev/isa/if_ne_isapnp.c
index b851ad5d084..a49a44bab03 100644
--- a/sys/dev/isa/if_ne_isapnp.c
+++ b/sys/dev/isa/if_ne_isapnp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ne_isapnp.c,v 1.1 1998/09/22 06:33:19 fgsch Exp $ */
+/* $OpenBSD: if_ne_isapnp.c,v 1.2 1998/11/06 06:32:15 fgsch Exp $ */
/* $NetBSD: if_ne_isapnp.c,v 1.7 1998/07/23 19:30:45 christos Exp $ */
/*-
@@ -88,6 +88,9 @@
#include <dev/ic/ne2000reg.h>
#include <dev/ic/ne2000var.h>
+#include <dev/ic/rtl80x9reg.h>
+#include <dev/ic/rtl80x9var.h>
+
#include <dev/isa/isavar.h>
#include <dev/isa/isapnpreg.h>
@@ -132,10 +135,18 @@ ne_isapnp_attach(
bus_space_handle_t nich;
bus_space_tag_t asict;
bus_space_handle_t asich;
+ void (*npp_init_media) __P((struct dp8390_softc *, int **,
+ int *, int *));
+ int *media, nmedia, defmedia;
const char *typestr;
+ int netype;
printf("\n");
+ npp_init_media = NULL;
+ media = NULL;
+ nmedia = defmedia = 0;
+
nict = ipa->ia_iot;
nich = ipa->ipa_io[0].h;
@@ -157,13 +168,29 @@ ne_isapnp_attach(
* Detect it again, so we can print some information about the
* interface.
*/
- switch (ne2000_detect(nict, nich, asict, asich)) {
+ netype = ne2000_detect(nict, nich, asict, asich);
+ switch (netype) {
case NE2000_TYPE_NE1000:
typestr = "NE1000";
break;
case NE2000_TYPE_NE2000:
typestr = "NE2000";
+ /*
+ * Check for a RealTek 8019.
+ */
+ bus_space_write_1(nict, nich, ED_P0_CR,
+ ED_CR_PAGE_0 | ED_CR_STP);
+ if (bus_space_read_1(nict, nich, NERTL_RTL0_8019ID0) ==
+ RTL0_8019ID0 &&
+ bus_space_read_1(nict, nich, NERTL_RTL0_8019ID1) ==
+ RTL0_8019ID1) {
+ typestr = "NE2000 (RTL8019)";
+ npp_init_media = rtl80x9_init_media;
+ dsc->sc_mediachange = rtl80x9_mediachange;
+ dsc->sc_mediastatus = rtl80x9_mediastatus;
+ dsc->init_card = rtl80x9_init_card;
+ }
break;
default:
@@ -173,6 +200,10 @@ ne_isapnp_attach(
printf("%s: %s Ethernet\n", dsc->sc_dev.dv_xname, typestr);
+ /* Initialize media, if we have it. */
+ if (npp_init_media != NULL)
+ (*npp_init_media)(dsc, &media, &nmedia, &defmedia);
+
/* This interface is always enabled. */
dsc->sc_enabled = 1;
@@ -180,7 +211,7 @@ ne_isapnp_attach(
* Do generic NE2000 attach. This will read the station address
* from the EEPROM.
*/
- ne2000_attach(nsc, NULL);
+ ne2000_attach(nsc, NULL, media, nmedia, defmedia);
/* Establish the interrupt handler. */
isc->sc_ih = isa_intr_establish(ipa->ia_ic, ipa->ipa_irq[0].num,
diff --git a/sys/dev/pci/files.pci b/sys/dev/pci/files.pci
index ca0c57f02a0..8bbd59cd28a 100644
--- a/sys/dev/pci/files.pci
+++ b/sys/dev/pci/files.pci
@@ -1,4 +1,4 @@
-# $OpenBSD: files.pci,v 1.27 1998/10/10 03:55:05 jason Exp $
+# $OpenBSD: files.pci,v 1.28 1998/11/06 06:32:15 fgsch Exp $
# $NetBSD: files.pci,v 1.20 1996/09/24 17:47:15 christos Exp $
#
# Config.new file and device description for machine-independent PCI code.
@@ -117,5 +117,5 @@ attach tx at pci
file dev/pci/if_tx.c tx
# NE2000-compatible PCI Ethernet cards
-attach ne at pci with ne_pci
+attach ne at pci with ne_pci: rtl80x9
file dev/pci/if_ne_pci.c ne_pci
diff --git a/sys/dev/pci/if_ne_pci.c b/sys/dev/pci/if_ne_pci.c
index 43f3f782d20..1e925c63aa7 100644
--- a/sys/dev/pci/if_ne_pci.c
+++ b/sys/dev/pci/if_ne_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ne_pci.c,v 1.2 1998/09/23 18:46:29 deraadt Exp $ */
+/* $OpenBSD: if_ne_pci.c,v 1.3 1998/11/06 06:32:15 fgsch Exp $ */
/* $NetBSD: if_ne_pci.c,v 1.8 1998/07/05 00:51:24 jonathan Exp $ */
/*-
@@ -75,6 +75,9 @@
#include <dev/ic/ne2000reg.h>
#include <dev/ic/ne2000var.h>
+#include <dev/ic/rtl80x9reg.h>
+#include <dev/ic/rtl80x9var.h>
+
struct ne_pci_softc {
struct ne2000_softc sc_ne2000; /* real "ne2000" softc */
@@ -89,38 +92,78 @@ struct cfattach ne_pci_ca = {
sizeof(struct ne_pci_softc), ne_pci_match, ne_pci_attach
};
-struct ne_pci_compatdev {
- pci_vendor_id_t vendor;
- pci_product_id_t product;
-};
+const struct ne_pci_product {
+ pci_vendor_id_t npp_vendor;
+ pci_product_id_t npp_product;
+ int (*npp_mediachange) __P((struct dp8390_softc *));
+ void (*npp_mediastatus) __P((struct dp8390_softc *,
+ struct ifmediareq *));
+ void (*npp_init_card) __P((struct dp8390_softc *));
+ void (*npp_init_media) __P((struct dp8390_softc *, int **,
+ int *, int *));
+ const char *npp_name;
+} ne_pci_products[] = {
+ { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8029,
+ rtl80x9_mediachange, rtl80x9_mediastatus,
+ rtl80x9_init_card, rtl80x9_init_media,
+ "RealTek 8029" },
+
+ { PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C940F,
+ NULL, NULL,
+ NULL, NULL,
+ "Winbond 89C940F" },
+
+ { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT86C926,
+ NULL, NULL,
+ NULL, NULL,
+ "VIA Technologies VT86C926" },
+
+ { PCI_VENDOR_SURECOM, PCI_PRODUCT_SURECOM_NE34,
+ NULL, NULL,
+ NULL, NULL,
+ "Surecom NE-34" },
+
+ { PCI_VENDOR_NETVIN, PCI_PRODUCT_NETVIN_NV5000,
+ NULL, NULL,
+ NULL, NULL,
+ "NetVin 5000" },
-struct ne_pci_compatdev ne_pci_compatdevs[] = {
- { PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8029 },
- { PCI_VENDOR_WINBOND, PCI_PRODUCT_WINBOND_W89C940F },
- { PCI_VENDOR_VIATECH, PCI_PRODUCT_VIATECH_VT86C926 },
- { PCI_VENDOR_SURECOM, PCI_PRODUCT_SURECOM_NE34 },
- { PCI_VENDOR_NETVIN, PCI_PRODUCT_NETVIN_NV5000 },
/* XXX The following entries need sanity checking in pcidevs */
- { PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_COMPEXE },
- { PCI_VENDOR_WINBOND2, PCI_PRODUCT_WINBOND2_W89C940 },
- { PCI_VENDOR_KTI, PCI_PRODUCT_KTI_KTIE },
- { 0, 0 },
+ { PCI_VENDOR_COMPEX, PCI_PRODUCT_COMPEX_COMPEXE,
+ NULL, NULL,
+ NULL, NULL,
+ "Compex" },
+
+ { PCI_VENDOR_WINBOND2, PCI_PRODUCT_WINBOND2_W89C940,
+ NULL, NULL,
+ NULL, NULL,
+ "ProLAN" },
+
+ { PCI_VENDOR_KTI, PCI_PRODUCT_KTI_KTIE,
+ NULL, NULL,
+ NULL, NULL,
+ "KTI" },
+
+ { 0, 0,
+ NULL, NULL,
+ NULL, NULL,
+ NULL },
};
-int ne_pci_lookup __P((pcireg_t));
+const struct ne_pci_product *ne_pci_lookup __P((struct pci_attach_args *));
-int
-ne_pci_lookup(id)
- pcireg_t id;
+const struct ne_pci_product *
+ne_pci_lookup(pa)
+ struct pci_attach_args *pa;
{
- struct ne_pci_compatdev *nc;
+ const struct ne_pci_product *npp;
- for (nc = ne_pci_compatdevs; nc->vendor != 0; nc++) {
- if (PCI_VENDOR(id) == nc->vendor &&
- PCI_PRODUCT(id) == nc->product)
- return (1);
+ for (npp = ne_pci_products; npp->npp_name != NULL; npp++) {
+ if (PCI_VENDOR(pa->pa_id) == npp->npp_vendor &&
+ PCI_PRODUCT(pa->pa_id) == npp->npp_product)
+ return (npp);
}
- return (0);
+ return (NULL);
}
/*
@@ -136,8 +179,8 @@ ne_pci_match(parent, match, aux)
{
struct pci_attach_args *pa = aux;
- if (ne_pci_lookup(pa->pa_id) != 0)
- return (1);
+ if (ne_pci_lookup(pa) != NULL)
+ return (1);
return (0);
}
@@ -161,8 +204,18 @@ ne_pci_attach(parent, self, aux)
bus_space_tag_t asict;
bus_space_handle_t asich;
const char *intrstr;
+ const struct ne_pci_product *npp;
pci_intr_handle_t ih;
pcireg_t csr;
+ int *media, nmedia, defmedia;
+
+ npp = ne_pci_lookup(pa);
+ if (npp == NULL) {
+ printf("\n");
+ panic("ne_pci_attach: impossible");
+ }
+
+ printf(": %s Ethernet\n", npp->npp_name);
#ifdef __NetBSD__
if (pci_mapreg_map(pa, PCI_CBIO, PCI_MAPREG_TYPE_IO, 0,
@@ -206,13 +259,24 @@ ne_pci_attach(parent, self, aux)
/* This interface is always enabled. */
dsc->sc_enabled = 1;
- printf("\n");
+ if (npp->npp_init_media != NULL) {
+ (*npp->npp_init_media)(dsc, &media, &nmedia, &defmedia);
+ dsc->sc_mediachange = npp->npp_mediachange;
+ dsc->sc_mediastatus = npp->npp_mediastatus;
+ } else {
+ media = NULL;
+ nmedia = 0;
+ defmedia = 0;
+ }
+
+ /* Always fill in init_card; it might be used for non-media stuff. */
+ dsc->init_card = npp->npp_init_card;
/*
* Do generic NE2000 attach. This will read the station address
* from the EEPROM.
*/
- ne2000_attach(nsc, NULL);
+ ne2000_attach(nsc, NULL, media, nmedia, defmedia);
/* Map and establish the interrupt. */
if (pci_intr_map(pc, pa->pa_intrtag, pa->pa_intrpin,
diff --git a/sys/dev/pcmcia/files.pcmcia b/sys/dev/pcmcia/files.pcmcia
index 7e1bc4322d7..f244cc59cec 100644
--- a/sys/dev/pcmcia/files.pcmcia
+++ b/sys/dev/pcmcia/files.pcmcia
@@ -1,4 +1,4 @@
-# $OpenBSD: files.pcmcia,v 1.10 1998/09/22 09:16:36 fgsch Exp $
+# $OpenBSD: files.pcmcia,v 1.11 1998/11/06 06:32:15 fgsch Exp $
# $NetBSD: files.pcmcia,v 1.9 1998/06/21 18:45:41 christos Exp $
#
# Config.new file and device description for machine-independent PCMCIA code.
@@ -18,7 +18,7 @@ file dev/pcmcia/if_ep_pcmcia.c ep_pcmcia
# National Semiconductor DS8390/WD83C690-based boards
# (NE[12]000, and clones)
-attach ne at pcmcia with ne_pcmcia
+attach ne at pcmcia with ne_pcmcia: rtl80x9
file dev/pcmcia/if_ne_pcmcia.c ne_pcmcia
# Adaptec APA-1460 SCSI Host Adapter
diff --git a/sys/dev/pcmcia/if_ne_pcmcia.c b/sys/dev/pcmcia/if_ne_pcmcia.c
index 4f26ea70e7c..8d62b3c8953 100644
--- a/sys/dev/pcmcia/if_ne_pcmcia.c
+++ b/sys/dev/pcmcia/if_ne_pcmcia.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_ne_pcmcia.c,v 1.3 1998/11/05 09:12:52 fgsch Exp $ */
+/* $OpenBSD: if_ne_pcmcia.c,v 1.4 1998/11/06 06:32:15 fgsch Exp $ */
/* $NetBSD: if_ne_pcmcia.c,v 1.17 1998/08/15 19:00:04 thorpej Exp $ */
/*
@@ -59,6 +59,9 @@
#include <dev/ic/ne2000reg.h>
#include <dev/ic/ne2000var.h>
+#include <dev/ic/rtl80x9reg.h>
+#include <dev/ic/rtl80x9var.h>
+
int ne_pcmcia_match __P((struct device *, void *, void *));
void ne_pcmcia_attach __P((struct device *, struct device *, void *));
@@ -330,6 +333,14 @@ ne_pcmcia_attach(parent, self, aux)
bus_addr_t offset;
int i, j, mwindow;
u_int8_t myea[6], *enaddr = NULL;
+ void (*npp_init_media) __P((struct dp8390_softc *, int **,
+ int *, int *));
+ int *media, nmedia, defmedia;
+ const char *typestr = "";
+
+ npp_init_media = NULL;
+ media = NULL;
+ nmedia = defmedia = 0;
psc->sc_pf = pa->pf;
cfe = pa->pf->cfe_head.sqh_first;
@@ -470,9 +481,30 @@ ne_pcmcia_attach(parent, self, aux)
}
}
- printf("%s: %s Ethernet\n", dsc->sc_dev.dv_xname, ne_dev->name);
+ /*
+ * Check for a RealTek 8019.
+ */
+ bus_space_write_1(dsc->sc_regt, dsc->sc_regh, ED_P0_CR,
+ ED_CR_PAGE_0 | ED_CR_STP);
+ if (bus_space_read_1(dsc->sc_regt, dsc->sc_regh, NERTL_RTL0_8019ID0)
+ == RTL0_8019ID0 &&
+ bus_space_read_1(dsc->sc_regt, dsc->sc_regh, NERTL_RTL0_8019ID1)
+ == RTL0_8019ID1) {
+ typestr = " (RTL8019)";
+ npp_init_media = rtl80x9_init_media;
+ dsc->sc_mediachange = rtl80x9_mediachange;
+ dsc->sc_mediastatus = rtl80x9_mediastatus;
+ dsc->init_card = rtl80x9_init_card;
+ }
+
+ printf("%s: %s%s Ethernet\n", dsc->sc_dev.dv_xname, ne_dev->name,
+ typestr);
+
+ /* Initialize media, if we have it. */
+ if (npp_init_media != NULL)
+ (*npp_init_media)(dsc, &media, &nmedia, &defmedia);
- ne2000_attach(nsc, enaddr);
+ ne2000_attach(nsc, enaddr, media, nmedia, defmedia);
#if 0
pcmcia_function_disable(pa->pf);