CVS commit: src

2020-12-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Jan  1 07:41:46 UTC 2021

Modified Files:
src/distrib/sets/lists/dtb: ad.aarch64 ad.aarch64eb
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic: Makefile
Added Files:
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic:
meson-g12b-odroid-n2-plus.dts

Log Message:
add dts for odroid-N2 plus.

meson-g12b-odroid-n2-plus.dts of linux is not optimized for the odroid-N2plus 
CPU clock.
and the dts for odroid-n2-plus in the hardkernel repository is  significantly 
changed,
so cannot be imported without modification. Therefore, a simple 
meson-g12b-odroid-n2-plus.dts
has been added based on "meson-g12b-odroid-n2.dts" with only the cpu_opp_table 
and
regulator table changed.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/dtb/ad.aarch64
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/dtb/ad.aarch64eb
cvs rdiff -u -r1.1.1.7 -r1.2 \
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile
cvs rdiff -u -r0 -r1.1 \

src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/dtb/ad.aarch64
diff -u src/distrib/sets/lists/dtb/ad.aarch64:1.3 src/distrib/sets/lists/dtb/ad.aarch64:1.4
--- src/distrib/sets/lists/dtb/ad.aarch64:1.3	Wed Jun 10 18:53:31 2020
+++ src/distrib/sets/lists/dtb/ad.aarch64	Fri Jan  1 07:41:46 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ad.aarch64,v 1.3 2020/06/10 18:53:31 jmcneill Exp $
+# $NetBSD: ad.aarch64,v 1.4 2021/01/01 07:41:46 ryo Exp $
 #
 # DO NOT EDIT THIS FILE MANUALLY
 # Generated by "make update-sets" in sys/dtb
@@ -40,6 +40,7 @@
 ./boot/dtb/amlogic/meson-g12a-u200.dtb   dtb-base-boot  dtb
 ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot  dtb
 ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb  dtb-base-boot  dtb
+./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot  dtb
 ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb  dtb-base-boot  dtb
 ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb  dtb-base-boot  dtb
 ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb  dtb-base-boot  dtb

Index: src/distrib/sets/lists/dtb/ad.aarch64eb
diff -u src/distrib/sets/lists/dtb/ad.aarch64eb:1.2 src/distrib/sets/lists/dtb/ad.aarch64eb:1.3
--- src/distrib/sets/lists/dtb/ad.aarch64eb:1.2	Wed Jun 10 18:53:31 2020
+++ src/distrib/sets/lists/dtb/ad.aarch64eb	Fri Jan  1 07:41:46 2021
@@ -1,4 +1,4 @@
-# $NetBSD: ad.aarch64eb,v 1.2 2020/06/10 18:53:31 jmcneill Exp $
+# $NetBSD: ad.aarch64eb,v 1.3 2021/01/01 07:41:46 ryo Exp $
 #
 # DO NOT EDIT THIS FILE MANUALLY
 # Generated by "make update-sets" in sys/dtb
@@ -40,6 +40,7 @@
 ./boot/dtb/amlogic/meson-g12a-u200.dtb   dtb-base-boot  dtb
 ./boot/dtb/amlogic/meson-g12a-x96-max.dtbdtb-base-boot  dtb
 ./boot/dtb/amlogic/meson-g12b-a311d-khadas-vim3.dtb  dtb-base-boot  dtb
+./boot/dtb/amlogic/meson-g12b-odroid-n2-plus.dtb dtb-base-boot  dtb
 ./boot/dtb/amlogic/meson-g12b-odroid-n2.dtb  dtb-base-boot  dtb
 ./boot/dtb/amlogic/meson-g12b-s922x-khadas-vim3.dtb  dtb-base-boot  dtb
 ./boot/dtb/amlogic/meson-g12b-ugoos-am6.dtb  dtb-base-boot  dtb

Index: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile
diff -u src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.1.1.7 src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.2
--- src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile:1.1.1.7	Fri Jan  3 14:33:37 2020
+++ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/Makefile	Fri Jan  1 07:41:46 2021
@@ -6,6 +6,7 @@ dtb-$(CONFIG_ARCH_MESON) += meson-g12a-x
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-a311d-khadas-vim3.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-s922x-khadas-vim3.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2.dtb
+dtb-$(CONFIG_ARCH_MESON) += meson-g12b-odroid-n2-plus.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-g12b-ugoos-am6.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nanopi-k2.dtb
 dtb-$(CONFIG_ARCH_MESON) += meson-gxbb-nexbox-a95x.dtb

Added files:

Index: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts
diff -u /dev/null src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts:1.1
--- /dev/null	Fri Jan  1 07:41:46 2021
+++ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2-plus.dts	Fri Jan  1 07:41:46 2021
@@ -0,0 +1,228 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * Copyright (c) 2019 BayLibre, SAS
+ * Author: Neil Armstrong 
+ */
+
+/dts-v1/;
+
+#include "meson-g12b-odroid-n2.dts"
+
+/ {
+	compatible = "hardkernel,odroid-n2-plus", 

CVS commit: src/sys/arch/arm/amlogic

2020-12-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Jan  1 07:18:23 UTC 2021

Modified Files:
src/sys/arch/arm/amlogic: meson_dwmac.c

Log Message:
fix to work with various clock frequencies, and add support 
"amlogic,meson-axg-dwmac"


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/amlogic/meson_dwmac.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/amlogic/meson_dwmac.c
diff -u src/sys/arch/arm/amlogic/meson_dwmac.c:1.8 src/sys/arch/arm/amlogic/meson_dwmac.c:1.9
--- src/sys/arch/arm/amlogic/meson_dwmac.c:1.8	Thu Feb  6 00:32:07 2020
+++ src/sys/arch/arm/amlogic/meson_dwmac.c	Fri Jan  1 07:18:23 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_dwmac.c,v 1.8 2020/02/06 00:32:07 rjs Exp $ */
+/* $NetBSD: meson_dwmac.c,v 1.9 2021/01/01 07:18:23 ryo Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.8 2020/02/06 00:32:07 rjs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.9 2021/01/01 07:18:23 ryo Exp $");
 
 #include 
 #include 
@@ -61,6 +61,7 @@ static const char * compatible[] = {
 	"amlogic,meson8b-dwmac",
 	"amlogic,meson-gx-dwmac",
 	"amlogic,meson-gxbb-dwmac",
+	"amlogic,meson-axg-dwmac",
 	NULL
 };
 
@@ -101,7 +102,8 @@ meson_dwmac_set_mode_rgmii(int phandle, 
 	u_int tx_delay;
 	uint32_t val;
 
-	const u_int div = clk_get_rate(clkin) / 25000;
+#define DIV_ROUND_OFF(x, y)	(((x) + (y) / 2) / (y))
+	const u_int div = DIV_ROUND_OFF(clk_get_rate(clkin), 25000);
 
 	if (of_getprop_uint32(phandle, "amlogic,tx-delay-ns", _delay) != 0)
 		tx_delay = 2;
@@ -153,6 +155,8 @@ meson_dwmac_attach(device_t parent, devi
 	struct dwc_gmac_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
+	int miiclk, phandle_phy, phy = MII_PHY_ANY;
+	u_int miiclk_rate;
 	bus_space_handle_t prgeth_bsh;
 	struct fdtbus_reset *rst_gmac;
 	struct clk *clk_gmac, *clk_in[2];
@@ -196,6 +200,12 @@ meson_dwmac_attach(device_t parent, devi
 		aprint_error(": missing 'phy-mode' property\n");
 		return;
 	}
+	phandle_phy = fdtbus_get_phandle(phandle, "phy-handle");
+	if (phandle_phy > 0) {
+		of_getprop_uint32(phandle_phy, "reg", );
+	} else {
+		phandle_phy = phandle;
+	}
 
 	if (strcmp(phy_mode, "rgmii") == 0) {
 		meson_dwmac_set_mode_rgmii(phandle, sc->sc_bst, prgeth_bsh, clk_in[0]);
@@ -226,10 +236,24 @@ meson_dwmac_attach(device_t parent, devi
 	}
 	aprint_normal_dev(self, "interrupting on %s\n", intrstr);
 
-	if (meson_dwmac_reset(phandle) != 0)
+	if (meson_dwmac_reset(phandle_phy) != 0)
 		aprint_error_dev(self, "PHY reset failed\n");
 
-	dwc_gmac_attach(sc, MII_PHY_ANY, GMAC_MII_CLK_100_150M_DIV62);
+	miiclk_rate = clk_get_rate(clk_gmac);
+	if (miiclk_rate > 250 * 1000 * 1000)
+		miiclk = GMAC_MII_CLK_250_300M_DIV124;
+	else if (miiclk_rate > 150 * 1000 * 1000)
+		miiclk = GMAC_MII_CLK_150_250M_DIV102;
+	else if (miiclk_rate > 100 * 1000 * 1000)
+		miiclk = GMAC_MII_CLK_100_150M_DIV62;
+	else if (miiclk_rate > 60 * 1000 * 1000)
+		miiclk = GMAC_MII_CLK_60_100M_DIV42;
+	else if (miiclk_rate > 35 * 1000 * 1000)
+		miiclk = GMAC_MII_CLK_35_60M_DIV26;
+	else
+		miiclk = GMAC_MII_CLK_25_35M_DIV16;
+
+	dwc_gmac_attach(sc, phy, miiclk);
 }
 
 CFATTACH_DECL_NEW(meson_dwmac, sizeof(struct dwc_gmac_softc),



CVS commit: src/sys/arch/arm/amlogic

2020-12-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Jan  1 07:17:37 UTC 2021

Modified Files:
src/sys/arch/arm/amlogic: mesongx_mmc.c

Log Message:
adapts to some register differences to add support "amlogic,meson-axg-mmc"


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/amlogic/mesongx_mmc.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/amlogic/mesongx_mmc.c
diff -u src/sys/arch/arm/amlogic/mesongx_mmc.c:1.5 src/sys/arch/arm/amlogic/mesongx_mmc.c:1.6
--- src/sys/arch/arm/amlogic/mesongx_mmc.c:1.5	Sun Apr 21 13:08:48 2019
+++ src/sys/arch/arm/amlogic/mesongx_mmc.c	Fri Jan  1 07:17:36 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: mesongx_mmc.c,v 1.5 2019/04/21 13:08:48 jmcneill Exp $ */
+/* $NetBSD: mesongx_mmc.c,v 1.6 2021/01/01 07:17:36 ryo Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.c,v 1.5 2019/04/21 13:08:48 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.c,v 1.6 2021/01/01 07:17:36 ryo Exp $");
 
 #include 
 #include 
@@ -45,10 +45,14 @@ __KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.
 #include 
 
 #define	SD_EMMC_CLOCK			0x00
-#define	 CLOCK_CFG_IRQ_SDIO_SLEEP		__BIT(25)
-#define	 CLOCK_CFG_ALWAYS_ON			__BIT(24)
-#define	 CLOCK_CFG_RX_DELAY			__BITS(23,20)
-#define	 CLOCK_CFG_TX_DELAY			__BITS(19,16)
+#define	 CLOCK_CFG_V2_IRQ_SDIO_SLEEP		__BIT(25)
+#define	 CLOCK_CFG_V2_ALWAYS_ON			__BIT(24)
+#define	 CLOCK_CFG_V2_RX_DELAY			__BITS(23,20)
+#define	 CLOCK_CFG_V2_TX_DELAY			__BITS(19,16)
+#define	 CLOCK_CFG_V3_IRQ_SDIO_SLEEP		__BIT(29)
+#define	 CLOCK_CFG_V3_ALWAYS_ON			__BIT(28)
+#define	 CLOCK_CFG_V3_RX_DELAY			__BITS(27,22)
+#define	 CLOCK_CFG_V3_TX_DELAY			__BITS(21,16)
 #define	 CLOCK_CFG_SRAM_PD			__BITS(15,14)
 #define	 CLOCK_CFG_RX_PHASE			__BITS(13,12)
 #define	 CLOCK_CFG_TX_PHASE			__BITS(11,10)
@@ -56,7 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.
 #define	 CLOCK_CFG_SRC__BITS(7,6)
 #define	 CLOCK_CFG_DIV__BITS(5,0)
 #define	SD_EMMC_DELAY			0x04
-#define	SD_EMMC_ADJUST			0x08
+#define	SD_EMMC_ADJUST			0x08	/* V2 */
 #define	 ADJUST_ADJ_DELAY			__BITS(21,16)
 #define	 ADJUST_CALI_RISE			__BIT(14)
 #define	 ADJUST_ADJ_ENABLE			__BIT(13)
@@ -66,6 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.
 #define	 CALOUT_CALI_SETUP			__BITS(15,8)
 #define	 CALOUT_CALI_VLD			__BIT(7)
 #define	 CALOUT_CALI_IDX			__BITS(5,0)
+#define SD_EMMC_V3_ADJUST		0x0c
 #define	SD_EMMC_START			0x40
 #define	 START_DESC_ADDR			__BITS(31,2)
 #define	 START_DESC_BUSY			__BIT(1)
@@ -214,6 +219,7 @@ struct mesongx_mmc_softc {
 
 	device_t		sc_sdmmc_dev;
 	uint32_t		sc_host_ocr;
+	int			sc_hwtype;
 
 	struct sdmmc_command	*sc_cmd;
 
@@ -257,8 +263,9 @@ CFATTACH_DECL_NEW(mesongx_mmc, sizeof(st
 	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))
 
 static const struct of_compat_data compat_data[] = {
-	{ "amlogic,meson-gx-mmc",	1 },
-	{ "amlogic,meson-gxbb-mmc",	1 },
+	{ "amlogic,meson-gx-mmc",	2 },
+	{ "amlogic,meson-gxbb-mmc",	2 },
+	{ "amlogic,meson-axg-mmc",	3 },
 	{ NULL }
 };
 
@@ -280,6 +287,8 @@ mesongx_mmc_attach(device_t parent, devi
 	bus_addr_t addr;
 	bus_size_t size;
 
+	sc->sc_hwtype = (int)of_search_compatible(phandle, compat_data)->data;
+
 	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
 		aprint_error(": couldn't get registers\n");
 		return;
@@ -483,7 +492,10 @@ mesongx_mmc_set_clock(struct mesongx_mmc
 		return ERANGE;
 
 	val = MMC_READ(sc, SD_EMMC_CLOCK);
-	val |= CLOCK_CFG_ALWAYS_ON;
+	if (sc->sc_hwtype == 3)
+		val |= CLOCK_CFG_V3_ALWAYS_ON;
+	else
+		val |= CLOCK_CFG_V2_ALWAYS_ON;
 	val &= ~CLOCK_CFG_RX_PHASE;
 	val |= __SHIFTIN(0, CLOCK_CFG_RX_PHASE);
 	val &= ~CLOCK_CFG_TX_PHASE;



CVS commit: src/sys/arch/arm/amlogic

2020-12-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Jan  1 07:15:18 UTC 2021

Modified Files:
src/sys/arch/arm/amlogic: meson_resets.c

Log Message:
add "amlogic,meson-axg-reset" to compatible


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/amlogic/meson_resets.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/amlogic/meson_resets.c
diff -u src/sys/arch/arm/amlogic/meson_resets.c:1.2 src/sys/arch/arm/amlogic/meson_resets.c:1.3
--- src/sys/arch/arm/amlogic/meson_resets.c:1.2	Mon Feb 25 19:30:17 2019
+++ src/sys/arch/arm/amlogic/meson_resets.c	Fri Jan  1 07:15:18 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_resets.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $ */
+/* $NetBSD: meson_resets.c,v 1.3 2021/01/01 07:15:18 ryo Exp $ */
 
 /*-
  * Copyright (c) 2017-2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: meson_resets.c,v 1.2 2019/02/25 19:30:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_resets.c,v 1.3 2021/01/01 07:15:18 ryo Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: meson_resets
 
 static const char * compatible[] = {
 	"amlogic,meson8b-reset",
+	"amlogic,meson-axg-reset",
 	"amlogic,meson-gxbb-reset",
 	NULL
 };



CVS commit: src/sys/dev/fdt

2020-12-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Jan  1 03:07:51 UTC 2021

Modified Files:
src/sys/dev/fdt: pwmregulator.c

Log Message:
- remove unnecessary code
- handle "enable-gpios" property, and enable/disable GPIOs in 
pwmregulator_enable()

pointed out by thorpej@, thanks


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/pwmregulator.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/pwmregulator.c
diff -u src/sys/dev/fdt/pwmregulator.c:1.1 src/sys/dev/fdt/pwmregulator.c:1.2
--- src/sys/dev/fdt/pwmregulator.c:1.1	Thu Dec 31 15:12:33 2020
+++ src/sys/dev/fdt/pwmregulator.c	Fri Jan  1 03:07:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: pwmregulator.c,v 1.1 2020/12/31 15:12:33 ryo Exp $ */
+/* $NetBSD: pwmregulator.c,v 1.2 2021/01/01 03:07:51 ryo Exp $ */
 
 /*
  * Copyright (c) 2020 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pwmregulator.c,v 1.1 2020/12/31 15:12:33 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pwmregulator.c,v 1.2 2021/01/01 03:07:51 ryo Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@ struct voltage_duty {
 struct pwmregulator_softc {
 	device_t sc_dev;
 	pwm_tag_t sc_pwm;
+	struct fdtbus_gpio_pin *sc_pin;
 	struct voltage_duty *sc_voltage_table;
 	int sc_voltage_table_num;
 	int sc_phandle;
@@ -132,8 +133,6 @@ pwmregulator_attach(device_t parent, dev
 	>sc_dutycycle_unit) != 0)
 		sc->sc_dutycycle_unit = 100;
 
-	len = of_getprop_uint32_array(phandle, "pwm-dutycycle-range",
-	sc->sc_dutycycle_range, 2);
 	if (of_getprop_uint32_array(phandle, "pwm-dutycycle-range",
 	sc->sc_dutycycle_range, 2) != 0) {
 		sc->sc_dutycycle_range[0] = 0;
@@ -193,6 +192,10 @@ pwmregulator_acquire(device_t dev)
 {
 	struct pwmregulator_softc * const sc = device_private(dev);
 
+	/* "enable-gpios" is optional */
+	sc->sc_pin = fdtbus_gpio_acquire(sc->sc_phandle, "enable-gpios",
+	GPIO_PIN_OUTPUT);
+
 	sc->sc_pwm = fdtbus_pwm_acquire(sc->sc_phandle, "pwms");
 	if (sc->sc_pwm == NULL)
 		return ENXIO;
@@ -205,6 +208,11 @@ pwmregulator_release(device_t dev)
 {
 	struct pwmregulator_softc * const sc = device_private(dev);
 
+	if (sc->sc_pin != NULL) {
+		fdtbus_gpio_write(sc->sc_pin, 0);
+		fdtbus_gpio_release(sc->sc_pin);
+	}
+
 	sc->sc_pwm = NULL;
 }
 
@@ -212,14 +220,22 @@ static int
 pwmregulator_enable(device_t dev, bool enable)
 {
 	struct pwmregulator_softc * const sc = device_private(dev);
+	int error;
 
 	if (sc->sc_pwm == NULL)
 		return ENXIO;
 
-	if (enable)
-		return pwm_enable(sc->sc_pwm);
-	else
-		return pwm_disable(sc->sc_pwm);
+	if (enable) {
+		if (sc->sc_pin != NULL)
+			fdtbus_gpio_write(sc->sc_pin, 1);
+		error = pwm_enable(sc->sc_pwm);
+	} else {
+		error = pwm_disable(sc->sc_pwm);
+		if (sc->sc_pin != NULL)
+			fdtbus_gpio_write(sc->sc_pin, 0);
+	}
+
+	return error;
 }
 
 static int



CVS commit: src/usr.bin/xlint

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan  1 01:42:55 UTC 2021

Modified Files:
src/usr.bin/xlint/common: externs.h tyname.c
src/usr.bin/xlint/lint1: decl.c tree.c

Log Message:
lint: rename basic_type_name to tspec_name

The term "basic type" is precisely defined in C99 6.2.5p14, and tspec_t
is close to that, but nowhere identical.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/xlint/common/externs.h
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/xlint/common/tyname.c
cvs rdiff -u -r1.90 -r1.91 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.110 -r1.111 src/usr.bin/xlint/lint1/tree.c

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/xlint/common/externs.h
diff -u src/usr.bin/xlint/common/externs.h:1.8 src/usr.bin/xlint/common/externs.h:1.9
--- src/usr.bin/xlint/common/externs.h:1.8	Tue Dec 29 13:33:03 2020
+++ src/usr.bin/xlint/common/externs.h	Fri Jan  1 01:42:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: externs.h,v 1.8 2020/12/29 13:33:03 rillig Exp $	*/
+/*	$NetBSD: externs.h,v 1.9 2021/01/01 01:42:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -46,7 +46,7 @@ extern	void	inittyp(void);
  */
 extern	const	char *tyname(char *, size_t, const type_t *);
 extern	int	sametype(const type_t *, const type_t *);
-extern	const	char *basic_type_name(tspec_t);
+extern	const	char *tspec_name(tspec_t);
 
 /*
  * mem.c

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.17 src/usr.bin/xlint/common/tyname.c:1.18
--- src/usr.bin/xlint/common/tyname.c:1.17	Thu Dec 31 18:51:28 2020
+++ src/usr.bin/xlint/common/tyname.c	Fri Jan  1 01:42:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.17 2020/12/31 18:51:28 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.18 2021/01/01 01:42:55 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.17 2020/12/31 18:51:28 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.18 2021/01/01 01:42:55 rillig Exp $");
 #endif
 
 #include 
@@ -54,7 +54,7 @@ __RCSID("$NetBSD: tyname.c,v 1.17 2020/1
 #endif
 
 const char *
-basic_type_name(tspec_t t)
+tspec_name(tspec_t t)
 {
 	switch (t) {
 	case BOOL:	return "_Bool";
@@ -90,7 +90,7 @@ basic_type_name(tspec_t t)
 	case SIGNED:	return "signed";
 	case UNSIGN:	return "unsigned";
 	default:
-		LERROR("basic_type_name(%d)", t);
+		LERROR("tspec_name(%d)", t);
 		return NULL;
 	}
 }
@@ -172,7 +172,7 @@ tyname(char *buf, size_t bufsiz, const t
 	if ((t = tp->t_tspec) == INT && tp->t_isenum)
 		t = ENUM;
 
-	s = basic_type_name(t);
+	s = tspec_name(t);
 
 	cv[0] = '\0';
 	if (tp->t_const)

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.90 src/usr.bin/xlint/lint1/decl.c:1.91
--- src/usr.bin/xlint/lint1/decl.c:1.90	Fri Jan  1 01:29:30 2021
+++ src/usr.bin/xlint/lint1/decl.c	Fri Jan  1 01:42:55 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.90 2021/01/01 01:29:30 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.91 2021/01/01 01:42:55 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.90 2021/01/01 01:29:30 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.91 2021/01/01 01:42:55 rillig Exp $");
 #endif
 
 #include 
@@ -305,7 +305,7 @@ add_type(type_t *tp)
 		else if (dcs->d_cmod == DOUBLE) {
 			t = DCOMPLEX;
 		} else
-			error(308, basic_type_name(dcs->d_cmod));
+			error(308, tspec_name(dcs->d_cmod));
 		dcs->d_cmod = NOTSPEC;
 	}
 
@@ -800,7 +800,7 @@ deftyp(void)
 		case LCOMPLEX:
 			break;
 		default:
-			LERROR("deftyp(%s)", basic_type_name(t));
+			LERROR("deftyp(%s)", tspec_name(t));
 		}
 		if (t != INT && t != CHAR && (s != NOTSPEC || l != NOTSPEC)) {
 			dcs->d_terr = 1;

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.110 src/usr.bin/xlint/lint1/tree.c:1.111
--- src/usr.bin/xlint/lint1/tree.c:1.110	Fri Jan  1 01:38:14 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Jan  1 01:42:55 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.110 2021/01/01 01:38:14 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.111 2021/01/01 01:42:55 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.110 2021/01/01 01:38:14 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.111 2021/01/01 01:42:55 rillig Exp $");
 #endif
 
 #include 
@@ -2200,17 +2200,17 @@ warn_incompatible_types(op_t op, tspec_t
 		if ((lt == STRUCT || lt == UNION) &&
 		(rt == STRUCT || rt == UNION)) {
 			/* assignment of different structures (%s != %s) */
-			error(240, basic_type_name(lt), basic_type_name(rt));
+			error(240, tspec_name(lt), tspec_name(rt));
 		} else {
 			/* assignment type mismatch (%s 

CVS commit: src/usr.bin/xlint/lint1

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan  1 01:38:14 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: tree.c

Log Message:
lint: clean up warn_incompatible_types

Splitting the code arbitrarily in separate phases made the code harder
to understand, both for humans as well as automated tools.

One of these tools, check-msgs.lua, couldn't check whether the comments
match the actual messages, and of course, the comments were wrong.
There was no good reason to deviate from the pattern followed by all the
rest of the code.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/usr.bin/xlint/lint1/tree.c

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/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.109 src/usr.bin/xlint/lint1/tree.c:1.110
--- src/usr.bin/xlint/lint1/tree.c:1.109	Fri Jan  1 01:07:08 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Jan  1 01:38:14 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.109 2021/01/01 01:07:08 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.110 2021/01/01 01:38:14 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.109 2021/01/01 01:07:08 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.110 2021/01/01 01:38:14 rillig Exp $");
 #endif
 
 #include 
@@ -2190,42 +2190,27 @@ static void
 warn_incompatible_types(op_t op, tspec_t lt, tspec_t rt)
 {
 	mod_t	*mp;
-	int e = 0;
 
 	mp = [op];
 
 	if (lt == VOID || (mp->m_binary && rt == VOID)) {
 		/* void type illegal in expression */
-		e = 109;
+		error(109);
 	} else if (op == ASSIGN) {
 		if ((lt == STRUCT || lt == UNION) &&
 		(rt == STRUCT || rt == UNION)) {
-			/* assignment of different structures */
-			e = 240;
+			/* assignment of different structures (%s != %s) */
+			error(240, basic_type_name(lt), basic_type_name(rt));
 		} else {
-			/* assignment type mismatch */
-			e = 171;
+			/* assignment type mismatch (%s != %s) */
+			error(171, basic_type_name(lt), basic_type_name(rt));
 		}
 	} else if (mp->m_binary) {
-		/* operands of %s have incompatible types */
-		e = 107;
+		/* operands of '%s' have incompatible types (%s != %s) */
+		error(107, mp->m_name, basic_type_name(lt), basic_type_name(rt));
 	} else {
-		/* operand of %s has incompatible type */
-		e = 108;
-	}
-	switch (e) {
-	case 0:
-		return;
-	case 109:
-		error(e);
-		return;
-	case 108:
-	case 107:
-		error(e, mp->m_name, basic_type_name(lt), basic_type_name(rt));
-		return;
-	default:
-		error(e, basic_type_name(lt), basic_type_name(rt));
-		return;
+		/* operand of '%s' has incompatible type (%s != %s) */
+		error(108, mp->m_name, basic_type_name(lt), basic_type_name(rt));
 	}
 }
 



CVS commit: src/usr.bin/xlint/lint1

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan  1 01:29:30 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: remove redundant printf arguments


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/xlint/lint1/decl.c

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/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.89 src/usr.bin/xlint/lint1/decl.c:1.90
--- src/usr.bin/xlint/lint1/decl.c:1.89	Fri Jan  1 01:26:02 2021
+++ src/usr.bin/xlint/lint1/decl.c	Fri Jan  1 01:29:30 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.89 2021/01/01 01:26:02 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.90 2021/01/01 01:29:30 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.89 2021/01/01 01:26:02 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.90 2021/01/01 01:29:30 rillig Exp $");
 #endif
 
 #include 
@@ -1352,7 +1352,7 @@ add_array(sym_t *decl, int dim, int n)
 		n = 0;
 	} else if (n == 0 && dim) {
 		/* zero sized array is a C99 extension */
-		c99ism(322, dim);
+		c99ism(322);
 	} else if (n == 0 && !dim) {
 		setcomplete(tp, 0);
 	}
@@ -3212,7 +3212,7 @@ print_previous_declaration(int msg, sym_
 	cpos = curr_pos;
 	curr_pos = psym->s_def_pos;
 	if (msg != -1) {
-		message(msg, psym->s_name);
+		message(msg);
 	} else if (psym->s_def == DEF || psym->s_def == TDEF) {
 		/* previous definition of %s */
 		message(261, psym->s_name);



CVS commit: src/usr.bin/xlint/lint1

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan  1 01:26:02 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: cgram.y check-msgs.lua decl.c scan.l

Log Message:
lint: align comments with actual message, in the lexer and parser


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/xlint/lint1/check-msgs.lua
cvs rdiff -u -r1.88 -r1.89 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.105 -r1.106 src/usr.bin/xlint/lint1/scan.l

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/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.122 src/usr.bin/xlint/lint1/cgram.y:1.123
--- src/usr.bin/xlint/lint1/cgram.y:1.122	Wed Dec 30 13:17:42 2020
+++ src/usr.bin/xlint/lint1/cgram.y	Fri Jan  1 01:26:02 2021
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.122 2020/12/30 13:17:42 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.123 2021/01/01 01:26:02 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: cgram.y,v 1.122 2020/12/30 13:17:42 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.123 2021/01/01 01:26:02 rillig Exp $");
 #endif
 
 #include 
@@ -365,19 +365,19 @@ ext_decl:
 data_def:
 	  T_SEMI {
 		if (sflag) {
-			/* syntax error: empty declaration */
+			/* empty declaration */
 			error(0);
 		} else if (!tflag) {
-			/* syntax error: empty declaration */
+			/* empty declaration */
 			warning(0);
 		}
 	  }
 	| clrtyp deftyp notype_init_decls T_SEMI {
 		if (sflag) {
-			/* old style declaration; add "int" */
+			/* old style declaration; add int */
 			error(1);
 		} else if (!tflag) {
-			/* old style declaration; add "int" */
+			/* old style declaration; add int */
 			warning(1);
 		}
 	  }
@@ -412,7 +412,7 @@ data_def:
 func_def:
 	  func_decl {
 		if ($1->s_type->t_tspec != FUNC) {
-			/* syntax error */
+			/* syntax error '%s' */
 			error(249, yytext);
 			YYERROR;
 		}
@@ -756,10 +756,10 @@ member_declaration_list_with_rbrace:
 	  }
 	| member_declaration_list T_RBRACE {
 		if (sflag) {
-			/* syntax req. ";" after last struct/union member */
+			/* syntax req. ';' after last struct/union member */
 			error(66);
 		} else {
-			/* syntax req. ";" after last struct/union member */
+			/* syntax req. ';' after last struct/union member */
 			warning(66);
 		}
 		$$ = $1;
@@ -949,10 +949,10 @@ enums_with_opt_comma:
 	  }
 	| enums T_COMMA {
 		if (sflag) {
-			/* trailing "," prohibited in enum declaration */
+			/* trailing ',' prohibited in enum declaration */
 			error(54);
 		} else {
-			/* trailing "," prohibited in enum declaration */
+			/* trailing ',' prohibited in enum declaration */
 			c99ism(54);
 		}
 		$$ = $1;
@@ -1256,10 +1256,10 @@ vararg_parameter_type_list:
 	  }
 	| T_ELLIPSE {
 		if (sflag) {
-			/* ANSI C requires formal parameter before "..." */
+			/* ANSI C requires formal parameter before '...' */
 			error(84);
 		} else if (!tflag) {
-			/* ANSI C requires formal parameter before "..." */
+			/* ANSI C requires formal parameter before '...' */
 			warning(84);
 		}
 		dcs->d_vararg = 1;

Index: src/usr.bin/xlint/lint1/check-msgs.lua
diff -u src/usr.bin/xlint/lint1/check-msgs.lua:1.2 src/usr.bin/xlint/lint1/check-msgs.lua:1.3
--- src/usr.bin/xlint/lint1/check-msgs.lua:1.2	Fri Jan  1 00:00:24 2021
+++ src/usr.bin/xlint/lint1/check-msgs.lua	Fri Jan  1 01:26:02 2021
@@ -1,5 +1,5 @@
 #! /usr/bin/lua
--- $NetBSD: check-msgs.lua,v 1.2 2021/01/01 00:00:24 rillig Exp $
+-- $NetBSD: check-msgs.lua,v 1.3 2021/01/01 01:26:02 rillig Exp $
 
 --[[
 
@@ -38,6 +38,7 @@ local function check_message(fname, line
 
   msg = string.gsub(msg, "/%*", "**")
   msg = string.gsub(msg, "%*/", "**")
+  msg = string.gsub(msg, "\\(.)", "%1")
   comment = string.gsub(comment, "arg%.", "argument")
   comment = string.gsub(comment, "bitop%.", "bitwise operation")
   comment = string.gsub(comment, "comb%.", "combination")
@@ -49,6 +50,7 @@ local function check_message(fname, line
   comment = string.gsub(comment, "incomp%.", "incompatible")
   comment = string.gsub(comment, "init%.", "initialize")
   comment = string.gsub(comment, "param%.", "parameter")
+  comment = string.gsub(comment, "req%.", "requires")
   comment = string.gsub(comment, "poss%.", "possibly")
   comment = string.gsub(comment, "trad%.", "traditional")
 
@@ -77,11 +79,9 @@ local function collect_errors(fname, msg
   for line in f:lines() do
 lineno = lineno + 1
 
-local id = line:match("^%s+warning%((%d+)[),]")
-if id == nil then
-  id = line:match("^%s+error%((%d+)[),]")
-end
-if id ~= nil then
+local func, id = line:match("^%s+(%w+)%((%d+)[),]")
+if func == "error" or func == "warning" or func == "c99ism" or
+   func == "gnuism" or func == "message" then
   local comment 

CVS commit: src

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan  1 01:07:08 UTC 2021

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh
src/usr.bin/xlint/lint1: tree.c
Added Files:
src/tests/usr.bin/xlint/lint1: d_return_type.c d_return_type.exp

Log Message:
lint: fix segmentation fault when checking returned enum types (211)


To generate a diff of this commit:
cvs rdiff -u -r1.1004 -r1.1005 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.22 -r1.23 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/d_return_type.c \
src/tests/usr.bin/xlint/lint1/d_return_type.exp
cvs rdiff -u -r1.15 -r1.16 src/tests/usr.bin/xlint/lint1/t_integration.sh
cvs rdiff -u -r1.108 -r1.109 src/usr.bin/xlint/lint1/tree.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1004 src/distrib/sets/lists/tests/mi:1.1005
--- src/distrib/sets/lists/tests/mi:1.1004	Thu Dec 31 18:51:28 2020
+++ src/distrib/sets/lists/tests/mi	Fri Jan  1 01:07:07 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1004 2020/12/31 18:51:28 rillig Exp $
+# $NetBSD: mi,v 1.1005 2021/01/01 01:07:07 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5798,6 +5798,8 @@
 ./usr/tests/usr.bin/xlint/lint1/d_nested_structs.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_nolimit_init.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_packed_structs.c		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/d_return_type.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/d_return_type.exp		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_shift_to_narrower_type.c	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_struct_init_nested.c		tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_struct_init_nested.exp	tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.22 src/tests/usr.bin/xlint/lint1/Makefile:1.23
--- src/tests/usr.bin/xlint/lint1/Makefile:1.22	Thu Dec 31 18:51:28 2020
+++ src/tests/usr.bin/xlint/lint1/Makefile	Fri Jan  1 01:07:08 2021
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.22 2020/12/31 18:51:28 rillig Exp $
+# $NetBSD: Makefile,v 1.23 2021/01/01 01:07:08 rillig Exp $
 
 NOMAN=		# defined
 
@@ -66,6 +66,8 @@ FILES+=		d_long_double_int.exp
 FILES+=		d_nested_structs.c
 FILES+=		d_nolimit_init.c
 FILES+=		d_packed_structs.c
+FILES+=		d_return_type.c
+FILES+=		d_return_type.exp
 FILES+=		d_shift_to_narrower_type.c
 FILES+=		d_struct_init_nested.c
 FILES+=		d_struct_init_nested.exp

Index: src/tests/usr.bin/xlint/lint1/t_integration.sh
diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.15 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.16
--- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.15	Thu Dec 31 18:51:28 2020
+++ src/tests/usr.bin/xlint/lint1/t_integration.sh	Fri Jan  1 01:07:08 2021
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.15 2020/12/31 18:51:28 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.16 2021/01/01 01:07:08 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -76,6 +76,7 @@ test_case cast_typeof
 test_case decl_old_style_arguments
 test_case fold_test
 test_case gcc_extension
+test_case return_type
 test_case type_question_colon
 test_case typefun
 test_case typename_as_var

Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.108 src/usr.bin/xlint/lint1/tree.c:1.109
--- src/usr.bin/xlint/lint1/tree.c:1.108	Fri Jan  1 00:00:24 2021
+++ src/usr.bin/xlint/lint1/tree.c	Fri Jan  1 01:07:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: tree.c,v 1.108 2021/01/01 00:00:24 rillig Exp $	*/
+/*	$NetBSD: tree.c,v 1.109 2021/01/01 01:07:08 rillig Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.108 2021/01/01 00:00:24 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.109 2021/01/01 01:07:08 rillig Exp $");
 #endif
 
 #include 
@@ -1369,6 +1369,7 @@ static void
 check_enum_type_mismatch(op_t op, int arg, tnode_t *ln, tnode_t *rn)
 {
 	mod_t	*mp;
+	char lbuf[128], rbuf[128];
 
 	mp = [op];
 
@@ -1384,7 +1385,8 @@ check_enum_type_mismatch(op_t op, int ar
 			break;
 		case RETURN:
 			/* return value type mismatch (%s) and (%s) */
-			warning(211);
+			warning(211, tyname(lbuf, sizeof(lbuf), ln->tn_type),
+			tyname(rbuf, sizeof(rbuf), rn->tn_type));
 			break;
 		default:
 			/* enum type mismatch, op %s */

Added files:

Index: src/tests/usr.bin/xlint/lint1/d_return_type.c
diff -u /dev/null 

CVS commit: src/usr.bin/xlint/lint1

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Jan  1 00:00:24 UTC 2021

Modified Files:
src/usr.bin/xlint/lint1: check-msgs.lua decl.c func.c init.c tree.c

Log Message:
lint: align comments in code with actual messages

Redundancy is bad.  Especially in this case, separating the format
strings from the actual arguments prevents the compiler from
cross-checking them.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/xlint/lint1/check-msgs.lua
cvs rdiff -u -r1.87 -r1.88 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.39 -r1.40 src/usr.bin/xlint/lint1/func.c
cvs rdiff -u -r1.48 -r1.49 src/usr.bin/xlint/lint1/init.c
cvs rdiff -u -r1.107 -r1.108 src/usr.bin/xlint/lint1/tree.c

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/xlint/lint1/check-msgs.lua
diff -u src/usr.bin/xlint/lint1/check-msgs.lua:1.1 src/usr.bin/xlint/lint1/check-msgs.lua:1.2
--- src/usr.bin/xlint/lint1/check-msgs.lua:1.1	Thu Dec 31 22:48:33 2020
+++ src/usr.bin/xlint/lint1/check-msgs.lua	Fri Jan  1 00:00:24 2021
@@ -1,5 +1,5 @@
 #! /usr/bin/lua
--- $NetBSD: check-msgs.lua,v 1.1 2020/12/31 22:48:33 rillig Exp $
+-- $NetBSD: check-msgs.lua,v 1.2 2021/01/01 00:00:24 rillig Exp $
 
 --[[
 
@@ -36,12 +36,28 @@ local function check_message(fname, line
 return
   end
 
+  msg = string.gsub(msg, "/%*", "**")
+  msg = string.gsub(msg, "%*/", "**")
+  comment = string.gsub(comment, "arg%.", "argument")
+  comment = string.gsub(comment, "bitop%.", "bitwise operation")
+  comment = string.gsub(comment, "comb%.", "combination")
+  comment = string.gsub(comment, "conv%.", "conversion")
+  comment = string.gsub(comment, "decl%.", "declaration")
+  comment = string.gsub(comment, "defn%.", "definition")
+  comment = string.gsub(comment, "expr%.", "expression")
+  comment = string.gsub(comment, "func%.", "function")
+  comment = string.gsub(comment, "incomp%.", "incompatible")
+  comment = string.gsub(comment, "init%.", "initialize")
+  comment = string.gsub(comment, "param%.", "parameter")
+  comment = string.gsub(comment, "poss%.", "possibly")
+  comment = string.gsub(comment, "trad%.", "traditional")
+
   if comment == msg then
 return
   end
 
-  local prefix = comment:match("(.*) %.%.%.$")
-  if prefix ~= nil and msg:find(prefix) == 1 then
+  local prefix = comment:match("^(.-)%s*%.%.%.$")
+  if prefix ~= nil and msg:find(prefix, 1, 1) == 1 then
 return
   end
 
@@ -66,7 +82,7 @@ local function collect_errors(fname, msg
   id = line:match("^%s+error%((%d+)[),]")
 end
 if id ~= nil then
-  local comment = prev:match("^%s+/%*%s+(.+)%s+%*/$")
+  local comment = prev:match("^%s+/%* (.+) %*/$")
   if comment ~= nil then
 check_message(fname, lineno, tonumber(id), comment, msgs, errors)
   end

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.87 src/usr.bin/xlint/lint1/decl.c:1.88
--- src/usr.bin/xlint/lint1/decl.c:1.87	Wed Dec 30 13:17:42 2020
+++ src/usr.bin/xlint/lint1/decl.c	Fri Jan  1 00:00:24 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.87 2020/12/30 13:17:42 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.88 2021/01/01 00:00:24 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.87 2020/12/30 13:17:42 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.88 2021/01/01 00:00:24 rillig Exp $");
 #endif
 
 #include 
@@ -562,7 +562,7 @@ add_qualifier(tqual_t q)
 
 	if (q == CONST) {
 		if (dcs->d_const) {
-			/* duplicate "%s" */
+			/* duplicate '%s' */
 			warning(10, "const");
 		}
 		dcs->d_const = 1;
@@ -572,7 +572,7 @@ add_qualifier(tqual_t q)
 		if (q != VOLATILE)
 			LERROR("add_qualifier()");
 		if (dcs->d_volatile) {
-			/* duplicate "%s" */
+			/* duplicate '%s' */
 			warning(10, "volatile");
 		}
 		dcs->d_volatile = 1;
@@ -772,7 +772,7 @@ deftyp(void)
 l = NOTSPEC;
 t = DOUBLE;
 if (!tflag)
-	/* use 'double' instead of ...  */
+	/* use 'double' instead of 'long ... */
 	warning(6);
 			}
 			break;
@@ -828,7 +828,7 @@ deftyp(void)
 		}
 	} else if (dcs->d_ctx == ARG || dcs->d_ctx == PARG) {
 		if (scl != NOSCL && scl != REG) {
-			/* only "register" valid ... */
+			/* only register valid ... */
 			error(9);
 			scl = NOSCL;
 		}
@@ -839,13 +839,13 @@ deftyp(void)
 	if (dcs->d_const && dcs->d_type->t_const) {
 		if (!dcs->d_type->t_typedef)
 			LERROR("deftyp()");
-		/* typedef already qualified with "%s" */
+		/* typedef already qualified with '%s' */
 		warning(68, "const");
 	}
 	if (dcs->d_volatile && dcs->d_type->t_volatile) {
 		if (!dcs->d_type->t_typedef)
 			LERROR("deftyp()");
-		/* typedef already qualified with "%s" */
+		/* typedef already qualified with '%s' */
 		warning(68, "volatile");
 	}
 
@@ -1034,7 +1034,7 @@ check_type(sym_t *sym)
 error(17);
 

CVS commit: src/usr.bin/xlint/lint1

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 31 22:48:33 UTC 2020

Added Files:
src/usr.bin/xlint/lint1: check-msgs.lua

Log Message:
lint: check messages and their IDs for consistency


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/usr.bin/xlint/lint1/check-msgs.lua

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: src/usr.bin/xlint/lint1/check-msgs.lua
diff -u /dev/null src/usr.bin/xlint/lint1/check-msgs.lua:1.1
--- /dev/null	Thu Dec 31 22:48:33 2020
+++ src/usr.bin/xlint/lint1/check-msgs.lua	Thu Dec 31 22:48:33 2020
@@ -0,0 +1,102 @@
+#! /usr/bin/lua
+-- $NetBSD: check-msgs.lua,v 1.1 2020/12/31 22:48:33 rillig Exp $
+
+--[[
+
+Check that the message text in the C source matches the actual user-visible
+message text.
+
+usage: ./check-diagnostics *.c
+
+]]
+
+
+local function load_messages(fname)
+  local msgs = {}
+
+  local f = assert(io.open(fname, "r"))
+  for line in f:lines() do
+local msg, id = line:match("%s*\"(.+)\",%s*/%*%s*(%d+)%s*%*/$")
+if msg ~= nil then
+  msgs[tonumber(id)] = msg
+end
+  end
+
+  f:close()
+
+  return msgs
+end
+
+
+local function check_message(fname, lineno, id, comment, msgs, errors)
+  local msg = msgs[id]
+
+  if msg == nil then
+errors:add("%s:%d: id=%d not found", fname, lineno, id)
+return
+  end
+
+  if comment == msg then
+return
+  end
+
+  local prefix = comment:match("(.*) %.%.%.$")
+  if prefix ~= nil and msg:find(prefix) == 1 then
+return
+  end
+
+  errors:add("%s:%d:   id=%-3d   msg=%-40s   comment=%s",
+fname, lineno, id, msg, comment)
+end
+
+
+local function collect_errors(fname, msgs)
+  local errors = {}
+  errors.add = function(self, fmt, ...)
+table.insert(self, string.format(fmt, ...))
+  end
+  local f = assert(io.open(fname, "r"))
+  local lineno = 0
+  local prev = ""
+  for line in f:lines() do
+lineno = lineno + 1
+
+local id = line:match("^%s+warning%((%d+)[),]")
+if id == nil then
+  id = line:match("^%s+error%((%d+)[),]")
+end
+if id ~= nil then
+  local comment = prev:match("^%s+/%*%s+(.+)%s+%*/$")
+  if comment ~= nil then
+check_message(fname, lineno, tonumber(id), comment, msgs, errors)
+  end
+end
+
+prev = line
+  end
+
+  f:close()
+
+  return errors
+end
+
+
+local function check_file(fname, msgs)
+  local errors = collect_errors(fname, msgs)
+  for _, err in ipairs(errors) do
+print(err)
+  end
+  return #errors == 0
+end
+
+
+local function main(arg)
+  local msgs = load_messages("err.c")
+  local ok = true
+  for _, fname in ipairs(arg) do
+ok = check_file(fname, msgs) and ok
+  end
+  return ok
+end
+
+os.exit(main(arg))



CVS commit: src/sys/arch/arm

2020-12-31 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Dec 31 20:47:06 UTC 2020

Modified Files:
src/sys/arch/arm/dts: rk3328-rock64.dts
src/sys/arch/arm/rockchip: rk3328_cru.c rk_i2s.c

Log Message:
begin to make rock64 audio work.

- set status for "analog_sound" to enabled.
- add clocks for the i2s and spdif nodes.
- match "rockchip,rk3066-i2s", "rockchip,rk3188-i2s",
  and "rockchip,rk3288-i2s".

this gets i2s and ausoc to attach, but no audio(4) yet.

to complete this probably also needs a codec driver (appears
to be rk3328 specific, unlike eg pinebookpro's es8316), and
support for "audio-graph-card" type sound cards.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/dts/rk3328-rock64.dts
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/rockchip/rk3328_cru.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/rockchip/rk_i2s.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/dts/rk3328-rock64.dts
diff -u src/sys/arch/arm/dts/rk3328-rock64.dts:1.5 src/sys/arch/arm/dts/rk3328-rock64.dts:1.6
--- src/sys/arch/arm/dts/rk3328-rock64.dts:1.5	Thu Dec 12 00:46:31 2019
+++ src/sys/arch/arm/dts/rk3328-rock64.dts	Thu Dec 31 20:47:05 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3328-rock64.dts,v 1.5 2019/12/12 00:46:31 jmcneill Exp $ */
+/* $NetBSD: rk3328-rock64.dts,v 1.6 2020/12/31 20:47:05 mrg Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -32,3 +32,7 @@
  {
 	status = "okay";
 };
+
+_sound {
+	status = "okay";
+};

Index: src/sys/arch/arm/rockchip/rk3328_cru.c
diff -u src/sys/arch/arm/rockchip/rk3328_cru.c:1.5 src/sys/arch/arm/rockchip/rk3328_cru.c:1.6
--- src/sys/arch/arm/rockchip/rk3328_cru.c:1.5	Wed May 15 01:24:43 2019
+++ src/sys/arch/arm/rockchip/rk3328_cru.c	Thu Dec 31 20:47:06 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3328_cru.c,v 1.5 2019/05/15 01:24:43 mrg Exp $ */
+/* $NetBSD: rk3328_cru.c,v 1.6 2020/12/31 20:47:06 mrg Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: rk3328_cru.c,v 1.5 2019/05/15 01:24:43 mrg Exp $");
+__KERNEL_RCSID(1, "$NetBSD: rk3328_cru.c,v 1.6 2020/12/31 20:47:06 mrg Exp $");
 
 #include 
 #include 
@@ -152,6 +152,12 @@ static const char * mux_2plls_parents[] 
 static const char * mux_2plls_hdmiphy_parents[] = { "cpll", "gpll", "dummy_hdmiphy" };
 static const char * comp_uart_parents[] = { "cpll", "gpll", "usb480m" };
 static const char * pclk_gmac_parents[] = { "aclk_gmac" };
+static const char * mux_i2s0_parents[] = { "clk_i2s0_div", "clk_i2s0_frac", "xin12m" };
+static const char * mux_i2s1_parents[] = { "clk_i2s1_div", "clk_i2s1_frac", "xin12m" };
+static const char * mux_i2s2_parents[] = { "clk_i2s2_div", "clk_i2s2_frac", "xin12m" };
+static const char * mux_spdif_parents[] = { "clk_spdif_div", "clk_spdif_frac", "xin12m" };
+static const char * mux_i2s1out_parents[] = { "clk_i2s1", "xin12m" };
+static const char * mux_i2s2out_parents[] = { "clk_i2s2", "xin12m" };
 
 static struct rk_cru_clk rk3328_cru_clks[] = {
 	RK_PLL(RK3328_PLL_APLL, "apll", pll_parents,
@@ -388,6 +394,74 @@ static struct rk_cru_clk rk3328_cru_clks
 	RK_MUX(RK3328_SCLK_UART2, "sclk_uart2", mux_uart2_parents, CLKSEL_CON(18), __BITS(9,8)),
 	RK_MUXGRF(RK3328_SCLK_MAC2IO, "clk_mac2io", mux_mac2io_src_parents, GRF_MAC_CON1, __BIT(10)),
 	RK_MUXGRF(RK3328_SCLK_MAC2IO_EXT, "clk_mac2io_ext", mux_mac2io_ext_parents, GRF_SOC_CON4, __BIT(14)),
+
+	/* I2S */
+	RK_COMPOSITE(0, "clk_i2s0_div", mux_2plls_parents,
+		 CLKSEL_CON(6),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(1),	/* gate_reg */
+		 __BIT(1),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(0, "clk_i2s1_div", mux_2plls_parents,
+		 CLKSEL_CON(8),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(1),	/* gate_reg */
+		 __BIT(4),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(0, "clk_i2s2_div", mux_2plls_parents,
+		 CLKSEL_CON(10),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(1),	/* gate_reg */
+		 __BIT(8),		/* gate_mask */
+		 0),
+	RK_COMPOSITE(0, "clk_spdif_div", mux_2plls_parents,
+		 CLKSEL_CON(12),	/* muxdiv_reg */
+		 __BIT(15),		/* mux_mask */
+		 __BITS(6,0),	/* div_mask */
+		 CLKGATE_CON(1),	/* gate_reg */
+		 __BIT(12),		/* gate_mask */
+		 0),
+	RK_COMPOSITE_FRAC(0, "clk_i2s0_frac", "clk_i2s0_div",
+			  CLKSEL_CON(7),	/* frac_reg */
+			  RK_COMPOSITE_SET_RATE_PARENT),
+	RK_COMPOSITE_FRAC(0, "clk_i2s1_frac", "clk_i2s1_div",
+			  CLKSEL_CON(9),	/* frac_reg */
+			  RK_COMPOSITE_SET_RATE_PARENT),
+	RK_COMPOSITE_FRAC(0, "clk_i2s2_frac", "clk_i2s2_div",
+			  CLKSEL_CON(11),	/* frac_reg */
+			  RK_COMPOSITE_SET_RATE_PARENT),
+	RK_COMPOSITE_FRAC(0, "clk_spdif_frac", "clk_spdif_div",
+			  CLKSEL_CON(13),	/* frac_reg 

CVS commit: src

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 31 18:51:28 UTC 2020

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/usr.bin/xlint/lint1: Makefile t_integration.sh
src/usr.bin/xlint/common: tyname.c
src/usr.bin/xlint/lint1: func.c
Added Files:
src/tests/usr.bin/xlint/lint1: d_fold_test.c d_fold_test.exp

Log Message:
lint: check that in "if (cond)", cond is scalar


To generate a diff of this commit:
cvs rdiff -u -r1.1003 -r1.1004 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.21 -r1.22 src/tests/usr.bin/xlint/lint1/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/xlint/lint1/d_fold_test.c \
src/tests/usr.bin/xlint/lint1/d_fold_test.exp
cvs rdiff -u -r1.14 -r1.15 src/tests/usr.bin/xlint/lint1/t_integration.sh
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/xlint/common/tyname.c
cvs rdiff -u -r1.38 -r1.39 src/usr.bin/xlint/lint1/func.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1003 src/distrib/sets/lists/tests/mi:1.1004
--- src/distrib/sets/lists/tests/mi:1.1003	Thu Dec 31 03:05:12 2020
+++ src/distrib/sets/lists/tests/mi	Thu Dec 31 18:51:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1003 2020/12/31 03:05:12 rillig Exp $
+# $NetBSD: mi,v 1.1004 2020/12/31 18:51:28 rillig Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -5782,6 +5782,8 @@
 ./usr/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.c	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_decl_old_style_arguments.exp	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_ellipsis_in_switch.c		tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/d_fold_test.c			tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint1/d_fold_test.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements1.c	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements2.c	tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint1/d_gcc_compound_statements3.c	tests-usr.bin-tests	compattestfile,atf

Index: src/tests/usr.bin/xlint/lint1/Makefile
diff -u src/tests/usr.bin/xlint/lint1/Makefile:1.21 src/tests/usr.bin/xlint/lint1/Makefile:1.22
--- src/tests/usr.bin/xlint/lint1/Makefile:1.21	Wed Dec 30 13:15:07 2020
+++ src/tests/usr.bin/xlint/lint1/Makefile	Thu Dec 31 18:51:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.21 2020/12/30 13:15:07 rillig Exp $
+# $NetBSD: Makefile,v 1.22 2020/12/31 18:51:28 rillig Exp $
 
 NOMAN=		# defined
 
@@ -50,6 +50,8 @@ FILES+=		d_cvt_in_ternary.c
 FILES+=		d_decl_old_style_arguments.c
 FILES+=		d_decl_old_style_arguments.exp
 FILES+=		d_ellipsis_in_switch.c
+FILES+=		d_fold_test.c
+FILES+=		d_fold_test.exp
 FILES+=		d_gcc_compound_statements1.c
 FILES+=		d_gcc_compound_statements2.c
 FILES+=		d_gcc_compound_statements3.c

Index: src/tests/usr.bin/xlint/lint1/t_integration.sh
diff -u src/tests/usr.bin/xlint/lint1/t_integration.sh:1.14 src/tests/usr.bin/xlint/lint1/t_integration.sh:1.15
--- src/tests/usr.bin/xlint/lint1/t_integration.sh:1.14	Wed Dec 30 13:42:19 2020
+++ src/tests/usr.bin/xlint/lint1/t_integration.sh	Thu Dec 31 18:51:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: t_integration.sh,v 1.14 2020/12/30 13:42:19 rillig Exp $
+# $NetBSD: t_integration.sh,v 1.15 2020/12/31 18:51:28 rillig Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -74,6 +74,7 @@ test_case c99_union_init4
 test_case cast_fun_array_param
 test_case cast_typeof
 test_case decl_old_style_arguments
+test_case fold_test
 test_case gcc_extension
 test_case type_question_colon
 test_case typefun

Index: src/usr.bin/xlint/common/tyname.c
diff -u src/usr.bin/xlint/common/tyname.c:1.16 src/usr.bin/xlint/common/tyname.c:1.17
--- src/usr.bin/xlint/common/tyname.c:1.16	Tue Dec 29 13:33:03 2020
+++ src/usr.bin/xlint/common/tyname.c	Thu Dec 31 18:51:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tyname.c,v 1.16 2020/12/29 13:33:03 rillig Exp $	*/
+/*	$NetBSD: tyname.c,v 1.17 2020/12/31 18:51:28 rillig Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tyname.c,v 1.16 2020/12/29 13:33:03 rillig Exp $");
+__RCSID("$NetBSD: tyname.c,v 1.17 2020/12/31 18:51:28 rillig Exp $");
 #endif
 
 #include 
@@ -87,6 +87,8 @@ basic_type_name(tspec_t t)
 	case DCOMPLEX:	return "double _Complex";
 	case LCOMPLEX:	return "long double _Complex";
 	case COMPLEX:	return "_Complex";
+	case SIGNED:	return "signed";
+	case UNSIGN:	return "unsigned";
 	default:
 		LERROR("basic_type_name(%d)", t);
 		return NULL;
@@ -204,6 +206,8 @@ tyname(char *buf, size_t bufsiz, const t
 	case FCOMPLEX:
 	case DCOMPLEX:
 	case LCOMPLEX:
+	case 

CVS commit: src/usr.bin/make

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 31 17:39:36 UTC 2020

Modified Files:
src/usr.bin/make: main.c meta.c parse.c
src/usr.bin/make/filemon: filemon_ktrace.c

Log Message:
make(1): replace pointers in controlling conditions with booleans


To generate a diff of this commit:
cvs rdiff -u -r1.507 -r1.508 src/usr.bin/make/main.c
cvs rdiff -u -r1.165 -r1.166 src/usr.bin/make/meta.c
cvs rdiff -u -r1.524 -r1.525 src/usr.bin/make/parse.c
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/filemon/filemon_ktrace.c

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/main.c
diff -u src/usr.bin/make/main.c:1.507 src/usr.bin/make/main.c:1.508
--- src/usr.bin/make/main.c:1.507	Wed Dec 30 10:03:16 2020
+++ src/usr.bin/make/main.c	Thu Dec 31 17:39:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.507 2020/12/30 10:03:16 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.508 2020/12/31 17:39:36 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -110,7 +110,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.507 2020/12/30 10:03:16 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.508 2020/12/31 17:39:36 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	"The Regents of the University of California.  "
@@ -828,12 +828,12 @@ MakeMode(void)
 	}
 
 	if (mode.str[0] != '\0') {
-		if (strstr(mode.str, "compat")) {
+		if (strstr(mode.str, "compat") != NULL) {
 			opts.compatMake = TRUE;
 			forceJobs = FALSE;
 		}
 #if USE_META
-		if (strstr(mode.str, "meta"))
+		if (strstr(mode.str, "meta") != NULL)
 			meta_mode_init(mode.str);
 #endif
 	}
@@ -844,7 +844,7 @@ MakeMode(void)
 static void
 PrintVar(const char *varname, Boolean expandVars)
 {
-	if (strchr(varname, '$')) {
+	if (strchr(varname, '$') != NULL) {
 		char *evalue;
 		(void)Var_Subst(varname, VAR_GLOBAL, VARE_WANTRES, );
 		/* TODO: handle errors */

Index: src/usr.bin/make/meta.c
diff -u src/usr.bin/make/meta.c:1.165 src/usr.bin/make/meta.c:1.166
--- src/usr.bin/make/meta.c:1.165	Tue Dec 22 22:31:50 2020
+++ src/usr.bin/make/meta.c	Thu Dec 31 17:39:36 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: meta.c,v 1.165 2020/12/22 22:31:50 rillig Exp $ */
+/*  $NetBSD: meta.c,v 1.166 2020/12/31 17:39:36 rillig Exp $ */
 
 /*
  * Implement 'meta' mode.
@@ -254,9 +254,9 @@ meta_name(char *mname, size_t mnamelen,
  * So we use realpath() just to get the dirname, and leave the
  * basename as given to us.
  */
-if ((cp = strrchr(tname, '/'))) {
-	if (cached_realpath(tname, buf)) {
-	if ((rp = strrchr(buf, '/'))) {
+if ((cp = strrchr(tname, '/')) != NULL) {
+	if (cached_realpath(tname, buf) != NULL) {
+	if ((rp = strrchr(buf, '/')) != NULL) {
 		rp++;
 		cp++;
 		if (strcmp(cp, rp) != 0)
@@ -327,7 +327,7 @@ is_submake(const char *cmd, GNode *gn)
 	p_len = strlen(p_make);
 }
 cp = strchr(cmd, '$');
-if ((cp)) {
+if (cp != NULL) {
 	(void)Var_Subst(cmd, gn, VARE_WANTRES, );
 	/* TODO: handle errors */
 	cmd = mp;
@@ -374,7 +374,7 @@ printCMD(const char *cmd, FILE *fp, GNod
 {
 char *cmd_freeIt = NULL;
 
-if (strchr(cmd, '$')) {
+if (strchr(cmd, '$') != NULL) {
 	(void)Var_Subst(cmd, gn, VARE_WANTRES, _freeIt);
 	/* TODO: handle errors */
 	cmd = cmd_freeIt;
@@ -451,7 +451,7 @@ meta_needed(GNode *gn, const char *dname
 }
 
 /* make sure these are canonical */
-if (cached_realpath(dname, objdir_realpath))
+if (cached_realpath(dname, objdir_realpath) != NULL)
 	dname = objdir_realpath;
 
 /* If we aren't in the object directory, don't create a meta file. */
@@ -575,7 +575,7 @@ meta_init(void)
 
 
 #define get_mode_bf(bf, token) \
-if ((cp = strstr(make_mode, token))) \
+if ((cp = strstr(make_mode, token)) != NULL) \
 	bf = boolValue(cp + sizeof (token) - 1)
 
 /*
@@ -593,15 +593,15 @@ meta_mode_init(const char *make_mode)
 writeMeta = TRUE;
 
 if (make_mode != NULL) {
-	if (strstr(make_mode, "env"))
+	if (strstr(make_mode, "env") != NULL)
 	metaEnv = TRUE;
-	if (strstr(make_mode, "verb"))
+	if (strstr(make_mode, "verb") != NULL)
 	metaVerbose = TRUE;
-	if (strstr(make_mode, "read"))
+	if (strstr(make_mode, "read") != NULL)
 	writeMeta = FALSE;
-	if (strstr(make_mode, "nofilemon"))
+	if (strstr(make_mode, "nofilemon") != NULL)
 	useFilemon = FALSE;
-	if (strstr(make_mode, "ignore-cmd"))
+	if (strstr(make_mode, "ignore-cmd") != NULL)
 	metaIgnoreCMDs = TRUE;
 	if (useFilemon)
 	get_mode_bf(filemonMissing, "missing-filemon=");
@@ -814,7 +814,7 @@ meta_job_output(Job *job, char *cp, cons
 		(void)Var_Subst("${" MAKE_META_PREFIX "}",
 VAR_GLOBAL, VARE_WANTRES, _prefix);
 		/* TODO: handle errors */
-		if ((cp2 = strchr(meta_prefix, '$')))
+		if ((cp2 = strchr(meta_prefix, '$')) != NULL)
 		meta_prefix_len = 

CVS commit: src/usr.bin/xlint/lint1

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 31 16:19:05 UTC 2020

Modified Files:
src/usr.bin/xlint/lint1: mkops

Log Message:
lint: in mkops, replace printf with println

One less backslash per line of code.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/xlint/lint1/mkops

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/xlint/lint1/mkops
diff -u src/usr.bin/xlint/lint1/mkops:1.10 src/usr.bin/xlint/lint1/mkops:1.11
--- src/usr.bin/xlint/lint1/mkops:1.10	Wed Dec 30 11:39:55 2020
+++ src/usr.bin/xlint/lint1/mkops	Thu Dec 31 16:19:05 2020
@@ -1,5 +1,5 @@
 #!/bin/sh -
-#	$NetBSD: mkops,v 1.10 2020/12/30 11:39:55 rillig Exp $
+#	$NetBSD: mkops,v 1.11 2020/12/31 16:19:05 rillig Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -28,8 +28,8 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-# allow AWK to be overriden
-: ${AWK:=awk}
+# allow AWK to be overridden
+: "${AWK:=awk}"
 
 
 while getopts ch f
@@ -44,37 +44,44 @@ do
 	esac
 done
 
-shift $(expr ${OPTIND} - 1)
+# shellcheck disable=SC2003
+shift "$(expr ${OPTIND} - 1)"
 
+# shellcheck disable=SC2016
 $AWK -F'	' -v v=$v '
+function println(s)
+{
+	printf("%s\n", s);
+}
+
 function display(fmt, last, comment)
 {
 	printf(fmt, last);
 	if (comment != "")
 		printf("\t/* pseudo op not used in trees */");
-	printf("\n");
+	println("");
 }
 
 BEGIN {
 	print "/* Automatically generated file; do not edit */";
 	if (v == "h") {
-		printf("typedef enum {\n");
+		println("typedef enum {");
 		FIRST = "";
 		LAST = "";
 		LASTCOMMENT= "";
 	}
 	if (v == "c") {
-		printf("#include \n");
-		printf("#include \"op.h\"\n");
-		printf("#include \"param.h\"\n");
-		printf("#ifndef __arraycount\n");
-		printf("#define __arraycount(a) (sizeof(a) / sizeof(a[0]))\n");
-		printf("#endif /* __arraycount */\n");
-		printf("mod_t modtab[NOPS];\n");
-		printf("static const struct {\n");
-		printf("\tmod_t\tm;\n");
-		printf("\tunsigned char\tok;\n");
-		printf("} imods[] = {\n");
+		println("#include ");
+		println("#include \"op.h\"");
+		println("#include \"param.h\"");
+		println("#ifndef __arraycount");
+		println("#define __arraycount(a) (sizeof(a) / sizeof(a[0]))");
+		println("#endif /* __arraycount */");
+		println("mod_t modtab[NOPS];");
+		println("static const struct {");
+		println("\tmod_t\tm;");
+		println("\tunsigned char\tok;");
+		println("} imods[] = {");
 	}
 }
 
@@ -107,25 +114,25 @@ END {
 	if (v == "h") {
 		display("\t%s,", LAST, LASTCOMMENT);
 		printf("#define\tNOPS\t((int)%s + 1)\n", LAST);
-		printf("} op_t;\n");
-		printf("const char *getopname(op_t);\n");
-		printf("void initmtab(void);\n");
+		println("} op_t;");
+		println("const char *getopname(op_t);");
+		println("void initmtab(void);");
 	}
 	if (v == "c") {
-		printf("};\n");
-		printf("const char *\n");
-		printf("getopname(op_t op) {\n");
-		printf("\treturn imods[op].m.m_name;\n");
-		printf("}\n");
-		printf("void\n");
-		printf("initmtab(void)\n");
-		printf("{\n");
-		printf("\tsize_t i;\n");
-		printf("\n");
-		printf("\tfor (i = 0; i < __arraycount(imods); i++)\n");
-		printf("\t\tif (imods[i].ok)\n");
-		printf("\t\t\tmodtab[i] = imods[i].m;\n");
-		printf("}\n");
+		println("};");
+		println("const char *");
+		println("getopname(op_t op) {");
+		println("\treturn imods[op].m.m_name;");
+		println("}");
+		println("void");
+		println("initmtab(void)");
+		println("{");
+		println("\tsize_t i;");
+		println("");
+		println("\tfor (i = 0; i < __arraycount(imods); i++)");
+		println("\t\tif (imods[i].ok)");
+		println("\t\t\tmodtab[i] = imods[i].m;");
+		println("}");
 	}
 }
 ' "$@"



CVS commit: src/sys/dev/fdt

2020-12-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Dec 31 15:12:34 UTC 2020

Modified Files:
src/sys/dev/fdt: files.fdt
Added Files:
src/sys/dev/fdt: pwmregulator.c

Log Message:
add fdt pwm regulator


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/fdt/files.fdt
cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/pwmregulator.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/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.59 src/sys/dev/fdt/files.fdt:1.60
--- src/sys/dev/fdt/files.fdt:1.59	Mon Dec 28 20:29:57 2020
+++ src/sys/dev/fdt/files.fdt	Thu Dec 31 15:12:33 2020
@@ -1,4 +1,4 @@
-# $NetBSD: files.fdt,v 1.59 2020/12/28 20:29:57 thorpej Exp $
+# $NetBSD: files.fdt,v 1.60 2020/12/31 15:12:33 ryo Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
@@ -21,6 +21,10 @@ device	gregulator
 attach	gregulator at fdt
 file	dev/fdt/gpioregulator.c			gregulator
 
+device	pregulator
+attach	pregulator at fdt
+file	dev/fdt/pwmregulator.c			pregulator
+
 device	fclock: clk
 attach	fclock at fdt
 file	dev/fdt/fixedclock.c			fclock

Added files:

Index: src/sys/dev/fdt/pwmregulator.c
diff -u /dev/null src/sys/dev/fdt/pwmregulator.c:1.1
--- /dev/null	Thu Dec 31 15:12:34 2020
+++ src/sys/dev/fdt/pwmregulator.c	Thu Dec 31 15:12:33 2020
@@ -0,0 +1,309 @@
+/* $NetBSD: pwmregulator.c,v 1.1 2020/12/31 15:12:33 ryo Exp $ */
+
+/*
+ * Copyright (c) 2020 Ryo Shimizu 
+ * All rights reserved.
+ *
+ * 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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+ * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: pwmregulator.c,v 1.1 2020/12/31 15:12:33 ryo Exp $");
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+static int pwmregulator_match(device_t, cfdata_t, void *);
+static void pwmregulator_attach(device_t, device_t, void *);
+
+/* fdtbus_regulator_controller_func callback */
+static int pwmregulator_acquire(device_t);
+static void pwmregulator_release(device_t);
+static int pwmregulator_enable(device_t, bool);
+static int pwmregulator_set_voltage(device_t, u_int, u_int);
+static int pwmregulator_get_voltage(device_t, u_int *);
+
+static const struct fdtbus_regulator_controller_func pwmregulator_funcs = {
+	.acquire = pwmregulator_acquire,
+	.release = pwmregulator_release,
+	.enable = pwmregulator_enable,
+	.set_voltage = pwmregulator_set_voltage,
+	.get_voltage = pwmregulator_get_voltage
+};
+
+struct voltage_duty {
+	uint32_t microvolt;
+	uint32_t duty;		/* percentage; 0-100 */
+};
+
+struct pwmregulator_softc {
+	device_t sc_dev;
+	pwm_tag_t sc_pwm;
+	struct voltage_duty *sc_voltage_table;
+	int sc_voltage_table_num;
+	int sc_phandle;
+	uint32_t sc_microvolt_min;
+	uint32_t sc_microvolt_max;
+	uint32_t sc_dutycycle_unit;
+	uint32_t sc_dutycycle_range[2];
+	bool sc_always_on;
+	bool sc_boot_on;
+};
+
+CFATTACH_DECL_NEW(pregulator, sizeof(struct pwmregulator_softc),
+pwmregulator_match, pwmregulator_attach, NULL, NULL);
+
+static const char * const compatible[] = {
+	"pwm-regulator",
+	NULL
+};
+
+static int
+pwmregulator_match(device_t parent, cfdata_t cf, void *aux)
+{
+	const struct fdt_attach_args *faa = aux;
+
+	return of_match_compatible(faa->faa_phandle, compatible);
+}
+
+static void
+pwmregulator_attach(device_t parent, device_t self, void *aux)
+{
+	struct pwmregulator_softc * const sc = device_private(self);
+	const struct fdt_attach_args *faa = aux;
+	const int phandle = faa->faa_phandle;
+	int len;
+	char *name;
+
+	sc->sc_dev = self;
+	sc->sc_phandle = phandle;
+
+	aprint_naive("\n");
+	len = OF_getproplen(phandle, "regulator-name");
+	if (len > 0) {
+		name = kmem_zalloc(len, KM_SLEEP);
+		if (OF_getprop(phandle, "regulator-name", name, len) == len)
+			

CVS commit: src/sys/dev/ofw

2020-12-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Dec 31 15:10:46 UTC 2020

Modified Files:
src/sys/dev/ofw: ofw_subr.c openfirm.h

Log Message:
add of_getprop_uint32_array()


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ofw/ofw_subr.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/ofw/openfirm.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/ofw/ofw_subr.c
diff -u src/sys/dev/ofw/ofw_subr.c:1.40 src/sys/dev/ofw/ofw_subr.c:1.41
--- src/sys/dev/ofw/ofw_subr.c:1.40	Thu Jul 16 21:32:44 2020
+++ src/sys/dev/ofw/ofw_subr.c	Thu Dec 31 15:10:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofw_subr.c,v 1.40 2020/07/16 21:32:44 jmcneill Exp $	*/
+/*	$NetBSD: ofw_subr.c,v 1.41 2020/12/31 15:10:46 ryo Exp $	*/
 
 /*
  * Copyright 1998
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.40 2020/07/16 21:32:44 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofw_subr.c,v 1.41 2020/12/31 15:10:46 ryo Exp $");
 
 #include 
 #include 
@@ -603,6 +603,23 @@ of_getprop_uint32(int node, const char *
 	return 0;
 }
 
+int
+of_getprop_uint32_array(int node, const char *prop, uint32_t *array, int n)
+{
+	uint32_t *v = array;
+	int len;
+
+	len = OF_getprop(node, prop, array, n * sizeof(*v));
+	if (len < (int)(n * sizeof(*v)))
+		return -1;
+
+	for (; n > 0; n--) {
+		BE32TOH(*v);
+		v++;
+	}
+
+	return 0;
+}
 /*
  * Get the value of a uint64 property, compensating for host byte order.
  * Returns 0 on success, non-zero on failure.

Index: src/sys/dev/ofw/openfirm.h
diff -u src/sys/dev/ofw/openfirm.h:1.39 src/sys/dev/ofw/openfirm.h:1.40
--- src/sys/dev/ofw/openfirm.h:1.39	Thu Jul 16 21:32:44 2020
+++ src/sys/dev/ofw/openfirm.h	Thu Dec 31 15:10:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: openfirm.h,v 1.39 2020/07/16 21:32:44 jmcneill Exp $	*/
+/*	$NetBSD: openfirm.h,v 1.40 2020/12/31 15:10:46 ryo Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -132,6 +132,7 @@ void	of_enter_spi_devs(prop_dictionary_t
 bool	of_hasprop(int, const char *);
 #define of_getprop_bool	of_hasprop
 int	of_getprop_uint32(int, const char *, uint32_t *);
+int	of_getprop_uint32_array(int, const char *, uint32_t *, int);
 int	of_getprop_uint64(int, const char *, uint64_t *);
 
 #endif /*_OPENFIRM_H_*/



CVS commit: src/sys/dev/ic

2020-12-31 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Dec 31 15:09:12 UTC 2020

Modified Files:
src/sys/dev/ic: dwc_gmac.c

Log Message:
extend the timeout value. dwc_gmac_reset() sometimes takes more time.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/ic/dwc_gmac.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/ic/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.71 src/sys/dev/ic/dwc_gmac.c:1.72
--- src/sys/dev/ic/dwc_gmac.c:1.71	Sat Jun 27 13:34:20 2020
+++ src/sys/dev/ic/dwc_gmac.c	Thu Dec 31 15:09:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.71 2020/06/27 13:34:20 jmcneill Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.72 2020/12/31 15:09:12 ryo Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.71 2020/06/27 13:34:20 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.72 2020/12/31 15:09:12 ryo Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -379,7 +379,7 @@ dwc_gmac_reset(struct dwc_gmac_softc *sc
 	bus_space_write_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_BUSMODE,
 	bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_BUSMODE)
 	| GMAC_BUSMODE_RESET);
-	for (cnt = 0; cnt < 3000; cnt++) {
+	for (cnt = 0; cnt < 3; cnt++) {
 		if ((bus_space_read_4(sc->sc_bst, sc->sc_bsh, AWIN_GMAC_DMA_BUSMODE)
 		& GMAC_BUSMODE_RESET) == 0)
 			return 0;



CVS commit: src/usr.bin/make/unit-tests

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 31 14:26:37 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directive-for-escape.exp
directive-for-escape.mk

Log Message:
make(1): add test for common and edge cases in .for loop expansion


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-for-escape.exp \
src/usr.bin/make/unit-tests/directive-for-escape.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/directive-for-escape.exp
diff -u src/usr.bin/make/unit-tests/directive-for-escape.exp:1.2 src/usr.bin/make/unit-tests/directive-for-escape.exp:1.3
--- src/usr.bin/make/unit-tests/directive-for-escape.exp:1.2	Thu Dec 31 13:23:43 2020
+++ src/usr.bin/make/unit-tests/directive-for-escape.exp	Thu Dec 31 14:26:37 2020
@@ -46,6 +46,28 @@ For: end for 1
 For: loop body:
 .  info ${:Ureplaced}
 make: "directive-for-escape.mk" line 78: replaced
+For: end for 1
+For: loop body:
+.  info .$$i: ${:Uinner}
+.  info .  $${i}: ${:Uinner}
+.  info .   $${i:M*}: ${:Uinner:M*}
+.  info .  $$(i): $(:Uinner)
+.  info .   $$(i:M*): $(:Uinner:M*)
+.  info . $${i$${:U}}: ${i${:U}}
+.  info .$${i\}}: ${:Uinner\}}	# XXX: unclear why SubstVarLong needs this
+.  info . $${i2}: ${i2}
+.  info . $${i,}: ${i,}
+.  info .  adjacent: ${:Uinner}${:Uinner}${:Uinner:M*}${:Uinner}
+make: "directive-for-escape.mk" line 86: .$i: inner
+make: "directive-for-escape.mk" line 87: .  ${i}: inner
+make: "directive-for-escape.mk" line 88: .   ${i:M*}: inner
+make: "directive-for-escape.mk" line 89: .  $(i): inner
+make: "directive-for-escape.mk" line 90: .   $(i:M*): inner
+make: "directive-for-escape.mk" line 91: . ${i${:U}}: outer
+make: "directive-for-escape.mk" line 92: .${i\}}: inner}
+make: "directive-for-escape.mk" line 93: . ${i2}: two
+make: "directive-for-escape.mk" line 94: . ${i,}: comma
+make: "directive-for-escape.mk" line 95: .  adjacent: innerinnerinnerinner
 make: no target to make.
 
 make: stopped in unit-tests
Index: src/usr.bin/make/unit-tests/directive-for-escape.mk
diff -u src/usr.bin/make/unit-tests/directive-for-escape.mk:1.2 src/usr.bin/make/unit-tests/directive-for-escape.mk:1.3
--- src/usr.bin/make/unit-tests/directive-for-escape.mk:1.2	Thu Dec 31 13:23:43 2020
+++ src/usr.bin/make/unit-tests/directive-for-escape.mk	Thu Dec 31 14:26:37 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for-escape.mk,v 1.2 2020/12/31 13:23:43 rillig Exp $
+# $NetBSD: directive-for-escape.mk,v 1.3 2020/12/31 14:26:37 rillig Exp $
 #
 # Test escaping of special characters in the iteration values of a .for loop.
 # These values get expanded later using the :U variable modifier, and this
@@ -77,3 +77,20 @@ EXT=		.c
 .for BASENAME}${EXT in replaced
 .  info ${BASENAME}${EXT}
 .endfor
+
+# Demonstrate the various ways to refer to the iteration variable.
+i=		outer
+i2=		two
+i,=		comma
+.for i in inner
+.  info .$$i: $i
+.  info .  $${i}: ${i}
+.  info .   $${i:M*}: ${i:M*}
+.  info .  $$(i): $(i)
+.  info .   $$(i:M*): $(i:M*)
+.  info . $${i$${:U}}: ${i${:U}}
+.  info .$${i\}}: ${i\}}	# XXX: unclear why SubstVarLong needs this
+.  info . $${i2}: ${i2}
+.  info . $${i,}: ${i,}
+.  info .  adjacent: $i${i}${i:M*}$i
+.endfor



CVS commit: src/usr.bin/make

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 31 14:10:04 UTC 2020

Modified Files:
src/usr.bin/make: for.c

Log Message:
make(1): fix undefined behavior in SubstVarLong

A memcmp implementation that would check the start and end pointers
first would have detected this possible out-of-bounds memory read.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/usr.bin/make/for.c

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/for.c
diff -u src/usr.bin/make/for.c:1.131 src/usr.bin/make/for.c:1.132
--- src/usr.bin/make/for.c:1.131	Thu Dec 31 13:56:56 2020
+++ src/usr.bin/make/for.c	Thu Dec 31 14:10:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.131 2020/12/31 13:56:56 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.132 2020/12/31 14:10:04 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
 #include "make.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.131 2020/12/31 13:56:56 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.132 2020/12/31 14:10:04 rillig Exp $");
 
 static int forLevel = 0;	/* Nesting level */
 
@@ -356,7 +356,8 @@ Buf_AddEscaped(Buffer *cmds, const char 
  * expression like ${i} or ${i:...} or $(i) or $(i:...) with ":Uvalue".
  */
 static void
-SubstVarLong(For *f, const char **pp, const char **inout_mark, char endc)
+SubstVarLong(For *f, const char **pp, const char *bodyEnd, char endc,
+	 const char **inout_mark)
 {
 	size_t i;
 	const char *p = *pp;
@@ -366,7 +367,8 @@ SubstVarLong(For *f, const char **pp, co
 		char *varname = forVar->name;
 		size_t varnameLen = forVar->nameLen;
 
-		/* XXX: undefined behavior for p if varname is longer than p? */
+		if (varnameLen >= (size_t)(bodyEnd - p))
+			continue;
 		if (memcmp(p, varname, varnameLen) != 0)
 			continue;
 		/* XXX: why test for backslash here? */
@@ -437,16 +439,18 @@ found:
 static void
 ForSubstBody(For *f)
 {
-	const char *p;
+	const char *p, *bodyEnd;
 	const char *mark;	/* where the last replacement left off */
 
 	Buf_Empty(>curBody);
 
 	mark = f->body.data;
+	bodyEnd = f->body.data + f->body.len;
 	for (p = mark; (p = strchr(p, '$')) != NULL;) {
 		if (p[1] == '{' || p[1] == '(') {
 			p += 2;
-			SubstVarLong(f, , , p[-1] == '{' ? '}' : ')');
+			SubstVarLong(f, , bodyEnd, p[-1] == '{' ? '}' : ')',
+			);
 		} else if (p[1] != '\0') {
 			SubstVarShort(f, p + 1, );
 			p += 2;
@@ -454,7 +458,7 @@ ForSubstBody(For *f)
 			break;
 	}
 
-	Buf_AddBytesBetween(>curBody, mark, f->body.data + f->body.len);
+	Buf_AddBytesBetween(>curBody, mark, bodyEnd);
 }
 
 /*



CVS commit: src/usr.bin/make

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 31 13:56:56 UTC 2020

Modified Files:
src/usr.bin/make: for.c

Log Message:
make(1): make control flow in SubstVarLong of .for loops more obvious


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/usr.bin/make/for.c

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/for.c
diff -u src/usr.bin/make/for.c:1.130 src/usr.bin/make/for.c:1.131
--- src/usr.bin/make/for.c:1.130	Thu Dec 31 13:37:33 2020
+++ src/usr.bin/make/for.c	Thu Dec 31 13:56:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.130 2020/12/31 13:37:33 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.131 2020/12/31 13:56:56 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
 #include "make.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.130 2020/12/31 13:37:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.131 2020/12/31 13:56:56 rillig Exp $");
 
 static int forLevel = 0;	/* Nesting level */
 
@@ -352,7 +352,7 @@ Buf_AddEscaped(Buffer *cmds, const char 
 }
 
 /*
- * While expanding the body of a .for loop, replace the inner part of an
+ * While expanding the body of a .for loop, replace the variable name of an
  * expression like ${i} or ${i:...} or $(i) or $(i:...) with ":Uvalue".
  */
 static void
@@ -374,7 +374,10 @@ SubstVarLong(For *f, const char **pp, co
 		p[varnameLen] != '\\')
 			continue;
 
-		/* Found a variable match. Replace with :U */
+		/*
+		 * Found a variable match.  Skip over the variable name and
+		 * instead add ':U' to the current body.
+		 */
 		Buf_AddBytesBetween(>curBody, *inout_mark, p);
 		Buf_AddStr(>curBody, ":U");
 		Buf_AddEscaped(>curBody,
@@ -382,10 +385,9 @@ SubstVarLong(For *f, const char **pp, co
 
 		p += varnameLen;
 		*inout_mark = p;
-		break;
+		*pp = p;
+		return;
 	}
-
-	*pp = p;
 }
 
 /*



CVS commit: src/usr.bin/make

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 31 13:37:33 UTC 2020

Modified Files:
src/usr.bin/make: for.c

Log Message:
make(1): clean up SubstVarShort in .for loops

This function does not need to advance the parsing position, which
removes duplicate code.


To generate a diff of this commit:
cvs rdiff -u -r1.129 -r1.130 src/usr.bin/make/for.c

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/for.c
diff -u src/usr.bin/make/for.c:1.129 src/usr.bin/make/for.c:1.130
--- src/usr.bin/make/for.c:1.129	Thu Dec 31 04:38:55 2020
+++ src/usr.bin/make/for.c	Thu Dec 31 13:37:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: for.c,v 1.129 2020/12/31 04:38:55 rillig Exp $	*/
+/*	$NetBSD: for.c,v 1.130 2020/12/31 13:37:33 rillig Exp $	*/
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
 #include "make.h"
 
 /*	"@(#)for.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: for.c,v 1.129 2020/12/31 04:38:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.130 2020/12/31 13:37:33 rillig Exp $");
 
 static int forLevel = 0;	/* Nesting level */
 
@@ -393,37 +393,30 @@ SubstVarLong(For *f, const char **pp, co
  * variable expressions like $i with their ${:U...} expansion.
  */
 static void
-SubstVarShort(For *f, const char **pp, const char **inout_mark)
+SubstVarShort(For *f, const char *p, const char **inout_mark)
 {
-	const char *p = *pp;
 	const char ch = *p;
+	ForVar *vars;
 	size_t i;
 
-	/* Probably a single character name, ignore $$ and stupid ones. */
-	if (!f->short_var || strchr("}):$", ch) != NULL) {
-		p++;
-		*pp = p;
+	/* Skip $$ and stupid ones. */
+	if (!f->short_var || strchr("}):$", ch) != NULL)
 		return;
-	}
 
+	vars = Vector_Get(>vars, 0);
 	for (i = 0; i < f->vars.len; i++) {
-		ForVar *var = Vector_Get(>vars, i);
-		const char *varname = var->name;
-		if (varname[0] != ch || varname[1] != '\0')
-			continue;
-
-		/* Found a variable match. Replace with ${:U} */
-		Buf_AddBytesBetween(>curBody, *inout_mark, p);
-		Buf_AddStr(>curBody, "{:U");
-		Buf_AddEscaped(>curBody,
-		f->items.words[f->sub_next + i], '}');
-		Buf_AddByte(>curBody, '}');
-
-		*inout_mark = ++p;
-		break;
-	}
-
-	*pp = p;
+		const char *varname = vars[i].name;
+		if (varname[0] == ch && varname[1] == '\0')
+			goto found;
+	}
+	return;
+
+found:
+	/* Replace $ with ${:U} */
+	Buf_AddBytesBetween(>curBody, *inout_mark, p), *inout_mark = p + 1;
+	Buf_AddStr(>curBody, "{:U");
+	Buf_AddEscaped(>curBody, f->items.words[f->sub_next + i], '}');
+	Buf_AddByte(>curBody, '}');
 }
 
 /*
@@ -453,8 +446,8 @@ ForSubstBody(For *f)
 			p += 2;
 			SubstVarLong(f, , , p[-1] == '{' ? '}' : ')');
 		} else if (p[1] != '\0') {
-			p++;
-			SubstVarShort(f, , );
+			SubstVarShort(f, p + 1, );
+			p += 2;
 		} else
 			break;
 	}



CVS commit: src/usr.bin/make/unit-tests

2020-12-31 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Thu Dec 31 13:23:43 UTC 2020

Modified Files:
src/usr.bin/make/unit-tests: directive-for-escape.exp
directive-for-escape.mk

Log Message:
make(1): add tests for extreme edge cases of .for loop expansion


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/directive-for-escape.exp \
src/usr.bin/make/unit-tests/directive-for-escape.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/directive-for-escape.exp
diff -u src/usr.bin/make/unit-tests/directive-for-escape.exp:1.1 src/usr.bin/make/unit-tests/directive-for-escape.exp:1.2
--- src/usr.bin/make/unit-tests/directive-for-escape.exp:1.1	Thu Dec 31 03:05:12 2020
+++ src/usr.bin/make/unit-tests/directive-for-escape.exp	Thu Dec 31 13:23:43 2020
@@ -38,6 +38,14 @@ For: end for 1
 For: loop body:
 .  info ${:U\$}
 make: "directive-for-escape.mk" line 60: $
+For: end for 1
+For: loop body:
+.  info ${NUMBERS} ${:Ureplaced}
+make: "directive-for-escape.mk" line 68: one two three replaced
+For: end for 1
+For: loop body:
+.  info ${:Ureplaced}
+make: "directive-for-escape.mk" line 78: replaced
 make: no target to make.
 
 make: stopped in unit-tests
Index: src/usr.bin/make/unit-tests/directive-for-escape.mk
diff -u src/usr.bin/make/unit-tests/directive-for-escape.mk:1.1 src/usr.bin/make/unit-tests/directive-for-escape.mk:1.2
--- src/usr.bin/make/unit-tests/directive-for-escape.mk:1.1	Thu Dec 31 03:05:12 2020
+++ src/usr.bin/make/unit-tests/directive-for-escape.mk	Thu Dec 31 13:23:43 2020
@@ -1,4 +1,4 @@
-# $NetBSD: directive-for-escape.mk,v 1.1 2020/12/31 03:05:12 rillig Exp $
+# $NetBSD: directive-for-escape.mk,v 1.2 2020/12/31 13:23:43 rillig Exp $
 #
 # Test escaping of special characters in the iteration values of a .for loop.
 # These values get expanded later using the :U variable modifier, and this
@@ -59,3 +59,21 @@ VALUES=		$${UNDEF:U\$$\$$ {{}} end}
 .for i in ${:U\$}
 .  info ${i}
 .endfor
+
+# As of 2020-12-31, the name of the iteration variable can even contain
+# colons, which then affects variable expressions having this exact modifier.
+# This is clearly an unintended side effect of the implementation.
+NUMBERS=	one two three
+.for NUMBERS:M*e in replaced
+.  info ${NUMBERS} ${NUMBERS:M*e}
+.endfor
+
+# As of 2020-12-31, the name of the iteration variable can contain braces,
+# which gets even more surprising than colons, since it allows to replace
+# sequences of variable expressions.  There is no practical use case for
+# this, though.
+BASENAME=	one
+EXT=		.c
+.for BASENAME}${EXT in replaced
+.  info ${BASENAME}${EXT}
+.endfor



CVS commit: src/sys/dev/pci/ixgbe

2020-12-31 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 31 12:34:33 UTC 2020

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe.c

Log Message:
Reduce code duplication. No functional change.

   Add new ixgbe_intr_admin_common() and use it in both ixgbe_msix_admin()
  and ixgbe_legacy_irq().


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/sys/dev/pci/ixgbe/ixgbe.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/pci/ixgbe/ixgbe.c
diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.276 src/sys/dev/pci/ixgbe/ixgbe.c:1.277
--- src/sys/dev/pci/ixgbe/ixgbe.c:1.276	Sat Dec 26 06:27:38 2020
+++ src/sys/dev/pci/ixgbe/ixgbe.c	Thu Dec 31 12:34:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe.c,v 1.276 2020/12/26 06:27:38 msaitoh Exp $ */
+/* $NetBSD: ixgbe.c,v 1.277 2020/12/31 12:34:33 msaitoh Exp $ */
 
 /**
 
@@ -258,12 +258,11 @@ static int	ixgbe_sysctl_debug(SYSCTLFN_P
 static int	ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO);
 static int	ixgbe_sysctl_wufc(SYSCTLFN_PROTO);
 
-/* Legacy (single vector) interrupt handler */
-static int	ixgbe_legacy_irq(void *);
-
-/* The MSI/MSI-X Interrupt handlers */
+/* Interrupt functions */
 static int	ixgbe_msix_que(void *);
 static int	ixgbe_msix_admin(void *);
+static void	ixgbe_intr_admin_common(struct adapter *, u32, u32 *);
+static int	ixgbe_legacy_irq(void *);
 
 /* Event handlers running on workqueue */
 static void	ixgbe_handle_que(void *);
@@ -3089,11 +3088,9 @@ ixgbe_msix_admin(void *arg)
 {
 	struct adapter	*adapter = arg;
 	struct ixgbe_hw *hw = >hw;
-	u32		eicr, eicr_mask;
+	u32		eicr;
 	u32		eims_orig;
 	u32		eims_disable = 0;
-	u32		task_requests = 0;
-	s32		retval;
 
 	++adapter->admin_irqev.ev_count;
 
@@ -3115,10 +3112,26 @@ ixgbe_msix_admin(void *arg)
 	/* Clear all OTHER interrupts with write */
 	IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr);
 
+	ixgbe_intr_admin_common(adapter, eicr, _disable);
+
+	/* Re-enable some OTHER interrupts */
+	IXGBE_WRITE_REG(hw, IXGBE_EIMS, eims_orig & ~eims_disable);
+
+	return 1;
+} /* ixgbe_msix_admin */
+
+static void
+ixgbe_intr_admin_common(struct adapter *adapter, u32 eicr, u32 *eims_disable)
+{
+	struct ixgbe_hw *hw = >hw;
+	u32		eicr_mask;
+	u32		task_requests = 0;
+	s32		retval;
+
 	/* Link status change */
 	if (eicr & IXGBE_EICR_LSC) {
 		task_requests |= IXGBE_REQUEST_TASK_LSC;
-		eims_disable |= IXGBE_EIMS_LSC;
+		*eims_disable |= IXGBE_EIMS_LSC;
 	}
 
 	if (ixgbe_is_sfp(hw)) {
@@ -3138,13 +3151,13 @@ ixgbe_msix_admin(void *arg)
 		|| ((hw->phy.sfp_type == ixgbe_sfp_type_not_present)
 			&& (eicr & IXGBE_EICR_LSC))) {
 			task_requests |= IXGBE_REQUEST_TASK_MOD;
-			eims_disable |= IXGBE_EIMS_LSC;
+			*eims_disable |= IXGBE_EIMS_LSC;
 		}
 
 		if ((hw->mac.type == ixgbe_mac_82599EB) &&
 		(eicr & IXGBE_EICR_GPI_SDP1_BY_MAC(hw))) {
 			task_requests |= IXGBE_REQUEST_TASK_MSF;
-			eims_disable |= IXGBE_EIMS_GPI_SDP1_BY_MAC(hw);
+			*eims_disable |= IXGBE_EIMS_GPI_SDP1_BY_MAC(hw);
 		}
 	}
 
@@ -3154,7 +3167,7 @@ ixgbe_msix_admin(void *arg)
 			if (!atomic_cas_uint(>fdir_reinit, 0, 1)) {
 task_requests |= IXGBE_REQUEST_TASK_FDIR;
 /* Disable the interrupt */
-eims_disable |= IXGBE_EIMS_FLOW_DIR;
+*eims_disable |= IXGBE_EIMS_FLOW_DIR;
 			}
 		}
 
@@ -3162,7 +3175,7 @@ ixgbe_msix_admin(void *arg)
 			device_printf(adapter->dev,
 			"CRITICAL: ECC ERROR!! Please Reboot!!\n");
 			/* Disable interrupt to prevent log spam */
-			eims_disable |= IXGBE_EICR_ECC;
+			*eims_disable |= IXGBE_EICR_ECC;
 		}
 
 		/* Check for over temp condition */
@@ -3172,7 +3185,7 @@ ixgbe_msix_admin(void *arg)
 if (!(eicr & IXGBE_EICR_GPI_SDP0_X550EM_a))
 	break;
 /* Disable interrupt to prevent log spam */
-eims_disable |= IXGBE_EICR_GPI_SDP0_X550EM_a;
+*eims_disable |= IXGBE_EICR_GPI_SDP0_X550EM_a;
 
 retval = hw->phy.ops.check_overtemp(hw);
 if (retval != IXGBE_ERR_OVERTEMP)
@@ -3184,7 +3197,7 @@ ixgbe_msix_admin(void *arg)
 if (!(eicr & IXGBE_EICR_TS))
 	break;
 /* Disable interrupt to prevent log spam */
-eims_disable |= IXGBE_EIMS_TS;
+*eims_disable |= IXGBE_EIMS_TS;
 
 retval = hw->phy.ops.check_overtemp(hw);
 if (retval != IXGBE_ERR_OVERTEMP)
@@ -3199,7 +3212,7 @@ ixgbe_msix_admin(void *arg)
 		if ((adapter->feat_en & IXGBE_FEATURE_SRIOV) &&
 		(eicr & IXGBE_EICR_MAILBOX)) {
 			task_requests |= IXGBE_REQUEST_TASK_MBX;
-			eims_disable |= IXGBE_EIMS_MAILBOX;
+			*eims_disable |= IXGBE_EIMS_MAILBOX;
 		}
 	}
 
@@ -3208,7 +3221,7 @@ ixgbe_msix_admin(void *arg)
 		retval = ixgbe_check_fan_failure(adapter, eicr, true);
 		if (retval == IXGBE_ERR_FAN_FAILURE) {
 			/* Disable interrupt to prevent log spam */
-			eims_disable |= IXGBE_EIMS_GPI_SDP1_BY_MAC(hw);
+			*eims_disable |= IXGBE_EIMS_GPI_SDP1_BY_MAC(hw);
 		}
 	}
 
@@ -3216,7 +3229,7 @@ ixgbe_msix_admin(void 

CVS commit: src/sys/arch/arm/rockchip

2020-12-31 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Thu Dec 31 11:36:13 UTC 2020

Modified Files:
src/sys/arch/arm/rockchip: rk3328_cru.h

Log Message:
Fix definition of RK3328_HCLK_I2S1_8CH


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/rockchip/rk3328_cru.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/rockchip/rk3328_cru.h
diff -u src/sys/arch/arm/rockchip/rk3328_cru.h:1.1 src/sys/arch/arm/rockchip/rk3328_cru.h:1.2
--- src/sys/arch/arm/rockchip/rk3328_cru.h:1.1	Sat Jun 16 00:19:04 2018
+++ src/sys/arch/arm/rockchip/rk3328_cru.h	Thu Dec 31 11:36:12 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: rk3328_cru.h,v 1.1 2018/06/16 00:19:04 jmcneill Exp $ */
+/* $NetBSD: rk3328_cru.h,v 1.2 2020/12/31 11:36:12 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -180,7 +180,7 @@
 #define RK3328_HCLK_TSP			309
 #define RK3328_HCLK_GMAC		310
 #define RK3328_HCLK_I2S0_8CH		311
-#define RK3328_HCLK_I2S1_8CH		313
+#define RK3328_HCLK_I2S1_8CH		312
 #define RK3328_HCLK_I2S2_2CH		313
 #define RK3328_HCLK_SPDIF_8CH		314
 #define RK3328_HCLK_VOP			315