if_sk.c (72084) | if_sk.c (72813) |
---|---|
1/* 2 * Copyright (c) 1997, 1998, 1999, 2000 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, 1999, 2000 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/dev/sk/if_sk.c 72084 2001-02-06 10:12:15Z phk $ | 32 * $FreeBSD: head/sys/dev/sk/if_sk.c 72813 2001-02-21 20:54:22Z wpaul $ |
33 */ 34 35/* 36 * SysKonnect SK-NET gigabit ethernet driver for FreeBSD. Supports 37 * the SK-984x series adapters, both single port and dual port. 38 * References: 39 * The XaQti XMAC II datasheet, 40 * http://www.freebsd.org/~wpaul/SysKonnect/xmacii_datasheet_rev_c_9-29.pdf --- 67 unchanged lines hidden (view full) --- 108 109MODULE_DEPEND(sk, miibus, 1, 1, 1); 110 111/* "controller miibus0" required. See GENERIC if you get errors here. */ 112#include "miibus_if.h" 113 114#ifndef lint 115static const char rcsid[] = | 33 */ 34 35/* 36 * SysKonnect SK-NET gigabit ethernet driver for FreeBSD. Supports 37 * the SK-984x series adapters, both single port and dual port. 38 * References: 39 * The XaQti XMAC II datasheet, 40 * http://www.freebsd.org/~wpaul/SysKonnect/xmacii_datasheet_rev_c_9-29.pdf --- 67 unchanged lines hidden (view full) --- 108 109MODULE_DEPEND(sk, miibus, 1, 1, 1); 110 111/* "controller miibus0" required. See GENERIC if you get errors here. */ 112#include "miibus_if.h" 113 114#ifndef lint 115static const char rcsid[] = |
116 "$FreeBSD: head/sys/dev/sk/if_sk.c 72084 2001-02-06 10:12:15Z phk $"; | 116 "$FreeBSD: head/sys/dev/sk/if_sk.c 72813 2001-02-21 20:54:22Z wpaul $"; |
117#endif 118 119static struct sk_type sk_devs[] = { 120 { SK_VENDORID, SK_DEVICEID_GE, "SysKonnect Gigabit Ethernet" }, 121 { 0, 0, NULL } 122}; 123 124static int sk_probe __P((device_t)); --- 1062 unchanged lines hidden (view full) --- 1187 bzero(sc, sizeof(struct sk_softc)); 1188 1189 mtx_init(&sc->sk_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE); 1190 SK_LOCK(sc); 1191 1192 /* 1193 * Handle power management nonsense. 1194 */ | 117#endif 118 119static struct sk_type sk_devs[] = { 120 { SK_VENDORID, SK_DEVICEID_GE, "SysKonnect Gigabit Ethernet" }, 121 { 0, 0, NULL } 122}; 123 124static int sk_probe __P((device_t)); --- 1062 unchanged lines hidden (view full) --- 1187 bzero(sc, sizeof(struct sk_softc)); 1188 1189 mtx_init(&sc->sk_mtx, device_get_nameunit(dev), MTX_DEF | MTX_RECURSE); 1190 SK_LOCK(sc); 1191 1192 /* 1193 * Handle power management nonsense. 1194 */ |
1195 command = pci_read_config(dev, SK_PCI_CAPID, 4) & 0x000000FF; 1196 if (command == 0x01) { | 1195 if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) { 1196 u_int32_t iobase, membase, irq; |
1197 | 1197 |
1198 command = pci_read_config(dev, SK_PCI_PWRMGMTCTRL, 4); 1199 if (command & SK_PSTATE_MASK) { 1200 u_int32_t iobase, membase, irq; | 1198 /* Save important PCI config data. */ 1199 iobase = pci_read_config(dev, SK_PCI_LOIO, 4); 1200 membase = pci_read_config(dev, SK_PCI_LOMEM, 4); 1201 irq = pci_read_config(dev, SK_PCI_INTLINE, 4); |
1201 | 1202 |
1202 /* Save important PCI config data. */ 1203 iobase = pci_read_config(dev, SK_PCI_LOIO, 4); 1204 membase = pci_read_config(dev, SK_PCI_LOMEM, 4); 1205 irq = pci_read_config(dev, SK_PCI_INTLINE, 4); | 1203 /* Reset the power state. */ 1204 printf("skc%d: chip is in D%d power mode " 1205 "-- setting to D0\n", unit, 1206 pci_get_powerstate(dev)); 1207 pci_set_powerstate(dev, PCI_POWERSTATE_D0); |
1206 | 1208 |
1207 /* Reset the power state. */ 1208 printf("skc%d: chip is in D%d power mode " 1209 "-- setting to D0\n", unit, command & SK_PSTATE_MASK); 1210 command &= 0xFFFFFFFC; 1211 pci_write_config(dev, SK_PCI_PWRMGMTCTRL, command, 4); 1212 1213 /* Restore PCI config data. */ 1214 pci_write_config(dev, SK_PCI_LOIO, iobase, 4); 1215 pci_write_config(dev, SK_PCI_LOMEM, membase, 4); 1216 pci_write_config(dev, SK_PCI_INTLINE, irq, 4); 1217 } | 1209 /* Restore PCI config data. */ 1210 pci_write_config(dev, SK_PCI_LOIO, iobase, 4); 1211 pci_write_config(dev, SK_PCI_LOMEM, membase, 4); 1212 pci_write_config(dev, SK_PCI_INTLINE, irq, 4); |
1218 } 1219 1220 /* 1221 * Map control/status registers. 1222 */ | 1213 } 1214 1215 /* 1216 * Map control/status registers. 1217 */ |
1218 pci_enable_busmaster(dev); 1219 pci_enable_io(dev, PCIM_CMD_PORTEN); 1220 pci_enable_io(dev, PCIM_CMD_MEMEN); |
|
1223 command = pci_read_config(dev, PCIR_COMMAND, 4); | 1221 command = pci_read_config(dev, PCIR_COMMAND, 4); |
1224 command |= (PCIM_CMD_PORTEN|PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN); 1225 pci_write_config(dev, PCIR_COMMAND, command, 4); 1226 command = pci_read_config(dev, PCIR_COMMAND, 4); | |
1227 1228#ifdef SK_USEIOSPACE 1229 if (!(command & PCIM_CMD_PORTEN)) { 1230 printf("skc%d: failed to enable I/O ports!\n", unit); 1231 error = ENXIO; 1232 goto fail; 1233 } 1234#else --- 994 unchanged lines hidden --- | 1222 1223#ifdef SK_USEIOSPACE 1224 if (!(command & PCIM_CMD_PORTEN)) { 1225 printf("skc%d: failed to enable I/O ports!\n", unit); 1226 error = ENXIO; 1227 goto fail; 1228 } 1229#else --- 994 unchanged lines hidden --- |