diff options
author | 1998-12-22 04:23:58 +0000 | |
---|---|---|
committer | 1998-12-22 04:23:58 +0000 | |
commit | 607f56a030e5cbb25491a072bd69df29fdf1ae7a (patch) | |
tree | 60b6edbc1c861bb53f1e80d0745e7f7adf97f5cd | |
parent | regen (diff) | |
download | wireguard-openbsd-607f56a030e5cbb25491a072bd69df29fdf1ae7a.tar.xz wireguard-openbsd-607f56a030e5cbb25491a072bd69df29fdf1ae7a.zip |
sync with FreeBSD
-rw-r--r-- | sys/dev/pci/if_rl.c | 37 | ||||
-rw-r--r-- | sys/dev/pci/if_rlreg.h | 20 |
2 files changed, 24 insertions, 33 deletions
diff --git a/sys/dev/pci/if_rl.c b/sys/dev/pci/if_rl.c index ce024ec7cba..5f11a9eba49 100644 --- a/sys/dev/pci/if_rl.c +++ b/sys/dev/pci/if_rl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rl.c,v 1.8 1998/11/23 19:42:42 jason Exp $ */ +/* $OpenBSD: if_rl.c,v 1.9 1998/12/22 04:23:58 jason Exp $ */ /* * Copyright (c) 1997, 1998 @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: if_rl.c,v 1.2 1998/11/18 21:03:57 wpaul Exp $ + * $FreeBSD: if_rl.c,v 1.7 1998/12/14 06:32:55 dillon Exp $ */ /* @@ -55,7 +55,7 @@ * * For transmission, the chip offers a series of four TX descriptor * registers. Each transmit frame must be in a contiguous buffer, aligned - * on a doubleword (32-bit) boundary. This means we almost always have to + * on a longword (32-bit) boundary. This means we almost always have to * do mbuf copies in order to transmit a frame, except in the unlikely * case where a) the packet fits into a single mbuf, and b) the packet * is 32-bit aligned within the mbuf's data area. The presence of only @@ -83,15 +83,6 @@ * chip. The 8129 has a serial MDIO interface for accessing the MII where * the 8139 lets you directly access the on-board PHY registers. We need * to select which interface to use depending on the chip type. - * - * Note: beware of trying to use the Linux RealTek driver as a reference - * for information about the RealTek chip. It contains several bogosities. - * It contains definitions for several undocumented registers which it - * claims are 'required for proper operation' yet it does not use these - * registers anywhere in the code. It also refers to some undocumented - * 'Twister tuning codes' which it doesn't use anywhere. It also contains - * bit definitions for several registers which are totally ignored: magic - * numbers are used instead, making the code hard to read. */ #include "bpfilter.h" @@ -179,8 +170,8 @@ static void rl_watchdog __P((struct ifnet *)); static int rl_ifmedia_upd __P((struct ifnet *)); static void rl_ifmedia_sts __P((struct ifnet *, struct ifmediareq *)); -static void rl_eeprom_putbyte __P((struct rl_softc *, u_int8_t)); -static void rl_eeprom_getword __P((struct rl_softc *, u_int8_t, u_int16_t *)); +static void rl_eeprom_putbyte __P((struct rl_softc *, int)); +static void rl_eeprom_getword __P((struct rl_softc *, int, u_int16_t *)); static void rl_read_eeprom __P((struct rl_softc *, caddr_t, int, int, int)); static void rl_mii_sync __P((struct rl_softc *)); @@ -188,7 +179,7 @@ static void rl_mii_send __P((struct rl_softc *, u_int32_t, int)); static int rl_mii_readreg __P((struct rl_softc *, struct rl_mii_frame *)); static int rl_mii_writereg __P((struct rl_softc *, struct rl_mii_frame *)); -static u_int8_t rl_calchash __P((u_int8_t *)); +static u_int8_t rl_calchash __P((caddr_t)); static void rl_setmulti __P((struct rl_softc *)); static void rl_reset __P((struct rl_softc *)); static int rl_list_tx_init __P((struct rl_softc *)); @@ -206,7 +197,7 @@ static int rl_list_tx_init __P((struct rl_softc *)); */ static void rl_eeprom_putbyte(sc, addr) struct rl_softc *sc; - u_int8_t addr; + int addr; { register int d, i; @@ -236,7 +227,7 @@ static void rl_eeprom_putbyte(sc, addr) */ static void rl_eeprom_getword(sc, addr, dest) struct rl_softc *sc; - u_int8_t addr; + int addr; u_int16_t *dest; { register int i; @@ -503,7 +494,7 @@ static int rl_mii_writereg(sc, frame) * Calculate CRC of a multicast group address, return the lower 6 bits. */ static u_int8_t rl_calchash(addr) - u_int8_t *addr; + caddr_t addr; { u_int32_t crc, carry; int i, j; @@ -1331,11 +1322,11 @@ rl_attach(parent, self, aux) printf(": can't find i/o space\n"); return; } - if (bus_space_map(pa->pa_iot, iobase, iosize, 0, &sc->sc_sh)) { + if (bus_space_map(pa->pa_iot, iobase, iosize, 0, &sc->rl_bhandle)) { printf(": can't map i/o space\n"); return; } - sc->sc_st = pa->pa_iot; + sc->rl_btag = pa->pa_iot; #else if (!(command & PCI_COMMAND_MEM_ENABLE)) { printf(": failed to enable memory mapping\n"); @@ -1345,11 +1336,11 @@ rl_attach(parent, self, aux) printf(": can't find mem space\n"); return; } - if (bus_space_map(pa->pa_memt, iobase, iosize, 0, &sc->sc_sh)) { + if (bus_space_map(pa->pa_memt, iobase, iosize, 0, &sc->rl_bhandle)) { printf(": can't map mem space\n"); return; } - sc->sc_st = pa->pa_memt; + sc->rl_btag = pa->pa_memt; #endif /* @@ -1381,7 +1372,7 @@ rl_attach(parent, self, aux) rl_read_eeprom(sc, (caddr_t)&rl_did, RL_EE_PCI_DID, 1, 0); - if (rl_did == RT_DEVICEID_8139) + if (rl_did == RT_DEVICEID_8139 || rl_did == ACCTON_DEVICEID_5030) sc->rl_type = RL_8139; else if (rl_did == RT_DEVICEID_8129) sc->rl_type = RL_8129; diff --git a/sys/dev/pci/if_rlreg.h b/sys/dev/pci/if_rlreg.h index bb1718f68ee..069203c3720 100644 --- a/sys/dev/pci/if_rlreg.h +++ b/sys/dev/pci/if_rlreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_rlreg.h,v 1.4 1998/11/19 07:01:56 jason Exp $ */ +/* $OpenBSD: if_rlreg.h,v 1.5 1998/12/22 04:23:59 jason Exp $ */ /* * Copyright (c) 1997, 1998 @@ -31,7 +31,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: if_rlreg.h,v 1.2 1998/11/18 21:03:58 wpaul Exp $ + * $FreeBSD: if_rlreg.h,v 1.4 1998/12/10 19:02:07 wpaul Exp $ */ /* @@ -333,8 +333,8 @@ struct rl_mii_frame { struct rl_softc { struct device sc_dev; /* us, as a device */ void * sc_ih; /* interrupt vectoring */ - bus_space_tag_t sc_st; - bus_space_handle_t sc_sh; + bus_space_handle_t rl_bhandle; /* bus space handle */ + bus_space_tag_t rl_btag; /* bus space tag */ bus_dma_tag_t sc_dmat; bus_dmamap_t sc_dma_mem; size_t sc_dma_mapsize; @@ -348,18 +348,18 @@ struct rl_softc { * register space access macros */ #define CSR_WRITE_4(sc, csr, val) \ - bus_space_write_4((sc)->sc_st, (sc)->sc_sh, csr, (val)) + bus_space_write_4(sc->rl_btag, sc->rl_bhandle, csr, val) #define CSR_WRITE_2(sc, csr, val) \ - bus_space_write_2((sc)->sc_st, (sc)->sc_sh, csr, (val)) + bus_space_write_2(sc->rl_btag, sc->rl_bhandle, csr, val) #define CSR_WRITE_1(sc, csr, val) \ - bus_space_write_1((sc)->sc_st, (sc)->sc_sh, csr, (val)) + bus_space_write_1(sc->rl_btag, sc->rl_bhandle, csr, val) #define CSR_READ_4(sc, csr) \ - bus_space_read_4((sc)->sc_st, (sc)->sc_sh, csr) + bus_space_read_4(sc->rl_btag, sc->rl_bhandle, csr) #define CSR_READ_2(sc, csr) \ - bus_space_read_2((sc)->sc_st, (sc)->sc_sh, csr) + bus_space_read_2(sc->rl_btag, sc->rl_bhandle, csr) #define CSR_READ_1(sc, csr) \ - bus_space_read_1((sc)->sc_st, (sc)->sc_sh, csr) + bus_space_read_1(sc->rl_btag, sc->rl_bhandle, csr) #define RL_TIMEOUT 1000 |