summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@cvs.openbsd.org>1999-03-26 06:34:29 +0000
committerFederico G. Schwindt <fgsch@cvs.openbsd.org>1999-03-26 06:34:29 +0000
commit7fce51bb872afa6c152868f7d14ba188bf132cb6 (patch)
tree64acb56b49a52de90437fb0acd1fe8daa86aee60
parent818585d7e5830c7105190e5bc04ab8e3e40221b9 (diff)
Add support for some 100Mbit PCMCIA cards.
Change the ne2000_detect parm list.
-rw-r--r--sys/dev/ic/ne2000.c52
-rw-r--r--sys/dev/ic/ne2000var.h6
-rw-r--r--sys/dev/isa/if_ne_isa.c15
-rw-r--r--sys/dev/isa/if_ne_isapnp.c4
-rw-r--r--sys/dev/pcmcia/if_ne_pcmcia.c14
5 files changed, 57 insertions, 34 deletions
diff --git a/sys/dev/ic/ne2000.c b/sys/dev/ic/ne2000.c
index 97c33e106d5..9ad0e82fea1 100644
--- a/sys/dev/ic/ne2000.c
+++ b/sys/dev/ic/ne2000.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ne2000.c,v 1.6 1998/11/06 06:32:15 fgsch Exp $ */
+/* $OpenBSD: ne2000.c,v 1.7 1999/03/26 06:34:26 fgsch Exp $ */
/* $NetBSD: ne2000.c,v 1.12 1998/06/10 01:15:50 thorpej Exp $ */
/*-
@@ -119,13 +119,13 @@ ne2000_attach(nsc, myea, media, nmedia, defmedia)
/*
* Detect it again; this gives us the memory size.
*/
- nsc->sc_type = ne2000_detect(nict, nich, asict, asich);
+ nsc->sc_type = ne2000_detect(nsc);
if (nsc->sc_type == 0) {
printf("%s: where did the card go?\n", dsc->sc_dev.dv_xname);
return;
}
- useword = (nsc->sc_type == NE2000_TYPE_NE2000);
+ useword = (nsc->sc_type != NE2000_TYPE_NE1000);
dsc->cr_proto = ED_CR_RD2;
@@ -138,7 +138,7 @@ ne2000_attach(nsc, myea, media, nmedia, defmedia)
* NE1000 gets byte-wide DMA, NE2000 gets word-wide DMA.
*/
dsc->dcr_reg = ED_DCR_FT1 | ED_DCR_LS |
- (nsc->sc_type == NE2000_TYPE_NE2000 ? ED_DCR_WTS : 0);
+ (nsc->sc_type != NE2000_TYPE_NE1000 ? ED_DCR_WTS : 0);
dsc->test_mem = ne2000_test_mem;
dsc->ring_copy = ne2000_ring_copy;
@@ -152,7 +152,7 @@ ne2000_attach(nsc, myea, media, nmedia, defmedia)
/*
* 8k of memory plus an additional 8k if an NE2000.
*/
- memsize = 8192 + (nsc->sc_type == NE2000_TYPE_NE2000 ? 8192 : 0);
+ memsize = 8192 + (nsc->sc_type != NE2000_TYPE_NE1000 ? 8192 : 0);
/*
* NIC memory doens't start at zero on an NE board.
@@ -231,7 +231,7 @@ ne2000_attach(nsc, myea, media, nmedia, defmedia)
dsc->mem_size = memsize;
- if (myea == NULL) {
+ if (myea == NULL && nsc->sc_type != NE2000_TYPE_DL10019) {
/* Read the station address. */
ne2000_readmem(nict, nich, asict, asich, 0, romdata,
sizeof(romdata), useword);
@@ -242,13 +242,7 @@ ne2000_attach(nsc, myea, media, nmedia, defmedia)
dsc->sc_arpcom.ac_enaddr[i] =
romdata[i * (useword ? 2 : 1)];
#endif
- } else
-#ifdef __NetBSD__
- bcopy(myea, dsc->sc_enaddr, sizeof(dsc->sc_enaddr));
-#else
- bcopy(myea, dsc->sc_arpcom.ac_enaddr,
- sizeof(dsc->sc_arpcom.ac_enaddr));
-#endif
+ }
/* Clear any pending interrupts that might have occurred above. */
bus_space_write_1(nict, nich, ED_P0_ISR, 0xff);
@@ -270,12 +264,14 @@ ne2000_attach(nsc, myea, media, nmedia, defmedia)
* Detect an NE-2000 or compatible. Returns a model code.
*/
int
-ne2000_detect(nict, nich, asict, asich)
- bus_space_tag_t nict;
- bus_space_handle_t nich;
- bus_space_tag_t asict;
- bus_space_handle_t asich;
+ne2000_detect(nsc)
+ struct ne2000_softc *nsc;
{
+ struct dp8390_softc *dsc = &nsc->sc_dp8390;
+ bus_space_tag_t nict = dsc->sc_regt;
+ bus_space_handle_t nich = dsc->sc_regh;
+ bus_space_tag_t asict = nsc->sc_asict;
+ bus_space_handle_t asich = nsc->sc_asich;
static u_int8_t test_pattern[32] = "THIS is A memory TEST pattern";
u_int8_t test_buffer[32], tmp;
int i, rv = 0;
@@ -409,8 +405,20 @@ ne2000_detect(nict, nich, asict, asich)
rv = NE2000_TYPE_NE2000;
} else {
- /* We're an NE1000. */
- rv = NE2000_TYPE_NE1000;
+ tmp = 0;
+ for (i = 4; i < 12; i++)
+ tmp += bus_space_read_1(asict, asich, i);
+
+ if (tmp == 0xff) {
+ for (i = 0; i < ETHER_ADDR_LEN; i++)
+ dsc->sc_arpcom.ac_enaddr[i] =
+ bus_space_read_1(asict, asich, i + 4);
+
+ rv = NE2000_TYPE_DL10019;
+ } else {
+ /* We're an NE1000. */
+ rv = NE2000_TYPE_NE1000;
+ }
}
/* Clear any pending interrupts that might have occurred above. */
@@ -607,7 +615,7 @@ ne2000_ring_copy(sc, src, dst, amount)
bus_space_tag_t asict = nsc->sc_asict;
bus_space_handle_t asich = nsc->sc_asich;
u_short tmp_amount;
- int useword = (nsc->sc_type == NE2000_TYPE_NE2000);
+ int useword = (nsc->sc_type != NE2000_TYPE_NE1000);
/* Does copy wrap to lower addr in ring buffer? */
if (src + amount > sc->mem_end) {
@@ -638,7 +646,7 @@ ne2000_read_hdr(sc, buf, hdr)
ne2000_readmem(sc->sc_regt, sc->sc_regh, nsc->sc_asict, nsc->sc_asich,
buf, (u_int8_t *)hdr, sizeof(struct dp8390_ring),
- (nsc->sc_type == NE2000_TYPE_NE2000));
+ (nsc->sc_type != NE2000_TYPE_NE1000));
#if BYTE_ORDER == BIG_ENDIAN
hdr->count = swap16(hdr->count);
#endif
diff --git a/sys/dev/ic/ne2000var.h b/sys/dev/ic/ne2000var.h
index 3e8d2bd7d38..982458d8f33 100644
--- a/sys/dev/ic/ne2000var.h
+++ b/sys/dev/ic/ne2000var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ne2000var.h,v 1.2 1998/11/06 06:32:15 fgsch Exp $ */
+/* $OpenBSD: ne2000var.h,v 1.3 1999/03/26 06:34:27 fgsch Exp $ */
/* $NetBSD: ne2000var.h,v 1.2 1997/10/14 22:54:12 thorpej Exp $ */
/*-
@@ -53,10 +53,10 @@ struct ne2000_softc {
/* sc_type */
#define NE2000_TYPE_NE1000 1
#define NE2000_TYPE_NE2000 2
+#define NE2000_TYPE_DL10019 3
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));
+int ne2000_detect __P((struct ne2000_softc *));
#endif /* _DEV_IC_NE2000VAR_H_ */
diff --git a/sys/dev/isa/if_ne_isa.c b/sys/dev/isa/if_ne_isa.c
index ae0093eaefe..704e4c05bf5 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.2 1998/11/06 06:32:15 fgsch Exp $ */
+/* $OpenBSD: if_ne_isa.c,v 1.3 1999/03/26 06:34:27 fgsch Exp $ */
/* $NetBSD: if_ne_isa.c,v 1.6 1998/07/05 06:49:13 jonathan Exp $ */
/*-
@@ -112,6 +112,9 @@ ne_isa_match(parent, match, aux)
struct device *parent;
void *match, *aux;
{
+ struct ne_isa_softc *isc = match;
+ struct ne2000_softc *nsc = &isc->sc_ne2000;
+ struct dp8390_softc *dsc = &nsc->sc_dp8390;
struct isa_attach_args *ia = aux;
bus_space_tag_t nict = ia->ia_iot;
bus_space_handle_t nich;
@@ -138,8 +141,14 @@ ne_isa_match(parent, match, aux)
NE2000_ASIC_NPORTS, &asich))
goto out;
+ dsc->sc_regt = nict;
+ dsc->sc_regh = nich;
+
+ nsc->sc_asict = asict;
+ nsc->sc_asich = asich;
+
/* Look for an NE2000-compatible card. */
- rv = ne2000_detect(nict, nich, asict, asich);
+ rv = ne2000_detect(nsc);
if (rv)
ia->ia_iosize = NE2000_NPORTS;
@@ -196,7 +205,7 @@ ne_isa_attach(parent, self, aux)
* Detect it again, so we can print some information about the
* interface.
*/
- netype = ne2000_detect(nict, nich, asict, asich);
+ netype = ne2000_detect(nsc);
switch (netype) {
case NE2000_TYPE_NE1000:
typestr = "NE1000";
diff --git a/sys/dev/isa/if_ne_isapnp.c b/sys/dev/isa/if_ne_isapnp.c
index a49a44bab03..5c336bc725b 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.2 1998/11/06 06:32:15 fgsch Exp $ */
+/* $OpenBSD: if_ne_isapnp.c,v 1.3 1999/03/26 06:34:27 fgsch Exp $ */
/* $NetBSD: if_ne_isapnp.c,v 1.7 1998/07/23 19:30:45 christos Exp $ */
/*-
@@ -168,7 +168,7 @@ ne_isapnp_attach(
* Detect it again, so we can print some information about the
* interface.
*/
- netype = ne2000_detect(nict, nich, asict, asich);
+ netype = ne2000_detect(nsc);
switch (netype) {
case NE2000_TYPE_NE1000:
typestr = "NE1000";
diff --git a/sys/dev/pcmcia/if_ne_pcmcia.c b/sys/dev/pcmcia/if_ne_pcmcia.c
index 3c976c47cb1..4c0b791f9cd 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.7 1999/01/31 11:28:39 fgsch Exp $ */
+/* $OpenBSD: if_ne_pcmcia.c,v 1.8 1999/03/26 06:34:28 fgsch Exp $ */
/* $NetBSD: if_ne_pcmcia.c,v 1.17 1998/08/15 19:00:04 thorpej Exp $ */
/*
@@ -220,6 +220,11 @@ struct ne2000dev {
PCMCIA_VENDOR_KINGSTON, PCMCIA_PRODUCT_KINGSTON_KNE_PC2,
PCMCIA_CIS_KINGSTON_KNE_PC2,
0, 0x0180, { 0x00, 0xc0, 0xf0 } },
+
+ { PCMCIA_STR_LINKSYS_FAST_ECARD,
+ PCMCIA_VENDOR_LINKSYS, PCMCIA_PRODUCT_LINKSYS_FAST_ECARD,
+ PCMCIA_CIS_LINKSYS_FAST_ECARD,
+ 0, -1, { 0x00, 0x80, 0xc8} },
#if 0
/* the rest of these are stolen from the linux pcnet pcmcia device
driver. Since I don't know the manfid or cis info strings for
@@ -354,7 +359,7 @@ ne_pcmcia_attach(parent, self, aux)
struct pcmcia_mem_handle pcmh;
bus_addr_t offset;
int i, j, mwindow;
- u_int8_t myea[6], *enaddr = NULL;
+ u_int8_t *enaddr = NULL;
void (*npp_init_media) __P((struct dp8390_softc *, int **,
int *, int *));
int *media, nmedia, defmedia;
@@ -474,11 +479,12 @@ ne_pcmcia_attach(parent, self, aux)
return;
}
for (j = 0; j < ETHER_ADDR_LEN; j++)
- myea[j] = bus_space_read_1(pcmh.memt,
+ dsc->sc_arpcom.ac_enaddr[j] =
+ bus_space_read_1(pcmh.memt,
pcmh.memh, offset + (j * 2));
pcmcia_mem_unmap(pa->pf, mwindow);
pcmcia_mem_free(pa->pf, &pcmh);
- enaddr = myea;
+ enaddr = dsc->sc_arpcom.ac_enaddr;
}
break;
}