CVS commit: src/sys/dev/ic
Module Name:src Committed By: mlelstv Date: Mon Mar 8 13:14:44 UTC 2021 Modified Files: src/sys/dev/ic: bcmgenet.c bcmgenetreg.h bcmgenetvar.h Log Message: Compute CRC for all segments of a multi-buffer packet. Add interrupt mitigation for transmit and receive. Use separate transmit lock. Fix some error paths. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/bcmgenet.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/bcmgenetreg.h cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/bcmgenetvar.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/ic/bcmgenet.c diff -u src/sys/dev/ic/bcmgenet.c:1.7 src/sys/dev/ic/bcmgenet.c:1.8 --- src/sys/dev/ic/bcmgenet.c:1.7 Sat Jun 27 13:34:20 2020 +++ src/sys/dev/ic/bcmgenet.c Mon Mar 8 13:14:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bcmgenet.c,v 1.7 2020/06/27 13:34:20 jmcneill Exp $ */ +/* $NetBSD: bcmgenet.c,v 1.8 2021/03/08 13:14:44 mlelstv Exp $ */ /*- * Copyright (c) 2020 Jared McNeill @@ -34,7 +34,7 @@ #include "opt_ddb.h" #include -__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.7 2020/06/27 13:34:20 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.8 2021/03/08 13:14:44 mlelstv Exp $"); #include #include @@ -72,20 +72,24 @@ CTASSERT(MCLBYTES == 2048); #define CALLOUT_FLAGS 0 #endif -#define TX_SKIP(n, o) (((n) + (o)) & (GENET_DMA_DESC_COUNT - 1)) -#define TX_NEXT(n) TX_SKIP(n, 1) -#define RX_NEXT(n) (((n) + 1) & (GENET_DMA_DESC_COUNT - 1)) - #define TX_MAX_SEGS 128 -#define TX_DESC_COUNT GENET_DMA_DESC_COUNT -#define RX_DESC_COUNT GENET_DMA_DESC_COUNT +#define TX_DESC_COUNT 256 /* GENET_DMA_DESC_COUNT */ +#define RX_DESC_COUNT 256 /* GENET_DMA_DESC_COUNT */ #define MII_BUSY_RETRY 1000 #define GENET_MAX_MDF_FILTER 17 +#define TX_SKIP(n, o) (((n) + (o)) % TX_DESC_COUNT) +#define TX_NEXT(n) TX_SKIP(n, 1) +#define RX_NEXT(n) (((n) + 1) % RX_DESC_COUNT) + #define GENET_LOCK(sc) mutex_enter(&(sc)->sc_lock) #define GENET_UNLOCK(sc) mutex_exit(&(sc)->sc_lock) #define GENET_ASSERT_LOCKED(sc) KASSERT(mutex_owned(&(sc)->sc_lock)) +#define GENET_TXLOCK(sc) mutex_enter(&(sc)->sc_txlock) +#define GENET_TXUNLOCK(sc) mutex_exit(&(sc)->sc_txlock) +#define GENET_ASSERT_TXLOCKED(sc) KASSERT(mutex_owned(&(sc)->sc_txlock)) + #define RD4(sc, reg) \ bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg)) #define WR4(sc, reg, val) \ @@ -190,7 +194,6 @@ genet_setup_txdesc(struct genet_softc *s uint32_t status; status = flags | __SHIFTIN(len, GENET_TX_DESC_STATUS_BUFLEN); - ++sc->sc_tx.queued; WR4(sc, GENET_TX_DESC_ADDRESS_LO(index), (uint32_t)paddr); WR4(sc, GENET_TX_DESC_ADDRESS_HI(index), (uint32_t)(paddr >> 32)); @@ -203,49 +206,58 @@ genet_setup_txbuf(struct genet_softc *sc bus_dma_segment_t *segs; int error, nsegs, cur, i; uint32_t flags; + bool nospace; + + /* at least one descriptor free ? */ + if (sc->sc_tx.queued >= TX_DESC_COUNT - 1) + return -1; error = bus_dmamap_load_mbuf(sc->sc_tx.buf_tag, sc->sc_tx.buf_map[index].map, m, BUS_DMA_WRITE | BUS_DMA_NOWAIT); if (error == EFBIG) { device_printf(sc->sc_dev, "TX packet needs too many DMA segments, dropping...\n"); - m_freem(m); - return 0; + return -2; } - if (error != 0) + if (error != 0) { + device_printf(sc->sc_dev, + "TX packet cannot be mapped, retried...\n"); return 0; + } segs = sc->sc_tx.buf_map[index].map->dm_segs; nsegs = sc->sc_tx.buf_map[index].map->dm_nsegs; - if (sc->sc_tx.queued >= GENET_DMA_DESC_COUNT - nsegs) { + nospace = sc->sc_tx.queued >= TX_DESC_COUNT - nsegs; + if (nospace) { bus_dmamap_unload(sc->sc_tx.buf_tag, sc->sc_tx.buf_map[index].map); + /* XXX coalesce and retry ? */ return -1; } + bus_dmamap_sync(sc->sc_tx.buf_tag, sc->sc_tx.buf_map[index].map, + 0, sc->sc_tx.buf_map[index].map->dm_mapsize, BUS_DMASYNC_PREWRITE); + + /* stored in same index as loaded map */ + sc->sc_tx.buf_map[index].mbuf = m; + flags = GENET_TX_DESC_STATUS_SOP | GENET_TX_DESC_STATUS_CRC | GENET_TX_DESC_STATUS_QTAG; for (cur = index, i = 0; i < nsegs; i++) { - sc->sc_tx.buf_map[cur].mbuf = (i == 0 ? m : NULL); if (i == nsegs - 1) flags |= GENET_TX_DESC_STATUS_EOP; genet_setup_txdesc(sc, cur, flags, segs[i].ds_addr, segs[i].ds_len); - if (i == 0) { + if (i == 0) flags &= ~GENET_TX_DESC_STATUS_SOP; - flags &= ~GENET_TX_DESC_STATUS_CRC; - } cur = TX_NEXT(cur); } - bus_dmamap_sync(sc->sc_tx.buf_tag, sc->sc_tx.buf_map[index].map, - 0, sc->sc_tx.buf_map[index].map->dm_mapsize, BUS_DMASYNC_PREWRITE); - return nsegs; } @@ -426,6 +438,43 @@ genet_reset(struct genet_softc *sc) } static void +genet_set_rxthresh(struct genet_softc *sc, int qid, int usecs, int count) +{ + int ticks; + uint32_t val; + + /* convert to 125MHz/1024 ticks */ + ticks = howmany(usecs * 125, 1024); + + if (count < 1) + count = 1; + if (coun
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: mlelstv Date: Mon Mar 8 13:15:06 UTC 2021 Modified Files: src/sys/dev/fdt: genet_fdt.c Log Message: Interrupt no longer needs kernel lock. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/genet_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/genet_fdt.c diff -u src/sys/dev/fdt/genet_fdt.c:1.4 src/sys/dev/fdt/genet_fdt.c:1.5 --- src/sys/dev/fdt/genet_fdt.c:1.4 Wed Jan 27 03:10:21 2021 +++ src/sys/dev/fdt/genet_fdt.c Mon Mar 8 13:15:06 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: genet_fdt.c,v 1.4 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: genet_fdt.c,v 1.5 2021/03/08 13:15:06 mlelstv Exp $ */ /*- * Copyright (c) 2020 Jared McNeill @@ -29,7 +29,7 @@ #include "opt_net_mpsafe.h" #include -__KERNEL_RCSID(0, "$NetBSD: genet_fdt.c,v 1.4 2021/01/27 03:10:21 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genet_fdt.c,v 1.5 2021/03/08 13:15:06 mlelstv Exp $"); #include #include @@ -126,7 +126,7 @@ genet_fdt_attach(device_t parent, device if (genet_attach(sc) != 0) return; - ih = fdtbus_intr_establish_xname(phandle, 0, IPL_NET, FDT_INTR_FLAGS, + ih = fdtbus_intr_establish_xname(phandle, 0, IPL_NET, FDT_INTR_MPSAFE, genet_intr, sc, device_xname(self)); if (ih == NULL) { aprint_error_dev(self, "couldn't establish interrupt on %s\n",
CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: mlelstv Date: Mon Mar 8 13:49:02 UTC 2021 Added Files: src/sys/arch/arm/broadcom: bcm2838_pcie.c bcm2838_pcie.h Log Message: RPI4 PCIe driver, based on pcihost_fdt.c To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/broadcom/bcm2838_pcie.c \ src/sys/arch/arm/broadcom/bcm2838_pcie.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/sys/arch/arm/broadcom/bcm2838_pcie.c diff -u /dev/null src/sys/arch/arm/broadcom/bcm2838_pcie.c:1.1 --- /dev/null Mon Mar 8 13:49:02 2021 +++ src/sys/arch/arm/broadcom/bcm2838_pcie.c Mon Mar 8 13:49:01 2021 @@ -0,0 +1,872 @@ +/* $NetBSD: bcm2838_pcie.c,v 1.1 2021/03/08 13:49:01 mlelstv Exp $ */ + +/*- + * Copyright (c) 2020 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Michael van Elst + * + * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``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 FOUNDATION OR CONTRIBUTORS + * 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: bcm2838_pcie.c,v 1.1 2021/03/08 13:49:01 mlelstv Exp $"); + +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include +#include + +#define PHYS_HI_RELO __BIT(31) +#define PHYS_HI_PREFETCH __BIT(30) +#define PHYS_HI_ALIASED __BIT(29) +#define PHYS_HI_SPACE __BITS(25,24) +#define PHYS_HI_SPACE_CFG 0 +#define PHYS_HI_SPACE_IO 1 +#define PHYS_HI_SPACE_MEM32 2 +#define PHYS_HI_SPACE_MEM64 3 + +#define CFG_OFFSET(b,d,f,r) ((b) << 16 | (d) << 1 | (f) << 8 | (r)) + +struct bcmstb_busspace { + struct bus_space bst; + int (*map)(void *, bus_addr_t, bus_size_t, +int, bus_space_handle_t *); + int flags; + struct { + bus_addr_t bpci; + bus_addr_t bbus; + bus_size_t size; + } ranges[4]; + size_t nranges; +}; + +struct bcmstb_softc { +bus_space_tag_t sc_bst; +bus_space_handle_t sc_bsh; + bus_dma_tag_t sc_dmat; + +kmutex_tsc_lock; +const char *sc_name; + + int sc_phandle; + + uint32_t sc_bus_min; + uint32_t sc_bus_max; + + struct arm32_pci_chipset sc_pc; + + struct bcmstb_busspace sc_io; + struct bcmstb_busspace sc_mem; + + int sc_pci_flags; +}; + +static void bcmstb_attach(device_t, struct bcmstb_softc *); +static int bcmstb_config(struct bcmstb_softc *); +static int bcmstb_setup(struct bcmstb_softc *); +static void bcmstb_attach_hook(device_t, device_t, struct pcibus_attach_args *); +static int bcmstb_bus_maxdevs(void *, int); +static pcitag_t bcmstb_make_tag(void *, int, int, int); +static void bcmstb_decompose_tag(void *, pcitag_t, int *, int *, int *); +static u_int bcmstb_get_segment(void *); +static pcireg_t bcmstb_conf_read(void *, pcitag_t, int); +static void bcmstb_conf_write(void *, pcitag_t, int, pcireg_t); +static int bcmstb_conf_hook(void *, int, int, int, pcireg_t); +static void bcmstb_conf_interrupt(void *, int, int, int, int, int *); + +static int bcmstb_intr_map(const struct pci_attach_args *, pci_intr_handle_t *); +static const char *bcmstb_intr_string(void *, pci_intr_handle_t, char *, size_t); +static const struct evcnt *bcmstb_intr_evcnt(void *, pci_intr_handle_t); +static int bcmstb_intr_setattr(void *, pci_intr_handle_t *, int, uint64_t); +static void *bcmstb_intr_establish(void *, pci_intr_handle_t, int, +int (*)(void *), void *, const char *); +static void bcmstb_intr_disestablish(void *, void *); +static int bcmstb_bus_space_map(void *, bus_addr_t, +bus_size_t, int, bus_space_handle_t *); + +struct bcm2838pcie_softc { + device_t sc_dev; + struct bcmstb_softc sc_bcmstb; +}; + +static int bcm
CVS commit: src/sys/arch/evbarm/rpi
Module Name:src Committed By: mlelstv Date: Mon Mar 8 13:53:08 UTC 2021 Modified Files: src/sys/arch/evbarm/rpi: rpi_vcmbox.c vcprop.h vcprop_subr.c Log Message: Add some firmware support functions and define more properties - framebuffer - power management - vchiq init - RPI4 USB firmware support To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/evbarm/rpi/rpi_vcmbox.c cvs rdiff -u -r1.19 -r1.20 src/sys/arch/evbarm/rpi/vcprop.h cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/rpi/vcprop_subr.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/evbarm/rpi/rpi_vcmbox.c diff -u src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.7 src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.8 --- src/sys/arch/evbarm/rpi/rpi_vcmbox.c:1.7 Tue Dec 1 04:14:31 2020 +++ src/sys/arch/evbarm/rpi/rpi_vcmbox.c Mon Mar 8 13:53:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rpi_vcmbox.c,v 1.7 2020/12/01 04:14:31 rin Exp $ */ +/* $NetBSD: rpi_vcmbox.c,v 1.8 2021/03/08 13:53:08 mlelstv Exp $ */ /*- * Copyright (c) 2013 Jared D. McNeill @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.7 2020/12/01 04:14:31 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rpi_vcmbox.c,v 1.8 2021/03/08 13:53:08 mlelstv Exp $"); #include #include @@ -65,19 +65,8 @@ struct vcmbox_clockrate_request { #define RATE2MHZ(rate) ((rate) / 100) #define MHZ2RATE(mhz) ((mhz) * 100) -#define VCMBOX_INIT_REQUEST(req) \ - do {\ - memset(&(req), 0, sizeof((req))); \ - (req).vb_hdr.vpb_len = htole32(sizeof((req))); \ - (req).vb_hdr.vpb_rcode = htole32(VCPROP_PROCESS_REQUEST);\ - (req).end.vpt_tag = htole32(VCPROPTAG_NULL); \ - } while (0) -#define VCMBOX_INIT_TAG(s, t) \ - do {\ - (s).tag.vpt_tag = htole32(t);\ - (s).tag.vpt_rcode = htole32(VCPROPTAG_REQUEST); \ - (s).tag.vpt_len = htole32(VCPROPTAG_LEN(s)); \ - } while (0) +#define VCMBOX_INIT_REQUEST(r) VCPROP_INIT_REQUEST(r) +#define VCMBOX_INIT_TAG(s, t) VCPROP_INIT_TAG(s, t) struct vcmbox_softc { device_t sc_dev; Index: src/sys/arch/evbarm/rpi/vcprop.h diff -u src/sys/arch/evbarm/rpi/vcprop.h:1.19 src/sys/arch/evbarm/rpi/vcprop.h:1.20 --- src/sys/arch/evbarm/rpi/vcprop.h:1.19 Tue Dec 1 04:14:31 2020 +++ src/sys/arch/evbarm/rpi/vcprop.h Mon Mar 8 13:53:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: vcprop.h,v 1.19 2020/12/01 04:14:31 rin Exp $ */ +/* $NetBSD: vcprop.h,v 1.20 2021/03/08 13:53:08 mlelstv Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -44,6 +44,8 @@ struct vcprop_tag { uint32_t vpt_tag; #define VCPROPTAG_NULL 0x #define VCPROPTAG_GET_FIRMWAREREV 0x0001 +#define VCPROPTAG_GET_FIRMWAREVARIANT 0x0002 +#define VCPROPTAG_GET_FIRMWAREHASH 0x0003 #define VCPROPTAG_GET_BOARDMODEL 0x00010001 #define VCPROPTAG_GET_BOARDREVISION 0x00010002 #define VCPROPTAG_GET_MACADDRESS 0x00010003 @@ -65,6 +67,11 @@ struct vcprop_tag { #define VCPROPTAG_GET_TURBO 0x00030009 #define VCPROPTAG_SET_TURBO 0x00038009 +#define VCPROPTAG_GET_STC 0x0003000b +#define VCPROPTAG_GET_THROTTLED 0x00030046 +#define VCPROPTAG_GET_CLOCK_MEASURED 0x00030047 +#define VCPROPTAG_NOTIFY_REBOOT 0x00030048 + #define VCPROPTAG_GET_VOLTAGE 0x00030003 #define VCPROPTAG_SET_VOLTAGE 0x00038003 #define VCPROPTAG_GET_MIN_VOLTAGE 0x00030008 @@ -73,24 +80,84 @@ struct vcprop_tag { #define VCPROPTAG_GET_TEMPERATURE 0x00030006 #define VCPROPTAG_GET_MAX_TEMPERATURE 0x0003000a +#define VCPROPTAG_GET_DOMAIN_STATE 0x00030030 +#define VCPROPTAG_SET_DOMAIN_STATE 0x00038030 + +#define VCPROPTAG_GET_GPIO_STATE 0x00030041 +#define VCPROPTAG_SET_GPIO_STATE 0x00038041 +#define VCPROPTAG_GET_GPIO_CONFIG 0x00030041 +#define VCPROPTAG_SET_GPIO_CONFIG 0x00038041 +#define VCPROPTAG_GET_PERIPH_REG 0x00030045 +#define VCPROPTAG_SET_PERIPH_REG 0x00038045 + +#define VCPROPTAG_GET_OTP 0x00030021 +#define VCPROPTAG_SET_OTP 0x00038021 + +#define VCPROPTAG_SET_SDHOST_CLOCK 0x00038042 + +#define VCPROPTAG_GET_POE_HAT_VAL 0x00030049 +#define VCPROPTAG_SET_POE_HAT_VAL 0x00030050 + +#define VCPROPTAG_NOTIFY_XHCI_RESET 0x00030058 + #define VCPROPTAG_GET_CMDLINE 0x00050001 #define VCPROPTAG_GET_DMACHAN 0x00060001 #define VCPROPTAG_ALLOCATE_BUFFER 0x00040001 +#define VCPROPTAG_RELEASE_BUFFER 0x00048001 #define VCPROPTAG_BLANK_SCREEN 0x00040002 #define VCPROPTAG_GET_FB_RES 0x00040003 +#define VCPROPTAG_TST_FB_RES 0x00044003 #define VCPROPTAG_SET_FB_RES 0x00048003 #define VCPROPTAG_GET_FB_VRES 0x00040004 +#define VCPROPTAG_TST_FB_VRES 0x00044004 #define VCPROPTAG_SET_FB_VRES 0x00048004 #define VCPROPTAG_GET_FB_DEPTH 0x00040005 +#define VCPROPTAG_TST_FB_DEPTH 0x00044005 #define VCPROPTAG_SET_FB_DEPTH 0x00048005 #define VCPROPTAG_GET_FB_PIXEL_ORDER 0x00040006 +#define VCPROPTAG_TST_FB_PIXEL_ORDER 0x00044006 #define VCPROPTAG_SET_FB_PIXEL_ORDER 0x00048006 #define VCPROPTAG_GET_FB_ALPHA_MODE 0x
CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: mlelstv Date: Mon Mar 8 13:59:29 UTC 2021 Modified Files: src/sys/arch/arm/broadcom: bcm2835_gpioreg.h Log Message: Undocumented register to multiplex emmc2 pins to legacy sdhc To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/broadcom/bcm2835_gpioreg.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/broadcom/bcm2835_gpioreg.h diff -u src/sys/arch/arm/broadcom/bcm2835_gpioreg.h:1.5 src/sys/arch/arm/broadcom/bcm2835_gpioreg.h:1.6 --- src/sys/arch/arm/broadcom/bcm2835_gpioreg.h:1.5 Sat Sep 28 07:24:52 2019 +++ src/sys/arch/arm/broadcom/bcm2835_gpioreg.h Mon Mar 8 13:59:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_gpioreg.h,v 1.5 2019/09/28 07:24:52 mlelstv Exp $ */ +/* $NetBSD: bcm2835_gpioreg.h,v 1.6 2021/03/08 13:59:29 mlelstv Exp $ */ /* * Copyright (c) 2013 Jonathan A. Kollasch @@ -73,4 +73,8 @@ #define BCM2835_GPIO_ALT2 6 #define BCM2835_GPIO_ALT3 7 +/* Undocumented register to multiplex emmc2 pins to legacy sdhc */ +#define BCM2838_GPIO_MUX 0x0d0 +#define BCM2838_GPIO_MUX_LEGACY 0x2 + #endif /* _BROADCOM_BCM2835_GPIOREG_H_ */
CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: mlelstv Date: Mon Mar 8 14:22:42 UTC 2021 Modified Files: src/sys/arch/arm/broadcom: bcm2835_intr.c bcm2835reg.h Log Message: Move interrupt register definitions to driver. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/arch/arm/broadcom/bcm2835_intr.c cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/broadcom/bcm2835reg.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/broadcom/bcm2835_intr.c diff -u src/sys/arch/arm/broadcom/bcm2835_intr.c:1.37 src/sys/arch/arm/broadcom/bcm2835_intr.c:1.38 --- src/sys/arch/arm/broadcom/bcm2835_intr.c:1.37 Wed Jan 27 03:10:19 2021 +++ src/sys/arch/arm/broadcom/bcm2835_intr.c Mon Mar 8 14:22:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835_intr.c,v 1.37 2021/01/27 03:10:19 thorpej Exp $ */ +/* $NetBSD: bcm2835_intr.c,v 1.38 2021/03/08 14:22:42 mlelstv Exp $ */ /*- * Copyright (c) 2012, 2015, 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.37 2021/01/27 03:10:19 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcm2835_intr.c,v 1.38 2021/03/08 14:22:42 mlelstv Exp $"); #define _INTR_PRIVATE @@ -104,6 +104,49 @@ static int bcm2836mp_int_base[BCM2836_NC #define BCM2835_INT_BASE bcm2835_int_base #define BCM2836_INT_BASECPUN(n) bcm2836mp_int_base[(n)] +#define BCM2836_INT_CNTPSIRQ_CPUN(n) (BCM2836_INT_BASECPUN(n) + BCM2836_INT_CNTPSIRQ) +#define BCM2836_INT_CNTPNSIRQ_CPUN(n) (BCM2836_INT_BASECPUN(n) + BCM2836_INT_CNTPNSIRQ) +#define BCM2836_INT_CNTVIRQ_CPUN(n) (BCM2836_INT_BASECPUN(n) + BCM2836_INT_CNTVIRQ) +#define BCM2836_INT_CNTHPIRQ_CPUN(n) (BCM2836_INT_BASECPUN(n) + BCM2836_INT_CNTHPIRQ) +#define BCM2836_INT_MAILBOX0_CPUN(n) (BCM2836_INT_BASECPUN(n) + BCM2836_INT_MAILBOX0) + +/* Periperal Interrupt sources */ +#define BCM2835_NIRQ 96 + +#define BCM2835_INT_GPU0BASE (BCM2835_INT_BASE + 0) +#define BCM2835_INT_TIMER0 (BCM2835_INT_GPU0BASE + 0) +#define BCM2835_INT_TIMER1 (BCM2835_INT_GPU0BASE + 1) +#define BCM2835_INT_TIMER2 (BCM2835_INT_GPU0BASE + 2) +#define BCM2835_INT_TIMER3 (BCM2835_INT_GPU0BASE + 3) +#define BCM2835_INT_USB (BCM2835_INT_GPU0BASE + 9) +#define BCM2835_INT_DMA0 (BCM2835_INT_GPU0BASE + 16) +#define BCM2835_INT_DMA2 (BCM2835_INT_GPU0BASE + 18) +#define BCM2835_INT_DMA3 (BCM2835_INT_GPU0BASE + 19) +#define BCM2835_INT_AUX (BCM2835_INT_GPU0BASE + 29) +#define BCM2835_INT_ARM (BCM2835_INT_GPU0BASE + 30) + +#define BCM2835_INT_GPU1BASE (BCM2835_INT_BASE + 32) +#define BCM2835_INT_GPIO0 (BCM2835_INT_GPU1BASE + 17) +#define BCM2835_INT_GPIO1 (BCM2835_INT_GPU1BASE + 18) +#define BCM2835_INT_GPIO2 (BCM2835_INT_GPU1BASE + 19) +#define BCM2835_INT_GPIO3 (BCM2835_INT_GPU1BASE + 20) +#define BCM2835_INT_BSC (BCM2835_INT_GPU1BASE + 21) +#define BCM2835_INT_SPI0 (BCM2835_INT_GPU1BASE + 22) +#define BCM2835_INT_PCM (BCM2835_INT_GPU1BASE + 23) +#define BCM2835_INT_SDHOST (BCM2835_INT_GPU1BASE + 24) +#define BCM2835_INT_UART0 (BCM2835_INT_GPU1BASE + 25) +#define BCM2835_INT_EMMC (BCM2835_INT_GPU1BASE + 30) + +#define BCM2835_INT_BASICBASE (BCM2835_INT_BASE + 64) +#define BCM2835_INT_ARMTIMER (BCM2835_INT_BASICBASE + 0) +#define BCM2835_INT_ARMMAILBOX (BCM2835_INT_BASICBASE + 1) +#define BCM2835_INT_ARMDOORBELL0 (BCM2835_INT_BASICBASE + 2) +#define BCM2835_INT_ARMDOORBELL1 (BCM2835_INT_BASICBASE + 3) +#define BCM2835_INT_GPU0HALTED (BCM2835_INT_BASICBASE + 4) +#define BCM2835_INT_GPU1HALTED (BCM2835_INT_BASICBASE + 5) +#define BCM2835_INT_ILLEGALTYPE0 (BCM2835_INT_BASICBASE + 6) +#define BCM2835_INT_ILLEGALTYPE1 (BCM2835_INT_BASICBASE + 7) + static void bcm2835_set_priority(struct pic_softc *pic, int ipl) { Index: src/sys/arch/arm/broadcom/bcm2835reg.h diff -u src/sys/arch/arm/broadcom/bcm2835reg.h:1.30 src/sys/arch/arm/broadcom/bcm2835reg.h:1.31 --- src/sys/arch/arm/broadcom/bcm2835reg.h:1.30 Sat Feb 22 00:17:54 2020 +++ src/sys/arch/arm/broadcom/bcm2835reg.h Mon Mar 8 14:22:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835reg.h,v 1.30 2020/02/22 00:17:54 jmcneill Exp $ */ +/* $NetBSD: bcm2835reg.h,v 1.31 2021/03/08 14:22:42 mlelstv Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -165,50 +165,6 @@ #define BCM2836_INT_TIMER 11 #define BCM2836_INT_NLOCAL 12 -#define BCM2836_INT_CNTPSIRQ_CPUN(n) (BCM2836_INT_BASECPUN(n) + BCM2836_INT_CNTPSIRQ) -#define BCM2836_INT_CNTPNSIRQ_CPUN(n) (BCM2836_INT_BASECPUN(n) + BCM2836_INT_CNTPNSIRQ) -#define BCM2836_INT_CNTVIRQ_CPUN(n) (BCM2836_INT_BASECPUN(n) + BCM2836_INT_CNTVIRQ) -#define BCM2836_INT_CNTHPIRQ_CPUN(n) (BCM2836_INT_BASECPUN(n) + BCM2836_INT_CNTHPIRQ) -#define BCM2836_INT_MAILBOX0_CPUN(n) (BCM2836_INT_BASECPUN(n) + BCM2836_INT_MAILBOX0) - -/* Periperal Interrupt sources */ -#define BCM2835_NIRQ 96 - -#define BCM2835_INT_GPU0BASE (BCM2835_INT_BASE + 0) -#define BCM2835_INT_TIMER0 (BCM2835_INT_GPU0BASE + 0) -#
CVS commit: src/sys/arch/arm/broadcom
Module Name:src Committed By: mlelstv Date: Mon Mar 8 14:27:46 UTC 2021 Modified Files: src/sys/arch/arm/broadcom: bcm2835reg.h Log Message: Add comments for 2711 local peripherals To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/arch/arm/broadcom/bcm2835reg.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/broadcom/bcm2835reg.h diff -u src/sys/arch/arm/broadcom/bcm2835reg.h:1.31 src/sys/arch/arm/broadcom/bcm2835reg.h:1.32 --- src/sys/arch/arm/broadcom/bcm2835reg.h:1.31 Mon Mar 8 14:22:42 2021 +++ src/sys/arch/arm/broadcom/bcm2835reg.h Mon Mar 8 14:27:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bcm2835reg.h,v 1.31 2021/03/08 14:22:42 mlelstv Exp $ */ +/* $NetBSD: bcm2835reg.h,v 1.32 2021/03/08 14:27:45 mlelstv Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -179,18 +179,18 @@ #define BCM2836_ARM_LOCAL_BASE 0x4000 #define BCM2836_ARM_LOCAL_SIZE 0x1000 /* 4KBytes */ -#define BCM2836_LOCAL_CONTROL 0x000 +#define BCM2836_LOCAL_CONTROL 0x000 /* ARM_CONTROL */ #define BCM2836_LOCAL_PRESCALER 0x008 -#define BCM2836_LOCAL_GPU_INT_ROUTING 0x00c -#define BCM2836_LOCAL_PM_ROUTING_SET 0x010 -#define BCM2836_LOCAL_PM_ROUTING_CLR 0x014 +#define BCM2836_LOCAL_GPU_INT_ROUTING 0x00c /* CORE_IRQ_CONTROL */ +#define BCM2836_LOCAL_PM_ROUTING_SET 0x010 /* PMU_CONTROL_SET */ +#define BCM2836_LOCAL_PM_ROUTING_CLR 0x014 /* PMU_CONTROL_CLR */ #define BCM2836_LOCAL_TIMER_LS 0x01c #define BCM2836_LOCAL_TIMER_MS 0x020 -#define BCM2836_LOCAL_INT_ROUTING 0x024 +#define BCM2836_LOCAL_INT_ROUTING 0x024 /* PERI_IRQ_ROUTE0 */ #define BCM2836_LOCAL_AXI_COUNT 0x02c -#define BCM2836_LOCAL_AXI_IRQ 0x030 +#define BCM2836_LOCAL_AXI_IRQ 0x030 /* AXI_QUIET_TIME */ #define BCM2836_LOCAL_TIMER_CONTROL 0x034 -#define BCM2836_LOCAL_TIMER_WRITE 0x038 +#define BCM2836_LOCAL_TIMER_WRITE 0x038 /* LOCAL_TIMER_IRQ */ #define BCM2836_LOCAL_TIMER_IRQ_CONTROL_BASE 0x40
CVS commit: src/sys/arch/m68k/fpe
Module Name:src Committed By: isaki Date: Mon Mar 8 14:37:55 UTC 2021 Modified Files: src/sys/arch/m68k/fpe: fpu_explode.c Log Message: Remove incorrect byte and word conversions from fpu_explode. The correct operation here is arithmetic right shift, but nobody calls it. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/m68k/fpe/fpu_explode.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/m68k/fpe/fpu_explode.c diff -u src/sys/arch/m68k/fpe/fpu_explode.c:1.15 src/sys/arch/m68k/fpe/fpu_explode.c:1.16 --- src/sys/arch/m68k/fpe/fpu_explode.c:1.15 Thu Feb 5 12:23:27 2015 +++ src/sys/arch/m68k/fpe/fpu_explode.c Mon Mar 8 14:37:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fpu_explode.c,v 1.15 2015/02/05 12:23:27 isaki Exp $ */ +/* $NetBSD: fpu_explode.c,v 1.16 2021/03/08 14:37:55 isaki Exp $ */ /* * Copyright (c) 1992, 1993 @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.15 2015/02/05 12:23:27 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fpu_explode.c,v 1.16 2021/03/08 14:37:55 isaki Exp $"); #include #include @@ -230,11 +230,6 @@ fpu_explode(struct fpemu *fe, struct fpn fp->fp_sign = s >> 31; fp->fp_sticky = 0; switch (type) { - - case FTYPE_BYT: - s >>= 8; - case FTYPE_WRD: - s >>= 16; case FTYPE_LNG: s = fpu_itof(fp, s); break; @@ -251,6 +246,10 @@ fpu_explode(struct fpemu *fe, struct fpn s = fpu_xtof(fp, s, space[1], space[2]); break; + case FTYPE_BYT: + case FTYPE_WRD: + /* Caller must cast it to signed LNG instead of calling this */ + /* FALLTHROUGH */ default: panic("fpu_explode"); }
CVS commit: src/lib/libpuffs
Module Name:src Committed By: christos Date: Mon Mar 8 17:34:10 UTC 2021 Modified Files: src/lib/libpuffs: dispatcher.c opdump.c Log Message: cast to the proper enums for lint To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/lib/libpuffs/dispatcher.c cvs rdiff -u -r1.37 -r1.38 src/lib/libpuffs/opdump.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libpuffs/dispatcher.c diff -u src/lib/libpuffs/dispatcher.c:1.48 src/lib/libpuffs/dispatcher.c:1.49 --- src/lib/libpuffs/dispatcher.c:1.48 Fri Oct 31 09:56:04 2014 +++ src/lib/libpuffs/dispatcher.c Mon Mar 8 12:34:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dispatcher.c,v 1.48 2014/10/31 13:56:04 manu Exp $ */ +/* $NetBSD: dispatcher.c,v 1.49 2021/03/08 17:34:10 christos Exp $ */ /* * Copyright (c) 2006, 2007, 2008 Antti Kantee. All Rights Reserved. @@ -31,7 +31,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: dispatcher.c,v 1.48 2014/10/31 13:56:04 manu Exp $"); +__RCSID("$NetBSD: dispatcher.c,v 1.49 2021/03/08 17:34:10 christos Exp $"); #endif /* !lint */ #include @@ -164,7 +164,7 @@ dispatch(struct puffs_cc *pcc) /* Execute actual operation */ if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VFS) { - switch (preq->preq_optype) { + switch ((enum puffs_vfs)preq->preq_optype) { case PUFFS_VFS_UNMOUNT: { struct puffs_vfsmsg_unmount *auxt = auxbuf; @@ -260,7 +260,7 @@ dispatch(struct puffs_cc *pcc) /* XXX: audit return values */ /* XXX: sync with kernel */ } else if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VN) { - switch (preq->preq_optype) { + switch ((enum puffs_vn)preq->preq_optype) { case PUFFS_VN_LOOKUP: { struct puffs_vnmsg_lookup *auxt = auxbuf; Index: src/lib/libpuffs/opdump.c diff -u src/lib/libpuffs/opdump.c:1.37 src/lib/libpuffs/opdump.c:1.38 --- src/lib/libpuffs/opdump.c:1.37 Fri Oct 31 09:56:04 2014 +++ src/lib/libpuffs/opdump.c Mon Mar 8 12:34:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: opdump.c,v 1.37 2014/10/31 13:56:04 manu Exp $ */ +/* $NetBSD: opdump.c,v 1.38 2021/03/08 17:34:10 christos Exp $ */ /* * Copyright (c) 2005, 2006 Antti Kantee. All Rights Reserved. @@ -35,7 +35,7 @@ #include #if !defined(lint) -__RCSID("$NetBSD: opdump.c,v 1.37 2014/10/31 13:56:04 manu Exp $"); +__RCSID("$NetBSD: opdump.c,v 1.38 2021/03/08 17:34:10 christos Exp $"); #endif /* !lint */ #include @@ -215,7 +215,7 @@ puffsdump_req(struct puffs_req *preq) preq->preq_pid, preq->preq_lid); if (isvn) { - switch (preq->preq_optype) { + switch ((enum puffs_vn)preq->preq_optype) { case PUFFS_VN_LOOKUP: puffsdump_lookup(preq); break; @@ -262,7 +262,7 @@ puffsdump_rv(struct puffs_req *preq) { if (PUFFSOP_OPCLASS(preq->preq_opclass) == PUFFSOP_VN) { - switch (preq->preq_optype) { + switch ((enum puffs_vn)preq->preq_optype) { case PUFFS_VN_LOOKUP: puffsdump_lookup_rv(preq); break;
CVS commit: src/sys/fs/puffs
Module Name:src Committed By: christos Date: Mon Mar 8 17:34:30 UTC 2021 Modified Files: src/sys/fs/puffs: puffs_msgif.h Log Message: give names to the enums so we can cast by name for lint To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/fs/puffs/puffs_msgif.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/fs/puffs/puffs_msgif.h diff -u src/sys/fs/puffs/puffs_msgif.h:1.85 src/sys/fs/puffs/puffs_msgif.h:1.86 --- src/sys/fs/puffs/puffs_msgif.h:1.85 Mon Sep 23 08:00:57 2019 +++ src/sys/fs/puffs/puffs_msgif.h Mon Mar 8 12:34:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: puffs_msgif.h,v 1.85 2019/09/23 12:00:57 christos Exp $ */ +/* $NetBSD: puffs_msgif.h,v 1.86 2021/03/08 17:34:30 christos Exp $ */ /* * Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved. @@ -61,7 +61,7 @@ #define PUFFSOP_OPCLASS(a) ((a) & PUFFSOP_OPCMASK) #define PUFFSOP_WANTREPLY(a) (((a) & PUFFSOPFLAG_FAF) == 0) -enum { +enum puffs_vfs { PUFFS_VFS_MOUNT, PUFFS_VFS_START, PUFFS_VFS_UNMOUNT, PUFFS_VFS_ROOT, PUFFS_VFS_QUOTACTL, PUFFS_VFS_STATVFS, PUFFS_VFS_SYNC, PUFFS_VFS_VGET, PUFFS_VFS_FHTOVP, @@ -70,7 +70,7 @@ enum { }; #define PUFFS_VFS_MAX PUFFS_VFS_SUSPEND -enum { +enum puffs_vn { PUFFS_VN_LOOKUP, PUFFS_VN_CREATE, PUFFS_VN_MKNOD, PUFFS_VN_OPEN, PUFFS_VN_CLOSE, PUFFS_VN_ACCESS, PUFFS_VN_GETATTR, PUFFS_VN_SETATTR, PUFFS_VN_READ, @@ -96,7 +96,7 @@ enum { /* * These signal invalid parameters the file system returned. */ -enum { +enum puffs_err { PUFFS_ERR_ERROR, PUFFS_ERR_MAKENODE, PUFFS_ERR_LOOKUP, PUFFS_ERR_READDIR, PUFFS_ERR_READLINK, PUFFS_ERR_READ, PUFFS_ERR_WRITE,
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 17:53:20 UTC 2021 Modified Files: src/sys/netinet: tcp_subr.c Log Message: Don't increment the iss sequence on each connection because it exposes information (Amit Klein) To generate a diff of this commit: cvs rdiff -u -r1.285 -r1.286 src/sys/netinet/tcp_subr.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/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.285 src/sys/netinet/tcp_subr.c:1.286 --- src/sys/netinet/tcp_subr.c:1.285 Sun Mar 7 09:58:54 2021 +++ src/sys/netinet/tcp_subr.c Mon Mar 8 12:53:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.285 2021/03/07 14:58:54 christos Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.286 2021/03/08 17:53:20 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.285 2021/03/07 14:58:54 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.286 2021/03/08 17:53:20 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2216,7 +2216,6 @@ tcp_new_iss1(void *laddr, void *faddr, u * XXX Use `addin'? * XXX TCP_ISSINCR too large to use? */ - tcp_iss_seq += TCP_ISSINCR; #ifdef TCPISS_DEBUG printf("ISS hash 0x%08x, ", tcp_iss); #endif @@ -2252,7 +2251,6 @@ tcp_new_iss1(void *laddr, void *faddr, u } else { tcp_iss &= TCP_ISS_RANDOM_MASK; tcp_iss += tcp_iss_seq; - tcp_iss_seq += TCP_ISSINCR; #ifdef TCPISS_DEBUG printf("ISS %08x\n", tcp_iss); #endif
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 17:54:23 UTC 2021 Modified Files: src/sys/netinet: in_var.h Log Message: Use a random IPv4 ID because the shuffling algorithm used before could expose information (Amit Klein) To generate a diff of this commit: cvs rdiff -u -r1.98 -r1.99 src/sys/netinet/in_var.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/netinet/in_var.h diff -u src/sys/netinet/in_var.h:1.98 src/sys/netinet/in_var.h:1.99 --- src/sys/netinet/in_var.h:1.98 Fri Sep 11 11:22:12 2020 +++ src/sys/netinet/in_var.h Mon Mar 8 12:54:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in_var.h,v 1.98 2020/09/11 15:22:12 roy Exp $ */ +/* $NetBSD: in_var.h,v 1.99 2021/03/08 17:54:23 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -65,6 +65,7 @@ #define _NETINET_IN_VAR_H_ #include +#include #define IN_IFF_TENTATIVE 0x01 /* tentative address */ #define IN_IFF_DUPLICATED 0x02 /* DAD detected duplicate */ @@ -469,7 +470,8 @@ ip_newid_range(const struct in_ifaddr *i if (ip_do_randomid) { /* XXX ignore num */ - return ip_randomid(ip_ids, ia ? ia->ia_idsalt : 0); + id = (uint16_t)cprng_fast32(); + return id ? id : 1; } /* Never allow an IP ID of 0 (detect wrap). */
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 17:54:43 UTC 2021 Modified Files: src/sys/netinet: tcp_timer.c Log Message: Add some randomness to the iss offset To generate a diff of this commit: cvs rdiff -u -r1.95 -r1.96 src/sys/netinet/tcp_timer.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/netinet/tcp_timer.c diff -u src/sys/netinet/tcp_timer.c:1.95 src/sys/netinet/tcp_timer.c:1.96 --- src/sys/netinet/tcp_timer.c:1.95 Thu May 3 03:13:48 2018 +++ src/sys/netinet/tcp_timer.c Mon Mar 8 12:54:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_timer.c,v 1.95 2018/05/03 07:13:48 maxv Exp $ */ +/* $NetBSD: tcp_timer.c,v 1.96 2021/03/08 17:54:43 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.95 2018/05/03 07:13:48 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.96 2021/03/08 17:54:43 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -111,6 +111,7 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_timer.c, #include #include #include +#include #include @@ -257,7 +258,7 @@ tcp_slowtimo_work(struct work *wk, void { mutex_enter(softnet_lock); - tcp_iss_seq += TCP_ISSINCR; /* increment iss */ + tcp_iss_seq += TCP_ISSINCR + (TCP_ISS_RANDOM_MASK & cprng_fast32()); tcp_now++; /* for timestamps */ mutex_exit(softnet_lock);
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 18:03:25 UTC 2021 Modified Files: src/sys/netinet: files.netinet in_var.h ip_input.c Removed Files: src/sys/netinet: ip_id.c Log Message: remove now unused pseudo-random ip id code. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/netinet/files.netinet cvs rdiff -u -r1.99 -r1.100 src/sys/netinet/in_var.h cvs rdiff -u -r1.16 -r0 src/sys/netinet/ip_id.c cvs rdiff -u -r1.400 -r1.401 src/sys/netinet/ip_input.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/netinet/files.netinet diff -u src/sys/netinet/files.netinet:1.28 src/sys/netinet/files.netinet:1.29 --- src/sys/netinet/files.netinet:1.28 Sat Jul 29 01:48:16 2017 +++ src/sys/netinet/files.netinet Mon Mar 8 13:03:25 2021 @@ -1,4 +1,4 @@ -# $NetBSD: files.netinet,v 1.28 2017/07/29 05:48:16 maxv Exp $ +# $NetBSD: files.netinet,v 1.29 2021/03/08 18:03:25 christos Exp $ defflag opt_tcp_debug.h TCP_DEBUG defparam opt_tcp_debug.h TCP_NDEBUG @@ -34,7 +34,6 @@ file netinet/in_proto.c inet file netinet/in_selsrc.c inet & ipselsrc file netinet/ip_flow.c inet & gateway file netinet/ip_icmp.c inet -file netinet/ip_id.c inet file netinet/ip_input.c inet file netinet/ip_mroute.c inet & mrouting file netinet/ip_output.c inet Index: src/sys/netinet/in_var.h diff -u src/sys/netinet/in_var.h:1.99 src/sys/netinet/in_var.h:1.100 --- src/sys/netinet/in_var.h:1.99 Mon Mar 8 12:54:23 2021 +++ src/sys/netinet/in_var.h Mon Mar 8 13:03:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in_var.h,v 1.99 2021/03/08 17:54:23 christos Exp $ */ +/* $NetBSD: in_var.h,v 1.100 2021/03/08 18:03:25 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -447,14 +447,6 @@ void in_addrhash_insert(struct in_ifaddr void in_addrhash_remove(struct in_ifaddr *); int ipflow_fastforward(struct mbuf *); -struct ipid_state; -typedef struct ipid_state ipid_state_t; - -ipid_state_t * ip_id_init(void); -void ip_id_fini(ipid_state_t *); -uint16_t ip_randomid(ipid_state_t *, uint16_t); - -extern ipid_state_t * ip_ids; extern uint16_t ip_id; extern int ip_do_randomid; Index: src/sys/netinet/ip_input.c diff -u src/sys/netinet/ip_input.c:1.400 src/sys/netinet/ip_input.c:1.401 --- src/sys/netinet/ip_input.c:1.400 Sun Mar 7 09:58:27 2021 +++ src/sys/netinet/ip_input.c Mon Mar 8 13:03:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_input.c,v 1.400 2021/03/07 14:58:27 christos Exp $ */ +/* $NetBSD: ip_input.c,v 1.401 2021/03/08 18:03:25 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.400 2021/03/07 14:58:27 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_input.c,v 1.401 2021/03/08 18:03:25 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -189,7 +189,6 @@ struct rttimer_queue *ip_mtudisc_timeout pktqueue_t * ip_pktq __read_mostly; pfil_head_t * inet_pfil_hook __read_mostly; -ipid_state_t * ip_ids __read_mostly; percpu_t * ipstat_percpu __read_mostly; static percpu_t *ipforward_rt_percpu __cacheline_aligned; @@ -291,7 +290,6 @@ ip_init(void) ip_reass_init(); - ip_ids = ip_id_init(); ip_id = time_uptime & 0xf; #ifdef GATEWAY
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 18:17:27 UTC 2021 Modified Files: src/sys/netinet: tcp_input.c tcp_subr.c tcp_usrreq.c tcp_var.h Log Message: Remove the unused "addin" argument (it was always 0) and go back using a random iss by default (instead of rfc1948) To generate a diff of this commit: cvs rdiff -u -r1.427 -r1.428 src/sys/netinet/tcp_input.c cvs rdiff -u -r1.286 -r1.287 src/sys/netinet/tcp_subr.c cvs rdiff -u -r1.228 -r1.229 src/sys/netinet/tcp_usrreq.c cvs rdiff -u -r1.194 -r1.195 src/sys/netinet/tcp_var.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/netinet/tcp_input.c diff -u src/sys/netinet/tcp_input.c:1.427 src/sys/netinet/tcp_input.c:1.428 --- src/sys/netinet/tcp_input.c:1.427 Fri Feb 19 10:43:56 2021 +++ src/sys/netinet/tcp_input.c Mon Mar 8 13:17:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_input.c,v 1.427 2021/02/19 15:43:56 jakllsch Exp $ */ +/* $NetBSD: tcp_input.c,v 1.428 2021/03/08 18:17:27 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -148,7 +148,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.427 2021/02/19 15:43:56 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.428 2021/03/08 18:17:27 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -4258,7 +4258,7 @@ syn_cache_add(struct sockaddr *src, stru sc->sc_iss = tcp_new_iss1(&dstin->sin_addr, &srcin->sin_addr, dstin->sin_port, - srcin->sin_port, sizeof(dstin->sin_addr), 0); + srcin->sin_port, sizeof(dstin->sin_addr)); break; } #ifdef INET6 @@ -4269,7 +4269,7 @@ syn_cache_add(struct sockaddr *src, stru sc->sc_iss = tcp_new_iss1(&dstin6->sin6_addr, &srcin6->sin6_addr, dstin6->sin6_port, - srcin6->sin6_port, sizeof(dstin6->sin6_addr), 0); + srcin6->sin6_port, sizeof(dstin6->sin6_addr)); break; } #endif Index: src/sys/netinet/tcp_subr.c diff -u src/sys/netinet/tcp_subr.c:1.286 src/sys/netinet/tcp_subr.c:1.287 --- src/sys/netinet/tcp_subr.c:1.286 Mon Mar 8 12:53:20 2021 +++ src/sys/netinet/tcp_subr.c Mon Mar 8 13:17:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_subr.c,v 1.286 2021/03/08 17:53:20 christos Exp $ */ +/* $NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -91,7 +91,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.286 2021/03/08 17:53:20 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.287 2021/03/08 18:17:27 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -163,7 +163,7 @@ int tcp_mssdflt = TCP_MSS; int tcp_minmss = TCP_MINMSS; int tcp_rttdflt = TCPTV_SRTTDFLT / PR_SLOWHZ; int tcp_do_rfc1323 = 1; /* window scaling / timestamps (obsolete) */ -int tcp_do_rfc1948 = 1; /* ISS by cryptographic hash */ +int tcp_do_rfc1948 = 0; /* ISS by cryptographic hash */ int tcp_do_sack = 1; /* selective acknowledgement */ int tcp_do_win_scale = 1; /* RFC1323 window scaling */ int tcp_do_timestamps = 1; /* RFC1323 timestamps */ @@ -2136,21 +2136,19 @@ tcp_seq tcp_iss_seq = 0; /* tcp initial * Get a new sequence value given a tcp control block */ tcp_seq -tcp_new_iss(struct tcpcb *tp, tcp_seq addin) +tcp_new_iss(struct tcpcb *tp) { if (tp->t_inpcb != NULL) { - return (tcp_new_iss1(&tp->t_inpcb->inp_laddr, + return tcp_new_iss1(&tp->t_inpcb->inp_laddr, &tp->t_inpcb->inp_faddr, tp->t_inpcb->inp_lport, - tp->t_inpcb->inp_fport, sizeof(tp->t_inpcb->inp_laddr), - addin)); + tp->t_inpcb->inp_fport, sizeof(tp->t_inpcb->inp_laddr)); } #ifdef INET6 if (tp->t_in6pcb != NULL) { - return (tcp_new_iss1(&tp->t_in6pcb->in6p_laddr, + return tcp_new_iss1(&tp->t_in6pcb->in6p_laddr, &tp->t_in6pcb->in6p_faddr, tp->t_in6pcb->in6p_lport, - tp->t_in6pcb->in6p_fport, sizeof(tp->t_in6pcb->in6p_laddr), - addin)); + tp->t_in6pcb->in6p_fport, sizeof(tp->t_in6pcb->in6p_laddr)); } #endif @@ -2176,7 +2174,7 @@ tcp_iss_secret_init(void) */ tcp_seq tcp_new_iss1(void *laddr, void *faddr, u_int16_t lport, u_int16_t fport, -size_t addrsz, tcp_seq addin) +size_t addrsz) { tcp_seq tcp_iss; @@ -2209,55 +2207,27 @@ tcp_new_iss1(void *laddr, void *faddr, u memcpy(&tcp_iss, hash, sizeof(tcp_iss)); - /* - * Now increment our "timer", and add it in to - * the computed value. - * - * XXX Use `addin'? - * XXX TCP_ISSINCR too large to use? - */ #ifdef TCPISS_DEBUG printf("ISS hash 0x%08x, ", tcp_iss); #endif - tcp_iss += tcp_iss_seq + addin; + /* + * Add the offset in to the computed value. + */ + tcp_iss += tcp_iss_seq; #ifdef TCPISS_DEBUG - printf("new ISS 0x%08x\n", tcp_iss); + printf("ISS %08x\n", tcp_iss); #endif } else { /* * Randomize. */ tcp_iss = cprng_fast32(); - - /* - * If we were asked to add some amount to a known
CVS commit: src/sys/netinet6
Module Name:src Committed By: christos Date: Mon Mar 8 18:22:16 UTC 2021 Modified Files: src/sys/netinet6: files.netinet6 ip6_var.h Removed Files: src/sys/netinet6: ip6_id.c Log Message: no need for ip6_id.c... To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.14 src/sys/netinet6/files.netinet6 cvs rdiff -u -r1.21 -r0 src/sys/netinet6/ip6_id.c cvs rdiff -u -r1.88 -r1.89 src/sys/netinet6/ip6_var.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/netinet6/files.netinet6 diff -u src/sys/netinet6/files.netinet6:1.13 src/sys/netinet6/files.netinet6:1.14 --- src/sys/netinet6/files.netinet6:1.13 Thu Feb 8 06:34:35 2018 +++ src/sys/netinet6/files.netinet6 Mon Mar 8 13:22:16 2021 @@ -1,4 +1,4 @@ -# $NetBSD: files.netinet6,v 1.13 2018/02/08 11:34:35 maxv Exp $ +# $NetBSD: files.netinet6,v 1.14 2021/03/08 18:22:16 christos Exp $ defflag opt_inet6.h RFC2292 @@ -17,7 +17,6 @@ file netinet6/in6_proto.c inet6 file netinet6/in6_src.c inet6 file netinet6/ip6_flow.c inet6 & gateway file netinet6/ip6_forward.c inet6 -file netinet6/ip6_id.c inet6 file netinet6/ip6_input.c inet6 file netinet6/ip6_mroute.c inet6 file netinet6/ip6_output.c inet6 Index: src/sys/netinet6/ip6_var.h diff -u src/sys/netinet6/ip6_var.h:1.88 src/sys/netinet6/ip6_var.h:1.89 --- src/sys/netinet6/ip6_var.h:1.88 Sun Mar 7 10:01:35 2021 +++ src/sys/netinet6/ip6_var.h Mon Mar 8 13:22:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ip6_var.h,v 1.88 2021/03/07 15:01:35 christos Exp $ */ +/* $NetBSD: ip6_var.h,v 1.89 2021/03/08 18:22:16 christos Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -228,6 +228,7 @@ struct ip6flow { #ifdef _KERNEL #include +#include /* * Auxiliary attributes of incoming IPv6 packets, which is initialized when we @@ -370,10 +371,21 @@ int in6_selectroute(struct sockaddr_in6 int ip6_get_membership(const struct sockopt *, struct ifnet **, struct psref *, void *, size_t); -u_int32_t ip6_randomid(void); -u_int32_t ip6_randomflowlabel(void); +static __inline uint32_t +ip6_randomid(void) +{ + + return cprng_fast32(); +} + +static __inline uint32_t +ip6_randomflowlabel(void) +{ + + return cprng_fast32() && 0xf; +} -static inline bool +static __inline bool ip6_dad_enabled(void) {
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Mon Mar 8 19:06:49 UTC 2021 Modified Files: src/usr.bin/indent: indent.c Log Message: indent: fix printing of uninitialized 'token' in debug output To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/usr.bin/indent/indent.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.32 src/usr.bin/indent/indent.c:1.33 --- src/usr.bin/indent/indent.c:1.32 Sun Mar 7 20:52:11 2021 +++ src/usr.bin/indent/indent.c Mon Mar 8 19:06:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.32 2021/03/07 20:52:11 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.33 2021/03/08 19:06:48 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.32 2021/03/07 20:52:11 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.33 2021/03/08 19:06:48 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -192,7 +192,7 @@ main(int argc, char **argv) l_token = tokenbuf + bufsize - 5; combuf[0] = codebuf[0] = labbuf[0] = ' '; /* set up code, label, and * comment buffers */ -combuf[1] = codebuf[1] = labbuf[1] = '\0'; +combuf[1] = codebuf[1] = labbuf[1] = tokenbuf[1] = '\0'; opt.else_if = 1; /* Default else-if special processing to on */ s_lab = e_lab = labbuf + 1; s_code = e_code = codebuf + 1;
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Mon Mar 8 19:21:41 UTC 2021 Modified Files: src/usr.bin/indent: Makefile Log Message: indent: make it easy to compile indent in debug mode To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/usr.bin/indent/Makefile 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/indent/Makefile diff -u src/usr.bin/indent/Makefile:1.8 src/usr.bin/indent/Makefile:1.9 --- src/usr.bin/indent/Makefile:1.8 Sun Mar 7 10:56:18 2021 +++ src/usr.bin/indent/Makefile Mon Mar 8 19:21:41 2021 @@ -1,10 +1,11 @@ -# $NetBSD: Makefile,v 1.8 2021/03/07 10:56:18 rillig Exp $ +# $NetBSD: Makefile,v 1.9 2021/03/08 19:21:41 rillig Exp $ # from: @(#)Makefile 8.1 (Berkeley) 6/6/93 PROG= indent SRCS= indent.c io.c lexi.c parse.c pr_comment.c args.c COPTS.io.c += -Wno-error=format-nonliteral +CPPFLAGS+= ${DEBUG:D-Ddebug} LINTFLAGS+= -e
CVS commit: src/external/bsd/openpam/dist
Module Name:src Committed By: christos Date: Mon Mar 8 19:38:10 UTC 2021 Modified Files: src/external/bsd/openpam/dist/include/security: openpam.h pam_constants.h src/external/bsd/openpam/dist/lib/libpam: openpam_dispatch.c openpam_log.c openpam_ttyconv.c pam_get_authtok.c pam_get_item.c pam_set_item.c Log Message: Appease new lint enum errors To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 \ src/external/bsd/openpam/dist/include/security/openpam.h cvs rdiff -u -r1.6 -r1.7 \ src/external/bsd/openpam/dist/include/security/pam_constants.h cvs rdiff -u -r1.3 -r1.4 \ src/external/bsd/openpam/dist/lib/libpam/openpam_dispatch.c \ src/external/bsd/openpam/dist/lib/libpam/openpam_log.c \ src/external/bsd/openpam/dist/lib/libpam/openpam_ttyconv.c \ src/external/bsd/openpam/dist/lib/libpam/pam_get_authtok.c \ src/external/bsd/openpam/dist/lib/libpam/pam_get_item.c \ src/external/bsd/openpam/dist/lib/libpam/pam_set_item.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/bsd/openpam/dist/include/security/openpam.h diff -u src/external/bsd/openpam/dist/include/security/openpam.h:1.10 src/external/bsd/openpam/dist/include/security/openpam.h:1.11 --- src/external/bsd/openpam/dist/include/security/openpam.h:1.10 Tue Apr 28 22:16:56 2020 +++ src/external/bsd/openpam/dist/include/security/openpam.h Mon Mar 8 14:38:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: openpam.h,v 1.10 2020/04/29 02:16:56 riastradh Exp $ */ +/* $NetBSD: openpam.h,v 1.11 2021/03/08 19:38:10 christos Exp $ */ /*- * Copyright (c) 2002-2003 Networks Associates Technology, Inc. @@ -201,7 +201,7 @@ openpam_get_feature(int _feature, int *_ /* * Log levels */ -enum { +enum openpam_log_primitives { PAM_LOG_LIBDEBUG = -1, PAM_LOG_DEBUG, PAM_LOG_VERBOSE, @@ -264,7 +264,7 @@ int openpam_nullconv(int _n, /* * PAM primitives */ -enum { +enum openpam_sm_primitives { PAM_SM_AUTHENTICATE, PAM_SM_SETCRED, PAM_SM_ACCT_MGMT, Index: src/external/bsd/openpam/dist/include/security/pam_constants.h diff -u src/external/bsd/openpam/dist/include/security/pam_constants.h:1.6 src/external/bsd/openpam/dist/include/security/pam_constants.h:1.7 --- src/external/bsd/openpam/dist/include/security/pam_constants.h:1.6 Sat May 6 15:50:09 2017 +++ src/external/bsd/openpam/dist/include/security/pam_constants.h Mon Mar 8 14:38:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pam_constants.h,v 1.6 2017/05/06 19:50:09 christos Exp $ */ +/* $NetBSD: pam_constants.h,v 1.7 2021/03/08 19:38:10 christos Exp $ */ /*- * Copyright (c) 2002-2003 Networks Associates Technology, Inc. @@ -90,7 +90,7 @@ enum { /* * XSSO 5.3 */ -enum { +enum openpam_message_items { PAM_PROMPT_ECHO_OFF = 1, PAM_PROMPT_ECHO_ON = 2, PAM_ERROR_MSG = 3, @@ -119,7 +119,7 @@ enum { /* * XSSO 5.5 */ -enum { +enum openpam_item_primitives { PAM_SERVICE = 1, PAM_USER = 2, PAM_TTY= 3, Index: src/external/bsd/openpam/dist/lib/libpam/openpam_dispatch.c diff -u src/external/bsd/openpam/dist/lib/libpam/openpam_dispatch.c:1.3 src/external/bsd/openpam/dist/lib/libpam/openpam_dispatch.c:1.4 --- src/external/bsd/openpam/dist/lib/libpam/openpam_dispatch.c:1.3 Sat May 6 15:50:09 2017 +++ src/external/bsd/openpam/dist/lib/libpam/openpam_dispatch.c Mon Mar 8 14:38:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: openpam_dispatch.c,v 1.3 2017/05/06 19:50:09 christos Exp $ */ +/* $NetBSD: openpam_dispatch.c,v 1.4 2021/03/08 19:38:10 christos Exp $ */ /*- * Copyright (c) 2002-2003 Networks Associates Technology, Inc. @@ -42,7 +42,7 @@ #endif #include -__RCSID("$NetBSD: openpam_dispatch.c,v 1.3 2017/05/06 19:50:09 christos Exp $"); +__RCSID("$NetBSD: openpam_dispatch.c,v 1.4 2021/03/08 19:38:10 christos Exp $"); #include @@ -86,7 +86,7 @@ openpam_dispatch(pam_handle_t *pamh, } /* pick a chain */ - switch (primitive) { + switch ((enum openpam_sm_primitives)primitive) { case PAM_SM_AUTHENTICATE: case PAM_SM_SETCRED: chain = pamh->chains[PAM_AUTH]; @@ -101,6 +101,7 @@ openpam_dispatch(pam_handle_t *pamh, case PAM_SM_CHAUTHTOK: chain = pamh->chains[PAM_PASSWORD]; break; + case PAM_NUM_PRIMITIVES: default: RETURNC(PAM_SYSTEM_ERR); } @@ -208,7 +209,7 @@ openpam_check_error_code(int primitive, return; /* specific error codes */ - switch (primitive) { + switch ((enum openpam_sm_primitives)primitive) { case PAM_SM_AUTHENTICATE: if (r == PAM_AUTH_ERR || r == PAM_CRED_INSUFFICIENT || @@ -245,6 +246,8 @@ openpam_check_error_code(int primitive, r == PAM_TRY_AGAIN) return; break; + case PAM_NUM_PRIMITIVES: + break; } openpam_log(PAM_LOG_ERROR, "%s(): unexpected return value %d", Index: src/external/bsd/openpam/dist/lib/libpam/openpam_log.c diff -u src/external/bsd/openpam/dist/lib/libpam/openpam_log.c:1.3 src/ex
CVS commit: src/tests/usr.bin/indent
Module Name:src Committed By: rillig Date: Mon Mar 8 20:01:16 UTC 2021 Modified Files: src/tests/usr.bin/indent: t_indent.sh Log Message: tests/indent: allow golden stderr file, improve filenames, clean up code When indent runs in filter mode, it may output messages to stderr. Allow tests with non-empty expected stderr. In the ATF output, the filename 'output_file.parsed' was not helpful for casual readers of diff output since they expect the filenames to be meaningful. Embed the name of the test case in that filename. Fix quoting of the shell variables. Remove the repetition of the regular expression to clean up the test files. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/indent/t_indent.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/usr.bin/indent/t_indent.sh diff -u src/tests/usr.bin/indent/t_indent.sh:1.2 src/tests/usr.bin/indent/t_indent.sh:1.3 --- src/tests/usr.bin/indent/t_indent.sh:1.2 Sun Mar 7 08:57:38 2021 +++ src/tests/usr.bin/indent/t_indent.sh Mon Mar 8 20:01:16 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_indent.sh,v 1.2 2021/03/07 08:57:38 rillig Exp $ +# $NetBSD: t_indent.sh,v 1.3 2021/03/08 20:01:16 rillig Exp $ # # Copyright 2016 Dell EMC # All rights reserved. @@ -44,25 +44,32 @@ check() # IDs, preventing them to be broken into several lines. It also # allows for remarks that are only needed in either the input or the # output. These removals affect the line numbers in the diffs. - local out_file="${tc}.stdout" - if [ -f "${out_file}" ]; then - parsed_file=output_file.parsed - - atf_check -o save:$parsed_file sed -e '/^\/\*[[:space:]]$.*/d' \ - ${tc}.stdout - out_flag="-o file:$parsed_file" + for fname in "$tc" "$tc.stdout" "$tc.stderr"; do + if [ -f "$fname" ]; then + atf_check -o "save:$fname.clean" \ + sed -e '/^\/\*[[:space:]]$.*/d' "$fname" + fi + done + + local out_arg='empty' + if [ -f "$tc.stdout.clean" ]; then + out_arg="file:$tc.stdout.clean" fi - local profile_file="${tc}.pro" - if [ -f "${profile_file}" ]; then - profile_flag="-P${profile_file}" - else - # Make sure we don't implicitly use ~/.indent.pro from the test - # host, for determinism purposes. - profile_flag="-npro" + + local err_arg='empty' + if [ -f "$tc.stderr.clean" ]; then + err_arg="file:$tc.stderr.clean" + fi + + # Make sure we don't implicitly use ~/.indent.pro from the test + # host, for determinism purposes. + local pro_arg='-npro' + if [ -f "$tc.pro" ]; then + pro_arg="-P$tc.pro" fi - sed -e '/^\/\*[[:space:]]$.*/d' ${tc} > input_file.parsed - atf_check -s exit:${tc##*.} ${out_flag} ${indent} ${profile_flag} < input_file.parsed + atf_check -s "exit:${tc##*.}" -o "$out_arg" -e "$err_arg" \ + "$indent" "$pro_arg" < "$tc.clean" } add_testcase()
CVS commit: src/sys
Module Name:src Committed By: christos Date: Mon Mar 8 20:01:54 UTC 2021 Modified Files: src/sys/net/npf: npf_ext_normalize.c src/sys/netinet: in_var.h Log Message: reinstate a simple version of ip_randomid() To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/net/npf/npf_ext_normalize.c cvs rdiff -u -r1.100 -r1.101 src/sys/netinet/in_var.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/npf/npf_ext_normalize.c diff -u src/sys/net/npf/npf_ext_normalize.c:1.10 src/sys/net/npf/npf_ext_normalize.c:1.11 --- src/sys/net/npf/npf_ext_normalize.c:1.10 Sat May 30 10:16:56 2020 +++ src/sys/net/npf/npf_ext_normalize.c Mon Mar 8 15:01:54 2021 @@ -26,7 +26,7 @@ #ifdef _KERNEL #include -__KERNEL_RCSID(0, "$NetBSD: npf_ext_normalize.c,v 1.10 2020/05/30 14:16:56 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: npf_ext_normalize.c,v 1.11 2021/03/08 20:01:54 christos Exp $"); #include #include @@ -114,7 +114,7 @@ npf_normalize_ip4(npf_cache_t *npc, npf_ if (np->n_random_id) { uint16_t oid = ip->ip_id, nid; - nid = htons(ip_randomid(ip_ids, 0)); + nid = ip_randomid(); cksum = npf_fixup16_cksum(cksum, oid, nid); ip->ip_id = nid; } Index: src/sys/netinet/in_var.h diff -u src/sys/netinet/in_var.h:1.100 src/sys/netinet/in_var.h:1.101 --- src/sys/netinet/in_var.h:1.100 Mon Mar 8 13:03:25 2021 +++ src/sys/netinet/in_var.h Mon Mar 8 15:01:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in_var.h,v 1.100 2021/03/08 18:03:25 christos Exp $ */ +/* $NetBSD: in_var.h,v 1.101 2021/03/08 20:01:54 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -450,6 +450,14 @@ int ipflow_fastforward(struct mbuf *); extern uint16_t ip_id; extern int ip_do_randomid; +static __inline uint16_t +ip_randomid(void) +{ + + uint16_t id = (uint16_t)cprng_fast32(); + return id ? id : 1; +} + /* * ip_newid_range: "allocate" num contiguous IP IDs. * @@ -462,8 +470,7 @@ ip_newid_range(const struct in_ifaddr *i if (ip_do_randomid) { /* XXX ignore num */ - id = (uint16_t)cprng_fast32(); - return id ? id : 1; + return ip_randomid(); } /* Never allow an IP ID of 0 (detect wrap). */
CVS commit: src/sys/sys
Module Name:src Committed By: christos Date: Mon Mar 8 20:02:47 UTC 2021 Modified Files: src/sys/sys: param.h Log Message: welcome to 9.99.81, ip_randomid() signature change. To generate a diff of this commit: cvs rdiff -u -r1.690 -r1.691 src/sys/sys/param.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/sys/param.h diff -u src/sys/sys/param.h:1.690 src/sys/sys/param.h:1.691 --- src/sys/sys/param.h:1.690 Fri Feb 19 09:51:59 2021 +++ src/sys/sys/param.h Mon Mar 8 15:02:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.690 2021/02/19 14:51:59 christos Exp $ */ +/* $NetBSD: param.h,v 1.691 2021/03/08 20:02:47 christos Exp $ */ /*- * Copyright (c) 1982, 1986, 1989, 1993 @@ -67,7 +67,7 @@ * 2.99.9 (299000900) */ -#define __NetBSD_Version__ 999008000 /* NetBSD 9.99.80 */ +#define __NetBSD_Version__ 999008100 /* NetBSD 9.99.81 */ #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \ (m) * 100) + (p) * 100) <= __NetBSD_Version__)
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Mar 8 20:12:04 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/indent: Makefile Added Files: src/tests/usr.bin/indent: lineno.0 lineno.0.pro lineno.0.stdout Log Message: tests/indent: add test for output line counting To generate a diff of this commit: cvs rdiff -u -r1.1026 -r1.1027 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/lineno.0 \ src/tests/usr.bin/indent/lineno.0.pro \ src/tests/usr.bin/indent/lineno.0.stdout 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.1026 src/distrib/sets/lists/tests/mi:1.1027 --- src/distrib/sets/lists/tests/mi:1.1026 Sun Mar 7 19:42:54 2021 +++ src/distrib/sets/lists/tests/mi Mon Mar 8 20:12:04 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1026 2021/03/07 19:42:54 rillig Exp $ +# $NetBSD: mi,v 1.1027 2021/03/08 20:12:04 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4728,6 +4728,9 @@ ./usr/tests/usr.bin/indent/label.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/label.0.pro tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/label.0.stdout tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lineno.0 tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lineno.0.pro tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/lineno.0.stdout tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/list_head.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/list_head.0.stdout tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/ncs.0 tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/indent/Makefile diff -u src/tests/usr.bin/indent/Makefile:1.3 src/tests/usr.bin/indent/Makefile:1.4 --- src/tests/usr.bin/indent/Makefile:1.3 Sat Mar 6 17:56:33 2021 +++ src/tests/usr.bin/indent/Makefile Mon Mar 8 20:12:04 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.3 2021/03/06 17:56:33 rillig Exp $ +# $NetBSD: Makefile,v 1.4 2021/03/08 20:12:04 rillig Exp $ .include @@ -25,6 +25,9 @@ FILES+= float.0.stdout FILES+= label.0 FILES+= label.0.stdout FILES+= label.0.pro +FILES+= lineno.0 +FILES+= lineno.0.pro +FILES+= lineno.0.stdout FILES+= list_head.0 FILES+= list_head.0.stdout FILES+= ncs.0 Added files: Index: src/tests/usr.bin/indent/lineno.0 diff -u /dev/null src/tests/usr.bin/indent/lineno.0:1.1 --- /dev/null Mon Mar 8 20:12:04 2021 +++ src/tests/usr.bin/indent/lineno.0 Mon Mar 8 20:12:04 2021 @@ -0,0 +1,9 @@ +/* $NetBSD: lineno.0,v 1.1 2021/03/08 20:12:04 rillig Exp $ */ +/* $FreeBSD$ */ + +/* Demonstrates line number counting in verbose mode. */ + +int * +function(void) +{ +} Index: src/tests/usr.bin/indent/lineno.0.pro diff -u /dev/null src/tests/usr.bin/indent/lineno.0.pro:1.1 --- /dev/null Mon Mar 8 20:12:04 2021 +++ src/tests/usr.bin/indent/lineno.0.pro Mon Mar 8 20:12:04 2021 @@ -0,0 +1,4 @@ +/* $NetBSD: lineno.0.pro,v 1.1 2021/03/08 20:12:04 rillig Exp $ */ +/* $FreeBSD$ */ + +-v Index: src/tests/usr.bin/indent/lineno.0.stdout diff -u /dev/null src/tests/usr.bin/indent/lineno.0.stdout:1.1 --- /dev/null Mon Mar 8 20:12:04 2021 +++ src/tests/usr.bin/indent/lineno.0.stdout Mon Mar 8 20:12:04 2021 @@ -0,0 +1,14 @@ +/* $NetBSD: lineno.0.stdout,v 1.1 2021/03/08 20:12:04 rillig Exp $ */ +/* $FreeBSD$ */ + +/* Demonstrates line number counting in verbose mode. */ + +int * +function(void) +{ +} +/* $ In the below output, the '5' means 5 non-empty lines. */ +/* $ XXX: It's rather strange that -v writes to stdout, */ +/* $ even in filter mode. This output belongs on stderr instead. */ +There were 5 output lines and 1 comments +(Lines with comments)/(Lines with code): 0.250
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Mon Mar 8 20:15:42 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h lexi.c pr_comment.c Log Message: indent: convert big macros to functions Each of these buffers is only modified in a single file. This makes it unnecessary to declare the macros in the global header. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/usr.bin/indent/indent.c cvs rdiff -u -r1.15 -r1.16 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.24 -r1.25 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.13 -r1.14 src/usr.bin/indent/pr_comment.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.33 src/usr.bin/indent/indent.c:1.34 --- src/usr.bin/indent/indent.c:1.33 Mon Mar 8 19:06:48 2021 +++ src/usr.bin/indent/indent.c Mon Mar 8 20:15:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.33 2021/03/08 19:06:48 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.34 2021/03/08 20:15:42 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.33 2021/03/08 19:06:48 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.34 2021/03/08 20:15:42 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -133,6 +133,36 @@ const char *simple_backup_suffix = ".BAK * files */ charbakfile[MAXPATHLEN] = ""; +static void +check_size_code(size_t desired_size) +{ +if (e_code + (desired_size) >= l_code) { + int nsize = l_code - s_code + 400 + desired_size; + int code_len = e_code - s_code; + codebuf = (char *)realloc(codebuf, nsize); + if (codebuf == NULL) + err(1, NULL); + e_code = codebuf + code_len + 1; + l_code = codebuf + nsize - 5; + s_code = codebuf + 1; +} +} + +static void +check_size_label(size_t desired_size) +{ +if (e_lab + (desired_size) >= l_lab) { + int nsize = l_lab - s_lab + 400 + desired_size; + int label_len = e_lab - s_lab; + labbuf = (char *)realloc(labbuf, nsize); + if (labbuf == NULL) + err(1, NULL); + e_lab = labbuf + label_len + 1; + l_lab = labbuf + nsize - 5; + s_lab = labbuf + 1; +} +} + int main(int argc, char **argv) { @@ -584,7 +614,7 @@ check_type: * in a line. fix it */ int len = e_com - s_com; - CHECK_SIZE_CODE(len + 3); + check_size_code(len + 3); *e_code++ = ' '; memcpy(e_code, s_com, len); e_code += len; @@ -603,8 +633,8 @@ check_type: /*-*\ | do switch on type of token scanned | \*-*/ - CHECK_SIZE_CODE(3); /* maximum number of increments of e_code - * before the next CHECK_SIZE_CODE or + check_size_code(3); /* maximum number of increments of e_code + * before the next check_size_code or * dump_line() is 2. After that there's the * final increment for the null character. */ switch (type_code) { /* now, decide what to do with the token */ @@ -720,7 +750,7 @@ check_type: { int len = e_token - s_token; - CHECK_SIZE_CODE(len); + check_size_code(len); memcpy(e_code, token, len); e_code += len; } @@ -731,7 +761,7 @@ check_type: { int len = e_token - s_token; - CHECK_SIZE_CODE(len + 1); + check_size_code(len + 1); if (ps.want_blank) *e_code++ = ' '; memcpy(e_code, token, len); @@ -782,7 +812,7 @@ check_type: { int len = e_code - s_code; - CHECK_SIZE_LAB(len + 3); + check_size_label(len + 3); memcpy(e_lab, s_code, len); e_lab += len; *e_lab++ = ':'; @@ -1073,7 +1103,7 @@ check_type: { int len = e_token - s_token; - CHECK_SIZE_CODE(len + 1); + check_size_code(len + 1); if (ps.want_blank) *e_code++ = ' '; memcpy(e_code, s_token, len); @@ -1087,7 +1117,7 @@ check_type: { int len = e_token - s_token; - CHECK_SIZE_CODE(len + 1); + check_size_code(len + 1); if (ps.want_blank) *e_code++ = ' '; memcpy(e_code, token, len); @@ -1128,7 +1158,7 @@ check_type: (s_lab != e_lab) || (s_code != e_code)) dump_line(); - CHECK_SIZE_LAB(1); + check_size_label(1); *e_lab++ = '#'; /* move whole line to 'label' buffer */ { int in_comment = 0; @@ -1142,7 +1172,7 @@ check_type: fill_buffer(); } while (*buf_ptr != '\n' || (in_comment && !had_eof)) { - CHECK_SIZE_LAB(2); + check_size_label(2); *e_lab = *buf_ptr++; if (buf_ptr >= buf_end) fill_buffer(); @@ -1210,7 +1240,7 @@ check_type: buf_end = sc_end; sc_end = NULL; } - CHECK_SIZE_LAB(1); + check_size_label(1); *e_lab = '\0'; /* null terminate line */ ps.pcase = false; } @@ -1343,13 +1373,13 @@
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Mon Mar 8 20:20:11 UTC 2021 Modified Files: src/usr.bin/indent: indent.c indent_globs.h lexi.c Log Message: indent: inline macro for backslash No functional change. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/usr.bin/indent/indent.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/indent/indent_globs.h cvs rdiff -u -r1.25 -r1.26 src/usr.bin/indent/lexi.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/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.34 src/usr.bin/indent/indent.c:1.35 --- src/usr.bin/indent/indent.c:1.34 Mon Mar 8 20:15:42 2021 +++ src/usr.bin/indent/indent.c Mon Mar 8 20:20:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.34 2021/03/08 20:15:42 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.35 2021/03/08 20:20:11 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.34 2021/03/08 20:15:42 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.35 2021/03/08 20:20:11 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -1177,7 +1177,7 @@ check_type: if (buf_ptr >= buf_end) fill_buffer(); switch (*e_lab++) { - case BACKSLASH: + case '\\': if (!in_comment) { *e_lab++ = *buf_ptr++; if (buf_ptr >= buf_end) Index: src/usr.bin/indent/indent_globs.h diff -u src/usr.bin/indent/indent_globs.h:1.16 src/usr.bin/indent/indent_globs.h:1.17 --- src/usr.bin/indent/indent_globs.h:1.16 Mon Mar 8 20:15:42 2021 +++ src/usr.bin/indent/indent_globs.h Mon Mar 8 20:20:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent_globs.h,v 1.16 2021/03/08 20:15:42 rillig Exp $ */ +/* $NetBSD: indent_globs.h,v 1.17 2021/03/08 20:20:11 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -40,7 +40,6 @@ * $FreeBSD: head/usr.bin/indent/indent_globs.h 337651 2018-08-11 19:20:06Z pstef $ */ -#define BACKSLASH '\\' #define bufsize 200 /* size of internal buffers */ #define sc_size 5000 /* size of save_com buffer */ #define label_offset 2 /* number of levels a label is placed to left Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.25 src/usr.bin/indent/lexi.c:1.26 --- src/usr.bin/indent/lexi.c:1.25 Mon Mar 8 20:15:42 2021 +++ src/usr.bin/indent/lexi.c Mon Mar 8 20:20:11 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.25 2021/03/08 20:15:42 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.26 2021/03/08 20:20:11 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.25 2021/03/08 20:15:42 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.26 2021/03/08 20:20:11 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -301,10 +301,10 @@ lexi(struct parser_state *state) } else while (isalnum((unsigned char)*buf_ptr) || - *buf_ptr == BACKSLASH || + *buf_ptr == '\\' || *buf_ptr == '_' || *buf_ptr == '$') { /* fill_buffer() terminates buffer with newline */ - if (*buf_ptr == BACKSLASH) { + if (*buf_ptr == '\\') { if (*(buf_ptr + 1) == '\n') { buf_ptr += 2; if (buf_ptr >= buf_end) @@ -467,7 +467,7 @@ lexi(struct parser_state *state) *e_token = *buf_ptr++; if (buf_ptr >= buf_end) fill_buffer(); - if (*e_token == BACKSLASH) { /* if escape, copy extra char */ + if (*e_token == '\\') { /* if escape, copy extra char */ if (*buf_ptr == '\n') /* check for escaped newline */ ++line_no; *++e_token = *buf_ptr++;
CVS commit: src/sys/rump/net/lib
Module Name:src Committed By: christos Date: Mon Mar 8 20:43:22 UTC 2021 Modified Files: src/sys/rump/net/lib/libnetinet: Makefile.inc src/sys/rump/net/lib/libnetinet6: Makefile.inc Log Message: remove ip{,6}_id.c To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/rump/net/lib/libnetinet/Makefile.inc cvs rdiff -u -r1.5 -r1.6 src/sys/rump/net/lib/libnetinet6/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/net/lib/libnetinet/Makefile.inc diff -u src/sys/rump/net/lib/libnetinet/Makefile.inc:1.14 src/sys/rump/net/lib/libnetinet/Makefile.inc:1.15 --- src/sys/rump/net/lib/libnetinet/Makefile.inc:1.14 Thu Apr 13 22:43:28 2017 +++ src/sys/rump/net/lib/libnetinet/Makefile.inc Mon Mar 8 15:43:22 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.14 2017/04/14 02:43:28 ozaki-r Exp $ +# $NetBSD: Makefile.inc,v 1.15 2021/03/08 20:43:22 christos Exp $ # .PATH: ${.CURDIR}/../../../../netinet @@ -7,7 +7,7 @@ CPPFLAGS+= -DINET # INET SRCS+= in_proto.c igmp.c in.c in_offload.c in_pcb.c ip_carp.c ip_icmp.c\ - ip_flow.c ip_id.c ip_input.c ip_reass.c ip_output.c raw_ip.c \ + ip_flow.c ip_input.c ip_reass.c ip_output.c raw_ip.c \ in_cksum.c cpu_in_cksum.c in4_cksum.c ip_encap.c portalgo.c # ARP Index: src/sys/rump/net/lib/libnetinet6/Makefile.inc diff -u src/sys/rump/net/lib/libnetinet6/Makefile.inc:1.5 src/sys/rump/net/lib/libnetinet6/Makefile.inc:1.6 --- src/sys/rump/net/lib/libnetinet6/Makefile.inc:1.5 Thu Feb 8 06:34:35 2018 +++ src/sys/rump/net/lib/libnetinet6/Makefile.inc Mon Mar 8 15:43:22 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.5 2018/02/08 11:34:35 maxv Exp $ +# $NetBSD: Makefile.inc,v 1.6 2021/03/08 20:43:22 christos Exp $ # .PATH: ${.CURDIR}/../../../../netinet6 @@ -8,7 +8,7 @@ CPPFLAGS+= -DINET6 # INET6 SRCS+= dest6.c frag6.c icmp6.c in6.c in6_cksum.c in6_ifattach.c \ in6_offload.c in6_pcb.c in6_proto.c in6_src.c ip6_flow.c \ - ip6_forward.c ip6_id.c ip6_input.c ip6_mroute.c ip6_output.c \ + ip6_forward.c ip6_input.c ip6_mroute.c ip6_output.c \ mld6.c nd6.c nd6_nbr.c nd6_rtr.c raw_ip6.c route6.c scope6.c \ udp6_usrreq.c
CVS commit: src/external/bsd/elftoolchain/dist/libelf
Module Name:src Committed By: jkoshy Date: Mon Mar 8 20:55:06 UTC 2021 Modified Files: src/external/bsd/elftoolchain/dist/libelf: elf.3 elf_begin.3 elf_cntl.3 elf_end.3 elf_errmsg.3 elf_fill.3 elf_flagdata.3 elf_getarhdr.3 elf_getarsym.3 elf_getbase.3 elf_getdata.3 elf_getident.3 elf_getphdrnum.3 elf_getphnum.3 elf_getscn.3 elf_getshdrnum.3 elf_getshdrstrndx.3 elf_getshnum.3 elf_getshstrndx.3 elf_hash.3 elf_kind.3 elf_memory.3 elf_next.3 elf_open.3 elf_rand.3 elf_rawfile.3 elf_strptr.3 elf_update.3 elf_version.3 gelf.3 gelf_checksum.3 gelf_fsize.3 gelf_getcap.3 gelf_getclass.3 gelf_getdyn.3 gelf_getehdr.3 gelf_getmove.3 gelf_getphdr.3 gelf_getrel.3 gelf_getrela.3 gelf_getshdr.3 gelf_getsym.3 gelf_getsyminfo.3 gelf_getsymshndx.3 gelf_newehdr.3 gelf_newphdr.3 gelf_update_ehdr.3 gelf_xlatetof.3 Log Message: Update libelf's manual pages to upstream revision [r3928]. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/elftoolchain/dist/libelf/elf.3 cvs rdiff -u -r1.3 -r1.4 \ src/external/bsd/elftoolchain/dist/libelf/elf_begin.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_cntl.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_end.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_errmsg.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_fill.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_flagdata.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getarhdr.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getarsym.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getbase.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getdata.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getident.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getphdrnum.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getphnum.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getscn.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getshdrnum.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getshdrstrndx.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getshnum.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_getshstrndx.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_hash.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_kind.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_memory.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_next.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_open.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_rand.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_rawfile.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_strptr.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_update.3 \ src/external/bsd/elftoolchain/dist/libelf/elf_version.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_checksum.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_fsize.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getcap.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getclass.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getdyn.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getehdr.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getmove.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getphdr.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getrel.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getrela.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getshdr.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getsym.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getsyminfo.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_getsymshndx.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_newehdr.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_newphdr.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_update_ehdr.3 \ src/external/bsd/elftoolchain/dist/libelf/gelf_xlatetof.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/elftoolchain/dist/libelf/elf.3 diff -u src/external/bsd/elftoolchain/dist/libelf/elf.3:1.4 src/external/bsd/elftoolchain/dist/libelf/elf.3:1.5 --- src/external/bsd/elftoolchain/dist/libelf/elf.3:1.4 Thu Apr 28 07:06:11 2016 +++ src/external/bsd/elftoolchain/dist/libelf/elf.3 Mon Mar 8 20:55:06 2021 @@ -1,6 +1,6 @@ -.\" $NetBSD: elf.3,v 1.4 2016/04/28 07:06:11 wiz Exp $ +.\" $NetBSD: elf.3,v 1.5 2021/03/08 20:55:06 jkoshy Exp $ .\" -.\" Copyright (c) 2006-2008,2011 Joseph Koshy. All rights reserved. +.\" Copyright (c) 2006-2008,2011,2019 Joseph Koshy. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions @@ -23,11 +23,11 @@ .
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Mar 8 20:55:34 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/indent: Makefile Added Files: src/tests/usr.bin/indent: block.0 block.0.stdout Log Message: tests/indent: demonstrate another bug in nested blocks To generate a diff of this commit: cvs rdiff -u -r1.1027 -r1.1028 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/block.0 \ src/tests/usr.bin/indent/block.0.stdout 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.1027 src/distrib/sets/lists/tests/mi:1.1028 --- src/distrib/sets/lists/tests/mi:1.1027 Mon Mar 8 20:12:04 2021 +++ src/distrib/sets/lists/tests/mi Mon Mar 8 20:55:34 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1027 2021/03/08 20:12:04 rillig Exp $ +# $NetBSD: mi,v 1.1028 2021/03/08 20:55:34 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4708,6 +4708,8 @@ ./usr/tests/usr.bin/indent/Kyuafile tests-usr.bin-tests compattestfile,atf,kyua ./usr/tests/usr.bin/indent/binary.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/binary.0.stdout tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/block.0 tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/block.0.stdout tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/comment-line-end.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/comment-line-end.0.stdout tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/comments.0 tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/indent/Makefile diff -u src/tests/usr.bin/indent/Makefile:1.4 src/tests/usr.bin/indent/Makefile:1.5 --- src/tests/usr.bin/indent/Makefile:1.4 Mon Mar 8 20:12:04 2021 +++ src/tests/usr.bin/indent/Makefile Mon Mar 8 20:55:34 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.4 2021/03/08 20:12:04 rillig Exp $ +# $NetBSD: Makefile,v 1.5 2021/03/08 20:55:34 rillig Exp $ .include @@ -8,6 +8,8 @@ TESTS_SH= t_indent FILESDIR= ${TESTSDIR} FILES= binary.0 FILES+= binary.0.stdout +FILES+= block.0 +FILES+= block.0.stdout FILES+= comment-line-end.0 FILES+= comment-line-end.0.stdout FILES+= comments.0 Added files: Index: src/tests/usr.bin/indent/block.0 diff -u /dev/null src/tests/usr.bin/indent/block.0:1.1 --- /dev/null Mon Mar 8 20:55:34 2021 +++ src/tests/usr.bin/indent/block.0 Mon Mar 8 20:55:34 2021 @@ -0,0 +1,14 @@ +/* $NetBSD: block.0,v 1.1 2021/03/08 20:55:34 rillig Exp $ */ +/* $FreeBSD$ */ + +void +function(void) +{ + if (true) { + + } + + { + print("block"); + } +} Index: src/tests/usr.bin/indent/block.0.stdout diff -u /dev/null src/tests/usr.bin/indent/block.0.stdout:1.1 --- /dev/null Mon Mar 8 20:55:34 2021 +++ src/tests/usr.bin/indent/block.0.stdout Mon Mar 8 20:55:34 2021 @@ -0,0 +1,15 @@ +/* $NetBSD: block.0.stdout,v 1.1 2021/03/08 20:55:34 rillig Exp $ */ +/* $FreeBSD$ */ + +void +function(void) +{ + if (true) { + +/* $ FIXME: indent must not merge these braces. */ + } { +/* $ FIXME: the following empty line was not in the input. */ + + print("block"); + } +}
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Mon Mar 8 21:13:34 UTC 2021 Modified Files: src/usr.bin/indent: lexi.c Log Message: indent: split bsearch comparison function It may have been a clever trick to use the same memory layout for struct templ and a string pointer, but it's not worth the extra comment and difficulty in understanding the code. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.bin/indent/lexi.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/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.26 src/usr.bin/indent/lexi.c:1.27 --- src/usr.bin/indent/lexi.c:1.26 Mon Mar 8 20:20:11 2021 +++ src/usr.bin/indent/lexi.c Mon Mar 8 21:13:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.26 2021/03/08 20:20:11 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.27 2021/03/08 21:13:33 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.26 2021/03/08 20:20:11 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.27 2021/03/08 21:13:33 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -75,9 +75,9 @@ struct templ { /* * This table has to be sorted alphabetically, because it'll be used in binary - * search. For the same reason, string must be the first thing in struct templ. + * search. */ -struct templ specials[] = +const struct templ specials[] = { {"_Bool", rw_type}, {"_Complex", rw_type}, @@ -187,9 +187,15 @@ check_size_token(size_t desired_size) } static int -strcmp_type(const void *e1, const void *e2) +compare_templ_array(const void *key, const void *elem) { -return strcmp(e1, *(const char *const *)e2); +return strcmp(key, ((const struct templ *)elem)->rwd); +} + +static int +compare_string_array(const void *key, const void *elem) +{ +return strcmp(key, *((const char *const *)elem)); } #ifdef debug @@ -341,11 +347,8 @@ lexi(struct parser_state *state) */ state->last_u_d = (state->last_token == structure); - p = bsearch(s_token, - specials, - sizeof(specials) / sizeof(specials[0]), - sizeof(specials[0]), - strcmp_type); + p = bsearch(s_token, specials, sizeof specials / sizeof specials[0], + sizeof specials[0], compare_templ_array); if (p == NULL) { /* not a special keyword... */ char *u; @@ -353,7 +356,7 @@ lexi(struct parser_state *state) if ((opt.auto_typedefs && ((u = strrchr(s_token, '_')) != NULL) && strcmp(u, "_t") == 0) || (typename_top >= 0 && bsearch(s_token, typenames, typename_top + 1, - sizeof(typenames[0]), strcmp_type))) { + sizeof typenames[0], compare_string_array))) { state->keyword = rw_type; state->last_u_d = true; goto found_typename;
CVS commit: src/external/bsd/blocklist/libexec
Module Name:src Committed By: christos Date: Mon Mar 8 21:48:22 UTC 2021 Modified Files: src/external/bsd/blocklist/libexec: blocklistd-helper Log Message: remove extra line To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/blocklist/libexec/blocklistd-helper Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/blocklist/libexec/blocklistd-helper diff -u src/external/bsd/blocklist/libexec/blocklistd-helper:1.2 src/external/bsd/blocklist/libexec/blocklistd-helper:1.3 --- src/external/bsd/blocklist/libexec/blocklistd-helper:1.2 Sat Mar 6 19:46:39 2021 +++ src/external/bsd/blocklist/libexec/blocklistd-helper Mon Mar 8 16:48:22 2021 @@ -206,7 +206,6 @@ flush) # XXX this MUST be done last and separately as "-s" is executed # _while_ the command arguments are being processed! /sbin/ipf -s && echo OK - /sbin/ipf -Z -I -Fi -s > /dev/null && echo OK ;; ipfw)
CVS commit: src/sys/netinet
Module Name:src Committed By: christos Date: Mon Mar 8 22:01:18 UTC 2021 Modified Files: src/sys/netinet: in_var.h Log Message: mv include to the kernel portion To generate a diff of this commit: cvs rdiff -u -r1.101 -r1.102 src/sys/netinet/in_var.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/netinet/in_var.h diff -u src/sys/netinet/in_var.h:1.101 src/sys/netinet/in_var.h:1.102 --- src/sys/netinet/in_var.h:1.101 Mon Mar 8 15:01:54 2021 +++ src/sys/netinet/in_var.h Mon Mar 8 17:01:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: in_var.h,v 1.101 2021/03/08 20:01:54 christos Exp $ */ +/* $NetBSD: in_var.h,v 1.102 2021/03/08 22:01:18 christos Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -65,7 +65,6 @@ #define _NETINET_IN_VAR_H_ #include -#include #define IN_IFF_TENTATIVE 0x01 /* tentative address */ #define IN_IFF_DUPLICATED 0x02 /* DAD detected duplicate */ @@ -383,6 +382,7 @@ struct in_multi { #ifdef _KERNEL #include +#include extern pktqueue_t *ip_pktq;
CVS commit: src
Module Name:src Committed By: rillig Date: Mon Mar 8 22:13:05 UTC 2021 Modified Files: src/distrib/sets/lists/tests: mi src/tests/usr.bin/indent: Makefile t_indent.sh Added Files: src/tests/usr.bin/indent: opt-bap+sob.0 opt-bap+sob.0.pro opt-bap+sob.0.stdout Log Message: tests/indent: demonstrate wrong removed empty line before '//' To generate a diff of this commit: cvs rdiff -u -r1.1028 -r1.1029 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.5 -r1.6 src/tests/usr.bin/indent/Makefile cvs rdiff -u -r0 -r1.1 src/tests/usr.bin/indent/opt-bap+sob.0 \ src/tests/usr.bin/indent/opt-bap+sob.0.pro \ src/tests/usr.bin/indent/opt-bap+sob.0.stdout cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/indent/t_indent.sh 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.1028 src/distrib/sets/lists/tests/mi:1.1029 --- src/distrib/sets/lists/tests/mi:1.1028 Mon Mar 8 20:55:34 2021 +++ src/distrib/sets/lists/tests/mi Mon Mar 8 22:13:05 2021 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1028 2021/03/08 20:55:34 rillig Exp $ +# $NetBSD: mi,v 1.1029 2021/03/08 22:13:05 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -4762,6 +4762,9 @@ ./usr/tests/usr.bin/indent/opt-badp.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/opt-badp.0.pro tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/opt-badp.0.stdout tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/opt-bap+sob.0 tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/opt-bap+sob.0.pro tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/indent/opt-bap+sob.0.stdout tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/opt-bap.0 tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/opt-bap.0.pro tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/indent/opt-bap.0.stdout tests-usr.bin-tests compattestfile,atf Index: src/tests/usr.bin/indent/Makefile diff -u src/tests/usr.bin/indent/Makefile:1.5 src/tests/usr.bin/indent/Makefile:1.6 --- src/tests/usr.bin/indent/Makefile:1.5 Mon Mar 8 20:55:34 2021 +++ src/tests/usr.bin/indent/Makefile Mon Mar 8 22:13:05 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.5 2021/03/08 20:55:34 rillig Exp $ +# $NetBSD: Makefile,v 1.6 2021/03/08 22:13:05 rillig Exp $ .include @@ -59,6 +59,9 @@ FILES+= opt-bad.0.stdout FILES+= opt-badp.0 FILES+= opt-badp.0.pro FILES+= opt-badp.0.stdout +FILES+= opt-bap+sob.0 +FILES+= opt-bap+sob.0.pro +FILES+= opt-bap+sob.0.stdout FILES+= opt-bap.0 FILES+= opt-bap.0.pro FILES+= opt-bap.0.stdout Index: src/tests/usr.bin/indent/t_indent.sh diff -u src/tests/usr.bin/indent/t_indent.sh:1.3 src/tests/usr.bin/indent/t_indent.sh:1.4 --- src/tests/usr.bin/indent/t_indent.sh:1.3 Mon Mar 8 20:01:16 2021 +++ src/tests/usr.bin/indent/t_indent.sh Mon Mar 8 22:13:05 2021 @@ -1,5 +1,5 @@ #! /bin/sh -# $NetBSD: t_indent.sh,v 1.3 2021/03/08 20:01:16 rillig Exp $ +# $NetBSD: t_indent.sh,v 1.4 2021/03/08 22:13:05 rillig Exp $ # # Copyright 2016 Dell EMC # All rights reserved. @@ -79,7 +79,7 @@ add_testcase() case "${tc%.*}" in *-*) - local IFS="-" + local IFS="-+" for word in ${tc%.*}; do tc_escaped="${tc_escaped:+${tc_escaped}_}${word}" done Added files: Index: src/tests/usr.bin/indent/opt-bap+sob.0 diff -u /dev/null src/tests/usr.bin/indent/opt-bap+sob.0:1.1 --- /dev/null Mon Mar 8 22:13:06 2021 +++ src/tests/usr.bin/indent/opt-bap+sob.0 Mon Mar 8 22:13:05 2021 @@ -0,0 +1,20 @@ +/* $NetBSD: opt-bap+sob.0,v 1.1 2021/03/08 22:13:05 rillig Exp $ */ +/* $FreeBSD$ */ + +/* + * As of 2021-03-08, the combination of -bap and -sob, which occurs in the + * example indent.pro from NetBSD, removes the empty line above the + * separator. Seen in games/cgram/cgram.c. + */ + +void +function1(void) +{ +} + +/ separator / + +void +function2(void) +{ +} Index: src/tests/usr.bin/indent/opt-bap+sob.0.pro diff -u /dev/null src/tests/usr.bin/indent/opt-bap+sob.0.pro:1.1 --- /dev/null Mon Mar 8 22:13:06 2021 +++ src/tests/usr.bin/indent/opt-bap+sob.0.pro Mon Mar 8 22:13:05 2021 @@ -0,0 +1,5 @@ +/* $NetBSD: opt-bap+sob.0.pro,v 1.1 2021/03/08 22:13:05 rillig Exp $ */ +/* $FreeBSD$ */ + +-bap +-sob Index: src/tests/usr.bin/indent/opt-bap+sob.0.stdout diff -u /dev/null src/tests/usr.bin/indent/opt-bap+sob.0.stdout:1.1 --- /dev/null Mon Mar 8 22:13:06 2021 +++ src/tests/usr.bin/indent/opt-bap+sob.0.stdout Mon Mar 8 22:13:05 2021 @@ -0,0 +1,20 @@ +/* $NetBSD: opt-bap+sob.0.stdout,v 1.1 2021/03/08 22:13:05 rillig Exp $ */ +/* $FreeBSD$ */ + +/* + * As of 2021-03-08, the combination of -bap and -sob, which occurs in the + * example indent.pro from NetBSD, removes the empty line above the + * separator. Seen in games/cgram/cgram.c. + *
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Mon Mar 8 22:23:58 UTC 2021 Modified Files: src/usr.bin/indent: io.c Log Message: indent: always use braces in do-while loops Having a 'while' at the beginning of a line looks as if it would start a loop. It's confusing when it _ends_ a loop instead. To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/usr.bin/indent/io.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/indent/io.c diff -u src/usr.bin/indent/io.c:1.24 src/usr.bin/indent/io.c:1.25 --- src/usr.bin/indent/io.c:1.24 Sun Mar 7 22:11:01 2021 +++ src/usr.bin/indent/io.c Mon Mar 8 22:23:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.24 2021/03/07 22:11:01 rillig Exp $ */ +/* $NetBSD: io.c,v 1.25 2021/03/08 22:23:58 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Be #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: io.c,v 1.24 2021/03/07 22:11:01 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.25 2021/03/08 22:23:58 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -126,8 +126,9 @@ dump_line(void) || strncmp(s_lab, "#endif", 6) == 0)) { char *s = s_lab; if (e_lab[-1] == '\n') e_lab--; - do putc(*s++, output); - while (s < e_lab && 'a' <= *s && *s<='z'); + do { + putc(*s++, output); + } while (s < e_lab && 'a' <= *s && *s <= 'z'); while ((*s == ' ' || *s == '\t') && s < e_lab) s++; if (s < e_lab) @@ -369,9 +370,9 @@ fill_buffer(void) } if (inhibit_formatting) { p = in_buffer; - do + do { putc(*p, output); - while (*p++ != '\n'); + } while (*p++ != '\n'); } }
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Mon Mar 8 22:26:17 UTC 2021 Modified Files: src/usr.bin/indent: io.c Log Message: indent: move comment about dump_line to column 1 It looked misplaced on the right side since that area is usually reserved for small remarks, not long explanations. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/usr.bin/indent/io.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/indent/io.c diff -u src/usr.bin/indent/io.c:1.25 src/usr.bin/indent/io.c:1.26 --- src/usr.bin/indent/io.c:1.25 Mon Mar 8 22:23:58 2021 +++ src/usr.bin/indent/io.c Mon Mar 8 22:26:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.25 2021/03/08 22:23:58 rillig Exp $ */ +/* $NetBSD: io.c,v 1.26 2021/03/08 22:26:17 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Be #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: io.c,v 1.25 2021/03/08 22:23:58 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.26 2021/03/08 22:26:17 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -65,13 +65,14 @@ int comment_open; static int paren_target; static int pad_output(int current, int target); +/* + * dump_line is the routine that actually effects the printing of the new + * source. It prints the label section, followed by the code section with + * the appropriate nesting level, followed by any comments. + */ void dump_line(void) -{/* dump_line is the routine that actually - * effects the printing of the new source. It - * prints the label section, followed by the - * code section with the appropriate nesting - * level, followed by any comments */ +{ int cur_col, target_col = 1; static int not_first_line;
CVS commit: src/usr.bin/indent
Module Name:src Committed By: rillig Date: Mon Mar 8 22:28:31 UTC 2021 Modified Files: src/usr.bin/indent: io.c Log Message: indent: remove redundant initializer in dump_line No functional change. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/usr.bin/indent/io.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/indent/io.c diff -u src/usr.bin/indent/io.c:1.26 src/usr.bin/indent/io.c:1.27 --- src/usr.bin/indent/io.c:1.26 Mon Mar 8 22:26:17 2021 +++ src/usr.bin/indent/io.c Mon Mar 8 22:28:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.26 2021/03/08 22:26:17 rillig Exp $ */ +/* $NetBSD: io.c,v 1.27 2021/03/08 22:28:31 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)io.c 8.1 (Be #include #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: io.c,v 1.26 2021/03/08 22:26:17 rillig Exp $"); +__RCSID("$NetBSD: io.c,v 1.27 2021/03/08 22:28:31 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -73,8 +73,7 @@ static int pad_output(int current, int t void dump_line(void) { -int cur_col, -target_col = 1; +int cur_col, target_col; static int not_first_line; if (ps.procname[0]) {
CVS commit: src/sys
Module Name:src Committed By: christos Date: Mon Mar 8 23:34:58 UTC 2021 Modified Files: src/sys/dist/pf/net: pf_norm.c src/sys/external/bsd/ipf/netinet: ip_fil_netbsd.c Log Message: Adjust for fewer args in calling functions To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dist/pf/net/pf_norm.c cvs rdiff -u -r1.35 -r1.36 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.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/dist/pf/net/pf_norm.c diff -u src/sys/dist/pf/net/pf_norm.c:1.28 src/sys/dist/pf/net/pf_norm.c:1.29 --- src/sys/dist/pf/net/pf_norm.c:1.28 Mon Apr 13 12:35:33 2015 +++ src/sys/dist/pf/net/pf_norm.c Mon Mar 8 18:34:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pf_norm.c,v 1.28 2015/04/13 16:35:33 riastradh Exp $ */ +/* $NetBSD: pf_norm.c,v 1.29 2021/03/08 23:34:58 christos Exp $ */ /* $OpenBSD: pf_norm.c,v 1.109 2007/05/28 17:16:39 henning Exp $ */ /* @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pf_norm.c,v 1.28 2015/04/13 16:35:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pf_norm.c,v 1.29 2021/03/08 23:34:58 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1044,7 +1044,7 @@ pf_normalize_ip(struct mbuf **m0, int di if (r->rule_flag & PFRULE_RANDOMID) { u_int16_t id = h->ip_id; - h->ip_id = ip_randomid(ip_ids, 0); + h->ip_id = ip_randomid(); h->ip_sum = pf_cksum_fixup(h->ip_sum, id, h->ip_id, 0); } if ((r->rule_flag & (PFRULE_FRAGCROP|PFRULE_FRAGDROP)) == 0) Index: src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c diff -u src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.35 src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.36 --- src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c:1.35 Fri Jun 12 06:35:59 2020 +++ src/sys/external/bsd/ipf/netinet/ip_fil_netbsd.c Mon Mar 8 18:34:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ip_fil_netbsd.c,v 1.35 2020/06/12 10:35:59 roy Exp $ */ +/* $NetBSD: ip_fil_netbsd.c,v 1.36 2021/03/08 23:34:58 christos Exp $ */ /* * Copyright (C) 2012 by Darren Reed. @@ -8,7 +8,7 @@ #if !defined(lint) #if defined(__NetBSD__) #include -__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.35 2020/06/12 10:35:59 roy Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ip_fil_netbsd.c,v 1.36 2021/03/08 23:34:58 christos Exp $"); #else static const char sccsid[] = "@(#)ip_fil.c 2.41 6/5/96 (C) 1993-2000 Darren Reed"; static const char rcsid[] = "@(#)Id: ip_fil_netbsd.c,v 1.1.1.2 2012/07/22 13:45:17 darrenr Exp"; @@ -1637,7 +1637,7 @@ ipf_newisn(fr_info_t *fin) return 0; #ifdef INET return tcp_new_iss1((void *)&fin->fin_src, (void *)&fin->fin_dst, - fin->fin_sport, fin->fin_dport, asz, 0); + fin->fin_sport, fin->fin_dport, asz); #else return ENOSYS; #endif
CVS commit: src/distrib/utils/libhack
Module Name:src Committed By: christos Date: Tue Mar 9 00:06:44 UTC 2021 Modified Files: src/distrib/utils/libhack: Makefile.inc Added Files: src/distrib/utils/libhack: wrap.c Log Message: Add a stubbed version of libwrap (tcpwrappers) To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/distrib/utils/libhack/Makefile.inc cvs rdiff -u -r0 -r1.1 src/distrib/utils/libhack/wrap.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/utils/libhack/Makefile.inc diff -u src/distrib/utils/libhack/Makefile.inc:1.37 src/distrib/utils/libhack/Makefile.inc:1.38 --- src/distrib/utils/libhack/Makefile.inc:1.37 Thu Feb 25 16:24:00 2021 +++ src/distrib/utils/libhack/Makefile.inc Mon Mar 8 19:06:44 2021 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.inc,v 1.37 2021/02/25 21:24:00 christos Exp $ +# $NetBSD: Makefile.inc,v 1.38 2021/03/09 00:06:44 christos Exp $ # # Include this fragment to build libhack.o # It is .o and not .a to make sure these are the @@ -25,7 +25,7 @@ HACKOBJS+= getcap.o getgrent.o getnet.o localeconv.o multibyte.o perror.o runetable.o setlocale.o \ nl_langinfo.o strcasecmp.o \ strerror.o strsignal.o syslog.o utmp.o fmtcheck.o \ - aligned_alloc.o regcomp.o regexec.o + aligned_alloc.o regcomp.o regexec.o wrap.o .if (${USE_YP} != "no") HACKOBJS+= yplib.o Added files: Index: src/distrib/utils/libhack/wrap.c diff -u /dev/null src/distrib/utils/libhack/wrap.c:1.1 --- /dev/null Mon Mar 8 19:06:44 2021 +++ src/distrib/utils/libhack/wrap.c Mon Mar 8 19:06:44 2021 @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2021 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * 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 NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``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 FOUNDATION OR CONTRIBUTORS + * 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 +__RCSID("$NetBSD: wrap.c,v 1.1 2021/03/09 00:06:44 christos Exp $"); + +#include + +struct request_info * +request_init(struct request_info *ri, ...) +{ + + return ri; +} + +void +sock_host(struct request_info *ri) +{ +} + +int +hosts_access(struct request_info *ri) +{ + return 1; /* always allow */ +} + +void +refuse(struct request_info *ri) +{ +}
CVS commit: src/distrib/evbarm/instkernel/sshramdisk
Module Name:src Committed By: christos Date: Tue Mar 9 00:08:04 UTC 2021 Modified Files: src/distrib/evbarm/instkernel/sshramdisk: list Log Message: We don't need libwrap anymore; libhack replaces it. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/distrib/evbarm/instkernel/sshramdisk/list Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/evbarm/instkernel/sshramdisk/list diff -u src/distrib/evbarm/instkernel/sshramdisk/list:1.4 src/distrib/evbarm/instkernel/sshramdisk/list:1.5 --- src/distrib/evbarm/instkernel/sshramdisk/list:1.4 Sun Mar 1 15:59:54 2020 +++ src/distrib/evbarm/instkernel/sshramdisk/list Mon Mar 8 19:08:04 2021 @@ -1,4 +1,4 @@ -# $NetBSD: list,v 1.4 2020/03/01 20:59:54 christos Exp $ +# $NetBSD: list,v 1.5 2021/03/09 00:08:04 christos Exp $ SRCDIRS bin sbin external/bsd/less/bin crypto/external/bsd/openssh/bin/sshd usr.bin usr.sbin @@ -69,7 +69,7 @@ SPECIAL umount srcdir distrib/utils/x_u SPECIAL sshd srcdir crypto/external/bsd/openssh/bin/sshd SPECIAL sshd keepsymbols allow_severity deny_severity -LIBS libhack.o -ledit -lutil -lcurses -lterminfo -lrmt -lcrypt -ll -lm -lz -lprop-lssh -lcrypto -lwrap +LIBS libhack.o -ledit -lutil -lcurses -lterminfo -lrmt -lcrypt -ll -lm -lz -lprop-lssh -lcrypto # init invokes the shell as -sh ARGVLN sh -sh
CVS commit: src/sys/arch/macppc/dev
Module Name:src Committed By: macallan Date: Tue Mar 9 01:17:37 UTC 2021 Modified Files: src/sys/arch/macppc/dev: smu.c Log Message: add support for the CPU temperature sensor found in iMac G5s To generate a diff of this commit: cvs rdiff -u -r1.11 -r1.12 src/sys/arch/macppc/dev/smu.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/macppc/dev/smu.c diff -u src/sys/arch/macppc/dev/smu.c:1.11 src/sys/arch/macppc/dev/smu.c:1.12 --- src/sys/arch/macppc/dev/smu.c:1.11 Fri Mar 5 07:15:53 2021 +++ src/sys/arch/macppc/dev/smu.c Tue Mar 9 01:17:37 2021 @@ -80,7 +80,7 @@ struct smu_iicbus { #define SMU_MAX_FANS 8 #define SMU_MAX_IICBUS 3 -#define SMU_MAX_SME_SENSORS SMU_MAX_FANS +#define SMU_MAX_SME_SENSORS (SMU_MAX_FANS + 8) struct smu_zone { bool (*filter)(const envsys_data_t *); @@ -120,6 +120,8 @@ struct smu_softc { struct sysmon_envsys *sc_sme; envsys_data_t sc_sme_sensors[SMU_MAX_SME_SENSORS]; + uint32_t cpu_m; + int32_t cpu_b; struct smu_zone sc_zones[SMU_ZONES]; lwp_t *sc_thread; @@ -130,7 +132,7 @@ struct smu_softc { #define SMU_CMD_RTC 0x8e #define SMU_CMD_I2C 0x9a #define SMU_CMD_POWER 0xaa -#define SMU_ADC 0xd8 +#define SMU_CMD_ADC 0xd8 #define SMU_MISC 0xee #define SMU_MISC_GET_DATA 0x02 #define SMU_MISC_LED_CTRL 0x04 @@ -165,6 +167,8 @@ static int smu_todr_settime_ymdhms(todr_ static int smu_fan_update_rpm(struct smu_fan *); static int smu_fan_get_rpm(struct smu_fan *, int *); static int smu_fan_set_rpm(struct smu_fan *, int); +static int smu_read_adc(struct smu_softc *, int); + static int smu_iicbus_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t, void *, size_t, int); static int smu_sysctl_fan_rpm(SYSCTLFN_ARGS); @@ -199,6 +203,7 @@ smu_attach(device_t parent, device_t sel { struct confargs *ca = aux; struct smu_softc *sc = device_private(self); + uint16_t data[4]; sc->sc_dev = self; sc->sc_node = ca->ca_node; @@ -227,6 +232,13 @@ smu_attach(device_t parent, device_t sel sc->sc_todr.cookie = sc; todr_attach(&sc->sc_todr); + /* calibration data */ + memset(data, 0, 8); + smu_get_datablock(SMU_CPUTEMP_CAL, (void *)data, 8); + DPRINTF("data %04x %04x %04x %04x\n", data[0], data[1], data[2], data[3]); + sc->cpu_m = data[2]; + sc->cpu_b = (int16_t)data[3]; + smu_setup_sme(sc); smu_setup_zones(sc); @@ -476,7 +488,8 @@ smu_setup_sme(struct smu_softc *sc) { struct smu_fan *fan; envsys_data_t *sme_sensor; - int i; + int i, sensors, child, reg; + char loc[32], type[32]; sc->sc_sme = sysmon_envsys_create(); @@ -494,7 +507,26 @@ smu_setup_sme(struct smu_softc *sc) return; } } - + sensors = OF_finddevice("/smu/sensors"); + child = OF_child(sensors); + while (child != 0) { + sme_sensor = &sc->sc_sme_sensors[i]; + if (OF_getprop(child, "location", loc, 32) == 0) goto next; + if (OF_getprop(child, "device_type", type, 32) == 0) goto next; + if (OF_getprop(child, "reg", ®, 4) == 0) goto next; + if (strcmp(type, "temp-sensor") == 0) { + sme_sensor->units = ENVSYS_STEMP; + sme_sensor->state = ENVSYS_SINVALID; + strncpy(sme_sensor->desc, loc, sizeof(sme_sensor->desc)); + sme_sensor->private = reg; + sysmon_envsys_sensor_attach(sc->sc_sme, sme_sensor); + i++; + printf("%s: %s@%x\n", loc, type, reg); + } +next: + child = OF_peer(child); + } + sc->sc_sme->sme_name = device_xname(sc->sc_dev); sc->sc_sme->sme_cookie = sc; sc->sc_sme->sme_refresh = smu_sme_refresh; @@ -535,6 +567,19 @@ smu_sme_refresh(struct sysmon_envsys *sm edata->value_cur = fan->current_rpm; edata->state = ENVSYS_SVALID; } + } else if (edata->private > 0) { + /* this works only for the CPU diode */ + int64_t r = smu_read_adc(sc, edata->private); + if (r != -1) { + r = r * sc->cpu_m; + r >>= 3; + r += (int64_t)sc->cpu_b << 9; + r <<= 1; + r *= 15625; + r /= 1024; + edata->value_cur = r + 27315; + edata->state = ENVSYS_SVALID; + } } } @@ -771,6 +816,23 @@ smu_fan_set_rpm(struct smu_fan *fan, int } static int +smu_read_adc(struct smu_softc *sc, int id) +{ + struct smu_cmd cmd; + int ret; + + cmd.cmd = SMU_CMD_ADC; + cmd.len = 1; + cmd.data[0] = id; + + ret = smu_do_cmd(sc, &cmd, 800); + if (ret == 0) { + return cmd.data[0] << 8 | cmd.data[1]; + } + return -1; +} + +static int smu_iicbus_exec(void *cookie, i2c_op_t op, i2c_addr_t addr, const void *send, size_t send_len, void *recv, size_t recv_len, int flags) {