diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-07-04 22:57:21 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2004-07-04 22:57:21 +0000 |
commit | f62e457034ba53c8435e61b84a362665a4207093 (patch) | |
tree | 9c1af653bb7190d7e0b81900f222989d095094a2 /sys/dev/pci | |
parent | 0de4e42997d7c9bd7834ceded1422a0b5814f7b0 (diff) |
sis rev 0x91 seeprom support to get eaddr; from fgsch
we supplied 10 soekris boxes to 10 openbsd developers, and these all
have some variety or other of sis ethernet. not ONE of them commented
about this diff when it was mailed out. how very sad.
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_sis.c | 36 | ||||
-rw-r--r-- | sys/dev/pci/if_sisreg.h | 7 |
2 files changed, 35 insertions, 8 deletions
diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index 186cf11fced..bc250fcceda 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.39 2004/06/06 04:34:33 mcbride Exp $ */ +/* $OpenBSD: if_sis.c,v 1.40 2004/07/04 22:57:20 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -132,6 +132,7 @@ void sis_read_cmos(struct sis_softc *, struct pci_attach_args *, caddr_t, int, i #endif void sis_read_mac(struct sis_softc *, struct pci_attach_args *); void sis_read_eeprom(struct sis_softc *, caddr_t, int, int, int); +void sis_read96x_mac(struct sis_softc *); void sis_mii_sync(struct sis_softc *); void sis_mii_send(struct sis_softc *, u_int32_t, int); @@ -361,6 +362,25 @@ void sis_read_mac(sc, pa) SIS_SETBIT(sc, SIS_RXFILT_CTL, SIS_RXFILTCTL_ENABLE); } +void sis_read96x_mac(sc) + struct sis_softc *sc; +{ + int i; + + SIO_SET(SIS96x_EECTL_REQ); + + for (i = 0; i < 2000; i++) { + if ((CSR_READ_4(sc, SIS_EECTL) & SIS96x_EECTL_GNT)) { + sis_read_eeprom(sc, (caddr_t)&sc->arpcom.ac_enaddr, + SIS_EE_NODEADDR, 3, 0); + break; + } else + DELAY(1); + } + + SIO_SET(SIS96x_EECTL_DONE); +} + /* * Sync the PHYs by setting data bit and strobing the clock 32 times. */ @@ -951,7 +971,7 @@ void sis_attach(parent, self, aux) /* Reset the adapter. */ sis_reset(sc); - printf(": "); + printf(":"); /* * Get station address from the EEPROM. @@ -961,13 +981,13 @@ void sis_attach(parent, self, aux) sc->sis_srr = CSR_READ_4(sc, NS_SRR); if (sc->sis_srr == NS_SRR_15C) - printf("DP83815C,"); + printf(" DP83815C,"); else if (sc->sis_srr == NS_SRR_15D) - printf("DP83815D,"); + printf(" DP83815D,"); else if (sc->sis_srr == NS_SRR_16A) - printf("DP83816A,"); + printf(" DP83816A,"); else - printf("srr %x,", sc->sis_srr); + printf(" srr %x,", sc->sis_srr); /* * Reading the MAC address out of the EEPROM on @@ -1027,7 +1047,9 @@ void sis_attach(parent, self, aux) 0x9, 6); else #endif - if (sc->sis_rev == SIS_REV_635 || + if (sc->sis_rev == SIS_REV_96x) + sis_read96x_mac(sc); + else if (sc->sis_rev == SIS_REV_635 || sc->sis_rev == SIS_REV_630ET || sc->sis_rev == SIS_REV_630EA1) sis_read_mac(sc, pa); diff --git a/sys/dev/pci/if_sisreg.h b/sys/dev/pci/if_sisreg.h index bd419b5256a..c6ad494cfd0 100644 --- a/sys/dev/pci/if_sisreg.h +++ b/sys/dev/pci/if_sisreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sisreg.h,v 1.17 2004/05/19 11:37:00 brad Exp $ */ +/* $OpenBSD: if_sisreg.h,v 1.18 2004/07/04 22:57:20 deraadt Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ee.columbia.edu>. All rights reserved. @@ -127,6 +127,10 @@ #define SIS_EECTL_CLK 0x00000004 #define SIS_EECTL_CSEL 0x00000008 +#define SIS96x_EECTL_GNT 0x00000100 +#define SIS96x_EECTL_DONE 0x00000200 +#define SIS96x_EECTL_REQ 0x00000400 + #define SIS_MII_CLK 0x00000040 #define SIS_MII_DIR 0x00000020 #define SIS_MII_DATA 0x00000010 @@ -385,6 +389,7 @@ struct sis_ring_data { #define SIS_REV_630EA1 0x0083 #define SIS_REV_630ET 0x0084 #define SIS_REV_635 0x0090 +#define SIS_REV_96x 0x0091 struct sis_type { u_int16_t sis_vid; |