CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: msaitoh Date: Wed Aug 18 09:17:17 UTC 2021 Modified Files: src/sys/dev/pci/ixgbe: ix_txrx.c Log Message: Refresh unrefreshed descriptors' buffers correctly. - Update next_to_refresh at least before ixgbe_rx_unrefresed() to detect the unrefreshed status correctly in ixgbe_rxeof(). - next_to_refresh points to the previous entry of the first unrefreshed descriptor, so fix a loop variable to point to the correct one in ixgbe_refresh_mbufs(). - Without the above two fixes, RX ring may have some unrefreshed entries which have inconsistent state. On such state, "ifconfig down up" causes panic in bus_dmamap_sync() on aarch64. - Tested on amd64 and aarch64. OK'd by knakahara. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/dev/pci/ixgbe/ix_txrx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.81 src/sys/dev/pci/ixgbe/ix_txrx.c:1.82 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.81 Wed Jul 7 08:58:19 2021 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Wed Aug 18 09:17:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.82 2021/08/18 09:17:17 msaitoh Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.82 2021/08/18 09:17:17 msaitoh Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -1336,15 +1336,15 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, struct adapter *adapter = rxr->adapter; struct ixgbe_rx_buf *rxbuf; struct mbuf *mp; - int i, j, error; + int i, error; boolrefreshed = false; - i = j = rxr->next_to_refresh; - /* Control the loop with one beyond */ - if (++j == rxr->num_desc) - j = 0; + i = rxr->next_to_refresh; + /* next_to_refresh points to the previous one */ + if (++i == rxr->num_desc) + i = 0; - while (j != limit) { + while (i != limit) { rxbuf = &rxr->rx_buffers[i]; if (rxbuf->buf == NULL) { mp = ixgbe_getjcl(&rxr->jcl_head, M_NOWAIT, @@ -1387,11 +1387,10 @@ ixgbe_refresh_mbufs(struct rx_ring *rxr, } refreshed = true; - /* Next is precalculated */ - i = j; + /* next_to_refresh points to the previous one */ rxr->next_to_refresh = i; - if (++j == rxr->num_desc) - j = 0; + if (++i == rxr->num_desc) + i = 0; } update: @@ -2090,6 +2089,7 @@ next_desc: /* Advance our pointers to the next descriptor. */ if (++i == rxr->num_desc) i = 0; + rxr->next_to_check = i; /* Now send to the stack or do LRO */ if (sendmp != NULL) { @@ -2107,8 +2107,6 @@ next_desc: if (ixgbe_rx_unrefreshed(rxr)) ixgbe_refresh_mbufs(rxr, i); - rxr->next_to_check = i; - IXGBE_RX_UNLOCK(rxr); #ifdef LRO
CVS commit: src/sys/dev/pci
Module Name:src Committed By: andvar Date: Tue Aug 17 17:16:40 UTC 2021 Modified Files: src/sys/dev/pci: pci_subr.c Log Message: s/Windw/Window/ in log message. To generate a diff of this commit: cvs rdiff -u -r1.227 -r1.228 src/sys/dev/pci/pci_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/dev/pci/pci_subr.c diff -u src/sys/dev/pci/pci_subr.c:1.227 src/sys/dev/pci/pci_subr.c:1.228 --- src/sys/dev/pci/pci_subr.c:1.227 Mon Jul 12 04:41:14 2021 +++ src/sys/dev/pci/pci_subr.c Tue Aug 17 17:16:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_subr.c,v 1.227 2021/07/12 04:41:14 msaitoh Exp $ */ +/* $NetBSD: pci_subr.c,v 1.228 2021/08/17 17:16:40 andvar Exp $ */ /* * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.227 2021/07/12 04:41:14 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.228 2021/08/17 17:16:40 andvar Exp $"); #ifdef _KERNEL_OPT #include "opt_pci.h" @@ -3539,7 +3539,7 @@ pci_conf_print_multicast_cap(const pcire /* Endpoint Only */ n = PCIREG_SHIFTOUT(reg, PCI_MCAST_CAP_WINSIZEREQ); if (n > 0) - printf(" Windw Size Requested: %d\n", 1 << (n - 1)); + printf(" Window Size Requested: %d\n", 1 << (n - 1)); onoff("ECRC Regeneration Supported", reg, PCI_MCAST_CAP_ECRCREGEN);
CVS commit: src/sys/dev/marvell
Module Name:src Committed By: andvar Date: Fri Aug 13 21:04:44 UTC 2021 Modified Files: src/sys/dev/marvell: if_mvxpe.c Log Message: s/fame/frame in mvxpe_mib_def with assumption that it was not intentional typo. To generate a diff of this commit: cvs rdiff -u -r1.34 -r1.35 src/sys/dev/marvell/if_mvxpe.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/marvell/if_mvxpe.c diff -u src/sys/dev/marvell/if_mvxpe.c:1.34 src/sys/dev/marvell/if_mvxpe.c:1.35 --- src/sys/dev/marvell/if_mvxpe.c:1.34 Mon Aug 2 12:56:24 2021 +++ src/sys/dev/marvell/if_mvxpe.c Fri Aug 13 21:04:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvxpe.c,v 1.34 2021/08/02 12:56:24 andvar Exp $ */ +/* $NetBSD: if_mvxpe.c,v 1.35 2021/08/13 21:04:44 andvar Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.34 2021/08/02 12:56:24 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvxpe.c,v 1.35 2021/08/13 21:04:44 andvar Exp $"); #include "opt_multiprocessor.h" @@ -218,7 +218,7 @@ STATIC struct mvxpe_mib_def { "Frame Size 256 - 511"}, {MVXPE_MIB_RX_FRAME1023_OCT, 0, "rx_frame_512_1023", "Frame Size 512 - 1023", 0}, - {MVXPE_MIB_RX_FRAMEMAX_OCT, 0, "rx_fame_1024_max", + {MVXPE_MIB_RX_FRAMEMAX_OCT, 0, "rx_frame_1024_max", "Frame Size 1024 - Max", 0}, {MVXPE_MIB_TX_GOOD_OCT, 1, "tx_good_oct", "Good Octets Tx", 0},
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jmcneill Date: Tue Aug 10 15:28:44 UTC 2021 Modified Files: src/sys/dev/ic: bcmgenet.c Log Message: Clear IFF_OACTIVE in genet_txintr (bug introduced in r1.8) and don't sync DMA maps with size 0. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/bcmgenet.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/bcmgenet.c diff -u src/sys/dev/ic/bcmgenet.c:1.9 src/sys/dev/ic/bcmgenet.c:1.10 --- src/sys/dev/ic/bcmgenet.c:1.9 Mon May 3 10:28:26 2021 +++ src/sys/dev/ic/bcmgenet.c Tue Aug 10 15:28:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: bcmgenet.c,v 1.9 2021/05/03 10:28:26 rin Exp $ */ +/* $NetBSD: bcmgenet.c,v 1.10 2021/08/10 15:28:44 jmcneill Exp $ */ /*- * Copyright (c) 2020 Jared McNeill @@ -34,7 +34,7 @@ #include "opt_ddb.h" #include -__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.9 2021/05/03 10:28:26 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bcmgenet.c,v 1.10 2021/08/10 15:28:44 jmcneill Exp $"); #include #include @@ -726,9 +726,11 @@ genet_rxintr(struct genet_softc *sc, int } /* unload map before it gets loaded in setup_rxbuf */ - bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map, - 0, sc->sc_rx.buf_map[index].map->dm_mapsize, - BUS_DMASYNC_POSTREAD); + if (sc->sc_rx.buf_map[index].map->dm_mapsize > 0) { + bus_dmamap_sync(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map, + 0, sc->sc_rx.buf_map[index].map->dm_mapsize, + BUS_DMASYNC_POSTREAD); + } bus_dmamap_unload(sc->sc_rx.buf_tag, sc->sc_rx.buf_map[index].map); sc->sc_rx.buf_map[index].mbuf = NULL; @@ -778,15 +780,18 @@ genet_txintr(struct genet_softc *sc, int bmap = &sc->sc_tx.buf_map[i]; if (bmap->mbuf != NULL) { /* XXX first segment already unloads */ - bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map, - 0, bmap->map->dm_mapsize, - BUS_DMASYNC_POSTWRITE); + if (bmap->map->dm_mapsize > 0) { +bus_dmamap_sync(sc->sc_tx.buf_tag, bmap->map, +0, bmap->map->dm_mapsize, +BUS_DMASYNC_POSTWRITE); + } bus_dmamap_unload(sc->sc_tx.buf_tag, bmap->map); m_freem(bmap->mbuf); bmap->mbuf = NULL; ++pkts; } + ifp->if_flags &= ~IFF_OACTIVE; i = TX_NEXT(i); sc->sc_tx.cidx = (sc->sc_tx.cidx + 1) & 0x; }
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: thorpej Date: Mon Aug 9 04:06:21 UTC 2021 Added Files: src/sys/dev/acpi: acpi_i2c.h Log Message: Fix CVS eff-up. To generate a diff of this commit: cvs rdiff -u -r0 -r1.4 src/sys/dev/acpi/acpi_i2c.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/dev/acpi/acpi_i2c.h diff -u /dev/null src/sys/dev/acpi/acpi_i2c.h:1.4 --- /dev/null Mon Aug 9 04:06:21 2021 +++ src/sys/dev/acpi/acpi_i2c.h Mon Aug 9 04:06:21 2021 @@ -0,0 +1,38 @@ +/* $NetBSD: acpi_i2c.h,v 1.4 2021/08/09 04:06:21 thorpej Exp $ */ + +/*- + * Copyright (c) 2017 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Manuel Bouyer. + * + * 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. + */ + + +#ifndef _SYS_DEV_ACPI_ACPI_I2C_H +#define _SYS_DEV_ACPI_ACPI_I2C_H +#include + +prop_array_t acpi_enter_i2c_devs(device_t, struct acpi_devnode *); +#endif /* _SYS_DEV_ACPI_ACPI_I2C_H */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: andvar Date: Sun Aug 8 21:45:53 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_parityscan.c Log Message: s/arry/array/ To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/raidframe/rf_parityscan.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/raidframe/rf_parityscan.c diff -u src/sys/dev/raidframe/rf_parityscan.c:1.37 src/sys/dev/raidframe/rf_parityscan.c:1.38 --- src/sys/dev/raidframe/rf_parityscan.c:1.37 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_parityscan.c Sun Aug 8 21:45:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_parityscan.c,v 1.37 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_parityscan.c,v 1.38 2021/08/08 21:45:53 andvar Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.37 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_parityscan.c,v 1.38 2021/08/08 21:45:53 andvar Exp $"); #include @@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: rf_paritysca /* * - * walk through the entire arry and write new parity. This works by + * walk through the entire array and write new parity. This works by * creating two DAGs, one to read a stripe of data and one to write * new parity. The first is executed, the data is xored together, and * then the second is executed. To avoid constantly building and
CVS commit: src/sys/dev/pci/cxgb
Module Name:src Committed By: andvar Date: Sun Aug 8 20:57:09 UTC 2021 Modified Files: src/sys/dev/pci/cxgb: cxgb_offload.c Log Message: s/propely/properly/ To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/pci/cxgb/cxgb_offload.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/cxgb/cxgb_offload.c diff -u src/sys/dev/pci/cxgb/cxgb_offload.c:1.6 src/sys/dev/pci/cxgb/cxgb_offload.c:1.7 --- src/sys/dev/pci/cxgb/cxgb_offload.c:1.6 Fri Dec 27 09:22:20 2019 +++ src/sys/dev/pci/cxgb/cxgb_offload.c Sun Aug 8 20:57:09 2021 @@ -31,7 +31,7 @@ POSSIBILITY OF SUCH DAMAGE. #include -__KERNEL_RCSID(0, "$NetBSD: cxgb_offload.c,v 1.6 2019/12/27 09:22:20 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cxgb_offload.c,v 1.7 2021/08/08 20:57:09 andvar Exp $"); #include #include @@ -516,7 +516,7 @@ cxgb_insert_tid(struct toedev *tdev, str } /* - * Populate a TID_RELEASE WR. The mbuf must be already propely sized. + * Populate a TID_RELEASE WR. The mbuf must be already properly sized. */ static inline void mk_tid_release(struct mbuf *m, unsigned int tid)
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Sun Aug 8 16:23:37 UTC 2021 Modified Files: src/sys/dev/sdmmc: if_bwfm_sdio.h Log Message: Fixup bwfm(4) register bit regarding SDIO device suspend/resume. >From OpenBSD if_bwfm_sdio.h r1.3 To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/sdmmc/if_bwfm_sdio.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/sdmmc/if_bwfm_sdio.h diff -u src/sys/dev/sdmmc/if_bwfm_sdio.h:1.2 src/sys/dev/sdmmc/if_bwfm_sdio.h:1.3 --- src/sys/dev/sdmmc/if_bwfm_sdio.h:1.2 Thu Oct 3 10:53:34 2019 +++ src/sys/dev/sdmmc/if_bwfm_sdio.h Sun Aug 8 16:23:37 2021 @@ -79,7 +79,7 @@ #define BWFM_SDIO_FUNC1_WAKEUPCTRL_HTWAIT (1 << 1) #define BWFM_SDIO_FUNC1_SLEEPCSR 0x1001F #define BWFM_SDIO_FUNC1_SLEEPCSR_KSO (1 << 0) -#define BWFM_SDIO_FUNC1_SLEEPCSR_DEVON (1 << 2) +#define BWFM_SDIO_FUNC1_SLEEPCSR_DEVON (1 << 1) #define BWFM_SDIO_SB_OFT_ADDR_PAGE 0x08000 #define BWFM_SDIO_SB_OFT_ADDR_MASK 0x07FFF
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sun Aug 8 15:23:42 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_regulator.c Log Message: fdt: regulator: pre-allocate regulator handle Workaround for PR# port-evbarm/54664 To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/fdt/fdt_regulator.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/fdt_regulator.c diff -u src/sys/dev/fdt/fdt_regulator.c:1.8 src/sys/dev/fdt/fdt_regulator.c:1.9 --- src/sys/dev/fdt/fdt_regulator.c:1.8 Mon May 27 23:18:33 2019 +++ src/sys/dev/fdt/fdt_regulator.c Sun Aug 8 15:23:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_regulator.c,v 1.8 2019/05/27 23:18:33 jmcneill Exp $ */ +/* $NetBSD: fdt_regulator.c,v 1.9 2021/08/08 15:23:42 jmcneill Exp $ */ /*- * Copyright (c) 2015 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_regulator.c,v 1.8 2019/05/27 23:18:33 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_regulator.c,v 1.9 2021/08/08 15:23:42 jmcneill Exp $"); #include #include @@ -37,6 +37,9 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_regulato #include #include +#define REGULATOR_TO_RC(_reg) \ + container_of((_reg), struct fdtbus_regulator_controller, rc_reg) + struct fdtbus_regulator_controller { device_t rc_dev; int rc_phandle; @@ -44,6 +47,8 @@ struct fdtbus_regulator_controller { u_int rc_enable_ramp_delay; + struct fdtbus_regulator rc_reg; /* handle returned by acquire() */ + LIST_ENTRY(fdtbus_regulator_controller) rc_next; }; @@ -60,6 +65,7 @@ fdtbus_register_regulator_controller(dev rc->rc_dev = dev; rc->rc_phandle = phandle; rc->rc_funcs = funcs; + rc->rc_reg.reg_rc = rc; of_getprop_uint32(phandle, "regulator-enable-ramp-delay", &rc->rc_enable_ramp_delay); @@ -85,7 +91,6 @@ struct fdtbus_regulator * fdtbus_regulator_acquire(int phandle, const char *prop) { struct fdtbus_regulator_controller *rc; - struct fdtbus_regulator *reg; int regulator_phandle; int error; @@ -105,26 +110,21 @@ fdtbus_regulator_acquire(int phandle, co return NULL; } - reg = kmem_alloc(sizeof(*reg), KM_SLEEP); - reg->reg_rc = rc; - - return reg; + return &rc->rc_reg; } void fdtbus_regulator_release(struct fdtbus_regulator *reg) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); rc->rc_funcs->release(rc->rc_dev); - - kmem_free(reg, sizeof(*reg)); } int fdtbus_regulator_enable(struct fdtbus_regulator *reg) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); int error; error = rc->rc_funcs->enable(rc->rc_dev, true); @@ -140,7 +140,7 @@ fdtbus_regulator_enable(struct fdtbus_re int fdtbus_regulator_disable(struct fdtbus_regulator *reg) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); if (of_hasprop(rc->rc_phandle, "regulator-always-on")) return EIO; @@ -152,7 +152,7 @@ int fdtbus_regulator_set_voltage(struct fdtbus_regulator *reg, u_int min_uvol, u_int max_uvol) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); if (rc->rc_funcs->set_voltage == NULL) return EINVAL; @@ -163,7 +163,7 @@ fdtbus_regulator_set_voltage(struct fdtb int fdtbus_regulator_get_voltage(struct fdtbus_regulator *reg, u_int *puvol) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); if (rc->rc_funcs->get_voltage == NULL) return EINVAL; @@ -175,7 +175,7 @@ int fdtbus_regulator_supports_voltage(struct fdtbus_regulator *reg, u_int min_uvol, u_int max_uvol) { - struct fdtbus_regulator_controller *rc = reg->reg_rc; + struct fdtbus_regulator_controller *rc = REGULATOR_TO_RC(reg); u_int uvol; if (rc->rc_funcs->set_voltage == NULL)
CVS commit: src/sys/dev/pci
Module Name:src Committed By: tnn Date: Sun Aug 8 12:17:37 UTC 2021 Modified Files: src/sys/dev/pci: radeonfb.c Log Message: radeonfb: use BUS_SPACE_MAP_PREFETCHABLE for the framebuffer mapping Makes the driver work on cia(4) based alpha machines, which can only do dense access to linear mappings with prefetch. ok macallan@ To generate a diff of this commit: cvs rdiff -u -r1.116 -r1.117 src/sys/dev/pci/radeonfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/radeonfb.c diff -u src/sys/dev/pci/radeonfb.c:1.116 src/sys/dev/pci/radeonfb.c:1.117 --- src/sys/dev/pci/radeonfb.c:1.116 Sat Aug 7 16:19:14 2021 +++ src/sys/dev/pci/radeonfb.c Sun Aug 8 12:17:37 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: radeonfb.c,v 1.116 2021/08/07 16:19:14 thorpej Exp $ */ +/* $NetBSD: radeonfb.c,v 1.117 2021/08/08 12:17:37 tnn Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.116 2021/08/07 16:19:14 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.117 2021/08/08 12:17:37 tnn Exp $"); #include #include @@ -799,7 +799,8 @@ radeonfb_attach(device_t parent, device_ sc->sc_memt = pa->pa_memt; if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz, - BUS_SPACE_MAP_LINEAR, &sc->sc_memh) != 0) { + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, + &sc->sc_memh) != 0) { sc->sc_memsz = 0; aprint_error("%s: Unable to map frame buffer\n", XNAME(sc)); goto error; @@ -1098,7 +1099,8 @@ radeonfb_map(struct radeonfb_softc *sc) return; } if (bus_space_map(sc->sc_memt, sc->sc_memaddr, sc->sc_memsz, - BUS_SPACE_MAP_LINEAR, &sc->sc_memh) != 0) { + BUS_SPACE_MAP_LINEAR | BUS_SPACE_MAP_PREFETCHABLE, + &sc->sc_memh) != 0) { sc->sc_memsz = 0; aprint_error_dev(sc->sc_dev, "Unable to map frame buffer\n");
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: jmcneill Date: Sun Aug 8 11:11:29 UTC 2021 Modified Files: src/sys/dev/sdmmc: if_bwfm_sdio.c Log Message: Use SMBIOS system product instead of the string "netbsd,generic-acpi" for firmware loading on ACPI systems. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/sdmmc/if_bwfm_sdio.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/sdmmc/if_bwfm_sdio.c diff -u src/sys/dev/sdmmc/if_bwfm_sdio.c:1.26 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.27 --- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.26 Mon Jun 21 03:17:59 2021 +++ src/sys/dev/sdmmc/if_bwfm_sdio.c Sun Aug 8 11:11:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_bwfm_sdio.c,v 1.26 2021/06/21 03:17:59 christos Exp $ */ +/* $NetBSD: if_bwfm_sdio.c,v 1.27 2021/08/08 11:11:29 jmcneill Exp $ */ /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation @@ -592,10 +592,17 @@ bwfm_fdt_find_phandle(device_t self, dev static const char * bwfm_fdt_get_model(void) { + const char *model; int phandle; phandle = OF_finddevice("/"); - return fdtbus_get_string_index(phandle, "compatible", 0); + model = fdtbus_get_string_index(phandle, "compatible", 0); + if (model == NULL || + (model != NULL && strcmp(model, "netbsd,generic-acpi") == 0)) { + model = pmf_get_platform("system-product"); + } + + return model; } static int
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: jmcneill Date: Sat Aug 7 21:19:16 UTC 2021 Modified Files: src/sys/dev/acpi: acpi_mcfg.c acpi_mcfg.h Log Message: acpi: expose acpimcfg_configure_bus_cb To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/dev/acpi/acpi_mcfg.c cvs rdiff -u -r1.3 -r1.4 src/sys/dev/acpi/acpi_mcfg.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/acpi/acpi_mcfg.c diff -u src/sys/dev/acpi/acpi_mcfg.c:1.23 src/sys/dev/acpi/acpi_mcfg.c:1.24 --- src/sys/dev/acpi/acpi_mcfg.c:1.23 Tue Jan 26 15:30:05 2021 +++ src/sys/dev/acpi/acpi_mcfg.c Sat Aug 7 21:19:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_mcfg.c,v 1.23 2021/01/26 15:30:05 skrll Exp $ */ +/* $NetBSD: acpi_mcfg.c,v 1.24 2021/08/07 21:19:15 jmcneill Exp $ */ /*- * Copyright (C) 2015 NONAKA Kimihiro @@ -28,7 +28,7 @@ #include "opt_pci.h" #include -__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.23 2021/01/26 15:30:05 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.24 2021/08/07 21:19:15 jmcneill Exp $"); #include #include @@ -693,7 +693,7 @@ out: } #ifdef PCI_NETBSD_CONFIGURE -static ACPI_STATUS +ACPI_STATUS acpimcfg_configure_bus_cb(ACPI_RESOURCE *res, void *ctx) { struct pciconf_resources *pcires = ctx; Index: src/sys/dev/acpi/acpi_mcfg.h diff -u src/sys/dev/acpi/acpi_mcfg.h:1.3 src/sys/dev/acpi/acpi_mcfg.h:1.4 --- src/sys/dev/acpi/acpi_mcfg.h:1.3 Sun Feb 2 16:31:25 2020 +++ src/sys/dev/acpi/acpi_mcfg.h Sat Aug 7 21:19:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_mcfg.h,v 1.3 2020/02/02 16:31:25 jmcneill Exp $ */ +/* $NetBSD: acpi_mcfg.h,v 1.4 2021/08/07 21:19:15 jmcneill Exp $ */ /*- * Copyright (C) 2015 NONAKA Kimihiro @@ -33,6 +33,7 @@ void acpimcfg_probe(struct acpi_softc *) int acpimcfg_init(bus_space_tag_t, const struct acpimcfg_ops *); int acpimcfg_map_bus(device_t, pci_chipset_tag_t, int); int acpimcfg_configure_bus(device_t, pci_chipset_tag_t, ACPI_HANDLE, int, int); +ACPI_STATUS acpimcfg_configure_bus_cb(ACPI_RESOURCE *, void *); int acpimcfg_conf_read(pci_chipset_tag_t, pcitag_t, int, pcireg_t *); int acpimcfg_conf_write(pci_chipset_tag_t, pcitag_t, int, pcireg_t);
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: jmcneill Date: Sat Aug 7 18:39:40 UTC 2021 Modified Files: src/sys/dev/acpi: acpi_resource.c acpivar.h Log Message: acpi: Add acpi_resource_parse_any(). Like acpi_resource_parse(), but doesn't exclude "produced" resources. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/sys/dev/acpi/acpi_resource.c cvs rdiff -u -r1.86 -r1.87 src/sys/dev/acpi/acpivar.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/acpi/acpi_resource.c diff -u src/sys/dev/acpi/acpi_resource.c:1.41 src/sys/dev/acpi/acpi_resource.c:1.42 --- src/sys/dev/acpi/acpi_resource.c:1.41 Tue Dec 31 17:26:04 2019 +++ src/sys/dev/acpi/acpi_resource.c Sat Aug 7 18:39:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_resource.c,v 1.41 2019/12/31 17:26:04 jmcneill Exp $ */ +/* $NetBSD: acpi_resource.c,v 1.42 2021/08/07 18:39:40 jmcneill Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.41 2019/12/31 17:26:04 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_resource.c,v 1.42 2021/08/07 18:39:40 jmcneill Exp $"); #include #include @@ -83,6 +83,7 @@ static ACPI_STATUS acpi_resource_parse_c struct resource_parse_callback_arg { const struct acpi_resource_parse_ops *ops; + bool include_producer; device_t dev; void *context; }; @@ -247,7 +248,8 @@ acpi_resource_parse_callback(ACPI_RESOUR case ACPI_RESOURCE_TYPE_ADDRESS32: /* XXX Only fixed size supported for now */ if (res->Data.Address32.Address.AddressLength == 0 || - res->Data.Address32.ProducerConsumer != ACPI_CONSUMER) + (!arg->include_producer && + res->Data.Address32.ProducerConsumer != ACPI_CONSUMER)) break; #define ADDRESS32_FIXED2(r) \ ((r)->Data.Address32.MinAddressFixed == ACPI_ADDRESS_FIXED && \ @@ -302,7 +304,8 @@ acpi_resource_parse_callback(ACPI_RESOUR #ifdef _LP64 /* XXX Only fixed size supported for now */ if (res->Data.Address64.Address.AddressLength == 0 || - res->Data.Address64.ProducerConsumer != ACPI_CONSUMER) + (!arg->include_producer && + res->Data.Address64.ProducerConsumer != ACPI_CONSUMER)) break; #define ADDRESS64_FIXED2(r) \ ((r)->Data.Address64.MinAddressFixed == ACPI_ADDRESS_FIXED && \ @@ -357,7 +360,8 @@ acpi_resource_parse_callback(ACPI_RESOUR break; case ACPI_RESOURCE_TYPE_EXTENDED_IRQ: - if (res->Data.ExtendedIrq.ProducerConsumer != ACPI_CONSUMER) { + if (!arg->include_producer && + res->Data.ExtendedIrq.ProducerConsumer != ACPI_CONSUMER) { ACPI_DEBUG_PRINT((ACPI_DB_RESOURCES, "ignored ExtIRQ producer\n")); break; @@ -420,6 +424,7 @@ acpi_resource_parse(device_t dev, ACPI_H cbarg.context = arg; cbarg.ops = ops; cbarg.dev = dev; + cbarg.include_producer = false; rv = AcpiWalkResources(handle, path, acpi_resource_parse_callback, &cbarg); @@ -436,6 +441,45 @@ acpi_resource_parse(device_t dev, ACPI_H } /* + * acpi_resource_parse_any: + * + * Parse a device node's resources and fill them in for the + * client. Like acpi_resource_parse, but doesn't skip ResourceProducer + * type resources. + */ +ACPI_STATUS +acpi_resource_parse_any(device_t dev, ACPI_HANDLE handle, const char *path, +void *arg, const struct acpi_resource_parse_ops *ops) +{ + struct resource_parse_callback_arg cbarg; + ACPI_STATUS rv; + + ACPI_FUNCTION_TRACE(__func__); + + if (ops->init) + (*ops->init)(dev, arg, &cbarg.context); + else + cbarg.context = arg; + cbarg.ops = ops; + cbarg.dev = dev; + cbarg.include_producer = true; + + rv = AcpiWalkResources(handle, path, acpi_resource_parse_callback, + &cbarg); + if (ACPI_FAILURE(rv)) { + aprint_error_dev(dev, "ACPI: unable to get %s resources: %s\n", + path, AcpiFormatException(rv)); + return_ACPI_STATUS(rv); + } + + if (ops->fini) + (*ops->fini)(dev, cbarg.context); + + return_ACPI_STATUS(AE_OK); +} + + +/* * acpi_resource_print: * * Print the resources assigned to a device. Index: src/sys/dev/acpi/acpivar.h diff -u src/sys/dev/acpi/acpivar.h:1.86 src/sys/dev/acpi/acpivar.h:1.87 --- src/sys/dev/acpi/acpivar.h:1.86 Wed May 12 23:22:33 2021 +++ src/sys/dev/acpi/acpivar.h Sat Aug 7 18:39:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: acpivar.h,v 1.86 2021/05/12 23:22:33 thorpej Exp $ */ +/* $NetBSD: acpivar.h,v 1.87 2021/08/07 18:39:40 jmcneill Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -330,6 +330,8 @@ void acpi_deregister_notify(struct acpi ACPI_STATUS acpi_resource_parse(device_t, ACPI_HANDLE, const char *, void *, const struct acpi_resource_parse_ops *); +ACPI_STATUS acpi_resource_parse_any(device_t, ACPI_HANDLE, const char *, + void *, const struct acpi_resource_parse_ops *); void acpi_resource_print(device_t, struct acpi_resources *); void acpi_resource_cleanup(struct acpi_resources *);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: tnn Date: Fri Aug 6 18:15:48 UTC 2021 Modified Files: src/sys/dev/ic: ssdfb.c Log Message: conditionally put back the include of This is a kludge to fix the build on some ports. According to pmap(9), including should be sufficient to use "bool pmap_is_modified(struct vm_page *pg)". However, on several ports, the function is implemented as a macro and depends on implementation details of "struct vm_page *", which is normally an incomplete forward declaration only. XXX revert when all ports are fixed. To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/ssdfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ssdfb.c diff -u src/sys/dev/ic/ssdfb.c:1.19 src/sys/dev/ic/ssdfb.c:1.20 --- src/sys/dev/ic/ssdfb.c:1.19 Thu Aug 5 22:31:20 2021 +++ src/sys/dev/ic/ssdfb.c Fri Aug 6 18:15:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $ */ +/* $NetBSD: ssdfb.c,v 1.20 2021/08/06 18:15:48 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.20 2021/08/06 18:15:48 tnn Exp $"); #include "opt_ddb.h" @@ -43,6 +43,9 @@ __KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1. #include #include +#ifdef pmap_is_modified +#include +#endif #include #include
CVS commit: src/sys/dev
Module Name:src Committed By: tnn Date: Thu Aug 5 22:31:20 UTC 2021 Modified Files: src/sys/dev/i2c: ssdfb_i2c.c src/sys/dev/ic: ssdfb.c ssdfbvar.h Log Message: ssdfb: revert rev 1.14 Can't run the worker thread MPSAFE with spi(4) yet because most controller drivers still lack MP safety. Cause issues when using multiple displays. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/ssdfb_i2c.c cvs rdiff -u -r1.18 -r1.19 src/sys/dev/ic/ssdfb.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/ssdfbvar.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/i2c/ssdfb_i2c.c diff -u src/sys/dev/i2c/ssdfb_i2c.c:1.10 src/sys/dev/i2c/ssdfb_i2c.c:1.11 --- src/sys/dev/i2c/ssdfb_i2c.c:1.10 Fri Jul 30 13:44:09 2021 +++ src/sys/dev/i2c/ssdfb_i2c.c Thu Aug 5 22:31:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $ */ +/* $NetBSD: ssdfb_i2c.c,v 1.11 2021/08/05 22:31:20 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.11 2021/08/05 22:31:20 tnn Exp $"); #include #include @@ -112,6 +112,7 @@ ssdfb_i2c_attach(device_t parent, device if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN) flags |= SSDFB_PRODUCT_SSD1306_GENERIC; + flags |= SSDFB_ATTACH_FLAG_MPSAFE; sc->sc.sc_dev = self; sc->sc_i2c_tag = ia->ia_tag; sc->sc_i2c_addr = ia->ia_addr; Index: src/sys/dev/ic/ssdfb.c diff -u src/sys/dev/ic/ssdfb.c:1.18 src/sys/dev/ic/ssdfb.c:1.19 --- src/sys/dev/ic/ssdfb.c:1.18 Thu Aug 5 19:07:09 2021 +++ src/sys/dev/ic/ssdfb.c Thu Aug 5 22:31:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $ */ +/* $NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $"); #include "opt_ddb.h" @@ -268,6 +268,7 @@ ssdfb_attach(struct ssdfb_softc *sc, int int error = 0; long defattr; const struct ssdfb_product *p; + int kt_flags; p = ssdfb_lookup_product(flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK); if (p == NULL) { @@ -393,11 +394,15 @@ ssdfb_attach(struct ssdfb_softc *sc, int if (sc->sc_is_console) ssdfb_set_usepoll(sc, true); - mutex_init(&sc->sc_cond_mtx, MUTEX_DEFAULT, IPL_SCHED); + mutex_init(&sc->sc_cond_mtx, MUTEX_DEFAULT, + ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE) ? IPL_SCHED : IPL_BIO); cv_init(&sc->sc_cond, "ssdfb"); - error = kthread_create(PRI_SOFTCLOCK, KTHREAD_MUSTJOIN | KTHREAD_MPSAFE, - NULL, ssdfb_thread, sc, &sc->sc_thread, "%s", - device_xname(sc->sc_dev)); + kt_flags = KTHREAD_MUSTJOIN; + /* XXX spi(4) is not MPSAFE yet. */ + if (ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE)) + kt_flags |= KTHREAD_MPSAFE; + error = kthread_create(PRI_SOFTCLOCK, kt_flags, NULL, ssdfb_thread, sc, + &sc->sc_thread, "%s", device_xname(sc->sc_dev)); if (error) { cv_destroy(&sc->sc_cond); mutex_destroy(&sc->sc_cond_mtx); Index: src/sys/dev/ic/ssdfbvar.h diff -u src/sys/dev/ic/ssdfbvar.h:1.9 src/sys/dev/ic/ssdfbvar.h:1.10 --- src/sys/dev/ic/ssdfbvar.h:1.9 Thu Aug 5 19:07:09 2021 +++ src/sys/dev/ic/ssdfbvar.h Thu Aug 5 22:31:20 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfbvar.h,v 1.9 2021/08/05 19:07:09 tnn Exp $ */ +/* $NetBSD: ssdfbvar.h,v 1.10 2021/08/05 22:31:20 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -36,6 +36,7 @@ #define SSDFB_ATTACH_FLAG_UPSIDEDOWN 0x0100 #define SSDFB_ATTACH_FLAG_INVERSE 0x0200 #define SSDFB_ATTACH_FLAG_CONSOLE 0x0400 +#define SSDFB_ATTACH_FLAG_MPSAFE 0x0800 /* * Fundamental commands
CVS commit: src/sys/dev/spi
Module Name:src Committed By: tnn Date: Thu Aug 5 19:17:22 UTC 2021 Modified Files: src/sys/dev/spi: ssdfb_spi.c Log Message: ssdfb: fix some constant names. NFC because the same cmd code is used To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/spi/ssdfb_spi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/spi/ssdfb_spi.c diff -u src/sys/dev/spi/ssdfb_spi.c:1.8 src/sys/dev/spi/ssdfb_spi.c:1.9 --- src/sys/dev/spi/ssdfb_spi.c:1.8 Thu Aug 5 19:08:59 2021 +++ src/sys/dev/spi/ssdfb_spi.c Thu Aug 5 19:17:22 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $ */ +/* $NetBSD: ssdfb_spi.c,v 1.9 2021/08/05 19:17:22 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.9 2021/08/05 19:17:22 tnn Exp $"); #include #include @@ -410,7 +410,7 @@ ssdfb_spi_xfer_rect_4wire_ssd1353(void * return 0; ssdfb_spi_4wire_set_dc(sc, 0); - cmd = SSD1322_CMD_SET_ROW_ADDRESS; + cmd = SSD1353_CMD_SET_ROW_ADDRESS; error = spi_send(sc->sc_sh, sizeof(cmd), &cmd); if (error) return error; @@ -427,7 +427,7 @@ ssdfb_spi_xfer_rect_4wire_ssd1353(void * return error; ssdfb_spi_4wire_set_dc(sc, 0); - cmd = SSD1322_CMD_SET_COLUMN_ADDRESS; + cmd = SSD1353_CMD_SET_COLUMN_ADDRESS; error = spi_send(sc->sc_sh, sizeof(cmd), &cmd); if (error) return error; @@ -439,7 +439,7 @@ ssdfb_spi_xfer_rect_4wire_ssd1353(void * return error; ssdfb_spi_4wire_set_dc(sc, 0); - cmd = SSD1322_CMD_WRITE_RAM; + cmd = SSD1353_CMD_WRITE_RAM; error = spi_send(sc->sc_sh, sizeof(cmd), &cmd); if (error) return error;
CVS commit: src/sys/dev/spi
Module Name:src Committed By: tnn Date: Thu Aug 5 19:08:59 UTC 2021 Modified Files: src/sys/dev/spi: ssdfb_spi.c Log Message: ssdfb: support SSD1353 at spi(4) To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/spi/ssdfb_spi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/spi/ssdfb_spi.c diff -u src/sys/dev/spi/ssdfb_spi.c:1.7 src/sys/dev/spi/ssdfb_spi.c:1.8 --- src/sys/dev/spi/ssdfb_spi.c:1.7 Tue Aug 3 11:30:25 2021 +++ src/sys/dev/spi/ssdfb_spi.c Thu Aug 5 19:08:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $ */ +/* $NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.8 2021/08/05 19:08:59 tnn Exp $"); #include #include @@ -70,6 +70,8 @@ static int ssdfb_spi_xfer_rect_3wire_ssd static int ssdfb_spi_cmd_4wire(void *, uint8_t *, size_t, bool); static int ssdfb_spi_xfer_rect_4wire_ssd1322(void *, uint8_t, uint8_t, uint8_t, uint8_t, uint8_t *, size_t, bool); +static int ssdfb_spi_xfer_rect_4wire_ssd1353(void *, uint8_t, uint8_t, + uint8_t, uint8_t, uint8_t *, size_t, bool); static void ssdfb_bitstream_init(struct bs_state *, uint8_t *); static void ssdfb_bitstream_append(struct bs_state *, uint8_t, uint8_t); @@ -84,6 +86,8 @@ CFATTACH_DECL_NEW(ssdfb_spi, sizeof(stru static const struct device_compatible_entry compat_data[] = { { .compat = "solomon,ssd1306", .value = SSDFB_PRODUCT_SSD1306_GENERIC }, { .compat = "solomon,ssd1322", .value = SSDFB_PRODUCT_SSD1322_GENERIC }, + { .compat = "solomon,ssd1353", .value = SSDFB_PRODUCT_SSD1353_GENERIC }, + { .compat = "dep160128a", .value = SSDFB_PRODUCT_DEP_160128A_RGB }, DEVICE_COMPAT_EOL }; @@ -154,28 +158,32 @@ ssdfb_spi_attach(device_t parent, device sc->sc_3wiremode = true; #endif + sc->sc.sc_cmd = sc->sc_3wiremode + ? ssdfb_spi_cmd_3wire + : ssdfb_spi_cmd_4wire; + switch (flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) { case SSDFB_PRODUCT_SSD1322_GENERIC: - if (sc->sc_3wiremode) { - sc->sc.sc_transfer_rect = - ssdfb_spi_xfer_rect_3wire_ssd1322; - } else { - sc->sc.sc_transfer_rect = - ssdfb_spi_xfer_rect_4wire_ssd1322; - } + sc->sc.sc_transfer_rect = sc->sc_3wiremode + ? ssdfb_spi_xfer_rect_3wire_ssd1322 + : ssdfb_spi_xfer_rect_4wire_ssd1322; + break; + case SSDFB_PRODUCT_SSD1353_GENERIC: + case SSDFB_PRODUCT_DEP_160128A_RGB: + sc->sc.sc_transfer_rect = sc->sc_3wiremode + ? NULL /* not supported here */ + : ssdfb_spi_xfer_rect_4wire_ssd1353; break; - default: - panic("ssdfb_spi_attach: product not implemented"); } - if (sc->sc_3wiremode) { - sc->sc.sc_cmd = ssdfb_spi_cmd_3wire; - } else { - sc->sc.sc_cmd = ssdfb_spi_cmd_4wire; + + if (!sc->sc.sc_transfer_rect) { + aprint_error(": sc_transfer_rect not implemented\n"); + return; } ssdfb_attach(&sc->sc, flags); - device_printf(sc->sc.sc_dev, "%d-wire SPI interface\n", + aprint_normal_dev(self, "%d-wire SPI interface\n", sc->sc_3wiremode == true ? 3 : 4); } @@ -381,3 +389,79 @@ ssdfb_spi_xfer_rect_4wire_ssd1322(void * return 0; } + +static int +ssdfb_spi_xfer_rect_4wire_ssd1353(void *cookie, uint8_t fromcol, uint8_t tocol, +uint8_t fromrow, uint8_t torow, uint8_t *p, size_t stride, bool usepoll) +{ + struct ssdfb_spi_softc *sc = (struct ssdfb_spi_softc *)cookie; + uint8_t row; + size_t rlen = (tocol + 1 - fromcol) * 3; + uint8_t bitstream[160 * 3]; + uint8_t *dstp, *srcp, *endp; + int error; + uint8_t cmd; + uint8_t data[2]; + + /* + * Unlike iic(4), there is no way to force spi(4) to use polling. + */ + if (usepoll && !cold) + return 0; + + ssdfb_spi_4wire_set_dc(sc, 0); + cmd = SSD1322_CMD_SET_ROW_ADDRESS; + error = spi_send(sc->sc_sh, sizeof(cmd), &cmd); + if (error) + return error; + ssdfb_spi_4wire_set_dc(sc, 1); + data[0] = fromrow; + data[1] = torow; + if (sc->sc.sc_upsidedown) { + /* fix picture outside frame on 160x128 panel */ + data[0] += 132 - sc->sc.sc_p->p_height; + data[1] += 132 - sc->sc.sc_p->p_height; + } + error = spi_send(sc->sc_sh, sizeof(data), data); + if (error) + return error; + + ssdfb_spi_4wire_set_dc(sc, 0); + cmd = SSD1322_CMD_SET_COLUMN_ADDRESS; + error = spi_send(sc->sc_sh, sizeof(cmd), &cmd); + if (error) + return error; + ssdfb_spi_4wire_set_dc(sc, 1); + data[0] = fromcol; + data[1] = tocol; + error = spi_send(sc->sc_sh, sizeof(data), data); + if (error) + return error; + + ssdfb_spi_4wire_set_dc(sc, 0); + cmd = SSD1322_CMD_WRITE_RAM; + error = spi_send(sc->sc_sh, sizeof(cmd), &cmd); + if (error) + return error; + + ssdfb_spi_4wire_set_dc(sc, 1); + KASSERT(rlen <= sizeof(bitstream)); + for (row = fromrow; row <= torow; row++) { + /* downconvert
CVS commit: src/sys/dev/ic
Module Name:src Committed By: tnn Date: Thu Aug 5 19:07:09 UTC 2021 Modified Files: src/sys/dev/ic: ssdfb.c ssdfbvar.h Log Message: ssdfb: support the SSD1353 controller and the DEP 160128A(1)-RGB display DEP 160128A is a 160x128 18-bit RGB OLED display module advertised as having an 8-bit parallel I/O interface. The controller can however attach serially via spi(4) by moving jumper resistors J1 and J2 to GND position. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/ssdfb.c cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/ssdfbvar.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/ssdfb.c diff -u src/sys/dev/ic/ssdfb.c:1.17 src/sys/dev/ic/ssdfb.c:1.18 --- src/sys/dev/ic/ssdfb.c:1.17 Thu Aug 5 00:16:36 2021 +++ src/sys/dev/ic/ssdfb.c Thu Aug 5 19:07:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $ */ +/* $NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $"); #include "opt_ddb.h" @@ -75,6 +75,7 @@ static void ssdfb_cursor(void *, int, in /* hardware interface */ static int ssdfb_init_ssd1306(struct ssdfb_softc *); static int ssdfb_init_ssd1322(struct ssdfb_softc *); +static int ssdfb_init_ssd1353(struct ssdfb_softc *); static int ssdfb_set_contrast(struct ssdfb_softc *, uint8_t, bool); static int ssdfb_set_display_on(struct ssdfb_softc *, bool, bool); static int ssdfb_set_mode(struct ssdfb_softc *, u_int); @@ -89,6 +90,7 @@ static void ssdfb_set_usepoll(struct ssd static int ssdfb_sync(struct ssdfb_softc *, bool); static int ssdfb_sync_ssd1306(struct ssdfb_softc *, bool); static int ssdfb_sync_ssd1322(struct ssdfb_softc *, bool); +static int ssdfb_sync_ssd1353(struct ssdfb_softc *, bool); static uint64_t ssdfb_transpose_block(uint8_t *, size_t); /* misc helpers */ @@ -104,7 +106,8 @@ static const char *ssdfb_controller_name [SSDFB_CONTROLLER_UNKNOWN] = "unknown", [SSDFB_CONTROLLER_SSD1306] = "Solomon Systech SSD1306", [SSDFB_CONTROLLER_SH1106] = "Sino Wealth SH1106", - [SSDFB_CONTROLLER_SSD1322] = "Solomon Systech SSD1322" + [SSDFB_CONTROLLER_SSD1322] = "Solomon Systech SSD1322", + [SSDFB_CONTROLLER_SSD1353] = "Solomon Systech SSD1353" }; /* @@ -204,6 +207,44 @@ static const struct ssdfb_product ssdfb_ .p_multiplex_ratio = 0x3f, .p_init = ssdfb_init_ssd1322, .p_sync = ssdfb_sync_ssd1322 + }, + { + .p_product_id = SSDFB_PRODUCT_SSD1353_GENERIC, + .p_controller_id = SSDFB_CONTROLLER_SSD1353, + .p_name = "generic", + .p_width = 160, + .p_height = 132, + .p_bits_per_pixel = 32, + .p_rgb = true, + .p_panel_shift = 0, + .p_compin_cfg = SSD1353_REMAP_RGB | SSD1353_REMAP_SPLIT_ODD_EVEN + | __SHIFTIN(2, SSD1353_REMAP_PIXEL_FORMAT_MASK), + .p_vcomh_deselect_level = SSD1353_DEFAULT_VCOMH, + .p_fosc = SSD1353_DEFAULT_FREQUENCY, + .p_fosc_div = SSD1353_DEFAULT_DIVIDER, + .p_default_contrast = SSD1353_DEFAULT_CONTRAST_CONTROL, + .p_multiplex_ratio = 0x83, + .p_init = ssdfb_init_ssd1353, + .p_sync = ssdfb_sync_ssd1353 + }, + { + .p_product_id = SSDFB_PRODUCT_DEP_160128A_RGB, + .p_controller_id = SSDFB_CONTROLLER_SSD1353, + .p_name = "Display Elektronik GmbH DEP 160128A(1)-RGB", + .p_width = 160, + .p_height = 128, + .p_bits_per_pixel = 32, + .p_rgb = true, + .p_panel_shift = 0, + .p_compin_cfg = SSD1353_REMAP_RGB | SSD1353_REMAP_SPLIT_ODD_EVEN + | __SHIFTIN(2, SSD1353_REMAP_PIXEL_FORMAT_MASK), + .p_vcomh_deselect_level = SSD1353_DEFAULT_VCOMH, + .p_fosc = SSD1353_DEFAULT_FREQUENCY, + .p_fosc_div = SSD1353_DEFAULT_DIVIDER, + .p_default_contrast = SSD1353_DEFAULT_CONTRAST_CONTROL, + .p_multiplex_ratio = 0x83, + .p_init = ssdfb_init_ssd1353, + .p_sync = ssdfb_sync_ssd1353 } }; @@ -872,18 +913,148 @@ ssdfb_init_ssd1322(struct ssdfb_softc *s } static int +ssdfb_init_ssd1353(struct ssdfb_softc *sc) +{ + int error; + uint8_t cmd[3]; + bool usepoll = true; + uint8_t remap; + + /* + * Enter sleep. + */ + SSDFB_CMD2(SSD1353_CMD_SET_COMMAND_LOCK, SSD1353_COMMAND_UNLOCK_MAGIC); + if (error) + return error; + SSDFB_CMD1(SSD1353_CMD_RESET); + if (error) + return error; + SSDFB_CMD1(SSD1353_CMD_DEACTIVATE_SCROLL); + if (error) + return error; + SSDFB_CMD1(SSD1353_CMD_SET_DISPLAY_OFF); + if (error) + return error; + + /* + * Start charge pumps. + */ + SSDFB_CMD2(SSD1353_CMD_SET_VCOMH, sc->sc_p->p_vcomh_deselect_level); + if (error) + return error; + SSDFB_CMD2(SSD1353_CMD_SET_PRE_CHARGE_VOLTAGE_LEVEL, + SSD1353_DEFAULT_PRE_CHARGE_VOLTAGE_LEVEL); + if (error) + return error; + + /* + * Configure timing characteristics. + */ + SSDFB_CMD2(SSD1353_CMD_SET_FRONT_CLOCK_DIVIDER, + __SHIFTIN
CVS commit: src/sys/dev/ic
Module Name:src Committed By: tnn Date: Thu Aug 5 00:16:36 UTC 2021 Modified Files: src/sys/dev/ic: ssdfb.c ssdfbvar.h Log Message: ssdfb: prepare for supporting rgb color displays To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/ssdfb.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ic/ssdfbvar.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/ssdfb.c diff -u src/sys/dev/ic/ssdfb.c:1.16 src/sys/dev/ic/ssdfb.c:1.17 --- src/sys/dev/ic/ssdfb.c:1.16 Thu Aug 5 00:02:51 2021 +++ src/sys/dev/ic/ssdfb.c Thu Aug 5 00:16:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $ */ +/* $NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.17 2021/08/05 00:16:36 tnn Exp $"); #include "opt_ddb.h" @@ -268,16 +268,35 @@ ssdfb_attach(struct ssdfb_softc *sc, int goto out; } #ifdef SSDFB_USE_NATIVE_DEPTH - ri->ri_depth = sc->sc_p->p_bits_per_pixel; + ri->ri_depth = sc->sc_p->p_bits_per_pixel; #else - ri->ri_depth = 8; + if (sc->sc_p->p_rgb && sc->sc_p->p_bits_per_pixel == 32) { + ri->ri_depth = sc->sc_p->p_bits_per_pixel; + ri->ri_rnum = 8; + ri->ri_gnum = 8; + ri->ri_bnum = 8; +#if _BYTE_ORDER == _LITTLE_ENDIAN + ri->ri_rpos = 0; + ri->ri_gpos = 8; + ri->ri_bpos = 16; +#else + ri->ri_rpos = 24; + ri->ri_gpos = 16; + ri->ri_bpos = 8; +#endif + } else { + ri->ri_depth = 8; + } #endif ri->ri_font = sc->sc_font; ri->ri_width = sc->sc_p->p_width; ri->ri_height = sc->sc_p->p_height; ri->ri_stride = ri->ri_width * ri->ri_depth / 8; ri->ri_hw = sc; - ri->ri_flg = RI_FULLCLEAR | RI_FORCEMONO; + ri->ri_flg = RI_FULLCLEAR; + if (!sc->sc_p->p_rgb) { + ri->ri_flg |= RI_FORCEMONO; + } sc->sc_ri_bits_len = round_page(ri->ri_stride * ri->ri_height); ri->ri_bits = (u_char *)uvm_km_alloc(kernel_map, sc->sc_ri_bits_len, 0, UVM_KMF_WIRED); @@ -290,7 +309,9 @@ ssdfb_attach(struct ssdfb_softc *sc, int if (error) goto out; - ri->ri_caps &= ~WSSCREEN_WSCOLORS; + if (!sc->sc_p->p_rgb) { + ri->ri_caps &= ~WSSCREEN_WSCOLORS; + } /* * Save original emul ops & insert our damage notification hooks. @@ -425,8 +446,10 @@ ssdfb_ioctl(void *v, void *vs, u_long cm case WSDISPLAYIO_GET_FBINFO: fbi = (struct wsdisplayio_fbinfo *)data; error = wsdisplayio_get_fbinfo(&sc->sc_ri, fbi); - fbi->fbi_subtype.fbi_cmapinfo.cmap_entries = cmaplen; - /* fbi->fbi_pixeltype = WSFB_GREYSCALE */; + if (!sc->sc_p->p_rgb) { + fbi->fbi_subtype.fbi_cmapinfo.cmap_entries = cmaplen; + /* fbi->fbi_pixeltype = WSFB_GREYSCALE */; + } return error; case WSDISPLAYIO_LINEBYTES: *(u_int *)data = sc->sc_ri.ri_stride; @@ -483,6 +506,8 @@ ssdfb_ioctl(void *v, void *vs, u_long cm return 0; #endif case WSDISPLAYIO_GETCMAP: + if (sc->sc_p->p_rgb) + return ENOTSUP; wc = (struct wsdisplay_cmap *)data; if (wc->index >= cmaplen || wc->count > cmaplen - wc->index) @@ -1117,9 +1142,9 @@ ssdfb_sync_ssd1322(struct ssdfb_softc *s * Transfer rasops bitmap into gddram shadow buffer while keeping track * of the bounding box of the dirty region we scribbled over. */ - x1 = sc->sc_p->p_width; + x1 = width; x2 = -1; - y1 = sc->sc_p->p_height; + y1 = height; y2 = -1; blockp = (uint16_t*)sc->sc_gddram; for (y = 0; y < height; y++) { Index: src/sys/dev/ic/ssdfbvar.h diff -u src/sys/dev/ic/ssdfbvar.h:1.7 src/sys/dev/ic/ssdfbvar.h:1.8 --- src/sys/dev/ic/ssdfbvar.h:1.7 Mon Aug 2 14:00:48 2021 +++ src/sys/dev/ic/ssdfbvar.h Thu Aug 5 00:16:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfbvar.h,v 1.7 2021/08/02 14:00:48 tnn Exp $ */ +/* $NetBSD: ssdfbvar.h,v 1.8 2021/08/05 00:16:36 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -235,6 +235,13 @@ #define SSD1353_CMD_SET_SECOND_PRECHARGE_SPEED 0x8a #define SSD1353_DEFAULT_SECOND_PRECHARGE_SPEED 2 #define SSD1353_CMD_REMAP_COLOR_DEPTH 0xa0 + #define SSD1353_REMAP_NO_INCREMENT __BIT(0) + #define SSD1353_REMAP_SEG_DIRECTION __BIT(1) + #define SSD1353_REMAP_RGB __BIT(2) + #define SSD1353_REMAP_LR __BIT(3) + #define SSD1353_REMAP_COM_DIRECTION __BIT(4) + #define SSD1353_REMAP_SPLIT_ODD_EVEN __BIT(5) + #define SSD1353_REMAP_PIXEL_FORMAT_MASK __BITS(7, 6) #define SSD1353_CMD_SET_DISPLAY_START_LINE SSD1322_CMD_SET_DISPLAY_START_LINE #define SSD1353_CMD_SET_DISPLAY_OFFSET SSD1322_CMD_SET_DISPLAY_OFFSET #define SSD1353_CMD_SET_VERTICAL_SCROLL_AREA SSDFB_CMD_SET_VERTICAL_SCROLL_AREA @@ -305,6 +312,7 @@ struct ssdfb_product { intp_width; intp_height; intp_bits_per_pixel; + boolp_rgb; intp_panel_shift; uint8_tp_fosc; uint8_tp_fosc_div;
CVS commit: src/sys/dev/ic
Module Name:src Committed By: tnn Date: Thu Aug 5 00:02:51 UTC 2021 Modified Files: src/sys/dev/ic: ssdfb.c Log Message: ssdfb: make it work on big-endian To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/ssdfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ssdfb.c diff -u src/sys/dev/ic/ssdfb.c:1.15 src/sys/dev/ic/ssdfb.c:1.16 --- src/sys/dev/ic/ssdfb.c:1.15 Mon Aug 2 14:00:48 2021 +++ src/sys/dev/ic/ssdfb.c Thu Aug 5 00:02:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $ */ +/* $NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.16 2021/08/05 00:02:51 tnn Exp $"); #include "opt_ddb.h" @@ -1126,24 +1126,27 @@ ssdfb_sync_ssd1322(struct ssdfb_softc *s src = (uint16_t*)&ri->ri_bits[y * ri->ri_stride]; src32 = (uint32_t*)src; for (x = 0; x < width_in_blocks; x++) { -#if _BYTE_ORDER == _LITTLE_ENDIAN -# ifdef SSDFB_USE_NATIVE_DEPTH +#ifdef SSDFB_USE_NATIVE_DEPTH raw_block = ((*src << 12) & 0xf000) | - ((*src << 4) & 0x0f00) | - ((*src >> 4) & 0x00f0) | + ((*src << 4) & 0x0f00) | + ((*src >> 4) & 0x00f0) | ((*src >> 12) & 0x000f); src++; -# else +#else raw_block = +# if _BYTE_ORDER == _LITTLE_ENDIAN ((*src32 << 8) & 0x0f00) | ((*src32 << 4) & 0xf000) | ((*src32 >> 16) & 0x000f) | ((*src32 >> 20) & 0x00f0); +# else + ((*src32 >> 24) & 0x000f) | + ((*src32 >> 12) & 0x00f0) | + ((*src32 ) & 0x0f00) | + ((*src32 << 12) & 0xf000); # endif src32++; -#else -# error please add big endian host support here #endif if (raw_block != *blockp) { *blockp = raw_block; @@ -1159,7 +1162,6 @@ ssdfb_sync_ssd1322(struct ssdfb_softc *s blockp++; } } - blockp = (uint16_t*)sc->sc_gddram; if (x2 != -1) return sc->sc_transfer_rect(sc->sc_cookie,
CVS commit: src/sys/dev/dkwedge
Module Name:src Committed By: mlelstv Date: Wed Aug 4 21:44:42 UTC 2021 Modified Files: src/sys/dev/dkwedge: dk.c Log Message: Swap and Dump uses DEV_BSIZE units. Translate from device sectors like regular I/O (strategy). To generate a diff of this commit: cvs rdiff -u -r1.105 -r1.106 src/sys/dev/dkwedge/dk.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/dkwedge/dk.c diff -u src/sys/dev/dkwedge/dk.c:1.105 src/sys/dev/dkwedge/dk.c:1.106 --- src/sys/dev/dkwedge/dk.c:1.105 Wed Jun 2 17:56:40 2021 +++ src/sys/dev/dkwedge/dk.c Wed Aug 4 21:44:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dk.c,v 1.105 2021/06/02 17:56:40 mlelstv Exp $ */ +/* $NetBSD: dk.c,v 1.106 2021/08/04 21:44:41 mlelstv Exp $ */ /*- * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.105 2021/06/02 17:56:40 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.106 2021/08/04 21:44:41 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_dkwedge.h" @@ -1639,6 +1639,7 @@ static int dksize(dev_t dev) { struct dkwedge_softc *sc = dkwedge_lookup(dev); + uint64_t p_size; int rv = -1; if (sc == NULL) @@ -1651,12 +1652,13 @@ dksize(dev_t dev) /* Our content type is static, no need to open the device. */ + p_size = sc->sc_size << sc->sc_parent->dk_blkshift; if (strcmp(sc->sc_ptype, DKW_PTYPE_SWAP) == 0) { /* Saturate if we are larger than INT_MAX. */ - if (sc->sc_size > INT_MAX) + if (p_size > INT_MAX) rv = INT_MAX; else - rv = (int) sc->sc_size; + rv = (int) p_size; } mutex_exit(&sc->sc_parent->dk_rawlock); @@ -1675,6 +1677,7 @@ dkdump(dev_t dev, daddr_t blkno, void *v { struct dkwedge_softc *sc = dkwedge_lookup(dev); const struct bdevsw *bdev; + uint64_t p_size, p_offset; int rv = 0; if (sc == NULL) @@ -1697,16 +1700,20 @@ dkdump(dev_t dev, daddr_t blkno, void *v rv = EINVAL; goto out; } - if (blkno < 0 || blkno + size / DEV_BSIZE > sc->sc_size) { + + p_offset = sc->sc_offset << sc->sc_parent->dk_blkshift; + p_size = sc->sc_size << sc->sc_parent->dk_blkshift; + + if (blkno < 0 || blkno + size / DEV_BSIZE > p_size) { printf("%s: blkno (%" PRIu64 ") + size / DEV_BSIZE (%zu) > " - "sc->sc_size (%" PRIu64 ")\n", __func__, blkno, - size / DEV_BSIZE, sc->sc_size); + "p_size (%" PRIu64 ")\n", __func__, blkno, + size / DEV_BSIZE, p_size); rv = EINVAL; goto out; } bdev = bdevsw_lookup(sc->sc_pdev); - rv = (*bdev->d_dump)(sc->sc_pdev, blkno + sc->sc_offset, va, size); + rv = (*bdev->d_dump)(sc->sc_pdev, blkno + p_offset, va, size); out: mutex_exit(&sc->sc_parent->dk_rawlock);
CVS commit: src/sys/dev/spi
Module Name:src Committed By: tnn Date: Tue Aug 3 11:30:26 UTC 2021 Modified Files: src/sys/dev/spi: ssdfb_spi.c Log Message: ssdfb: support having an optional reset pin To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/spi/ssdfb_spi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/spi/ssdfb_spi.c diff -u src/sys/dev/spi/ssdfb_spi.c:1.6 src/sys/dev/spi/ssdfb_spi.c:1.7 --- src/sys/dev/spi/ssdfb_spi.c:1.6 Sun Aug 1 14:56:18 2021 +++ src/sys/dev/spi/ssdfb_spi.c Tue Aug 3 11:30:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $ */ +/* $NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.7 2021/08/03 11:30:25 tnn Exp $"); #include #include @@ -55,6 +55,7 @@ struct ssdfb_spi_softc { struct spi_handle *sc_sh; #ifdef FDT struct fdtbus_gpio_pin *sc_gpio_dc; + struct fdtbus_gpio_pin *sc_gpio_res; #endif bool sc_3wiremode; }; @@ -133,13 +134,22 @@ ssdfb_spi_attach(device_t parent, device * 4 wire mode sends 8 bit sequences and requires an auxiliary GPIO * pin for the command/data bit. */ - sc->sc_3wiremode = true; #ifdef FDT const int phandle = sa->sa_cookie; - sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "dc-gpio", GPIO_PIN_OUTPUT); + sc->sc_gpio_dc = + fdtbus_gpio_acquire(phandle, "dc-gpio", GPIO_PIN_OUTPUT); if (!sc->sc_gpio_dc) - sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "cd-gpio", GPIO_PIN_OUTPUT); + sc->sc_gpio_dc = + fdtbus_gpio_acquire(phandle, "cd-gpio", GPIO_PIN_OUTPUT); sc->sc_3wiremode = (sc->sc_gpio_dc == NULL); + sc->sc_gpio_res = + fdtbus_gpio_acquire(phandle, "res-gpio", GPIO_PIN_OUTPUT); + if (sc->sc_gpio_res) { + fdtbus_gpio_write_raw(sc->sc_gpio_res, 0); + DELAY(100); + fdtbus_gpio_write_raw(sc->sc_gpio_res, 1); + DELAY(100); + } #else sc->sc_3wiremode = true; #endif
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: msaitoh Date: Tue Aug 3 07:54:39 UTC 2021 Modified Files: src/sys/dev/sdmmc: sdmmc_mem.c Log Message: Use unsigned to avoid undefined behavior in sdmmc_mem_sd_switch(). Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/dev/sdmmc/sdmmc_mem.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/sdmmc/sdmmc_mem.c diff -u src/sys/dev/sdmmc/sdmmc_mem.c:1.73 src/sys/dev/sdmmc/sdmmc_mem.c:1.74 --- src/sys/dev/sdmmc/sdmmc_mem.c:1.73 Sun Jun 13 09:50:02 2021 +++ src/sys/dev/sdmmc/sdmmc_mem.c Tue Aug 3 07:54:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: sdmmc_mem.c,v 1.73 2021/06/13 09:50:02 mlelstv Exp $ */ +/* $NetBSD: sdmmc_mem.c,v 1.74 2021/08/03 07:54:39 msaitoh Exp $ */ /* $OpenBSD: sdmmc_mem.c,v 1.10 2009/01/09 10:55:22 jsg Exp $ */ /* @@ -45,7 +45,7 @@ /* Routines for SD/MMC memory cards. */ #include -__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.73 2021/06/13 09:50:02 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sdmmc_mem.c,v 1.74 2021/08/03 07:54:39 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_sdmmc.h" @@ -1604,8 +1604,8 @@ sdmmc_mem_sd_switch(struct sdmmc_functio cmd.c_datalen = statlen; cmd.c_blklen = statlen; cmd.c_opcode = SD_SEND_SWITCH_FUNC; - cmd.c_arg = - (!!mode << 31) | (function << gsft) | (0x00ff & ~(0xf << gsft)); + cmd.c_arg = ((uint32_t)!!mode << 31) | + (function << gsft) | (0x00ff & ~(0xf << gsft)); cmd.c_flags = SCF_CMD_ADTC | SCF_CMD_READ | SCF_RSP_R1 | SCF_RSP_SPI_R1; if (ISSET(sc->sc_caps, SMC_CAPS_DMA)) cmd.c_dmamap = sc->sc_dmap;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: knakahara Date: Tue Aug 3 01:08:18 UTC 2021 Modified Files: src/sys/dev/pci: if_wm.c Log Message: Fix locking against myself reported by rin@n.o. In some machine, INTx interrupts occurs for some reason while holding txq_lock in softint context. e.g. https://dmesgd.nycbug.org/index.cgi?do=view&id=6139 The panic message is the following. [ 50.1699480] panic: LOCKDEBUG: Mutex error: mutex_vector_enter,467: locking against myself [ 50.1800188] cpu0: Begin traceback... [ 50.1800188] 0xc7a29ac4: netbsd:db_panic+0xc [ 50.1900018] 0xc7a29adc: netbsd:vpanic+0x120 [ 50.1999533] 0xc7a29af4: netbsd:aprint_debug [ 50.1999533] 0xc7a29b34: netbsd:lockdebug_abort1+0x18c [ 50.2099719] 0xc7a29b74: netbsd:lockdebug_wantlock+0x1e8 [ 50.2199525] 0xc7a29bb4: netbsd:mutex_enter+0x288 [ 50.2299642] 0xc7a29be4: netbsd:wm_intr_legacy+0x9c [ 50.2299642] 0xc7a29c2c: netbsd:i80321_intr_dispatch+0x138 [ 50.2399631] 0xc7a29de4: netbsd:irq_entry+0x98 [ 50.2499452] 0xc7a29e24: netbsd:entropy_enter+0x88 [ 50.256] 0xc7a29e6c: netbsd:rnd_add_data_1+0x50 [ 50.2699565] 0xc7a29ebc: netbsd:rnd_add_data+0x10c [ 50.2699565] 0xc7a29ed4: netbsd:rnd_add_uint32+0x28 [ 50.2799524] 0xc7a29f1c: netbsd:wm_txeof+0x2c0 [ 50.2899527] 0xc7a29f5c: netbsd:wm_handle_queue+0x44 [ 50.3000257] 0xc7a29fac: netbsd:softint_thread+0x130 [ 50.3100119] cpu0: End traceback... To fix this panic, stop wm(4) interrupts before calling softint. This behavior is similar to MSI-X polling mode. Reviewed by msaitoh@n.o, tested by rin@n.o, thanks. To generate a diff of this commit: cvs rdiff -u -r1.705 -r1.706 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.705 src/sys/dev/pci/if_wm.c:1.706 --- src/sys/dev/pci/if_wm.c:1.705 Wed Jun 16 00:21:18 2021 +++ src/sys/dev/pci/if_wm.c Tue Aug 3 01:08:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.705 2021/06/16 00:21:18 riastradh Exp $ */ +/* $NetBSD: if_wm.c,v 1.706 2021/08/03 01:08:18 knakahara Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -82,7 +82,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.705 2021/06/16 00:21:18 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.706 2021/08/03 01:08:18 knakahara Exp $"); #ifdef _KERNEL_OPT #include "opt_net_mpsafe.h" @@ -9774,6 +9774,20 @@ wm_sched_handle_queue(struct wm_softc *s softint_schedule(wmq->wmq_si); } +static inline void +wm_legacy_intr_disable(struct wm_softc *sc) +{ + + CSR_WRITE(sc, WMREG_IMC, 0xU); +} + +static inline void +wm_legacy_intr_enable(struct wm_softc *sc) +{ + + CSR_WRITE(sc, WMREG_IMS, sc->sc_icr); +} + /* * wm_intr_legacy: * @@ -9788,6 +9802,7 @@ wm_intr_legacy(void *arg) struct wm_rxqueue *rxq = &wmq->wmq_rxq; uint32_t icr, rndval = 0; int handled = 0; + bool more = false; while (1 /* CONSTCOND */) { icr = CSR_READ(sc, WMREG_ICR); @@ -9822,7 +9837,7 @@ wm_intr_legacy(void *arg) * as if_percpuq_enqueue() just call softint_schedule(). * So, we can call wm_rxeof() in interrupt context. */ - wm_rxeof(rxq, UINT_MAX); + more = wm_rxeof(rxq, UINT_MAX); mutex_exit(rxq->rxq_lock); mutex_enter(txq->txq_lock); @@ -9840,7 +9855,7 @@ wm_intr_legacy(void *arg) WM_Q_EVCNT_INCR(txq, txdw); } #endif - wm_txeof(txq, UINT_MAX); + more |= wm_txeof(txq, UINT_MAX); mutex_exit(txq->txq_lock); WM_CORE_LOCK(sc); @@ -9869,8 +9884,9 @@ wm_intr_legacy(void *arg) rnd_add_uint32(&sc->rnd_source, rndval); - if (handled) { + if (more) { /* Try to get more packets going. */ + wm_legacy_intr_disable(sc); wmq->wmq_txrx_use_workqueue = sc->sc_txrx_use_workqueue; wm_sched_handle_queue(sc, wmq); } @@ -9883,6 +9899,10 @@ wm_txrxintr_disable(struct wm_queue *wmq { struct wm_softc *sc = wmq->wmq_txq.txq_sc; + if (__predict_false(!wm_is_using_msix(sc))) { + return wm_legacy_intr_disable(sc); + } + if (sc->sc_type == WM_T_82574) CSR_WRITE(sc, WMREG_IMC, ICR_TXQ(wmq->wmq_id) | ICR_RXQ(wmq->wmq_id)); @@ -9900,6 +9920,10 @@ wm_txrxintr_enable(struct wm_queue *wmq) wm_itrs_calculate(sc, wmq); + if (__predict_false(!wm_is_using_msix(sc))) { + return wm_legacy_intr_enable(sc); + } + /* * ICR_OTHER which is disabled in wm_linkintr_msix() is enabled here. * There is no need to care about which of RXQ(0) and RXQ(1) enable
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Mon Aug 2 22:37:29 UTC 2021 Modified Files: src/sys/dev/raidframe: raidframevar.h rf_raid.h Log Message: Accidentally commited some other changes that weren't quite ready. Add these changes to fix the build. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/raidframevar.h cvs rdiff -u -r1.49 -r1.50 src/sys/dev/raidframe/rf_raid.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/raidframe/raidframevar.h diff -u src/sys/dev/raidframe/raidframevar.h:1.21 src/sys/dev/raidframe/raidframevar.h:1.22 --- src/sys/dev/raidframe/raidframevar.h:1.21 Thu Oct 10 03:43:59 2019 +++ src/sys/dev/raidframe/raidframevar.h Mon Aug 2 22:37:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: raidframevar.h,v 1.21 2019/10/10 03:43:59 christos Exp $ */ +/* $NetBSD: raidframevar.h,v 1.22 2021/08/02 22:37:29 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. * All rights reserved. @@ -355,6 +355,7 @@ typedef RF_uint32 RF_ReconReqFlags_t; /* flags that can be put in the rf_recon_req structure */ #define RF_FDFLAGS_NONE 0x0 /* just fail the disk */ #define RF_FDFLAGS_RECON 0x1 /* fail and initiate recon */ +#define RF_FDFLAGS_RECON_FORCE 0x2 /* fail and initiate recon, ignoring errors */ struct rf_recon_req { /* used to tell the kernel to fail a disk */ RF_RowCol_t col; Index: src/sys/dev/raidframe/rf_raid.h diff -u src/sys/dev/raidframe/rf_raid.h:1.49 src/sys/dev/raidframe/rf_raid.h:1.50 --- src/sys/dev/raidframe/rf_raid.h:1.49 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_raid.h Mon Aug 2 22:37:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid.h,v 1.49 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_raid.h,v 1.50 2021/08/02 22:37:29 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -187,6 +187,7 @@ struct RF_Raid_s { RF_HeadSepLimit_t headSepLimit; int numFloatingReconBufs; int reconInProgress; + int forceRecon; rf_declare_cond2(waitForReconCond); /* goes with raidPtr->mutex */ RF_RaidReconDesc_t *reconDesc; /* reconstruction descriptor */ RF_ReconCtrl_t *reconControl; /* reconstruction control structure
CVS commit: src/sys/dev/ic
Module Name:src Committed By: tnn Date: Mon Aug 2 14:00:48 UTC 2021 Modified Files: src/sys/dev/ic: ssdfb.c ssdfbvar.h Log Message: ssdfb: define SSD1353 command set also adjust some SSD1322 command names To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/sys/dev/ic/ssdfb.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/ic/ssdfbvar.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/ssdfb.c diff -u src/sys/dev/ic/ssdfb.c:1.14 src/sys/dev/ic/ssdfb.c:1.15 --- src/sys/dev/ic/ssdfb.c:1.14 Fri Jul 30 13:44:09 2021 +++ src/sys/dev/ic/ssdfb.c Mon Aug 2 14:00:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb.c,v 1.14 2021/07/30 13:44:09 tnn Exp $ */ +/* $NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.14 2021/07/30 13:44:09 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.15 2021/08/02 14:00:48 tnn Exp $"); #include "opt_ddb.h" @@ -271,7 +271,7 @@ ssdfb_attach(struct ssdfb_softc *sc, int ri->ri_depth = sc->sc_p->p_bits_per_pixel; #else ri->ri_depth = 8; -#endif +#endif ri->ri_font = sc->sc_font; ri->ri_width = sc->sc_p->p_width; ri->ri_height = sc->sc_p->p_height; @@ -774,14 +774,14 @@ ssdfb_init_ssd1322(struct ssdfb_softc *s if (error) return error; SSDFB_CMD2(SSD1322_CMD_SET_SECOND_PRECHARGE_PERIOD, - SSD1322_DEFAULT_SECOND_PRECHARGE); + SSD1322_DEFAULT_SECOND_PRECHARGE_PERIOD); if (error) return error; /* * Configure physical display panel layout. */ - SSDFB_CMD2(SSD1322_CMD_SET_MUX_RATIO, sc->sc_p->p_multiplex_ratio); + SSDFB_CMD2(SSD1322_CMD_SET_MULTIPLEX_RATIO, sc->sc_p->p_multiplex_ratio); if (error) return error; if (sc->sc_upsidedown) Index: src/sys/dev/ic/ssdfbvar.h diff -u src/sys/dev/ic/ssdfbvar.h:1.6 src/sys/dev/ic/ssdfbvar.h:1.7 --- src/sys/dev/ic/ssdfbvar.h:1.6 Fri Jul 30 13:44:09 2021 +++ src/sys/dev/ic/ssdfbvar.h Mon Aug 2 14:00:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfbvar.h,v 1.6 2021/07/30 13:44:09 tnn Exp $ */ +/* $NetBSD: ssdfbvar.h,v 1.7 2021/08/02 14:00:48 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -154,13 +154,12 @@ #define SSD1322_CMD_SET_DISPLAY_START_LINE 0xa1 #define SSD1322_CMD_SET_DISPLAY_OFFSET 0xa2 -/* These are the same as SSDFB generic commands */ -#define SSD1322_CMD_ENTIRE_DISPLAY_OFF 0xa4 -#define SSD1322_CMD_ENTIRE_DISPLAY_ON 0xa5 -#define SSD1322_CMD_NORMAL_DISPLAY 0xa6 -#define SSD1322_CMD_INVERSE_DISPLAY 0xa7 -#define SSD1322_CMD_SET_SLEEP_MODE_ON 0xae -#define SSD1322_CMD_SET_SLEEP_MODE_OFF 0xaf +#define SSD1322_CMD_ENTIRE_DISPLAY_OFF SSDFB_CMD_ENTIRE_DISPLAY_OFF +#define SSD1322_CMD_ENTIRE_DISPLAY_ON SSDFB_CMD_ENTIRE_DISPLAY_ON +#define SSD1322_CMD_NORMAL_DISPLAY SSDFB_CMD_SET_NORMAL_DISPLAY +#define SSD1322_CMD_INVERSE_DISPLAY SSDFB_CMD_SET_INVERSE_DISPLAY +#define SSD1322_CMD_SET_SLEEP_MODE_ON SSDFB_CMD_SET_DISPLAY_OFF +#define SSD1322_CMD_SET_SLEEP_MODE_OFF SSDFB_CMD_SET_DISPLAY_ON #define SSD1322_CMD_ENABLE_PARTIAL_DISPLAY 0xa8 #define SSD1322_CMD_EXIT_PARTIAL_DISPLAY 0xa9 @@ -190,7 +189,7 @@ #define SSD1322_GPIO1_LOW __BIT(3) #define SSD1322_GPIO1_HIGH __BITS(3, 2) #define SSD1322_CMD_SET_SECOND_PRECHARGE_PERIOD 0xb6 - #define SSD1322_DEFAULT_SECOND_PRECHARGE 8 + #define SSD1322_DEFAULT_SECOND_PRECHARGE_PERIOD 8 #define SSD1322_CMD_SET_GRAY_SCALE_TABLE 0xb8 #define SSD1322_CMD_SET_DEFAULT_GRAY_SCALE_TABLE 0xb9 #define SSD1322_CMD_SET_PRE_CHARGE_VOLTAGE_LEVEL 0xbb @@ -201,13 +200,73 @@ #define SSD1322_DEFAULT_CONTRAST_CURRENT 0x7f #define SSD1322_CMD_MASTER_CONTRAST_CURRENT_CONTROL 0xc7 #define SSD1322_DEFAULT_MASTER_CONTRAST_CURRENT_CONTROL 0xf -#define SSD1322_CMD_SET_MUX_RATIO 0xca +#define SSD1322_CMD_SET_MULTIPLEX_RATIO 0xca #define SSD1322_CMD_DISPLAY_ENHANCEMENT_B 0xd1 #define SSD1322_DISPLAY_ENHANCEMENT_B_MAGIC1 0xa2 #define SSD1322_DISPLAY_ENHANCEMENT_B_MAGIC2 0x20 #define SSD1322_CMD_SET_COMMAND_LOCK 0xfd #define SSD1322_COMMAND_UNLOCK_MAGIC 0x12 #define SSD1322_COMMAND_LOCK_MAGIC 0x16 +/* undocumented on this chip, but works in practice */ +#define SSD1322_CMD_NOP SSDFB_CMD_NOP + +/* + * SSD1353 command set + */ +#define SSD1353_CMD_SET_COLUMN_ADDRESS SSD1322_CMD_SET_COLUMN_ADDRESS +#define SSD1353_CMD_DRAW_LINE0x21 +#define SSD1353_CMD_DRAW_RECTANGLE 0x22 +#define SSD1353_CMD_COPY0x23 +#define SSD1353_CMD_DIM 0x24 +#define SSD1353_CMD_CLEAR_WINDOW 0x25 +#define SSD1353_CMD_FILL_ENABLE0x26 +#define SSD1353_CMD_SCROLLING_SETUP 0x27 +#define SSD1353_CMD_DEACTIVATE_SCROLL SSDFB_CMD_DEACTIVATE_SCROLL +#define SSD1353_CMD_ACTIVATE_SCROLL SSDFB_CMD_ACTIVATE_SCROLL +#define SSD1353_CMD_WRITE_RAMSSD1322_CMD_WRITE_RAM +#define SD1353_CMD_READ_RAMSSD1322_CMD_READ_RAM +#define SSD1353_CMD_SET_ROW_
CVS commit: src/sys/dev/spi
Module Name:src Committed By: tnn Date: Sun Aug 1 14:56:18 UTC 2021 Modified Files: src/sys/dev/spi: ssdfb_spi.c Log Message: ssdfb: support the 4-wire SPI interface To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/spi/ssdfb_spi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/spi/ssdfb_spi.c diff -u src/sys/dev/spi/ssdfb_spi.c:1.5 src/sys/dev/spi/ssdfb_spi.c:1.6 --- src/sys/dev/spi/ssdfb_spi.c:1.5 Wed Jan 27 02:32:31 2021 +++ src/sys/dev/spi/ssdfb_spi.c Sun Aug 1 14:56:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb_spi.c,v 1.5 2021/01/27 02:32:31 thorpej Exp $ */ +/* $NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.5 2021/01/27 02:32:31 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.6 2021/08/01 14:56:18 tnn Exp $"); #include #include @@ -39,6 +39,10 @@ __KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c, #include #include #include +#include "opt_fdt.h" +#ifdef FDT +#include +#endif struct bs_state { uint8_t *base; @@ -49,6 +53,9 @@ struct bs_state { struct ssdfb_spi_softc { struct ssdfb_softc sc; struct spi_handle *sc_sh; +#ifdef FDT + struct fdtbus_gpio_pin *sc_gpio_dc; +#endif bool sc_3wiremode; }; @@ -74,7 +81,8 @@ CFATTACH_DECL_NEW(ssdfb_spi, sizeof(stru ssdfb_spi_match, ssdfb_spi_attach, NULL, NULL); static const struct device_compatible_entry compat_data[] = { - { .compat = "solomon,ssd1322" }, + { .compat = "solomon,ssd1306", .value = SSDFB_PRODUCT_SSD1306_GENERIC }, + { .compat = "solomon,ssd1322", .value = SSDFB_PRODUCT_SSD1322_GENERIC }, DEVICE_COMPAT_EOL }; @@ -108,8 +116,14 @@ ssdfb_spi_attach(device_t parent, device sc->sc.sc_dev = self; sc->sc_sh = sa->sa_handle; sc->sc.sc_cookie = (void *)sc; - if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN) - flags |= SSDFB_PRODUCT_SSD1322_GENERIC; + if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN) { + const struct device_compatible_entry *dce = + device_compatible_lookup(sa->sa_compat, sa->sa_ncompat, compat_data); + if (dce) + flags |= (int)dce->value; + else + flags |= SSDFB_PRODUCT_SSD1322_GENERIC; + } /* * Note on interface modes. * @@ -117,11 +131,18 @@ ssdfb_spi_attach(device_t parent, device * the bit that determines if the lower 8 bits are command or data. * * 4 wire mode sends 8 bit sequences and requires an auxiliary GPIO - * pin for the command/data bit. But in other to allocate a GPIO pin - * we need to use fdt, so only support 3 wire mode in this frontend, - * at least for now. + * pin for the command/data bit. */ sc->sc_3wiremode = true; +#ifdef FDT + const int phandle = sa->sa_cookie; + sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "dc-gpio", GPIO_PIN_OUTPUT); + if (!sc->sc_gpio_dc) + sc->sc_gpio_dc = fdtbus_gpio_acquire(phandle, "cd-gpio", GPIO_PIN_OUTPUT); + sc->sc_3wiremode = (sc->sc_gpio_dc == NULL); +#else + sc->sc_3wiremode = true; +#endif switch (flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) { case SSDFB_PRODUCT_SSD1322_GENERIC: @@ -141,7 +162,7 @@ ssdfb_spi_attach(device_t parent, device } else { sc->sc.sc_cmd = ssdfb_spi_cmd_4wire; } - + ssdfb_attach(&sc->sc, flags); device_printf(sc->sc.sc_dev, "%d-wire SPI interface\n", @@ -264,8 +285,11 @@ ssdfb_bitstream_final(struct bs_state *s static void ssdfb_spi_4wire_set_dc(struct ssdfb_spi_softc *sc, int value) { - /* TODO: this should toggle an auxilliary GPIO pin */ +#ifdef FDT + fdtbus_gpio_write_raw(sc->sc_gpio_dc, value); +#else panic("ssdfb_spi_4wire_set_dc"); +#endif } static int
CVS commit: src/sys/dev/ic
Module Name:src Committed By: tnn Date: Sat Jul 31 10:04:13 UTC 2021 Modified Files: src/sys/dev/ic: com.c Log Message: only read cpr register if we're going to use the value To generate a diff of this commit: cvs rdiff -u -r1.364 -r1.365 src/sys/dev/ic/com.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/com.c diff -u src/sys/dev/ic/com.c:1.364 src/sys/dev/ic/com.c:1.365 --- src/sys/dev/ic/com.c:1.364 Fri Jul 30 12:46:46 2021 +++ src/sys/dev/ic/com.c Sat Jul 31 10:04:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.364 2021/07/30 12:46:46 tnn Exp $ */ +/* $NetBSD: com.c,v 1.365 2021/07/31 10:04:12 tnn Exp $ */ /*- * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.364 2021/07/30 12:46:46 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.365 2021/07/31 10:04:12 tnn Exp $"); #include "opt_com.h" #include "opt_ddb.h" @@ -539,10 +539,11 @@ com_attach_subr(struct com_softc *sc) goto fifodelay; case COM_TYPE_DW_APB: - cpr = bus_space_read_4(sc->sc_regs.cr_iot, sc->sc_regs.cr_ioh, - DW_APB_UART_CPR); - if (!prop_dictionary_get_uint(dict, "fifolen", &sc->sc_fifolen)) + if (!prop_dictionary_get_uint(dict, "fifolen", &sc->sc_fifolen)) { + cpr = bus_space_read_4(sc->sc_regs.cr_iot, + sc->sc_regs.cr_ioh, DW_APB_UART_CPR); sc->sc_fifolen = __SHIFTOUT(cpr, UART_CPR_FIFO_MODE) * 16; + } if (sc->sc_fifolen == 0) { sc->sc_fifolen = 1; fifo_msg = "DesignWare APB UART, no fifo";
CVS commit: src/sys/dev
Module Name:src Committed By: tnn Date: Fri Jul 30 13:44:09 UTC 2021 Modified Files: src/sys/dev/i2c: ssdfb_i2c.c src/sys/dev/ic: ssdfb.c ssdfbvar.h Log Message: ssdfb(4): remove code for dealing with non-MPSAFE attachment spi(4) was marked MPSAFE some time ago, so we're always on an MPSAFE parent device. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/dev/i2c/ssdfb_i2c.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/ssdfb.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/ic/ssdfbvar.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/i2c/ssdfb_i2c.c diff -u src/sys/dev/i2c/ssdfb_i2c.c:1.9 src/sys/dev/i2c/ssdfb_i2c.c:1.10 --- src/sys/dev/i2c/ssdfb_i2c.c:1.9 Thu Jan 28 14:42:45 2021 +++ src/sys/dev/i2c/ssdfb_i2c.c Fri Jul 30 13:44:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb_i2c.c,v 1.9 2021/01/28 14:42:45 thorpej Exp $ */ +/* $NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.9 2021/01/28 14:42:45 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $"); #include #include @@ -112,7 +112,6 @@ ssdfb_i2c_attach(device_t parent, device if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN) flags |= SSDFB_PRODUCT_SSD1306_GENERIC; - flags |= SSDFB_ATTACH_FLAG_MPSAFE; sc->sc.sc_dev = self; sc->sc_i2c_tag = ia->ia_tag; sc->sc_i2c_addr = ia->ia_addr; Index: src/sys/dev/ic/ssdfb.c diff -u src/sys/dev/ic/ssdfb.c:1.13 src/sys/dev/ic/ssdfb.c:1.14 --- src/sys/dev/ic/ssdfb.c:1.13 Sat Apr 24 23:36:55 2021 +++ src/sys/dev/ic/ssdfb.c Fri Jul 30 13:44:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfb.c,v 1.13 2021/04/24 23:36:55 thorpej Exp $ */ +/* $NetBSD: ssdfb.c,v 1.14 2021/07/30 13:44:09 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.13 2021/04/24 23:36:55 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.14 2021/07/30 13:44:09 tnn Exp $"); #include "opt_ddb.h" @@ -227,7 +227,6 @@ ssdfb_attach(struct ssdfb_softc *sc, int int error = 0; long defattr; const struct ssdfb_product *p; - int kt_flags; p = ssdfb_lookup_product(flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK); if (p == NULL) { @@ -332,15 +331,11 @@ ssdfb_attach(struct ssdfb_softc *sc, int if (sc->sc_is_console) ssdfb_set_usepoll(sc, true); - mutex_init(&sc->sc_cond_mtx, MUTEX_DEFAULT, - ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE) ? IPL_SCHED : IPL_BIO); + mutex_init(&sc->sc_cond_mtx, MUTEX_DEFAULT, IPL_SCHED); cv_init(&sc->sc_cond, "ssdfb"); - kt_flags = KTHREAD_MUSTJOIN; - /* XXX spi(4) is not MPSAFE yet. */ - if (ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE)) - kt_flags |= KTHREAD_MPSAFE; - error = kthread_create(PRI_SOFTCLOCK, kt_flags, NULL, ssdfb_thread, sc, - &sc->sc_thread, "%s", device_xname(sc->sc_dev)); + error = kthread_create(PRI_SOFTCLOCK, KTHREAD_MUSTJOIN | KTHREAD_MPSAFE, + NULL, ssdfb_thread, sc, &sc->sc_thread, "%s", + device_xname(sc->sc_dev)); if (error) { cv_destroy(&sc->sc_cond); mutex_destroy(&sc->sc_cond_mtx); Index: src/sys/dev/ic/ssdfbvar.h diff -u src/sys/dev/ic/ssdfbvar.h:1.5 src/sys/dev/ic/ssdfbvar.h:1.6 --- src/sys/dev/ic/ssdfbvar.h:1.5 Sat Nov 2 14:18:36 2019 +++ src/sys/dev/ic/ssdfbvar.h Fri Jul 30 13:44:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ssdfbvar.h,v 1.5 2019/11/02 14:18:36 tnn Exp $ */ +/* $NetBSD: ssdfbvar.h,v 1.6 2021/07/30 13:44:09 tnn Exp $ */ /* * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -36,7 +36,6 @@ #define SSDFB_ATTACH_FLAG_UPSIDEDOWN 0x0100 #define SSDFB_ATTACH_FLAG_INVERSE 0x0200 #define SSDFB_ATTACH_FLAG_CONSOLE 0x0400 -#define SSDFB_ATTACH_FLAG_MPSAFE 0x0800 /* * Fundamental commands
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Tue Jul 27 03:09:27 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_cvscan.c rf_cvscan.h Log Message: Missed cleaning up this "peek" routines the other day. Take care of it now. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/raidframe/rf_cvscan.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/raidframe/rf_cvscan.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/raidframe/rf_cvscan.c diff -u src/sys/dev/raidframe/rf_cvscan.c:1.17 src/sys/dev/raidframe/rf_cvscan.c:1.18 --- src/sys/dev/raidframe/rf_cvscan.c:1.17 Sat Feb 9 03:33:59 2019 +++ src/sys/dev/raidframe/rf_cvscan.c Tue Jul 27 03:09:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_cvscan.c,v 1.17 2019/02/09 03:33:59 christos Exp $ */ +/* $NetBSD: rf_cvscan.c,v 1.18 2021/07/27 03:09:26 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -35,7 +35,7 @@ **/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_cvscan.c,v 1.17 2019/02/09 03:33:59 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_cvscan.c,v 1.18 2021/07/27 03:09:26 oster Exp $"); #include #include "rf_alloclist.h" @@ -272,44 +272,6 @@ rf_CvscanDequeue(void *q_in) return (ret); } - - -RF_DiskQueueData_t * -rf_CvscanPeek(void *q_in) -{ - RF_CvscanHeader_t *hdr = (RF_CvscanHeader_t *) q_in; - longrange, i, sum_dist_left, sum_dist_right; - RF_DiskQueueData_t *tmp, *headElement; - - DO_CHECK_STATE(hdr); - - if (hdr->left_cnt == 0 && hdr->right_cnt == 0) - headElement = NULL; - else { - range = RF_MIN(hdr->range_for_avg, RF_MIN(hdr->left_cnt, hdr->right_cnt)); - for (i = 0, tmp = hdr->left, sum_dist_left = - ((hdr->direction == rf_cvscan_RIGHT) ? range * hdr->change_penalty : 0); - tmp != NULL && i < range; - tmp = tmp->next, i++) { - sum_dist_left += hdr->cur_block - tmp->sectorOffset; - } - for (i = 0, tmp = hdr->right, sum_dist_right = - ((hdr->direction == rf_cvscan_LEFT) ? range * hdr->change_penalty : 0); - tmp != NULL && i < range; - tmp = tmp->next, i++) { - sum_dist_right += tmp->sectorOffset - hdr->cur_block; - } - - if (hdr->right_cnt == 0 || sum_dist_left < sum_dist_right) - headElement = hdr->left; - else - headElement = hdr->right; - } - return (headElement); -} - - - /* ** CVSCAN( 1, 0 ) is Shortest Seek Time First (SSTF) **lowest average response time Index: src/sys/dev/raidframe/rf_cvscan.h diff -u src/sys/dev/raidframe/rf_cvscan.h:1.6 src/sys/dev/raidframe/rf_cvscan.h:1.7 --- src/sys/dev/raidframe/rf_cvscan.h:1.6 Sun Dec 11 12:23:37 2005 +++ src/sys/dev/raidframe/rf_cvscan.h Tue Jul 27 03:09:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_cvscan.h,v 1.6 2005/12/11 12:23:37 christos Exp $ */ +/* $NetBSD: rf_cvscan.h,v 1.7 2021/07/27 03:09:26 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -75,7 +75,6 @@ rf_CvscanCreate(RF_SectorCount_t sect_pe RF_AllocListElem_t * cl_list, RF_ShutdownList_t ** listp); voidrf_CvscanEnqueue(void *qptr, RF_DiskQueueData_t * req, int priority); RF_DiskQueueData_t *rf_CvscanDequeue(void *qptr); -RF_DiskQueueData_t *rf_CvscanPeek(void *qptr); int rf_CvscanPromote(void *qptr, RF_StripeNum_t parityStripeID, RF_ReconUnitNum_t which_ru);
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Tue Jul 27 03:01:48 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_copyback.c rf_dagfuncs.c rf_diskqueue.c rf_diskqueue.h rf_reconstruct.c Log Message: rf_CreateDiskQueueData() no longer uses waitflag, and will always succeed. Cleanup the error path for the (no longer needed) PR_NOWAIT cases. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/dev/raidframe/rf_copyback.c cvs rdiff -u -r1.32 -r1.33 src/sys/dev/raidframe/rf_dagfuncs.c cvs rdiff -u -r1.61 -r1.62 src/sys/dev/raidframe/rf_diskqueue.c cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_diskqueue.h cvs rdiff -u -r1.126 -r1.127 src/sys/dev/raidframe/rf_reconstruct.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/raidframe/rf_copyback.c diff -u src/sys/dev/raidframe/rf_copyback.c:1.54 src/sys/dev/raidframe/rf_copyback.c:1.55 --- src/sys/dev/raidframe/rf_copyback.c:1.54 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_copyback.c Tue Jul 27 03:01:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_copyback.c,v 1.54 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_copyback.c,v 1.55 2021/07/27 03:01:48 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -38,7 +38,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.54 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_copyback.c,v 1.55 2021/07/27 03:01:48 oster Exp $"); #include @@ -335,12 +335,10 @@ rf_CopybackOne(RF_CopybackDesc_t *desc, /* create reqs to read the old location & write the new */ desc->readreq = rf_CreateDiskQueueData(RF_IO_TYPE_READ, spOffs, sectPerSU, desc->databuf, 0L, 0, rf_CopybackReadDoneProc, desc, - NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL, - PR_WAITOK); + NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL); desc->writereq = rf_CreateDiskQueueData(RF_IO_TYPE_WRITE, testOffs, sectPerSU, desc->databuf, 0L, 0, rf_CopybackWriteDoneProc, desc, - NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL, - PR_WAITOK); + NULL, (void *) raidPtr, RF_DISKQUEUE_DATA_FLAGS_NONE, NULL); desc->fcol = testCol; /* enqueue the read. the write will go out as part of the callback on Index: src/sys/dev/raidframe/rf_dagfuncs.c diff -u src/sys/dev/raidframe/rf_dagfuncs.c:1.32 src/sys/dev/raidframe/rf_dagfuncs.c:1.33 --- src/sys/dev/raidframe/rf_dagfuncs.c:1.32 Fri Jun 19 19:29:39 2020 +++ src/sys/dev/raidframe/rf_dagfuncs.c Tue Jul 27 03:01:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_dagfuncs.c,v 1.32 2020/06/19 19:29:39 jdolecek Exp $ */ +/* $NetBSD: rf_dagfuncs.c,v 1.33 2021/07/27 03:01:48 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.32 2020/06/19 19:29:39 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_dagfuncs.c,v 1.33 2021/07/27 03:01:48 oster Exp $"); #include #include @@ -280,13 +280,10 @@ rf_DiskReadFuncForThreads(RF_DagNode_t * #else NULL, #endif - (void *) (node->dagHdr->raidPtr), 0, node->dagHdr->bp, PR_NOWAIT); - if (!req) { - (node->wakeFunc) (node, ENOMEM); - } else { - node->dagFuncData = (void *) req; - rf_DiskIOEnqueue(&(dqs[pda->col]), req, priority); - } + (void *) (node->dagHdr->raidPtr), 0, node->dagHdr->bp); + + node->dagFuncData = (void *) req; + rf_DiskIOEnqueue(&(dqs[pda->col]), req, priority); } @@ -314,14 +311,10 @@ rf_DiskWriteFuncForThreads(RF_DagNode_t NULL, #endif (void *) (node->dagHdr->raidPtr), - 0, node->dagHdr->bp, PR_NOWAIT); + 0, node->dagHdr->bp); - if (!req) { - (node->wakeFunc) (node, ENOMEM); - } else { - node->dagFuncData = (void *) req; - rf_DiskIOEnqueue(&(dqs[pda->col]), req, priority); - } + node->dagFuncData = (void *) req; + rf_DiskIOEnqueue(&(dqs[pda->col]), req, priority); } /* * the undo function for disk nodes @@ -343,13 +336,10 @@ rf_DiskUndoFunc(RF_DagNode_t *node) NULL, #endif (void *) (node->dagHdr->raidPtr), - 0, NULL, PR_NOWAIT); - if (!req) - (node->wakeFunc) (node, ENOMEM); - else { - node->dagFuncData = (void *) req; - rf_DiskIOEnqueue(&(dqs[pda->col]), req, RF_IO_NORMAL_PRIORITY); - } + 0, NULL); + + node->dagFuncData = (void *) req; + rf_DiskIOEnqueue(&(dqs[pda->col]), req, RF_IO_NORMAL_PRIORITY); } /* Index: src/sys/dev/raidframe/rf_diskqueue.c diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.61 src/sys/dev/raidframe/rf_diskqueue.c:1.62 --- src/sys/dev/raidframe/rf_diskqueue.c:1.61 Fri Jul 23 20:18:24 2021 +++ src/sys/dev/raidframe
CVS commit: src/sys/dev/eisa
Module Name:src Committed By: thorpej Date: Tue Jul 27 01:18:04 UTC 2021 Modified Files: src/sys/dev/eisa: ahb.c Log Message: - Remove unused include. - Rename ahb_ecb_phys_kv() to ahb_ecb_lookup(). - Remove a bogus comment. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/dev/eisa/ahb.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/eisa/ahb.c diff -u src/sys/dev/eisa/ahb.c:1.68 src/sys/dev/eisa/ahb.c:1.69 --- src/sys/dev/eisa/ahb.c:1.68 Mon Jul 26 16:45:56 2021 +++ src/sys/dev/eisa/ahb.c Tue Jul 27 01:18:04 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ahb.c,v 1.68 2021/07/26 16:45:56 thorpej Exp $ */ +/* $NetBSD: ahb.c,v 1.69 2021/07/27 01:18:04 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahb.c,v 1.68 2021/07/26 16:45:56 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahb.c,v 1.69 2021/07/27 01:18:04 thorpej Exp $"); #include "opt_ddb.h" @@ -58,7 +58,6 @@ __KERNEL_RCSID(0, "$NetBSD: ahb.c,v 1.68 #include #include #include -#include #include #include @@ -121,7 +120,7 @@ static void ahb_send_immed(struct ahb_so static int ahbintr(void *); static void ahb_free_ecb(struct ahb_softc *, struct ahb_ecb *); static struct ahb_ecb *ahb_get_ecb(struct ahb_softc *); -static struct ahb_ecb *ahb_ecb_phys_kv(struct ahb_softc *, uint32_t); +static struct ahb_ecb *ahb_ecb_lookup(struct ahb_softc *, uint32_t); static void ahb_done(struct ahb_softc *, struct ahb_ecb *); static int ahb_find(bus_space_tag_t, bus_space_handle_t, struct ahb_probe_data *); @@ -324,7 +323,7 @@ ahb_send_immed(struct ahb_softc *sc, u_i Debugger(); } - bus_space_write_4(iot, ioh, MBOXOUT0, cmd); /* don't know this will work */ + bus_space_write_4(iot, ioh, MBOXOUT0, cmd); bus_space_write_1(iot, ioh, G2CNTRL, G2CNTRL_SET_HOST_READY); bus_space_write_1(iot, ioh, ATTN, OP_IMMED | ecb->xs->xs_periph->periph_target); @@ -374,7 +373,7 @@ ahbintr(void *arg) case AHB_ECB_OK: case AHB_ECB_RECOVERED: case AHB_ECB_ERR: - ecb = ahb_ecb_phys_kv(sc, mboxval); + ecb = ahb_ecb_lookup(sc, mboxval); if (!ecb) { aprint_error_dev(sc->sc_dev, "BAD ECB RETURNED!\n"); @@ -506,10 +505,10 @@ ahb_get_ecb(struct ahb_softc *sc) } /* - * given a physical address, find the ecb that it corresponds to. + * Lookup and return the ECB that has the specified DMA address. */ static struct ahb_ecb * -ahb_ecb_phys_kv(struct ahb_softc *sc, uint32_t ecb_phys) +ahb_ecb_lookup(struct ahb_softc *sc, uint32_t ecb_phys) { int hashnum = ECB_HASH(ecb_phys); struct ahb_ecb *ecb = sc->sc_ecbhash[hashnum];
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Mon Jul 26 22:50:36 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_netbsdkintf.c Log Message: Add support for detecting and configuring nested RAID setups at boot. To generate a diff of this commit: cvs rdiff -u -r1.396 -r1.397 src/sys/dev/raidframe/rf_netbsdkintf.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/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.396 src/sys/dev/raidframe/rf_netbsdkintf.c:1.397 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.396 Fri Jul 23 02:35:14 2021 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Mon Jul 26 22:50:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.396 2021/07/23 02:35:14 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.397 2021/07/26 22:50:36 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.396 2021/07/23 02:35:14 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.397 2021/07/26 22:50:36 oster Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_autoconfig.h" @@ -483,42 +483,56 @@ rf_containsboot(RF_Raid_t *r, device_t b static void rf_buildroothack(RF_ConfigSet_t *config_sets) { + RF_AutoConfig_t *ac_list; RF_ConfigSet_t *cset; RF_ConfigSet_t *next_cset; int num_root; + int raid_added; struct raid_softc *sc, *rsc; struct dk_softc *dksc = NULL; /* XXX gcc -Os: may be used uninit. */ sc = rsc = NULL; num_root = 0; - cset = config_sets; - while (cset != NULL) { - next_cset = cset->next; - if (rf_have_enough_components(cset) && - cset->ac->clabel->autoconfigure == 1) { - sc = rf_auto_config_set(cset); - if (sc != NULL) { -aprint_debug("raid%d: configured ok, rootable %d\n", -sc->sc_unit, cset->rootable); -if (cset->rootable) { - rsc = sc; - num_root++; + + raid_added = 1; + while (raid_added > 0) { + raid_added = 0; + cset = config_sets; + while (cset != NULL) { + next_cset = cset->next; + if (rf_have_enough_components(cset) && + cset->ac->clabel->autoconfigure == 1) { +sc = rf_auto_config_set(cset); +if (sc != NULL) { + aprint_debug("raid%d: configured ok, rootable %d\n", + sc->sc_unit, cset->rootable); + /* We added one RAID set */ + raid_added++; + if (cset->rootable) { + rsc = sc; + num_root++; + } +} else { + /* The autoconfig didn't work :( */ + aprint_debug("Autoconfig failed\n"); + rf_release_all_vps(cset); } } else { -/* The autoconfig didn't work :( */ -aprint_debug("Autoconfig failed\n"); +/* we're not autoconfiguring this set... + release the associated resources */ rf_release_all_vps(cset); } - } else { - /* we're not autoconfiguring this set... - release the associated resources */ - rf_release_all_vps(cset); + /* cleanup */ + rf_cleanup_config_set(cset); + cset = next_cset; + } + if (raid_added > 0) { + /* We added at least one RAID set, so re-scan for recursive RAID */ + ac_list = rf_find_raid_components(); + config_sets = rf_create_auto_sets(ac_list); } - /* cleanup */ - rf_cleanup_config_set(cset); - cset = next_cset; } - + /* if the user has specified what the root device should be then we don't touch booted_device or boothowto... */
CVS commit: src/sys/dev/eisa
Module Name:src Committed By: thorpej Date: Mon Jul 26 16:45:56 UTC 2021 Modified Files: src/sys/dev/eisa: ahb.c ahbreg.h Log Message: - Type hygiene. - Rename ahb_ecb::hashkey to ahb_ecb::ecb_dma_addr, and use that value rather than recomputing it all the time. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/eisa/ahb.c cvs rdiff -u -r1.17 -r1.18 src/sys/dev/eisa/ahbreg.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/eisa/ahb.c diff -u src/sys/dev/eisa/ahb.c:1.67 src/sys/dev/eisa/ahb.c:1.68 --- src/sys/dev/eisa/ahb.c:1.67 Sat Jul 24 15:52:16 2021 +++ src/sys/dev/eisa/ahb.c Mon Jul 26 16:45:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ahb.c,v 1.67 2021/07/24 15:52:16 thorpej Exp $ */ +/* $NetBSD: ahb.c,v 1.68 2021/07/26 16:45:56 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahb.c,v 1.67 2021/07/24 15:52:16 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahb.c,v 1.68 2021/07/26 16:45:56 thorpej Exp $"); #include "opt_ddb.h" @@ -108,7 +108,7 @@ struct ahb_softc { /* * Offset of an ECB from the beginning of the ECB DMA mapping. */ -#define AHB_ECB_OFF(e) (((u_long)(e)) - ((u_long)&sc->sc_ecbs[0])) +#define AHB_ECB_OFF(e) (((uintptr_t)(e)) - ((uintptr_t)&sc->sc_ecbs[0])) struct ahb_probe_data { int sc_irq; @@ -121,7 +121,7 @@ static void ahb_send_immed(struct ahb_so static int ahbintr(void *); static void ahb_free_ecb(struct ahb_softc *, struct ahb_ecb *); static struct ahb_ecb *ahb_get_ecb(struct ahb_softc *); -static struct ahb_ecb *ahb_ecb_phys_kv(struct ahb_softc *, physaddr); +static struct ahb_ecb *ahb_ecb_phys_kv(struct ahb_softc *, uint32_t); static void ahb_done(struct ahb_softc *, struct ahb_ecb *); static int ahb_find(bus_space_tag_t, bus_space_handle_t, struct ahb_probe_data *); @@ -294,12 +294,7 @@ ahb_send_mbox(struct ahb_softc *sc, int Debugger(); } - /* - * don't know if this will work. - * XXX WHAT DOES THIS COMMENT MEAN?! --thorpej - */ - bus_space_write_4(iot, ioh, MBOXOUT0, - sc->sc_dmamap_ecb->dm_segs[0].ds_addr + AHB_ECB_OFF(ecb)); + bus_space_write_4(iot, ioh, MBOXOUT0, ecb->ecb_dma_addr); bus_space_write_1(iot, ioh, ATTN, opcode | ecb->xs->xs_periph->periph_target); @@ -309,7 +304,7 @@ ahb_send_mbox(struct ahb_softc *sc, int } /* - * Function to send an immediate type command to the adapter + * Function to send an immediate type command to the adapter */ static void ahb_send_immed(struct ahb_softc *sc, u_int32_t cmd, struct ahb_ecb *ecb) @@ -454,13 +449,14 @@ ahb_init_ecb(struct ahb_softc *sc, struc return (error); } + ecb->ecb_dma_addr = sc->sc_dmamap_ecb->dm_segs[0].ds_addr + + AHB_ECB_OFF(ecb); + /* * put in the phystokv hash table * Never gets taken out. */ - ecb->hashkey = sc->sc_dmamap_ecb->dm_segs[0].ds_addr + - AHB_ECB_OFF(ecb); - hashnum = ECB_HASH(ecb->hashkey); + hashnum = ECB_HASH(ecb->ecb_dma_addr); ecb->nexthash = sc->sc_ecbhash[hashnum]; sc->sc_ecbhash[hashnum] = ecb; ahb_reset_ecb(sc, ecb); @@ -513,13 +509,13 @@ ahb_get_ecb(struct ahb_softc *sc) * given a physical address, find the ecb that it corresponds to. */ static struct ahb_ecb * -ahb_ecb_phys_kv(struct ahb_softc *sc, physaddr ecb_phys) +ahb_ecb_phys_kv(struct ahb_softc *sc, uint32_t ecb_phys) { int hashnum = ECB_HASH(ecb_phys); struct ahb_ecb *ecb = sc->sc_ecbhash[hashnum]; while (ecb) { - if (ecb->hashkey == ecb_phys) + if (ecb->ecb_dma_addr == ecb_phys) break; ecb = ecb->nexthash; } @@ -867,11 +863,11 @@ ahb_scsipi_request(struct scsipi_channel ecb->opt2 = periph->periph_lun | ECB_NRB; memcpy(&ecb->scsi_cmd, xs->cmd, ecb->scsi_cmd_length = xs->cmdlen); - ecb->sense_ptr = sc->sc_dmamap_ecb->dm_segs[0].ds_addr + - AHB_ECB_OFF(ecb) + offsetof(struct ahb_ecb, ecb_sense); + ecb->sense_ptr = ecb->ecb_dma_addr + + offsetof(struct ahb_ecb, ecb_sense); ecb->req_sense_length = sizeof(ecb->ecb_sense); - ecb->status = sc->sc_dmamap_ecb->dm_segs[0].ds_addr + - AHB_ECB_OFF(ecb) + offsetof(struct ahb_ecb, ecb_status); + ecb->status = ecb->ecb_dma_addr + + offsetof(struct ahb_ecb, ecb_status); ecb->ecb_status.host_stat = 0x00; ecb->ecb_status.target_stat = 0x00; @@ -927,17 +923,16 @@ ahb_scsipi_request(struct scsipi_channel ecb->dmamap_xfer->dm_segs[seg].ds_len; } - ecb->data_addr = sc->sc_dmamap_ecb->dm_segs[0].ds_addr + - AHB_ECB_OFF(ecb) + + ecb->data_addr = ecb->ecb_dma_addr + offsetof(struct ahb_ecb, ahb_dma); ecb->data_length = ecb->dmamap_xfer->dm_nsegs * sizeof(struct ahb_dma_seg); ecb->opt1 |= ECB_S_G; } else { /* No data xfer, use non S/G values */ - ecb->data_addr = (physaddr)0; + ecb->data_addr = 0; ecb->data_length = 0; } - ecb->link_addr = (physa
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: jmcneill Date: Sun Jul 25 01:43:08 UTC 2021 Modified Files: src/sys/dev/acpi: acpi_timer.c Log Message: acpi_timer: use ACPI-Fast if WAET timer one read flag is set The Windows ACPI Emulated Devices Table (WAET) has a hint to inform the OS that a single read of the PM timer is reliable. Honour this flag. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/acpi/acpi_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/dev/acpi/acpi_timer.c diff -u src/sys/dev/acpi/acpi_timer.c:1.26 src/sys/dev/acpi/acpi_timer.c:1.27 --- src/sys/dev/acpi/acpi_timer.c:1.26 Fri May 29 12:30:41 2020 +++ src/sys/dev/acpi/acpi_timer.c Sun Jul 25 01:43:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_timer.c,v 1.26 2020/05/29 12:30:41 rin Exp $ */ +/* $NetBSD: acpi_timer.c,v 1.27 2021/07/25 01:43:08 jmcneill Exp $ */ /*- * Copyright (c) 2006 Matthias Drochner @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_timer.c,v 1.26 2020/05/29 12:30:41 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_timer.c,v 1.27 2021/07/25 01:43:08 jmcneill Exp $"); #include #include @@ -61,6 +61,7 @@ int acpitimer_init(struct acpi_softc *sc) { #if (!ACPI_REDUCED_HARDWARE) + ACPI_TABLE_WAET *waet; ACPI_STATUS rv; uint32_t bits; int i, j; @@ -79,6 +80,18 @@ acpitimer_init(struct acpi_softc *sc) for (i = j = 0; i < 10; i++) j += acpitimer_test(); + rv = AcpiGetTable(ACPI_SIG_WAET, 0, (ACPI_TABLE_HEADER **)&waet); + if (ACPI_SUCCESS(rv)) { + /* + * Windows ACPI Emulated Devices Table (WAET) has a hint + * to let the OS know that a single read of the PM timer + * provides a reliable value. + */ + if ((waet->Flags & ACPI_WAET_TIMER_ONE_READ) != 0) { + j += 10; + } + } + if (j >= 10) { acpi_timecounter.tc_name = "ACPI-Fast"; acpi_timecounter.tc_get_timecount = acpitimer_read_fast;
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: macallan Date: Sun Jul 25 00:11:43 UTC 2021 Modified Files: src/sys/dev/i2c: fcu.c Log Message: don't put CPUs in separate zones, turns out there really isn't much that keeps the airflow apart around them To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/i2c/fcu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/i2c/fcu.c diff -u src/sys/dev/i2c/fcu.c:1.12 src/sys/dev/i2c/fcu.c:1.13 --- src/sys/dev/i2c/fcu.c:1.12 Wed Jan 27 02:29:48 2021 +++ src/sys/dev/i2c/fcu.c Sun Jul 25 00:11:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fcu.c,v 1.12 2021/01/27 02:29:48 thorpej Exp $ */ +/* $NetBSD: fcu.c,v 1.13 2021/07/25 00:11:43 macallan Exp $ */ /*- * Copyright (c) 2018 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.12 2021/01/27 02:29:48 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fcu.c,v 1.13 2021/07/25 00:11:43 macallan Exp $"); #include #include @@ -75,11 +75,10 @@ typedef struct _fcu_fan { int duty; /* for pwm fans */ } fcu_fan_t; -#define FCU_ZONE_CPU_A 0 -#define FCU_ZONE_CPU_B 1 -#define FCU_ZONE_CASE 2 -#define FCU_ZONE_DRIVEBAY 3 -#define FCU_ZONE_COUNT 4 +#define FCU_ZONE_CPU 0 +#define FCU_ZONE_CASE 1 +#define FCU_ZONE_DRIVEBAY 2 +#define FCU_ZONE_COUNT 3 struct fcu_softc { device_t sc_dev; @@ -103,8 +102,7 @@ static void fcu_attach(device_t, device_ static void fcu_sensors_refresh(struct sysmon_envsys *, envsys_data_t *); -static bool is_cpu_a(const envsys_data_t *); -static bool is_cpu_b(const envsys_data_t *); +static bool is_cpu(const envsys_data_t *); static bool is_case(const envsys_data_t *); static bool is_drive(const envsys_data_t *); @@ -162,12 +160,9 @@ fcu_attach(device_t parent, device_t sel have_eeprom1 = 0; /* init zones */ - sc->sc_zones[FCU_ZONE_CPU_A].filter = is_cpu_a; - sc->sc_zones[FCU_ZONE_CPU_A].threshold = 50; - sc->sc_zones[FCU_ZONE_CPU_A].nfans = 0; - sc->sc_zones[FCU_ZONE_CPU_B].filter = is_cpu_b; - sc->sc_zones[FCU_ZONE_CPU_B].threshold = 50; - sc->sc_zones[FCU_ZONE_CPU_B].nfans = 0; + sc->sc_zones[FCU_ZONE_CPU].filter = is_cpu; + sc->sc_zones[FCU_ZONE_CPU].threshold = 50; + sc->sc_zones[FCU_ZONE_CPU].nfans = 0; sc->sc_zones[FCU_ZONE_CASE].filter = is_case; sc->sc_zones[FCU_ZONE_CASE].threshold = 50; sc->sc_zones[FCU_ZONE_CASE].nfans = 0; @@ -282,12 +277,8 @@ fcu_attach(device_t parent, device_t sel descr, fan->base_rpm, fan->max_rpm, fan->step); /* now stuff them into zones */ - if (strstr(descr, "CPU A") != NULL) { -fcu_zone_t *z = &sc->sc_zones[FCU_ZONE_CPU_A]; -z->fans[z->nfans] = sc->sc_nfans; -z->nfans++; - } else if (strstr(descr, "CPU B") != NULL) { -fcu_zone_t *z = &sc->sc_zones[FCU_ZONE_CPU_B]; + if (strstr(descr, "CPU") != NULL) { +fcu_zone_t *z = &sc->sc_zones[FCU_ZONE_CPU]; z->fans[z->nfans] = sc->sc_nfans; z->nfans++; } else if ((strstr(descr, "BACKSIDE") != NULL) || @@ -358,21 +349,11 @@ fcu_sensors_refresh(struct sysmon_envsys } static bool -is_cpu_a(const envsys_data_t *edata) +is_cpu(const envsys_data_t *edata) { if (edata->units != ENVSYS_STEMP) return false; - if (strstr(edata->desc, "CPU A") != NULL) - return TRUE; - return false; -} - -static bool -is_cpu_b(const envsys_data_t *edata) -{ - if (edata->units != ENVSYS_STEMP) - return false; - if (strstr(edata->desc, "CPU B") != NULL) + if (strstr(edata->desc, "CPU") != NULL) return TRUE; return false; } @@ -462,7 +443,6 @@ fcu_adjust_zone(struct fcu_softc *sc, in fcu_fan_t *f; int temp, i, speed, diff; - if (z->nfans <= 0) return;
CVS commit: src/sys/dev/eisa
Module Name:src Committed By: thorpej Date: Sat Jul 24 22:37:56 UTC 2021 Modified Files: src/sys/dev/eisa: eisadevs.h eisadevs_data.h Log Message: Regen: Add some Compaq display controllers. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.31 src/sys/dev/eisa/eisadevs.h cvs rdiff -u -r1.31 -r1.32 src/sys/dev/eisa/eisadevs_data.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/eisa/eisadevs.h diff -u src/sys/dev/eisa/eisadevs.h:1.30 src/sys/dev/eisa/eisadevs.h:1.31 --- src/sys/dev/eisa/eisadevs.h:1.30 Sun Dec 11 12:21:20 2005 +++ src/sys/dev/eisa/eisadevs.h Sat Jul 24 22:37:56 2021 @@ -1,10 +1,10 @@ -/* $NetBSD: eisadevs.h,v 1.30 2005/12/11 12:21:20 christos Exp $ */ +/* $NetBSD: eisadevs.h,v 1.31 2021/07/24 22:37:56 thorpej Exp $ */ /* * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: eisadevs,v 1.27 2005/02/27 00:26:59 perry Exp + * NetBSD: eisadevs,v 1.30 2021/07/24 22:36:31 thorpej Exp */ /* @@ -38,6 +38,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + /* * List of known products, grouped and sorted by vendor code. */ @@ -65,6 +66,13 @@ #define EISA_PRODUCT_BUS6301 "BusLogic Bt763E Ethernet" /* Compaq products */ +#define EISA_PRODUCT_CPQ3001 "Compaq Advanced VGA" +#define EISA_PRODUCT_CPQ3011 "Compaq QVision 1024/E Video Controller" +#define EISA_PRODUCT_CPQ3021 "Compaq QVision 1024/I Video Controller" +#define EISA_PRODUCT_CPQ3111 "Compaq QVision 1024/E Graphics Controller" +#define EISA_PRODUCT_CPQ3112 "Compaq QVision 1280/E Graphics Controller" +#define EISA_PRODUCT_CPQ3121 "Compaq QVision 1024/I Graphics Controller" +#define EISA_PRODUCT_CPQ3122 "Compaq QVision 1280/I Graphics Controller" #define EISA_PRODUCT_CPQ4001 "Compaq IDA array controller" #define EISA_PRODUCT_CPQ4002 "Compaq IDA-2 array controller" #define EISA_PRODUCT_CPQ4010 "Compaq IEAS array controller" Index: src/sys/dev/eisa/eisadevs_data.h diff -u src/sys/dev/eisa/eisadevs_data.h:1.31 src/sys/dev/eisa/eisadevs_data.h:1.32 --- src/sys/dev/eisa/eisadevs_data.h:1.31 Sun Dec 11 12:21:20 2005 +++ src/sys/dev/eisa/eisadevs_data.h Sat Jul 24 22:37:56 2021 @@ -1,10 +1,10 @@ -/* $NetBSD: eisadevs_data.h,v 1.31 2005/12/11 12:21:20 christos Exp $ */ +/* $NetBSD: eisadevs_data.h,v 1.32 2021/07/24 22:37:56 thorpej Exp $ */ /* * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: - * NetBSD: eisadevs,v 1.27 2005/02/27 00:26:59 perry Exp + * NetBSD: eisadevs,v 1.30 2021/07/24 22:36:31 thorpej Exp */ /* @@ -111,6 +111,41 @@ const struct eisa_knowndev eisa_knowndev }, { 0, + "CPQ3001", + EISA_PRODUCT_CPQ3001, + }, + { + 0, + "CPQ3011", + EISA_PRODUCT_CPQ3011, + }, + { + 0, + "CPQ3021", + EISA_PRODUCT_CPQ3021, + }, + { + 0, + "CPQ3111", + EISA_PRODUCT_CPQ3111, + }, + { + 0, + "CPQ3112", + EISA_PRODUCT_CPQ3112, + }, + { + 0, + "CPQ3121", + EISA_PRODUCT_CPQ3121, + }, + { + 0, + "CPQ3122", + EISA_PRODUCT_CPQ3122, + }, + { + 0, "CPQ4001", EISA_PRODUCT_CPQ4001, },
CVS commit: src/sys/dev/eisa
Module Name:src Committed By: thorpej Date: Sat Jul 24 22:36:31 UTC 2021 Modified Files: src/sys/dev/eisa: eisadevs Log Message: Add some Compaq display controllers. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/dev/eisa/eisadevs 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/eisa/eisadevs diff -u src/sys/dev/eisa/eisadevs:1.29 src/sys/dev/eisa/eisadevs:1.30 --- src/sys/dev/eisa/eisadevs:1.29 Wed Jan 21 14:18:44 2009 +++ src/sys/dev/eisa/eisadevs Sat Jul 24 22:36:31 2021 @@ -1,4 +1,4 @@ -$NetBSD: eisadevs,v 1.29 2009/01/21 14:18:44 jnemeth Exp $ +$NetBSD: eisadevs,v 1.30 2021/07/24 22:36:31 thorpej Exp $ /* * Copyright (c) 1995, 1996 Christopher G. Demetriou @@ -86,6 +86,13 @@ product BUS 6001 Bt760 Ethernet product BUS 6301 Bt763E Ethernet /* Compaq products */ +product CPQ 3001 Advanced VGA +product CPQ 3011 QVision 1024/E Video Controller +product CPQ 3021 QVision 1024/I Video Controller +product CPQ 3111 QVision 1024/E Graphics Controller +product CPQ 3112 QVision 1280/E Graphics Controller +product CPQ 3121 QVision 1024/I Graphics Controller +product CPQ 3122 QVision 1280/I Graphics Controller product CPQ 4001 IDA array controller product CPQ 4002 IDA-2 array controller product CPQ 4010 IEAS array controller
CVS commit: src/sys/dev
Module Name:src Committed By: jmcneill Date: Sat Jul 24 22:33:23 UTC 2021 Modified Files: src/sys/dev: smbios.c Log Message: build fix To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/smbios.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/smbios.c diff -u src/sys/dev/smbios.c:1.2 src/sys/dev/smbios.c:1.3 --- src/sys/dev/smbios.c:1.2 Sat Jul 24 11:39:19 2021 +++ src/sys/dev/smbios.c Sat Jul 24 22:33:23 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: smbios.c,v 1.2 2021/07/24 11:39:19 jmcneill Exp $ */ +/* $NetBSD: smbios.c,v 1.3 2021/07/24 22:33:23 jmcneill Exp $ */ /* * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -86,7 +86,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: smbios.c,v 1.2 2021/07/24 11:39:19 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smbios.c,v 1.3 2021/07/24 22:33:23 jmcneill Exp $"); #include #include @@ -138,7 +138,7 @@ smbios_map_memory(paddr_t pa, size_t siz } pmap_update(pmap_kernel()); - return (void *)(va + (pa - spa)); + return (void *)(uintptr_t)(va + (pa - spa)); } static void
CVS commit: src/sys/dev/eisa
Module Name:src Committed By: thorpej Date: Sat Jul 24 19:14:35 UTC 2021 Modified Files: src/sys/dev/eisa: depca_eisa.c Log Message: Report our interrupt trigger type. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/eisa/depca_eisa.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/eisa/depca_eisa.c diff -u src/sys/dev/eisa/depca_eisa.c:1.16 src/sys/dev/eisa/depca_eisa.c:1.17 --- src/sys/dev/eisa/depca_eisa.c:1.16 Mon Jul 12 16:44:52 2021 +++ src/sys/dev/eisa/depca_eisa.c Sat Jul 24 19:14:35 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: depca_eisa.c,v 1.16 2021/07/12 16:44:52 thorpej Exp $ */ +/* $NetBSD: depca_eisa.c,v 1.17 2021/07/24 19:14:35 thorpej Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: depca_eisa.c,v 1.16 2021/07/12 16:44:52 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: depca_eisa.c,v 1.17 2021/07/24 19:14:35 thorpej Exp $"); #include "opt_inet.h" @@ -175,9 +175,11 @@ depca_eisa_intr_establish(struct depca_s aprint_error("\n"); return (NULL); } - if (intrstr != NULL) - aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", - intrstr); + if (intrstr != NULL) { + aprint_normal_dev(sc->sc_dev, + "interrupting at %s (%s trigger)\n", + (esc->sc_ist == IST_LEVEL) ? "level" : "edge", intrstr); + } return (rv); }
CVS commit: src/sys/dev/eisa
Module Name:src Committed By: thorpej Date: Sat Jul 24 19:06:25 UTC 2021 Modified Files: src/sys/dev/eisa: mlx_eisa.c Log Message: Noralize autoconfiguration messages, and report interrupt trigger type. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/eisa/mlx_eisa.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/eisa/mlx_eisa.c diff -u src/sys/dev/eisa/mlx_eisa.c:1.28 src/sys/dev/eisa/mlx_eisa.c:1.29 --- src/sys/dev/eisa/mlx_eisa.c:1.28 Sat Apr 24 23:36:53 2021 +++ src/sys/dev/eisa/mlx_eisa.c Sat Jul 24 19:06:25 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: mlx_eisa.c,v 1.28 2021/04/24 23:36:53 thorpej Exp $ */ +/* $NetBSD: mlx_eisa.c,v 1.29 2021/07/24 19:06:25 thorpej Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: mlx_eisa.c,v 1.28 2021/04/24 23:36:53 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mlx_eisa.c,v 1.29 2021/07/24 19:06:25 thorpej Exp $"); #include #include @@ -113,16 +113,32 @@ mlx_eisa_attach(device_t parent, device_ struct mlx_softc *mlx; bus_space_tag_t iot; const char *intrstr; - int irq, icfg; + int irq, ist, icfg; char intrbuf[EISA_INTRSTR_LEN]; mlx = device_private(self); iot = ea->ea_iot; ec = ea->ea_ec; + dce = eisa_compatible_lookup(ea, compat_data); + KASSERT(dce != NULL); + + mlx->mlx_ci.ci_nchan = (int)dce->value; + mlx->mlx_ci.ci_iftype = 1; + + mlx->mlx_submit = mlx_v1_submit; + mlx->mlx_findcomplete = mlx_v1_findcomplete; + mlx->mlx_intaction = mlx_v1_intaction; + mlx->mlx_fw_handshake = mlx_v1_fw_handshake; +#ifdef MLX_RESET + mlx->mlx_reset = mlx_v1_reset; +#endif + + aprint_normal(": Mylex RAID\n"); + if (bus_space_map(iot, EISA_SLOT_ADDR(ea->ea_slot) + MLX_EISA_SLOT_OFFSET, MLX_EISA_IOSIZE, 0, &ioh)) { - aprint_error(": can't map i/o space\n"); + aprint_error_dev(self, "can't map i/o space\n"); return; } @@ -150,42 +166,32 @@ mlx_eisa_attach(device_t parent, device_ irq = 15; break; default: - aprint_error(": controller on invalid IRQ\n"); + aprint_error_dev(self, + "controller on invalid IRQ (icfg=0x%02x)\n", icfg); return; } + ist = (icfg & 0x08) != 0 ? IST_LEVEL : IST_EDGE; + if (eisa_intr_map(ec, irq, &ih)) { - aprint_error(": can't map interrupt (%d)\n", irq); + aprint_error_dev(self, "can't map interrupt (%d)\n", irq); return; } intrstr = eisa_intr_string(ec, ih, intrbuf, sizeof(intrbuf)); - mlx->mlx_ih = eisa_intr_establish(ec, ih, - ((icfg & 0x08) != 0 ? IST_LEVEL : IST_EDGE), - IPL_BIO, mlx_intr, mlx); + mlx->mlx_ih = eisa_intr_establish(ec, ih, ist, IPL_BIO, mlx_intr, mlx); if (mlx->mlx_ih == NULL) { - aprint_error(": can't establish interrupt"); + aprint_error_dev(self, "can't establish interrupt"); if (intrstr != NULL) - aprint_normal(" at %s", intrstr); - aprint_normal("\n"); + aprint_error(" at %s", intrstr); + aprint_error("\n"); return; } + if (intrstr != NULL) { + aprint_normal_dev(self, "interrupting at %s (%s trigger)\n", + ist == IST_EDGE ? "edge" : "level", intrstr); + } - dce = eisa_compatible_lookup(ea, compat_data); - KASSERT(dce != NULL); - - mlx->mlx_ci.ci_nchan = (int)dce->value; - mlx->mlx_ci.ci_iftype = 1; - - mlx->mlx_submit = mlx_v1_submit; - mlx->mlx_findcomplete = mlx_v1_findcomplete; - mlx->mlx_intaction = mlx_v1_intaction; - mlx->mlx_fw_handshake = mlx_v1_fw_handshake; -#ifdef MLX_RESET - mlx->mlx_reset = mlx_v1_reset; -#endif - - aprint_normal(": Mylex RAID\n"); mlx_init(mlx, intrstr); }
CVS commit: src/sys/dev/eisa
Module Name:src Committed By: thorpej Date: Sat Jul 24 18:50:07 UTC 2021 Modified Files: src/sys/dev/eisa: if_tlp_eisa.c Log Message: Report which trigger type we're using for our interrupt. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/eisa/if_tlp_eisa.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/eisa/if_tlp_eisa.c diff -u src/sys/dev/eisa/if_tlp_eisa.c:1.28 src/sys/dev/eisa/if_tlp_eisa.c:1.29 --- src/sys/dev/eisa/if_tlp_eisa.c:1.28 Wed Jan 27 04:35:15 2021 +++ src/sys/dev/eisa/if_tlp_eisa.c Sat Jul 24 18:50:07 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tlp_eisa.c,v 1.28 2021/01/27 04:35:15 thorpej Exp $ */ +/* $NetBSD: if_tlp_eisa.c,v 1.29 2021/07/24 18:50:07 thorpej Exp $ */ /*- * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_tlp_eisa.c,v 1.28 2021/01/27 04:35:15 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tlp_eisa.c,v 1.29 2021/07/24 18:50:07 thorpej Exp $"); #include "opt_inet.h" @@ -150,7 +150,7 @@ tlp_eisa_attach(device_t parent, device_ const struct tulip_eisa_product *tep; u_int8_t enaddr[ETHER_ADDR_LEN], tmpbuf[sizeof(testpat)]; u_int32_t val; - int irq, i, cnt; + int irq, ist, i, cnt; char intrbuf[EISA_INTRSTR_LEN]; /* @@ -244,6 +244,7 @@ tlp_eisa_attach(device_t parent, device_ */ val = bus_space_read_4(iot, ioh, DE425_CFG0); irq = tlp_eisa_irqs[(val >> 1) & 0x03]; + ist = (val & 0x01) ? IST_EDGE : IST_LEVEL; /* * Map and establish our interrupt. @@ -253,8 +254,7 @@ tlp_eisa_attach(device_t parent, device_ return; } intrstr = eisa_intr_string(ec, ih, intrbuf, sizeof(intrbuf)); - esc->sc_ih = eisa_intr_establish(ec, ih, - (val & 0x01) ? IST_EDGE : IST_LEVEL, IPL_NET, tlp_intr, sc); + esc->sc_ih = eisa_intr_establish(ec, ih, ist, IPL_NET, tlp_intr, sc); if (esc->sc_ih == NULL) { aprint_error_dev(self, "unable to establish interrupt"); if (intrstr != NULL) @@ -262,8 +262,10 @@ tlp_eisa_attach(device_t parent, device_ aprint_error("\n"); return; } - if (intrstr != NULL) - aprint_normal_dev(self, "interrupting at %s\n", intrstr); + if (intrstr != NULL) { + aprint_normal_dev(self, "interrupting at %s (%s trigger)\n", + ist == IST_EDGE ? "edge" : "level", intrstr); + } /* * Finish off the attach.
CVS commit: src/sys/dev/eisa
Module Name:src Committed By: thorpej Date: Sat Jul 24 15:52:16 UTC 2021 Modified Files: src/sys/dev/eisa: ahb.c Log Message: Don't blindly establish our interrupt handler as IST_LEVEL. If the INTDEF register has the INTHIGH bit set, the controller is going to keep the line low when *not* asserting an interrupt, and since EISA level-tiggered interrupts are active-low, this would result in a forever-interrupt-storm. So, if INTHIGH is set in INTDEF, establish our interrupt handler as IST_EDGE, which will program the EISA PIC to detect the interrupt on the rising edge of the IRQ line. To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/dev/eisa/ahb.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/eisa/ahb.c diff -u src/sys/dev/eisa/ahb.c:1.66 src/sys/dev/eisa/ahb.c:1.67 --- src/sys/dev/eisa/ahb.c:1.66 Sat Apr 24 23:36:53 2021 +++ src/sys/dev/eisa/ahb.c Sat Jul 24 15:52:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ahb.c,v 1.66 2021/04/24 23:36:53 thorpej Exp $ */ +/* $NetBSD: ahb.c,v 1.67 2021/07/24 15:52:16 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -46,7 +46,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ahb.c,v 1.66 2021/04/24 23:36:53 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ahb.c,v 1.67 2021/07/24 15:52:16 thorpej Exp $"); #include "opt_ddb.h" @@ -112,6 +112,7 @@ struct ahb_softc { struct ahb_probe_data { int sc_irq; + int sc_ist; int sc_scsi_dev; }; @@ -251,7 +252,7 @@ ahbattach(device_t parent, device_t self return; } intrstr = eisa_intr_string(ec, ih, intrbuf, sizeof(intrbuf)); - sc->sc_ih = eisa_intr_establish(ec, ih, IST_LEVEL, IPL_BIO, + sc->sc_ih = eisa_intr_establish(ec, ih, apd.sc_ist, IPL_BIO, ahbintr, sc); if (sc->sc_ih == NULL) { aprint_error_dev(sc->sc_dev, "couldn't establish interrupt"); @@ -260,8 +261,11 @@ ahbattach(device_t parent, device_t self aprint_error("\n"); return; } - if (intrstr != NULL) - aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr); + if (intrstr != NULL) { + aprint_normal_dev(sc->sc_dev, + "interrupting at %s (%s trigger)\n", intrstr, + apd.sc_ist == IST_EDGE ? "edge" : "level"); + } /* * ask the adapter what subunits are present @@ -609,7 +613,7 @@ ahb_find(bus_space_tag_t iot, bus_space_ struct ahb_probe_data *sc) { u_char intdef; - int i, irq, busid; + int i, irq, ist, busid; int wait = 1000; /* 1 sec enough? */ bus_space_write_1(iot, ioh, PORTADDR, PORTADDR_ENHANCED); @@ -676,6 +680,21 @@ ahb_find(bus_space_tag_t iot, bus_space_ return EIO; } + /* + * On EISA, edge triggered interrupts are signalled by the rising + * edge of the interrupt signal, while level tiggered interrupts + * are signalled so long as the interrupt signal is driven low. + * + * So, if the controller is configured for active-high interrupts, + * that is "edge trigger" in our parlance, while active-low would + * be "level trigger". + */ + if (intdef & INTHIGH) { + ist = IST_EDGE; + } else { + ist = IST_LEVEL; + } + bus_space_write_1(iot, ioh, INTDEF, (intdef | INTEN)); /* make sure we can interrupt */ /* who are we on the scsi bus? */ @@ -684,6 +703,7 @@ ahb_find(bus_space_tag_t iot, bus_space_ /* if we want to return data, do so now */ if (sc) { sc->sc_irq = irq; + sc->sc_ist = ist; sc->sc_scsi_dev = busid; }
CVS commit: src/sys/dev/eisa
Module Name:src Committed By: thorpej Date: Sat Jul 24 15:44:16 UTC 2021 Modified Files: src/sys/dev/eisa: ahbreg.h Log Message: Correct the comment about the INTHIGH bit in the INTDEF register. It does indeed mean "IRQ signal is active-high", but "else edge" is not correct; level-triggered EISA interrupt are active-low, and edge-triggered EISA interrupts are rising-edge, so INTHIGH would in fact mean "edge". To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/eisa/ahbreg.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/eisa/ahbreg.h diff -u src/sys/dev/eisa/ahbreg.h:1.16 src/sys/dev/eisa/ahbreg.h:1.17 --- src/sys/dev/eisa/ahbreg.h:1.16 Mon Apr 28 20:23:48 2008 +++ src/sys/dev/eisa/ahbreg.h Sat Jul 24 15:44:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ahbreg.h,v 1.16 2008/04/28 20:23:48 martin Exp $ */ +/* $NetBSD: ahbreg.h,v 1.17 2021/07/24 15:44:16 thorpej Exp $ */ /*- * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ typedef u_int32_t physlen; #define INT12 0x03 #define INT14 0x05 #define INT15 0x06 -#define INTHIGH 0x08 /* int high=ACTIVE (else edge) */ +#define INTHIGH 0x08 /* interrupt signal is active-high */ #define INTEN 0x10 / bit definitions for SCSIDEF / #define HSCSIID 0x0F /* our SCSI ID */
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: jmcneill Date: Sat Jul 24 11:36:41 UTC 2021 Modified Files: src/sys/dev/acpi: acpi_dev.c Log Message: acpi: /dev/acpi: fix bounds check when reading tables To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/acpi/acpi_dev.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/acpi/acpi_dev.c diff -u src/sys/dev/acpi/acpi_dev.c:1.1 src/sys/dev/acpi/acpi_dev.c:1.2 --- src/sys/dev/acpi/acpi_dev.c:1.1 Sun Dec 6 02:57:30 2020 +++ src/sys/dev/acpi/acpi_dev.c Sat Jul 24 11:36:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_dev.c,v 1.1 2020/12/06 02:57:30 jmcneill Exp $ */ +/* $NetBSD: acpi_dev.c,v 1.2 2021/07/24 11:36:41 jmcneill Exp $ */ /*- * Copyright (c) 2020 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_dev.c,v 1.1 2020/12/06 02:57:30 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_dev.c,v 1.2 2021/07/24 11:36:41 jmcneill Exp $"); #include #include @@ -208,7 +208,7 @@ acpi_read(dev_t dev, struct uio *uio, in /* Copy the contents of the table to user-space */ pa = uio->uio_offset; - len = uimin(pa - table_pa + table_len, uio->uio_resid); + len = uimin(table_len - (pa - table_pa), uio->uio_resid); data = AcpiOsMapMemory(pa, len); if (data == NULL) { return ENOMEM;
CVS commit: src/sys/dev/dtv
Module Name:src Committed By: skrll Date: Sat Jul 24 07:48:38 UTC 2021 Modified Files: src/sys/dev/dtv: dtv_device.c Log Message: #include for COHERENCY_UNIT and some KNF while I'm here. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.13 src/sys/dev/dtv/dtv_device.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/dtv/dtv_device.c diff -u src/sys/dev/dtv/dtv_device.c:1.12 src/sys/dev/dtv/dtv_device.c:1.13 --- src/sys/dev/dtv/dtv_device.c:1.12 Sat Oct 28 04:53:55 2017 +++ src/sys/dev/dtv/dtv_device.c Sat Jul 24 07:48:38 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dtv_device.c,v 1.12 2017/10/28 04:53:55 riastradh Exp $ */ +/* $NetBSD: dtv_device.c,v 1.13 2021/07/24 07:48:38 skrll Exp $ */ /*- * Copyright (c) 2011 Jared D. McNeill @@ -33,12 +33,13 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dtv_device.c,v 1.12 2017/10/28 04:53:55 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dtv_device.c,v 1.13 2021/07/24 07:48:38 skrll Exp $"); +#include #include +#include #include #include -#include #include #include #include
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 22:34:12 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_raid1.c Log Message: The number of components used must be at least 2. An odd number of components is not allowed. PR bin/45162 To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/dev/raidframe/rf_raid1.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/raidframe/rf_raid1.c diff -u src/sys/dev/raidframe/rf_raid1.c:1.38 src/sys/dev/raidframe/rf_raid1.c:1.39 --- src/sys/dev/raidframe/rf_raid1.c:1.38 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_raid1.c Fri Jul 23 22:34:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_raid1.c,v 1.38 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_raid1.c,v 1.39 2021/07/23 22:34:12 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.38 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_raid1.c,v 1.39 2021/07/23 22:34:12 oster Exp $"); #include "rf_raid.h" #include "rf_raid1.h" @@ -65,6 +65,11 @@ rf_ConfigureRAID1(RF_ShutdownList_t **li RF_Raid1ConfigInfo_t *info; RF_RowCol_t i; + /* Sanity check the number of columns... */ + if (raidPtr->numCol < 2 || raidPtr->numCol % 2 != 0) { + return (EINVAL); + } + /* create a RAID level 1 configuration structure */ info = RF_MallocAndAdd(sizeof(*info), raidPtr->cleanupList); if (info == NULL)
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 20:18:24 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_diskqueue.c rf_diskqueue.h rf_fifo.c rf_fifo.h rf_sstf.c rf_sstf.h Log Message: Various disk queue "peek" routines were only ever used in the simulator version of RAIDFrame. Remove them from here. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/dev/raidframe/rf_diskqueue.c cvs rdiff -u -r1.27 -r1.28 src/sys/dev/raidframe/rf_diskqueue.h cvs rdiff -u -r1.16 -r1.17 src/sys/dev/raidframe/rf_fifo.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/raidframe/rf_fifo.h cvs rdiff -u -r1.17 -r1.18 src/sys/dev/raidframe/rf_sstf.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/raidframe/rf_sstf.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/raidframe/rf_diskqueue.c diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.60 src/sys/dev/raidframe/rf_diskqueue.c:1.61 --- src/sys/dev/raidframe/rf_diskqueue.c:1.60 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_diskqueue.c Fri Jul 23 20:18:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.c,v 1.60 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_diskqueue.c,v 1.61 2021/07/23 20:18:24 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -66,7 +66,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.60 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.61 2021/07/23 20:18:24 oster Exp $"); #include @@ -115,36 +115,31 @@ static const RF_DiskQueueSW_t diskqueues rf_FifoCreate, rf_FifoEnqueue, rf_FifoDequeue, - rf_FifoPeek, - rf_FifoPromote}, + rf_FifoPromote}, {"cvscan", /* cvscan */ rf_CvscanCreate, rf_CvscanEnqueue, rf_CvscanDequeue, - rf_CvscanPeek, - rf_CvscanPromote}, + rf_CvscanPromote}, {"sstf", /* shortest seek time first */ rf_SstfCreate, rf_SstfEnqueue, rf_SstfDequeue, - rf_SstfPeek, - rf_SstfPromote}, + rf_SstfPromote}, {"scan", /* SCAN (two-way elevator) */ rf_ScanCreate, rf_SstfEnqueue, rf_ScanDequeue, - rf_ScanPeek, - rf_SstfPromote}, + rf_SstfPromote}, {"cscan", /* CSCAN (one-way elevator) */ rf_CscanCreate, rf_SstfEnqueue, rf_CscanDequeue, - rf_CscanPeek, - rf_SstfPromote}, + rf_SstfPromote}, }; #define NUM_DISK_QUEUE_TYPES (sizeof(diskqueuesw)/sizeof(RF_DiskQueueSW_t)) Index: src/sys/dev/raidframe/rf_diskqueue.h diff -u src/sys/dev/raidframe/rf_diskqueue.h:1.27 src/sys/dev/raidframe/rf_diskqueue.h:1.28 --- src/sys/dev/raidframe/rf_diskqueue.h:1.27 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_diskqueue.h Fri Jul 23 20:18:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.h,v 1.27 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_diskqueue.h,v 1.28 2021/07/23 20:18:24 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -89,7 +89,6 @@ struct RF_DiskQueueSW_s { * system */ void(*Enqueue) (void *, RF_DiskQueueData_t *, int); /* enqueue routine */ RF_DiskQueueData_t *(*Dequeue) (void *); /* dequeue routine */ - RF_DiskQueueData_t *(*Peek) (void *); /* peek at head of queue */ /* the rest are optional: they improve performance, but the driver * will deal with it if they don't exist */ Index: src/sys/dev/raidframe/rf_fifo.c diff -u src/sys/dev/raidframe/rf_fifo.c:1.16 src/sys/dev/raidframe/rf_fifo.c:1.17 --- src/sys/dev/raidframe/rf_fifo.c:1.16 Sat Feb 9 03:34:00 2019 +++ src/sys/dev/raidframe/rf_fifo.c Fri Jul 23 20:18:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_fifo.c,v 1.16 2019/02/09 03:34:00 christos Exp $ */ +/* $NetBSD: rf_fifo.c,v 1.17 2021/07/23 20:18:24 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -36,7 +36,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_fifo.c,v 1.16 2019/02/09 03:34:00 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_fifo.c,v 1.17 2021/07/23 20:18:24 oster Exp $"); #include @@ -147,23 +147,6 @@ rf_FifoDequeue(void *q_in) return (nd); } -/* Return ptr to item at head of queue. Used to examine request - * info without actually dequeueing the request. - */ -RF_DiskQueueData_t * -rf_FifoPeek(void *q_in) -{ - RF_DiskQueueData_t *headElement = NULL; - RF_FifoHeader_t *q = (RF_FifoHeader_t *) q_in; - - RF_ASSERT(q); - if (q->hq_head) - headElement = q->hq_head; - else - if (q->lq_head) - headElement = q->lq_head; - return (headElement); -} /* We sometimes need to promote a low priority access to a regular priority access. * Currently, this is only used when the user wants to write a stripe which is currently * under reconstruction. Index: src/sys/dev/raidframe/rf_fifo.h diff -u src/sys/dev/raidframe/rf_fifo.h:1.6 src/sys/dev/raidfr
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 02:35:14 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_desc.h rf_driver.c rf_driver.h rf_netbsdkintf.c rf_states.c Log Message: All IO is async in the RAIDframe kernel driver, so desc->async_flag isn't needed. Cleanup the flag from rf_DoAccess() and its caller as well. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/rf_desc.h cvs rdiff -u -r1.138 -r1.139 src/sys/dev/raidframe/rf_driver.c cvs rdiff -u -r1.20 -r1.21 src/sys/dev/raidframe/rf_driver.h cvs rdiff -u -r1.395 -r1.396 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.52 -r1.53 src/sys/dev/raidframe/rf_states.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/raidframe/rf_desc.h diff -u src/sys/dev/raidframe/rf_desc.h:1.21 src/sys/dev/raidframe/rf_desc.h:1.22 --- src/sys/dev/raidframe/rf_desc.h:1.21 Thu Oct 10 03:43:59 2019 +++ src/sys/dev/raidframe/rf_desc.h Fri Jul 23 02:35:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_desc.h,v 1.21 2019/10/10 03:43:59 christos Exp $ */ +/* $NetBSD: rf_desc.h,v 1.22 2021/07/23 02:35:14 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -91,7 +91,6 @@ struct RF_RaidAccessDesc_s { * I/O */ void *callbackArg; /* arg to give to callback func */ RF_RaidAccessDesc_t *next; - int async_flag; RF_Etimer_t timer; /* used for timing this access */ }; #endif/* !_RF__RF_DESC_H_ */ Index: src/sys/dev/raidframe/rf_driver.c diff -u src/sys/dev/raidframe/rf_driver.c:1.138 src/sys/dev/raidframe/rf_driver.c:1.139 --- src/sys/dev/raidframe/rf_driver.c:1.138 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_driver.c Fri Jul 23 02:35:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.c,v 1.138 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_driver.c,v 1.139 2021/07/23 02:35:14 oster Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. * All rights reserved. @@ -66,7 +66,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.138 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_driver.c,v 1.139 2021/07/23 02:35:14 oster Exp $"); #ifdef _KERNEL_OPT #include "opt_raid_diagnostic.h" @@ -665,13 +665,11 @@ rf_FreeRaidAccDesc(RF_RaidAccessDesc_t * * when either the DAG library is incomplete or there are too many * failures in a parity group. * - * type should be read or write async_flag should be RF_TRUE or - * RF_FALSE bp_in is a buf pointer. void *to facilitate ignoring it - * outside the kernel + * type should be read or write. bp_in is a buf pointer. void *to + * facilitate ignoring it outside the kernel / int -rf_DoAccess(RF_Raid_t * raidPtr, RF_IoType_t type, int async_flag, - RF_RaidAddr_t raidAddress, RF_SectorCount_t numBlocks, +rf_DoAccess(RF_Raid_t * raidPtr, RF_IoType_t type, RF_RaidAddr_t raidAddress, RF_SectorCount_t numBlocks, void *bufPtr, struct buf *bp, RF_RaidAccessFlags_t flags) { RF_RaidAccessDesc_t *desc; @@ -704,7 +702,6 @@ rf_DoAccess(RF_Raid_t * raidPtr, RF_IoTy #if RF_ACC_TRACE > 0 RF_ETIMER_START(desc->tracerec.tot_timer); #endif - desc->async_flag = async_flag; if (raidPtr->parity_map != NULL && type == RF_IO_TYPE_WRITE) Index: src/sys/dev/raidframe/rf_driver.h diff -u src/sys/dev/raidframe/rf_driver.h:1.20 src/sys/dev/raidframe/rf_driver.h:1.21 --- src/sys/dev/raidframe/rf_driver.h:1.20 Sat Dec 26 00:58:45 2015 +++ src/sys/dev/raidframe/rf_driver.h Fri Jul 23 02:35:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_driver.h,v 1.20 2015/12/26 00:58:45 pgoyette Exp $ */ +/* $NetBSD: rf_driver.h,v 1.21 2021/07/23 02:35:14 oster Exp $ */ /* * rf_driver.h */ @@ -52,7 +52,7 @@ RF_RaidAccessDesc_t *rf_AllocRaidAccDesc RF_RaidAccessFlags_t, const RF_AccessState_t *); void rf_FreeRaidAccDesc(RF_RaidAccessDesc_t *); -int rf_DoAccess(RF_Raid_t *, RF_IoType_t, int, RF_RaidAddr_t, +int rf_DoAccess(RF_Raid_t *, RF_IoType_t, RF_RaidAddr_t, RF_SectorCount_t, void *, struct buf *, RF_RaidAccessFlags_t); #if 0 Index: src/sys/dev/raidframe/rf_netbsdkintf.c diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.395 src/sys/dev/raidframe/rf_netbsdkintf.c:1.396 --- src/sys/dev/raidframe/rf_netbsdkintf.c:1.395 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_netbsdkintf.c Fri Jul 23 02:35:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsdkintf.c,v 1.395 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_netbsdkintf.c,v 1.396 2021/07/23 02:35:14 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc. @@ -101,7 +101,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.395 2021/07/23 00:54:45 oster Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 02:18:26 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_netbsd.h Log Message: The 'pss_issued' pool is unused, so remove it. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/raidframe/rf_netbsd.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/raidframe/rf_netbsd.h diff -u src/sys/dev/raidframe/rf_netbsd.h:1.37 src/sys/dev/raidframe/rf_netbsd.h:1.38 --- src/sys/dev/raidframe/rf_netbsd.h:1.37 Fri Jul 23 00:54:45 2021 +++ src/sys/dev/raidframe/rf_netbsd.h Fri Jul 23 02:18:26 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsd.h,v 1.37 2021/07/23 00:54:45 oster Exp $ */ +/* $NetBSD: rf_netbsd.h,v 1.38 2021/07/23 02:18:26 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -73,7 +73,6 @@ struct RF_Pools_s { struct pool mcpair; /* Mutex/Cond Pairs */ struct pool pda; /* Physical Disk Access structures */ struct pool pss; /* Parity Stripe Status */ - struct pool pss_issued; /* Parity Stripe Status Issued */ struct pool rad; /* Raid Access Descriptors */ struct pool reconbuffer; /* reconstruction buffer (header) pool */ struct pool revent; /* reconstruct events */ @@ -100,7 +99,6 @@ struct RF_PoolNames_s { char mcpair[RF_MAX_POOLNAMELEN]; /* Mutex/Cond Pairs */ char pda[RF_MAX_POOLNAMELEN]; /* Physical Disk Access structures */ char pss[RF_MAX_POOLNAMELEN]; /* Parity Stripe Status */ - char pss_issued[RF_MAX_POOLNAMELEN]; /* Parity Stripe Status Issued */ char rad[RF_MAX_POOLNAMELEN]; /* Raid Access Descriptors */ char reconbuffer[RF_MAX_POOLNAMELEN]; /* reconstruction buffer (header) pool */ char revent[RF_MAX_POOLNAMELEN]; /* reconstruct events */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 00:54:45 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_alloclist.c rf_aselect.c rf_callback.c rf_callback.h rf_copyback.c rf_dagdegrd.c rf_dagdegwr.c rf_dagffrd.c rf_dagffwr.c rf_dagutils.c rf_dagutils.h rf_diskqueue.c rf_diskqueue.h rf_driver.c rf_evenodd.c rf_map.c rf_map.h rf_mcpair.c rf_mcpair.h rf_netbsd.h rf_netbsdkintf.c rf_paritylogDiskMgr.c rf_parityscan.c rf_psstatus.c rf_psstatus.h rf_raid.h rf_raid1.c rf_reconbuffer.c rf_reconstruct.c rf_reconstruct.h rf_reconutil.c rf_revent.c rf_revent.h rf_states.c rf_stripelocks.c rf_stripelocks.h Log Message: Extensive mechanical changes to the pools used in RAIDframe. Alloclist remains not per-RAID, so initialize that pool separately/differently than the rest. The remainder of pools in RF_Pools_s are now per-RAID pools. Mostly mechanical changes to functions to allocate/destroy per-RAID pools. Needed to make raidPtr available in certain cases to be able to find the per-RAID pools. Extend rf_pool_init() to now populate a per-RAID wchan value that is unique to each pool for a given RAID device. TODO: Complete the analysis of the minimum number of items that are required for each pool to allow IO to progress (i.e. so that a request for pool resources can always be satisfied), and dynamically scale minimum pool sizes based on RAID configuration. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/raidframe/rf_alloclist.c \ src/sys/dev/raidframe/rf_revent.c cvs rdiff -u -r1.29 -r1.30 src/sys/dev/raidframe/rf_aselect.c \ src/sys/dev/raidframe/rf_reconstruct.h cvs rdiff -u -r1.24 -r1.25 src/sys/dev/raidframe/rf_callback.c \ src/sys/dev/raidframe/rf_mcpair.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/raidframe/rf_callback.h cvs rdiff -u -r1.53 -r1.54 src/sys/dev/raidframe/rf_copyback.c cvs rdiff -u -r1.31 -r1.32 src/sys/dev/raidframe/rf_dagdegrd.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/raidframe/rf_dagdegwr.c cvs rdiff -u -r1.21 -r1.22 src/sys/dev/raidframe/rf_dagffrd.c \ src/sys/dev/raidframe/rf_dagutils.h cvs rdiff -u -r1.36 -r1.37 src/sys/dev/raidframe/rf_dagffwr.c \ src/sys/dev/raidframe/rf_netbsd.h src/sys/dev/raidframe/rf_parityscan.c cvs rdiff -u -r1.57 -r1.58 src/sys/dev/raidframe/rf_dagutils.c cvs rdiff -u -r1.59 -r1.60 src/sys/dev/raidframe/rf_diskqueue.c cvs rdiff -u -r1.26 -r1.27 src/sys/dev/raidframe/rf_diskqueue.h \ src/sys/dev/raidframe/rf_reconbuffer.c cvs rdiff -u -r1.137 -r1.138 src/sys/dev/raidframe/rf_driver.c cvs rdiff -u -r1.22 -r1.23 src/sys/dev/raidframe/rf_evenodd.c cvs rdiff -u -r1.50 -r1.51 src/sys/dev/raidframe/rf_map.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/raidframe/rf_map.h cvs rdiff -u -r1.10 -r1.11 src/sys/dev/raidframe/rf_mcpair.h \ src/sys/dev/raidframe/rf_revent.h cvs rdiff -u -r1.394 -r1.395 src/sys/dev/raidframe/rf_netbsdkintf.c cvs rdiff -u -r1.30 -r1.31 src/sys/dev/raidframe/rf_paritylogDiskMgr.c cvs rdiff -u -r1.37 -r1.38 src/sys/dev/raidframe/rf_psstatus.c \ src/sys/dev/raidframe/rf_raid1.c src/sys/dev/raidframe/rf_reconutil.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/raidframe/rf_psstatus.h cvs rdiff -u -r1.48 -r1.49 src/sys/dev/raidframe/rf_raid.h cvs rdiff -u -r1.125 -r1.126 src/sys/dev/raidframe/rf_reconstruct.c cvs rdiff -u -r1.51 -r1.52 src/sys/dev/raidframe/rf_states.c cvs rdiff -u -r1.34 -r1.35 src/sys/dev/raidframe/rf_stripelocks.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/raidframe/rf_stripelocks.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/raidframe/rf_alloclist.c diff -u src/sys/dev/raidframe/rf_alloclist.c:1.28 src/sys/dev/raidframe/rf_alloclist.c:1.29 --- src/sys/dev/raidframe/rf_alloclist.c:1.28 Sun Feb 10 17:13:33 2019 +++ src/sys/dev/raidframe/rf_alloclist.c Fri Jul 23 00:54:45 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_alloclist.c,v 1.28 2019/02/10 17:13:33 christos Exp $ */ +/* $NetBSD: rf_alloclist.c,v 1.29 2021/07/23 00:54:45 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -37,7 +37,7 @@ ***/ #include -__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.28 2019/02/10 17:13:33 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_alloclist.c,v 1.29 2021/07/23 00:54:45 oster Exp $"); #include @@ -59,15 +59,17 @@ static void rf_ShutdownAllocList(void *) static void rf_ShutdownAllocList(void *ignored) { - pool_destroy(&rf_pools.alloclist); + pool_destroy(&rf_alloclist_pool); } int rf_ConfigureAllocList(RF_ShutdownList_t **listp) { - rf_pool_init(&rf_pools.alloclist, sizeof(RF_AllocListElem_t), - "rf_alloclist_pl", RF_AL_FREELIST_MIN, RF_AL_FREELIST_MAX); + pool_init(&rf_alloclist_pool, sizeof(RF_AllocListElem_t), 0, 0, 0, "rf_alloclist_pl", NU
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Fri Jul 23 00:26:20 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_diskqueue.c rf_netbsd.h Log Message: getiobuf() can return NULL if there are no IO buffers available. RAIDframe can't deal with that, so create a dedicated pool of buffers to use for IO. PR_WAITOK is fine here, as we pre-allocate more than we need to guarantee IO can make progress. Tuning of pool still to come. To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/dev/raidframe/rf_diskqueue.c cvs rdiff -u -r1.35 -r1.36 src/sys/dev/raidframe/rf_netbsd.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/raidframe/rf_diskqueue.c diff -u src/sys/dev/raidframe/rf_diskqueue.c:1.58 src/sys/dev/raidframe/rf_diskqueue.c:1.59 --- src/sys/dev/raidframe/rf_diskqueue.c:1.58 Fri Jun 19 19:32:03 2020 +++ src/sys/dev/raidframe/rf_diskqueue.c Fri Jul 23 00:26:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_diskqueue.c,v 1.58 2020/06/19 19:32:03 jdolecek Exp $ */ +/* $NetBSD: rf_diskqueue.c,v 1.59 2021/07/23 00:26:19 oster Exp $ */ /* * Copyright (c) 1995 Carnegie-Mellon University. * All rights reserved. @@ -66,7 +66,7 @@ / #include -__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.58 2020/06/19 19:32:03 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_diskqueue.c,v 1.59 2021/07/23 00:26:19 oster Exp $"); #include @@ -84,6 +84,8 @@ __KERNEL_RCSID(0, "$NetBSD: rf_diskqueue #include "rf_fifo.h" #include "rf_kintf.h" +#include + static void rf_ShutdownDiskQueueSystem(void *); #ifndef RF_DEBUG_DISKQUEUE @@ -147,10 +149,15 @@ static const RF_DiskQueueSW_t diskqueues }; #define NUM_DISK_QUEUE_TYPES (sizeof(diskqueuesw)/sizeof(RF_DiskQueueSW_t)) + #define RF_MAX_FREE_DQD 256 #define RF_MIN_FREE_DQD 64 -#include +/* XXX: scale these... */ +#define RF_MAX_FREE_BUFIO 256 +#define RF_MIN_FREE_BUFIO 64 + + /* configures a single disk queue */ @@ -189,6 +196,7 @@ static void rf_ShutdownDiskQueueSystem(void *ignored) { pool_destroy(&rf_pools.dqd); + pool_destroy(&rf_pools.bufio); } int @@ -197,6 +205,8 @@ rf_ConfigureDiskQueueSystem(RF_ShutdownL rf_pool_init(&rf_pools.dqd, sizeof(RF_DiskQueueData_t), "rf_dqd_pl", RF_MIN_FREE_DQD, RF_MAX_FREE_DQD); + rf_pool_init(&rf_pools.bufio, sizeof(buf_t), + "rf_bufio_pl", RF_MIN_FREE_BUFIO, RF_MAX_FREE_BUFIO); rf_ShutdownCreate(listp, rf_ShutdownDiskQueueSystem, NULL); return (0); @@ -367,19 +377,20 @@ rf_CreateDiskQueueData(RF_IoType_t typ, { RF_DiskQueueData_t *p; - p = pool_get(&rf_pools.dqd, waitflag | PR_ZERO); - if (p == NULL) - return (NULL); + p = pool_get(&rf_pools.dqd, PR_WAITOK | PR_ZERO); + KASSERT(p != NULL); - if (waitflag == PR_WAITOK) { - p->bp = getiobuf(NULL, true); - } else { - p->bp = getiobuf(NULL, false); - } - if (p->bp == NULL) { - pool_put(&rf_pools.dqd, p); - return (NULL); - } + /* Obtain a buffer from our own pool. It is possible for the + regular getiobuf() to run out of memory and return NULL. + We need to guarantee that never happens, as RAIDframe + doesn't have a good way to recover if memory allocation + fails here. + */ + p->bp = pool_get(&rf_pools.bufio, PR_WAITOK | PR_ZERO); + KASSERT(p->bp != NULL); + + buf_init(p->bp); + SET(p->bp->b_cflags, BC_BUSY); /* mark buffer busy */ if (mbp) { SET(p->bp->b_flags, mbp->b_flags & rf_b_pass); @@ -405,6 +416,6 @@ rf_CreateDiskQueueData(RF_IoType_t typ, void rf_FreeDiskQueueData(RF_DiskQueueData_t *p) { - putiobuf(p->bp); + pool_put(&rf_pools.bufio, p->bp); pool_put(&rf_pools.dqd, p); } Index: src/sys/dev/raidframe/rf_netbsd.h diff -u src/sys/dev/raidframe/rf_netbsd.h:1.35 src/sys/dev/raidframe/rf_netbsd.h:1.36 --- src/sys/dev/raidframe/rf_netbsd.h:1.35 Fri Jun 19 19:29:39 2020 +++ src/sys/dev/raidframe/rf_netbsd.h Fri Jul 23 00:26:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_netbsd.h,v 1.35 2020/06/19 19:29:39 jdolecek Exp $ */ +/* $NetBSD: rf_netbsd.h,v 1.36 2021/07/23 00:26:19 oster Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -61,6 +61,7 @@ struct RF_Pools_s { struct pool asm_hdr; /* Access Stripe Map Header */ struct pool asmap; /* Access Stripe Map */ struct pool asmhle; /* Access Stripe Map Header List Elements */ + struct pool bufio; /* Buffer IO Pool */ struct pool callbackf; /* Callback function descriptors */ struct pool callbackv; /* Callback value descriptors */ struct pool dagh;/* DAG headers */
CVS commit: src/sys/dev/raidframe
Module Name:src Committed By: oster Date: Wed Jul 21 23:10:12 UTC 2021 Modified Files: src/sys/dev/raidframe: rf_shutdown.c Log Message: Remove commented line that is a duplicate of a real line. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/raidframe/rf_shutdown.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/raidframe/rf_shutdown.c diff -u src/sys/dev/raidframe/rf_shutdown.c:1.20 src/sys/dev/raidframe/rf_shutdown.c:1.21 --- src/sys/dev/raidframe/rf_shutdown.c:1.20 Wed Dec 17 20:51:34 2008 +++ src/sys/dev/raidframe/rf_shutdown.c Wed Jul 21 23:10:12 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: rf_shutdown.c,v 1.20 2008/12/17 20:51:34 cegger Exp $ */ +/* $NetBSD: rf_shutdown.c,v 1.21 2021/07/21 23:10:12 oster Exp $ */ /* * rf_shutdown.c */ @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: rf_shutdown.c,v 1.20 2008/12/17 20:51:34 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rf_shutdown.c,v 1.21 2021/07/21 23:10:12 oster Exp $"); #include @@ -71,8 +71,6 @@ _rf_ShutdownCreate(RF_ShutdownList_t **l * Have to directly allocate memory here, since we start up before * and shutdown after RAIDframe internal allocation system. */ - /* ent = (RF_ShutdownList_t *) malloc(sizeof(RF_ShutdownList_t), - M_RAIDFRAME, M_WAITOK); */ ent = (RF_ShutdownList_t *) malloc(sizeof(RF_ShutdownList_t), M_RAIDFRAME, M_WAITOK); ent->cleanup = cleanup;
CVS commit: src/sys/dev/audio
Module Name:src Committed By: isaki Date: Wed Jul 21 06:14:58 UTC 2021 Modified Files: src/sys/dev/audio: audio.c Log Message: AUDIO_SETINFO: fix a bug that the gain and the balance could not be set at the same time. Fix PR kern/56308. To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/dev/audio/audio.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/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.104 src/sys/dev/audio/audio.c:1.105 --- src/sys/dev/audio/audio.c:1.104 Tue Jun 8 09:46:04 2021 +++ src/sys/dev/audio/audio.c Wed Jul 21 06:14:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.104 2021/06/08 09:46:04 riastradh Exp $ */ +/* $NetBSD: audio.c,v 1.105 2021/07/21 06:14:58 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -138,7 +138,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.104 2021/06/08 09:46:04 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.105 2021/07/21 06:14:58 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -7418,59 +7418,46 @@ audio_hw_setinfo(struct audio_softc *sc, } } - /* Backup play.{gain,balance} */ + /* play.{gain,balance} */ if (SPECIFIED(newpi->gain) || SPECIFIED_CH(newpi->balance)) { au_get_gain(sc, &sc->sc_outports, &pgain, &pbalance); if (oldai) { oldpi->gain = pgain; oldpi->balance = pbalance; } + + if (SPECIFIED(newpi->gain)) + pgain = newpi->gain; + if (SPECIFIED_CH(newpi->balance)) + pbalance = newpi->balance; + error = au_set_gain(sc, &sc->sc_outports, pgain, pbalance); + if (error) { + audio_printf(sc, + "setting play.gain=%d/balance=%d failed: " + "errno=%d\n", + pgain, pbalance, error); + goto abort; + } } - /* Backup record.{gain,balance} */ + + /* record.{gain,balance} */ if (SPECIFIED(newri->gain) || SPECIFIED_CH(newri->balance)) { au_get_gain(sc, &sc->sc_inports, &rgain, &rbalance); if (oldai) { oldri->gain = rgain; oldri->balance = rbalance; } - } - if (SPECIFIED(newpi->gain)) { - error = au_set_gain(sc, &sc->sc_outports, - newpi->gain, pbalance); - if (error) { - audio_printf(sc, - "setting play.gain=%d failed: errno=%d\n", - newpi->gain, error); - goto abort; - } - } - if (SPECIFIED(newri->gain)) { - error = au_set_gain(sc, &sc->sc_inports, - newri->gain, rbalance); - if (error) { - audio_printf(sc, - "setting record.gain=%d failed: errno=%d\n", - newri->gain, error); - goto abort; - } - } - if (SPECIFIED_CH(newpi->balance)) { - error = au_set_gain(sc, &sc->sc_outports, - pgain, newpi->balance); - if (error) { - audio_printf(sc, - "setting play.balance=%d failed: errno=%d\n", - newpi->balance, error); - goto abort; - } - } - if (SPECIFIED_CH(newri->balance)) { - error = au_set_gain(sc, &sc->sc_inports, - rgain, newri->balance); + + if (SPECIFIED(newri->gain)) + rgain = newri->gain; + if (SPECIFIED_CH(newri->balance)) + rbalance = newri->balance; + error = au_set_gain(sc, &sc->sc_inports, rgain, rbalance); if (error) { audio_printf(sc, - "setting record.balance=%d failed: errno=%d\n", - newri->balance, error); + "setting record.gain=%d/balance=%d failed: " + "errno=%d\n", + rgain, rbalance, error); goto abort; } }
CVS commit: src/sys/dev/pci
Module Name:src Committed By: riastradh Date: Sat Jul 17 10:45:58 UTC 2021 Modified Files: src/sys/dev/pci: pucdata.c Log Message: puc(4): Add Intel Core 5G (mobile) KT. To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/sys/dev/pci/pucdata.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/pucdata.c diff -u src/sys/dev/pci/pucdata.c:1.109 src/sys/dev/pci/pucdata.c:1.110 --- src/sys/dev/pci/pucdata.c:1.109 Tue Feb 2 16:11:43 2021 +++ src/sys/dev/pci/pucdata.c Sat Jul 17 10:45:58 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pucdata.c,v 1.109 2021/02/02 16:11:43 bouyer Exp $ */ +/* $NetBSD: pucdata.c,v 1.110 2021/07/17 10:45:58 riastradh Exp $ */ /* * Copyright (c) 1998, 1999 Christopher G. Demetriou. All rights reserved. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.109 2021/02/02 16:11:43 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pucdata.c,v 1.110 2021/07/17 10:45:58 riastradh Exp $"); #include #include @@ -2046,6 +2046,15 @@ const struct puc_device_description puc_ }, }, + /* Intel Core 5G (mobile) KT */ + { "Intel Core 5G (mobile) KT", + { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE5G_M_KT, 0, 0 }, + { 0x, 0x, 0, 0 }, + { + { PUC_PORT_TYPE_COM, PCI_BAR0, 0x00, COM_FREQ }, + }, + }, + /* Intel EG20T UART */ { "Intel EG20T UART #0", { PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_EG20T_UART_0, 0, 0 },
CVS commit: src/sys/dev/pci
Module Name:src Committed By: mrg Date: Sat Jul 17 07:11:36 UTC 2021 Modified Files: src/sys/dev/pci: pcidevs Log Message: add current generation NVIDIA graphics cards (3050-3090 etc.) To generate a diff of this commit: cvs rdiff -u -r1.1427 -r1.1428 src/sys/dev/pci/pcidevs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/pcidevs diff -u src/sys/dev/pci/pcidevs:1.1427 src/sys/dev/pci/pcidevs:1.1428 --- src/sys/dev/pci/pcidevs:1.1427 Mon Jul 12 12:58:57 2021 +++ src/sys/dev/pci/pcidevs Sat Jul 17 07:11:35 2021 @@ -1,4 +1,4 @@ -$NetBSD: pcidevs,v 1.1427 2021/07/12 12:58:57 msaitoh Exp $ +$NetBSD: pcidevs,v 1.1428 2021/07/17 07:11:35 mrg Exp $ /* * Copyright (c) 1995, 1996 Christopher G. Demetriou @@ -7182,6 +7182,44 @@ product NVIDIA TESLA_V100PCI16 0x1db4 T product NVIDIA TESLA_V100SXM32 0x1db5 Tesla V100 SXM2 32GB product NVIDIA TESLA_V100PCI32 0x1db6 Tesla V100 PCIe 32GB product NVIDIA QUADRO_GV100 0x1dba Quadro GV100 +product NVIDIA TITAN_RTX 0x1e02 TITAN RTX +product NVIDIA GF_GTX2080_Ti 0x1e04 GeForce GTX 2080 Ti +product NVIDIA GF_GTX2080_Ti_2 0x1e07 GeForce GTX 2080 Ti +product NVIDIA QUADRO_RTX_8000 0x1e30 Quadro RTX 8000 / 6000 +product NVIDIA QUADRO_RTX_6000 0x1e3c Quadro RTX 6000 +product NVIDIA GF_GTX2080 0x1e82 GeForce GTX 2080 +product NVIDIA GF_GTX2080_2 0x1e87 GeForce GTX 2080 +product NVIDIA GF_GTX2060 0x1e89 GeForce GTX 2060 +product NVIDIA GF_GTX2080_M 0x1e90 GeForce GTX 2080 Mobile +product NVIDIA QUADRO_RTX_5000 0x1eb0 Quadro RTX 5000 +product NVIDIA QUADRO_RTX_4000 0x1eb1 Quadro RTX 4000 +product NVIDIA GF_GTX2080_M2 0x1ed0 GeForce GTX 2080 Mobile +product NVIDIA GF_GTX2070 0x1f02 GeForce GTX 2070 +product NVIDIA GF_GTX2070_2 0x1f07 GeForce GTX 2070 +product NVIDIA GF_GTX2060_2 0x1f08 GeForce GTX 2060 +product NVIDIA GF_GTX2070_M 0x1f10 GeForce GTX 2070 Mobile +product NVIDIA GF_GTX2060_M 0x1f11 GeForce GTX 2060 Mobile +product NVIDIA GF_GTX2070_M2 0x1f50 GeForce GTX 2070 Mobile +product NVIDIA GF_GTX2060_M2 0x1f51 GeForce GTX 2060 Mobile +product NVIDIA GF_GTX1650 0x1f82 GeForce GTX 1650 +product NVIDIA GF_GTX1650_M 0x1f91 GeForce GTX 1650 Mobile +product NVIDIA GF_GTX1660_Ti 0x2182 GeForce GTX 1660 Ti +product NVIDIA GF_GTX1660 0x2184 GeForce GTX 1660 +product NVIDIA GF_GTX3090 0x2204 GeForce GTX 3090 +product NVIDIA GF_GTX3080_Ti 0x2205 GeForce GTX 3080 Ti +product NVIDIA GF_GTX3080 0x2206 GeForce GTX 3080 +product NVIDIA RTX_A6000 0x2230 RTX A6000 +product NVIDIA RTX_A40 0x2235 RTX A40 +product NVIDIA GF_RTX3090_Ti 0x2482 GeForce RTX 3070 Ti +product NVIDIA GF_RTX3070 0x2484 GeForce RTX 3070 +product NVIDIA GF_RTX3060_Ti 0x2486 GeForce RTX 3060 Ti +product NVIDIA GF_RTX3070_MM 0x249c GeForce RTX 3070 Mobile / Max-Q +product NVIDIA GF_RTX3070_MM2 0x249d GeForce RTX 3070 Mobile / Max-Q +product NVIDIA GF_RTX3070_M 0x24dc GeForce RTX 3070 Mobile +product NVIDIA GF_RTX3070_MM3 0x24dd GeForce RTX 3070 Mobile / Max-Q +product NVIDIA GF_RTX3060 0x2501 GeForce RTX 3060 +product NVIDIA GF_RTX3060_MM 0x2520 GeForce RTX 3060 Mobile / Max-Q +product NVIDIA GF_RTX3050 0x2283 GeForce RTX 3050 /* Nvidia & SGS-Thomson Microelectronics */
CVS commit: src/sys/dev/pci
Module Name:src Committed By: andvar Date: Fri Jul 16 12:20:01 UTC 2021 Modified Files: src/sys/dev/pci: xmm7360.c Log Message: Add missing RCSID, remove non-breaking space characters in copyright, remove vim modeline (from yambo in IRC). ok riastradh To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/xmm7360.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/xmm7360.c diff -u src/sys/dev/pci/xmm7360.c:1.7 src/sys/dev/pci/xmm7360.c:1.8 --- src/sys/dev/pci/xmm7360.c:1.7 Sat Apr 24 23:36:57 2021 +++ src/sys/dev/pci/xmm7360.c Fri Jul 16 12:20:01 2021 @@ -1,4 +1,5 @@ -// vim: noet ts=8 sts=8 sw=8 +/* $NetBSD: xmm7360.c,v 1.8 2021/07/16 12:20:01 andvar Exp $ */ + /* * Device driver for Intel XMM7360 LTE modems, eg. Fibocom L850-GL. * Written by James Wah @@ -6,8 +7,8 @@ * * Development of this driver was supported by genua GmbH * -Â * Copyright (c) 2020 genua GmbH -Â *Â Copyright (c) 2020 James Wah + * Copyright (c) 2020 genua GmbH + * Copyright (c) 2020 James Wah * * The OpenBSD and NetBSD support was written by Jaromir Dolecek for * Moritz Systems Technology Company Sp. z o.o. @@ -74,7 +75,7 @@ MODULE_DEVICE_TABLE(pci, xmm7360_ids); #include "opt_gateway.h" #include -__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.7 2021/04/24 23:36:57 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xmm7360.c,v 1.8 2021/07/16 12:20:01 andvar Exp $"); #endif #include
CVS commit: src/sys/dev/usb
Module Name:src Committed By: nisimura Date: Thu Jul 15 15:23:46 UTC 2021 Modified Files: src/sys/dev/usb: if_mue.c Log Message: back out the previous accidental commit To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/dev/usb/if_mue.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/usb/if_mue.c diff -u src/sys/dev/usb/if_mue.c:1.61 src/sys/dev/usb/if_mue.c:1.62 --- src/sys/dev/usb/if_mue.c:1.61 Thu Jul 15 03:25:50 2021 +++ src/sys/dev/usb/if_mue.c Thu Jul 15 15:23:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mue.c,v 1.61 2021/07/15 03:25:50 nisimura Exp $ */ +/* $NetBSD: if_mue.c,v 1.62 2021/07/15 15:23:46 nisimura Exp $ */ /* $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $ */ /* @@ -20,7 +20,7 @@ /* Driver for Microchip LAN7500/LAN7800 chipsets. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.61 2021/07/15 03:25:50 nisimura Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.62 2021/07/15 15:23:46 nisimura Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -98,7 +98,7 @@ static void mue_setmtu_locked(struct usb static void mue_reset(struct usbnet *); static void mue_uno_stop(struct ifnet *, int); -static int mue_uno_override_ioctl(struct ifnet *, u_long, void *); +static int mue_uno_ioctl(struct ifnet *, u_long, void *); static int mue_uno_mii_read_reg(struct usbnet *, int, int, uint16_t *); static int mue_uno_mii_write_reg(struct usbnet *, int, int, uint16_t); static void mue_uno_mii_statchg(struct ifnet *); @@ -110,7 +110,7 @@ static int mue_uno_init(struct ifnet *); static const struct usbnet_ops mue_ops = { .uno_stop = mue_uno_stop, - .uno_override_ioctl = mue_uno_override_ioctl, + .uno_ioctl = mue_uno_ioctl, .uno_read_reg = mue_uno_mii_read_reg, .uno_write_reg = mue_uno_mii_write_reg, .uno_statchg = mue_uno_mii_statchg, @@ -137,14 +137,7 @@ static const struct usbnet_ops mue_ops = #define ETHER_IS_ZERO(addr) \ (!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5])) -struct mue_softc { - struct usbnet sc_un; - struct usbnet_intr sc_intr; - uint8_t sc_ibuf[8]; - unsigned sc_flowflags; /* 802.3x PAUSE flow control */ -}; - -CFATTACH_DECL_NEW(mue, sizeof(struct mue_softc), mue_match, mue_attach, +CFATTACH_DECL_NEW(mue, sizeof(struct usbnet), mue_match, mue_attach, usbnet_detach, usbnet_activate); static uint32_t @@ -767,15 +760,14 @@ static void mue_attach(device_t parent, device_t self, void *aux) { USBNET_MII_DECL_DEFAULT(unm); + struct usbnet * const un = device_private(self); prop_dictionary_t dict = device_properties(self); - struct mue_softc * const sc = device_private(self); struct usb_attach_arg *uaa = aux; struct usbd_device *dev = uaa->uaa_device; - struct usbnet *un = &sc->sc_un; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - usbd_status err; char *devinfop; + usbd_status err; const char *descr; uint32_t id_rev; uint8_t i; @@ -790,7 +782,7 @@ mue_attach(device_t parent, device_t sel un->un_dev = self; un->un_udev = dev; - un->un_sc = sc; /* @@! */ + un->un_sc = un; un->un_ops = &mue_ops; un->un_rx_xfer_flags = USBD_SHORT_XFER_OK; un->un_tx_xfer_flags = USBD_FORCE_SHORT_XFER; @@ -892,8 +884,6 @@ mue_attach(device_t parent, device_t sel ec->ec_capabilities = ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU; #endif - unm.un_mii_phyloc = un->un_phyno; /* use internal PHY 1 */ - unm.un_mii_flags |= MIIF_DOPAUSE; /* use PAUSE cap. */ usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST, 0, &unm); } @@ -1007,93 +997,90 @@ mue_setiff_locked(struct usbnet *un) { struct ethercom *ec = usbnet_ec(un); struct ifnet * const ifp = usbnet_ifp(un); - struct ether_multistep step; + const uint8_t *enaddr = CLLADDR(ifp->if_sadl); struct ether_multi *enm; - uint32_t mchash[MUE_DP_SEL_VHF_HASH_LEN]; - uint32_t rfe, rxfilt, crc, hireg, loreg; + struct ether_multistep step; + uint32_t pfiltbl[MUE_NUM_ADDR_FILTX][2]; + uint32_t hashtbl[MUE_DP_SEL_VHF_HASH_LEN]; + uint32_t reg, rxfilt, h, hireg, loreg; size_t i; if (usbnet_isdying(un)) return; - for (i = 1; i < MUE_NUM_ADDR_FILTX; i++) { - hireg = (un->un_flags & LAN7500) - ? MUE_7500_ADDR_FILTX(i) : MUE_7800_ADDR_FILTX(i); - mue_csr_write(un, hireg, 0); - } - memset(mchash, 0, sizeof(mchash)); + /* Clear perfect filter and hash tables. */ + memset(pfiltbl, 0, sizeof(pfiltbl)); + memset(hashtbl, 0, sizeof(hashtbl)); - rfe = (un->un_flags & LAN7500) ? MUE_7500_RFE_CTL : MUE_7800_RFE_CTL; - rxfilt = mue_csr_read(un, rfe); - rxfilt &= ~(MUE_RFE_CTL_MULTICAST_HASH | + reg = (un->un_flags & LAN7500) ? MUE_7500_RFE_CTL : MUE_7800_RFE_CTL; + rxfilt = mue_csr_read(un, reg); + rxfilt &= ~(MUE_RFE_CTL_PERFECT | MUE_RFE_CTL_MULTICAST_HASH | MUE_RFE_CTL_UNICAST | MUE_RFE_CTL_MULTICAST); - ETHER_LOCK(ec); + /* Always accept broadcast frames. */ + rxfilt |= MUE_RFE_CTL_BR
CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: msaitoh Date: Thu Jul 15 08:09:31 UTC 2021 Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixv.c Log Message: Add a new sysctl to read rxr->next_to_refresh. To generate a diff of this commit: cvs rdiff -u -r1.286 -r1.287 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.163 -r1.164 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.286 src/sys/dev/pci/ixgbe/ixgbe.c:1.287 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.286 Wed Jul 7 08:58:19 2021 +++ src/sys/dev/pci/ixgbe/ixgbe.c Thu Jul 15 08:09:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.287 2021/07/15 08:09:31 msaitoh Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.287 2021/07/15 08:09:31 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -253,6 +253,7 @@ static int ixgbe_sysctl_power_state(SYSC static int ixgbe_sysctl_print_rss_config(SYSCTLFN_PROTO); #endif static int ixgbe_sysctl_next_to_check_handler(SYSCTLFN_PROTO); +static int ixgbe_sysctl_next_to_refresh_handler(SYSCTLFN_PROTO); static int ixgbe_sysctl_rdh_handler(SYSCTLFN_PROTO); static int ixgbe_sysctl_rdt_handler(SYSCTLFN_PROTO); static int ixgbe_sysctl_tdt_handler(SYSCTLFN_PROTO); @@ -1930,6 +1931,13 @@ ixgbe_add_hw_stats(struct adapter *adapt break; if (sysctl_createv(log, 0, &rnode, &cnode, + CTLFLAG_READONLY, CTLTYPE_INT, "rxd_nxrf", + SYSCTL_DESCR("Receive Descriptor next to refresh"), + ixgbe_sysctl_next_to_refresh_handler, 0, (void *)rxr, 0, + CTL_CREATE, CTL_EOL) != 0) + break; + + if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READONLY, CTLTYPE_INT, "rxd_head", SYSCTL_DESCR("Receive Descriptor Head"), ixgbe_sysctl_rdh_handler, 0, (void *)rxr, 0, @@ -2302,6 +2310,32 @@ ixgbe_sysctl_next_to_check_handler(SYSCT } /* ixgbe_sysctl_next_to_check_handler */ / + * ixgbe_sysctl_next_to_refresh_handler - Receive Descriptor next to check + * handler function + * + * Retrieves the next_to_refresh value + / +static int +ixgbe_sysctl_next_to_refresh_handler(SYSCTLFN_ARGS) +{ + struct sysctlnode node = *rnode; + struct rx_ring *rxr = (struct rx_ring *)node.sysctl_data; + struct adapter *adapter; + uint32_t val; + + if (!rxr) + return (0); + + adapter = rxr->adapter; + if (ixgbe_fw_recovery_mode_swflag(adapter)) + return (EPERM); + + val = rxr->next_to_refresh; + node.sysctl_data = &val; + return sysctl_lookup(SYSCTLFN_CALL(&node)); +} /* ixgbe_sysctl_next_to_refresh_handler */ + +/ * ixgbe_sysctl_rdh_handler - Receive Descriptor Head handler function * * Retrieves the RDH value from the hardware Index: src/sys/dev/pci/ixgbe/ixv.c diff -u src/sys/dev/pci/ixgbe/ixv.c:1.163 src/sys/dev/pci/ixgbe/ixv.c:1.164 --- src/sys/dev/pci/ixgbe/ixv.c:1.163 Wed Jul 7 08:58:19 2021 +++ src/sys/dev/pci/ixgbe/ixv.c Thu Jul 15 08:09:31 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ixv.c,v 1.163 2021/07/07 08:58:19 msaitoh Exp $ */ +/* $NetBSD: ixv.c,v 1.164 2021/07/15 08:09:31 msaitoh Exp $ */ /** @@ -35,7 +35,7 @@ /*$FreeBSD: head/sys/dev/ixgbe/if_ixv.c 331224 2018-03-19 20:55:05Z erj $*/ #include -__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.163 2021/07/07 08:58:19 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixv.c,v 1.164 2021/07/15 08:09:31 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -144,6 +144,7 @@ static void ixv_set_sysctl_value(struct const char *, int *, int); static int ixv_sysctl_interrupt_rate_handler(SYSCTLFN_PROTO); static int ixv_sysctl_next_to_check_handler(SYSCTLFN_PROTO); +static int ixv_sysctl_next_to_refresh_handler(SYSCTLFN_PROTO); static int ixv_sysctl_rdh_handler(SYSCTLFN_PROTO); static int ixv_sysctl_rdt_handler(SYSCTLFN_PROTO); static int ixv_sysctl_tdt_handler(SYSCTLFN_PROTO); @@ -2033,6 +2034,32 @@ ixv_sysctl_next_to_check_handler(SYSCTLF } /* ixv_sysctl_next_to_check_handler */ / + * ixv_sysctl_next_to_refresh_handler - Receive Descriptor next to refresh + * handler function + * + * Retrieves the next_to_refresh value + / +static int +ixv_sysctl_next_to_refresh_handler(SYSCTLFN_ARGS) +{ + struct sysctlnode node = *rnode; + struct rx_ring *rxr =
CVS commit: src/sys/dev/usb
Module Name:src Committed By: nisimura Date: Thu Jul 15 03:25:50 UTC 2021 Modified Files: src/sys/dev/usb: if_mue.c uchcom.c Log Message: explanation typo To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/dev/usb/if_mue.c cvs rdiff -u -r1.38 -r1.39 src/sys/dev/usb/uchcom.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/usb/if_mue.c diff -u src/sys/dev/usb/if_mue.c:1.60 src/sys/dev/usb/if_mue.c:1.61 --- src/sys/dev/usb/if_mue.c:1.60 Sat Jun 27 13:33:26 2020 +++ src/sys/dev/usb/if_mue.c Thu Jul 15 03:25:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mue.c,v 1.60 2020/06/27 13:33:26 jmcneill Exp $ */ +/* $NetBSD: if_mue.c,v 1.61 2021/07/15 03:25:50 nisimura Exp $ */ /* $OpenBSD: if_mue.c,v 1.3 2018/08/04 16:42:46 jsg Exp $ */ /* @@ -20,7 +20,7 @@ /* Driver for Microchip LAN7500/LAN7800 chipsets. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.60 2020/06/27 13:33:26 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mue.c,v 1.61 2021/07/15 03:25:50 nisimura Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -98,7 +98,7 @@ static void mue_setmtu_locked(struct usb static void mue_reset(struct usbnet *); static void mue_uno_stop(struct ifnet *, int); -static int mue_uno_ioctl(struct ifnet *, u_long, void *); +static int mue_uno_override_ioctl(struct ifnet *, u_long, void *); static int mue_uno_mii_read_reg(struct usbnet *, int, int, uint16_t *); static int mue_uno_mii_write_reg(struct usbnet *, int, int, uint16_t); static void mue_uno_mii_statchg(struct ifnet *); @@ -110,7 +110,7 @@ static int mue_uno_init(struct ifnet *); static const struct usbnet_ops mue_ops = { .uno_stop = mue_uno_stop, - .uno_ioctl = mue_uno_ioctl, + .uno_override_ioctl = mue_uno_override_ioctl, .uno_read_reg = mue_uno_mii_read_reg, .uno_write_reg = mue_uno_mii_write_reg, .uno_statchg = mue_uno_mii_statchg, @@ -137,7 +137,14 @@ static const struct usbnet_ops mue_ops = #define ETHER_IS_ZERO(addr) \ (!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5])) -CFATTACH_DECL_NEW(mue, sizeof(struct usbnet), mue_match, mue_attach, +struct mue_softc { + struct usbnet sc_un; + struct usbnet_intr sc_intr; + uint8_t sc_ibuf[8]; + unsigned sc_flowflags; /* 802.3x PAUSE flow control */ +}; + +CFATTACH_DECL_NEW(mue, sizeof(struct mue_softc), mue_match, mue_attach, usbnet_detach, usbnet_activate); static uint32_t @@ -760,14 +767,15 @@ static void mue_attach(device_t parent, device_t self, void *aux) { USBNET_MII_DECL_DEFAULT(unm); - struct usbnet * const un = device_private(self); prop_dictionary_t dict = device_properties(self); + struct mue_softc * const sc = device_private(self); struct usb_attach_arg *uaa = aux; struct usbd_device *dev = uaa->uaa_device; + struct usbnet *un = &sc->sc_un; usb_interface_descriptor_t *id; usb_endpoint_descriptor_t *ed; - char *devinfop; usbd_status err; + char *devinfop; const char *descr; uint32_t id_rev; uint8_t i; @@ -782,7 +790,7 @@ mue_attach(device_t parent, device_t sel un->un_dev = self; un->un_udev = dev; - un->un_sc = un; + un->un_sc = sc; /* @@! */ un->un_ops = &mue_ops; un->un_rx_xfer_flags = USBD_SHORT_XFER_OK; un->un_tx_xfer_flags = USBD_FORCE_SHORT_XFER; @@ -884,6 +892,8 @@ mue_attach(device_t parent, device_t sel ec->ec_capabilities = ETHERCAP_VLAN_MTU | ETHERCAP_JUMBO_MTU; #endif + unm.un_mii_phyloc = un->un_phyno; /* use internal PHY 1 */ + unm.un_mii_flags |= MIIF_DOPAUSE; /* use PAUSE cap. */ usbnet_attach_ifp(un, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST, 0, &unm); } @@ -997,90 +1007,93 @@ mue_setiff_locked(struct usbnet *un) { struct ethercom *ec = usbnet_ec(un); struct ifnet * const ifp = usbnet_ifp(un); - const uint8_t *enaddr = CLLADDR(ifp->if_sadl); - struct ether_multi *enm; struct ether_multistep step; - uint32_t pfiltbl[MUE_NUM_ADDR_FILTX][2]; - uint32_t hashtbl[MUE_DP_SEL_VHF_HASH_LEN]; - uint32_t reg, rxfilt, h, hireg, loreg; + struct ether_multi *enm; + uint32_t mchash[MUE_DP_SEL_VHF_HASH_LEN]; + uint32_t rfe, rxfilt, crc, hireg, loreg; size_t i; if (usbnet_isdying(un)) return; - /* Clear perfect filter and hash tables. */ - memset(pfiltbl, 0, sizeof(pfiltbl)); - memset(hashtbl, 0, sizeof(hashtbl)); + for (i = 1; i < MUE_NUM_ADDR_FILTX; i++) { + hireg = (un->un_flags & LAN7500) + ? MUE_7500_ADDR_FILTX(i) : MUE_7800_ADDR_FILTX(i); + mue_csr_write(un, hireg, 0); + } + memset(mchash, 0, sizeof(mchash)); - reg = (un->un_flags & LAN7500) ? MUE_7500_RFE_CTL : MUE_7800_RFE_CTL; - rxfilt = mue_csr_read(un, reg); - rxfilt &= ~(MUE_RFE_CTL_PERFECT | MUE_RFE_CTL_MULTICAST_HASH | + rfe = (un->un_flags & LAN7500) ? MUE_7500_RFE_CTL : MUE_7800_RFE_CTL; + rxfilt = mue_csr_read(un, rfe); + rxfilt &= ~(MUE_RFE_CTL_MULTICAST_HASH | MUE_RFE_CTL_UNICAST | MUE_RFE_CTL_MULTICAST); - /* Always accept broadcast frames. */ - rxfilt |=
CVS commit: src/sys/dev/usb
Module Name:src Committed By: nisimura Date: Wed Jul 14 07:34:16 UTC 2021 Modified Files: src/sys/dev/usb: uchcom.c Log Message: The second REQ_RESET USB request by reset_chip() makes LCR, PRE and DIV registers to have default values 8N1 and 19200 just as the first req does. Nuke reset_chip() and rundandant set_dte_rate() to amend. While here added some narrative about prescale/divisor calculation. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/dev/usb/uchcom.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/usb/uchcom.c diff -u src/sys/dev/usb/uchcom.c:1.37 src/sys/dev/usb/uchcom.c:1.38 --- src/sys/dev/usb/uchcom.c:1.37 Sat Apr 24 23:36:59 2021 +++ src/sys/dev/usb/uchcom.c Wed Jul 14 07:34:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uchcom.c,v 1.37 2021/04/24 23:36:59 thorpej Exp $ */ +/* $NetBSD: uchcom.c,v 1.38 2021/07/14 07:34:16 nisimura Exp $ */ /* * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.37 2021/04/24 23:36:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uchcom.c,v 1.38 2021/07/14 07:34:16 nisimura Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -118,9 +118,6 @@ int uchcomdebug = 0; #define UCHCOMIBUFSIZE 256 #define UCHCOMOBUFSIZE 256 -#define UCHCOM_RESET_VALUE 0x501F -#define UCHCOM_RESET_INDEX 0xD90A - struct uchcom_softc { device_t sc_dev; @@ -155,6 +152,7 @@ struct uchcom_divider uint8_t dv_div; }; +/* 0,1,2,3,7 are prescale factors for given 4x 1200 clock formula */ static const uint32_t rates4x[8] = { [0] = 4 * 1200 / 1024, [1] = 4 * 1200 / 128, @@ -618,6 +616,24 @@ set_break(struct uchcom_softc *sc, int o static int calc_divider_settings(struct uchcom_divider *dp, uint32_t rate) { +/* + * combined with rates4x[] defined above, this routine generates, + * 1200: prescale = 1/0x1, divisor = 178/0xb2 + * 2400: prescale = 1/0x1, divisor = 217/0xd9 + * 4800: prescale = 2/0x2, divisor = 100/0x64 + * 9600: prescale = 2/0x2, divisor = 178/0xb2 + * 19200: prescale = 2/0x2, divisor = 217/0xd9 + * 38400: prescale = 3/0x3, divisor = 100/0x64 + * 57600: prescale = 2/0x2, divisor = 243/0xf3 + * 115200: prescale = 3/0x3, divisor = 204/0xcc + * 921600: prescale = 7/0x7, divisor = 243/0xf3 + * 50: prescale = 3/0x3, divisor = 244/0xf4 + * 100: prescale = 3/0x3, divisor = 250/0xfa + * 150: prescale = 3/0x3, divisor = 252/0xfc + * 200: prescale = 3/0x3, divisor = 253/0xfd + * 250: unsupported + * 300: prescale = 3/0x3, divisor = 254/0xfe + */ size_t i; uint32_t best, div, pre; const uint32_t rate4x = rate * 4U; @@ -652,7 +668,7 @@ calc_divider_settings(struct uchcom_divi return -1; dp->dv_prescaler = pre; - dp->dv_div = (uint8_t)-div; + dp->dv_div = 256 - div; return 0; } @@ -740,26 +756,12 @@ clear_chip(struct uchcom_softc *sc) usbd_errstr(err)); return EIO; } - - return 0; -} - -static int -reset_chip(struct uchcom_softc *sc) -{ - usbd_status err; - - err = generic_control_out(sc, UCHCOM_REQ_RESET, - UCHCOM_RESET_VALUE, UCHCOM_RESET_INDEX); - if (err) - goto failed; - + /* + * this REQ_RESET call ends up with + * LCR=0xc0 (8N1) + * PRE=0x02, DIV=0xb2 (19200) + */ return 0; - -failed: - printf("%s: cannot reset: %s\n", - device_xname(sc->sc_dev), usbd_errstr(err)); - return EIO; } static int @@ -787,14 +789,6 @@ setup_comm(struct uchcom_softc *sc) if (ret) return ret; - ret = reset_chip(sc); - if (ret) - return ret; - - ret = set_dte_rate(sc, TTYDEF_SPEED); /* XXX */ - if (ret) - return ret; - sc->sc_dtr = sc->sc_rts = 1; ret = set_dtrrts(sc, sc->sc_dtr, sc->sc_rts); if (ret)
CVS commit: src/sys/dev/eisa
Module Name:src Committed By: thorpej Date: Mon Jul 12 16:44:52 UTC 2021 Modified Files: src/sys/dev/eisa: depca_eisa.c Log Message: Printing out our model name is not considered an error message. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/dev/eisa/depca_eisa.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/eisa/depca_eisa.c diff -u src/sys/dev/eisa/depca_eisa.c:1.15 src/sys/dev/eisa/depca_eisa.c:1.16 --- src/sys/dev/eisa/depca_eisa.c:1.15 Sat Mar 29 19:28:24 2014 +++ src/sys/dev/eisa/depca_eisa.c Mon Jul 12 16:44:52 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: depca_eisa.c,v 1.15 2014/03/29 19:28:24 christos Exp $ */ +/* $NetBSD: depca_eisa.c,v 1.16 2021/07/12 16:44:52 thorpej Exp $ */ /*- * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: depca_eisa.c,v 1.15 2014/03/29 19:28:24 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: depca_eisa.c,v 1.16 2021/07/12 16:44:52 thorpej Exp $"); #include "opt_inet.h" @@ -106,7 +106,8 @@ depca_eisa_attach(device_t parent, devic struct eisa_cfg_irq eci; sc->sc_dev = self; - aprint_error(": DEC DE422 Ethernet\n"); + aprint_naive("\n"); + aprint_normal(": DEC DE422 Ethernet\n"); sc->sc_iot = ea->ea_iot; sc->sc_memt = ea->ea_memt;
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Mon Jul 12 12:59:54 UTC 2021 Modified Files: src/sys/dev/pci: ichsmb.c Log Message: Add Jasper Lake support. To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/dev/pci/ichsmb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ichsmb.c diff -u src/sys/dev/pci/ichsmb.c:1.70 src/sys/dev/pci/ichsmb.c:1.71 --- src/sys/dev/pci/ichsmb.c:1.70 Sat Apr 24 23:36:57 2021 +++ src/sys/dev/pci/ichsmb.c Mon Jul 12 12:59:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ichsmb.c,v 1.70 2021/04/24 23:36:57 thorpej Exp $ */ +/* $NetBSD: ichsmb.c,v 1.71 2021/07/12 12:59:54 msaitoh Exp $ */ /* $OpenBSD: ichiic.c,v 1.44 2020/10/07 11:23:05 jsg Exp $ */ /* @@ -22,7 +22,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.70 2021/04/24 23:36:57 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ichsmb.c,v 1.71 2021/07/12 12:59:54 msaitoh Exp $"); #include #include @@ -135,6 +135,7 @@ ichsmb_match(device_t parent, cfdata_t m case PCI_PRODUCT_INTEL_BSW_PCU_SMB: case PCI_PRODUCT_INTEL_APL_SMB: case PCI_PRODUCT_INTEL_GLK_SMB: + case PCI_PRODUCT_INTEL_JSL_SMB: case PCI_PRODUCT_INTEL_C600_SMBUS: case PCI_PRODUCT_INTEL_C600_SMB_0: case PCI_PRODUCT_INTEL_C600_SMB_1:
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Mon Jul 12 12:58:58 UTC 2021 Modified Files: src/sys/dev/pci: pcidevs Log Message: Add Intel Jasper Lake devices and Reealtek RTL8821CE. To generate a diff of this commit: cvs rdiff -u -r1.1426 -r1.1427 src/sys/dev/pci/pcidevs Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/pcidevs diff -u src/sys/dev/pci/pcidevs:1.1426 src/sys/dev/pci/pcidevs:1.1427 --- src/sys/dev/pci/pcidevs:1.1426 Wed Apr 21 13:09:33 2021 +++ src/sys/dev/pci/pcidevs Mon Jul 12 12:58:57 2021 @@ -1,4 +1,4 @@ -$NetBSD: pcidevs,v 1.1426 2021/04/21 13:09:33 jakllsch Exp $ +$NetBSD: pcidevs,v 1.1427 2021/07/12 12:58:57 msaitoh Exp $ /* * Copyright (c) 1995, 1996 Christopher G. Demetriou @@ -5183,6 +5183,56 @@ product INTEL WIFI_LINK_5350_1 0x423a Wi product INTEL WIFI_LINK_5350_2 0x423b WiFi Link 5350 product INTEL WIFI_LINK_5150_1 0x423c WiFi Link 5150 product INTEL WIFI_LINK_5150_2 0x423d WiFi Link 5150 + +product INTEL JSL_ESPI 0x4d87 Jasper Lake eSPI +product INTEL JSL_P2SB 0x4da0 Jasper Lake P2SB +product INTEL JSL_PMC 0x4da1 Jasper Lake PMC +product INTEL JSL_SMB 0x4da3 Jasper Lake SMBus +product INTEL JSL_SPI_FLASH 0x4da4 Jasper Lake SPI (FLASH) +product INTEL JSL_TRACE 0x4da6 Jasper Lake Intel Trace Hub +product INTEL JSL_UART_0 0x4da8 Jasper Lake UART 0 +product INTEL JSL_UART_1 0x4da9 Jasper Lake UART 1 +product INTEL JSL_SPI_0 0x4daa Jasper Lake SPI 0 +product INTEL JSL_SPI_1 0x4dab Jasper Lake SPI 1 +product INTEL JSL_PCIE_1 0x4db8 Jasper Lake PCIe Root Port 1 +product INTEL JSL_PCIE_2 0x4db9 Jasper Lake PCIe Root Port 2 +product INTEL JSL_PCIE_3 0x4dba Jasper Lake PCIe Root Port 3 +product INTEL JSL_PCIE_4 0x4dbb Jasper Lake PCIe Root Port 4 +product INTEL JSL_PCIE_5 0x4dbc Jasper Lake PCIe Root Port 5 +product INTEL JSL_PCIE_6 0x4dbd Jasper Lake PCIe Root Port 6 +product INTEL JSL_PCIE_7 0x4dbe Jasper Lake PCIe Root Port 7 +product INTEL JSL_PCIE_8 0x4dbf Jasper Lake PCIe Root Port 8 +product INTEL JSL_EMMC 0x4dc4 Jasper Lake eMMC +product INTEL JSL_LPSS_I2C_4 0x4dc5 Jasper Lake LPSS I2C 4 +product INTEL JSL_LPSS_I2C_5 0x4dc6 Jasper Lake LPSS I2C 5 +product INTEL JSL_UART_2 0x4dc7 Jasper Lake UART 2 +product INTEL JSL_CAVS 0x4dc8 Jasper Lake cAVS +product INTEL JSL_AHCI_1 0x4dd2 Jasper Lake SATA (AHCI) +product INTEL JSL_AHCI_2 0x4dd3 Jasper Lake SATA (AHCI) +product INTEL JSL_D_RAID 0x4dd6 Jasper Lake SATA (RAID, desktop) +product INTEL JSL_M_RAID 0x4dd7 Jasper Lake SATA (RAID, mobile) +product INTEL JSL_AHCI_OPTANE 0x4dde Jasper Lake SATA (Optane, desktop) +product INTEL JSL_HECI_1 0x4de0 Jasper Lake HECI 1 +product INTEL JSL_HECI_2 0x4de1 Jasper Lake HECI 2 +product INTEL JSL_HECI_3 0x4de4 Jasper Lake HECI 3 +product INTEL JSL_LPSS_I2C_0 0x4de8 Jasper Lake LPSS I2C 0 +product INTEL JSL_LPSS_I2C_1 0x4de9 Jasper Lake LPSS I2C 1 +product INTEL JSL_LPSS_I2C_2 0x4dea Jasper Lake LPSS I2C 2 +product INTEL JSL_LPSS_I2C_3 0x4deb Jasper Lake LPSS I2C 3 +product INTEL JSL_XHCI 0x4ded Jasper Lake USB Host (xHCI) +product INTEL JSL_XDCI 0x4dee Jasper Lake USB Device (xDCI) +product INTEL JSL_SSRAM 0x4def Jasper Lake Shared SRAM +product INTEL JSL_CNVI_0 0x4df0 Jasper Lake CNVi WiFi (SKU 0) +product INTEL JSL_CNVI_1 0x4df1 Jasper Lake CNVi WiFi (SKU 1) +product INTEL JSL_CNVI_2 0x4df2 Jasper Lake CNVi WiFi (SKU 2) +product INTEL JSL_CNVI_3 0x4df3 Jasper Lake CNVi WiFi (SKU 3) +product INTEL JSL_SCS 0x4df8 Jasper Lake SD Card +product INTEL JSL_SPI_2 0x4dfb Jasper Lake SPI 2 +product INTEL JSL_DPTF 0x4e03 Jasper Lake DPTF +product INTEL JSL_HB 0x4e22 Jasper Lake Processor Transaction Route +product INTEL JSL_GPU_EU_16 0x4e55 Jasper Lake GPU 16 EU +product INTEL JSL_GPU_EU_24 0x4e61 Jasper Lake GPU 24 EU +product INTEL JSL_GPU_EU_32 0x4e71 Jasper Lake GPU 32 EU product INTEL EP80579_HB 0x5020 EP80579 Host product INTEL EP80579_MEM 0x5021 EP80579 Memory product INTEL EP80579_EDMA 0x5023 EP80579 EDMA @@ -7574,6 +7624,7 @@ product REALTEK RTL8188EE 0x8179 RTL8188 product REALTEK RT8180 0x8180 8180 802.11b product REALTEK RT8185 0x8185 8185 802.11a/b/g product REALTEK RTL8192EE 0x818b RTL8192EE Wireless LAN 802.11n PCI-E NIC +product REALTEK RTL8821CE 0xc821 RTL8821CE 802.11ac PCIe NIC /* Red Hat products */ product REDHAT PPB 0x0001 Qemu PCI-PCI
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Mon Jul 12 04:41:14 UTC 2021 Modified Files: src/sys/dev/pci: pci_subr.c Log Message: s/Precision Time Management/Precision Time Measurement/ To generate a diff of this commit: cvs rdiff -u -r1.226 -r1.227 src/sys/dev/pci/pci_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/dev/pci/pci_subr.c diff -u src/sys/dev/pci/pci_subr.c:1.226 src/sys/dev/pci/pci_subr.c:1.227 --- src/sys/dev/pci/pci_subr.c:1.226 Tue Jun 29 21:03:36 2021 +++ src/sys/dev/pci/pci_subr.c Mon Jul 12 04:41:14 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_subr.c,v 1.226 2021/06/29 21:03:36 pgoyette Exp $ */ +/* $NetBSD: pci_subr.c,v 1.227 2021/07/12 04:41:14 msaitoh Exp $ */ /* * Copyright (c) 1997 Zubin D. Dittia. All rights reserved. @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.226 2021/06/29 21:03:36 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.227 2021/07/12 04:41:14 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_pci.h" @@ -4175,7 +4175,7 @@ pci_conf_print_ptm_cap(const pcireg_t *r pcireg_t reg; uint32_t val; - printf("\n Precision Time Management\n"); + printf("\n Precision Time Measurement\n"); reg = regs[o2i(extcapoff + PCI_PTM_CAP)]; printf("PTM Capability register: 0x%08x\n", reg); @@ -4312,7 +4312,7 @@ static struct { pci_conf_print_dpc_cap }, { PCI_EXTCAP_L1PM, "L1 PM Substates", pci_conf_print_l1pm_cap }, - { PCI_EXTCAP_PTM, "Precision Time Management", + { PCI_EXTCAP_PTM, "Precision Time Measurement", pci_conf_print_ptm_cap }, { PCI_EXTCAP_MPCIE, "M-PCIe", NULL },
CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: msaitoh Date: Wed Jul 7 08:58:20 UTC 2021 Modified Files: src/sys/dev/pci/ixgbe: ix_txrx.c ixgbe.c ixgbe.h ixv.c Log Message: Add new sysctl "rx_copy_len". ixgbe_rxeof() has an optimization "RX_COPY" to reduce costs of bus_dmamap_load_mbuf() and bus_dmamap_unload() by copying a mbuf cluster's memory to a newly allocated mbuf's MH_databuf[] and recycle the original map. The optimization is used when a length of a packet is smaller than a specific value. The value is calculated based on MHLEN. The size of MHLEN is architecture specific. It's 256 or 512. Make the threshold controllable by adding a new sysctl. To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.81 src/sys/dev/pci/ixgbe/ix_txrx.c cvs rdiff -u -r1.285 -r1.286 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/ixgbe/ixgbe.h cvs rdiff -u -r1.162 -r1.163 src/sys/dev/pci/ixgbe/ixv.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.80 src/sys/dev/pci/ixgbe/ix_txrx.c:1.81 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.80 Wed Jul 7 08:32:51 2021 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Wed Jul 7 08:58:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.81 2021/07/07 08:58:19 msaitoh Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -1976,7 +1976,7 @@ ixgbe_rxeof(struct ix_queue *que) * is cache aligned into a new mbuf, and * leave the old mbuf+cluster for re-use. */ - if (eop && len <= IXGBE_RX_COPY_LEN) { + if (eop && len <= adapter->rx_copy_len) { sendmp = m_gethdr(M_NOWAIT, MT_DATA); if (sendmp != NULL) { sendmp->m_data += IXGBE_RX_COPY_ALIGN; Index: src/sys/dev/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.285 src/sys/dev/pci/ixgbe/ixgbe.c:1.286 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.285 Tue Jun 29 21:03:36 2021 +++ src/sys/dev/pci/ixgbe/ixgbe.c Wed Jul 7 08:58:19 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.285 2021/06/29 21:03:36 pgoyette Exp $ */ +/* $NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.285 2021/06/29 21:03:36 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ixgbe.c,v 1.286 2021/07/07 08:58:19 msaitoh Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -259,6 +259,7 @@ static int ixgbe_sysctl_tdt_handler(SYSC static int ixgbe_sysctl_tdh_handler(SYSCTLFN_PROTO); static int ixgbe_sysctl_eee_state(SYSCTLFN_PROTO); static int ixgbe_sysctl_debug(SYSCTLFN_PROTO); +static int ixgbe_sysctl_rx_copy_len(SYSCTLFN_PROTO); static int ixgbe_sysctl_wol_enable(SYSCTLFN_PROTO); static int ixgbe_sysctl_wufc(SYSCTLFN_PROTO); @@ -986,6 +987,9 @@ ixgbe_attach(device_t parent, device_t d } else adapter->num_rx_desc = ixgbe_rxd; + /* Set default high limit of copying mbuf in rxeof */ + adapter->rx_copy_len = IXGBE_RX_COPY_LEN_MAX; + adapter->num_jcl = adapter->num_rx_desc * IXGBE_JCLNUM_MULTI; /* Allocate our TX/RX Queues */ @@ -3368,6 +3372,13 @@ ixgbe_add_device_sysctls(struct adapter aprint_error_dev(dev, "could not create sysctl\n"); if (sysctl_createv(log, 0, &rnode, &cnode, + CTLFLAG_READWRITE, CTLTYPE_INT, + "rx_copy_len", SYSCTL_DESCR("RX Copy Length"), + ixgbe_sysctl_rx_copy_len, 0, + (void *)adapter, 0, CTL_CREATE, CTL_EOL) != 0) + aprint_error_dev(dev, "could not create sysctl\n"); + + if (sysctl_createv(log, 0, &rnode, &cnode, CTLFLAG_READONLY, CTLTYPE_INT, "num_rx_desc", SYSCTL_DESCR("Number of rx descriptors"), NULL, 0, &adapter->num_rx_desc, 0, CTL_CREATE, CTL_EOL) != 0) @@ -6174,6 +6185,31 @@ ixgbe_sysctl_debug(SYSCTLFN_ARGS) } /* ixgbe_sysctl_debug */ / + * ixgbe_sysctl_rx_copy_len + / +static int +ixgbe_sysctl_rx_copy_len(SYSCTLFN_ARGS) +{ + struct sysctlnode node = *rnode; + struct adapter *adapter = (struct adapter *)node.sysctl_data; + int error; + int result = adapter->rx_copy_len; + + node.sysctl_data = &result; + error = sysctl_lookup(SYSCTLFN_CALL(&node)); + + if (error || newp == NULL) + return error; + + if ((result < 0) || (result > IXGBE_RX_COPY_LEN_MAX)) + return EINVAL; + + adapter->rx_copy_len = result; + + return 0; +} /* ixgbe_sysctl_rx_copy_len */ + +/*
CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: msaitoh Date: Wed Jul 7 08:32:51 UTC 2021 Modified Files: src/sys/dev/pci/ixgbe: ix_txrx.c Log Message: Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring(). ixgbe_setup_receive_ring() fully allocates rx buffers. When a descriptor ring is full, rxr->next_to_refresh should point to rxr_next_to_check -1. Before this change, rxr->next_to_refresh is set to 0 and ixgbe_refresh_mbufs() wastefully loops in ixgbe_refresh_mbufs() because it means the ring is empty. To generate a diff of this commit: cvs rdiff -u -r1.79 -r1.80 src/sys/dev/pci/ixgbe/ix_txrx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/ixgbe/ix_txrx.c diff -u src/sys/dev/pci/ixgbe/ix_txrx.c:1.79 src/sys/dev/pci/ixgbe/ix_txrx.c:1.80 --- src/sys/dev/pci/ixgbe/ix_txrx.c:1.79 Thu May 27 06:11:34 2021 +++ src/sys/dev/pci/ixgbe/ix_txrx.c Wed Jul 7 08:32:51 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ix_txrx.c,v 1.79 2021/05/27 06:11:34 msaitoh Exp $ */ +/* $NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $ */ /** @@ -64,7 +64,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.79 2021/05/27 06:11:34 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ix_txrx.c,v 1.80 2021/07/07 08:32:51 msaitoh Exp $"); #include "opt_inet.h" #include "opt_inet6.h" @@ -1577,7 +1577,7 @@ ixgbe_setup_receive_ring(struct rx_ring /* Setup our descriptor indices */ rxr->next_to_check = 0; - rxr->next_to_refresh = 0; + rxr->next_to_refresh = adapter->num_rx_desc - 1; /* Fully allocated */ rxr->lro_enabled = FALSE; rxr->rx_copies.ev_count = 0; #if 0 /* NetBSD */
CVS commit: src/sys/dev/isa
Module Name:src Committed By: nonaka Date: Sat Jul 3 04:44:16 UTC 2021 Modified Files: src/sys/dev/isa: itesio_isa.c itesio_isavar.h Log Message: itesio(4): Added IT8625E support. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/isa/itesio_isa.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/isa/itesio_isavar.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/isa/itesio_isa.c diff -u src/sys/dev/isa/itesio_isa.c:1.28 src/sys/dev/isa/itesio_isa.c:1.29 --- src/sys/dev/isa/itesio_isa.c:1.28 Tue Jul 23 09:38:53 2019 +++ src/sys/dev/isa/itesio_isa.c Sat Jul 3 04:44:16 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: itesio_isa.c,v 1.28 2019/07/23 09:38:53 msaitoh Exp $ */ +/* $NetBSD: itesio_isa.c,v 1.29 2021/07/03 04:44:16 nonaka Exp $ */ /* Derived from $OpenBSD: it.c,v 1.19 2006/04/10 00:57:54 deraadt Exp $ */ /* @@ -34,13 +34,14 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.28 2019/07/23 09:38:53 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.29 2021/07/03 04:44:16 nonaka Exp $"); #include #include #include #include #include +#include #include #include @@ -52,6 +53,11 @@ __KERNEL_RCSID(0, "$NetBSD: itesio_isa.c #define IT_VOLTSTART_IDX 3 /* voltage start index */ #define IT_FANSTART_IDX 12 /* fan start index */ +/* IT8625: 3 temps, 10 volts, 6 fans */ +#define IT8625_NUM_SENSORS 19 +#define IT8625_VOLTSTART_IDX 3 /* voltage start index */ +#define IT8625_FANSTART_IDX 13 /* fan start index */ + #if defined(ITESIO_DEBUG) #define DPRINTF(x) do { printf x; } while (0) #else @@ -90,6 +96,13 @@ static void itesio_refresh_temp(struct i static void itesio_refresh_volts(struct itesio_softc *, envsys_data_t *); static void itesio_refresh_fans(struct itesio_softc *, envsys_data_t *); static void itesio_refresh(struct sysmon_envsys *, envsys_data_t *); +static void itesio_refresh_it8705_fans(struct itesio_softc *, + envsys_data_t *); +static void itesio_setup_it8625_sensors(struct itesio_softc *); +static void itesio_refresh_it8625_volts(struct itesio_softc *, + envsys_data_t *); +static void itesio_refresh_it8625_fans(struct itesio_softc *, + envsys_data_t *); /* sysmon_wdog glue */ static bool itesio_wdt_suspend(device_t, const pmf_qual_t *); @@ -109,11 +122,58 @@ static const int itesio_vrfact[] = { RFACT_NONE /* VBAT */ }; +static const struct itesio_config itesio_config[] = { + { + .chipid = ITESIO_ID8625, + .no_wdt = true, + .num_sensors = IT8625_NUM_SENSORS, + .voltstart_idx = IT8625_VOLTSTART_IDX, + .fanstart_idx = IT8625_FANSTART_IDX, + .setup_sensors = itesio_setup_it8625_sensors, + .refresh_volts = itesio_refresh_it8625_volts, + .refresh_fans = itesio_refresh_it8625_fans, + }, + { .chipid = ITESIO_ID8628, }, + { .chipid = ITESIO_ID8655, }, + { + .chipid = ITESIO_ID8705, + .no_wdt = true, + .refresh_fans = itesio_refresh_it8705_fans, + }, + { + .chipid = ITESIO_ID8712, + .refresh_fans = itesio_refresh_it8705_fans, + }, + { .chipid = ITESIO_ID8716, }, + { .chipid = ITESIO_ID8718, }, + { .chipid = ITESIO_ID8720, }, + { .chipid = ITESIO_ID8721, }, + { .chipid = ITESIO_ID8726, }, + { .chipid = ITESIO_ID8728, }, + { .chipid = ITESIO_ID8771, }, + { .chipid = ITESIO_ID8772, }, +}; + +static const struct itesio_config * +itesio_isa_find_config(uint16_t chipid) +{ + const struct itesio_config *ic; + size_t i; + + for (i = 0; i < __arraycount(itesio_config); i++) { + ic = &itesio_config[i]; + if (chipid == ic->chipid) + return ic; + } + return NULL; +} + static int itesio_isa_match(device_t parent, cfdata_t match, void *aux) { struct isa_attach_args *ia = aux; bus_space_handle_t ioh; + const struct itesio_config *ic; uint16_t cr; /* Must supply an address */ @@ -135,28 +195,16 @@ itesio_isa_match(device_t parent, cfdata itesio_exit(ia->ia_iot, ioh); bus_space_unmap(ia->ia_iot, ioh, 2); - switch (cr) { - case ITESIO_ID8628: - case ITESIO_ID8655: - case ITESIO_ID8705: - case ITESIO_ID8712: - case ITESIO_ID8716: - case ITESIO_ID8718: - case ITESIO_ID8720: - case ITESIO_ID8721: - case ITESIO_ID8726: - case ITESIO_ID8728: - case ITESIO_ID8771: - case ITESIO_ID8772: - ia->ia_nio = 1; - ia->ia_io[0].ir_size = 2; - ia->ia_niomem = 0; - ia->ia_nirq = 0; - ia->ia_ndrq = 0; - return 1; - default: + ic = itesio_isa_find_config(cr); + if (ic == NULL) return 0; - } + + ia->ia_nio = 1; + ia->ia_io[0].ir_size = 2; + ia->ia_niomem = 0; + ia->ia_nirq = 0; + ia->ia_ndrq = 0; + return 1; } static void @@ -164,7 +212,9 @@ itesio_isa_attach(device_t parent, devic { struct itesio_softc *sc = device_private(self); struct isa_attach_args *ia = aux; - int i; + const struct itesio_config *ic; + uint32_t i; + int error; uint8_t cr; sc->sc_iot = ia->ia_iot; @@ -205,6 +255,27 @@ itesio_isa_attach(device_t parent, devic */ itesio_exit(sc->sc_iot, sc->sc_pn
CVS commit: src/sys/dev/ic
Module Name:src Committed By: thorpej Date: Thu Jul 1 20:39:15 UTC 2021 Modified Files: src/sys/dev/ic: ax88190.c dl10019.c dp8390.c Log Message: Make sure the media / mii members in struct ethercom are initialized so that the media-related ioctls work. Problem reported by Björn Johannesson on current-users@. XXX pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/ic/ax88190.c cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/dl10019.c cvs rdiff -u -r1.98 -r1.99 src/sys/dev/ic/dp8390.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/ic/ax88190.c diff -u src/sys/dev/ic/ax88190.c:1.17 src/sys/dev/ic/ax88190.c:1.18 --- src/sys/dev/ic/ax88190.c:1.17 Wed Jun 30 20:00:18 2021 +++ src/sys/dev/ic/ax88190.c Thu Jul 1 20:39:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ax88190.c,v 1.17 2021/06/30 20:00:18 thorpej Exp $ */ +/* $NetBSD: ax88190.c,v 1.18 2021/07/01 20:39:15 thorpej Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ax88190.c,v 1.17 2021/06/30 20:00:18 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ax88190.c,v 1.18 2021/07/01 20:39:15 thorpej Exp $"); #include #include @@ -101,6 +101,8 @@ ax88190_media_init(struct dp8390_softc * callout_setfunc(&sc->sc_tick_ch, ax88190_tick, sc); + sc->sc_ec.ec_mii = mii; + mii->mii_ifp = ifp; mii->mii_readreg = ax88190_mii_readreg; mii->mii_writereg = ax88190_mii_writereg; Index: src/sys/dev/ic/dl10019.c diff -u src/sys/dev/ic/dl10019.c:1.16 src/sys/dev/ic/dl10019.c:1.17 --- src/sys/dev/ic/dl10019.c:1.16 Wed Jun 30 20:00:18 2021 +++ src/sys/dev/ic/dl10019.c Thu Jul 1 20:39:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dl10019.c,v 1.16 2021/06/30 20:00:18 thorpej Exp $ */ +/* $NetBSD: dl10019.c,v 1.17 2021/07/01 20:39:15 thorpej Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dl10019.c,v 1.16 2021/06/30 20:00:18 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dl10019.c,v 1.17 2021/07/01 20:39:15 thorpej Exp $"); #include #include @@ -134,6 +134,8 @@ dl10019_media_init(struct dp8390_softc * callout_setfunc(&sc->sc_tick_ch, dl10019_tick, sc); + sc->sc_ec.ec_mii = mii; + mii->mii_ifp = ifp; mii->mii_readreg = dl10019_mii_readreg; mii->mii_writereg = dl10019_mii_writereg; Index: src/sys/dev/ic/dp8390.c diff -u src/sys/dev/ic/dp8390.c:1.98 src/sys/dev/ic/dp8390.c:1.99 --- src/sys/dev/ic/dp8390.c:1.98 Wed Jun 30 20:00:18 2021 +++ src/sys/dev/ic/dp8390.c Thu Jul 1 20:39:15 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dp8390.c,v 1.98 2021/06/30 20:00:18 thorpej Exp $ */ +/* $NetBSD: dp8390.c,v 1.99 2021/07/01 20:39:15 thorpej Exp $ */ /* * Device driver for National Semiconductor DS8390/WD83C690 based ethernet @@ -14,7 +14,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.98 2021/06/30 20:00:18 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dp8390.c,v 1.99 2021/07/01 20:39:15 thorpej Exp $"); #include "opt_inet.h" @@ -68,7 +68,6 @@ void dp8390_media_init(struct dp8390_softc *sc) { - sc->sc_ec.ec_ifmedia = &sc->sc_media; ifmedia_init(&sc->sc_media, 0, dp8390_mediachange, dp8390_mediastatus); ifmedia_add(&sc->sc_media, IFM_ETHER | IFM_MANUAL, 0, NULL); ifmedia_set(&sc->sc_media, IFM_ETHER | IFM_MANUAL); @@ -135,7 +134,13 @@ dp8390_config(struct dp8390_softc *sc) aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n", ether_sprintf(sc->sc_enaddr)); - /* Initialize media goo. */ + /* + * Initialize media structures. We'll default to pointing ec_ifmedia + * at our embedded media structure. A card front-end can initialize + * ec_mii if it has an MII interface. (Note that sc_media is an + * alias of sc_mii.mii_media in dp8390_softc.) + */ + sc->sc_ec.ec_ifmedia = &sc->sc_media; (*sc->sc_media_init)(sc); /* We can support 802.1Q VLAN-sized frames. */
CVS commit: src/sys/dev/pci
Module Name:src Committed By: jmcneill Date: Thu Jul 1 17:22:10 UTC 2021 Modified Files: src/sys/dev/pci: if_ena.c Log Message: port-evbarm/56274: no network on ec2 arm64 9.99.85 Remove custom SIOCSIFFLAGS handling and rely on ether_ioctl to DTRT To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/pci/if_ena.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_ena.c diff -u src/sys/dev/pci/if_ena.c:1.27 src/sys/dev/pci/if_ena.c:1.28 --- src/sys/dev/pci/if_ena.c:1.27 Sat Jan 23 11:50:30 2021 +++ src/sys/dev/pci/if_ena.c Thu Jul 1 17:22:10 2021 @@ -36,7 +36,7 @@ #if 0 __FBSDID("$FreeBSD: head/sys/dev/ena/ena.c 333456 2018-05-10 09:37:54Z mw $"); #endif -__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.27 2021/01/23 11:50:30 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ena.c,v 1.28 2021/07/01 17:22:10 jmcneill Exp $"); #include #include @@ -2396,28 +2396,6 @@ ena_ioctl(struct ifnet *ifp, u_long comm rw_exit(&adapter->ioctl_sx); break; - case SIOCSIFFLAGS: - if ((ifp->if_flags & IFF_UP) != 0) { - if ((if_getdrvflags(ifp) & IFF_RUNNING) != 0) { -if ((ifp->if_flags & (IFF_PROMISC | -IFF_ALLMULTI)) != 0) { - device_printf(adapter->pdev, - "ioctl promisc/allmulti\n"); -} - } else { -rw_enter(&adapter->ioctl_sx, RW_WRITER); -rc = ena_up(adapter); -rw_exit(&adapter->ioctl_sx); - } - } else { - if ((if_getdrvflags(ifp) & IFF_RUNNING) != 0) { -rw_enter(&adapter->ioctl_sx, RW_WRITER); -ena_down(adapter); -rw_exit(&adapter->ioctl_sx); - } - } - break; - case SIOCADDMULTI: case SIOCDELMULTI: break;
CVS commit: src/sys/dev/pckbport
Module Name:src Committed By: blymn Date: Wed Jun 30 22:13:27 UTC 2021 Modified Files: src/sys/dev/pckbport: synapticsvar.h Log Message: Fix hardcoded size for total_patckets array in synaptics_softc, it needs to be SYN_MAX_FINGERS because the driver expects it to be. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pckbport/synapticsvar.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/pckbport/synapticsvar.h diff -u src/sys/dev/pckbport/synapticsvar.h:1.10 src/sys/dev/pckbport/synapticsvar.h:1.11 --- src/sys/dev/pckbport/synapticsvar.h:1.10 Mon Apr 27 22:31:47 2020 +++ src/sys/dev/pckbport/synapticsvar.h Wed Jun 30 22:13:27 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: synapticsvar.h,v 1.10 2020/04/27 22:31:47 jmcneill Exp $ */ +/* $NetBSD: synapticsvar.h,v 1.11 2021/06/30 22:13:27 blymn Exp $ */ /* * Copyright (c) 2005, Steve C. Woodford @@ -38,6 +38,8 @@ #ifndef _DEV_PCKBCPORT_SYNAPTICSVAR_H_ #define _DEV_PCKBCPORT_SYNAPTICSVAR_H_ +#define SYN_MAX_FINGERS 2 + struct synaptics_softc { int caps; @@ -56,7 +58,9 @@ struct synaptics_softc { #define SYN_FLAG_HAS_EXTENDED_WMODE (1 << 11) #define SYN_FLAG_HAS_ADV_GESTURE_MODE (1 << 12) - u_int total_packets[2]; /* Total number of packets received */ + /* Total number of packets received */ + u_int total_packets[SYN_MAX_FINGERS]; + #define SYN_TIME(sc,c,n) (((sc)->total_packets[(n)] >= (c)) ? \ ((sc)->total_packets[(n)] - (c)) : \ ((c) - (sc)->total_packets[(n)])) @@ -79,7 +83,6 @@ struct synaptics_softc { #define SYN_IS_DRAG(t) ((t) & SYN_GESTURE_DRAG) #define SYN_HIST_SIZE 4 -#define SYN_MAX_FINGERS 2 char button_history; int dz_hold; int rem_x[SYN_MAX_FINGERS];
CVS commit: src/sys/dev/ic
Module Name:src Committed By: thorpej Date: Wed Jun 30 20:00:18 UTC 2021 Modified Files: src/sys/dev/ic: ax88190.c dl10019.c dp8390.c dp8390var.h Log Message: Fix a couple of problems with MII-equipped NE2000 derivatives reported by Björn Johannesson on current-users@: - Re-factor dp8390_stop() into dp8390_halt() (that does the stuff to halt the hardware) and dp8390_stop() (which alls dp8390_halt() before calling mii_down() via sc->sc_stop_card()). This prevents us from calling mii_down() before all of the interface data structures have been set up, which these days can trip a KASSERT(). - Add a 1-second timer to call mii_tick(), and enable it in the sc->sc_init_card() callback, and cancel it in the sc->sc_stop_card() and sc->sc_media_fini() callbacks. This is actually a long-standing bug that previously didn't have much practical effect, but causes problems with dhcpcd's link live-ness detection logic. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/ax88190.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/ic/dl10019.c cvs rdiff -u -r1.97 -r1.98 src/sys/dev/ic/dp8390.c cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ic/dp8390var.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/ax88190.c diff -u src/sys/dev/ic/ax88190.c:1.16 src/sys/dev/ic/ax88190.c:1.17 --- src/sys/dev/ic/ax88190.c:1.16 Tue Feb 4 05:25:39 2020 +++ src/sys/dev/ic/ax88190.c Wed Jun 30 20:00:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ax88190.c,v 1.16 2020/02/04 05:25:39 thorpej Exp $ */ +/* $NetBSD: ax88190.c,v 1.17 2021/06/30 20:00:18 thorpej Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ax88190.c,v 1.16 2020/02/04 05:25:39 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ax88190.c,v 1.17 2021/06/30 20:00:18 thorpej Exp $"); #include #include @@ -80,12 +80,27 @@ static const struct mii_bitbang_ops ax88 } }; +static void +ax88190_tick(void *arg) +{ + struct dp8390_softc *sc = arg; + int s; + + s = splnet(); + mii_tick(&sc->sc_mii); + splx(s); + + callout_schedule(&sc->sc_tick_ch, hz); +} + void ax88190_media_init(struct dp8390_softc *sc) { struct ifnet *ifp = &sc->sc_ec.ec_if; struct mii_data *mii = &sc->sc_mii; + callout_setfunc(&sc->sc_tick_ch, ax88190_tick, sc); + mii->mii_ifp = ifp; mii->mii_readreg = ax88190_mii_readreg; mii->mii_writereg = ax88190_mii_writereg; @@ -107,8 +122,9 @@ void ax88190_media_fini(struct dp8390_softc *sc) { + callout_stop(&sc->sc_tick_ch); mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); - ifmedia_fini(&sc->sc_mii.mii_media); + /* dp8390_detach() will call ifmedia_fini(). */ } int @@ -135,12 +151,14 @@ ax88190_init_card(struct dp8390_softc *s { mii_mediachg(&sc->sc_mii); + callout_schedule(&sc->sc_tick_ch, hz); } void ax88190_stop_card(struct dp8390_softc *sc) { + callout_stop(&sc->sc_tick_ch); mii_down(&sc->sc_mii); } Index: src/sys/dev/ic/dl10019.c diff -u src/sys/dev/ic/dl10019.c:1.15 src/sys/dev/ic/dl10019.c:1.16 --- src/sys/dev/ic/dl10019.c:1.15 Tue Feb 4 05:25:39 2020 +++ src/sys/dev/ic/dl10019.c Wed Jun 30 20:00:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dl10019.c,v 1.15 2020/02/04 05:25:39 thorpej Exp $ */ +/* $NetBSD: dl10019.c,v 1.16 2021/06/30 20:00:18 thorpej Exp $ */ /*- * Copyright (c) 2001 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dl10019.c,v 1.15 2020/02/04 05:25:39 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dl10019.c,v 1.16 2021/06/30 20:00:18 thorpej Exp $"); #include #include @@ -113,12 +113,27 @@ dl10019_mii_reset(struct dp8390_softc *s bus_space_write_1(sc->sc_regt, sc->sc_regh, NEDL_DL0_GPIO, 0x00); } +static void +dl10019_tick(void *arg) +{ + struct dp8390_softc *sc = arg; + int s; + + s = splnet(); + mii_tick(&sc->sc_mii); + splx(s); + + callout_schedule(&sc->sc_tick_ch, hz); +} + void dl10019_media_init(struct dp8390_softc *sc) { struct ifnet *ifp = &sc->sc_ec.ec_if; struct mii_data *mii = &sc->sc_mii; + callout_setfunc(&sc->sc_tick_ch, dl10019_tick, sc); + mii->mii_ifp = ifp; mii->mii_readreg = dl10019_mii_readreg; mii->mii_writereg = dl10019_mii_writereg; @@ -142,8 +157,9 @@ void dl10019_media_fini(struct dp8390_softc *sc) { + callout_stop(&sc->sc_tick_ch); mii_detach(&sc->sc_mii, MII_PHY_ANY, MII_OFFSET_ANY); - ifmedia_fini(&sc->sc_mii.mii_media); + /* dp8390_detach() will call ifmedia_fini(). */ } int @@ -171,12 +187,14 @@ dl10019_init_card(struct dp8390_softc *s dl10019_mii_reset(sc); mii_mediachg(&sc->sc_mii); + callout_schedule(&sc->sc_tick_ch, hz); } void dl10019_stop_card(struct dp8390_softc *sc) { + callout_stop(&sc->sc_tick_ch); mii_down(&sc->sc_mii); } Index: src/sys/dev/ic/dp8390.c diff -u src/sys/dev/ic/dp8390.c:1.97 src/sys/dev/ic/dp8390.c:1.98 --- src/sys/dev/ic/dp839
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Wed Jun 30 17:34:03 UTC 2021 Modified Files: src/sys/dev: devlist2h.awk Log Message: devlist2h.awk: Nix trailing whitespace. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/dev/devlist2h.awk 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/devlist2h.awk diff -u src/sys/dev/devlist2h.awk:1.4 src/sys/dev/devlist2h.awk:1.5 --- src/sys/dev/devlist2h.awk:1.4 Tue Jun 29 21:03:36 2021 +++ src/sys/dev/devlist2h.awk Wed Jun 30 17:34:03 2021 @@ -1,5 +1,5 @@ #! /usr/bin/awk -f -# $NetBSD: devlist2h.awk,v 1.4 2021/06/29 21:03:36 pgoyette Exp $ +# $NetBSD: devlist2h.awk,v 1.5 2021/06/30 17:34:03 riastradh Exp $ # # Copyright (c) 1995, 1996 Christopher G. Demetriou # All rights reserved. @@ -31,7 +31,7 @@ # function collectline(f) { - oparen = 0 + oparen = 0 line = "" while (f <= NF) { if ($f == "#") { @@ -40,7 +40,7 @@ function collectline(f) { f++ continue } - if (oparen) { + if (oparen) { line = line $f if (f < NF) line = line " "
CVS commit: src/sys/dev
Module Name:src Committed By: pgoyette Date: Tue Jun 29 21:04:04 UTC 2021 Modified Files: src/sys/dev/hdaudio: hdaudiodevs.h hdaudiodevs_data.h src/sys/dev/mii: miidevs.h miidevs_data.h src/sys/dev/pci: pcidevs.h pcidevs_data.h src/sys/dev/usb: usbdevs.h usbdevs_data.h Log Message: Regen for new sys/dev/devlist2h.awk To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/hdaudio/hdaudiodevs.h \ src/sys/dev/hdaudio/hdaudiodevs_data.h cvs rdiff -u -r1.165 -r1.166 src/sys/dev/mii/miidevs.h cvs rdiff -u -r1.154 -r1.155 src/sys/dev/mii/miidevs_data.h cvs rdiff -u -r1.1412 -r1.1413 src/sys/dev/pci/pcidevs.h cvs rdiff -u -r1.1411 -r1.1412 src/sys/dev/pci/pcidevs_data.h cvs rdiff -u -r1.783 -r1.784 src/sys/dev/usb/usbdevs.h \ src/sys/dev/usb/usbdevs_data.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/hdaudio/hdaudiodevs.h diff -u src/sys/dev/hdaudio/hdaudiodevs.h:1.5 src/sys/dev/hdaudio/hdaudiodevs.h:1.6 --- src/sys/dev/hdaudio/hdaudiodevs.h:1.5 Wed Apr 29 07:36:22 2020 +++ src/sys/dev/hdaudio/hdaudiodevs.h Tue Jun 29 21:04:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudiodevs.h,v 1.5 2020/04/29 07:36:22 nia Exp $ */ +/* $NetBSD: hdaudiodevs.h,v 1.6 2021/06/29 21:04:02 pgoyette Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -259,3 +259,7 @@ /* VMware */ #define HDAUDIO_PRODUCT_VMWARE_VIRTUAL_HDA 0x1975 /* Virtual HDA */ + +/* Define format strings for non-existent values */ +#define hdaudio_id1_format "vendor %4.4x" +#define hdaudio_id2_format "product %4.4x" Index: src/sys/dev/hdaudio/hdaudiodevs_data.h diff -u src/sys/dev/hdaudio/hdaudiodevs_data.h:1.5 src/sys/dev/hdaudio/hdaudiodevs_data.h:1.6 --- src/sys/dev/hdaudio/hdaudiodevs_data.h:1.5 Wed Apr 29 07:36:22 2020 +++ src/sys/dev/hdaudio/hdaudiodevs_data.h Tue Jun 29 21:04:02 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: hdaudiodevs_data.h,v 1.5 2020/04/29 07:36:22 nia Exp $ */ +/* $NetBSD: hdaudiodevs_data.h,v 1.6 2021/06/29 21:04:02 pgoyette Exp $ */ /* * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. @@ -35,7 +35,7 @@ * SUCH DAMAGE. */ -static const uint16_t hdaudio_vendors[] = { +static const uint32_t hdaudio_vendors[] = { HDAUDIO_VENDOR_ATI, 1, 0, HDAUDIO_VENDOR_NVIDIA, 5, 0, HDAUDIO_VENDOR_REALTEK, 12, 0, @@ -49,7 +49,7 @@ static const uint16_t hdaudio_vendors[] HDAUDIO_VENDOR_SIGMATEL, 24, 0, }; -static const uint16_t hdaudio_products[] = { +static const uint32_t hdaudio_products[] = { HDAUDIO_VENDOR_ATI, HDAUDIO_PRODUCT_ATI_RS600_HDMI_1, 78, 84, 0, HDAUDIO_VENDOR_ATI, HDAUDIO_PRODUCT_ATI_RS600_HDMI_2, Index: src/sys/dev/mii/miidevs.h diff -u src/sys/dev/mii/miidevs.h:1.165 src/sys/dev/mii/miidevs.h:1.166 --- src/sys/dev/mii/miidevs.h:1.165 Tue Jun 23 14:35:59 2020 +++ src/sys/dev/mii/miidevs.h Tue Jun 29 21:04:02 2021 @@ -1,7 +1,7 @@ -/* $NetBSD: miidevs.h,v 1.165 2020/06/23 14:35:59 msaitoh Exp $ */ +/* $NetBSD: miidevs.h,v 1.166 2021/06/29 21:04:02 pgoyette Exp $ */ /* - * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. + * THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. * * generated from: * NetBSD: miidevs,v 1.168 2020/06/23 14:35:36 msaitoh Exp @@ -56,76 +56,76 @@ * Use "make -f Makefile.miidevs" to regenerate miidevs.h and miidevs_data.h */ -#define MII_OUI_AMD 0x1a /* Advanced Micro Devices */ -#define MII_OUI_TRIDIUM 0x0001f0 /* Tridium */ -#define MII_OUI_DATATRACK 0x0002c6 /* Data Track Technology */ -#define MII_OUI_AGERE 0x00053d /* Agere */ -#define MII_OUI_QUAKE 0x000897 /* Quake Technologies */ -#define MII_OUI_BANKSPEED 0x0006b8 /* Bankspeed Pty */ -#define MII_OUI_NETEXCELL 0x0008bb /* NetExcell */ -#define MII_OUI_NETAS 0x0009c3 /* Netas */ -#define MII_OUI_BROADCOM2 0x000af7 /* Broadcom Corporation */ -#define MII_OUI_AELUROS 0x000b25 /* Aeluros */ -#define MII_OUI_RALINK 0x000c43 /* Ralink Technology */ -#define MII_OUI_ASIX 0x000ec6 /* ASIX */ -#define MII_OUI_BROADCOM 0x001018 /* Broadcom Corporation */ -#define MII_OUI_MICREL 0x0010a1 /* Micrel */ -#define MII_OUI_ALTIMA 0x0010a9 /* Altima Communications */ -#define MII_OUI_ENABLESEMI 0x0010dd /* Enable Semiconductor */ -#define MII_OUI_SUNPLUS 0x001105 /* Sunplus Technology */ -#define MII_OUI_TERANETICS 0x0014a6 /* Teranetics */ -#define MII_OUI_RALINK2 0x0017a5 /* Ralink Technology */ -#define MII_OUI_AQUANTIA 0x0017b6 /* Aquantia Corporation */ -#define MII_OUI_BROADCOM3 0x001be9 /* Broadcom Corporation */ -#define MII_OUI_LEVEL1 0x00207b /* Level 1 */ -#define MII_OUI_MARVELL 0x005043 /* Marvell Semiconductor */ -#define MII_OUI_QUALSEMI 0x006051 /* Quality Semiconductor */ -#define MII_OUI_AMLOGIC 0x006051 /* Amlogic */ -#define MII_OUI_DAVICOM 0x00606e /* Davicom Semiconductor */ -#define MII_OUI_SMSC 0x00800f /* SMSC */ -#define MII_OUI_SEEQ 0x00a07d /* Seeq */ -#define MII_OUI_ICS 0x00a0be /*
CVS commit: src/sys/dev/usb
Module Name:src Committed By: pgoyette Date: Sun Jun 27 22:41:55 UTC 2021 Modified Files: src/sys/dev/usb: ukbd.c Log Message: Since there's a bit of code that is conditionally compiled based on USBVERBOSE, we need to include the opt_usbverbose.h header to get any possible definition of this macro. XXX Note that this code will NOT get included in the loadable module XXX for USBVERBOSE. To generate a diff of this commit: cvs rdiff -u -r1.150 -r1.151 src/sys/dev/usb/ukbd.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/usb/ukbd.c diff -u src/sys/dev/usb/ukbd.c:1.150 src/sys/dev/usb/ukbd.c:1.151 --- src/sys/dev/usb/ukbd.c:1.150 Sat Apr 24 23:36:59 2021 +++ src/sys/dev/usb/ukbd.c Sun Jun 27 22:41:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ukbd.c,v 1.150 2021/04/24 23:36:59 thorpej Exp $*/ +/* $NetBSD: ukbd.c,v 1.151 2021/06/27 22:41:55 pgoyette Exp $*/ /* * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -35,13 +35,14 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.150 2021/04/24 23:36:59 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ukbd.c,v 1.151 2021/06/27 22:41:55 pgoyette Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" #include "opt_ukbd.h" #include "opt_ukbd_layout.h" #include "opt_usb.h" +#include "opt_usbverbose.h" #include "opt_wsdisplay_compat.h" #endif /* _KERNEL_OPT */
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: jmcneill Date: Sat Jun 26 10:43:52 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: Fix 32-bit build. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fdt_memory.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/fdt_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.2 src/sys/dev/fdt/fdt_memory.c:1.3 --- src/sys/dev/fdt/fdt_memory.c:1.2 Fri Jun 25 08:41:09 2021 +++ src/sys/dev/fdt/fdt_memory.c Sat Jun 26 10:43:52 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.2 2021/06/25 08:41:09 ryo Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.3 2021/06/26 10:43:52 jmcneill Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.2 2021/06/25 08:41:09 ryo Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.3 2021/06/26 10:43:52 jmcneill Exp $"); #include #include @@ -110,11 +110,12 @@ void fdt_memory_remove_reserved(uint64_t min_addr, uint64_t max_addr) { uint64_t lstart = 0, lend = 0; - uint64_t addr, size; int index, error, phandle, child; const int num = fdt_num_mem_rsv(fdtbus_get_data()); for (index = 0; index <= num; index++) { + uint64_t addr, size; + error = fdt_get_mem_rsv(fdtbus_get_data(), index, &addr, &size); if (error != 0) @@ -147,6 +148,9 @@ fdt_memory_remove_reserved(uint64_t min_ phandle = OF_finddevice("/reserved-memory"); if (phandle != -1) { for (child = OF_child(phandle); child; child = OF_peer(child)) { + bus_addr_t addr; + bus_size_t size; + if (!of_hasprop(child, "no-map")) continue;
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: ryo Date: Fri Jun 25 08:41:09 UTC 2021 Modified Files: src/sys/dev/fdt: fdt_memory.c Log Message: fdt "/reserved-memory" node should be handled To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_memory.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/fdt_memory.c diff -u src/sys/dev/fdt/fdt_memory.c:1.1 src/sys/dev/fdt/fdt_memory.c:1.2 --- src/sys/dev/fdt/fdt_memory.c:1.1 Sat Dec 12 09:27:31 2020 +++ src/sys/dev/fdt/fdt_memory.c Fri Jun 25 08:41:09 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: fdt_memory.c,v 1.1 2020/12/12 09:27:31 skrll Exp $ */ +/* $NetBSD: fdt_memory.c,v 1.2 2021/06/25 08:41:09 ryo Exp $ */ /*- * Copyright (c) 2018 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ #include "opt_fdt.h" #include -__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.1 2020/12/12 09:27:31 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_memory.c,v 1.2 2021/06/25 08:41:09 ryo Exp $"); #include #include @@ -111,7 +111,7 @@ fdt_memory_remove_reserved(uint64_t min_ { uint64_t lstart = 0, lend = 0; uint64_t addr, size; - int index, error; + int index, error, phandle, child; const int num = fdt_num_mem_rsv(fdtbus_get_data()); for (index = 0; index <= num; index++) { @@ -139,6 +139,24 @@ fdt_memory_remove_reserved(uint64_t min_ lstart = addr; lend = addr + size; } + + /* + * "no-map" ranges defined in the /reserved-memory node + * must also be excluded. + */ + phandle = OF_finddevice("/reserved-memory"); + if (phandle != -1) { + for (child = OF_child(phandle); child; child = OF_peer(child)) { + if (!of_hasprop(child, "no-map")) +continue; + + if (fdtbus_get_reg(child, 0, &addr, &size) != 0) +continue; + if (size == 0) +continue; + fdt_memory_remove_range(addr, size); + } + } } void
CVS commit: src/sys/dev/pci
Module Name:src Committed By: thorpej Date: Thu Jun 24 23:48:08 UTC 2021 Modified Files: src/sys/dev/pci: pcireg.h Log Message: >From the "Should have been done years ago" department, add some macros describing the format of PCI Type 0 and Type 1 Configuration Cycle addresses. To generate a diff of this commit: cvs rdiff -u -r1.154 -r1.155 src/sys/dev/pci/pcireg.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/pci/pcireg.h diff -u src/sys/dev/pci/pcireg.h:1.154 src/sys/dev/pci/pcireg.h:1.155 --- src/sys/dev/pci/pcireg.h:1.154 Sat May 15 13:00:45 2021 +++ src/sys/dev/pci/pcireg.h Thu Jun 24 23:48:08 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pcireg.h,v 1.154 2021/05/15 13:00:45 jakllsch Exp $ */ +/* $NetBSD: pcireg.h,v 1.155 2021/06/24 23:48:08 thorpej Exp $ */ /* * Copyright (c) 1995, 1996, 1999, 2000 @@ -68,6 +68,21 @@ typedef u_int16_t pci_product_id_t; (((pid) & PCI_PRODUCT_MASK) << PCI_PRODUCT_SHIFT)) \ /* + * Standard format of a PCI Type 0 Configuration Cycle address. + */ +#define PCI_CONF_TYPE0_IDSEL(d) __BIT((d) + 11) +#define PCI_CONF_TYPE0_FUNCTION __BITS(8,10) +#define PCI_CONF_TYPE0_OFFSET __BITS(0,7) + +/* + * Standard format of a PCI Type 1 Configuration Cycle address. + */ +#define PCI_CONF_TYPE1_BUS __BITS(16,23) +#define PCI_CONF_TYPE1_DEVICE __BITS(11,15) +#define PCI_CONF_TYPE1_FUNCTION __BITS(8,10) +#define PCI_CONF_TYPE1_OFFSET __BITS(0,7) + +/* * Command and status register. */ #define PCI_COMMAND_STATUS_REG 0x04
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mrg Date: Thu Jun 24 23:01:37 UTC 2021 Modified Files: src/sys/dev/usb: usbnet.h Log Message: clarify some comments about what the "send callback" is. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/usb/usbnet.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/usb/usbnet.h diff -u src/sys/dev/usb/usbnet.h:1.20 src/sys/dev/usb/usbnet.h:1.21 --- src/sys/dev/usb/usbnet.h:1.20 Mon Mar 1 22:59:52 2021 +++ src/sys/dev/usb/usbnet.h Thu Jun 24 23:01:36 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: usbnet.h,v 1.20 2021/03/01 22:59:52 mrg Exp $ */ +/* $NetBSD: usbnet.h,v 1.21 2021/06/24 23:01:36 mrg Exp $ */ /* * Copyright (c) 2019 Matthew R. Green @@ -59,7 +59,7 @@ * - ioctl can use either a device-specific override (useful for special * cases), but provides a normal handler with callback to handle * ENETRESET conditions that should be sufficient for most users - * - start uses usbnet send callback + * - start uses usbnet transmit prepare callback (uno_tx_prepare) * - interface init and stop have helper functions * - device specific init should use usbnet_init_rx_tx() to open pipes * to the device and setup the rx/tx chains for use after any device @@ -73,9 +73,9 @@ * packets, which can use usbnet_enqueue() to provide data to the * higher layers * - for tx, usbnet_start (if_start) will pull entries out of the - * transmit queue and use the send callback for the given mbuf. - * the usb callback will use usbnet_txeof() for the transmit - * completion function (internal to usbnet) + * transmit queue and use the transmit prepare callback (uno_tx_prepare) + * for the given mbuf. the usb callback will use usbnet_txeof() for + * the transmit completion function (internal to usbnet) * - there is special interrupt pipe handling * - timer/tick: * - the uno_tick callback will be called once a second if present.
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mrg Date: Thu Jun 24 23:01:03 UTC 2021 Modified Files: src/sys/dev/usb: ohci.c Log Message: turn off ohcidebug by default. none of the other HCs do this. next up: options to set these by default To generate a diff of this commit: cvs rdiff -u -r1.316 -r1.317 src/sys/dev/usb/ohci.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/usb/ohci.c diff -u src/sys/dev/usb/ohci.c:1.316 src/sys/dev/usb/ohci.c:1.317 --- src/sys/dev/usb/ohci.c:1.316 Tue Jun 15 23:39:43 2021 +++ src/sys/dev/usb/ohci.c Thu Jun 24 23:01:03 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.316 2021/06/15 23:39:43 riastradh Exp $ */ +/* $NetBSD: ohci.c,v 1.317 2021/06/24 23:01:03 mrg Exp $ */ /* * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.316 2021/06/15 23:39:43 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.317 2021/06/24 23:01:03 mrg Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -77,7 +77,7 @@ __KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.3 #ifndef OHCI_DEBUG #define ohcidebug 0 #else -static int ohcidebug = 10; +static int ohcidebug = 0; SYSCTL_SETUP(sysctl_hw_ohci_setup, "sysctl hw.ohci setup") {
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mrg Date: Thu Jun 24 23:00:14 UTC 2021 Modified Files: src/sys/dev/usb: TODO.usbmp Log Message: update a couple of lists of drivers that have had a few changes To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/usb/TODO.usbmp 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/usb/TODO.usbmp diff -u src/sys/dev/usb/TODO.usbmp:1.19 src/sys/dev/usb/TODO.usbmp:1.20 --- src/sys/dev/usb/TODO.usbmp:1.19 Sat May 16 13:46:12 2020 +++ src/sys/dev/usb/TODO.usbmp Thu Jun 24 23:00:14 2021 @@ -1,4 +1,4 @@ -$NetBSD: TODO.usbmp,v 1.19 2020/05/16 13:46:12 maya Exp $ +$NetBSD: TODO.usbmp,v 1.20 2021/06/24 23:00:14 mrg Exp $ the majority of the USB MP device interface is documented in usbdivar.h. @@ -20,20 +20,17 @@ KERNEL_LOCK usb_detach_{waitold,wakeup} to usb_detach_{wait,broadcast} conversion: - drivers: - if_aue.c - stuirda.c - ubt.c - ucom.c - ucycom.c - udsir.c - uhso.c - uirda.c - ulpt.c - umass.c - done, partially done -- need to check umass_scsipi.c change - uscanner.c - usscanner.c - ustir.c - utoppy.c + - stuirda.c + - ubt.c + - ucycom.c + - udsir.c + - uhso.c + - uirda.c + - ulpt.c + - uscanner.c + - usscanner.c + - ustir.c + - utoppy.c use usb_delay_ms_locked() in places @@ -81,20 +78,18 @@ splusb drivers to convert: - uvideo.c wakeup/tsleep drivers: - - if_otus.c + - if_rum.c - if_run.c - if_upgt.c - - if_urtwn.c - - if_zyd.c - - ucom.c + - if_ural.c - ucycom.c - udsir.c - uirda.c - - ulpt.c - - umass_isdata.c + - umcs.h + - usb.c + - usb_subr.c + - usbdi.c - ustir.c - - uthum.c - - uvscom.c missing D_MPSAFE drivers: - ucom
CVS commit: src/sys/dev/pci
Module Name:src Committed By: riastradh Date: Thu Jun 24 09:17:53 UTC 2021 Modified Files: src/sys/dev/pci: if_iwm.c Log Message: iwm(4): Disentangle attach. Don't attach a half-baked interface and then detach it and then reattach it after mountroot when we can read firmware; just defer attaching the interface altogether until mountroot. Likely fixes some panics I've seen every now and then at boot with iwm(4). To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/dev/pci/if_iwm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/if_iwm.c diff -u src/sys/dev/pci/if_iwm.c:1.86 src/sys/dev/pci/if_iwm.c:1.87 --- src/sys/dev/pci/if_iwm.c:1.86 Wed Jun 16 00:21:18 2021 +++ src/sys/dev/pci/if_iwm.c Thu Jun 24 09:17:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwm.c,v 1.86 2021/06/16 00:21:18 riastradh Exp $ */ +/* $NetBSD: if_iwm.c,v 1.87 2021/06/24 09:17:53 riastradh Exp $ */ /* OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp */ #define IEEE80211_NO_HT /* @@ -106,7 +106,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.86 2021/06/16 00:21:18 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.87 2021/06/24 09:17:53 riastradh Exp $"); #include #include @@ -482,6 +482,7 @@ static void iwm_softintr(void *); static int iwm_preinit(struct iwm_softc *); static void iwm_attach_hook(device_t); static void iwm_attach(device_t, device_t, void *); +static int iwm_config_complete(struct iwm_softc *); #if 0 static void iwm_init_task(void *); static int iwm_activate(device_t, enum devact); @@ -6598,10 +6599,6 @@ iwm_init_hw(struct iwm_softc *sc) struct ieee80211com *ic = &sc->sc_ic; int err, i, ac; - err = iwm_preinit(sc); - if (err) - return err; - err = iwm_start_hw(sc); if (err) { aprint_error_dev(sc->sc_dev, "could not initialize hardware\n"); @@ -6951,10 +6948,6 @@ iwm_ioctl(struct ifnet *ifp, u_long cmd, case SIOCADDMULTI: case SIOCDELMULTI: - if (!ISSET(sc->sc_flags, IWM_FLAG_ATTACHED)) { - err = ENXIO; - break; - } sa = ifreq_getaddr(SIOCADDMULTI, (struct ifreq *)data); err = (cmd == SIOCADDMULTI) ? ether_addmulti(sa, &sc->sc_ec) : @@ -6964,10 +6957,6 @@ iwm_ioctl(struct ifnet *ifp, u_long cmd, break; default: - if (!ISSET(sc->sc_flags, IWM_FLAG_ATTACHED)) { - err = ether_ioctl(ifp, cmd, data); - break; - } err = ieee80211_ioctl(ic, cmd, data); break; } @@ -7728,13 +7717,8 @@ iwm_match(device_t parent, cfdata_t matc static int iwm_preinit(struct iwm_softc *sc) { - struct ieee80211com *ic = &sc->sc_ic; - struct ifnet *ifp = IC2IFP(&sc->sc_ic); int err; - if (ISSET(sc->sc_flags, IWM_FLAG_ATTACHED)) - return 0; - err = iwm_start_hw(sc); if (err) { aprint_error_dev(sc->sc_dev, "could not initialize hardware\n"); @@ -7746,44 +7730,10 @@ iwm_preinit(struct iwm_softc *sc) if (err) return err; - sc->sc_flags |= IWM_FLAG_ATTACHED; - aprint_normal_dev(sc->sc_dev, "hw rev 0x%x, fw ver %s, address %s\n", sc->sc_hw_rev & IWM_CSR_HW_REV_TYPE_MSK, sc->sc_fwver, ether_sprintf(sc->sc_nvm.hw_addr)); -#ifndef IEEE80211_NO_HT - if (sc->sc_nvm.sku_cap_11n_enable) - iwm_setup_ht_rates(sc); -#endif - - /* not all hardware can do 5GHz band */ - if (sc->sc_nvm.sku_cap_band_52GHz_enable) - ic->ic_sup_rates[IEEE80211_MODE_11A] = ieee80211_std_rateset_11a; - - ether_ifdetach(ifp); - /* - * XXX - * ether_ifdetach() overwrites ifp->if_ioctl, so restore it here. - */ - ifp->if_ioctl = iwm_ioctl; - ieee80211_ifattach(ic); - - ic->ic_node_alloc = iwm_node_alloc; - - /* Override 802.11 state transition machine. */ - sc->sc_newstate = ic->ic_newstate; - ic->ic_newstate = iwm_newstate; - - /* XXX media locking needs revisiting */ - mutex_init(&sc->sc_media_mtx, MUTEX_DEFAULT, IPL_SOFTNET); - ieee80211_media_init_with_lock(ic, - iwm_media_change, ieee80211_media_status, &sc->sc_media_mtx); - - ieee80211_announce(ic); - - iwm_radiotap_attach(sc); - return 0; } @@ -7792,7 +7742,7 @@ iwm_attach_hook(device_t dev) { struct iwm_softc *sc = device_private(dev); - iwm_preinit(sc); + iwm_config_complete(sc); } static void @@ -7800,8 +7750,6 @@ iwm_attach(device_t parent, device_t sel { struct iwm_softc *sc = device_private(self); struct pci_attach_args *pa = aux; - struct ieee80211com *ic = &sc->sc_ic; - struct ifnet *ifp = &sc->sc_ec.ec_if; pcireg_t reg, memtype; char intrbuf[PCI_INTRSTR_LEN]; const char *intrstr; @@ -8081,6 +8029,60 @@ iwm_attach(device_t parent, device_t sel } } + callout_init(&sc->sc_calib_to, 0); + callout_setfunc(&sc->sc_calib_to, iwm_calib_timeout, sc); + callout_init(&sc->sc_led_blink_to, 0); + callout_setfunc(&sc->sc_led_blink_to, iwm_led_blink_timeout, sc); +#ifndef IEEE80211_NO_HT + if (workqueue_create(&sc->sc_setratewq, "iwmsr", + iwm_setrates_task, sc, PRI_NONE, IPL_NET, 0)) + panic("%s: could not create
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Thu Jun 24 08:20:42 UTC 2021 Modified Files: src/sys/dev/usb: ucom.c Log Message: ucom(4): Fix earlier mistake causing pipes not to be closed. In revision 1.123, mrg@ changed what he thought was a double-close, but was actually abort&close (as is appropriate) to just abort (which is not enough -- leaks the pipe). This restores the abort&close. The original `bug' was found by code inspection, whereas this bug was found by asserting in usb_subr.c that no pipes are open on device disconnection after detach; the asserts actually triggered with several ucom(4) devices, and no longer trigger with this change. XXX pullup-9 To generate a diff of this commit: cvs rdiff -u -r1.128 -r1.129 src/sys/dev/usb/ucom.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/usb/ucom.c diff -u src/sys/dev/usb/ucom.c:1.128 src/sys/dev/usb/ucom.c:1.129 --- src/sys/dev/usb/ucom.c:1.128 Mon Oct 26 12:24:10 2020 +++ src/sys/dev/usb/ucom.c Thu Jun 24 08:20:42 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ucom.c,v 1.128 2020/10/26 12:24:10 mrg Exp $ */ +/* $NetBSD: ucom.c,v 1.129 2021/06/24 08:20:42 riastradh Exp $ */ /* * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.128 2020/10/26 12:24:10 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.129 2021/06/24 08:20:42 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -414,11 +414,9 @@ ucom_detach(device_t self, int flags) if (sc->sc_bulkin_pipe != NULL) { usbd_abort_pipe(sc->sc_bulkin_pipe); - sc->sc_bulkin_pipe = NULL; } if (sc->sc_bulkout_pipe != NULL) { usbd_abort_pipe(sc->sc_bulkout_pipe); - sc->sc_bulkout_pipe = NULL; } mutex_enter(&sc->sc_lock);
CVS commit: src/sys/dev/pci
Module Name:src Committed By: christos Date: Mon Jun 21 03:21:17 UTC 2021 Modified Files: src/sys/dev/pci: radeonfb.c Log Message: fix proplib deprecation To generate a diff of this commit: cvs rdiff -u -r1.114 -r1.115 src/sys/dev/pci/radeonfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/radeonfb.c diff -u src/sys/dev/pci/radeonfb.c:1.114 src/sys/dev/pci/radeonfb.c:1.115 --- src/sys/dev/pci/radeonfb.c:1.114 Sat Apr 24 19:36:57 2021 +++ src/sys/dev/pci/radeonfb.c Sun Jun 20 23:21:17 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: radeonfb.c,v 1.114 2021/04/24 23:36:57 thorpej Exp $ */ +/* $NetBSD: radeonfb.c,v 1.115 2021/06/21 03:21:17 christos Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.114 2021/04/24 23:36:57 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: radeonfb.c,v 1.115 2021/06/21 03:21:17 christos Exp $"); #include #include @@ -812,7 +812,7 @@ radeonfb_attach(device_t parent, device_ /* setup default video mode from devprop (allows PROM override) */ sc->sc_defaultmode = radeonfb_default_mode; - if (prop_dictionary_get_cstring_nocopy(device_properties(sc->sc_dev), + if (prop_dictionary_get_string(device_properties(sc->sc_dev), "videomode", &mptr)) { strncpy(sc->sc_modebuf, mptr, sizeof(sc->sc_modebuf));
CVS commit: src/sys/dev/pci
Module Name:src Committed By: christos Date: Mon Jun 21 03:19:21 UTC 2021 Modified Files: src/sys/dev/pci: machfb.c Log Message: fix proplib deprecation To generate a diff of this commit: cvs rdiff -u -r1.104 -r1.105 src/sys/dev/pci/machfb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/pci/machfb.c diff -u src/sys/dev/pci/machfb.c:1.104 src/sys/dev/pci/machfb.c:1.105 --- src/sys/dev/pci/machfb.c:1.104 Sat Apr 24 19:36:57 2021 +++ src/sys/dev/pci/machfb.c Sun Jun 20 23:19:21 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: machfb.c,v 1.104 2021/04/24 23:36:57 thorpej Exp $ */ +/* $NetBSD: machfb.c,v 1.105 2021/06/21 03:19:21 christos Exp $ */ /* * Copyright (c) 2002 Bang Jun-Young @@ -34,7 +34,7 @@ #include __KERNEL_RCSID(0, - "$NetBSD: machfb.c,v 1.104 2021/04/24 23:36:57 thorpej Exp $"); + "$NetBSD: machfb.c,v 1.105 2021/06/21 03:19:21 christos Exp $"); #include #include @@ -520,7 +520,7 @@ mach64_attach(device_t parent, device_t default_mode.hdisplay = width; default_mode.vdisplay = height; - prop_dictionary_get_cstring_nocopy(device_properties(sc->sc_dev), + prop_dictionary_get_string(device_properties(sc->sc_dev), "videomode", &mptr); memset(&sc->sc_ei, 0, sizeof(sc->sc_ei));
CVS commit: src/sys/dev/sdmmc
Module Name:src Committed By: christos Date: Mon Jun 21 03:18:00 UTC 2021 Modified Files: src/sys/dev/sdmmc: if_bwfm_sdio.c Log Message: fix proplib deprecation To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/dev/sdmmc/if_bwfm_sdio.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/sdmmc/if_bwfm_sdio.c diff -u src/sys/dev/sdmmc/if_bwfm_sdio.c:1.25 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.26 --- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.25 Tue Jan 26 22:10:21 2021 +++ src/sys/dev/sdmmc/if_bwfm_sdio.c Sun Jun 20 23:17:59 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_bwfm_sdio.c,v 1.25 2021/01/27 03:10:21 thorpej Exp $ */ +/* $NetBSD: if_bwfm_sdio.c,v 1.26 2021/06/21 03:17:59 christos Exp $ */ /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */ /* * Copyright (c) 2010-2016 Broadcom Corporation @@ -565,7 +565,7 @@ bwfm_fdt_find_phandle(device_t self, dev /* locate in FDT */ dict = device_properties(self); - if (prop_dictionary_get_cstring_nocopy(dict, "fdt-path", &str)) { + if (prop_dictionary_get_string(dict, "fdt-path", &str)) { /* search in FDT */ phandle = OF_finddevice(str); } else { @@ -576,7 +576,7 @@ bwfm_fdt_find_phandle(device_t self, dev return -1; /* locate in FDT */ dict = device_properties(dev); - if (!prop_dictionary_get_cstring_nocopy(dict, "fdt-path", &str)) + if (!prop_dictionary_get_string(dict, "fdt-path", &str)) return -1; /* are we the only FDT child ? */
CVS commit: src/sys/dev/dm
Module Name:src Committed By: christos Date: Mon Jun 21 03:16:43 UTC 2021 Modified Files: src/sys/dev/dm: dm_ioctl.c Log Message: fix proplib deprecation To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/sys/dev/dm/dm_ioctl.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/dm/dm_ioctl.c diff -u src/sys/dev/dm/dm_ioctl.c:1.51 src/sys/dev/dm/dm_ioctl.c:1.52 --- src/sys/dev/dm/dm_ioctl.c:1.51 Fri May 7 05:53:39 2021 +++ src/sys/dev/dm/dm_ioctl.c Sun Jun 20 23:16:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dm_ioctl.c,v 1.51 2021/05/07 09:53:39 hannken Exp $ */ +/* $NetBSD: dm_ioctl.c,v 1.52 2021/06/21 03:16:43 christos Exp $ */ /* * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -29,7 +29,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.51 2021/05/07 09:53:39 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dm_ioctl.c,v 1.52 2021/06/21 03:16:43 christos Exp $"); /* * Locking is used to synchronise between ioctl calls and between dm_table's @@ -910,8 +910,8 @@ dm_table_status_ioctl(prop_dictionary_t name = NULL; flags = 0; - prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_NAME, &name); - prop_dictionary_get_cstring_nocopy(dm_dict, DM_IOCTL_UUID, &uuid); + prop_dictionary_get_string(dm_dict, DM_IOCTL_NAME, &name); + prop_dictionary_get_string(dm_dict, DM_IOCTL_UUID, &uuid); prop_dictionary_get_uint32(dm_dict, DM_IOCTL_FLAGS, &flags); prop_dictionary_get_uint32(dm_dict, DM_IOCTL_MINOR, &minor);
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: christos Date: Mon Jun 21 03:12:54 UTC 2021 Modified Files: src/sys/dev/i2c: adm1021.c dbcool.c dstemp.c i2c.c lm75.c pcagpio.c pcf8574.c Log Message: fix proplib deprecation To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/dev/i2c/adm1021.c cvs rdiff -u -r1.61 -r1.62 src/sys/dev/i2c/dbcool.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/i2c/dstemp.c cvs rdiff -u -r1.78 -r1.79 src/sys/dev/i2c/i2c.c cvs rdiff -u -r1.44 -r1.45 src/sys/dev/i2c/lm75.c cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/pcagpio.c cvs rdiff -u -r1.9 -r1.10 src/sys/dev/i2c/pcf8574.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/i2c/adm1021.c diff -u src/sys/dev/i2c/adm1021.c:1.28 src/sys/dev/i2c/adm1021.c:1.29 --- src/sys/dev/i2c/adm1021.c:1.28 Tue Jun 15 00:41:01 2021 +++ src/sys/dev/i2c/adm1021.c Sun Jun 20 23:12:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: adm1021.c,v 1.28 2021/06/15 04:41:01 mlelstv Exp $ */ +/* $NetBSD: adm1021.c,v 1.29 2021/06/21 03:12:54 christos Exp $ */ /* $OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $ */ /* @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.28 2021/06/15 04:41:01 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.29 2021/06/21 03:12:54 christos Exp $"); #include #include @@ -409,11 +409,11 @@ admtemp_attach(device_t parent, device_t sc->sc_sensor[ADMTEMP_EXT].flags = ENVSYS_FMONLIMITS | ENVSYS_FHAS_ENTROPY; - if (prop_dictionary_get_cstring_nocopy(sc->sc_prop, "s00", &desc)) { + if (prop_dictionary_get_string(sc->sc_prop, "s00", &desc)) { strncpy(iname, desc, 64); } - if (prop_dictionary_get_cstring_nocopy(sc->sc_prop, "s01", &desc)) { + if (prop_dictionary_get_string(sc->sc_prop, "s01", &desc)) { strncpy(ename, desc, 64); } Index: src/sys/dev/i2c/dbcool.c diff -u src/sys/dev/i2c/dbcool.c:1.61 src/sys/dev/i2c/dbcool.c:1.62 --- src/sys/dev/i2c/dbcool.c:1.61 Tue Jun 15 00:39:49 2021 +++ src/sys/dev/i2c/dbcool.c Sun Jun 20 23:12:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dbcool.c,v 1.61 2021/06/15 04:39:49 mlelstv Exp $ */ +/* $NetBSD: dbcool.c,v 1.62 2021/06/21 03:12:54 christos Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.61 2021/06/15 04:39:49 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.62 2021/06/21 03:12:54 christos Exp $"); #include #include @@ -1697,7 +1697,7 @@ dbcool_attach_sensor(struct dbcool_softc name_index = sc->sc_dc.dc_chip->table[idx].name_index; snprintf(name, 7, "s%02x", sc->sc_dc.dc_chip->table[idx].reg.val_reg); - if (prop_dictionary_get_cstring_nocopy(sc->sc_prop, name, &desc)) { + if (prop_dictionary_get_string(sc->sc_prop, name, &desc)) { strlcpy(sc->sc_sensor[idx].desc, desc, sizeof(sc->sc_sensor[idx].desc)); } else { Index: src/sys/dev/i2c/dstemp.c diff -u src/sys/dev/i2c/dstemp.c:1.13 src/sys/dev/i2c/dstemp.c:1.14 --- src/sys/dev/i2c/dstemp.c:1.13 Tue Jun 15 00:41:01 2021 +++ src/sys/dev/i2c/dstemp.c Sun Jun 20 23:12:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dstemp.c,v 1.13 2021/06/15 04:41:01 mlelstv Exp $ */ +/* $NetBSD: dstemp.c,v 1.14 2021/06/21 03:12:54 christos Exp $ */ /*- * Copyright (c) 2018 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.13 2021/06/15 04:41:01 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.14 2021/06/21 03:12:54 christos Exp $"); #include #include @@ -126,9 +126,9 @@ dstemp_attach(device_t parent, device_t sc->sc_sensor_temp.state = ENVSYS_SINVALID; sc->sc_sensor_temp.flags = ENVSYS_FHAS_ENTROPY; - if (prop_dictionary_get_cstring_nocopy(sc->sc_prop, "s00", &desc)) { + if (prop_dictionary_get_string(sc->sc_prop, "s00", &desc)) { strncpy(name, desc, 64); - } else if (prop_dictionary_get_cstring_nocopy(sc->sc_prop, "saa", &desc)) { + } else if (prop_dictionary_get_string(sc->sc_prop, "saa", &desc)) { strncpy(name, desc, 64); } Index: src/sys/dev/i2c/i2c.c diff -u src/sys/dev/i2c/i2c.c:1.78 src/sys/dev/i2c/i2c.c:1.79 --- src/sys/dev/i2c/i2c.c:1.78 Sat Apr 24 19:36:54 2021 +++ src/sys/dev/i2c/i2c.c Sun Jun 20 23:12:54 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: i2c.c,v 1.78 2021/04/24 23:36:54 thorpej Exp $ */ +/* $NetBSD: i2c.c,v 1.79 2021/06/21 03:12:54 christos Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -40,7 +40,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.78 2021/04/24 23:36:54 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i2c.c,v 1.79 2021/06/21 03:12:54 christos Exp $"); #include #include @@ -452,7 +452,7 @@ iic_attach(device_t parent, device_t sel for (i = 0; i < count; i++) { dev = prop_array_get(child_devices, i); if (!dev) continue; - if (!prop_dictionary_get_cstring_nocopy( + if (!prop_dictionary_get_string( dev, "
CVS commit: src/sys/dev
Module Name:src Committed By: christos Date: Mon Jun 21 03:11:05 UTC 2021 Modified Files: src/sys/dev: veriexec.c Log Message: fix proplib deprecation To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/veriexec.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/veriexec.c diff -u src/sys/dev/veriexec.c:1.1 src/sys/dev/veriexec.c:1.2 --- src/sys/dev/veriexec.c:1.1 Wed Dec 9 13:25:32 2015 +++ src/sys/dev/veriexec.c Sun Jun 20 23:11:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: veriexec.c,v 1.1 2015/12/09 18:25:32 maxv Exp $ */ +/* $NetBSD: veriexec.c,v 1.2 2021/06/21 03:11:05 christos Exp $ */ /*- * Copyright (c) 2005, 2006 Elad Efrat @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: veriexec.c,v 1.1 2015/12/09 18:25:32 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: veriexec.c,v 1.2 2021/06/21 03:11:05 christos Exp $"); #include #include @@ -110,7 +110,7 @@ veriexec_delete(prop_dictionary_t dict, const char *file; int error; - if (!prop_dictionary_get_cstring_nocopy(dict, "file", &file)) + if (!prop_dictionary_get_string(dict, "file", &file)) return (EINVAL); error = namei_simple_kernel(file, NSM_FOLLOW_NOEMULROOT, &vp); @@ -135,7 +135,7 @@ veriexec_query(prop_dictionary_t dict, p const char *file; int error; - if (!prop_dictionary_get_cstring_nocopy(dict, "file", &file)) + if (!prop_dictionary_get_string(dict, "file", &file)) return (EINVAL); error = namei_simple_kernel(file, NSM_FOLLOW_NOEMULROOT, &vp);
CVS commit: src/sys/dev/usb
Module Name:src Committed By: mlelstv Date: Sat Jun 19 05:50:48 UTC 2021 Modified Files: src/sys/dev/usb: uaudio.c Log Message: Relax identification of interfaces and endpoints. Now also attaches headsets like Jabra Evolve 75. To generate a diff of this commit: cvs rdiff -u -r1.171 -r1.172 src/sys/dev/usb/uaudio.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/usb/uaudio.c diff -u src/sys/dev/usb/uaudio.c:1.171 src/sys/dev/usb/uaudio.c:1.172 --- src/sys/dev/usb/uaudio.c:1.171 Sun Jun 13 07:51:09 2021 +++ src/sys/dev/usb/uaudio.c Sat Jun 19 05:50:48 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: uaudio.c,v 1.171 2021/06/13 07:51:09 mlelstv Exp $ */ +/* $NetBSD: uaudio.c,v 1.172 2021/06/19 05:50:48 mlelstv Exp $ */ /* * Copyright (c) 1999, 2012 The NetBSD Foundation, Inc. @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.171 2021/06/13 07:51:09 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uaudio.c,v 1.172 2021/06/19 05:50:48 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -561,8 +561,14 @@ uaudio_find_iface(const char *tbuf, int { const usb_interface_descriptor_t *d; - while (*offsp < size) { + while (*offsp + sizeof(*d) <= size) { d = (const void *)(tbuf + *offsp); + DPRINTFN(3, "%d + %d <= %d type %d class %d/%d iface %d\n", + *offsp, d->bLength, size, + d->bDescriptorType, + d->bInterfaceClass, + d->bInterfaceSubClass, + d->bInterfaceNumber); *offsp += d->bLength; if (d->bDescriptorType == UDESC_INTERFACE && d->bInterfaceClass == UICLASS_AUDIO && @@ -1533,7 +1539,6 @@ uaudio_add_alt(struct uaudio_softc *sc, Static usbd_status uaudio_process_as(struct uaudio_softc *sc, const char *tbuf, int *offsp, int size, const usb_interface_descriptor_t *id) -#define offs (*offsp) { const struct usb_audio_streaming_interface_descriptor *asid; const struct usb_audio_streaming_type1_descriptor *asf1d; @@ -1541,55 +1546,151 @@ uaudio_process_as(struct uaudio_softc *s const usb_endpoint_descriptor_audio_t *epdesc1; const struct usb_audio_streaming_endpoint_descriptor *sed; int format, chan __unused, prec, enc; - int dir, type, sync; + int dir, type, sync, epcount; struct as_info ai; const char *format_str __unused; + const uaudio_cs_descriptor_t *desc; - asid = (const void *)(tbuf + offs); - if (asid->bDescriptorType != UDESC_CS_INTERFACE || - asid->bDescriptorSubtype != AS_GENERAL) - return USBD_INVAL; - DPRINTF("asid: bTerminalLink=%d wFormatTag=%d\n", - asid->bTerminalLink, UGETW(asid->wFormatTag)); - offs += asid->bLength; - if (offs > size) - return USBD_INVAL; + DPRINTF("offset = %d < %d\n", *offsp, size); - asf1d = (const void *)(tbuf + offs); - if (asf1d->bDescriptorType != UDESC_CS_INTERFACE || - asf1d->bDescriptorSubtype != FORMAT_TYPE) - return USBD_INVAL; - offs += asf1d->bLength; - if (offs > size) - return USBD_INVAL; + epcount = 0; + asid = NULL; + asf1d = NULL; + ed = NULL; + epdesc1 = NULL; + sed = NULL; - if (asf1d->bFormatType != FORMAT_TYPE_I) { - aprint_normal_dev(sc->sc_dev, - "ignored setting with type %d format\n", UGETW(asid->wFormatTag)); - return USBD_NORMAL_COMPLETION; + while (*offsp < size) { + desc = (const uaudio_cs_descriptor_t *)(tbuf + *offsp); + if (*offsp + desc->bLength > size) + return USBD_INVAL; + + switch (desc->bDescriptorType) { + case UDESC_CS_INTERFACE: + switch (desc->bDescriptorSubtype) { + case AS_GENERAL: +if (asid != NULL) + goto ignore; +asid = (const struct usb_audio_streaming_interface_descriptor *) desc; +DPRINTF("asid: bTerminalLink=%d wFormatTag=%d bLength=%d\n", + asid->bTerminalLink, UGETW(asid->wFormatTag), asid->bLength); +break; + case FORMAT_TYPE: +if (asf1d != NULL) + goto ignore; +asf1d = (const struct usb_audio_streaming_type1_descriptor *) desc; +DPRINTF("asf1d: bDescriptorType=%d bDescriptorSubtype=%d\n", + asf1d->bDescriptorType, asf1d->bDescriptorSubtype); +if (asf1d->bFormatType != FORMAT_TYPE_I) { + aprint_normal_dev(sc->sc_dev, + "ignored setting with type %d format\n", UGETW(asid->wFormatTag)); + return USBD_NORMAL_COMPLETION; +} +break; + default: +goto ignore; + } + break; + case UDESC_ENDPOINT: + epcount++; + if (epcount > id->bNumEndpoints) +goto ignore; + switch (epcount) { + case 1: +ed = (const usb_endpoint_descriptor_audio_t *) desc; +DPRINTF("endpoint[0] bLength=%d bDescriptorType=%d " + "bEndpointAddress=%d bmAttributes=%#x wMaxPacketSize=%d " + "bInterval=%d bRefresh=%d bSynchAddress=%d\n", + ed->bLength, ed->bDescriptorType, ed->bEndpointAddress, + ed->bmAttributes, UGETW(ed->wMaxPacketSize), + ed->bInterval, ed->bRefresh, ed->bSynchAddress); +if (UE_GET_XFERTYPE(ed->bmAttributes) != UE_ISOCHRONOUS) + return USBD_INVAL; +
CVS commit: src/sys/dev/pci
Module Name:src Committed By: msaitoh Date: Thu Jun 17 02:05:48 UTC 2021 Modified Files: src/sys/dev/pci: if_iwnreg.h Log Message: Use unsigned to avoid undefined behavior. Found by kUBSan. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/pci/if_iwnreg.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/pci/if_iwnreg.h diff -u src/sys/dev/pci/if_iwnreg.h:1.17 src/sys/dev/pci/if_iwnreg.h:1.18 --- src/sys/dev/pci/if_iwnreg.h:1.17 Wed Jul 19 16:55:12 2017 +++ src/sys/dev/pci/if_iwnreg.h Thu Jun 17 02:05:47 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_iwnreg.h,v 1.17 2017/07/19 16:55:12 mlelstv Exp $ */ +/* $NetBSD: if_iwnreg.h,v 1.18 2021/06/17 02:05:47 msaitoh Exp $ */ /* $OpenBSD: if_iwnreg.h,v 1.49 2014/09/09 18:56:24 sthen Exp $ */ /*- @@ -244,7 +244,7 @@ /* Possible flags for register IWN_DRAM_INT_TBL. */ #define IWN_DRAM_INT_TBL_WRAP_CHECK (1 << 27) -#define IWN_DRAM_INT_TBL_ENABLE (1 << 31) +#define IWN_DRAM_INT_TBL_ENABLE (1U << 31) /* Possible values for register IWN_ANA_PLL. */ #define IWN_ANA_PLL_INIT 0x00880300 @@ -267,7 +267,7 @@ #define IWN_INT_FH_TX (1 << 27) #define IWN_INT_RX_PERIODIC (1 << 28) #define IWN_INT_HW_ERR (1 << 29) -#define IWN_INT_FH_RX (1 << 31) +#define IWN_INT_FH_RX (1U << 31) /* Shortcut. */ #define IWN_INT_MASK_DEF \
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Wed Jun 16 13:20:49 UTC 2021 Modified Files: src/sys/dev/usb: usbdi.c Log Message: usb(4): Fix uninitialized variable for error branch. To generate a diff of this commit: cvs rdiff -u -r1.217 -r1.218 src/sys/dev/usb/usbdi.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/usb/usbdi.c diff -u src/sys/dev/usb/usbdi.c:1.217 src/sys/dev/usb/usbdi.c:1.218 --- src/sys/dev/usb/usbdi.c:1.217 Mon Jun 14 15:35:34 2021 +++ src/sys/dev/usb/usbdi.c Wed Jun 16 13:20:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: usbdi.c,v 1.217 2021/06/14 15:35:34 mlelstv Exp $ */ +/* $NetBSD: usbdi.c,v 1.218 2021/06/16 13:20:49 riastradh Exp $ */ /* * Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.217 2021/06/14 15:35:34 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.218 2021/06/16 13:20:49 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -223,7 +223,7 @@ usbd_status usbd_open_pipe_ival(struct usbd_interface *iface, uint8_t address, uint8_t flags, struct usbd_pipe **pipe, int ival) { - struct usbd_pipe *p; + struct usbd_pipe *p = NULL; struct usbd_endpoint *ep = NULL /* XXXGCC */; bool piperef = false; usbd_status err;
CVS commit: src/sys/dev/usb
Module Name:src Committed By: riastradh Date: Tue Jun 15 23:39:43 UTC 2021 Modified Files: src/sys/dev/usb: ohci.c Log Message: ohci(4): Constify a constant debug string table. To generate a diff of this commit: cvs rdiff -u -r1.315 -r1.316 src/sys/dev/usb/ohci.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/usb/ohci.c diff -u src/sys/dev/usb/ohci.c:1.315 src/sys/dev/usb/ohci.c:1.316 --- src/sys/dev/usb/ohci.c:1.315 Tue Jan 5 18:00:21 2021 +++ src/sys/dev/usb/ohci.c Tue Jun 15 23:39:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.315 2021/01/05 18:00:21 skrll Exp $ */ +/* $NetBSD: ohci.c,v 1.316 2021/06/15 23:39:43 riastradh Exp $ */ /* * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.315 2021/01/05 18:00:21 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.316 2021/06/15 23:39:43 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -1403,7 +1403,7 @@ ohci_rhsc_enable(void *v_sc) } #ifdef OHCI_DEBUG -const char *ohci_cc_strs[] = { +const char *const ohci_cc_strs[] = { "NO_ERROR", "CRC", "BIT_STUFFING",
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Tue Jun 15 23:24:57 UTC 2021 Modified Files: src/sys/dev: dev_verbose.h Log Message: dev_verbose(9): Use a comma expression, not an expression block. Should pacify clang's -Wcompound-token-split-by-macro. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/dev/dev_verbose.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/dev_verbose.h diff -u src/sys/dev/dev_verbose.h:1.6 src/sys/dev/dev_verbose.h:1.7 --- src/sys/dev/dev_verbose.h:1.6 Wed Jun 9 23:22:51 2021 +++ src/sys/dev/dev_verbose.h Tue Jun 15 23:24:57 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dev_verbose.h,v 1.6 2021/06/09 23:22:51 pgoyette Exp $ */ +/* $NetBSD: dev_verbose.h,v 1.7 2021/06/15 23:24:57 riastradh Exp $ */ /* * Redistribution and use in source and binary forms, with or without @@ -117,7 +117,7 @@ tag ## _findvendor(char *buf, size_t len \ tag ## _load_verbose(); \ MODULE_HOOK_CALL(tag ## _findvendor_hook, (buf, len, vendor), \ - {snprintf(buf, len, "vendor %4.4x", vendor); NULL; }, \ + (snprintf(buf, len, "vendor %4.4x", vendor), NULL), \ retval); \ return retval; \ } \ @@ -131,7 +131,7 @@ tag ## _findproduct(char *buf, size_t le tag ## _load_verbose(); \ MODULE_HOOK_CALL(tag ## _findproduct_hook, \ (buf, len, vendor, product),\ - {snprintf(buf, len, "product %4.4x", product); NULL; }, \ + (snprintf(buf, len, "product %4.4x", product), NULL), \ retval); \ return retval; \ } \
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: mlelstv Date: Tue Jun 15 04:41:01 UTC 2021 Modified Files: src/sys/dev/i2c: adm1021.c dstemp.c Log Message: iic_acquire_bus may fail. To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/dev/i2c/adm1021.c cvs rdiff -u -r1.12 -r1.13 src/sys/dev/i2c/dstemp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/i2c/adm1021.c diff -u src/sys/dev/i2c/adm1021.c:1.27 src/sys/dev/i2c/adm1021.c:1.28 --- src/sys/dev/i2c/adm1021.c:1.27 Sat Jan 30 01:22:06 2021 +++ src/sys/dev/i2c/adm1021.c Tue Jun 15 04:41:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: adm1021.c,v 1.27 2021/01/30 01:22:06 thorpej Exp $ */ +/* $NetBSD: adm1021.c,v 1.28 2021/06/15 04:41:01 mlelstv Exp $ */ /* $OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $ */ /* @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.27 2021/01/30 01:22:06 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.28 2021/06/15 04:41:01 mlelstv Exp $"); #include #include @@ -344,7 +344,11 @@ admtemp_attach(device_t parent, device_t sc->sc_prop = ia->ia_prop; prop_object_retain(sc->sc_prop); - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) { + aprint_error_dev(self, "cannot acquire iic bus\n"); + return; + } + cmd = ADM1021_CONFIG_READ; if (admtemp_exec(sc, I2C_OP_READ_WITH_STOP, &cmd, &data) != 0) { iic_release_bus(sc->sc_tag, 0); @@ -466,10 +470,8 @@ admtemp_refresh(struct sysmon_envsys *sm uint8_t cmd, xdata; int8_t sdata; - if (iic_acquire_bus(sc->sc_tag, 0)) { - edata->state = ENVSYS_SINVALID; + if (iic_acquire_bus(sc->sc_tag, 0) != 0) return; - } if (edata->sensor == ADMTEMP_INT) cmd = ADM1021_INT_TEMP; Index: src/sys/dev/i2c/dstemp.c diff -u src/sys/dev/i2c/dstemp.c:1.12 src/sys/dev/i2c/dstemp.c:1.13 --- src/sys/dev/i2c/dstemp.c:1.12 Mon Mar 1 04:39:45 2021 +++ src/sys/dev/i2c/dstemp.c Tue Jun 15 04:41:01 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dstemp.c,v 1.12 2021/03/01 04:39:45 rin Exp $ */ +/* $NetBSD: dstemp.c,v 1.13 2021/06/15 04:41:01 mlelstv Exp $ */ /*- * Copyright (c) 2018 Michael Lorenz @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.12 2021/03/01 04:39:45 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dstemp.c,v 1.13 2021/06/15 04:41:01 mlelstv Exp $"); #include #include @@ -145,7 +145,8 @@ dstemp_init(struct dstemp_softc *sc) int error; uint8_t cmd[2], data; - iic_acquire_bus(sc->sc_i2c, 0); + if (iic_acquire_bus(sc->sc_i2c, 0)) + return; cmd[0] = DSTEMP_CONFIG; data = 0; error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP, @@ -171,10 +172,12 @@ dstemp_sensors_refresh(struct sysmon_env int error; - iic_acquire_bus(sc->sc_i2c, 0); - error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP, - sc->sc_addr, &cmd, 1, &data, 2, 0); - iic_release_bus(sc->sc_i2c, 0); + error = iic_acquire_bus(sc->sc_i2c, 0); + if (error == 0) { + error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP, + sc->sc_addr, &cmd, 1, &data, 2, 0); + iic_release_bus(sc->sc_i2c, 0); + } if (error) { edata->state = ENVSYS_SINVALID;
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: mlelstv Date: Tue Jun 15 04:40:13 UTC 2021 Modified Files: src/sys/dev/i2c: am2315.c Log Message: avoid double-free To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/am2315.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/i2c/am2315.c diff -u src/sys/dev/i2c/am2315.c:1.5 src/sys/dev/i2c/am2315.c:1.6 --- src/sys/dev/i2c/am2315.c:1.5 Sun Jun 17 01:08:15 2018 +++ src/sys/dev/i2c/am2315.c Tue Jun 15 04:40:13 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: am2315.c,v 1.5 2018/06/17 01:08:15 thorpej Exp $ */ +/* $NetBSD: am2315.c,v 1.6 2021/06/15 04:40:13 mlelstv Exp $ */ /* * Copyright (c) 2017 Brad Spencer @@ -17,7 +17,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: am2315.c,v 1.5 2018/06/17 01:08:15 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: am2315.c,v 1.6 2021/06/15 04:40:13 mlelstv Exp $"); /* * Driver for the Aosong AM2315 @@ -458,10 +458,8 @@ am2315_detach(device_t self, int flags) mutex_enter(&sc->sc_mutex); /* Remove the sensors */ - if (sc->sc_sme != NULL) { + if (sc->sc_sme != NULL) sysmon_envsys_unregister(sc->sc_sme); - sc->sc_sme = NULL; - } mutex_exit(&sc->sc_mutex); /* Destroy the wait cond */
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: mlelstv Date: Tue Jun 15 04:39:49 UTC 2021 Modified Files: src/sys/dev/i2c: dbcool.c hytp14.c si70xx.c Log Message: avoid double-free To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/dev/i2c/dbcool.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/i2c/hytp14.c cvs rdiff -u -r1.6 -r1.7 src/sys/dev/i2c/si70xx.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/i2c/dbcool.c diff -u src/sys/dev/i2c/dbcool.c:1.60 src/sys/dev/i2c/dbcool.c:1.61 --- src/sys/dev/i2c/dbcool.c:1.60 Sat Jan 30 01:22:06 2021 +++ src/sys/dev/i2c/dbcool.c Tue Jun 15 04:39:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: dbcool.c,v 1.60 2021/01/30 01:22:06 thorpej Exp $ */ +/* $NetBSD: dbcool.c,v 1.61 2021/06/15 04:39:49 mlelstv Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -50,7 +50,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.60 2021/01/30 01:22:06 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dbcool.c,v 1.61 2021/06/15 04:39:49 mlelstv Exp $"); #include #include @@ -819,11 +819,11 @@ dbcool_detach(device_t self, int flags) pmf_device_deregister(self); - sysmon_envsys_unregister(sc->sc_sme); + if (sc->sc_sme != NULL) + sysmon_envsys_unregister(sc->sc_sme); sysctl_teardown(&sc->sc_sysctl_log); - sc->sc_sme = NULL; return 0; } @@ -1600,6 +1600,7 @@ dbcool_setup(device_t self) out: sysmon_envsys_destroy(sc->sc_sme); + sc->sc_sme = NULL; } static int Index: src/sys/dev/i2c/hytp14.c diff -u src/sys/dev/i2c/hytp14.c:1.13 src/sys/dev/i2c/hytp14.c:1.14 --- src/sys/dev/i2c/hytp14.c:1.13 Wed Jan 27 02:29:48 2021 +++ src/sys/dev/i2c/hytp14.c Tue Jun 15 04:39:49 2021 @@ -61,7 +61,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hytp14.c,v 1.13 2021/01/27 02:29:48 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hytp14.c,v 1.14 2021/06/15 04:39:49 mlelstv Exp $"); #include #include @@ -204,6 +204,7 @@ hytp14_attach(device_t parent, device_t aprint_error_dev(sc->sc_dev, "unable to register with sysmon\n"); sysmon_envsys_destroy(sc->sc_sme); + sc->sc_sme = NULL; return; } @@ -244,10 +245,8 @@ hytp14_detach(device_t self, int flags) sc = device_private(self); - if (sc->sc_sme != NULL) { + if (sc->sc_sme != NULL) sysmon_envsys_unregister(sc->sc_sme); - sc->sc_sme = NULL; - } /* stop measurement thread */ mutex_enter(&sc->sc_mutex); Index: src/sys/dev/i2c/si70xx.c diff -u src/sys/dev/i2c/si70xx.c:1.6 src/sys/dev/i2c/si70xx.c:1.7 --- src/sys/dev/i2c/si70xx.c:1.6 Sat Dec 5 14:50:33 2020 +++ src/sys/dev/i2c/si70xx.c Tue Jun 15 04:39:49 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: si70xx.c,v 1.6 2020/12/05 14:50:33 jdc Exp $ */ +/* $NetBSD: si70xx.c,v 1.7 2021/06/15 04:39:49 mlelstv Exp $ */ /* * Copyright (c) 2017 Brad Spencer @@ -17,7 +17,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: si70xx.c,v 1.6 2020/12/05 14:50:33 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: si70xx.c,v 1.7 2021/06/15 04:39:49 mlelstv Exp $"); /* Driver for the Silicon Labs SI7013/SI7020/SI7021 @@ -968,10 +968,8 @@ si70xx_detach(device_t self, int flags) mutex_enter(&sc->sc_mutex); /* Remove the sensors */ - if (sc->sc_sme != NULL) { + if (sc->sc_sme != NULL) sysmon_envsys_unregister(sc->sc_sme); - sc->sc_sme = NULL; - } mutex_exit(&sc->sc_mutex); /* Remove the sysctl tree */
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Tue Jun 15 00:20:33 UTC 2021 Modified Files: src/sys/dev: ipmi.c Log Message: ipmi(4): Tidy up ipmi_thread a little. - Join on detach -- don't free anything until thread has exited; thread may still be using stuff. - Nix dead error branch -- malloc(M_WAITOK) cannot fail. - x = malloc(sizeof(x[0]) * n), not x = malloc(sizeof(type_t) * n) To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ipmi.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/ipmi.c diff -u src/sys/dev/ipmi.c:1.8 src/sys/dev/ipmi.c:1.9 --- src/sys/dev/ipmi.c:1.8 Mon Jun 14 22:00:10 2021 +++ src/sys/dev/ipmi.c Tue Jun 15 00:20:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ipmi.c,v 1.8 2021/06/14 22:00:10 riastradh Exp $ */ +/* $NetBSD: ipmi.c,v 1.9 2021/06/15 00:20:33 riastradh Exp $ */ /* * Copyright (c) 2019 Michael van Elst @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.8 2021/06/14 22:00:10 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.9 2021/06/15 00:20:33 riastradh Exp $"); #include #include @@ -1984,13 +1984,8 @@ ipmi_thread(void *cookie) break; /* allocate and fill sensor arrays */ - sc->sc_sensor = - malloc(sizeof(envsys_data_t) * sc->sc_nsensors, - M_DEVBUF, M_WAITOK | M_ZERO); - if (sc->sc_sensor == NULL) { - aprint_error_dev(self, "can't allocate envsys_data_t\n"); - kthread_exit(0); - } + sc->sc_sensor = malloc(sizeof(sc->sc_sensor[0]) * sc->sc_nsensors, + M_DEVBUF, M_WAITOK | M_ZERO); sc->sc_envsys = sysmon_envsys_create(); sc->sc_envsys->sme_cookie = sc; @@ -2132,7 +2127,7 @@ ipmi_attach(device_t parent, device_t se cv_init(&sc->sc_poll_cv, "ipmipoll"); cv_init(&sc->sc_mode_cv, "ipmimode"); - if (kthread_create(PRI_NONE, 0, NULL, ipmi_thread, self, + if (kthread_create(PRI_NONE, KTHREAD_MUSTJOIN, NULL, ipmi_thread, self, &sc->sc_kthread, "%s", device_xname(self)) != 0) { aprint_error_dev(self, "unable to create thread, disabled\n"); } else @@ -2150,6 +2145,8 @@ ipmi_detach(device_t self, int flags) sc->sc_thread_running = false; cv_signal(&sc->sc_poll_cv); mutex_exit(&sc->sc_poll_mtx); + if (sc->sc_kthread) + (void)kthread_join(sc->sc_kthread); if ((rc = sysmon_wdog_unregister(&sc->sc_wdog)) != 0) { if (rc == ERESTART)
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Mon Jun 14 22:00:10 UTC 2021 Modified Files: src/sys/dev: ipmi.c Log Message: ipmi(4): Notify config_pending_decr when ready, not when dying. Should fix hang at boot. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/dev/ipmi.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/ipmi.c diff -u src/sys/dev/ipmi.c:1.7 src/sys/dev/ipmi.c:1.8 --- src/sys/dev/ipmi.c:1.7 Sat Jun 12 12:15:43 2021 +++ src/sys/dev/ipmi.c Mon Jun 14 22:00:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: ipmi.c,v 1.7 2021/06/12 12:15:43 riastradh Exp $ */ +/* $NetBSD: ipmi.c,v 1.8 2021/06/14 22:00:10 riastradh Exp $ */ /* * Copyright (c) 2019 Michael van Elst @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.7 2021/06/12 12:15:43 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ipmi.c,v 1.8 2021/06/14 22:00:10 riastradh Exp $"); #include #include @@ -2090,6 +2090,8 @@ ipmi_thread(void *cookie) if (!pmf_device_register(self, ipmi_suspend, NULL)) aprint_error_dev(self, "couldn't establish a power handler\n"); + config_pending_decr(self); + mutex_enter(&sc->sc_poll_mtx); while (sc->sc_thread_running) { while (sc->sc_mode == IPMI_MODE_COMMAND) @@ -2108,7 +2110,6 @@ ipmi_thread(void *cookie) SENSOR_REFRESH_RATE); } mutex_exit(&sc->sc_poll_mtx); - config_pending_decr(self); kthread_exit(0); }
CVS commit: src/sys/dev/pad
Module Name:src Committed By: riastradh Date: Mon Jun 14 18:44:53 UTC 2021 Modified Files: src/sys/dev/pad: pad.c Log Message: pad(4): Explain what's wrong with using device pointers like this. ...and why the kernel lock is not enough. To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pad/pad.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/pad/pad.c diff -u src/sys/dev/pad/pad.c:1.74 src/sys/dev/pad/pad.c:1.75 --- src/sys/dev/pad/pad.c:1.74 Mon Jun 14 18:44:45 2021 +++ src/sys/dev/pad/pad.c Mon Jun 14 18:44:53 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pad.c,v 1.74 2021/06/14 18:44:45 riastradh Exp $ */ +/* $NetBSD: pad.c,v 1.75 2021/06/14 18:44:53 riastradh Exp $ */ /*- * Copyright (c) 2007 Jared D. McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.74 2021/06/14 18:44:45 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.75 2021/06/14 18:44:53 riastradh Exp $"); #include #include @@ -386,6 +386,36 @@ pad_close(struct pad_softc *sc) device_t self = sc->sc_dev; cfdata_t cf = device_cfdata(self); + /* + * XXX This is not quite enough to prevent racing with drvctl + * detach. What can happen: + * + * cpu0cpu1 + * + * pad_close + * take kernel lock + * sc->sc_open = 0 + * drop kernel lock + * wait for config_misc_lock + * drvctl detach + * take kernel lock + * drop kernel lock + * wait for config_misc_lock + * retake kernel lock + * drop config_misc_lock + * take config_misc_lock + * wait for kernel lock + * pad_detach (sc_open=0 already) + * free device + * drop kernel lock + * use device after free + * + * We need a way to grab a reference to the device so it won't + * be freed until we're done -- it's OK if we config_detach + * twice as long as it's idempotent, but not OK if the first + * config_detach frees the struct device before the second one + * has finished handling it. + */ KERNEL_LOCK(1, NULL); KASSERT(sc->sc_open); sc->sc_open = 0;