CVS commit: src/sys/dev/marvell
Module Name:src Committed By: skrll Date: Mon Feb 3 07:47:54 UTC 2020 Modified Files: src/sys/dev/marvell: if_mvgbe.c Log Message: Adopt To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/dev/marvell/if_mvgbe.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_mvgbe.c diff -u src/sys/dev/marvell/if_mvgbe.c:1.58 src/sys/dev/marvell/if_mvgbe.c:1.59 --- src/sys/dev/marvell/if_mvgbe.c:1.58 Fri Sep 13 07:55:07 2019 +++ src/sys/dev/marvell/if_mvgbe.c Mon Feb 3 07:47:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: if_mvgbe.c,v 1.58 2019/09/13 07:55:07 msaitoh Exp $ */ +/* $NetBSD: if_mvgbe.c,v 1.59 2020/02/03 07:47:53 skrll Exp $ */ /* * Copyright (c) 2007, 2008, 2013 KIYOHARA Takashi * All rights reserved. @@ -25,7 +25,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.58 2019/09/13 07:55:07 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_mvgbe.c,v 1.59 2020/02/03 07:47:53 skrll Exp $"); #include "opt_multiprocessor.h" @@ -1455,7 +1455,7 @@ mvgbe_watchdog(struct ifnet *ifp) } else { aprint_error_ifnet(ifp, "watchdog timeout\n"); - ifp->if_oerrors++; + if_statinc(ifp, if_oerrors); mvgbe_init(ifp); } @@ -1998,15 +1998,15 @@ mvgbe_rxeof(struct mvgbe_softc *sc) int err = rxstat & MVGBE_RX_ERROR_CODE_MASK; if (err == MVGBE_RX_CRC_ERROR) -ifp->if_ierrors++; +if_statinc(ifp, if_ierrors); if (err == MVGBE_RX_OVERRUN_ERROR) -ifp->if_ierrors++; +if_statinc(ifp, if_ierrors); if (err == MVGBE_RX_MAX_FRAME_LEN_ERROR) -ifp->if_ierrors++; +if_statinc(ifp, if_ierrors); if (err == MVGBE_RX_RESOURCE_ERROR) -ifp->if_ierrors++; +if_statinc(ifp, if_ierrors); #else - ifp->if_ierrors++; + if_statinc(ifp, if_ierrors); #endif mvgbe_newbuf(sc, cur, m, dmamap); continue; @@ -2059,7 +2059,7 @@ mvgbe_rxeof(struct mvgbe_softc *sc) aprint_error_ifnet(ifp, "no receive buffers available --" " packet dropped!\n"); -ifp->if_ierrors++; +if_statinc(ifp, if_ierrors); continue; } m = m0; @@ -2107,16 +2107,16 @@ mvgbe_txeof(struct mvgbe_softc *sc) break; } if (cur_tx->cmdsts & MVGBE_TX_LAST_DESC) - ifp->if_opackets++; + if_statinc(ifp, if_opackets); if (cur_tx->cmdsts & MVGBE_ERROR_SUMMARY) { int err = cur_tx->cmdsts & MVGBE_TX_ERROR_CODE_MASK; if (err == MVGBE_TX_LATE_COLLISION_ERROR) -ifp->if_collisions++; +if_statinc(ifp, if_collisions); if (err == MVGBE_TX_UNDERRUN_ERROR) -ifp->if_oerrors++; +if_statinc(ifp, if_oerrors); if (err == MVGBE_TX_EXCESSIVE_COLLISION_ERRO) -ifp->if_collisions++; +if_statinc(ifp, if_collisions); } if (cdata->mvgbe_tx_chain[idx].mvgbe_mbuf != NULL) { entry = cdata->mvgbe_tx_map[idx];
CVS commit: src/sys/arch/ia64
Module Name:src Committed By: scole Date: Mon Feb 3 02:56:25 UTC 2020 Modified Files: src/sys/arch/ia64: TODO Log Message: Update architectures ski is known to run on To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/ia64/TODO Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/ia64/TODO diff -u src/sys/arch/ia64/TODO:1.9 src/sys/arch/ia64/TODO:1.10 --- src/sys/arch/ia64/TODO:1.9 Sun Nov 17 16:52:29 2019 +++ src/sys/arch/ia64/TODO Mon Feb 3 02:56:25 2020 @@ -1,9 +1,8 @@ -$ NetBSD: TODO,v 1.1 2018/04/14 12:06:03 scole Exp $ +$ NetBSD: TODO,v 1.10 2020/02/03 02:54:23 scole Exp $ What works: The ski simulator (pkgsrc/emulators/ski) is known to work on NetBSD - i386 and amd64, and probably will work on other archs as well. It - can run and step through in assembly. + i386, amd64 and macppc. It "should" work on other archs as well. Netbooting may work on some machines, basically you need to boot diskless with the loader.efi (from src/sys/arch/ia64/stand/ia64/)
CVS commit: src/doc
Module Name:src Committed By: kamil Date: Sun Feb 2 21:50:22 UTC 2020 Modified Files: src/doc: CHANGES Log Message: realpath(1): Ported from FreeBSD. To generate a diff of this commit: cvs rdiff -u -r1.2647 -r1.2648 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2647 src/doc/CHANGES:1.2648 --- src/doc/CHANGES:1.2647 Sat Feb 1 21:14:44 2020 +++ src/doc/CHANGES Sun Feb 2 21:50:21 2020 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2647 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2648 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -141,3 +141,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: urio(4): Removed from the tree. [maya 20200129] Collect network interface statistics using per-cpu counters that are collated when they are queried. [thorpej 20200201] + realpath(1): Ported from FreeBSD. [kamil 20200202]
CVS commit: src
Module Name:src Committed By: kamil Date: Sun Feb 2 21:49:44 UTC 2020 Modified Files: src/distrib/sets/lists/base: mi src/distrib/sets/lists/debug: mi src/distrib/sets/lists/man: mi src/usr.bin: Makefile Added Files: src/usr.bin/realpath: Makefile realpath.1 realpath.c Log Message: Port realpath(1) from FreeBSD realpath(1) wraps realpath(3) and returns resolved physical path. This utility shipped with GNU and FreeBSD is sometimes used in scripts in the wild. To generate a diff of this commit: cvs rdiff -u -r1.1226 -r1.1227 src/distrib/sets/lists/base/mi cvs rdiff -u -r1.292 -r1.293 src/distrib/sets/lists/debug/mi cvs rdiff -u -r1.1678 -r1.1679 src/distrib/sets/lists/man/mi cvs rdiff -u -r1.232 -r1.233 src/usr.bin/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/realpath/Makefile \ src/usr.bin/realpath/realpath.1 src/usr.bin/realpath/realpath.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/base/mi diff -u src/distrib/sets/lists/base/mi:1.1226 src/distrib/sets/lists/base/mi:1.1227 --- src/distrib/sets/lists/base/mi:1.1226 Sun Jan 19 20:41:17 2020 +++ src/distrib/sets/lists/base/mi Sun Feb 2 21:49:44 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1226 2020/01/19 20:41:17 riastradh Exp $ +# $NetBSD: mi,v 1.1227 2020/02/02 21:49:44 kamil Exp $ # # Note: Don't delete entries from here - mark them as "obsolete" instead, # unless otherwise stated below. @@ -923,6 +923,7 @@ ./usr/bin/rcsmergebase-rcs-bin ./usr/bin/rdist base-netutil-bin ./usr/bin/readlinkbase-util-bin +./usr/bin/realpathbase-util-bin ./usr/bin/renicebase-util-bin ./usr/bin/reset base-util-bin ./usr/bin/rev base-util-bin Index: src/distrib/sets/lists/debug/mi diff -u src/distrib/sets/lists/debug/mi:1.292 src/distrib/sets/lists/debug/mi:1.293 --- src/distrib/sets/lists/debug/mi:1.292 Sun Jan 19 10:50:26 2020 +++ src/distrib/sets/lists/debug/mi Sun Feb 2 21:49:44 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.292 2020/01/19 10:50:26 martin Exp $ +# $NetBSD: mi,v 1.293 2020/02/02 21:49:44 kamil Exp $ ./etc/mtree/set.debug comp-sys-root ./usr/lib comp-sys-usr compatdir ./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile @@ -735,6 +735,7 @@ ./usr/libdata/debug/usr/bin/rcsmerge.debug comp-rcs-debug debug ./usr/libdata/debug/usr/bin/rdist.debug comp-netutil-debug debug ./usr/libdata/debug/usr/bin/readelf.debug comp-util-debug binutils,debug +./usr/libdata/debug/usr/bin/realpath.debug comp-util-debug debug ./usr/libdata/debug/usr/bin/refer.debug comp-groff-debug groff,debug ./usr/libdata/debug/usr/bin/renice.debug comp-util-debug debug ./usr/libdata/debug/usr/bin/rev.debug comp-util-debug debug Index: src/distrib/sets/lists/man/mi diff -u src/distrib/sets/lists/man/mi:1.1678 src/distrib/sets/lists/man/mi:1.1679 --- src/distrib/sets/lists/man/mi:1.1678 Wed Jan 29 18:39:04 2020 +++ src/distrib/sets/lists/man/mi Sun Feb 2 21:49:44 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.1678 2020/01/29 18:39:04 maya Exp $ +# $NetBSD: mi,v 1.1679 2020/02/02 21:49:44 kamil Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -480,6 +480,7 @@ ./usr/share/man/cat1/rcsmerge.0 man-rcs-catman .cat ./usr/share/man/cat1/rdist.0 man-netutil-catman .cat ./usr/share/man/cat1/readlink.0 man-util-catman .cat +./usr/share/man/cat1/realpath.0 man-util-catman .cat ./usr/share/man/cat1/rehash.0 man-util-catman .cat ./usr/share/man/cat1/repeat.0 man-util-catman .cat ./usr/share/man/cat1/reset.0 man-util-catman .cat @@ -3726,6 +3727,7 @@ ./usr/share/man/html1/rcsmerge.html man-rcs-htmlman html ./usr/share/man/html1/rdist.html man-netutil-htmlman html ./usr/share/man/html1/readlink.html man-util-htmlman html +./usr/share/man/html1/realpath.html man-util-htmlman html ./usr/share/man/html1/rehash.html man-util-htmlman html ./usr/share/man/html1/repeat.html man-util-htmlman html ./usr/share/man/html1/reset.html man-util-htmlman html @@ -6622,6 +6624,7 @@ ./usr/share/man/man1/rcsmerge.1 man-rcs-man .man ./usr/share/man/man1/rdist.1 man-netutil-man .man ./usr/share/man/man1/readlink.1 man-util-man .man +./usr/share/man/man1/realpath.1 man-util-man .man ./usr/share/man/man1/rehash.1 man-util-man .man ./usr/share/man/man1/repeat.1 man-util-man .man ./usr/share/man/man1/reset.1 man-util-man .man Index: src/usr.bin/Makefile diff -u src/usr.bin/Makefile:1.232 src/usr.bin/Makefile:1.233 --- src/usr.bin/Makefile:1.232 Tue Jul 24 15:26:16 2018 +++ src/usr.bin/Makefile Sun Feb 2 21:49:43 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.232 2018/07/24 15:26:16 christos Exp $ +# $NetBSD: Makefile,v 1.233 2020/02/02 21:49:43 kamil Exp $ # from: @(#)Makefile 8.3 (Berkeley) 1/7/94 .include @@ -22,7 +22,7 @@ SUBDIR= apply asa at audio audiocfg \
CVS commit: src/sys/arch/arm/acpi
Module Name:src Committed By: jmcneill Date: Sun Feb 2 16:44:25 UTC 2020 Modified Files: src/sys/arch/arm/acpi: acpi_pci_layerscape_gen4.c Log Message: Map and read MCFG space directly instead of going through acpimcfg to simplify access through our tiny config space window. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/acpi/acpi_pci_layerscape_gen4.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/acpi/acpi_pci_layerscape_gen4.c diff -u src/sys/arch/arm/acpi/acpi_pci_layerscape_gen4.c:1.1 src/sys/arch/arm/acpi/acpi_pci_layerscape_gen4.c:1.2 --- src/sys/arch/arm/acpi/acpi_pci_layerscape_gen4.c:1.1 Sat Feb 1 13:26:43 2020 +++ src/sys/arch/arm/acpi/acpi_pci_layerscape_gen4.c Sun Feb 2 16:44:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_pci_layerscape_gen4.c,v 1.1 2020/02/01 13:26:43 jmcneill Exp $ */ +/* $NetBSD: acpi_pci_layerscape_gen4.c,v 1.2 2020/02/02 16:44:25 jmcneill Exp $ */ /*- * Copyright (c) 2020 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: acpi_pci_layerscape_gen4.c,v 1.1 2020/02/01 13:26:43 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_pci_layerscape_gen4.c,v 1.2 2020/02/02 16:44:25 jmcneill Exp $"); #include #include @@ -78,6 +78,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_pci_lay struct acpi_pci_layerscape_gen4 { bus_space_tag_t bst; bus_space_handle_t bsh; + bus_space_handle_t win_bsh; uint8_t rev; kmutex_t lock; }; @@ -120,12 +121,11 @@ static void acpi_pci_layerscape_gen4_select_target(struct acpi_pci_layerscape_gen4 *pcie, pci_chipset_tag_t pc, pcitag_t tag) { - struct acpi_pci_context *ap = pc->pc_conf_v; int b, d, f; pci_decompose_tag(pc, tag, , , ); - const uint32_t target = PAB_TARGET_BUS(b - ap->ap_bus) | + const uint32_t target = PAB_TARGET_BUS(b) | PAB_TARGET_DEV(d) | PAB_TARGET_FUNC(f); acpi_pci_layerscape_gen4_ccsr_write4(pcie, PAB_AXI_AMAP_PEX_WIN_L(0), target); @@ -133,7 +133,7 @@ acpi_pci_layerscape_gen4_select_target(s } static bool -acpi_pci_layerscape_gen4_is_tag_okay(pci_chipset_tag_t pc, pcitag_t tag) +acpi_pci_layerscape_gen4_is_tag_okay(pci_chipset_tag_t pc, pcitag_t tag, int reg) { struct acpi_pci_context *ap = pc->pc_conf_v; int b, d, f; @@ -143,6 +143,9 @@ acpi_pci_layerscape_gen4_is_tag_okay(pci if (b <= ap->ap_bus + 1 && d > 0) return false; + if (b != ap->ap_bus) + return acpimcfg_conf_valid(pc, tag, reg); + return true; } @@ -152,11 +155,10 @@ acpi_pci_layerscape_gen4_conf_read(pci_c struct acpi_pci_context *ap = pc->pc_conf_v; struct acpi_pci_layerscape_gen4 *pcie = ap->ap_conf_priv; int b, d, f; - int error; pci_decompose_tag(pc, tag, , , ); - if (!acpi_pci_layerscape_gen4_is_tag_okay(pc, tag)) { + if (!acpi_pci_layerscape_gen4_is_tag_okay(pc, tag, reg)) { *data = -1; return EINVAL; } @@ -168,10 +170,9 @@ acpi_pci_layerscape_gen4_conf_read(pci_c if (b == ap->ap_bus) { *data = acpi_pci_layerscape_gen4_ccsr_read4(pcie, reg); - error = 0; } else { acpi_pci_layerscape_gen4_select_target(pcie, pc, tag); - error = acpimcfg_conf_read(pc, pci_make_tag(pc, 0, 0, 0), reg, data); + *data = bus_space_read_4(pcie->bst, pcie->win_bsh, reg); } if (pcie->rev == 0x10 && reg == PCI_ID_REG) @@ -179,7 +180,7 @@ acpi_pci_layerscape_gen4_conf_read(pci_c mutex_exit(>lock); - return error; + return 0; } static int @@ -188,26 +189,49 @@ acpi_pci_layerscape_gen4_conf_write(pci_ struct acpi_pci_context *ap = pc->pc_conf_v; struct acpi_pci_layerscape_gen4 *pcie = ap->ap_conf_priv; int b, d, f; - int error; pci_decompose_tag(pc, tag, , , ); - if (!acpi_pci_layerscape_gen4_is_tag_okay(pc, tag)) + if (!acpi_pci_layerscape_gen4_is_tag_okay(pc, tag, reg)) return EINVAL; mutex_enter(>lock); if (b == ap->ap_bus) { acpi_pci_layerscape_gen4_ccsr_write4(pcie, reg, data); - error = 0; } else { acpi_pci_layerscape_gen4_select_target(pcie, pc, tag); - error = acpimcfg_conf_write(pc, pci_make_tag(pc, 0, 0, 0), reg, data); + bus_space_write_4(pcie->bst, pcie->win_bsh, reg, data); } mutex_exit(>lock); - return error; + return 0; +} + +static UINT64 +acpi_pci_layerscape_win_base(ACPI_INTEGER seg) +{ + ACPI_TABLE_MCFG *mcfg; + ACPI_MCFG_ALLOCATION *ama; + ACPI_STATUS rv; + uint32_t off; + int i; + + rv = AcpiGetTable(ACPI_SIG_MCFG, 0, (ACPI_TABLE_HEADER **)); + if (ACPI_FAILURE(rv)) + return 0; + + off = sizeof(ACPI_TABLE_MCFG); + ama = ACPI_ADD_PTR(ACPI_MCFG_ALLOCATION, mcfg, off); + for (i = 0; off + sizeof(ACPI_MCFG_ALLOCATION) <= mcfg->Header.Length; i++) { + if (ama->PciSegment == seg) + return ama->Address; + off += sizeof(ACPI_MCFG_ALLOCATION); + ama = ACPI_ADD_PTR(ACPI_MCFG_ALLOCATION, mcfg, off); + } + + return 0; /* not found */ } static ACPI_STATUS @@ -221,6 +245,7 @@ acpi_pci_layerscape_gen4_map(ACPI_HANDLE
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: jmcneill Date: Sun Feb 2 16:31:25 UTC 2020 Modified Files: src/sys/dev/acpi: acpi_mcfg.c acpi_mcfg.h Log Message: Add acpimcfg_conf_valid helper for pcie controllers with nonstandard config space layouts. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/dev/acpi/acpi_mcfg.c cvs rdiff -u -r1.2 -r1.3 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.17 src/sys/dev/acpi/acpi_mcfg.c:1.18 --- src/sys/dev/acpi/acpi_mcfg.c:1.17 Mon Oct 14 00:15:13 2019 +++ src/sys/dev/acpi/acpi_mcfg.c Sun Feb 2 16:31:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_mcfg.c,v 1.17 2019/10/14 00:15:13 jmcneill Exp $ */ +/* $NetBSD: acpi_mcfg.c,v 1.18 2020/02/02 16:31:25 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.17 2019/10/14 00:15:13 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: acpi_mcfg.c,v 1.18 2020/02/02 16:31:25 jmcneill Exp $"); #include #include @@ -962,3 +962,28 @@ acpimcfg_conf_write(pci_chipset_tag_t pc mcfg_ops->ao_write(seg->ms_bst, mb->bsh[dev][func], reg, data); return 0; } + +bool +acpimcfg_conf_valid(pci_chipset_tag_t pc, pcitag_t tag, int reg) +{ + struct mcfg_segment *seg = NULL; + struct mcfg_bus *mb; + int bus, dev, func; + + if (!mcfg_inited) + return false; + + pci_decompose_tag(pc, tag, , , ); + + seg = acpimcfg_get_segment(pc, bus); + if (seg == NULL) + return false; + + mb = >ms_bus[bus - seg->ms_bus_start]; + if (!PCIDEV_IS_VALID(mb, dev, func)) + return false; + if (!EXTCONF_IS_VALID(mb, dev, func) && reg >= PCI_CONF_SIZE) + return false; + + return true; +} Index: src/sys/dev/acpi/acpi_mcfg.h diff -u src/sys/dev/acpi/acpi_mcfg.h:1.2 src/sys/dev/acpi/acpi_mcfg.h:1.3 --- src/sys/dev/acpi/acpi_mcfg.h:1.2 Mon Oct 15 10:01:32 2018 +++ src/sys/dev/acpi/acpi_mcfg.h Sun Feb 2 16:31:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi_mcfg.h,v 1.2 2018/10/15 10:01:32 jmcneill Exp $ */ +/* $NetBSD: acpi_mcfg.h,v 1.3 2020/02/02 16:31:25 jmcneill Exp $ */ /*- * Copyright (C) 2015 NONAKA Kimihiro @@ -36,6 +36,7 @@ int acpimcfg_configure_bus(device_t, pci 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); +bool acpimcfg_conf_valid(pci_chipset_tag_t, pcitag_t, int); struct acpimcfg_ops { /* validate MCFG memory region */
CVS commit: src/sys/dev/pci
Module Name:src Committed By: jmcneill Date: Sun Feb 2 16:30:31 UTC 2020 Modified Files: src/sys/dev/pci: pci.c Log Message: pci_probe_device: make sure PCI_ID_REG returns valid data before touching any other registers To generate a diff of this commit: cvs rdiff -u -r1.156 -r1.157 src/sys/dev/pci/pci.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.c diff -u src/sys/dev/pci/pci.c:1.156 src/sys/dev/pci/pci.c:1.157 --- src/sys/dev/pci/pci.c:1.156 Tue Oct 15 13:27:11 2019 +++ src/sys/dev/pci/pci.c Sun Feb 2 16:30:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.c,v 1.156 2019/10/15 13:27:11 jmcneill Exp $ */ +/* $NetBSD: pci.c,v 1.157 2020/02/02 16:30:31 jmcneill Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998 @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.156 2019/10/15 13:27:11 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.157 2020/02/02 16:30:31 jmcneill Exp $"); #ifdef _KERNEL_OPT #include "opt_pci.h" @@ -288,13 +288,7 @@ pci_probe_device(struct pci_softc *sc, p if (sc->PCI_SC_DEVICESC(device, function).c_dev != NULL && !match) return 0; - bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG); - if (PCI_HDRTYPE_TYPE(bhlcr) > 2) - return 0; - id = pci_conf_read(pc, tag, PCI_ID_REG); - /* csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); */ - pciclass = pci_conf_read(pc, tag, PCI_CLASS_REG); /* Invalid vendor ID value? */ if (PCI_VENDOR(id) == PCI_VENDOR_INVALID) @@ -303,6 +297,13 @@ pci_probe_device(struct pci_softc *sc, p if (PCI_VENDOR(id) == 0) return 0; + bhlcr = pci_conf_read(pc, tag, PCI_BHLC_REG); + if (PCI_HDRTYPE_TYPE(bhlcr) > 2) + return 0; + + /* csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); */ + pciclass = pci_conf_read(pc, tag, PCI_CLASS_REG); + /* Collect memory range info */ memset(sc->PCI_SC_DEVICESC(device, function).c_range, 0, sizeof(sc->PCI_SC_DEVICESC(device, function).c_range));
CVS commit: src/sys/dev/pci
Module Name:src Committed By: jmcneill Date: Sun Feb 2 14:45:14 UTC 2020 Modified Files: src/sys/dev/pci: pciconf.c Log Message: Fix null deref for busses with no IO port resources. To generate a diff of this commit: cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/pciconf.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/pciconf.c diff -u src/sys/dev/pci/pciconf.c:1.45 src/sys/dev/pci/pciconf.c:1.46 --- src/sys/dev/pci/pciconf.c:1.45 Mon Jan 20 10:35:42 2020 +++ src/sys/dev/pci/pciconf.c Sun Feb 2 14:45:14 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pciconf.c,v 1.45 2020/01/20 10:35:42 skrll Exp $ */ +/* $NetBSD: pciconf.c,v 1.46 2020/02/02 14:45:14 jmcneill Exp $ */ /* * Copyright 2001 Wasabi Systems, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.45 2020/01/20 10:35:42 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.46 2020/02/02 14:45:14 jmcneill Exp $"); #include "opt_pci.h" @@ -772,6 +772,12 @@ setup_iowins(pciconf_bus_t *pb) continue; pd = pi->dev; + if (pb->ioext == NULL) { + /* Bus has no IO ranges, disable IO BAR */ + pi->address = 0; + pd->enable &= ~PCI_CONF_ENABLE_IO; + goto write_ioaddr; + } pi->address = pci_allocate_range(pb->ioext, pi->size, pi->align, false); if (~pi->address == 0) { @@ -798,6 +804,7 @@ setup_iowins(pciconf_bus_t *pb) } else { pd->enable |= PCI_CONF_ENABLE_IO; } +write_ioaddr: if (pci_conf_debug) { print_tag(pd->pc, pd->tag); printf("Putting %" PRIu64 " I/O bytes @ %#" PRIx64
CVS commit: src/sys/arch/arm
Module Name:src Committed By: skrll Date: Sun Feb 2 09:19:48 UTC 2020 Modified Files: src/sys/arch/arm/arm32: arm32_kvminit.c src/sys/arch/arm/include/arm32: pte.h Log Message: G/C L1_TABLE_SIZE_REAL To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/arch/arm/arm32/arm32_kvminit.c cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/include/arm32/pte.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/arm32_kvminit.c diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.55 src/sys/arch/arm/arm32/arm32_kvminit.c:1.56 --- src/sys/arch/arm/arm32/arm32_kvminit.c:1.55 Wed May 8 13:18:47 2019 +++ src/sys/arch/arm/arm32/arm32_kvminit.c Sun Feb 2 09:19:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arm32_kvminit.c,v 1.55 2019/05/08 13:18:47 skrll Exp $ */ +/* $NetBSD: arm32_kvminit.c,v 1.56 2020/02/02 09:19:48 skrll Exp $ */ /* * Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved. @@ -127,7 +127,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.55 2019/05/08 13:18:47 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.56 2020/02/02 09:19:48 skrll Exp $"); #include #include @@ -460,7 +460,7 @@ arm32_kernel_vm_init(vaddr_t kernel_vm_b */ size_t kernel_size = bmi->bmi_kernelend; kernel_size -= (bmi->bmi_kernelstart & -L2_S_SEGSIZE); - kernel_size += L1_TABLE_SIZE_REAL; + kernel_size += L1_TABLE_SIZE; kernel_size += PAGE_SIZE * KERNEL_L2PT_VMDATA_NUM; if (map_vectors_p) { kernel_size += PAGE_SIZE; /* L2PT for VECTORS */ Index: src/sys/arch/arm/include/arm32/pte.h diff -u src/sys/arch/arm/include/arm32/pte.h:1.21 src/sys/arch/arm/include/arm32/pte.h:1.22 --- src/sys/arch/arm/include/arm32/pte.h:1.21 Sat Jan 18 14:40:04 2020 +++ src/sys/arch/arm/include/arm32/pte.h Sun Feb 2 09:19:48 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pte.h,v 1.21 2020/01/18 14:40:04 skrll Exp $ */ +/* $NetBSD: pte.h,v 1.22 2020/02/02 09:19:48 skrll Exp $ */ /* * Copyright (c) 2001, 2002 Wasabi Systems, Inc. @@ -138,7 +138,6 @@ typedef uint32_t pt_entry_t; /* L2 table * keep the old L2_TABLE_SIZE define lying around. Converted ports * should use L2_TABLE_SIZE_REAL until then. */ -#define L1_TABLE_SIZE_REAL 0x4000 /* 16K */ #define L2_TABLE_SIZE_REAL 0x400 /* 1K */ #define L1TT_SIZE 0x2000 /* 8K */
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: skrll Date: Sun Feb 2 08:56:30 UTC 2020 Modified Files: src/sys/arch/arm/arm32: pmap.c Log Message: More KNF To generate a diff of this commit: cvs rdiff -u -r1.386 -r1.387 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.386 src/sys/arch/arm/arm32/pmap.c:1.387 --- src/sys/arch/arm/arm32/pmap.c:1.386 Sun Feb 2 08:19:15 2020 +++ src/sys/arch/arm/arm32/pmap.c Sun Feb 2 08:56:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.386 2020/02/02 08:19:15 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.387 2020/02/02 08:56:29 skrll Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -198,7 +198,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.386 2020/02/02 08:19:15 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.387 2020/02/02 08:56:29 skrll Exp $"); #include #include @@ -1109,7 +1109,7 @@ pmap_find_pv(struct vm_page_md *md, pmap break; } - return (pv); + return pv; } /* @@ -1226,7 +1226,7 @@ pmap_modify_pv(struct vm_page_md *md, pa KASSERT(!PV_IS_KENTRY_P(set_mask)); if ((npv = pmap_find_pv(md, pm, va)) == NULL) - return (0); + return 0; NPDEBUG(PDB_PVDUMP, printf("pmap_modify_pv: pm %p, md %p, clr 0x%x, set 0x%x, flags 0x%x\n", pm, md, clr_mask, set_mask, npv->pv_flags)); @@ -1300,7 +1300,7 @@ pmap_modify_pv(struct vm_page_md *md, pa PMAPCOUNT(remappings); - return (oflags); + return oflags; } @@ -1505,9 +1505,9 @@ pmap_get_l2_bucket(pmap_t pm, vaddr_t va if ((l2 = pm->pm_l2[L2_IDX(l1slot)]) == NULL || (l2b = >l2_bucket[L2_BUCKET(l1slot)])->l2b_kva == NULL) - return (NULL); + return NULL; - return (l2b); + return l2b; } /* @@ -1535,7 +1535,7 @@ pmap_alloc_l2_bucket(pmap_t pm, vaddr_t * Need to allocate a new l2_dtable. */ if ((l2 = pmap_alloc_l2_dtable()) == NULL) - return (NULL); + return NULL; /* * Link it into the parent pmap @@ -1565,7 +1565,7 @@ pmap_alloc_l2_bucket(pmap_t pm, vaddr_t pm->pm_l2[L2_IDX(l1slot)] = NULL; pmap_free_l2_dtable(l2); } - return (NULL); + return NULL; } l2->l2_occupancy++; @@ -1586,7 +1586,7 @@ pmap_alloc_l2_bucket(pmap_t pm, vaddr_t #endif } - return (l2b); + return l2b; } /* @@ -1740,7 +1740,7 @@ pmap_l2ptp_ctor(void *arg, void *v, int memset(v, 0, L2_TABLE_SIZE_REAL); PTE_SYNC_RANGE(v, L2_TABLE_SIZE_REAL / sizeof(pt_entry_t)); - return (0); + return 0; } static int @@ -1748,7 +1748,7 @@ pmap_l2dtable_ctor(void *arg, void *v, i { memset(v, 0, sizeof(struct l2_dtable)); - return (0); + return 0; } static int @@ -1756,7 +1756,7 @@ pmap_pmap_ctor(void *arg, void *v, int f { memset(v, 0, sizeof(struct pmap)); - return (0); + return 0; } static void @@ -1835,7 +1835,7 @@ pmap_get_vac_flags(const struct vm_page_ if (md->urw_mappings) uidx |= 2; - return (pmap_vac_flags[uidx][kidx]); + return pmap_vac_flags[uidx][kidx]; } static inline void @@ -3049,7 +3049,7 @@ pmap_create(void) pmap_pinit(pm); - return (pm); + return pm; } u_int @@ -3279,7 +3279,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_ pmap_free_l2_bucket(pm, l2b, 0); UVMHIST_LOG(maphist, " <-- done (ENOMEM)", 0, 0, 0, 0); - return (ENOMEM); + return ENOMEM; } } @@ -3434,7 +3434,7 @@ pmap_enter(pmap_t pm, vaddr_t va, paddr_ free_pv: if (new_pv) pool_put(_pv_pool, new_pv); - return (error); + return error; } /* @@ -4784,7 +4784,7 @@ pmap_fault_fixup(pmap_t pm, vaddr_t va, out: pmap_release_pmap_lock(pm); - return (rv); + return rv; } /* @@ -5816,13 +5816,13 @@ pmap_grow_map(vaddr_t va, paddr_t *pap) pa = pv.pv_pa; #else if (uvm_page_physget() == false) - return (1); + return 1; #endif /* PMAP_STEAL_MEMORY */ } else { struct vm_page *pg; pg = uvm_pagealloc(NULL, 0, NULL, UVM_PGA_USERESERVE); if (pg == NULL) - return (1); + return 1; pa = VM_PAGE_TO_PHYS(pg); /* * This new page must not have any mappings. Enter it via @@ -5848,7 +5848,7 @@ pmap_grow_map(vaddr_t va, paddr_t *pap) KDASSERT((opte & L2_S_CACHE_MASK) == pte_l2_s_cache_mode_pt); #endif memset((void *)va, 0, PAGE_SIZE); - return (0); + return 0; } /* @@ -5877,7 +5877,7 @@ pmap_grow_l2_bucket(pmap_t pm, vaddr_t v * Need to allocate a backing page */ if (pmap_grow_map(nva, NULL)) -return (NULL); +return NULL; } l2 = (struct l2_dtable *)nva; @@ -5889,7 +5889,7 @@ pmap_grow_l2_bucket(pmap_t pm, vaddr_t v * Map in another page to cover it. */ if (pmap_grow_map(nva & ~PGOFSET, NULL)) -return (NULL); +return NULL; } pmap_kernel_l2dtable_kva = nva; @@ -5919,7 +5919,7 @@ pmap_grow_l2_bucket(pmap_t pm, vaddr_t v * Need to allocate a backing page */ if
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: skrll Date: Sun Feb 2 08:19:15 UTC 2020 Modified Files: src/sys/arch/arm/arm32: pmap.c Log Message: Always call pmap_grow_map with a page aligned new VA. KASSERT that this happenes. To generate a diff of this commit: cvs rdiff -u -r1.385 -r1.386 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.385 src/sys/arch/arm/arm32/pmap.c:1.386 --- src/sys/arch/arm/arm32/pmap.c:1.385 Sun Feb 2 08:16:40 2020 +++ src/sys/arch/arm/arm32/pmap.c Sun Feb 2 08:19:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.385 2020/02/02 08:16:40 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.386 2020/02/02 08:19:15 skrll Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -198,7 +198,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.385 2020/02/02 08:16:40 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.386 2020/02/02 08:19:15 skrll Exp $"); #include #include @@ -5800,6 +5800,8 @@ pmap_grow_map(vaddr_t va, paddr_t *pap) { paddr_t pa; + KASSERT((va & PGOFSET) == 0); + if (uvm.page_init_done == false) { #ifdef PMAP_STEAL_MEMORY pv_addr_t pv; @@ -5886,7 +5888,7 @@ pmap_grow_l2_bucket(pmap_t pm, vaddr_t v * The new l2_dtable straddles a page boundary. * Map in another page to cover it. */ - if (pmap_grow_map(nva, NULL)) + if (pmap_grow_map(nva & ~PGOFSET, NULL)) return (NULL); }
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: skrll Date: Sun Feb 2 08:16:40 UTC 2020 Modified Files: src/sys/arch/arm/arm32: pmap.c Log Message: Always pmap_kenter_pa the page in pmap_grow_map regardless of how we got it. To generate a diff of this commit: cvs rdiff -u -r1.384 -r1.385 src/sys/arch/arm/arm32/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.384 src/sys/arch/arm/arm32/pmap.c:1.385 --- src/sys/arch/arm/arm32/pmap.c:1.384 Sun Feb 2 07:55:11 2020 +++ src/sys/arch/arm/arm32/pmap.c Sun Feb 2 08:16:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.384 2020/02/02 07:55:11 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.385 2020/02/02 08:16:40 skrll Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -198,7 +198,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.384 2020/02/02 07:55:11 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.385 2020/02/02 08:16:40 skrll Exp $"); #include #include @@ -5815,9 +5815,6 @@ pmap_grow_map(vaddr_t va, paddr_t *pap) #else if (uvm_page_physget() == false) return (1); - - pmap_kenter_pa(va, pa, - VM_PROT_READ|VM_PROT_WRITE, PMAP_KMPAGE|PMAP_PTE); #endif /* PMAP_STEAL_MEMORY */ } else { struct vm_page *pg; @@ -5831,10 +5828,11 @@ pmap_grow_map(vaddr_t va, paddr_t *pap) */ struct vm_page_md *md __diagused = VM_PAGE_TO_MD(pg); KASSERT(SLIST_EMPTY(>pvh_list)); - pmap_kenter_pa(va, pa, - VM_PROT_READ|VM_PROT_WRITE, PMAP_KMPAGE|PMAP_PTE); } + pmap_kenter_pa(va, pa, + VM_PROT_READ|VM_PROT_WRITE, PMAP_KMPAGE|PMAP_PTE); + if (pap) *pap = pa;
CVS commit: src/sys/arch/arm/arm32
Module Name:src Committed By: skrll Date: Sun Feb 2 07:59:42 UTC 2020 Modified Files: src/sys/arch/arm/arm32: arm32_machdep.c Log Message: KNF. One #include is enough To generate a diff of this commit: cvs rdiff -u -r1.130 -r1.131 src/sys/arch/arm/arm32/arm32_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/arm32_machdep.c diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.130 src/sys/arch/arm/arm32/arm32_machdep.c:1.131 --- src/sys/arch/arm/arm32/arm32_machdep.c:1.130 Fri Dec 27 09:45:26 2019 +++ src/sys/arch/arm/arm32/arm32_machdep.c Sun Feb 2 07:59:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arm32_machdep.c,v 1.130 2019/12/27 09:45:26 msaitoh Exp $ */ +/* $NetBSD: arm32_machdep.c,v 1.131 2020/02/02 07:59:41 skrll Exp $ */ /* * Copyright (c) 1994-1998 Mark Brinicombe. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.130 2019/12/27 09:45:26 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.131 2020/02/02 07:59:41 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_arm_start.h" @@ -53,24 +53,24 @@ __KERNEL_RCSID(0, "$NetBSD: arm32_machde #include "opt_pmap_debug.h" #include + #include -#include -#include -#include +#include +#include +#include +#include +#include #include #include #include +#include #include -#include #include -#include +#include +#include #include -#include -#include -#include -#include +#include #include -#include #include