PR/29925: Mihai CHELARU: Fix for stge 1023.
This commit is contained in:
parent
25a6efd600
commit
5a8da30681
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_stge.c,v 1.28 2005/06/25 21:43:38 bouyer Exp $ */
|
||||
/* $NetBSD: if_stge.c,v 1.29 2005/07/25 00:41:12 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -42,7 +42,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.28 2005/06/25 21:43:38 bouyer Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.29 2005/07/25 00:41:12 christos Exp $");
|
||||
|
||||
#include "bpfilter.h"
|
||||
|
||||
|
@ -277,9 +277,7 @@ static void stge_shutdown(void *);
|
|||
static void stge_reset(struct stge_softc *);
|
||||
static void stge_rxdrain(struct stge_softc *);
|
||||
static int stge_add_rxbuf(struct stge_softc *, int);
|
||||
#if 0
|
||||
static void stge_read_eeprom(struct stge_softc *, int, uint16_t *);
|
||||
#endif
|
||||
static void stge_tick(void *);
|
||||
|
||||
static void stge_stats_update(struct stge_softc *);
|
||||
|
@ -301,6 +299,7 @@ static int stge_match(struct device *, struct cfdata *, void *);
|
|||
static void stge_attach(struct device *, struct device *, void *);
|
||||
|
||||
int stge_copy_small = 0;
|
||||
int stge_1023_bug = 0; /* XXX: ST1023 works only in promisc mode */
|
||||
|
||||
CFATTACH_DECL(stge, sizeof(struct stge_softc),
|
||||
stge_match, stge_attach, NULL, NULL);
|
||||
|
@ -328,6 +327,9 @@ static const struct stge_product {
|
|||
pci_product_id_t stge_product;
|
||||
const char *stge_name;
|
||||
} stge_products[] = {
|
||||
{ PCI_VENDOR_SUNDANCETI, PCI_PRODUCT_SUNDANCETI_ST1023,
|
||||
"Sundance ST-1023 Gigabit Ethernet" },
|
||||
|
||||
{ PCI_VENDOR_SUNDANCETI, PCI_PRODUCT_SUNDANCETI_ST2021,
|
||||
"Sundance ST-2021 Gigabit Ethernet" },
|
||||
|
||||
|
@ -565,8 +567,10 @@ stge_attach(struct device *parent, struct device *self, void *aux)
|
|||
* Reading the station address from the EEPROM doesn't seem
|
||||
* to work, at least on my sample boards. Instead, since
|
||||
* the reset sequence does AutoInit, read it from the station
|
||||
* address registers.
|
||||
* address registers. For Sundance 1023 you can only read it
|
||||
* from EEPROM.
|
||||
*/
|
||||
if (sp->stge_product != PCI_PRODUCT_SUNDANCETI_ST1023) {
|
||||
enaddr[0] = bus_space_read_2(sc->sc_st, sc->sc_sh,
|
||||
STGE_StationAddress0) & 0xff;
|
||||
enaddr[1] = bus_space_read_2(sc->sc_st, sc->sc_sh,
|
||||
|
@ -579,6 +583,16 @@ stge_attach(struct device *parent, struct device *self, void *aux)
|
|||
STGE_StationAddress2) & 0xff;
|
||||
enaddr[5] = bus_space_read_2(sc->sc_st, sc->sc_sh,
|
||||
STGE_StationAddress2) >> 8;
|
||||
else {
|
||||
uint16_t myaddr[ETHER_ADDR_LEN / 2];
|
||||
for (i = 0; i <ETHER_ADDR_LEN / 2; i++) {
|
||||
stge_read_eeprom(sc, STGE_EEPROM_StationAddress0 + i,
|
||||
&myaddr[i]);
|
||||
myaddr[i] = le16toh(myaddr[i]);
|
||||
}
|
||||
(void)memcpy(enaddr, myaddr, sizeof(enaddr));
|
||||
stge_1023_bug = 1;
|
||||
}
|
||||
|
||||
printf("%s: Ethernet address %s\n", sc->sc_dev.dv_xname,
|
||||
ether_sprintf(enaddr));
|
||||
|
@ -1761,7 +1775,6 @@ stge_stop(struct ifnet *ifp, int disable)
|
|||
ifp->if_timer = 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
stge_eeprom_wait(struct stge_softc *sc)
|
||||
{
|
||||
|
@ -1796,7 +1809,6 @@ stge_read_eeprom(struct stge_softc *sc, int offset, uint16_t *data)
|
|||
sc->sc_dev.dv_xname);
|
||||
*data = bus_space_read_2(sc->sc_st, sc->sc_sh, STGE_EepromData);
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
/*
|
||||
* stge_add_rxbuf:
|
||||
|
@ -1863,6 +1875,10 @@ stge_set_filter(struct stge_softc *sc)
|
|||
if (ifp->if_flags & IFF_BROADCAST)
|
||||
sc->sc_ReceiveMode |= RM_ReceiveBroadcast;
|
||||
|
||||
/* XXX: ST1023 only works in promiscuous mode */
|
||||
if (stge_1023_bug)
|
||||
ifp->if_flags |= IFF_PROMISC;
|
||||
|
||||
if (ifp->if_flags & IFF_PROMISC) {
|
||||
sc->sc_ReceiveMode |= RM_ReceiveAllFrames;
|
||||
goto allmulti;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
$NetBSD: pcidevs,v 1.725 2005/07/01 19:37:59 drochner Exp $
|
||||
$NetBSD: pcidevs,v 1.726 2005/07/25 00:41:12 christos Exp $
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Christopher G. Demetriou
|
||||
|
@ -2717,6 +2717,7 @@ product SUN US_IIe 0xa001 UltraSPARC IIe PCI
|
|||
|
||||
/* Sundance Technology products */
|
||||
product SUNDANCETI ST201 0x0201 ST201 10/100 Ethernet
|
||||
product SUNDANCETI ST1023 0x1023 ST1023 Gigabit Ethernet
|
||||
product SUNDANCETI ST2021 0x2021 ST2021 Gigabit Ethernet
|
||||
|
||||
/* Surecom Technology products */
|
||||
|
|
Loading…
Reference in New Issue