| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_wm.c,v 1.369 2015/10/13 10:26:21 knakahara Exp $ */ | | 1 | /* $NetBSD: if_wm.c,v 1.370 2015/10/13 21:28:41 christos Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. | | 4 | * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Written by Jason R. Thorpe for Wasabi Systems, Inc. | | 7 | * Written by Jason R. Thorpe for Wasabi Systems, Inc. |
8 | * | | 8 | * |
9 | * Redistribution and use in source and binary forms, with or without | | 9 | * Redistribution and use in source and binary forms, with or without |
10 | * modification, are permitted provided that the following conditions | | 10 | * modification, are permitted provided that the following conditions |
11 | * are met: | | 11 | * are met: |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -73,27 +73,27 @@ | | | @@ -73,27 +73,27 @@ |
73 | * TODO (in order of importance): | | 73 | * TODO (in order of importance): |
74 | * | | 74 | * |
75 | * - Check XXX'ed comments | | 75 | * - Check XXX'ed comments |
76 | * - EEE (Energy Efficiency Ethernet) | | 76 | * - EEE (Energy Efficiency Ethernet) |
77 | * - Multi queue | | 77 | * - Multi queue |
78 | * - Image Unique ID | | 78 | * - Image Unique ID |
79 | * - LPLU other than PCH* | | 79 | * - LPLU other than PCH* |
80 | * - Virtual Function | | 80 | * - Virtual Function |
81 | * - Set LED correctly (based on contents in EEPROM) | | 81 | * - Set LED correctly (based on contents in EEPROM) |
82 | * - Rework how parameters are loaded from the EEPROM. | | 82 | * - Rework how parameters are loaded from the EEPROM. |
83 | */ | | 83 | */ |
84 | | | 84 | |
85 | #include <sys/cdefs.h> | | 85 | #include <sys/cdefs.h> |
86 | __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.369 2015/10/13 10:26:21 knakahara Exp $"); | | 86 | __KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.370 2015/10/13 21:28:41 christos Exp $"); |
87 | | | 87 | |
88 | #ifdef _KERNEL_OPT | | 88 | #ifdef _KERNEL_OPT |
89 | #include "opt_net_mpsafe.h" | | 89 | #include "opt_net_mpsafe.h" |
90 | #endif | | 90 | #endif |
91 | | | 91 | |
92 | #include <sys/param.h> | | 92 | #include <sys/param.h> |
93 | #include <sys/systm.h> | | 93 | #include <sys/systm.h> |
94 | #include <sys/callout.h> | | 94 | #include <sys/callout.h> |
95 | #include <sys/mbuf.h> | | 95 | #include <sys/mbuf.h> |
96 | #include <sys/malloc.h> | | 96 | #include <sys/malloc.h> |
97 | #include <sys/kmem.h> | | 97 | #include <sys/kmem.h> |
98 | #include <sys/kernel.h> | | 98 | #include <sys/kernel.h> |
99 | #include <sys/socket.h> | | 99 | #include <sys/socket.h> |
| @@ -9304,27 +9304,27 @@ wm_check_for_link(struct wm_softc *sc) | | | @@ -9304,27 +9304,27 @@ wm_check_for_link(struct wm_softc *sc) |
9304 | | | 9304 | |
9305 | return 0; | | 9305 | return 0; |
9306 | } | | 9306 | } |
9307 | | | 9307 | |
9308 | /* | | 9308 | /* |
9309 | * wm_tbi_tick: | | 9309 | * wm_tbi_tick: |
9310 | * | | 9310 | * |
9311 | * Check the link on TBI devices. | | 9311 | * Check the link on TBI devices. |
9312 | * This function acts as mii_tick(). | | 9312 | * This function acts as mii_tick(). |
9313 | */ | | 9313 | */ |
9314 | static void | | 9314 | static void |
9315 | wm_tbi_tick(struct wm_softc *sc) | | 9315 | wm_tbi_tick(struct wm_softc *sc) |
9316 | { | | 9316 | { |
9317 | struct wm_txqueue *txq = &sc->sc_txq[0]; | | 9317 | struct wm_txqueue *txq __diagused = &sc->sc_txq[0]; |
9318 | struct mii_data *mii = &sc->sc_mii; | | 9318 | struct mii_data *mii = &sc->sc_mii; |
9319 | struct ifmedia_entry *ife = mii->mii_media.ifm_cur; | | 9319 | struct ifmedia_entry *ife = mii->mii_media.ifm_cur; |
9320 | uint32_t status; | | 9320 | uint32_t status; |
9321 | | | 9321 | |
9322 | KASSERT(WM_TX_LOCKED(txq)); | | 9322 | KASSERT(WM_TX_LOCKED(txq)); |
9323 | | | 9323 | |
9324 | status = CSR_READ(sc, WMREG_STATUS); | | 9324 | status = CSR_READ(sc, WMREG_STATUS); |
9325 | | | 9325 | |
9326 | /* XXX is this needed? */ | | 9326 | /* XXX is this needed? */ |
9327 | (void)CSR_READ(sc, WMREG_RXCW); | | 9327 | (void)CSR_READ(sc, WMREG_RXCW); |
9328 | (void)CSR_READ(sc, WMREG_CTRL); | | 9328 | (void)CSR_READ(sc, WMREG_CTRL); |
9329 | | | 9329 | |
9330 | /* set link status */ | | 9330 | /* set link status */ |
| @@ -9512,27 +9512,27 @@ wm_serdes_mediastatus(struct ifnet *ifp, | | | @@ -9512,27 +9512,27 @@ wm_serdes_mediastatus(struct ifnet *ifp, |
9512 | | (mii->mii_media_active & IFM_ETH_FMASK); | | 9512 | | (mii->mii_media_active & IFM_ETH_FMASK); |
9513 | setled: | | 9513 | setled: |
9514 | wm_tbi_serdes_set_linkled(sc); | | 9514 | wm_tbi_serdes_set_linkled(sc); |
9515 | } | | 9515 | } |
9516 | | | 9516 | |
9517 | /* | | 9517 | /* |
9518 | * wm_serdes_tick: | | 9518 | * wm_serdes_tick: |
9519 | * | | 9519 | * |
9520 | * Check the link on serdes devices. | | 9520 | * Check the link on serdes devices. |
9521 | */ | | 9521 | */ |
9522 | static void | | 9522 | static void |
9523 | wm_serdes_tick(struct wm_softc *sc) | | 9523 | wm_serdes_tick(struct wm_softc *sc) |
9524 | { | | 9524 | { |
9525 | struct wm_txqueue *txq = &sc->sc_txq[0]; | | 9525 | struct wm_txqueue *txq __diagused = &sc->sc_txq[0]; |
9526 | struct ifnet *ifp = &sc->sc_ethercom.ec_if; | | 9526 | struct ifnet *ifp = &sc->sc_ethercom.ec_if; |
9527 | struct mii_data *mii = &sc->sc_mii; | | 9527 | struct mii_data *mii = &sc->sc_mii; |
9528 | struct ifmedia_entry *ife = mii->mii_media.ifm_cur; | | 9528 | struct ifmedia_entry *ife = mii->mii_media.ifm_cur; |
9529 | uint32_t reg; | | 9529 | uint32_t reg; |
9530 | | | 9530 | |
9531 | KASSERT(WM_TX_LOCKED(txq)); | | 9531 | KASSERT(WM_TX_LOCKED(txq)); |
9532 | | | 9532 | |
9533 | mii->mii_media_status = IFM_AVALID; | | 9533 | mii->mii_media_status = IFM_AVALID; |
9534 | mii->mii_media_active = IFM_ETHER; | | 9534 | mii->mii_media_active = IFM_ETHER; |
9535 | | | 9535 | |
9536 | /* Check PCS */ | | 9536 | /* Check PCS */ |
9537 | reg = CSR_READ(sc, WMREG_PCS_LSTS); | | 9537 | reg = CSR_READ(sc, WMREG_PCS_LSTS); |
9538 | if ((reg & PCS_LSTS_LINKOK) != 0) { | | 9538 | if ((reg & PCS_LSTS_LINKOK) != 0) { |