if_rl.c (72645) | if_rl.c (72813) |
---|---|
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 72645 2001-02-18 10:43:53Z asmodai $ | 32 * $FreeBSD: head/sys/pci/if_rl.c 72813 2001-02-21 20:54:22Z 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 72645 2001-02-18 10:43:53Z asmodai $"; | 136 "$FreeBSD: head/sys/pci/if_rl.c 72813 2001-02-21 20:54:22Z 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" }, 145 { RT_VENDORID, RT_DEVICEID_8139, 146 "RealTek 8139 10/100BaseTX" }, 147 { RT_VENDORID, RT_DEVICEID_8138, 148 "RealTek 8139 10/100BaseTX CardBus" }, 149 { ACCTON_VENDORID, ACCTON_DEVICEID_5030, 150 "Accton MPX 5030/5038 10/100BaseTX" }, 151 { DELTA_VENDORID, DELTA_DEVICEID_8139, 152 "Delta Electronics 8139 10/100BaseTX" }, 153 { ADDTRON_VENDORID, ADDTRON_DEVICEID_8139, 154 "Addtron Technolgy 8139 10/100BaseTX" }, | 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" }, 145 { RT_VENDORID, RT_DEVICEID_8139, 146 "RealTek 8139 10/100BaseTX" }, 147 { RT_VENDORID, RT_DEVICEID_8138, 148 "RealTek 8139 10/100BaseTX CardBus" }, 149 { ACCTON_VENDORID, ACCTON_DEVICEID_5030, 150 "Accton MPX 5030/5038 10/100BaseTX" }, 151 { DELTA_VENDORID, DELTA_DEVICEID_8139, 152 "Delta Electronics 8139 10/100BaseTX" }, 153 { ADDTRON_VENDORID, ADDTRON_DEVICEID_8139, 154 "Addtron Technolgy 8139 10/100BaseTX" }, |
155 { DLINK_VENDORID, DLINK_DEVICEID_530TXPLUS, 156 "D-Link DFE-530TX+ 10/100BaseTX" }, |
|
155 { 0, 0, NULL } 156}; 157 158static int rl_probe __P((device_t)); 159static int rl_attach __P((device_t)); 160static int rl_detach __P((device_t)); 161 162static int rl_encap __P((struct rl_softc *, struct mbuf * )); --- 664 unchanged lines hidden (view full) --- 827 pci_write_config(dev, RL_PCI_LOIO, iobase, 4); 828 pci_write_config(dev, RL_PCI_LOMEM, membase, 4); 829 pci_write_config(dev, RL_PCI_INTLINE, irq, 4); 830 } 831 832 /* 833 * Map control/status registers. 834 */ | 157 { 0, 0, NULL } 158}; 159 160static int rl_probe __P((device_t)); 161static int rl_attach __P((device_t)); 162static int rl_detach __P((device_t)); 163 164static int rl_encap __P((struct rl_softc *, struct mbuf * )); --- 664 unchanged lines hidden (view full) --- 829 pci_write_config(dev, RL_PCI_LOIO, iobase, 4); 830 pci_write_config(dev, RL_PCI_LOMEM, membase, 4); 831 pci_write_config(dev, RL_PCI_INTLINE, irq, 4); 832 } 833 834 /* 835 * Map control/status registers. 836 */ |
837 pci_enable_busmaster(dev); 838 pci_enable_io(dev, PCIM_CMD_PORTEN); 839 pci_enable_io(dev, PCIM_CMD_MEMEN); |
|
835 command = pci_read_config(dev, PCIR_COMMAND, 4); | 840 command = pci_read_config(dev, PCIR_COMMAND, 4); |
836 command |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); 837 pci_write_config(dev, PCIR_COMMAND, command, 4); 838 command = pci_read_config(dev, PCIR_COMMAND, 4); | |
839 840#ifdef RL_USEIOSPACE 841 if (!(command & PCIM_CMD_PORTEN)) { 842 printf("rl%d: failed to enable I/O ports!\n", unit); 843 error = ENXIO; 844 goto fail; 845 } 846#else --- 73 unchanged lines hidden (view full) --- 920 /* 921 * Now read the exact device type from the EEPROM to find 922 * out if it's an 8129 or 8139. 923 */ 924 rl_read_eeprom(sc, (caddr_t)&rl_did, RL_EE_PCI_DID, 1, 0); 925 926 if (rl_did == RT_DEVICEID_8139 || rl_did == ACCTON_DEVICEID_5030 || 927 rl_did == DELTA_DEVICEID_8139 || rl_did == ADDTRON_DEVICEID_8139 || | 841 842#ifdef RL_USEIOSPACE 843 if (!(command & PCIM_CMD_PORTEN)) { 844 printf("rl%d: failed to enable I/O ports!\n", unit); 845 error = ENXIO; 846 goto fail; 847 } 848#else --- 73 unchanged lines hidden (view full) --- 922 /* 923 * Now read the exact device type from the EEPROM to find 924 * out if it's an 8129 or 8139. 925 */ 926 rl_read_eeprom(sc, (caddr_t)&rl_did, RL_EE_PCI_DID, 1, 0); 927 928 if (rl_did == RT_DEVICEID_8139 || rl_did == ACCTON_DEVICEID_5030 || 929 rl_did == DELTA_DEVICEID_8139 || rl_did == ADDTRON_DEVICEID_8139 || |
928 rl_did == RT_DEVICEID_8138) | 930 rl_did == RT_DEVICEID_8138 || rl_did == DLINK_DEVICEID_530TXPLUS) |
929 sc->rl_type = RL_8139; 930 else if (rl_did == RT_DEVICEID_8129) 931 sc->rl_type = RL_8129; 932 else { 933 printf("rl%d: unknown device ID: %x\n", unit, rl_did); 934 bus_teardown_intr(dev, sc->rl_irq, sc->rl_intrhand); 935 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->rl_irq); 936 bus_release_resource(dev, RL_RES, RL_RID, sc->rl_res); --- 748 unchanged lines hidden --- | 931 sc->rl_type = RL_8139; 932 else if (rl_did == RT_DEVICEID_8129) 933 sc->rl_type = RL_8129; 934 else { 935 printf("rl%d: unknown device ID: %x\n", unit, rl_did); 936 bus_teardown_intr(dev, sc->rl_irq, sc->rl_intrhand); 937 bus_release_resource(dev, SYS_RES_IRQ, 0, sc->rl_irq); 938 bus_release_resource(dev, RL_RES, RL_RID, sc->rl_res); --- 748 unchanged lines hidden --- |