Mon Dec 14 00:52:10 2009 UTC ()
Only tick mii if the phy had a status change.


(matt)
diff -r1.28 -r1.29 src/sys/dev/pci/if_msk.c

cvs diff -r1.28 -r1.29 src/sys/dev/pci/if_msk.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_msk.c 2009/09/05 14:09:55 1.28
+++ src/sys/dev/pci/if_msk.c 2009/12/14 00:52:04 1.29
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_msk.c,v 1.28 2009/09/05 14:09:55 tsutsui Exp $ */ 1/* $NetBSD: if_msk.c,v 1.29 2009/12/14 00:52:04 matt Exp $ */
2/* $OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $ */ 2/* $OpenBSD: if_msk.c,v 1.42 2007/01/17 02:43:02 krw Exp $ */
3 3
4/* 4/*
5 * Copyright (c) 1997, 1998, 1999, 2000 5 * Copyright (c) 1997, 1998, 1999, 2000
6 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 6 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -42,27 +42,27 @@ @@ -42,27 +42,27 @@
42 * purpose with or without fee is hereby granted, provided that the above 42 * purpose with or without fee is hereby granted, provided that the above
43 * copyright notice and this permission notice appear in all copies. 43 * copyright notice and this permission notice appear in all copies.
44 * 44 *
45 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 45 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
46 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 46 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
47 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 47 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
48 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 48 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
49 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 49 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
50 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 50 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
51 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 51 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
52 */ 52 */
53 53
54#include <sys/cdefs.h> 54#include <sys/cdefs.h>
55__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.28 2009/09/05 14:09:55 tsutsui Exp $"); 55__KERNEL_RCSID(0, "$NetBSD: if_msk.c,v 1.29 2009/12/14 00:52:04 matt Exp $");
56 56
57#include "bpfilter.h" 57#include "bpfilter.h"
58#include "rnd.h" 58#include "rnd.h"
59 59
60#include <sys/param.h> 60#include <sys/param.h>
61#include <sys/systm.h> 61#include <sys/systm.h>
62#include <sys/sockio.h> 62#include <sys/sockio.h>
63#include <sys/mbuf.h> 63#include <sys/mbuf.h>
64#include <sys/malloc.h> 64#include <sys/malloc.h>
65#include <sys/mutex.h> 65#include <sys/mutex.h>
66#include <sys/kernel.h> 66#include <sys/kernel.h>
67#include <sys/socket.h> 67#include <sys/socket.h>
68#include <sys/device.h> 68#include <sys/device.h>
@@ -1209,28 +1209,29 @@ mskc_attach(device_t parent, device_t se @@ -1209,28 +1209,29 @@ mskc_attach(device_t parent, device_t se
1209 } 1209 }
1210 } 1210 }
1211 1211
1212 /* 1212 /*
1213 * Map control/status registers. 1213 * Map control/status registers.
1214 */ 1214 */
1215 1215
1216 memtype = pci_mapreg_type(pc, pa->pa_tag, SK_PCI_LOMEM); 1216 memtype = pci_mapreg_type(pc, pa->pa_tag, SK_PCI_LOMEM);
1217 switch (memtype) { 1217 switch (memtype) {
1218 case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT: 1218 case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_32BIT:
1219 case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT: 1219 case PCI_MAPREG_TYPE_MEM | PCI_MAPREG_MEM_TYPE_64BIT:
1220 if (pci_mapreg_map(pa, SK_PCI_LOMEM, 1220 if (pci_mapreg_map(pa, SK_PCI_LOMEM,
1221 memtype, 0, &sc->sk_btag, &sc->sk_bhandle, 1221 memtype, 0, &sc->sk_btag, &sc->sk_bhandle,
1222 NULL, &size) == 0) 1222 NULL, &size) == 0) {
1223 break; 1223 break;
 1224 }
1224 default: 1225 default:
1225 aprint_error(": can't map mem space\n"); 1226 aprint_error(": can't map mem space\n");
1226 return; 1227 return;
1227 } 1228 }
1228 1229
1229 sc->sc_dmatag = pa->pa_dmat; 1230 sc->sc_dmatag = pa->pa_dmat;
1230 1231
1231 sc->sk_type = sk_win_read_1(sc, SK_CHIPVER); 1232 sc->sk_type = sk_win_read_1(sc, SK_CHIPVER);
1232 sc->sk_rev = (sk_win_read_1(sc, SK_CONFIG) >> 4); 1233 sc->sk_rev = (sk_win_read_1(sc, SK_CONFIG) >> 4);
1233 1234
1234 /* bail out here if chip is not recognized */ 1235 /* bail out here if chip is not recognized */
1235 if (!(SK_IS_YUKON2(sc))) { 1236 if (!(SK_IS_YUKON2(sc))) {
1236 aprint_error(": unknown chip type: %d\n", sc->sk_type); 1237 aprint_error(": unknown chip type: %d\n", sc->sk_type);
@@ -1811,30 +1812,35 @@ msk_txeof(struct sk_if_softc *sc_if, int @@ -1811,30 +1812,35 @@ msk_txeof(struct sk_if_softc *sc_if, int
1811 1812
1812 if (sc_if->sk_cdata.sk_tx_cnt < MSK_TX_RING_CNT - 2) 1813 if (sc_if->sk_cdata.sk_tx_cnt < MSK_TX_RING_CNT - 2)
1813 ifp->if_flags &= ~IFF_OACTIVE; 1814 ifp->if_flags &= ~IFF_OACTIVE;
1814 1815
1815 if (prog > 0) 1816 if (prog > 0)
1816 sc_if->sk_cdata.sk_tx_cons = cons; 1817 sc_if->sk_cdata.sk_tx_cons = cons;
1817} 1818}
1818 1819
1819void 1820void
1820msk_tick(void *xsc_if) 1821msk_tick(void *xsc_if)
1821{ 1822{
1822 struct sk_if_softc *sc_if = xsc_if;  1823 struct sk_if_softc *sc_if = xsc_if;
1823 struct mii_data *mii = &sc_if->sk_mii; 1824 struct mii_data *mii = &sc_if->sk_mii;
 1825 uint16_t gpsr;
1824 int s; 1826 int s;
1825 1827
1826 s = splnet(); 1828 s = splnet();
1827 mii_tick(mii); 1829 gpsr = SK_YU_READ_2(sc_if, YUKON_GPSR);
 1830 if ((gpsr & YU_GPSR_MII_PHY_STC) != 0) {
 1831 SK_YU_WRITE_2(sc_if, YUKON_GPSR, YU_GPSR_MII_PHY_STC);
 1832 mii_tick(mii);
 1833 }
1828 splx(s); 1834 splx(s);
1829 1835
1830 callout_schedule(&sc_if->sk_tick_ch, hz); 1836 callout_schedule(&sc_if->sk_tick_ch, hz);
1831} 1837}
1832 1838
1833void 1839void
1834msk_intr_yukon(struct sk_if_softc *sc_if) 1840msk_intr_yukon(struct sk_if_softc *sc_if)
1835{ 1841{
1836 u_int8_t status; 1842 u_int8_t status;
1837 1843
1838 status = SK_IF_READ_1(sc_if, 0, SK_GMAC_ISR); 1844 status = SK_IF_READ_1(sc_if, 0, SK_GMAC_ISR);
1839 /* RX overrun */ 1845 /* RX overrun */
1840 if ((status & SK_GMAC_INT_RX_OVER) != 0) { 1846 if ((status & SK_GMAC_INT_RX_OVER) != 0) {