if_rl.c (67771) | if_rl.c (67931) |
---|---|
1/* 2 * Copyright (c) 1997, 1998 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * | 1/* 2 * Copyright (c) 1997, 1998 3 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 15 unchanged lines hidden (view full) --- 24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 30 * THE POSSIBILITY OF SUCH DAMAGE. 31 * |
32 * $FreeBSD: head/sys/pci/if_rl.c 67771 2000-10-28 09:00:20Z wpaul $ | 32 * $FreeBSD: head/sys/pci/if_rl.c 67931 2000-10-30 07:54:38Z wpaul $ |
33 */ 34 35/* 36 * RealTek 8129/8139 PCI NIC driver 37 * 38 * Supports several extremely cheap PCI 10/100 adapters based on 39 * the RealTek chipset. Datasheets can be obtained from 40 * www.realtek.com.tw. --- 87 unchanged lines hidden (view full) --- 128 * uniprocessor systems though. 129 */ 130#define RL_USEIOSPACE 131 132#include <pci/if_rlreg.h> 133 134#ifndef lint 135static const char rcsid[] = | 33 */ 34 35/* 36 * RealTek 8129/8139 PCI NIC driver 37 * 38 * Supports several extremely cheap PCI 10/100 adapters based on 39 * the RealTek chipset. Datasheets can be obtained from 40 * www.realtek.com.tw. --- 87 unchanged lines hidden (view full) --- 128 * uniprocessor systems though. 129 */ 130#define RL_USEIOSPACE 131 132#include <pci/if_rlreg.h> 133 134#ifndef lint 135static const char rcsid[] = |
136 "$FreeBSD: head/sys/pci/if_rl.c 67771 2000-10-28 09:00:20Z wpaul $"; | 136 "$FreeBSD: head/sys/pci/if_rl.c 67931 2000-10-30 07:54:38Z wpaul $"; |
137#endif 138 139/* 140 * Various supported device vendors/types and their names. 141 */ 142static struct rl_type rl_devs[] = { 143 { RT_VENDORID, RT_DEVICEID_8129, 144 "RealTek 8129 10/100BaseTX" }, --- 78 unchanged lines hidden (view full) --- 223 "rl", 224 rl_methods, 225 sizeof(struct rl_softc) 226}; 227 228static devclass_t rl_devclass; 229 230DRIVER_MODULE(if_rl, pci, rl_driver, rl_devclass, 0, 0); | 137#endif 138 139/* 140 * Various supported device vendors/types and their names. 141 */ 142static struct rl_type rl_devs[] = { 143 { RT_VENDORID, RT_DEVICEID_8129, 144 "RealTek 8129 10/100BaseTX" }, --- 78 unchanged lines hidden (view full) --- 223 "rl", 224 rl_methods, 225 sizeof(struct rl_softc) 226}; 227 228static devclass_t rl_devclass; 229 230DRIVER_MODULE(if_rl, pci, rl_driver, rl_devclass, 0, 0); |
231DRIVER_MODULE(if_rl, cardbus, rl_driver, rl_devclass, 0, 0); |
|
231DRIVER_MODULE(miibus, rl, miibus_driver, miibus_devclass, 0, 0); 232 233#define EE_SET(x) \ 234 CSR_WRITE_1(sc, RL_EECMD, \ 235 CSR_READ_1(sc, RL_EECMD) | x) 236 237#define EE_CLR(x) \ 238 CSR_WRITE_1(sc, RL_EECMD, \ 239 CSR_READ_1(sc, RL_EECMD) & ~x) 240 241/* 242 * Send a read command and address to the EEPROM, check for ACK. 243 */ 244static void rl_eeprom_putbyte(sc, addr) 245 struct rl_softc *sc; 246 int addr; 247{ 248 register int d, i; 249 | 232DRIVER_MODULE(miibus, rl, miibus_driver, miibus_devclass, 0, 0); 233 234#define EE_SET(x) \ 235 CSR_WRITE_1(sc, RL_EECMD, \ 236 CSR_READ_1(sc, RL_EECMD) | x) 237 238#define EE_CLR(x) \ 239 CSR_WRITE_1(sc, RL_EECMD, \ 240 CSR_READ_1(sc, RL_EECMD) & ~x) 241 242/* 243 * Send a read command and address to the EEPROM, check for ACK. 244 */ 245static void rl_eeprom_putbyte(sc, addr) 246 struct rl_softc *sc; 247 int addr; 248{ 249 register int d, i; 250 |
250 d = addr | RL_EECMD_READ; | 251 d = addr | sc->rl_eecmd_read; |
251 252 /* 253 * Feed in each bit and strobe the clock. 254 */ 255 for (i = 0x400; i; i >>= 1) { 256 if (d & i) { 257 EE_SET(RL_EE_DATAIN); 258 } else { --- 629 unchanged lines hidden (view full) --- 888 889 callout_handle_init(&sc->rl_stat_ch); 890 891 mtx_init(&sc->rl_mtx, device_get_nameunit(dev), MTX_DEF); 892 RL_LOCK(sc); 893 894 /* Reset the adapter. */ 895 rl_reset(sc); | 252 253 /* 254 * Feed in each bit and strobe the clock. 255 */ 256 for (i = 0x400; i; i >>= 1) { 257 if (d & i) { 258 EE_SET(RL_EE_DATAIN); 259 } else { --- 629 unchanged lines hidden (view full) --- 889 890 callout_handle_init(&sc->rl_stat_ch); 891 892 mtx_init(&sc->rl_mtx, device_get_nameunit(dev), MTX_DEF); 893 RL_LOCK(sc); 894 895 /* Reset the adapter. */ 896 rl_reset(sc); |
897 sc->rl_eecmd_read = RL_EECMD_READ_6BIT; 898 rl_read_eeprom(sc, (caddr_t)&rl_did, 0, 1, 0); 899 if (rl_did != 8129) 900 sc->rl_eecmd_read = RL_EECMD_READ_8BIT; |
|
896 897 /* 898 * Get station address from the EEPROM. 899 */ 900 rl_read_eeprom(sc, (caddr_t)&eaddr, RL_EE_EADDR, 3, 0); 901 902 /* 903 * A RealTek chip was detected. Inform the world. --- 771 unchanged lines hidden --- | 901 902 /* 903 * Get station address from the EEPROM. 904 */ 905 rl_read_eeprom(sc, (caddr_t)&eaddr, RL_EE_EADDR, 3, 0); 906 907 /* 908 * A RealTek chip was detected. Inform the world. --- 771 unchanged lines hidden --- |