Wed Jul 15 01:42:27 2020 UTC ()
G.C. comment.


(msaitoh)
diff -r1.130 -r1.131 src/sys/dev/ic/gem.c

cvs diff -r1.130 -r1.131 src/sys/dev/ic/gem.c (expand / switch to unified diff)

--- src/sys/dev/ic/gem.c 2020/03/15 22:19:00 1.130
+++ src/sys/dev/ic/gem.c 2020/07/15 01:42:27 1.131
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: gem.c,v 1.130 2020/03/15 22:19:00 thorpej Exp $ */ 1/* $NetBSD: gem.c,v 1.131 2020/07/15 01:42:27 msaitoh Exp $ */
2 2
3/* 3/*
4 * 4 *
5 * Copyright (C) 2001 Eduardo Horvath. 5 * Copyright (C) 2001 Eduardo Horvath.
6 * Copyright (c) 2001-2003 Thomas Moestl 6 * Copyright (c) 2001-2003 Thomas Moestl
7 * All rights reserved. 7 * All rights reserved.
8 * 8 *
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE. 29 * SUCH DAMAGE.
30 * 30 *
31 */ 31 */
32 32
33/* 33/*
34 * Driver for Apple GMAC, Sun ERI and Sun GEM Ethernet controllers 34 * Driver for Apple GMAC, Sun ERI and Sun GEM Ethernet controllers
35 * See `GEM Gigabit Ethernet ASIC Specification' 35 * See `GEM Gigabit Ethernet ASIC Specification'
36 * http://www.sun.com/processors/manuals/ge.pdf 36 * http://www.sun.com/processors/manuals/ge.pdf
37 */ 37 */
38 38
39#include <sys/cdefs.h> 39#include <sys/cdefs.h>
40__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.130 2020/03/15 22:19:00 thorpej Exp $"); 40__KERNEL_RCSID(0, "$NetBSD: gem.c,v 1.131 2020/07/15 01:42:27 msaitoh Exp $");
41 41
42#include "opt_inet.h" 42#include "opt_inet.h"
43 43
44#include <sys/param.h> 44#include <sys/param.h>
45#include <sys/systm.h> 45#include <sys/systm.h>
46#include <sys/callout.h> 46#include <sys/callout.h>
47#include <sys/mbuf.h> 47#include <sys/mbuf.h>
48#include <sys/syslog.h> 48#include <sys/syslog.h>
49#include <sys/malloc.h> 49#include <sys/malloc.h>
50#include <sys/kernel.h> 50#include <sys/kernel.h>
51#include <sys/socket.h> 51#include <sys/socket.h>
52#include <sys/ioctl.h> 52#include <sys/ioctl.h>
53#include <sys/errno.h> 53#include <sys/errno.h>
@@ -870,36 +870,36 @@ gem_reset_tx(struct gem_softc *sc) @@ -870,36 +870,36 @@ gem_reset_tx(struct gem_softc *sc)
870{ 870{
871 bus_space_tag_t t = sc->sc_bustag; 871 bus_space_tag_t t = sc->sc_bustag;
872 bus_space_handle_t h = sc->sc_h1, h2 = sc->sc_h2; 872 bus_space_handle_t h = sc->sc_h1, h2 = sc->sc_h2;
873 873
874 /* 874 /*
875 * Resetting while DMA is in progress can cause a bus hang, so we 875 * Resetting while DMA is in progress can cause a bus hang, so we
876 * disable DMA first. 876 * disable DMA first.
877 */ 877 */
878 gem_disable_tx(sc); 878 gem_disable_tx(sc);
879 bus_space_write_4(t, h, GEM_TX_CONFIG, 0); 879 bus_space_write_4(t, h, GEM_TX_CONFIG, 0);
880 bus_space_barrier(t, h, GEM_TX_CONFIG, 4, BUS_SPACE_BARRIER_WRITE); 880 bus_space_barrier(t, h, GEM_TX_CONFIG, 4, BUS_SPACE_BARRIER_WRITE);
881 /* Wait till it finishes */ 881 /* Wait till it finishes */
882 if (!gem_bitwait(sc, h, GEM_TX_CONFIG, 1, 0)) 882 if (!gem_bitwait(sc, h, GEM_TX_CONFIG, 1, 0))
883 aprint_error_dev(sc->sc_dev, "cannot disable tx dma\n"); /* OpenBSD 1.34 */ 883 aprint_error_dev(sc->sc_dev, "cannot disable tx dma\n");
884 /* Wait 5ms extra. */ 884 /* Wait 5ms extra. */
885 delay(5000); 885 delay(5000);
886 886
887 /* Finally, reset the ETX */ 887 /* Finally, reset the ETX */
888 bus_space_write_4(t, h2, GEM_RESET, GEM_RESET_TX); 888 bus_space_write_4(t, h2, GEM_RESET, GEM_RESET_TX);
889 bus_space_barrier(t, h, GEM_RESET, 4, BUS_SPACE_BARRIER_WRITE); 889 bus_space_barrier(t, h, GEM_RESET, 4, BUS_SPACE_BARRIER_WRITE);
890 /* Wait till it finishes */ 890 /* Wait till it finishes */
891 if (!gem_bitwait(sc, h2, GEM_RESET, GEM_RESET_TX, 0)) { 891 if (!gem_bitwait(sc, h2, GEM_RESET, GEM_RESET_TX, 0)) {
892 aprint_error_dev(sc->sc_dev, "cannot reset transmitter\n"); /* OpenBSD 1.34 */ 892 aprint_error_dev(sc->sc_dev, "cannot reset transmitter\n");
893 return (1); 893 return (1);
894 } 894 }
895 return (0); 895 return (0);
896} 896}
897 897
898/* 898/*
899 * disable receiver. 899 * disable receiver.
900 */ 900 */
901int 901int
902gem_disable_rx(struct gem_softc *sc) 902gem_disable_rx(struct gem_softc *sc)
903{ 903{
904 bus_space_tag_t t = sc->sc_bustag; 904 bus_space_tag_t t = sc->sc_bustag;
905 bus_space_handle_t h = sc->sc_h1; 905 bus_space_handle_t h = sc->sc_h1;