Sat Jun 27 13:34:20 2020 UTC ()
prop_data_data_nocopy -> prop_data_value


(jmcneill)
diff -r1.6 -r1.7 src/sys/dev/ic/bcmgenet.c
diff -r1.28 -r1.29 src/sys/dev/ic/dm9000.c
diff -r1.70 -r1.71 src/sys/dev/ic/dwc_gmac.c

cvs diff -r1.6 -r1.7 src/sys/dev/ic/bcmgenet.c (expand / switch to unified diff)

--- src/sys/dev/ic/bcmgenet.c 2020/05/25 19:49:28 1.6
+++ src/sys/dev/ic/bcmgenet.c 2020/06/27 13:34:20 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bcmgenet.c,v 1.6 2020/05/25 19:49:28 jmcneill Exp $ */ 1/* $NetBSD: bcmgenet.c,v 1.7 2020/06/27 13:34:20 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2020 Jared McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2020 Jared McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * 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.
@@ -24,27 +24,27 @@ @@ -24,27 +24,27 @@
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29/* 29/*
30 * Broadcom GENETv5 30 * Broadcom GENETv5
31 */ 31 */
32 32
33#include "opt_net_mpsafe.h" 33#include "opt_net_mpsafe.h"
34#include "opt_ddb.h" 34#include "opt_ddb.h"
35 35
36#include <sys/cdefs.h> 36#include <sys/cdefs.h>
37__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.6 2020/05/25 19:49:28 jmcneill Exp $"); 37__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.7 2020/06/27 13:34:20 jmcneill Exp $");
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/bus.h> 40#include <sys/bus.h>
41#include <sys/device.h> 41#include <sys/device.h>
42#include <sys/intr.h> 42#include <sys/intr.h>
43#include <sys/systm.h> 43#include <sys/systm.h>
44#include <sys/kernel.h> 44#include <sys/kernel.h>
45#include <sys/mutex.h> 45#include <sys/mutex.h>
46#include <sys/callout.h> 46#include <sys/callout.h>
47#include <sys/cprng.h> 47#include <sys/cprng.h>
48 48
49#include <net/if.h> 49#include <net/if.h>
50#include <net/if_dl.h> 50#include <net/if_dl.h>
@@ -826,27 +826,27 @@ genet_ioctl(struct ifnet *ifp, u_long cm @@ -826,27 +826,27 @@ genet_ioctl(struct ifnet *ifp, u_long cm
826} 826}
827 827
828static void 828static void
829genet_get_eaddr(struct genet_softc *sc, uint8_t *eaddr) 829genet_get_eaddr(struct genet_softc *sc, uint8_t *eaddr)
830{ 830{
831 prop_dictionary_t prop = device_properties(sc->sc_dev); 831 prop_dictionary_t prop = device_properties(sc->sc_dev);
832 uint32_t maclo, machi, val; 832 uint32_t maclo, machi, val;
833 prop_data_t eaprop; 833 prop_data_t eaprop;
834 834
835 eaprop = prop_dictionary_get(prop, "mac-address"); 835 eaprop = prop_dictionary_get(prop, "mac-address");
836 if (eaprop != NULL) { 836 if (eaprop != NULL) {
837 KASSERT(prop_object_type(eaprop) == PROP_TYPE_DATA); 837 KASSERT(prop_object_type(eaprop) == PROP_TYPE_DATA);
838 KASSERT(prop_data_size(eaprop) == ETHER_ADDR_LEN); 838 KASSERT(prop_data_size(eaprop) == ETHER_ADDR_LEN);
839 memcpy(eaddr, prop_data_data_nocopy(eaprop), 839 memcpy(eaddr, prop_data_value(eaprop),
840 ETHER_ADDR_LEN); 840 ETHER_ADDR_LEN);
841 return; 841 return;
842 } 842 }
843 843
844 maclo = machi = 0; 844 maclo = machi = 0;
845 845
846 val = RD4(sc, GENET_SYS_RBUF_FLUSH_CTRL); 846 val = RD4(sc, GENET_SYS_RBUF_FLUSH_CTRL);
847 if ((val & GENET_SYS_RBUF_FLUSH_RESET) == 0) { 847 if ((val & GENET_SYS_RBUF_FLUSH_RESET) == 0) {
848 maclo = htobe32(RD4(sc, GENET_UMAC_MAC0)); 848 maclo = htobe32(RD4(sc, GENET_UMAC_MAC0));
849 machi = htobe16(RD4(sc, GENET_UMAC_MAC1) & 0xffff); 849 machi = htobe16(RD4(sc, GENET_UMAC_MAC1) & 0xffff);
850 } 850 }
851 851
852 if (maclo == 0 && machi == 0) { 852 if (maclo == 0 && machi == 0) {

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

--- src/sys/dev/ic/dm9000.c 2020/04/02 13:38:50 1.28
+++ src/sys/dev/ic/dm9000.c 2020/06/27 13:34:20 1.29
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dm9000.c,v 1.28 2020/04/02 13:38:50 nisimura Exp $ */ 1/* $NetBSD: dm9000.c,v 1.29 2020/06/27 13:34:20 jmcneill Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2009 Paul Fleischer 4 * Copyright (c) 2009 Paul Fleischer
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 3. The name of the company nor the name of the author may be used to 12 * 3. The name of the company nor the name of the author may be used to
13 * endorse or promote products derived from this software without specific 13 * endorse or promote products derived from this software without specific
14 * prior written permission. 14 * prior written permission.
@@ -214,27 +214,27 @@ dme_attach(struct dme_softc *sc, const u @@ -214,27 +214,27 @@ dme_attach(struct dme_softc *sc, const u
214 "DM9000 was configured with MAC address: %s\n", 214 "DM9000 was configured with MAC address: %s\n",
215 ether_sprintf(enaddr)); 215 ether_sprintf(enaddr));
216 } 216 }
217#endif 217#endif
218 dict = device_properties(sc->sc_dev); 218 dict = device_properties(sc->sc_dev);
219 ea = (dict) ? prop_dictionary_get(dict, "mac-address") : NULL; 219 ea = (dict) ? prop_dictionary_get(dict, "mac-address") : NULL;
220 if (ea != NULL) { 220 if (ea != NULL) {
221 /* 221 /*
222 * If the MAC address is overriden by a device property, 222 * If the MAC address is overriden by a device property,
223 * use that. 223 * use that.
224 */ 224 */
225 KASSERT(prop_object_type(ea) == PROP_TYPE_DATA); 225 KASSERT(prop_object_type(ea) == PROP_TYPE_DATA);
226 KASSERT(prop_data_size(ea) == ETHER_ADDR_LEN); 226 KASSERT(prop_data_size(ea) == ETHER_ADDR_LEN);
227 memcpy(enaddr, prop_data_data_nocopy(ea), ETHER_ADDR_LEN); 227 memcpy(enaddr, prop_data_value(ea), ETHER_ADDR_LEN);
228 aprint_debug_dev(sc->sc_dev, "got MAC address!\n"); 228 aprint_debug_dev(sc->sc_dev, "got MAC address!\n");
229 } else { 229 } else {
230 /* 230 /*
231 * If we did not get an externaly configure address, 231 * If we did not get an externaly configure address,
232 * try to read one from the current setup, before 232 * try to read one from the current setup, before
233 * resetting the chip. 233 * resetting the chip.
234 */ 234 */
235 dme_read_c(sc, DM9000_PAB0, enaddr, 6); 235 dme_read_c(sc, DM9000_PAB0, enaddr, 6);
236 if (ETHER_IS_ONE(enaddr) || ETHER_IS_ZERO(enaddr)) { 236 if (ETHER_IS_ONE(enaddr) || ETHER_IS_ZERO(enaddr)) {
237 /* make a random MAC address */ 237 /* make a random MAC address */
238 uint32_t maclo = 0x00f2 | (cprng_strong32() << 16); 238 uint32_t maclo = 0x00f2 | (cprng_strong32() << 16);
239 uint32_t machi = cprng_strong32(); 239 uint32_t machi = cprng_strong32();
240 enaddr[0] = maclo; 240 enaddr[0] = maclo;

cvs diff -r1.70 -r1.71 src/sys/dev/ic/dwc_gmac.c (expand / switch to unified diff)

--- src/sys/dev/ic/dwc_gmac.c 2020/05/17 21:50:47 1.70
+++ src/sys/dev/ic/dwc_gmac.c 2020/06/27 13:34:20 1.71
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: dwc_gmac.c,v 1.70 2020/05/17 21:50:47 chs Exp $ */ 1/* $NetBSD: dwc_gmac.c,v 1.71 2020/06/27 13:34:20 jmcneill Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc. 4 * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry and Martin Husemann. 8 * by Matt Thomas of 3am Software Foundry and Martin Husemann.
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.
@@ -31,27 +31,27 @@ @@ -31,27 +31,27 @@
31 31
32/* 32/*
33 * This driver supports the Synopsis Designware GMAC core, as found 33 * This driver supports the Synopsis Designware GMAC core, as found
34 * on Allwinner A20 cores and others. 34 * on Allwinner A20 cores and others.
35 * 35 *
36 * Real documentation seems to not be available, the marketing product 36 * Real documentation seems to not be available, the marketing product
37 * documents could be found here: 37 * documents could be found here:
38 * 38 *
39 * http://www.synopsys.com/dw/ipdir.php?ds=dwc_ether_mac10_100_1000_unive 39 * http://www.synopsys.com/dw/ipdir.php?ds=dwc_ether_mac10_100_1000_unive
40 */ 40 */
41 41
42#include <sys/cdefs.h> 42#include <sys/cdefs.h>
43 43
44__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.70 2020/05/17 21:50:47 chs Exp $"); 44__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.71 2020/06/27 13:34:20 jmcneill Exp $");
45 45
46/* #define DWC_GMAC_DEBUG 1 */ 46/* #define DWC_GMAC_DEBUG 1 */
47 47
48#ifdef _KERNEL_OPT 48#ifdef _KERNEL_OPT
49#include "opt_inet.h" 49#include "opt_inet.h"
50#include "opt_net_mpsafe.h" 50#include "opt_net_mpsafe.h"
51#endif 51#endif
52 52
53#include <sys/param.h> 53#include <sys/param.h>
54#include <sys/bus.h> 54#include <sys/bus.h>
55#include <sys/device.h> 55#include <sys/device.h>
56#include <sys/intr.h> 56#include <sys/intr.h>
57#include <sys/systm.h> 57#include <sys/systm.h>
@@ -192,27 +192,27 @@ dwc_gmac_attach(struct dwc_gmac_softc *s @@ -192,27 +192,27 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
192 192
193 mutex_init(&sc->sc_mdio_lock, MUTEX_DEFAULT, IPL_NET); 193 mutex_init(&sc->sc_mdio_lock, MUTEX_DEFAULT, IPL_NET);
194 sc->sc_mii_clk = mii_clk & 7; 194 sc->sc_mii_clk = mii_clk & 7;
195 195
196 dict = device_properties(sc->sc_dev); 196 dict = device_properties(sc->sc_dev);
197 prop_data_t ea = dict ? prop_dictionary_get(dict, "mac-address") : NULL; 197 prop_data_t ea = dict ? prop_dictionary_get(dict, "mac-address") : NULL;
198 if (ea != NULL) { 198 if (ea != NULL) {
199 /* 199 /*
200 * If the MAC address is overriden by a device property, 200 * If the MAC address is overriden by a device property,
201 * use that. 201 * use that.
202 */ 202 */
203 KASSERT(prop_object_type(ea) == PROP_TYPE_DATA); 203 KASSERT(prop_object_type(ea) == PROP_TYPE_DATA);
204 KASSERT(prop_data_size(ea) == ETHER_ADDR_LEN); 204 KASSERT(prop_data_size(ea) == ETHER_ADDR_LEN);
205 memcpy(enaddr, prop_data_data_nocopy(ea), ETHER_ADDR_LEN); 205 memcpy(enaddr, prop_data_value(ea), ETHER_ADDR_LEN);
206 } else { 206 } else {
207 /* 207 /*
208 * If we did not get an externaly configure address, 208 * If we did not get an externaly configure address,
209 * try to read one from the current filter setup, 209 * try to read one from the current filter setup,
210 * before resetting the chip. 210 * before resetting the chip.
211 */ 211 */
212 maclo = bus_space_read_4(sc->sc_bst, sc->sc_bsh, 212 maclo = bus_space_read_4(sc->sc_bst, sc->sc_bsh,
213 AWIN_GMAC_MAC_ADDR0LO); 213 AWIN_GMAC_MAC_ADDR0LO);
214 machi = bus_space_read_4(sc->sc_bst, sc->sc_bsh, 214 machi = bus_space_read_4(sc->sc_bst, sc->sc_bsh,
215 AWIN_GMAC_MAC_ADDR0HI); 215 AWIN_GMAC_MAC_ADDR0HI);
216 216
217 if (maclo == 0xffffffff && (machi & 0xffff) == 0xffff) { 217 if (maclo == 0xffffffff && (machi & 0xffff) == 0xffff) {
218 /* fake MAC address */ 218 /* fake MAC address */