diff options
author | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2005-04-21 06:48:06 +0000 |
---|---|---|
committer | Federico G. Schwindt <fgsch@cvs.openbsd.org> | 2005-04-21 06:48:06 +0000 |
commit | 289be5541394173fa72c73582bd5c6231e86109a (patch) | |
tree | d8f2b64ea25ed807938a3d2bdcd3f90f362dd78c /sys/dev | |
parent | 88c0df2432a4971cb01b481997b1c1ef2561684b (diff) |
o if the mac address cannot be read, just fail and disestablish the
irq (for shared irq's) on failure. (should other drivers do the same?)
o if it's a rev 0x12 card, only use the first phy as it reports a
non-existent one as well (From FreeBSD).
o remove splimp/splx from ste_attach().
o some cleanup.
thanks to matt at mattroberts dot org and paolo at actcom dot net dot il
for testing; commit deraadt@.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/if_ste.c | 46 | ||||
-rw-r--r-- | sys/dev/pci/if_stereg.h | 3 |
2 files changed, 34 insertions, 15 deletions
diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c index 0e68be75244..f804eff0956 100644 --- a/sys/dev/pci/if_ste.c +++ b/sys/dev/pci/if_ste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ste.c,v 1.29 2005/04/08 20:30:51 beck Exp $ */ +/* $OpenBSD: if_ste.c,v 1.30 2005/04/21 06:48:05 fgsch Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -334,6 +334,9 @@ int ste_miibus_readreg(self, phy, reg) struct ste_softc *sc = (struct ste_softc *)self; struct ste_mii_frame frame; + if (sc->ste_one_phy && phy != 0) + return (0); + bzero((char *)&frame, sizeof(frame)); frame.mii_phyaddr = phy; @@ -462,7 +465,8 @@ int ste_eeprom_wait(sc) } if (i == 100) { - printf("%s: eeprom failed to come ready\n", sc->sc_dev.dv_xname); + printf("%s: eeprom failed to come ready\n", + sc->sc_dev.dv_xname); return(1); } @@ -829,7 +833,6 @@ void ste_attach(parent, self, aux) struct device *parent, *self; void *aux; { - int s; const char *intrstr = NULL; u_int32_t command; struct ste_softc *sc = (struct ste_softc *)self; @@ -840,8 +843,6 @@ void ste_attach(parent, self, aux) bus_addr_t iobase; bus_size_t iosize; - s = splimp(); - /* * Handle power management nonsense. */ @@ -871,6 +872,16 @@ void ste_attach(parent, self, aux) } /* + * Only use one PHY since this chip reports multiple + * Note on the DFE-550 the PHY is at 1 on the DFE-580 + * it is at 0 & 1. It is rev 0x12. + */ + if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_DLINK && + PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_DLINK_550TX && + PCI_REVISION(pa->pa_class) == 0x12) + sc->ste_one_phy = 1; + + /* * Map control/status registers. */ command = pci_conf_read(pc, pa->pa_tag, PCI_COMMAND_STATUS_REG); @@ -932,15 +943,21 @@ void ste_attach(parent, self, aux) /* * Get station address from the EEPROM. */ - ste_read_eeprom(sc,(caddr_t)&sc->arpcom.ac_enaddr,STE_EEADDR_NODE0,3,0); + if (ste_read_eeprom(sc, (caddr_t)&sc->arpcom.ac_enaddr, + STE_EEADDR_NODE0, 3, 0)) { + printf("%s: failed to read station address\n", + sc->sc_dev.dv_xname); + goto fail_1; + } printf(" address %s\n", ether_sprintf(sc->arpcom.ac_enaddr)); sc->ste_ldata_ptr = malloc(sizeof(struct ste_list_data) + 8, - M_DEVBUF, M_DONTWAIT); + M_DEVBUF, M_DONTWAIT); if (sc->ste_ldata_ptr == NULL) { - printf("%s: no memory for list buffers!\n", sc->sc_dev.dv_xname); - goto fail; + printf("%s: no memory for list buffers!\n", + sc->sc_dev.dv_xname); + goto fail_1; } sc->ste_ldata = (struct ste_list_data *)sc->ste_ldata_ptr; @@ -982,8 +999,10 @@ void ste_attach(parent, self, aux) shutdownhook_establish(ste_shutdown, sc); fail: - splx(s); return; + +fail_1: + pci_intr_disestablish(pc, sc->sc_ih); } int ste_newbuf(sc, c, m) @@ -1242,7 +1261,7 @@ void ste_stop(sc) void ste_reset(sc) struct ste_softc *sc; { - int i; + int i; STE_SETBIT4(sc, STE_ASICCTL, STE_ASICCTL_GLOBAL_RESET|STE_ASICCTL_RX_RESET| @@ -1259,9 +1278,8 @@ void ste_reset(sc) } if (i == STE_TIMEOUT) - printf("%s: global reset never completed\n", sc->sc_dev.dv_xname); - - return; + printf("%s: global reset never completed\n", + sc->sc_dev.dv_xname); } int ste_ioctl(ifp, command, data) diff --git a/sys/dev/pci/if_stereg.h b/sys/dev/pci/if_stereg.h index 6cbc623471d..77d0e8651b1 100644 --- a/sys/dev/pci/if_stereg.h +++ b/sys/dev/pci/if_stereg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_stereg.h,v 1.8 2004/11/21 18:04:09 brad Exp $ */ +/* $OpenBSD: if_stereg.h,v 1.9 2005/04/21 06:48:05 fgsch Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -517,6 +517,7 @@ struct ste_softc { struct ste_list_data *ste_ldata; caddr_t ste_ldata_ptr; struct ste_chain_data ste_cdata; + u_int8_t ste_one_phy; }; struct ste_mii_frame { |