CVS commit: src/sys/net/lagg
Module Name:src Committed By: rillig Date: Wed May 19 06:13:08 UTC 2021 Modified Files: src/sys/net/lagg: if_laggproto.h Log Message: if_lagg: fix Clang build Clang is stricter than GCC when it comes to nonliteral format strings. sys/net/lagg/if_lagg.c:2372:12: error: format string is not a string literal [-Werror,-Wformat-nonliteral] To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/net/lagg/if_laggproto.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/lagg/if_laggproto.h diff -u src/sys/net/lagg/if_laggproto.h:1.1 src/sys/net/lagg/if_laggproto.h:1.2 --- src/sys/net/lagg/if_laggproto.h:1.1 Mon May 17 04:07:43 2021 +++ src/sys/net/lagg/if_laggproto.h Wed May 19 06:13:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_laggproto.h,v 1.1 2021/05/17 04:07:43 yamaguchi Exp $ */ +/* $NetBSD: if_laggproto.h,v 1.2 2021/05/19 06:13:08 rillig Exp $ */ #ifndef _NET_LAGG_IF_LAGGPROTO_H_ #define _NET_LAGG_IF_LAGGPROTO_H_ @@ -226,7 +226,8 @@ lagg_portactive(struct lagg_port *lp) return false; } -void lagg_log(struct lagg_softc *, int, const char *, ...); +void lagg_log(struct lagg_softc *, int, const char *, ...) + __printflike(3, 4); void lagg_port_getref(struct lagg_port *, struct psref *); void lagg_port_putref(struct lagg_port *, struct psref *); void lagg_enqueue(struct lagg_softc *,
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/spi
Module Name:src Committed By: thorpej Date: Wed May 19 03:46:26 UTC 2021 Modified Files: src/sys/dev/spi [thorpej-i2c-spi-conf]: m25p.c mcp23s17.c mcp3k.c mcp48x1.c oj6sh.c ssdfb_spi.c tmp121.c Log Message: match/probe routines should not have side-effects; call spi_configure() from the attach routine. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.17.4.1 src/sys/dev/spi/m25p.c cvs rdiff -u -r1.2.2.1 -r1.2.2.2 src/sys/dev/spi/mcp23s17.c cvs rdiff -u -r1.2.36.1 -r1.2.36.2 src/sys/dev/spi/mcp3k.c cvs rdiff -u -r1.1.54.1 -r1.1.54.2 src/sys/dev/spi/mcp48x1.c cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/dev/spi/oj6sh.c cvs rdiff -u -r1.5 -r1.5.4.1 src/sys/dev/spi/ssdfb_spi.c cvs rdiff -u -r1.5.72.1 -r1.5.72.2 src/sys/dev/spi/tmp121.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/spi/m25p.c diff -u src/sys/dev/spi/m25p.c:1.17 src/sys/dev/spi/m25p.c:1.17.4.1 --- src/sys/dev/spi/m25p.c:1.17 Wed Jan 27 02:32:31 2021 +++ src/sys/dev/spi/m25p.c Wed May 19 03:46:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: m25p.c,v 1.17 2021/01/27 02:32:31 thorpej Exp $ */ +/* $NetBSD: m25p.c,v 1.17.4.1 2021/05/19 03:46:26 thorpej Exp $ */ /*- * Copyright (c) 2006 Urbana-Champaign Independent Media Center. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: m25p.c,v 1.17 2021/01/27 02:32:31 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: m25p.c,v 1.17.4.1 2021/05/19 03:46:26 thorpej Exp $"); #include #include @@ -125,17 +125,8 @@ static int m25p_match(device_t parent, cfdata_t cf, void *aux) { struct spi_attach_args *sa = aux; - int res; - res = spi_compatible_match(sa, cf, compat_data); - if (!res) - return res; - - /* configure for 20MHz, which is the max for normal reads */ - if (spi_configure(sa->sa_handle, SPI_MODE_0, 2000)) - res = 0; - - return res; + return spi_compatible_match(sa, cf, compat_data); } static void @@ -143,12 +134,21 @@ m25p_attach(device_t parent, device_t se { struct m25p_softc *sc = device_private(self); struct spi_attach_args *sa = aux; + int error; sc->sc_sh = sa->sa_handle; aprint_normal("\n"); aprint_naive("\n"); + /* configure for 20MHz, which is the max for normal reads */ + error = spi_configure(sa->sa_handle, SPI_MODE_0, 2000); + if (error) { + aprint_error_dev(self, "spi_configure failed (error = %d)\n", + error); + return; + } + config_interrupts(self, m25p_doattach); } Index: src/sys/dev/spi/mcp23s17.c diff -u src/sys/dev/spi/mcp23s17.c:1.2.2.1 src/sys/dev/spi/mcp23s17.c:1.2.2.2 --- src/sys/dev/spi/mcp23s17.c:1.2.2.1 Wed May 19 03:32:27 2021 +++ src/sys/dev/spi/mcp23s17.c Wed May 19 03:46:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mcp23s17.c,v 1.2.2.1 2021/05/19 03:32:27 thorpej Exp $ */ +/* $NetBSD: mcp23s17.c,v 1.2.2.2 2021/05/19 03:46:26 thorpej Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mcp23s17.c,v 1.2.2.1 2021/05/19 03:32:27 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcp23s17.c,v 1.2.2.2 2021/05/19 03:46:26 thorpej Exp $"); /* * Driver for Microchip MCP23S17 GPIO @@ -105,16 +105,8 @@ static int mcp23s17gpio_match(device_t parent, cfdata_t cf, void *aux) { struct spi_attach_args *sa = aux; - int rv; - rv = spi_compatible_match(sa, cf, compat_data); - if (rv != 0) { - /* run at 10MHz */ - if (spi_configure(sa->sa_handle, SPI_MODE_0, 1000)) - return 0; - } - - return rv; + return spi_compatible_match(sa, cf, compat_data); } static void @@ -122,6 +114,7 @@ mcp23s17gpio_attach(device_t parent, dev { struct mcp23s17gpio_softc *sc; struct spi_attach_args *sa; + int error; #if NGPIO > 0 int i; struct gpiobus_attach_args gba; @@ -142,6 +135,14 @@ mcp23s17gpio_attach(device_t parent, dev aprint_naive(": GPIO\n"); aprint_normal(": MCP23S17 GPIO (ha=%d)\n", sc->sc_ha); + /* run at 10MHz */ + error = spi_configure(sa->sa_handle, SPI_MODE_0, 1000); + if (error) { + aprint_error_dev(self, "spi_configure failed (error = %d)\n", + error); + return; + } + DPRINTF(1, ("%s: initialize (HAEN|SEQOP)\n", device_xname(sc->sc_dev))); /* basic setup */ Index: src/sys/dev/spi/mcp3k.c diff -u src/sys/dev/spi/mcp3k.c:1.2.36.1 src/sys/dev/spi/mcp3k.c:1.2.36.2 --- src/sys/dev/spi/mcp3k.c:1.2.36.1 Wed May 19 03:33:05 2021 +++ src/sys/dev/spi/mcp3k.c Wed May 19 03:46:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mcp3k.c,v 1.2.36.1 2021/05/19 03:33:05 thorpej Exp $ */ +/* $NetBSD: mcp3k.c,v 1.2.36.2 2021/05/19 03:46:26 thorpej Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -242,10 +242,6 @@ mcp3kadc_match(device_t parent, cfdata_t if (sa->sa_clist == NULL && mcp3kadc_lookup(sa, cf) == NULL) { return 0; } - - /* configure for 1MHz */ - if (spi_configure(sa->sa_handle, SPI_MODE_0, 100)) - return 0; } return rv; @@ -258,7 +254,7 @@
CVS commit: src/sys
Module Name:src Committed By: yamaguchi Date: Wed May 19 03:44:46 UTC 2021 Modified Files: src/sys/conf: files src/sys/net: if_pppoe.c Log Message: Added a kernel option to change the number of processing packets at one pppoeintr() To generate a diff of this commit: cvs rdiff -u -r1.1283 -r1.1284 src/sys/conf/files cvs rdiff -u -r1.175 -r1.176 src/sys/net/if_pppoe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/conf/files diff -u src/sys/conf/files:1.1283 src/sys/conf/files:1.1284 --- src/sys/conf/files:1.1283 Mon May 17 04:07:43 2021 +++ src/sys/conf/files Wed May 19 03:44:46 2021 @@ -1,4 +1,4 @@ -# $NetBSD: files,v 1.1283 2021/05/17 04:07:43 yamaguchi Exp $ +# $NetBSD: files,v 1.1284 2021/05/19 03:44:46 yamaguchi Exp $ # @(#)files.newconf 7.5 (Berkeley) 5/10/93 version 20171118 @@ -289,6 +289,7 @@ defflag opt_ppp.h PPP_DEFLATE PPP_BSDCO # compression, enable pppd # packet filtering support defflag opt_pppoe.h PPPOE_SERVER PPPOE_DEBUG +defparam opt_pppoe.h PPPOE_DEQUEUE_MAXLEN defparam opt_sppp.h SPPP_KEEPALIVE_INTERVAL SPPP_NORECV_TIME Index: src/sys/net/if_pppoe.c diff -u src/sys/net/if_pppoe.c:1.175 src/sys/net/if_pppoe.c:1.176 --- src/sys/net/if_pppoe.c:1.175 Wed May 19 03:35:27 2021 +++ src/sys/net/if_pppoe.c Wed May 19 03:44:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_pppoe.c,v 1.175 2021/05/19 03:35:27 yamaguchi Exp $ */ +/* $NetBSD: if_pppoe.c,v 1.176 2021/05/19 03:44:46 yamaguchi Exp $ */ /* * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.175 2021/05/19 03:35:27 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.176 2021/05/19 03:44:46 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "pppoe.h" @@ -76,6 +76,10 @@ __KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v #define PPPOE_MPSAFE 1 #endif +#ifndef PPPOE_DEQUEUE_MAXLEN +#define PPPOE_DEQUEUE_MAXLEN IFQ_MAXLEN +#endif + struct pppoehdr { uint8_t vertype; uint8_t code; @@ -598,7 +602,7 @@ pppoeintr(void) SOFTNET_LOCK_UNLESS_NET_MPSAFE(); - for (i = 0; i < IFQ_MAXLEN; i++) { + for (i = 0; i < PPPOE_DEQUEUE_MAXLEN; i++) { IFQ_LOCK(&ppoediscinq); IF_DEQUEUE(&ppoediscinq, m); IFQ_UNLOCK(&ppoediscinq); @@ -607,7 +611,7 @@ pppoeintr(void) pppoe_disc_input(m); } - for (i = 0; i < IFQ_MAXLEN; i++) { + for (i = 0; i < PPPOE_DEQUEUE_MAXLEN; i++) { IFQ_LOCK(&ppoeinq); IF_DEQUEUE(&ppoeinq, m); IFQ_UNLOCK(&ppoeinq); @@ -616,6 +620,11 @@ pppoeintr(void) pppoe_data_input(m); } +#if PPPOE_DEQUEUE_MAXLEN < IFQ_MAXLEN + if (!IF_IS_EMPTY(&ppoediscinq) || !IF_IS_EMPTY(&ppoeinq)) + softint_schedule(pppoe_softintr); +#endif + SOFTNET_UNLOCK_UNLESS_NET_MPSAFE(); }
CVS commit: src/sys/net
Module Name:src Committed By: yamaguchi Date: Wed May 19 03:35:27 UTC 2021 Modified Files: src/sys/net: if_pppoe.c Log Message: Added a limitation of the number of processing packets because a enqueuing process can not add packets over IFQ_MAXLEN and removed reschedule at pppoeintr() because it also scheduled at enqueuing process. To generate a diff of this commit: cvs rdiff -u -r1.174 -r1.175 src/sys/net/if_pppoe.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_pppoe.c diff -u src/sys/net/if_pppoe.c:1.174 src/sys/net/if_pppoe.c:1.175 --- src/sys/net/if_pppoe.c:1.174 Tue May 18 01:46:29 2021 +++ src/sys/net/if_pppoe.c Wed May 19 03:35:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_pppoe.c,v 1.174 2021/05/18 01:46:29 yamaguchi Exp $ */ +/* $NetBSD: if_pppoe.c,v 1.175 2021/05/19 03:35:27 yamaguchi Exp $ */ /* * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.174 2021/05/18 01:46:29 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.175 2021/05/19 03:35:27 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "pppoe.h" @@ -594,36 +594,27 @@ static void pppoeintr(void) { struct mbuf *m; - int disc_done, data_done; + int i; SOFTNET_LOCK_UNLESS_NET_MPSAFE(); - do { - disc_done = 0; - data_done = 0; - for (;;) { - IFQ_LOCK(&ppoediscinq); - IF_DEQUEUE(&ppoediscinq, m); - IFQ_UNLOCK(&ppoediscinq); - if (m == NULL) -break; - disc_done = 1; - pppoe_disc_input(m); - } - - for (;;) { - IFQ_LOCK(&ppoeinq); - IF_DEQUEUE(&ppoeinq, m); - IFQ_UNLOCK(&ppoeinq); - if (m == NULL) -break; - data_done = 1; - pppoe_data_input(m); - } - } while (disc_done || data_done); + for (i = 0; i < IFQ_MAXLEN; i++) { + IFQ_LOCK(&ppoediscinq); + IF_DEQUEUE(&ppoediscinq, m); + IFQ_UNLOCK(&ppoediscinq); + if (m == NULL) + break; + pppoe_disc_input(m); + } - if (!IF_IS_EMPTY(&ppoediscinq) || !IF_IS_EMPTY(&ppoeinq)) - softint_schedule(pppoe_softintr); + for (i = 0; i < IFQ_MAXLEN; i++) { + IFQ_LOCK(&ppoeinq); + IF_DEQUEUE(&ppoeinq, m); + IFQ_UNLOCK(&ppoeinq); + if (m == NULL) + break; + pppoe_data_input(m); + } SOFTNET_UNLOCK_UNLESS_NET_MPSAFE(); }
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/spi
Module Name:src Committed By: thorpej Date: Wed May 19 03:34:11 UTC 2021 Modified Files: src/sys/dev/spi [thorpej-i2c-spi-conf]: tmp121.c Log Message: Use spi_compatible_match(). XXX Should support the other variants of this device. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.5.72.1 src/sys/dev/spi/tmp121.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/spi/tmp121.c diff -u src/sys/dev/spi/tmp121.c:1.5 src/sys/dev/spi/tmp121.c:1.5.72.1 --- src/sys/dev/spi/tmp121.c:1.5 Mon Jun 20 17:31:37 2011 +++ src/sys/dev/spi/tmp121.c Wed May 19 03:34:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tmp121.c,v 1.5 2011/06/20 17:31:37 pgoyette Exp $ */ +/* $NetBSD: tmp121.c,v 1.5.72.1 2021/05/19 03:34:11 thorpej Exp $ */ /*- * Copyright (c) 2006 Urbana-Champaign Independent Media Center. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tmp121.c,v 1.5 2011/06/20 17:31:37 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tmp121.c,v 1.5.72.1 2021/05/19 03:34:11 thorpej Exp $"); #include #include @@ -68,16 +68,39 @@ static void tmp121temp_refresh(struct sy CFATTACH_DECL_NEW(tmp121temp, sizeof(struct tmp121temp_softc), tmp121temp_match, tmp121temp_attach, NULL, NULL); +static const struct device_compatible_entry compat_data[] = { + { .compat = "ti,tmp121" }, + { .compat = "TMP00121" }, + +#if 0 /* We should also add support for these: */ + { .compat = "ti,tmp122" }, + + { .compat = "ti,lm70" }, + { .compat = "LM70" }, + + { .compat = "ti,lm71" }, + { .compat = "LM71" }, + + { .compat = "ti,lm74" }, + { .compat = "LM74" }, +#endif + DEVICE_COMPAT_EOL +}; + static int tmp121temp_match(device_t parent, cfdata_t cf, void *aux) { struct spi_attach_args *sa = aux; + int rv; - /* configure for 10MHz */ - if (spi_configure(sa->sa_handle, SPI_MODE_0, 100)) - return 0; + rv = spi_compatible_match(sa, cf, compat_data); + if (rv != 0) { + /* configure for 10MHz */ + if (spi_configure(sa->sa_handle, SPI_MODE_0, 100)) + return 0; + } - return 1; + return rv; } static void
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/spi
Module Name:src Committed By: thorpej Date: Wed May 19 03:33:33 UTC 2021 Modified Files: src/sys/dev/spi [thorpej-i2c-spi-conf]: mcp48x1.c Log Message: Use spi_compatible_match(). To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.1.54.1 src/sys/dev/spi/mcp48x1.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/spi/mcp48x1.c diff -u src/sys/dev/spi/mcp48x1.c:1.1 src/sys/dev/spi/mcp48x1.c:1.1.54.1 --- src/sys/dev/spi/mcp48x1.c:1.1 Tue Feb 25 20:09:37 2014 +++ src/sys/dev/spi/mcp48x1.c Wed May 19 03:33:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mcp48x1.c,v 1.1 2014/02/25 20:09:37 rkujawa Exp $ */ +/* $NetBSD: mcp48x1.c,v 1.1.54.1 2021/05/19 03:33:33 thorpej Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mcp48x1.c,v 1.1 2014/02/25 20:09:37 rkujawa Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcp48x1.c,v 1.1.54.1 2021/05/19 03:33:33 thorpej Exp $"); /* * Driver for Microchip MCP4801/MCP4811/MCP4821 DAC. @@ -57,7 +57,7 @@ __KERNEL_RCSID(0, "$NetBSD: mcp48x1.c,v #define MCP48X1DAC_DATA __BITS(11,0) /* data */ struct mcp48x1dac_model { - const char *name; + u_int name; uint8_t resolution; uint8_t shift; /* data left shift during write */ }; @@ -66,7 +66,7 @@ struct mcp48x1dac_softc { device_t sc_dev; struct spi_handle *sc_sh; - struct mcp48x1dac_model *sc_dm; /* struct describing DAC model */ + const struct mcp48x1dac_model *sc_dm; uint16_t sc_dac_data; bool sc_dac_gain; @@ -93,55 +93,97 @@ static int sysctl_mcp48x1dac_gain(SYSCTL CFATTACH_DECL_NEW(mcp48x1dac, sizeof(struct mcp48x1dac_softc), mcp48x1dac_match, mcp48x1dac_attach, NULL, NULL); -static struct mcp48x1dac_model mcp48x1_models[] = { - { - .name = "MCP4801", - .resolution = 8, - .shift = 4 - }, - { - .name = "MCP4811", - .resolution = 10, - .shift = 2 - }, - { - .name = "MCP4821", - .resolution = 12, - .shift = 0 - } +static const struct mcp48x1dac_model mcp4801 = { + .name = 4801, + .resolution = 8, + .shift = 4 +}; + +static const struct mcp48x1dac_model mcp4811 = { + .name = 4811, + .resolution = 10, + .shift = 2 +}; + +static const struct mcp48x1dac_model mcp4821 = { + .name = 4821, + .resolution = 12, + .shift = 0 +}; + +static const struct device_compatible_entry compat_data[] = { + { .compat = "microchip,mcp4801", .data = &mcp4801 }, + { .compat = "microchip,mcp4811", .data = &mcp4811 }, + { .compat = "microchip,mcp4821", .data = &mcp4821 }, + DEVICE_COMPAT_EOL }; +static const struct mcp48x1dac_model * +mcp48x1dac_lookup(const struct spi_attach_args *sa, const cfdata_t cf) +{ + const struct device_compatible_entry *dce; + + if (sa->sa_clist != NULL) { + dce = device_compatible_lookup_strlist(sa->sa_clist, + sa->sa_clist_size, compat_data); + if (dce == NULL) { + return NULL; + } + return dce->data; + } else { + const struct mcp48x1dac_model *model; + + for (dce = compat_data; dce->compat != NULL; dce++) { + model = dce->data; + if (model->name == cf->cf_flags) { +return model; + } + } + return NULL; + } +} static int mcp48x1dac_match(device_t parent, cfdata_t cf, void *aux) { struct spi_attach_args *sa = aux; + int rv; - /* MCP48x1 is a write-only device, so no way to detect it! */ - - if (spi_configure(sa->sa_handle, SPI_MODE_0, 2000)) - return 0; + rv = spi_compatible_match(sa, cf, compat_data); + if (rv != 0) { + /* + * If we're doing indorect config, the user must + * have specified the correct model. + */ + if (sa->sa_clist == NULL && mcp48x1dac_lookup(sa, cf) == NULL) { + return 0; + } + + /* configure for 20MHz */ + if (spi_configure(sa->sa_handle, SPI_MODE_0, 2000)) + return 0; + } - return 1; + return rv; } static void mcp48x1dac_attach(device_t parent, device_t self, void *aux) { - struct mcp48x1dac_softc *sc; - struct spi_attach_args *sa; - int cf_flags; - - aprint_naive(": Digital to Analog converter\n"); - aprint_normal(": MCP48x1 DAC\n"); + struct mcp48x1dac_softc *sc = device_private(self); + struct spi_attach_args *sa = aux; + const struct mcp48x1dac_model *model; - sa = aux; - sc = device_private(self); sc->sc_dev = self; sc->sc_sh = sa->sa_handle; - cf_flags = device_cfdata(sc->sc_dev)->cf_flags; - sc->sc_dm = &mcp48x1_models[cf_flags]; /* flag value defines model */ + model = mcp48x1dac_lookup(sa, device_cfdata(self)); + KASSERT(model != NULL); + + sc->sc_dm = model; + + aprint_naive(": Digital to Analog converter\n"); + aprint_normal(": MCP%u DAC\n", model->name); if(!mcp48x1dac_envsys_attach(sc)) { aprint_error_dev(sc->sc_dev, "failed to attach envsys\n");
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/spi
Module Name:src Committed By: thorpej Date: Wed May 19 03:33:05 UTC 2021 Modified Files: src/sys/dev/spi [thorpej-i2c-spi-conf]: mcp3k.c Log Message: Use spi_compatible_match(). XXX More work to do for proper FDT integration. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.36.1 src/sys/dev/spi/mcp3k.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/spi/mcp3k.c diff -u src/sys/dev/spi/mcp3k.c:1.2 src/sys/dev/spi/mcp3k.c:1.2.36.1 --- src/sys/dev/spi/mcp3k.c:1.2 Sun Nov 20 12:38:04 2016 +++ src/sys/dev/spi/mcp3k.c Wed May 19 03:33:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mcp3k.c,v 1.2 2016/11/20 12:38:04 phx Exp $ */ +/* $NetBSD: mcp3k.c,v 1.2.36.1 2021/05/19 03:33:05 thorpej Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -72,14 +72,14 @@ struct mcp3kadc_model { }; struct mcp3kadc_softc { - device_t sc_dev; - struct spi_handle *sc_sh; - int sc_model; - uint32_t sc_adc_max; - int32_t sc_vref_mv; + device_t sc_dev; + struct spi_handle *sc_sh; + const struct mcp3kadc_model *sc_model; + uint32_t sc_adc_max; + int32_tsc_vref_mv; - struct sysmon_envsys *sc_sme; - envsys_data_t sc_sensors[M3K_MAX_SENSORS]; + struct sysmon_envsys *sc_sme; + envsys_data_t sc_sensors[M3K_MAX_SENSORS]; }; static int mcp3kadc_match(device_t, cfdata_t, void *); @@ -91,124 +91,192 @@ static int sysctl_mcp3kadc_vref(SYSCTLFN CFATTACH_DECL_NEW(mcp3kadc, sizeof(struct mcp3kadc_softc), mcp3kadc_match, mcp3kadc_attach, NULL, NULL); -static struct mcp3kadc_model mcp3k_models[] = { - { - .name = 3001, - .bits = 10, - .channels = 1, - .lead = 3, - .flags = 0 - }, - { - .name = 3002, - .bits = 10, - .channels = 2, - .lead = 2, - .flags = M3K_SGLDIFF | M3K_MSBF - }, - { - .name = 3004, - .bits = 10, - .channels = 4, - .lead = 2, - .flags = M3K_SGLDIFF | M3K_D2D1D0 - }, - { - .name = 3008, - .bits = 10, - .channels = 8, - .lead = 2, - .flags = M3K_SGLDIFF | M3K_D2D1D0 - }, - { - .name = 3201, - .bits = 12, - .channels = 1, - .lead = 3, - .flags = 0 - }, - { - .name = 3202, - .bits = 12, - .channels = 2, - .lead = 2, - .flags = M3K_SGLDIFF | M3K_MSBF - }, - { - .name = 3204, - .bits = 12, - .channels = 4, - .lead = 2, - .flags = M3K_SGLDIFF | M3K_D2D1D0 - }, - { - .name = 3208, - .bits = 12, - .channels = 8, - .lead = 2, - .flags = M3K_SGLDIFF | M3K_D2D1D0 - }, - { - .name = 3301, - .bits = 13, - .channels = 1, - .lead = 3, - .flags = M3K_SIGNED - }, - { - .name = 3302, - .bits = 13, - .channels = 4, - .lead = 2, - .flags = M3K_SIGNED | M3K_SGLDIFF | M3K_D2D1D0 - }, - { - .name = 3304, - .bits = 13, - .channels = 8, - .lead = 2, - .flags = M3K_SIGNED | M3K_SGLDIFF | M3K_D2D1D0 - }, +static const struct mcp3kadc_model mcp3001 = { + .name = 3001, + .bits = 10, + .channels = 1, + .lead = 3, + .flags = 0 }; +static const struct mcp3kadc_model mcp3002 = { + .name = 3002, + .bits = 10, + .channels = 2, + .lead = 2, + .flags = M3K_SGLDIFF | M3K_MSBF +}; + +static const struct mcp3kadc_model mcp3004 = { + .name = 3004, + .bits = 10, + .channels = 4, + .lead = 2, + .flags = M3K_SGLDIFF | M3K_D2D1D0 +}; + +static const struct mcp3kadc_model mcp3008 = { + .name = 3008, + .bits = 10, + .channels = 8, + .lead = 2, + .flags = M3K_SGLDIFF | M3K_D2D1D0 +}; + +static const struct mcp3kadc_model mcp3201 = { + .name = 3201, + .bits = 12, + .channels = 1, + .lead = 3, + .flags = 0 +}; + +static const struct mcp3kadc_model mcp3202 = { + .name = 3202, + .bits = 12, + .channels = 2, + .lead = 2, + .flags = M3K_SGLDIFF | M3K_MSBF +}; + +static const struct mcp3kadc_model mcp3204 = { + .name = 3204, + .bits = 12, + .channels = 4, + .lead = 2, + .flags = M3K_SGLDIFF | M3K_D2D1D0 +}; + +static const struct mcp3kadc_model mcp3208 = { + .name = 3208, + .bits = 12, + .channels = 8, + .lead = 2, + .flags = M3K_SGLDIFF | M3K_D2D1D0 +}; + +static const struct mcp3kadc_model mcp3301 = { + .name = 3301, + .bits = 13, + .channels = 1, + .lead = 3, + .flags = M3K_SIGNED +}; + +static const struct mcp3kadc_model mcp3302 = { + .name = 3302, + .bits = 13, + .channels = 4, + .lead = 2, + .flags = M3K_SIGNED | M3K_SGLDIFF | M3K_D2D1D0 +}; + +static const struct mcp3kadc_model mcp3304 = { + .name = 3304, + .bits = 13, + .channels = 8, + .lead = 2, + .flags = M3K_SIGNED | M3K_SGLDIFF | M3K_D2D1D0 +}; + +static const struct device_compatible_entry compat_data[] = { + { .compat = "microchip,mcp3001", .data = &mcp3001 }, + { .compat = "microchip,mcp3002", .data = &mcp3002 }, + { .compat = "microchip,mcp3004", .data = &mcp3004 }, + { .compat = "microchip,mcp3008", .data = &mcp3008 }, + { .compat = "microchip,mcp3201", .data = &mcp3201 }, + { .compat = "microchip,mcp3202", .data = &mcp3202 }, + { .compat = "microchip,mcp3204", .data = &mcp3204 }, + { .compat = "microchip,mcp3208", .data = &mcp3208 }, + { .compat = "microchip,mcp3301", .data
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/spi
Module Name:src Committed By: thorpej Date: Wed May 19 03:32:27 UTC 2021 Modified Files: src/sys/dev/spi [thorpej-i2c-spi-conf]: mcp23s17.c Log Message: Use spi_compatible_match(). XXX More work to do for proper FDT integration. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/dev/spi/mcp23s17.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/spi/mcp23s17.c diff -u src/sys/dev/spi/mcp23s17.c:1.2 src/sys/dev/spi/mcp23s17.c:1.2.2.1 --- src/sys/dev/spi/mcp23s17.c:1.2 Sat Apr 24 23:36:59 2021 +++ src/sys/dev/spi/mcp23s17.c Wed May 19 03:32:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mcp23s17.c,v 1.2 2021/04/24 23:36:59 thorpej Exp $ */ +/* $NetBSD: mcp23s17.c,v 1.2.2.1 2021/05/19 03:32:27 thorpej Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mcp23s17.c,v 1.2 2021/04/24 23:36:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mcp23s17.c,v 1.2.2.1 2021/05/19 03:32:27 thorpej Exp $"); /* * Driver for Microchip MCP23S17 GPIO @@ -87,18 +87,34 @@ static void mcp23s17gpio_gpio_pin_ct CFATTACH_DECL_NEW(mcp23s17gpio, sizeof(struct mcp23s17gpio_softc), mcp23s17gpio_match, mcp23s17gpio_attach, NULL, NULL); +static const struct device_compatible_entry compat_data[] = { + { .compat = "mcp,mcp23s17" }, + { .compat = "microchip,mcp23s17" }, + +#if 0 /* We should also add support for these: */ + { .compat = "mcp,mcp23s08" }, + { .compat = "microchip,mcp23s08" }, + + { .compat = "microchip,mcp23s18" }, +#endif + + DEVICE_COMPAT_EOL +}; + static int mcp23s17gpio_match(device_t parent, cfdata_t cf, void *aux) { struct spi_attach_args *sa = aux; + int rv; - /* MCP23S17 has no way to detect it! */ - - /* run at 10MHz */ - if (spi_configure(sa->sa_handle, SPI_MODE_0, 1000)) - return 0; + rv = spi_compatible_match(sa, cf, compat_data); + if (rv != 0) { + /* run at 10MHz */ + if (spi_configure(sa->sa_handle, SPI_MODE_0, 1000)) + return 0; + } - return 1; + return rv; } static void @@ -116,6 +132,11 @@ mcp23s17gpio_attach(device_t parent, dev sc->sc_dev = self; sc->sc_sh = sa->sa_handle; sc->sc_bank = 0; + + /* + * XXX Initialize sc_ha from microchip,spi-present-mask + * XXX property for FDT. Only consult cf_flags for indirect. + */ sc->sc_ha = device_cfdata(sc->sc_dev)->cf_flags & 0x7; aprint_naive(": GPIO\n"); @@ -124,7 +145,10 @@ mcp23s17gpio_attach(device_t parent, dev DPRINTF(1, ("%s: initialize (HAEN|SEQOP)\n", device_xname(sc->sc_dev))); /* basic setup */ - mcp23s17gpio_write(sc, MCP23x17_IOCONA(sc->sc_bank), MCP23x17_IOCON_HAEN|MCP23x17_IOCON_SEQOP); + mcp23s17gpio_write(sc, MCP23x17_IOCONA(sc->sc_bank), + MCP23x17_IOCON_HAEN|MCP23x17_IOCON_SEQOP); + + /* XXX Hook up to FDT GPIO. */ #if NGPIO > 0 for (i = 0; i < MCP23x17_GPIO_NPINS; i++) {
CVS commit: [thorpej-i2c-spi-conf] src/sys
Module Name:src Committed By: thorpej Date: Wed May 19 03:14:25 UTC 2021 Modified Files: src/sys/arch/arm/broadcom [thorpej-i2c-spi-conf]: bcm2835_bsc_fdt.c src/sys/arch/arm/nvidia [thorpej-i2c-spi-conf]: tegra_i2c.c src/sys/arch/arm/rockchip [thorpej-i2c-spi-conf]: rk_i2c.c src/sys/arch/arm/samsung [thorpej-i2c-spi-conf]: exynos_i2c.c src/sys/arch/arm/sociox [thorpej-i2c-spi-conf]: sni_i2c.c src/sys/arch/arm/sunxi [thorpej-i2c-spi-conf]: sunxi_rsb.c sunxi_twi.c src/sys/arch/arm/ti [thorpej-i2c-spi-conf]: ti_iic.c src/sys/dev/fdt [thorpej-i2c-spi-conf]: dwiic_fdt.c fdt_i2c.c fdtvar.h src/sys/dev/i2c [thorpej-i2c-spi-conf]: motoi2c.c Log Message: fdtbus_attach_i2cbus() is no longer anything other than a wrapper around config_found(); just get rid of it and make its callers look like all of the other I2C controller drivers. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c cvs rdiff -u -r1.26 -r1.26.4.1 src/sys/arch/arm/nvidia/tegra_i2c.c cvs rdiff -u -r1.10 -r1.10.4.1 src/sys/arch/arm/rockchip/rk_i2c.c cvs rdiff -u -r1.22 -r1.22.4.1 src/sys/arch/arm/samsung/exynos_i2c.c cvs rdiff -u -r1.11 -r1.11.2.1 src/sys/arch/arm/sociox/sni_i2c.c cvs rdiff -u -r1.14 -r1.14.4.1 src/sys/arch/arm/sunxi/sunxi_rsb.c cvs rdiff -u -r1.17 -r1.17.4.1 src/sys/arch/arm/sunxi/sunxi_twi.c cvs rdiff -u -r1.13 -r1.13.4.1 src/sys/arch/arm/ti/ti_iic.c cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/dev/fdt/dwiic_fdt.c cvs rdiff -u -r1.10.2.1 -r1.10.2.2 src/sys/dev/fdt/fdt_i2c.c cvs rdiff -u -r1.70.2.1 -r1.70.2.2 src/sys/dev/fdt/fdtvar.h cvs rdiff -u -r1.11.2.1 -r1.11.2.2 src/sys/dev/i2c/motoi2c.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c diff -u src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c:1.6 src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c:1.6.4.1 --- src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c:1.6 Fri Jan 29 14:11:14 2021 +++ src/sys/arch/arm/broadcom/bcm2835_bsc_fdt.c Wed May 19 03:14:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_bsc_fdt.c,v 1.6 2021/01/29 14:11:14 skrll Exp $ */ +/* $NetBSD: bcm2835_bsc_fdt.c,v 1.6.4.1 2021/05/19 03:14:24 thorpej Exp $ */ /* * Copyright (c) 2019 Jason R. Thorpe @@ -28,7 +28,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc_fdt.c,v 1.6 2021/01/29 14:11:14 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm2835_bsc_fdt.c,v 1.6.4.1 2021/05/19 03:14:24 thorpej Exp $"); #include #include @@ -135,5 +135,10 @@ bsciic_fdt_attach(device_t parent, devic fdtbus_register_i2c_controller(&sc->sc_i2c, phandle); - fdtbus_attach_i2cbus(self, phandle, &sc->sc_i2c, iicbus_print); + struct i2cbus_attach_args iba = { + .iba_tag = &sc->sc_i2c, + }; + config_found(self, &iba, iicbus_print, + CFARG_DEVHANDLE, device_handle(self), + CFARG_EOL); } Index: src/sys/arch/arm/nvidia/tegra_i2c.c diff -u src/sys/arch/arm/nvidia/tegra_i2c.c:1.26 src/sys/arch/arm/nvidia/tegra_i2c.c:1.26.4.1 --- src/sys/arch/arm/nvidia/tegra_i2c.c:1.26 Wed Jan 27 03:10:19 2021 +++ src/sys/arch/arm/nvidia/tegra_i2c.c Wed May 19 03:14:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tegra_i2c.c,v 1.26 2021/01/27 03:10:19 thorpej Exp $ */ +/* $NetBSD: tegra_i2c.c,v 1.26.4.1 2021/05/19 03:14:24 thorpej Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tegra_i2c.c,v 1.26 2021/01/27 03:10:19 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tegra_i2c.c,v 1.26.4.1 2021/05/19 03:14:24 thorpej Exp $"); #include #include @@ -180,7 +180,12 @@ tegra_i2c_attach(device_t parent, device fdtbus_register_i2c_controller(&sc->sc_ic, phandle); - fdtbus_attach_i2cbus(self, phandle, &sc->sc_ic, iicbus_print); + struct i2cbus_attach_args iba = { + .iba_tag = &sc->sc_ic, + }; + config_found(self, &iba, iicbus_print, + CFARG_DEVHANDLE, device_handle(self), + CFARG_EOL); } static void Index: src/sys/arch/arm/rockchip/rk_i2c.c diff -u src/sys/arch/arm/rockchip/rk_i2c.c:1.10 src/sys/arch/arm/rockchip/rk_i2c.c:1.10.4.1 --- src/sys/arch/arm/rockchip/rk_i2c.c:1.10 Wed Jan 27 03:10:19 2021 +++ src/sys/arch/arm/rockchip/rk_i2c.c Wed May 19 03:14:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_i2c.c,v 1.10 2021/01/27 03:10:19 thorpej Exp $ */ +/* $NetBSD: rk_i2c.c,v 1.10.4.1 2021/05/19 03:14:24 thorpej Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rk_i2c.c,v 1.10 2021/01/27 03:10:19 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_i2c.c,v 1.10.4.1 2021/05/19 03:14:24 thorpej Exp $"); #include #include @@ -418,7 +418,12 @@ rk_i2c_attach(device_t parent, device_t fdtbus_register_i2c_controller(&sc->sc_ic, phandle); - fdtbus_attach_i2cbus(self, phandle, &sc->sc_ic, iicbus_print); + struct i2cbus_attach_args iba = { + .iba_tag =
CVS commit: [thorpej-i2c-spi-conf] src/sys
Module Name:src Committed By: thorpej Date: Wed May 19 02:58:26 UTC 2021 Modified Files: src/sys/arch/arm/imx [thorpej-i2c-spi-conf]: imxspi.c src/sys/arch/arm/rockchip [thorpej-i2c-spi-conf]: rk_spi.c src/sys/arch/arm/sunxi [thorpej-i2c-spi-conf]: sun4i_spi.c src/sys/dev/fdt [thorpej-i2c-spi-conf]: fdt_spi.c fdtvar.h Log Message: - As with i2c, just register the spi_controller directly. - fdtbus_attach_spibus() is no longer anything other than a wrapper around config_found(); just get rid of it and make its callers look like all of the other SPI controller drivers. To generate a diff of this commit: cvs rdiff -u -r1.8.2.1 -r1.8.2.2 src/sys/arch/arm/imx/imxspi.c cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/arch/arm/rockchip/rk_spi.c cvs rdiff -u -r1.7 -r1.7.4.1 src/sys/arch/arm/sunxi/sun4i_spi.c cvs rdiff -u -r1.2.2.1 -r1.2.2.2 src/sys/dev/fdt/fdt_spi.c cvs rdiff -u -r1.70 -r1.70.2.1 src/sys/dev/fdt/fdtvar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/imx/imxspi.c diff -u src/sys/arch/arm/imx/imxspi.c:1.8.2.1 src/sys/arch/arm/imx/imxspi.c:1.8.2.2 --- src/sys/arch/arm/imx/imxspi.c:1.8.2.1 Tue May 18 23:30:55 2021 +++ src/sys/arch/arm/imx/imxspi.c Wed May 19 02:58:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: imxspi.c,v 1.8.2.1 2021/05/18 23:30:55 thorpej Exp $ */ +/* $NetBSD: imxspi.c,v 1.8.2.2 2021/05/19 02:58:26 thorpej Exp $ */ /*- * Copyright (c) 2014 Genetec Corporation. All rights reserved. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.8.2.1 2021/05/18 23:30:55 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.8.2.2 2021/05/19 02:58:26 thorpej Exp $"); #include "opt_imxspi.h" #include "opt_fdt.h" @@ -86,20 +86,6 @@ int imxspi_debug = IMXSPI_DEBUG; #define DPRINTFN(n,x) #endif -#ifdef FDT -static struct spi_controller * -imxspi_get_controller(device_t dev) -{ - struct imxspi_softc * const sc = device_private(dev); - - return &sc->sc_spi; -} - -static const struct fdtbus_spi_controller_func imxspi_funcs = { - .get_controller = imxspi_get_controller -}; -#endif - int imxspi_attach_common(device_t self) { @@ -140,16 +126,14 @@ imxspi_attach_common(device_t self) #ifdef FDT KASSERT(sc->sc_phandle != 0); - fdtbus_register_spi_controller(self, sc->sc_phandle, &imxspi_funcs); - fdtbus_attach_spibus(self, sc->sc_phandle, spibus_print); -#else + fdtbus_register_spi_controller(&sc->sc_spi, sc->sc_phandle); +#endif struct spibus_attach_args sba = { .sba_controller = &sc->sc_spi, }; - config_found(sc->sc_dev, &sba, spibus_print, + config_found(self, &sba, spibus_print, CFARG_DEVHANDLE, device_handle(self), CFARG_EOL); -#endif return 0; } Index: src/sys/arch/arm/rockchip/rk_spi.c diff -u src/sys/arch/arm/rockchip/rk_spi.c:1.6 src/sys/arch/arm/rockchip/rk_spi.c:1.6.4.1 --- src/sys/arch/arm/rockchip/rk_spi.c:1.6 Wed Jan 27 03:10:19 2021 +++ src/sys/arch/arm/rockchip/rk_spi.c Wed May 19 02:58:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rk_spi.c,v 1.6 2021/01/27 03:10:19 thorpej Exp $ */ +/* $NetBSD: rk_spi.c,v 1.6.4.1 2021/05/19 02:58:26 thorpej Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.6 2021/01/27 03:10:19 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.6.4.1 2021/05/19 02:58:26 thorpej Exp $"); #include #include @@ -170,7 +170,6 @@ struct rk_spi_softc { #define SPIREG_WRITE(sc, reg, val) \ bus_space_write_4((sc)->sc_bst, (sc)->sc_bsh, (reg), (val)) -static struct spi_controller *rk_spi_get_controller(device_t); static int rk_spi_match(device_t, cfdata_t, void *); static void rk_spi_attach(device_t, device_t, void *); @@ -187,18 +186,6 @@ static int rk_spi_intr(void *); CFATTACH_DECL_NEW(rk_spi, sizeof(struct rk_spi_softc), rk_spi_match, rk_spi_attach, NULL, NULL); -static const struct fdtbus_spi_controller_func rk_spi_funcs = { - .get_controller = rk_spi_get_controller -}; - -static struct spi_controller * -rk_spi_get_controller(device_t dev) -{ - struct rk_spi_softc * const sc = device_private(dev); - - return &sc->sc_spi; -} - static int rk_spi_match(device_t parent, cfdata_t cf, void *aux) { @@ -266,8 +253,14 @@ rk_spi_attach(device_t parent, device_t sc->sc_spi.sct_transfer = rk_spi_transfer; sc->sc_spi.sct_nslaves = 2; - fdtbus_register_spi_controller(self, phandle, &rk_spi_funcs); - (void) fdtbus_attach_spibus(self, phandle, spibus_print); + fdtbus_register_spi_controller(&sc->sc_spi, phandle); + + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(self, &sba, spibus_print, + CFARG_DEVHANDLE, device_handle(self), + CFARG_EOL); } static int Index: src/sys/arch/arm/sunxi/sun4i_spi.c diff -u src/sys/arch/arm/sunxi/sun4i_spi.c:1.7 src/sys/arch/arm/sunxi/sun4i_spi.c:1.7.4.1 --- src/sys/arch/a
CVS commit: src/sys/net
Module Name:src Committed By: yamaguchi Date: Wed May 19 02:14:19 UTC 2021 Modified Files: src/sys/net: if_spppsubr.c Log Message: Make functions that use for logging MP-safe There is no change in behavior. To generate a diff of this commit: cvs rdiff -u -r1.245 -r1.246 src/sys/net/if_spppsubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.245 src/sys/net/if_spppsubr.c:1.246 --- src/sys/net/if_spppsubr.c:1.245 Wed May 19 02:07:20 2021 +++ src/sys/net/if_spppsubr.c Wed May 19 02:14:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.245 2021/05/19 02:07:20 yamaguchi Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.246 2021/05/19 02:14:19 yamaguchi Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.245 2021/05/19 02:07:20 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.246 2021/05/19 02:14:19 yamaguchi Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -116,6 +116,14 @@ __KERNEL_RCSID(0, "$NetBSD: if_spppsubr. #define SPPP_ALIVE_INTERVAL DEFAULT_ALIVE_INTERVAL #endif +#define SPPP_CPTYPE_NAMELEN 5 /* buf size of cp type name */ +#define SPPP_AUTHTYPE_NAMELEN 32 /* buf size of auth type name */ +#define SPPP_LCPOPT_NAMELEN 5 /* buf size of lcp option name */ +#define SPPP_IPCPOPT_NAMELEN 5 /* buf size of ipcp option name */ +#define SPPP_IPV6CPOPT_NAMELEN 5 /* buf size of ipv6cp option name */ +#define SPPP_PROTO_NAMELEN 7 /* buf size of protocol name */ +#define SPPP_DOTQUAD_BUFLEN 16 /* length of "aa.bb.cc.dd" */ + /* * Interface flags that can be set in an ifconfig command. * @@ -437,16 +445,16 @@ static void sppp_chap_tlu(struct sppp *) static void sppp_chap_scr(struct sppp *); static void sppp_chap_rcv_challenge_event(struct sppp *, void *); -static const char *sppp_auth_type_name(u_short, u_char); -static const char *sppp_cp_type_name(u_char); -static const char *sppp_dotted_quad(uint32_t); -static const char *sppp_ipcp_opt_name(u_char); +static const char *sppp_auth_type_name(char *, size_t, u_short, u_char); +static const char *sppp_cp_type_name(char *, size_t, u_char); +static const char *sppp_dotted_quad(char *, size_t, uint32_t); +static const char *sppp_ipcp_opt_name(char *, size_t, u_char); #ifdef INET6 -static const char *sppp_ipv6cp_opt_name(u_char); +static const char *sppp_ipv6cp_opt_name(char *, size_t, u_char); #endif -static const char *sppp_lcp_opt_name(u_char); +static const char *sppp_lcp_opt_name(char *, size_t, u_char); static const char *sppp_phase_name(int); -static const char *sppp_proto_name(u_short); +static const char *sppp_proto_name(char *, size_t, u_short); static const char *sppp_state_name(int); static int sppp_params(struct sppp *, u_long, void *); #ifdef INET @@ -1612,10 +1620,15 @@ sppp_cp_send(struct sppp *sp, u_short pr memcpy(lh + 1, data, len); if (debug) { + char pbuf[SPPP_PROTO_NAMELEN]; + char tbuf[SPPP_CPTYPE_NAMELEN]; + const char *pname, *cpname; + + pname = sppp_proto_name(pbuf, sizeof(pbuf), proto); + cpname = sppp_cp_type_name(tbuf, sizeof(tbuf), lh->type); log(LOG_DEBUG, "%s: %s output <%s id=0x%x len=%d", - ifp->if_xname, - sppp_proto_name(proto), - sppp_cp_type_name(lh->type), lh->ident, ntohs(lh->len)); + ifp->if_xname, pname, cpname, + lh->ident, ntohs(lh->len)); if (len) sppp_print_bytes((u_char *)(lh + 1), len); addlog(">\n"); @@ -1756,6 +1769,8 @@ sppp_cp_input(const struct cp *cp, struc int printlen, len = m->m_pkthdr.len; u_char *p; uint32_t u32; + char tbuf[SPPP_CPTYPE_NAMELEN]; + const char *cpname; SPPP_LOCK(sp, RW_WRITER); @@ -1771,11 +1786,12 @@ sppp_cp_input(const struct cp *cp, struc h = mtod(m, struct lcp_header *); if (debug) { printlen = ntohs(h->len); + cpname = sppp_cp_type_name(tbuf, sizeof(tbuf), h->type); log(LOG_DEBUG, "%s: %s input(%s): <%s id=0x%x len=%d", ifp->if_xname, cp->name, sppp_state_name(scp->state), - sppp_cp_type_name(h->type), h->ident, printlen); + cpname, h->ident, printlen); if (len < printlen) printlen = len; if (printlen > 4) @@ -1855,11 +1871,11 @@ sppp_cp_input(const struct cp *cp, struc break; case CODE_REJ: /* XXX catastrophic rejects (RXJ-) aren't handled yet. */ + cpname = sppp_cp_type_name(tbuf, sizeof(tbuf), h->type); log(LOG_INFO, "%s: %s: ignoring RXJ (%s) for code ?, " "danger will robinson\n", - ifp->if_xname, cp->name, - sppp_cp_type_name(h->type)); + ifp->if_xname, cp->name, cpname); sppp_wq_add(sp->wq_cp, &scp->work_rxj); break; case PROTO_REJ: @@ -1881,13 +1897,14 @@ sppp_cp_input(const struct cp *cp, struc if (upper == NULL) catastrophic++; - if (debug) + if (debug) { + cpname = sppp_cp_type_name(tbuf, s
CVS commit: src/sys/net
Module Name:src Committed By: yamaguchi Date: Wed May 19 02:07:21 UTC 2021 Modified Files: src/sys/net: if_spppsubr.c Log Message: Added clear of dns addresses when IPCP is closed To generate a diff of this commit: cvs rdiff -u -r1.244 -r1.245 src/sys/net/if_spppsubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.244 src/sys/net/if_spppsubr.c:1.245 --- src/sys/net/if_spppsubr.c:1.244 Wed May 19 02:02:46 2021 +++ src/sys/net/if_spppsubr.c Wed May 19 02:07:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.244 2021/05/19 02:02:46 yamaguchi Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.245 2021/05/19 02:07:20 yamaguchi Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.244 2021/05/19 02:02:46 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.245 2021/05/19 02:07:20 yamaguchi Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -3662,12 +3662,14 @@ sppp_ipcp_close(struct sppp *sp, void *x sppp_close_event(sp, xcp); #ifdef INET - if (sp->ipcp.flags & (IPCP_MYADDR_DYN|IPCP_HISADDR_DYN)) + if (sp->ipcp.flags & (IPCP_MYADDR_DYN|IPCP_HISADDR_DYN)) { /* * Some address was dynamic, clear it again. */ sppp_clear_ip_addrs(sp); + } #endif + memset(&sp->dns_addrs, 0, sizeof sp->dns_addrs); } /*
CVS commit: src/sys/net
Module Name:src Committed By: yamaguchi Date: Wed May 19 02:02:46 UTC 2021 Modified Files: src/sys/net: if_spppsubr.c Log Message: Added logs on dropping IPCP and IPv6CP packets To generate a diff of this commit: cvs rdiff -u -r1.243 -r1.244 src/sys/net/if_spppsubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.243 src/sys/net/if_spppsubr.c:1.244 --- src/sys/net/if_spppsubr.c:1.243 Wed May 19 01:54:09 2021 +++ src/sys/net/if_spppsubr.c Wed May 19 02:02:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.243 2021/05/19 01:54:09 yamaguchi Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.244 2021/05/19 02:02:46 yamaguchi Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.243 2021/05/19 01:54:09 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.244 2021/05/19 02:02:46 yamaguchi Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -714,13 +714,14 @@ sppp_input(struct ifnet *ifp, struct mbu &prot); SPPP_DOWNGRADE(sp); } - if (debug) - log(LOG_DEBUG, - "%s: invalid input protocol " - "\n", ifp->if_xname, protocol); if_statinc(ifp, if_noproto); goto drop; default: + if (debug) { + log(LOG_DEBUG, + "%s: invalid input protocol " + "\n", ifp->if_xname, protocol); + } goto reject_protocol; case PPP_LCP: SPPP_UNLOCK(sp); @@ -743,8 +744,12 @@ sppp_input(struct ifnet *ifp, struct mbu return; #ifdef INET case PPP_IPCP: - if (!ISSET(sp->pp_ncpflags, SPPP_NCP_IPCP)) + if (!ISSET(sp->pp_ncpflags, SPPP_NCP_IPCP)) { + log(LOG_INFO, "%s: reject IPCP packet " + "because IPCP is disabled\n", + ifp->if_xname); goto reject_protocol; + } SPPP_UNLOCK(sp); if (sp->pp_phase == SPPP_PHASE_NETWORK) { sppp_cp_input(&ipcp, sp, m); @@ -762,8 +767,12 @@ sppp_input(struct ifnet *ifp, struct mbu #endif #ifdef INET6 case PPP_IPV6CP: - if (!ISSET(sp->pp_ncpflags, SPPP_NCP_IPV6CP)) + if (!ISSET(sp->pp_ncpflags, SPPP_NCP_IPV6CP)) { + log(LOG_INFO, "%s: reject IPv6CP packet " + "because IPv6CP is disabled\n", + ifp->if_xname); goto reject_protocol; + } SPPP_UNLOCK(sp); if (sp->pp_phase == SPPP_PHASE_NETWORK) { sppp_cp_input(&ipv6cp, sp, m);
CVS commit: src/sys/net
Module Name:src Committed By: yamaguchi Date: Wed May 19 01:54:09 UTC 2021 Modified Files: src/sys/net: if_spppsubr.c Log Message: remove a wrong ntohs(). The variable is already host-byte-order. To generate a diff of this commit: cvs rdiff -u -r1.242 -r1.243 src/sys/net/if_spppsubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.242 src/sys/net/if_spppsubr.c:1.243 --- src/sys/net/if_spppsubr.c:1.242 Wed May 19 01:42:35 2021 +++ src/sys/net/if_spppsubr.c Wed May 19 01:54:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.242 2021/05/19 01:42:35 yamaguchi Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.243 2021/05/19 01:54:09 yamaguchi Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.242 2021/05/19 01:42:35 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.243 2021/05/19 01:54:09 yamaguchi Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -717,7 +717,7 @@ sppp_input(struct ifnet *ifp, struct mbu if (debug) log(LOG_DEBUG, "%s: invalid input protocol " - "\n", ifp->if_xname, ntohs(protocol)); + "\n", ifp->if_xname, protocol); if_statinc(ifp, if_noproto); goto drop; default:
CVS commit: src/sys/net
Module Name:src Committed By: yamaguchi Date: Wed May 19 01:42:35 UTC 2021 Modified Files: src/sys/net: if_spppsubr.c Log Message: Added a log about rejection of IPCP address option To generate a diff of this commit: cvs rdiff -u -r1.241 -r1.242 src/sys/net/if_spppsubr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/if_spppsubr.c diff -u src/sys/net/if_spppsubr.c:1.241 src/sys/net/if_spppsubr.c:1.242 --- src/sys/net/if_spppsubr.c:1.241 Fri May 14 08:41:25 2021 +++ src/sys/net/if_spppsubr.c Wed May 19 01:42:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_spppsubr.c,v 1.241 2021/05/14 08:41:25 yamaguchi Exp $ */ +/* $NetBSD: if_spppsubr.c,v 1.242 2021/05/19 01:42:35 yamaguchi Exp $ */ /* * Synchronous PPP/Cisco link level subroutines. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.241 2021/05/14 08:41:25 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.242 2021/05/19 01:42:35 yamaguchi Exp $"); #if defined(_KERNEL_OPT) #include "opt_inet.h" @@ -3929,6 +3929,11 @@ sppp_ipcp_confrej(struct sppp *sp, struc * Peer doesn't grok address option. This is * bad. XXX Should we better give up here? */ + if (!debug) { +log(LOG_ERR, "%s: " +"IPCP address option rejected\n", +ifp->if_xname); + } CLR(sp->ipcp.opts, SPPP_IPCP_OPT_ADDRESS); break; #ifdef notyet
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev
Module Name:src Committed By: thorpej Date: Tue May 18 23:48:16 UTC 2021 Modified Files: src/sys/dev/fdt [thorpej-i2c-spi-conf]: fdt_spi.c src/sys/dev/ofw [thorpej-i2c-spi-conf]: ofw_spi_subr.c src/sys/dev/spi [thorpej-i2c-spi-conf]: spi.c spivar.h Log Message: Define a "spi-enumerate-devices" device call and use it for direct configuration of SPI devices, rather than slinging arrays of dictionaries around. Implement this device call for OpenFirmware / FDT, following the SPI bindings for Device Tree. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/dev/fdt/fdt_spi.c cvs rdiff -u -r1.1 -r1.1.6.1 src/sys/dev/ofw/ofw_spi_subr.c cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/dev/spi/spi.c cvs rdiff -u -r1.10 -r1.10.6.1 src/sys/dev/spi/spivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/fdt_spi.c diff -u src/sys/dev/fdt/fdt_spi.c:1.2 src/sys/dev/fdt/fdt_spi.c:1.2.2.1 --- src/sys/dev/fdt/fdt_spi.c:1.2 Sat Apr 24 23:36:53 2021 +++ src/sys/dev/fdt/fdt_spi.c Tue May 18 23:48:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_spi.c,v 1.2 2021/04/24 23:36:53 thorpej Exp $ */ +/* $NetBSD: fdt_spi.c,v 1.2.2.1 2021/05/18 23:48:16 thorpej Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_spi.c,v 1.2 2021/04/24 23:36:53 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_spi.c,v 1.2.2.1 2021/05/18 23:48:16 thorpej Exp $"); #include #include @@ -84,33 +84,17 @@ device_t fdtbus_attach_spibus(device_t dev, int phandle, cfprint_t print) { struct spi_controller *spi; - struct spibus_attach_args sba; - prop_dictionary_t devs; - device_t ret; - u_int address_cells; - - devs = prop_dictionary_create(); - if (of_getprop_uint32(phandle, "#address-cells", &address_cells)) - address_cells = 1; - of_enter_spi_devs(devs, phandle, address_cells * 4); spi = fdtbus_get_spi_controller(phandle); KASSERT(spi != NULL); - memset(&sba, 0, sizeof(sba)); - sba.sba_controller = spi; - sba.sba_child_devices = prop_dictionary_get(devs, "spi-child-devices"); - if (sba.sba_child_devices) - prop_object_retain(sba.sba_child_devices); - prop_object_release(devs); - - ret = config_found(dev, &sba, print, + struct spibus_attach_args sba = { + .sba_controller = spi, + }; + return config_found(dev, &sba, print, CFARG_IATTR, "spibus", + CFARG_DEVHANDLE, device_handle(dev), CFARG_EOL); - if (sba.sba_child_devices) - prop_object_release(sba.sba_child_devices); - - return ret; } Index: src/sys/dev/ofw/ofw_spi_subr.c diff -u src/sys/dev/ofw/ofw_spi_subr.c:1.1 src/sys/dev/ofw/ofw_spi_subr.c:1.1.6.1 --- src/sys/dev/ofw/ofw_spi_subr.c:1.1 Thu Feb 4 20:19:09 2021 +++ src/sys/dev/ofw/ofw_spi_subr.c Tue May 18 23:48:16 2021 @@ -1,100 +1,96 @@ -/* $NetBSD: ofw_spi_subr.c,v 1.1 2021/02/04 20:19:09 thorpej Exp $ */ +/* $NetBSD: ofw_spi_subr.c,v 1.1.6.1 2021/05/18 23:48:16 thorpej Exp $ */ /* - * Copyright 1998 - * Digital Equipment Corporation. All rights reserved. + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. * - * This software is furnished under license and may be used and - * copied only in accordance with the following terms and conditions. - * Subject to these conditions, you may download, copy, install, - * use, modify and distribute this software in source and/or binary - * form. No title or ownership is transferred hereby. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *notice, this list of conditions and the following disclaimer in the + *documentation and/or other materials provided with the distribution. * - * 1) Any source code used, modified or distributed must reproduce - *and retain this copyright notice and list of conditions as - *they appear in the source file. - * - * 2) No right is granted to use any trade name, trademark, or logo of - *Digital Equipment Corporation. Neither the "Digital Equipment - *Corporation" name nor any trademark or logo of Digital Equipment - *Corporation may be used to endorse or promote products derived - *from this software without the prior written permission of - *Digital Equipment Corporation. - * - * 3) This software is provided "AS-IS" and any express or implied - *warranties, including but not limited to, any implied warranties - *of merchantability, fitness for a particular purpose, or - *non-infringement are disclaimed. In no event shall DIGITAL be - *liable for any damages whatsoever, and in particular, DIGITAL - *shall not be
CVS commit: [thorpej-i2c-spi-conf] src/sys
Module Name:src Committed By: thorpej Date: Tue May 18 23:30:56 UTC 2021 Modified Files: src/sys/arch/arm/at91 [thorpej-i2c-spi-conf]: at91spi.c src/sys/arch/arm/broadcom [thorpej-i2c-spi-conf]: bcm2835_spi.c src/sys/arch/arm/imx [thorpej-i2c-spi-conf]: imxspi.c src/sys/arch/arm/sunxi [thorpej-i2c-spi-conf]: sun6i_spi.c src/sys/arch/mips/alchemy/dev [thorpej-i2c-spi-conf]: auspi.c src/sys/arch/mips/atheros/dev [thorpej-i2c-spi-conf]: arspi.c src/sys/dev/marvell [thorpej-i2c-spi-conf]: mvspi.c Log Message: Pass the controller devhandle along to the "spi" instance. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/arm/at91/at91spi.c cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/arch/arm/broadcom/bcm2835_spi.c cvs rdiff -u -r1.8 -r1.8.2.1 src/sys/arch/arm/imx/imxspi.c cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/arm/sunxi/sun6i_spi.c cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/arch/mips/alchemy/dev/auspi.c cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/mips/atheros/dev/arspi.c cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/dev/marvell/mvspi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/at91/at91spi.c diff -u src/sys/arch/arm/at91/at91spi.c:1.6 src/sys/arch/arm/at91/at91spi.c:1.6.2.1 --- src/sys/arch/arm/at91/at91spi.c:1.6 Sat Apr 24 23:36:26 2021 +++ src/sys/arch/arm/at91/at91spi.c Tue May 18 23:30:55 2021 @@ -1,5 +1,5 @@ -/* $Id: at91spi.c,v 1.6 2021/04/24 23:36:26 thorpej Exp $ */ -/* $NetBSD: at91spi.c,v 1.6 2021/04/24 23:36:26 thorpej Exp $ */ +/* $Id: at91spi.c,v 1.6.2.1 2021/05/18 23:30:55 thorpej Exp $ */ +/* $NetBSD: at91spi.c,v 1.6.2.1 2021/05/18 23:30:55 thorpej Exp $ */ /*- * Copyright (c) 2007 Embedtronics Oy. All rights reserved. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: at91spi.c,v 1.6 2021/04/24 23:36:26 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: at91spi.c,v 1.6.2.1 2021/05/18 23:30:55 thorpej Exp $"); #include "locators.h" @@ -105,7 +105,6 @@ at91spi_attach_common(device_t parent, d { struct at91spi_softc *sc = device_private(self); struct at91bus_attach_args *sa = aux; - struct spibus_attach_args sba; bus_dma_segment_t segs; int rsegs, err; @@ -155,9 +154,6 @@ at91spi_attach_common(device_t parent, d aprint_error("%s: no slaves!\n", device_xname(sc->sc_dev)); } - memset(&sba, 0, sizeof(sba)); - sba.sba_controller = &sc->sc_spi; - /* initialize the queue */ SIMPLEQ_INIT(&sc->sc_q); @@ -193,7 +189,12 @@ at91spi_attach_common(device_t parent, d PUTREG(sc, SPI_PDC_BASE + PDC_PTCR, PDC_PTCR_TXTEN | PDC_PTCR_RXTEN); /* attach slave devices */ - config_found(sc->sc_dev, &sba, spibus_print, CFARG_EOL); + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(sc->sc_dev, &sba, spibus_print, + CFARG_DEVHANDLE, device_handle(sc->sc_dev), + CFARG_EOL); } int Index: src/sys/arch/arm/broadcom/bcm2835_spi.c diff -u src/sys/arch/arm/broadcom/bcm2835_spi.c:1.10 src/sys/arch/arm/broadcom/bcm2835_spi.c:1.10.2.1 --- src/sys/arch/arm/broadcom/bcm2835_spi.c:1.10 Sat Apr 24 23:36:26 2021 +++ src/sys/arch/arm/broadcom/bcm2835_spi.c Tue May 18 23:30:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_spi.c,v 1.10 2021/04/24 23:36:26 thorpej Exp $ */ +/* $NetBSD: bcm2835_spi.c,v 1.10.2.1 2021/05/18 23:30:55 thorpej Exp $ */ /* * Copyright (c) 2012 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.10 2021/04/24 23:36:26 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm2835_spi.c,v 1.10.2.1 2021/05/18 23:30:55 thorpej Exp $"); #include #include @@ -95,7 +95,6 @@ bcmspi_attach(device_t parent, device_t { struct bcmspi_softc * const sc = device_private(self); struct fdt_attach_args * const faa = aux; - struct spibus_attach_args sba; aprint_naive("\n"); aprint_normal(": SPI\n"); @@ -138,10 +137,12 @@ bcmspi_attach(device_t parent, device_t sc->sc_spi.sct_transfer = bcmspi_transfer; sc->sc_spi.sct_nslaves = 3; - memset(&sba, 0, sizeof(sba)); - sba.sba_controller = &sc->sc_spi; - - config_found(self, &sba, spibus_print, CFARG_EOL); + struct spibus_attach_args sba = { + .sba_controller = &sc->sc_spi, + }; + config_found(self, &sba, spibus_print, + CFARG_DEVHANDLE, device_handle(self), + CFARG_EOL); } static int Index: src/sys/arch/arm/imx/imxspi.c diff -u src/sys/arch/arm/imx/imxspi.c:1.8 src/sys/arch/arm/imx/imxspi.c:1.8.2.1 --- src/sys/arch/arm/imx/imxspi.c:1.8 Sat Apr 24 23:36:27 2021 +++ src/sys/arch/arm/imx/imxspi.c Tue May 18 23:30:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: imxspi.c,v 1.8 2021/04/24 23:36:27 thorpej Exp $ */ +/* $NetBSD: imxspi.c,v 1.8.2.1 2021/05/18 23:30:55 thorpej Exp $ */ /*- * Copyright (c) 2014 Genetec Corporation. All rights reserved. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: imxspi.c,v 1.8 2
CVS commit: [thorpej-i2c-spi-conf] src/sys/dev/i2c
Module Name:src Committed By: thorpej Date: Tue May 18 23:26:46 UTC 2021 Modified Files: src/sys/dev/i2c [thorpej-i2c-spi-conf]: i2c.c Log Message: Correct a comment. To generate a diff of this commit: cvs rdiff -u -r1.78.2.6 -r1.78.2.7 src/sys/dev/i2c/i2c.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/i2c/i2c.c diff -u src/sys/dev/i2c/i2c.c:1.78.2.6 src/sys/dev/i2c/i2c.c:1.78.2.7 --- src/sys/dev/i2c/i2c.c:1.78.2.6 Mon May 17 00:05:56 2021 +++ src/sys/dev/i2c/i2c.c Tue May 18 23:26:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.c,v 1.78.2.6 2021/05/17 00:05:56 thorpej Exp $ */ +/* $NetBSD: i2c.c,v 1.78.2.7 2021/05/18 23:26:46 thorpej Exp $ */ /*- * Copyright (c) 2021 The NetBSD Foundation, Inc. @@ -69,7 +69,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.78.2.6 2021/05/17 00:05:56 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.78.2.7 2021/05/18 23:26:46 thorpej Exp $"); #include #include @@ -678,9 +678,8 @@ iic_attach(device_t parent, device_t sel aprint_error_dev(self, "couldn't establish power handler\n"); /* - * Attempt to enumerate the devices on the bus. If - * there is no enumeration method, or no devices are - * found, then we will attempt indirect configuration. + * Attempt to enumerate the devices on the bus. If there is no + * enumeration method, then we will attempt indirect configuration. */ struct i2c_enumerate_devices_args enumargs; struct i2c_attach_args ia;
CVS commit: src/bin/sh/bltin
Module Name:src Committed By: kre Date: Tue May 18 21:39:06 UTC 2021 Modified Files: src/bin/sh/bltin: bltin.h echo.c Log Message: Fix a bug in the built-in echo in /bin/sh reported in private mail by Oguz If echo detects an I/O error, it does exit(1) (that's fine) but then the next echo also does exit(1) even without any errors of its own, and every following echo writing to stdout does the same thing. eg: echo foo >&- ; echo $?; echo $?; ( echo $( echo $?; echo $?) ; echo $? ) 1 1 1 1 1 The first echo writes nothing (stdout is closed) but does exit(1). The second echo writes "1" (correct, the exit status of the previous echo) and should exit(0) - but doesn't. This pattern continues... While here, conform to the POSIX requirement on echo (and many other standard utilities, but definitely not all) that when the utility does exit(>0) a message must be written to stderr (and vice versa in many cases). Our echo (as shown above) did the exit(1) part when it detected the I/O error, but no message is sent to stderr. Fix that while we're here. Similar changes are required for /bin/echo (coming soon), and /usr/bin/printf (which is also the sh builtin printf) - except currently that one kind of conforms, as it ignores errors writing to stdout (as do large numbers of other utilities). For many programs that's kind of acceptable, but where the sole purpose of the program is to write to stdout, it really isn't. Also to be fixed soon. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/bin/sh/bltin/bltin.h cvs rdiff -u -r1.14 -r1.15 src/bin/sh/bltin/echo.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/sh/bltin/bltin.h diff -u src/bin/sh/bltin/bltin.h:1.15 src/bin/sh/bltin/bltin.h:1.16 --- src/bin/sh/bltin/bltin.h:1.15 Mon Jun 26 22:09:16 2017 +++ src/bin/sh/bltin/bltin.h Tue May 18 21:39:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bltin.h,v 1.15 2017/06/26 22:09:16 kre Exp $ */ +/* $NetBSD: bltin.h,v 1.16 2021/05/18 21:39:06 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -58,6 +58,7 @@ #undef putchar #undef fileno #undef ferror +#undef clearerr #define FILE struct output #define stdout out1 #define stderr out2 @@ -74,6 +75,7 @@ #define fflush(f) _RETURN_INT(flushout(f)) #define fileno(f) ((f)->fd) #define ferror(f) ((f)->flags & OUTPUT_ERR) +#define clearerr(f) ((f)->flags &= ~OUTPUT_ERR) #define INITARGS(argv) #define err sh_err #define verr sh_verr Index: src/bin/sh/bltin/echo.c diff -u src/bin/sh/bltin/echo.c:1.14 src/bin/sh/bltin/echo.c:1.15 --- src/bin/sh/bltin/echo.c:1.14 Sun Oct 12 01:40:37 2008 +++ src/bin/sh/bltin/echo.c Tue May 18 21:39:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: echo.c,v 1.14 2008/10/12 01:40:37 dholland Exp $ */ +/* $NetBSD: echo.c,v 1.15 2021/05/18 21:39:06 kre Exp $ */ /*- * Copyright (c) 1991, 1993 @@ -52,7 +52,7 @@ */ #include -__RCSID("$NetBSD: echo.c,v 1.14 2008/10/12 01:40:37 dholland Exp $"); +__RCSID("$NetBSD: echo.c,v 1.15 2021/05/18 21:39:06 kre Exp $"); #define main echocmd @@ -68,6 +68,8 @@ main(int argc, char **argv) int nflag = 0; int eflag = 0; + clearerr(stdout); + ap = argv; if (argc) ap++; @@ -116,7 +118,9 @@ main(int argc, char **argv) if (! nflag) putchar('\n'); fflush(stdout); - if (ferror(stdout)) - return 1; + if (ferror(stdout)) { + clearerr(stdout); + err(1, "write error"); + } return 0; }
CVS commit: src/tests/bin/sh
Module Name:src Committed By: kre Date: Tue May 18 21:37:56 UTC 2021 Modified Files: src/tests/bin/sh: t_builtins.sh Log Message: Add two new sub-tests to the echo test case of the t_builtins shell ATF test. The first verifies that echo exits >0 when it encounters an I/O error on its output (this part would have succeeded for a long time). It also verifies the POSIX requirement that when most standard utilities (or perhaps many rather than most) exit(>0) they must write a message to stderr. Our sh's built in echo did not do that (nor does /bin/echo but that's not relevant here). The second demonstrates (on an unfixed built-in echo) a bug reported in private e-mail by Oguz where once an instance of the built-in echo has detected an I/O error, all later invocations of the built-in echo, with no I/O errors of their own, also exit(1) (the error status on stdout is not cleared, each echo sees the "I/O error occurred" and does exit(1)). In this second sub-test, the "2>&-" on the first echo command is simply an artifact caused by the test harness - the "check" function verifies that exit((>0) requires a message on stderr (and vice versa), but that only applies to most (or many) utilities, echo is one, but sh is not. In the second test, the exit status comes from sh - sh is permitted to write to stderr (via the echo command it runs in this case) and still exit(0). But the check function in the test does not understand that subtlety. So, we simply suppress the stderr message by closing stderr (the first of these two new sub-tests has verified that the message exists).. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/tests/bin/sh/t_builtins.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/bin/sh/t_builtins.sh diff -u src/tests/bin/sh/t_builtins.sh:1.5 src/tests/bin/sh/t_builtins.sh:1.6 --- src/tests/bin/sh/t_builtins.sh:1.5 Wed Jan 9 10:51:23 2019 +++ src/tests/bin/sh/t_builtins.sh Tue May 18 21:37:56 2021 @@ -1,4 +1,4 @@ -# $NetBSD: t_builtins.sh,v 1.5 2019/01/09 10:51:23 kre Exp $ +# $NetBSD: t_builtins.sh,v 1.6 2021/05/18 21:37:56 kre Exp $ # # Copyright (c) 2018 The NetBSD Foundation, Inc. # All rights reserved. @@ -291,6 +291,9 @@ echo_body() { done done + check 'echo foo >&-' "" 1 + check 'echo foo >&- 2>&-; echo $?; echo $?' "1${nl}0${nl}" 0 + results }
CVS commit: src/external/gpl3
Module Name:src Committed By: christos Date: Tue May 18 21:34:04 UTC 2021 Modified Files: src/external/gpl3/gcc.old/dist/libcpp: macro.c src/external/gpl3/gcc/dist/libcpp: macro.c Log Message: restore -iremap functionality which was omitted by a merge botch, and then remove as unused later. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gcc.old/dist/libcpp/macro.c cvs rdiff -u -r1.13 -r1.14 src/external/gpl3/gcc/dist/libcpp/macro.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl3/gcc.old/dist/libcpp/macro.c diff -u src/external/gpl3/gcc.old/dist/libcpp/macro.c:1.10 src/external/gpl3/gcc.old/dist/libcpp/macro.c:1.11 --- src/external/gpl3/gcc.old/dist/libcpp/macro.c:1.10 Fri Apr 9 19:14:40 2021 +++ src/external/gpl3/gcc.old/dist/libcpp/macro.c Tue May 18 17:34:03 2021 @@ -406,6 +406,33 @@ add_cpp_remap_path (const char *arg) ++remap_pairs; } +static const char * +cpp_remap_file (const char *arg, char **tmp_name) +{ + char *result; + size_t i, len; + + for (i = 0; i < remap_pairs; ++i) { + len = strlen (remap_src[i]); + if (strncmp (remap_src[i], arg, len)) + continue; + if (arg[len] == '\0') + return remap_dst[i]; + if (arg[len] != '/') + continue; + arg += len; + len = strlen (remap_dst[i]); + result = (char *) xmalloc (len + strlen (arg) + 1); + memcpy(result, remap_dst[i], len); + strcpy(result + len, arg); + *tmp_name = result; + + return result; + } + + return arg; +} + /* Helper function for builtin_macro. Returns the text generated by a builtin macro. */ const uchar * @@ -469,6 +496,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi { unsigned int len; const char *name; + char *tmp_name; uchar *buf; if (node->value.builtin == BT_FILE) @@ -482,11 +510,14 @@ _cpp_builtin_macro_text (cpp_reader *pfi } if (pfile->cb.remap_filename) name = pfile->cb.remap_filename (name); + tmp_name = NULL; + name = cpp_remap_file (name, &tmp_name); len = strlen (name); buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); result = buf; *buf = '"'; buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len); + free (tmp_name); *buf++ = '"'; *buf = '\0'; } Index: src/external/gpl3/gcc/dist/libcpp/macro.c diff -u src/external/gpl3/gcc/dist/libcpp/macro.c:1.13 src/external/gpl3/gcc/dist/libcpp/macro.c:1.14 --- src/external/gpl3/gcc/dist/libcpp/macro.c:1.13 Sat Apr 10 20:02:18 2021 +++ src/external/gpl3/gcc/dist/libcpp/macro.c Tue May 18 17:34:03 2021 @@ -502,6 +502,33 @@ add_cpp_remap_path (const char *arg) ++remap_pairs; } +static const char * +cpp_remap_file (const char *arg, char **tmp_name) +{ + char *result; + size_t i, len; + + for (i = 0; i < remap_pairs; ++i) { + len = strlen (remap_src[i]); + if (strncmp (remap_src[i], arg, len)) + continue; + if (arg[len] == '\0') + return remap_dst[i]; + if (arg[len] != '/') + continue; + arg += len; + len = strlen (remap_dst[i]); + result = (char *) xmalloc (len + strlen (arg) + 1); + memcpy(result, remap_dst[i], len); + strcpy(result + len, arg); + *tmp_name = result; + + return result; + } + + return arg; +} + /* Helper function for builtin_macro. Returns the text generated by a builtin macro. */ const uchar * @@ -565,6 +592,7 @@ _cpp_builtin_macro_text (cpp_reader *pfi { unsigned int len; const char *name; + char *tmp_name; uchar *buf; if (node->value.builtin == BT_FILE) @@ -578,11 +606,14 @@ _cpp_builtin_macro_text (cpp_reader *pfi } if (pfile->cb.remap_filename) name = pfile->cb.remap_filename (name); + tmp_name = NULL; + name = cpp_remap_file (name, &tmp_name); len = strlen (name); buf = _cpp_unaligned_alloc (pfile, len * 2 + 3); result = buf; *buf = '"'; buf = cpp_quote_string (buf + 1, (const unsigned char *) name, len); + free (tmp_name); *buf++ = '"'; *buf = '\0'; }
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: dholland Date: Tue May 18 20:34:20 UTC 2021 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: Remove some unused variables, found by gcc -Wall. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.19 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.20 --- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.19 Tue May 18 20:32:18 2021 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Tue May 18 20:34:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: elf2bb.c,v 1.19 2021/05/18 20:32:18 dholland Exp $ */ +/* $NetBSD: elf2bb.c,v 1.20 2021/05/18 20:34:20 dholland Exp $ */ /*- * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -92,7 +92,6 @@ int main(int argc, char *argv[]) { int ifd, ofd; - u_int mid, flags, magic; void *image; Elf32_Ehdr *eh; Elf32_Shdr *sh; @@ -104,7 +103,7 @@ main(int argc, char *argv[]) int i, l, delta; u_int8_t *rpo; u_int32_t oldaddr, addrdiff; - u_int32_t tsz, dsz, bsz, trsz, drsz, entry, relver; + u_int32_t tsz, dsz, bsz, trsz, relver; u_int32_t pcrelsz, r32sz; int sumsize = 16; int c;
CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb
Module Name:src Committed By: dholland Date: Tue May 18 20:32:18 UTC 2021 Modified Files: src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c Log Message: Print ptrdiff_t with %td, not %d. Appeared in passing in PR 56188. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.18 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.19 --- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.18 Thu Feb 25 03:40:27 2021 +++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c Tue May 18 20:32:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: elf2bb.c,v 1.18 2021/02/25 03:40:27 rin Exp $ */ +/* $NetBSD: elf2bb.c,v 1.19 2021/05/18 20:32:18 dholland Exp $ */ /*- * Copyright (c) 1996,2006 The NetBSD Foundation, Inc. @@ -421,7 +421,7 @@ retry: *rpo = 0; rpo += delta; *rpo = 0; rpo += delta; - printf("using %d bytes, %d bytes remaining.\n", delta > 0 ? + printf("using %td bytes, %td bytes remaining.\n", delta > 0 ? rpo-buffer-tsz-dsz : buffer+bbsize-rpo, delta > 0 ? buffer + bbsize - rpo : rpo - buffer - tsz - dsz); /*
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Tue May 18 17:05:45 UTC 2021 Modified Files: src/usr.bin/make/unit-tests: Makefile opt-chdir.mk Log Message: Do not trust that /nonexistent does not exist Use /nonexistent.${.MAKE.PID} to avoid failure when /nonexistent actually exists. To generate a diff of this commit: cvs rdiff -u -r1.277 -r1.278 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/opt-chdir.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.277 src/usr.bin/make/unit-tests/Makefile:1.278 --- src/usr.bin/make/unit-tests/Makefile:1.277 Tue Apr 27 16:20:06 2021 +++ src/usr.bin/make/unit-tests/Makefile Tue May 18 17:05:45 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.277 2021/04/27 16:20:06 rillig Exp $ +# $NetBSD: Makefile,v 1.278 2021/05/18 17:05:45 sjg Exp $ # # Unit tests for make(1) # @@ -487,6 +487,7 @@ SED_CMDS.job-output-long-lines= \ ${:D marker should always be at the beginning of the line. } \ -e '/^aa*--- job-b ---$$/d' \ -e '/^bb*--- job-a ---$$/d' +SED_CMDS.opt-chdir= -e 's,\(nonexistent\).[1-9][0-9]*,\1,' SED_CMDS.opt-debug-graph1= ${STD_SED_CMDS.dg1} SED_CMDS.opt-debug-graph2= ${STD_SED_CMDS.dg2} SED_CMDS.opt-debug-graph3= ${STD_SED_CMDS.dg3} Index: src/usr.bin/make/unit-tests/opt-chdir.mk diff -u src/usr.bin/make/unit-tests/opt-chdir.mk:1.5 src/usr.bin/make/unit-tests/opt-chdir.mk:1.6 --- src/usr.bin/make/unit-tests/opt-chdir.mk:1.5 Sun Nov 15 05:43:56 2020 +++ src/usr.bin/make/unit-tests/opt-chdir.mk Tue May 18 17:05:45 2021 @@ -1,4 +1,4 @@ -# $NetBSD: opt-chdir.mk,v 1.5 2020/11/15 05:43:56 sjg Exp $ +# $NetBSD: opt-chdir.mk,v 1.6 2021/05/18 17:05:45 sjg Exp $ # # Tests for the -C command line option, which changes the directory at the # beginning. @@ -23,5 +23,7 @@ chdir-root: .PHONY .IGNORE @MAKE_OBJDIR_CHECK_WRITABLE=no ${MAKE} -C / -V 'cwd: $${.CURDIR}' # Trying to change to a nonexistent directory exits immediately. +# Note: just because the whole point of /nonexistent is that it should +# not exist - doesn't mean it doesn't. chdir-nonexistent: .PHONY .IGNORE - @${MAKE} -C /nonexistent + @${MAKE} -C /nonexistent.${.MAKE.PID}
CVS commit: src/sys/arch/hp300/dev
Module Name:src Committed By: tsutsui Date: Tue May 18 15:21:41 UTC 2021 Modified Files: src/sys/arch/hp300/dev: rdreg.h Log Message: Consistently use #define here. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/arch/hp300/dev/rdreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/hp300/dev/rdreg.h diff -u src/sys/arch/hp300/dev/rdreg.h:1.13 src/sys/arch/hp300/dev/rdreg.h:1.14 --- src/sys/arch/hp300/dev/rdreg.h:1.13 Tue Feb 8 20:20:13 2011 +++ src/sys/arch/hp300/dev/rdreg.h Tue May 18 15:21:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rdreg.h,v 1.13 2011/02/08 20:20:13 rmind Exp $ */ +/* $NetBSD: rdreg.h,v 1.14 2021/05/18 15:21:41 tsutsui Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -78,9 +78,9 @@ struct rd_stat { } cu_tva; } c_pf; } __attribute__((__packed__)); -#define c_raw c_pf.cu_raw -#define c_blk c_pf.cu_sva.cu_lsl /* for now */ -#define c_tva c_pf.cu_tva +#define c_raw c_pf.cu_raw +#define c_blk c_pf.cu_sva.cu_lsl /* for now */ +#define c_tva c_pf.cu_tva struct rd_ssmcmd { char c_unit; @@ -132,18 +132,18 @@ struct rd_describe { #define RD9134DID 0x221 /* also 9122S */ #define RD9134LID 0x222 /* also 9122D */ #define RD7912PID 0x209 -#define RD7914CTID 0x20A +#define RD7914CTID 0x20A #define RD7914PID 0x20B #define RD7958AID 0x22B -#define RD7957AID 0x22A +#define RD7957AID 0x22A #define RD7933HID 0x212 #define RD7936HID 0x213 /* just guessing -- as of yet unknown */ #define RD7937HID 0x214 -#define RD7957BID 0x22C /* another guess based on 7958B */ -#define RD7958BID 0x22D -#define RD7959BID 0x22E /* another guess based on 7958B */ -#define RD2200AID 0x22F -#define RD2203AID 0x230 /* yet another guess */ +#define RD7957BID 0x22C /* another guess based on 7958B */ +#define RD7958BID 0x22D +#define RD7959BID 0x22E /* another guess based on 7958B */ +#define RD2200AID 0x22F +#define RD2203AID 0x230 /* yet another guess */ /* SW ids -- indicies into rdidentinfo, order is arbitrary */ #define RD7945A 0 @@ -152,17 +152,17 @@ struct rd_describe { #define RD7912P 3 #define RD7914P 4 #define RD7958A 5 -#define RD7957A 6 +#define RD7957A 6 #define RD7933H 7 #define RD9134L 8 #define RD7936H 9 #define RD7937H 10 -#define RD7914CT 11 -#define RD7946A 12 -#define RD9122D 13 -#define RD7957B 14 -#define RD7958B 15 -#define RD7959B 16 +#define RD7914CT 11 +#define RD7946A 12 +#define RD9122D 13 +#define RD7957B 14 +#define RD7958B 15 +#define RD7959B 16 #define NRD7945ABPT 16 #define NRD7945ATRK 7 @@ -226,31 +226,31 @@ struct rd_describe { #define RDCTLR 15 /* convert 512 byte count into DEV_BSIZE count */ -#define RDSZ(x) ((x) >> (DEV_BSHIFT-9)) +#define RDSZ(x) ((x) >> (DEV_BSHIFT-9)) /* convert block number into sector number and back */ #define RDBTOS(x) ((x) << (DEV_BSHIFT-8)) -#define RDSTOB(x) ((x) >> (DEV_BSHIFT-8)) +#define RDSTOB(x) ((x) >> (DEV_BSHIFT-8)) /* extract cyl/head/sect info from three-vector address */ -#define RDCYL(tva) ((u_long)(tva).cu_cyhd >> 8) -#define RDHEAD(tva) ((tva).cu_cyhd & 0xFF) -#define RDSECT(tva) ((tva).cu_sect) +#define RDCYL(tva) ((u_long)(tva).cu_cyhd >> 8) +#define RDHEAD(tva) ((tva).cu_cyhd & 0xFF) +#define RDSECT(tva) ((tva).cu_sect) #define REF_MASK 0x0 #define FEF_MASK 0x0 #define AEF_MASK 0x0 #define IEF_MASK 0xF970 -#define FEF_CU 0x4000 /* cross-unit */ -#define FEF_DR 0x0080 /* diagnostic result */ -#define FEF_IMR 0x0008 /* internal maintenance release */ +#define FEF_CU 0x4000 /* cross-unit */ +#define FEF_DR 0x0080 /* diagnostic result */ +#define FEF_IMR 0x0008 /* internal maintenance release */ #define FEF_PF 0x0002 /* power fail */ #define FEF_REXMT 0x0001 /* retransmit */ -#define AEF_UD 0x0040 /* unrecoverable data */ -#define IEF_RRMASK 0xe000 /* request release bits */ -#define IEF_MD 0x0020 /* marginal data */ -#define IEF_RD 0x0010 /* recoverable data */ +#define AEF_UD 0x0040 /* unrecoverable data */ +#define IEF_RRMASK 0xe000 /* request release bits */ +#define IEF_MD 0x0020 /* marginal data */ +#define IEF_RD 0x0010 /* recoverable data */ #define C_READ 0x00 #define C_RAM 0x00 /* single vector (i.e. sector number) */ @@ -260,13 +260,13 @@ struct rd_describe { #define C_SADDR 0x10 #define C_SLEN 0x18 #define C_SUNIT(x) (0x20 | (x)) -#define C_SVOL(x) (0x40 | (x)) +#define C_SVOL(x) (0x40 | (x)) #define C_NOP 0x34 -#define C_DESC 0x35 +#define C_DESC 0x35 #define C_SREL 0x3b #define C_SSM 0x3e #define C_SRAM 0x48 -#define C_REL 0xc0 +#define C_REL 0xc0 #define C_CMD 0x05 #define C_EXEC 0x0e
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Tue May 18 11:13:31 UTC 2021 Modified Files: src/sys/dev/fdt: dwc3_fdt.c Log Message: Unbreak previous; we have to look for a child node iff our node isn't compatible with snps,dwc3. To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/fdt/dwc3_fdt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/dwc3_fdt.c diff -u src/sys/dev/fdt/dwc3_fdt.c:1.14 src/sys/dev/fdt/dwc3_fdt.c:1.15 --- src/sys/dev/fdt/dwc3_fdt.c:1.14 Sat Apr 24 23:36:53 2021 +++ src/sys/dev/fdt/dwc3_fdt.c Tue May 18 11:13:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dwc3_fdt.c,v 1.14 2021/04/24 23:36:53 thorpej Exp $ */ +/* $NetBSD: dwc3_fdt.c,v 1.15 2021/05/18 11:13:31 jmcneill Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.14 2021/04/24 23:36:53 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dwc3_fdt.c,v 1.15 2021/05/18 11:13:31 jmcneill Exp $"); #include #include @@ -203,14 +203,18 @@ dwc3_fdt_set_mode(struct xhci_softc *sc, } static const struct device_compatible_entry compat_data[] = { - /* 1 = parent of dwc3 subnode */ - { .compat = "allwinner,sun50i-h6-dwc3", .value = 1 }, - { .compat = "amlogic,meson-gxl-dwc3", .value = 1 }, - { .compat = "fsl,imx8mq-dwc3", .value = 1 }, - { .compat = "rockchip,rk3328-dwc3", .value = 1 }, - { .compat = "rockchip,rk3399-dwc3", .value = 1 }, - { .compat = "samsung,exynos5250-dwusb3", .value = 1 }, - { .compat = "snps,dwc3", .value = 0 }, + { .compat = "allwinner,sun50i-h6-dwc3" }, + { .compat = "amlogic,meson-gxl-dwc3" }, + { .compat = "fsl,imx8mq-dwc3" }, + { .compat = "rockchip,rk3328-dwc3" }, + { .compat = "rockchip,rk3399-dwc3" }, + { .compat = "samsung,exynos5250-dwusb3" }, + { .compat = "snps,dwc3" }, + DEVICE_COMPAT_EOL +}; + +static const struct device_compatible_entry compat_data_dwc3[] = { + { .compat = "snps,dwc3" }, DEVICE_COMPAT_EOL }; @@ -228,7 +232,6 @@ dwc3_fdt_attach(device_t parent, device_ struct xhci_softc * const sc = device_private(self); struct fdt_attach_args * const faa = aux; const int phandle = faa->faa_phandle; - const struct device_compatible_entry *dce; struct fdtbus_reset *rst; struct fdtbus_phy *phy; struct clk *clk; @@ -239,11 +242,8 @@ dwc3_fdt_attach(device_t parent, device_ void *ih; u_int n; - dce = of_compatible_lookup(phandle, compat_data); - KASSERT(dce != NULL); - /* Find dwc3 sub-node */ - if (dce->value != 0) { + if (of_compatible_lookup(phandle, compat_data_dwc3) == NULL) { dwc3_phandle = of_find_firstchild_byname(phandle, "dwc3"); } else { dwc3_phandle = phandle;
CVS commit: src/sys/net/lagg
Module Name:src Committed By: hannken Date: Tue May 18 11:02:58 UTC 2021 Modified Files: src/sys/net/lagg: if_lagg_lacp.c Log Message: Make this compile without DIAGNOSTIC. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/net/lagg/if_lagg_lacp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/lagg/if_lagg_lacp.c diff -u src/sys/net/lagg/if_lagg_lacp.c:1.1 src/sys/net/lagg/if_lagg_lacp.c:1.2 --- src/sys/net/lagg/if_lagg_lacp.c:1.1 Mon May 17 04:07:43 2021 +++ src/sys/net/lagg/if_lagg_lacp.c Tue May 18 11:02:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_lagg_lacp.c,v 1.1 2021/05/17 04:07:43 yamaguchi Exp $ */ +/* $NetBSD: if_lagg_lacp.c,v 1.2 2021/05/18 11:02:58 hannken Exp $ */ /*- * SPDX-License-Identifier: BSD-2-Clause-NetBSD @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.1 2021/05/17 04:07:43 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_lagg_lacp.c,v 1.2 2021/05/18 11:02:58 hannken Exp $"); #ifdef _KERNEL_OPT #include "opt_lagg.h" @@ -504,7 +504,7 @@ void lacp_detach(struct lagg_proto_softc *xlsc) { struct lacp_softc *lsc = (struct lacp_softc *)xlsc; - struct lagg_softc *sc = lsc->lsc_softc; + struct lagg_softc *sc __diagused = lsc->lsc_softc; KASSERT(LAGG_LOCKED(lsc->lsc_softc)); KASSERT(TAILQ_EMPTY(&lsc->lsc_aggregators)); @@ -2149,7 +2149,7 @@ lacp_set_mux(struct lacp_softc *lsc, str static void lacp_sm_mux(struct lacp_softc *lsc, struct lacp_port *lacpp) { - struct lacp_aggregator *la; + struct lacp_aggregator *la __diagused; enum lacp_mux_state next_state; enum lacp_selected selected; bool p_sync, p_collecting;
CVS commit: src/sys/kern
Module Name:src Committed By: hannken Date: Tue May 18 08:59:44 UTC 2021 Modified Files: src/sys/kern: exec_elf.c Log Message: Remove a superfluous VOP_GETATTR() from elf_load_interp() and replace the LK_EXCLUSIVE lock with a LK_SHARED lock. The attributes requested were not used since Rev 1.25 of exec_elf32.c from 1997/05/08 when mycroft GCd the va_mode check. To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/kern/exec_elf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/exec_elf.c diff -u src/sys/kern/exec_elf.c:1.101 src/sys/kern/exec_elf.c:1.102 --- src/sys/kern/exec_elf.c:1.101 Sun Jan 12 18:30:58 2020 +++ src/sys/kern/exec_elf.c Tue May 18 08:59:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: exec_elf.c,v 1.101 2020/01/12 18:30:58 ad Exp $ */ +/* $NetBSD: exec_elf.c,v 1.102 2021/05/18 08:59:44 hannken Exp $ */ /*- * Copyright (c) 1994, 2000, 2005, 2015, 2020 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.101 2020/01/12 18:30:58 ad Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exec_elf.c,v 1.102 2021/05/18 08:59:44 hannken Exp $"); #ifdef _KERNEL_OPT #include "opt_pax.h" @@ -421,7 +421,6 @@ elf_load_interp(struct lwp *l, struct ex { int error, i; struct vnode *vp; - struct vattr attr; Elf_Ehdr eh; Elf_Phdr *ph = NULL; const Elf_Phdr *base_ph; @@ -456,7 +455,7 @@ elf_load_interp(struct lwp *l, struct ex } /* We'll tidy this ourselves - otherwise we have locking issues */ epp->ep_interp = NULL; - vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(vp, LK_SHARED | LK_RETRY); /* * Similarly, if it's not marked as executable, or it's not a regular @@ -469,11 +468,6 @@ elf_load_interp(struct lwp *l, struct ex if ((error = VOP_ACCESS(vp, VEXEC, l->l_cred)) != 0) goto bad; - /* get attributes */ - /* XXX VOP_GETATTR() is the only thing that needs LK_EXCLUSIVE ^ */ - if ((error = VOP_GETATTR(vp, &attr, l->l_cred)) != 0) - goto bad; - /* * Check mount point. Though we're not trying to exec this binary, * we will be executing code from it, so if the mount point
CVS commit: src/bin/dd
Module Name:src Committed By: nia Date: Tue May 18 07:17:09 UTC 2021 Modified Files: src/bin/dd: dd.1 Log Message: dd.1: add an example of writing a NetBSD image To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/bin/dd/dd.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/bin/dd/dd.1 diff -u src/bin/dd/dd.1:1.36 src/bin/dd/dd.1:1.37 --- src/bin/dd/dd.1:1.36 Wed Jan 30 10:28:50 2019 +++ src/bin/dd/dd.1 Tue May 18 07:17:09 2021 @@ -1,4 +1,4 @@ -.\" $NetBSD: dd.1,v 1.36 2019/01/30 10:28:50 wiz Exp $ +.\" $NetBSD: dd.1,v 1.37 2021/05/18 07:17:09 nia Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -32,7 +32,7 @@ .\" .\" @(#)dd.1 8.2 (Berkeley) 1/13/94 .\" -.Dd January 29, 2019 +.Dd May 18, 2021 .Dt DD 1 .Os .Sh NAME @@ -546,6 +546,18 @@ for more details. .Sh EXIT STATUS .Ex -std dd .Sh EXAMPLES +To write a +.Xr gzip 1 +compressed +.Nx +image to a removable drive, with +.Xr progress 1 +output: +.Bd -literal -unfilled -offset indent +zcat NetBSD-9.2-amd64-install.img.gz | \\ +progress dd of=/dev/rsd0 bs=1m +.Ed +.Pp To print summary information in human-readable form: .Pp .Dl dd if=/dev/zero of=/dev/null count=1 msgfmt=human