Thu Mar 5 15:36:39 2020 UTC ()
No functional change:

 - Fix typo in comment.
 - Whitespace


(msaitoh)
diff -r1.117 -r1.118 src/sys/dev/pci/if_ti.c
diff -r1.25 -r1.26 src/sys/dev/pci/if_tireg.h

cvs diff -r1.117 -r1.118 src/sys/dev/pci/if_ti.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_ti.c 2020/03/05 15:33:13 1.117
+++ src/sys/dev/pci/if_ti.c 2020/03/05 15:36:39 1.118
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_ti.c,v 1.117 2020/03/05 15:33:13 msaitoh Exp $ */ 1/* $NetBSD: if_ti.c,v 1.118 2020/03/05 15:36:39 msaitoh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997, 1998, 1999 4 * Copyright (c) 1997, 1998, 1999
5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -71,27 +71,27 @@ @@ -71,27 +71,27 @@
71 * compiling it requires a GNU toolchain targeted for mips-sgi-irix5.3. 71 * compiling it requires a GNU toolchain targeted for mips-sgi-irix5.3.
72 * 72 *
73 * The following people deserve special thanks: 73 * The following people deserve special thanks:
74 * - Terry Murphy of 3Com, for providing a 3c985 Tigon 1 board 74 * - Terry Murphy of 3Com, for providing a 3c985 Tigon 1 board
75 * for testing 75 * for testing
76 * - Raymond Lee of Netgear, for providing a pair of Netgear 76 * - Raymond Lee of Netgear, for providing a pair of Netgear
77 * GA620 Tigon 2 boards for testing 77 * GA620 Tigon 2 boards for testing
78 * - Ulf Zimmermann, for bringing the GA620 to my attention and 78 * - Ulf Zimmermann, for bringing the GA620 to my attention and
79 * convincing me to write this driver. 79 * convincing me to write this driver.
80 * - Andrew Gallatin for providing FreeBSD/Alpha support. 80 * - Andrew Gallatin for providing FreeBSD/Alpha support.
81 */ 81 */
82 82
83#include <sys/cdefs.h> 83#include <sys/cdefs.h>
84__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.117 2020/03/05 15:33:13 msaitoh Exp $"); 84__KERNEL_RCSID(0, "$NetBSD: if_ti.c,v 1.118 2020/03/05 15:36:39 msaitoh Exp $");
85 85
86#include "opt_inet.h" 86#include "opt_inet.h"
87 87
88#include <sys/param.h> 88#include <sys/param.h>
89#include <sys/systm.h> 89#include <sys/systm.h>
90#include <sys/sockio.h> 90#include <sys/sockio.h>
91#include <sys/mbuf.h> 91#include <sys/mbuf.h>
92#include <sys/malloc.h> 92#include <sys/malloc.h>
93#include <sys/kernel.h> 93#include <sys/kernel.h>
94#include <sys/socket.h> 94#include <sys/socket.h>
95#include <sys/queue.h> 95#include <sys/queue.h>
96#include <sys/device.h> 96#include <sys/device.h>
97#include <sys/reboot.h> 97#include <sys/reboot.h>
@@ -216,27 +216,27 @@ CFATTACH_DECL_NEW(ti, sizeof(struct ti_s @@ -216,27 +216,27 @@ CFATTACH_DECL_NEW(ti, sizeof(struct ti_s
216 * Send an instruction or address to the EEPROM, check for ACK. 216 * Send an instruction or address to the EEPROM, check for ACK.
217 */ 217 */
218static uint32_t 218static uint32_t
219ti_eeprom_putbyte(struct ti_softc *sc, int byte) 219ti_eeprom_putbyte(struct ti_softc *sc, int byte)
220{ 220{
221 int i, ack = 0; 221 int i, ack = 0;
222 222
223 /* 223 /*
224 * Make sure we're in TX mode. 224 * Make sure we're in TX mode.
225 */ 225 */
226 TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN); 226 TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_TXEN);
227 227
228 /* 228 /*
229 * Feed in each bit and stobe the clock. 229 * Feed in each bit and strobe the clock.
230 */ 230 */
231 for (i = 0x80; i; i >>= 1) { 231 for (i = 0x80; i; i >>= 1) {
232 if (byte & i) { 232 if (byte & i) {
233 TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT); 233 TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT);
234 } else { 234 } else {
235 TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT); 235 TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_DOUT);
236 } 236 }
237 DELAY(1); 237 DELAY(1);
238 TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK); 238 TI_SETBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK);
239 DELAY(1); 239 DELAY(1);
240 TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK); 240 TI_CLRBIT(sc, TI_MISC_LOCAL_CTL, TI_MLC_EE_CLK);
241 } 241 }
242 242
@@ -2198,27 +2198,27 @@ ti_stats_update(struct ti_softc *sc) @@ -2198,27 +2198,27 @@ ti_stats_update(struct ti_softc *sc)
2198 2198
2199 uint64_t collisions =  2199 uint64_t collisions =
2200 (sc->ti_rdata->ti_info.ti_stats.dot3StatsSingleCollisionFrames + 2200 (sc->ti_rdata->ti_info.ti_stats.dot3StatsSingleCollisionFrames +
2201 sc->ti_rdata->ti_info.ti_stats.dot3StatsMultipleCollisionFrames + 2201 sc->ti_rdata->ti_info.ti_stats.dot3StatsMultipleCollisionFrames +
2202 sc->ti_rdata->ti_info.ti_stats.dot3StatsExcessiveCollisions + 2202 sc->ti_rdata->ti_info.ti_stats.dot3StatsExcessiveCollisions +
2203 sc->ti_rdata->ti_info.ti_stats.dot3StatsLateCollisions); 2203 sc->ti_rdata->ti_info.ti_stats.dot3StatsLateCollisions);
2204 if_statadd(ifp, if_collisions, collisions - sc->ti_if_collisions); 2204 if_statadd(ifp, if_collisions, collisions - sc->ti_if_collisions);
2205 sc->ti_if_collisions = collisions; 2205 sc->ti_if_collisions = collisions;
2206 2206
2207 TI_CDSTATSSYNC(sc, BUS_DMASYNC_PREREAD); 2207 TI_CDSTATSSYNC(sc, BUS_DMASYNC_PREREAD);
2208} 2208}
2209 2209
2210/* 2210/*
2211 * Encapsulate an mbuf chain in the tx ring by coupling the mbuf data 2211 * Encapsulate an mbuf chain in the tx ring by coupling the mbuf data
2212 * pointers to descriptors. 2212 * pointers to descriptors.
2213 */ 2213 */
2214static int 2214static int
2215ti_encap_tigon1(struct ti_softc *sc, struct mbuf *m_head, uint32_t *txidx) 2215ti_encap_tigon1(struct ti_softc *sc, struct mbuf *m_head, uint32_t *txidx)
2216{ 2216{
2217 struct ti_tx_desc *f = NULL; 2217 struct ti_tx_desc *f = NULL;
2218 uint32_t frag, cur, cnt = 0; 2218 uint32_t frag, cur, cnt = 0;
2219 struct txdmamap_pool_entry *dma; 2219 struct txdmamap_pool_entry *dma;
2220 bus_dmamap_t dmamap; 2220 bus_dmamap_t dmamap;
2221 int error, i; 2221 int error, i;
2222 uint16_t csum_flags = 0; 2222 uint16_t csum_flags = 0;
2223 2223
2224 dma = SIMPLEQ_FIRST(&sc->txdma_list); 2224 dma = SIMPLEQ_FIRST(&sc->txdma_list);
@@ -2677,27 +2677,27 @@ ti_ifmedia_sts(struct ifnet *ifp, struct @@ -2677,27 +2677,27 @@ ti_ifmedia_sts(struct ifnet *ifp, struct
2677 if (media & TI_LNK_FULL_DUPLEX) 2677 if (media & TI_LNK_FULL_DUPLEX)
2678 ifmr->ifm_active |= IFM_FDX; 2678 ifmr->ifm_active |= IFM_FDX;
2679 if (media & TI_LNK_HALF_DUPLEX) 2679 if (media & TI_LNK_HALF_DUPLEX)
2680 ifmr->ifm_active |= IFM_HDX; 2680 ifmr->ifm_active |= IFM_HDX;
2681 } 2681 }
2682 2682
2683 sc->ethercom.ec_if.if_baudrate = 2683 sc->ethercom.ec_if.if_baudrate =
2684 ifmedia_baudrate(sc->ifmedia.ifm_media); 2684 ifmedia_baudrate(sc->ifmedia.ifm_media);
2685} 2685}
2686 2686
2687static int 2687static int
2688ti_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data) 2688ti_ether_ioctl(struct ifnet *ifp, u_long cmd, void *data)
2689{ 2689{
2690 struct ifaddr *ifa = (struct ifaddr *) data; 2690 struct ifaddr *ifa = (struct ifaddr *)data;
2691 struct ti_softc *sc = ifp->if_softc; 2691 struct ti_softc *sc = ifp->if_softc;
2692 2692
2693 if ((ifp->if_flags & IFF_UP) == 0) { 2693 if ((ifp->if_flags & IFF_UP) == 0) {
2694 ifp->if_flags |= IFF_UP; 2694 ifp->if_flags |= IFF_UP;
2695 ti_init(sc); 2695 ti_init(sc);
2696 } 2696 }
2697 2697
2698 switch (cmd) { 2698 switch (cmd) {
2699 case SIOCINITIFADDR: 2699 case SIOCINITIFADDR:
2700 2700
2701 switch (ifa->ifa_addr->sa_family) { 2701 switch (ifa->ifa_addr->sa_family) {
2702#ifdef INET 2702#ifdef INET
2703 case AF_INET: 2703 case AF_INET:
@@ -2710,27 +2710,27 @@ ti_ether_ioctl(struct ifnet *ifp, u_long @@ -2710,27 +2710,27 @@ ti_ether_ioctl(struct ifnet *ifp, u_long
2710 break; 2710 break;
2711 2711
2712 default: 2712 default:
2713 return (EINVAL); 2713 return (EINVAL);
2714 } 2714 }
2715 2715
2716 return (0); 2716 return (0);
2717} 2717}
2718 2718
2719static int 2719static int
2720ti_ioctl(struct ifnet *ifp, u_long command, void *data) 2720ti_ioctl(struct ifnet *ifp, u_long command, void *data)
2721{ 2721{
2722 struct ti_softc *sc = ifp->if_softc; 2722 struct ti_softc *sc = ifp->if_softc;
2723 struct ifreq *ifr = (struct ifreq *) data; 2723 struct ifreq *ifr = (struct ifreq *)data;
2724 int s, error = 0; 2724 int s, error = 0;
2725 struct ti_cmd_desc cmd; 2725 struct ti_cmd_desc cmd;
2726 2726
2727 s = splnet(); 2727 s = splnet();
2728 2728
2729 switch (command) { 2729 switch (command) {
2730 case SIOCINITIFADDR: 2730 case SIOCINITIFADDR:
2731 error = ti_ether_ioctl(ifp, command, data); 2731 error = ti_ether_ioctl(ifp, command, data);
2732 break; 2732 break;
2733 case SIOCSIFMTU: 2733 case SIOCSIFMTU:
2734 if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU_JUMBO) 2734 if (ifr->ifr_mtu < ETHERMIN || ifr->ifr_mtu > ETHERMTU_JUMBO)
2735 error = EINVAL; 2735 error = EINVAL;
2736 else if ((error = ifioctl_common(ifp, command, data)) 2736 else if ((error = ifioctl_common(ifp, command, data))

cvs diff -r1.25 -r1.26 src/sys/dev/pci/if_tireg.h (expand / switch to unified diff)

--- src/sys/dev/pci/if_tireg.h 2020/02/29 19:29:38 1.25
+++ src/sys/dev/pci/if_tireg.h 2020/03/05 15:36:39 1.26
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_tireg.h,v 1.25 2020/02/29 19:29:38 thorpej Exp $ */ 1/* $NetBSD: if_tireg.h,v 1.26 2020/03/05 15:36:39 msaitoh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1997, 1998, 1999 4 * Copyright (c) 1997, 1998, 1999
5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. 5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -29,27 +29,27 @@ @@ -29,27 +29,27 @@
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
32 * THE POSSIBILITY OF SUCH DAMAGE. 32 * THE POSSIBILITY OF SUCH DAMAGE.
33 * 33 *
34 * FreeBSD Id: if_tireg.h,v 1.9 1999/07/27 03:54:48 wpaul Exp 34 * FreeBSD Id: if_tireg.h,v 1.9 1999/07/27 03:54:48 wpaul Exp
35 */ 35 */
36 36
37/* 37/*
38 * Tigon register offsets. These are memory mapped registers 38 * Tigon register offsets. These are memory mapped registers
39 * which can be accessed with the CSR_READ_4()/CSR_WRITE_4() macros. 39 * which can be accessed with the CSR_READ_4()/CSR_WRITE_4() macros.
40 * Each register must be accessed using 32 bit operations. 40 * Each register must be accessed using 32 bit operations.
41 * 41 *
42 * All reegisters are accessed through a 16K shared memory block. 42 * All registers are accessed through a 16K shared memory block.
43 * The first group of registers are actually copies of the PCI 43 * The first group of registers are actually copies of the PCI
44 * configuration space registers. 44 * configuration space registers.
45 */ 45 */
46 46
47/* 47/*
48 * Tigon configuration and control registers. 48 * Tigon configuration and control registers.
49 */ 49 */
50#define TI_MISC_HOST_CTL 0x040 50#define TI_MISC_HOST_CTL 0x040
51#define TI_MISC_LOCAL_CTL 0x044 51#define TI_MISC_LOCAL_CTL 0x044
52#define TI_SEM_AB 0x048 /* Tigon 2 only */ 52#define TI_SEM_AB 0x048 /* Tigon 2 only */
53#define TI_MISC_CONF 0x050 /* Tigon 2 only */ 53#define TI_MISC_CONF 0x050 /* Tigon 2 only */
54#define TI_TIMER_BITS 0x054 54#define TI_TIMER_BITS 0x054
55#define TI_TIMERREF 0x058 55#define TI_TIMERREF 0x058