CVS commit: src/usr.sbin/npf/npfctl
Module Name:src Committed By: ozaki-r Date: Mon Oct 30 04:53:43 UTC 2017 Modified Files: src/usr.sbin/npf/npfctl: npfctl.c Log Message: Fix showing translated port (ntohs-ed twice wrongly) To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/npf/npfctl/npfctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/npf/npfctl/npfctl.c diff -u src/usr.sbin/npf/npfctl/npfctl.c:1.53 src/usr.sbin/npf/npfctl/npfctl.c:1.54 --- src/usr.sbin/npf/npfctl/npfctl.c:1.53 Wed Jan 11 02:10:44 2017 +++ src/usr.sbin/npf/npfctl/npfctl.c Mon Oct 30 04:53:43 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: npfctl.c,v 1.53 2017/01/11 02:10:44 christos Exp $ */ +/* $NetBSD: npfctl.c,v 1.54 2017/10/30 04:53:43 ozaki-r Exp $ */ /*- * Copyright (c) 2009-2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: npfctl.c,v 1.53 2017/01/11 02:10:44 christos Exp $"); +__RCSID("$NetBSD: npfctl.c,v 1.54 2017/10/30 04:53:43 ozaki-r Exp $"); #include #include @@ -624,7 +624,7 @@ npfctl_conn_print(unsigned alen, const n fputc('\n', fp); return 1; } - fprintf(fp, " via %s:%d\n", ifname, ntohs(p[2])); + fprintf(fp, " via %s:%d\n", ifname, p[2]); return 1; }
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: pgoyette Date: Mon Oct 30 03:25:14 UTC 2017 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: Remove unneeded casts to (uintptr_t). This is already taken care of in the xxxHIST_LOG() macros. No need to pull-up to -8 - the extra cast really won't hurt anything. To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.40 src/sys/uvm/pmap/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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.39 src/sys/uvm/pmap/pmap.c:1.40 --- src/sys/uvm/pmap/pmap.c:1.39 Mon Oct 30 01:19:46 2017 +++ src/sys/uvm/pmap/pmap.c Mon Oct 30 03:25:14 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.39 2017/10/30 01:19:46 pgoyette Exp $ */ +/* $NetBSD: pmap.c,v 1.40 2017/10/30 03:25:14 pgoyette Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.39 2017/10/30 01:19:46 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.40 2017/10/30 03:25:14 pgoyette Exp $"); /* * Manages physical address maps. @@ -885,7 +885,7 @@ pmap_pte_remove(pmap_t pmap, vaddr_t sva UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist); UVMHIST_LOG(pmaphist, "(pmap=%#jx kernel=%c va=%#jx..%#jx)", - (uintmax_t)(uintptr_t)pmap, (is_kernel_pmap_p ? 1 : 0), sva, eva); + (uintptr_t)pmap, (is_kernel_pmap_p ? 1 : 0), sva, eva); UVMHIST_LOG(pmaphist, "ptep=%#jx, flags(npte)=%#jx", (uintptr_t)ptep, flags, 0, 0); @@ -1029,8 +1029,7 @@ pmap_pte_protect(pmap_t pmap, vaddr_t sv UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist); UVMHIST_LOG(pmaphist, "(pmap=%#jx kernel=%jx va=%#jx..%#jx)", - (uintmax_t)(uintptr_t)pmap, (pmap == pmap_kernel() ? 1 : 0), - sva, eva); + (uintptr_t)pmap, (pmap == pmap_kernel() ? 1 : 0), sva, eva); UVMHIST_LOG(pmaphist, "ptep=%#jx, flags(npte)=%#jx)", (uintptr_t)ptep, flags, 0, 0);
CVS commit: src/sys/net/npf
Module Name:src Committed By: ozaki-r Date: Mon Oct 30 03:02:35 UTC 2017 Modified Files: src/sys/net/npf: npf_ctl.c Log Message: Fix npfclt reload on rump kernels It fails because npfctl cannot get an errno when it calls ioctl to the (rump) kernel; npfctl (libnpf) expects that an errno is returned via proplib, however, the rump library of npf doesn't so. It happens because of mishandlings of complicate npf kernel options. PR kern/52643 To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/net/npf/npf_ctl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/net/npf/npf_ctl.c diff -u src/sys/net/npf/npf_ctl.c:1.48 src/sys/net/npf/npf_ctl.c:1.49 --- src/sys/net/npf/npf_ctl.c:1.48 Wed May 17 18:56:12 2017 +++ src/sys/net/npf/npf_ctl.c Mon Oct 30 03:02:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: npf_ctl.c,v 1.48 2017/05/17 18:56:12 christos Exp $ */ +/* $NetBSD: npf_ctl.c,v 1.49 2017/10/30 03:02:35 ozaki-r Exp $ */ /*- * Copyright (c) 2009-2014 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ #ifdef _KERNEL #include -__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.48 2017/05/17 18:56:12 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: npf_ctl.c,v 1.49 2017/10/30 03:02:35 ozaki-r Exp $"); #include #include @@ -630,15 +630,31 @@ fail: if (tblset) { npf_tableset_destroy(tblset); } - prop_object_release(npf_dict); +#if defined(_NPF_TESTING) || defined(_NPF_STANDALONE) + /* Free only if allocated by prop_dictionary_copyin_ioctl_size. */ + if (!npfctl_testing) +#endif + prop_object_release(npf_dict); - /* Error report. */ -#if !defined(_NPF_TESTING) && !defined(_NPF_STANDALONE) - prop_dictionary_set_int32(errdict, "errno", error); - prop_dictionary_copyout_ioctl(pref, cmd, errdict); - prop_object_release(errdict); - error = 0; + /* + * - _NPF_STANDALONE doesn't require to set prop. + * - For _NPF_TESTING, if npfctl_testing, setting prop isn't needed, + * otherwise it's needed. + */ +#ifndef _NPF_STANDALONE +#ifdef _NPF_TESTING + if (!npfctl_testing) { +#endif + /* Error report. */ + prop_dictionary_set_int32(errdict, "errno", error); + prop_dictionary_copyout_ioctl(pref, cmd, errdict); + error = 0; +#ifdef _NPF_TESTING + } #endif +#endif /* _NPF_STANDALONE */ + prop_object_release(errdict); + return error; }
CVS commit: src/sys/dev/pci
Module Name:src Committed By: sevan Date: Mon Oct 30 01:24:47 UTC 2017 Modified Files: src/sys/dev/pci: pcidevs Log Message: Add Areca ARC1214 & ARC1880. >From OpenBSD. To generate a diff of this commit: cvs rdiff -u -r1.1299 -r1.1300 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.1299 src/sys/dev/pci/pcidevs:1.1300 --- src/sys/dev/pci/pcidevs:1.1299 Fri Oct 20 12:01:43 2017 +++ src/sys/dev/pci/pcidevs Mon Oct 30 01:24:47 2017 @@ -1,4 +1,4 @@ -$NetBSD: pcidevs,v 1.1299 2017/10/20 12:01:43 christos Exp $ +$NetBSD: pcidevs,v 1.1300 2017/10/30 01:24:47 sevan Exp $ /* * Copyright (c) 1995, 1996 Christopher G. Demetriou @@ -1216,6 +1216,7 @@ product ARECA ARC1200 0x1200 ARC-1200 product ARECA ARC1200_B 0x1201 ARC-1200 rev B product ARECA ARC1202 0x1202 ARC-1202 product ARECA ARC1210 0x1210 ARC-1210 +product ARECA ARC1214 0x1214 ARC-1214 product ARECA ARC1220 0x1220 ARC-1220 product ARECA ARC1230 0x1230 ARC-1230 product ARECA ARC1260 0x1260 ARC-1260 @@ -1225,6 +1226,7 @@ product ARECA ARC1380 0x1380 ARC-1380 product ARECA ARC1381 0x1381 ARC-1381 product ARECA ARC1680 0x1680 ARC-1680 product ARECA ARC1681 0x1681 ARC-1681 +product ARECA ARC1880 0x1880 ARC-1880 /* ASIX Electronics products */ product ASIX AX88140A 0x1400 AX88140A 10/100 Ethernet
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: pgoyette Date: Mon Oct 30 01:19:46 UTC 2017 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: And replace an instance of "%p" conversion with "%#jx" To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.39 src/sys/uvm/pmap/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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.38 src/sys/uvm/pmap/pmap.c:1.39 --- src/sys/uvm/pmap/pmap.c:1.38 Mon Oct 30 00:55:42 2017 +++ src/sys/uvm/pmap/pmap.c Mon Oct 30 01:19:46 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.38 2017/10/30 00:55:42 kre Exp $ */ +/* $NetBSD: pmap.c,v 1.39 2017/10/30 01:19:46 pgoyette Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.38 2017/10/30 00:55:42 kre Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.39 2017/10/30 01:19:46 pgoyette Exp $"); /* * Manages physical address maps. @@ -884,7 +884,7 @@ pmap_pte_remove(pmap_t pmap, vaddr_t sva const bool is_kernel_pmap_p = (pmap == pmap_kernel()); UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist); - UVMHIST_LOG(pmaphist, "(pmap=%p kernel=%c va=%#jx..%#jx)", + UVMHIST_LOG(pmaphist, "(pmap=%#jx kernel=%c va=%#jx..%#jx)", (uintmax_t)(uintptr_t)pmap, (is_kernel_pmap_p ? 1 : 0), sva, eva); UVMHIST_LOG(pmaphist, "ptep=%#jx, flags(npte)=%#jx", (uintptr_t)ptep, flags, 0, 0);
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: kre Date: Mon Oct 30 00:55:42 UTC 2017 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: Remove a stray '"' (obvious typo) and add a couple of casts that are probably needed. To generate a diff of this commit: cvs rdiff -u -r1.37 -r1.38 src/sys/uvm/pmap/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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.37 src/sys/uvm/pmap/pmap.c:1.38 --- src/sys/uvm/pmap/pmap.c:1.37 Sat Oct 28 00:37:13 2017 +++ src/sys/uvm/pmap/pmap.c Mon Oct 30 00:55:42 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.37 2017/10/28 00:37:13 pgoyette Exp $ */ +/* $NetBSD: pmap.c,v 1.38 2017/10/30 00:55:42 kre Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.37 2017/10/28 00:37:13 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.38 2017/10/30 00:55:42 kre Exp $"); /* * Manages physical address maps. @@ -884,8 +884,8 @@ pmap_pte_remove(pmap_t pmap, vaddr_t sva const bool is_kernel_pmap_p = (pmap == pmap_kernel()); UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist); - UVMHIST_LOG(pmaphist, "(pmap=%p kernel=%c va=%#jx"..%#jx)", - pmap, (is_kernel_pmap_p ? 1 : 0), sva, eva); + UVMHIST_LOG(pmaphist, "(pmap=%p kernel=%c va=%#jx..%#jx)", + (uintmax_t)(uintptr_t)pmap, (is_kernel_pmap_p ? 1 : 0), sva, eva); UVMHIST_LOG(pmaphist, "ptep=%#jx, flags(npte)=%#jx", (uintptr_t)ptep, flags, 0, 0); @@ -1029,7 +1029,8 @@ pmap_pte_protect(pmap_t pmap, vaddr_t sv UVMHIST_FUNC(__func__); UVMHIST_CALLED(pmaphist); UVMHIST_LOG(pmaphist, "(pmap=%#jx kernel=%jx va=%#jx..%#jx)", - pmap, (pmap == pmap_kernel() ? 1 : 0), sva, eva); + (uintmax_t)(uintptr_t)pmap, (pmap == pmap_kernel() ? 1 : 0), + sva, eva); UVMHIST_LOG(pmaphist, "ptep=%#jx, flags(npte)=%#jx)", (uintptr_t)ptep, flags, 0, 0);
CVS commit: src/sys/dev
Module Name:src Committed By: riastradh Date: Sun Oct 29 17:57:21 UTC 2017 Modified Files: src/sys/dev: sequencer.c Log Message: Provisionally return to declaring midi_cd unconditionally. Apparently this breaks compiling some kernels, although how they ever managed to link if midi_cd is not declared in ioconf.h, and therefore presumably not defined in ioconf.c, is beyond me. Maybe someone who knows how sequencer is supposed to work, and/or someone who knows how arm kernels are linked, can figure this out... To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/dev/sequencer.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/sequencer.c diff -u src/sys/dev/sequencer.c:1.69 src/sys/dev/sequencer.c:1.70 --- src/sys/dev/sequencer.c:1.69 Sat Oct 28 04:16:04 2017 +++ src/sys/dev/sequencer.c Sun Oct 29 17:57:21 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: sequencer.c,v 1.69 2017/10/28 04:16:04 riastradh Exp $ */ +/* $NetBSD: sequencer.c,v 1.70 2017/10/29 17:57:21 riastradh Exp $ */ /* * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc. @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.69 2017/10/28 04:16:04 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sequencer.c,v 1.70 2017/10/29 17:57:21 riastradh Exp $"); #ifdef _KERNEL_OPT #include "sequencer.h" @@ -99,9 +99,13 @@ __KERNEL_RCSID(0, "$NetBSD: sequencer.c, * * XXX XXX XXX Apparently sequencer.ioconf doesn't actually make the * sequencer cdev! Did this ever work? + * + * XXX XXX XXX Apparently there are even some kernels that include a + * sequencer pseudo-device but exclude any midi device. How do they + * even link?? */ -#ifdef _MODULE extern struct cfdriver midi_cd; +#ifdef _MODULE extern struct cfdriver sequencer_cd; #endif
CVS commit: src/sys/arch/amd64/conf
Module Name:src Committed By: maxv Date: Sun Oct 29 17:19:14 UTC 2017 Modified Files: src/sys/arch/amd64/conf: GENERIC_KASLR Log Message: Mmh, we don't map the CTF section on kaslr kernels, so disable KDTRACE_HOOKS for now. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amd64/conf/GENERIC_KASLR 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/amd64/conf/GENERIC_KASLR diff -u src/sys/arch/amd64/conf/GENERIC_KASLR:1.2 src/sys/arch/amd64/conf/GENERIC_KASLR:1.3 --- src/sys/arch/amd64/conf/GENERIC_KASLR:1.2 Sun Oct 8 09:06:50 2017 +++ src/sys/arch/amd64/conf/GENERIC_KASLR Sun Oct 29 17:19:14 2017 @@ -1,6 +1,8 @@ -# $NetBSD: GENERIC_KASLR,v 1.2 2017/10/08 09:06:50 maxv Exp $ +# $NetBSD: GENERIC_KASLR,v 1.3 2017/10/29 17:19:14 maxv Exp $ include "arch/amd64/conf/GENERIC" +no options KDTRACE_HOOKS + makeoptions KASLR=1 # Kernel ASLR options KASLR
CVS commit: src/sys/arch
Module Name:src Committed By: jmcneill Date: Sun Oct 29 16:02:46 UTC 2017 Modified Files: src/sys/arch/arm/sunxi: sunxi_musb.c src/sys/arch/evbarm/conf: SUNXI Log Message: Create a custom bus space tag and use it to remap registers instead of relying on options MOTG_ALLWINNER. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_musb.c cvs rdiff -u -r1.49 -r1.50 src/sys/arch/evbarm/conf/SUNXI 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/sunxi/sunxi_musb.c diff -u src/sys/arch/arm/sunxi/sunxi_musb.c:1.1 src/sys/arch/arm/sunxi/sunxi_musb.c:1.2 --- src/sys/arch/arm/sunxi/sunxi_musb.c:1.1 Sat Sep 9 12:01:04 2017 +++ src/sys/arch/arm/sunxi/sunxi_musb.c Sun Oct 29 16:02:46 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_musb.c,v 1.1 2017/09/09 12:01:04 jmcneill Exp $ */ +/* $NetBSD: sunxi_musb.c,v 1.2 2017/10/29 16:02:46 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -26,8 +26,13 @@ * SUCH DAMAGE. */ +#include "opt_motg.h" +#ifdef MOTG_ALLWINNER +# error Do not define MOTG_ALLWINNER when using this driver +#endif + #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_musb.c,v 1.1 2017/09/09 12:01:04 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_musb.c,v 1.2 2017/10/29 16:02:46 jmcneill Exp $"); #include #include @@ -41,18 +46,23 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_musb.c #include #include #include +#include #include +#include + #define MUSB2_REG_AWIN_VEND0 0x43 -#define MUSB2_REG_INTTX 0x44 -#define MUSB2_REG_INTRX 0x46 -#define MUSB2_REG_INTUSB 0x4c static int sunxi_musb_match(device_t, cfdata_t, void *); static void sunxi_musb_attach(device_t, device_t, void *); -CFATTACH_DECL_NEW(sunxi_musb, sizeof(struct motg_softc), +struct sunxi_musb_softc { + struct motg_softc sc_otg; + struct bus_space sc_bs; +}; + +CFATTACH_DECL_NEW(sunxi_musb, sizeof(struct sunxi_musb_softc), sunxi_musb_match, sunxi_musb_attach, NULL, NULL); static const struct of_compat_data compat_data[] = { @@ -63,6 +73,217 @@ static const struct of_compat_data compa { NULL } }; +#define REMAPFLAG 0x8000 +#define REGDECL(a, b) [(a)] = ((b) | REMAPFLAG) + +/* Allwinner USB DRD register mappings */ +static const uint16_t sunxi_musb_regmap[] = { + REGDECL(MUSB2_REG_EPFIFO(0), 0x), + REGDECL(MUSB2_REG_EPFIFO(1), 0x0004), + REGDECL(MUSB2_REG_EPFIFO(2), 0x0008), + REGDECL(MUSB2_REG_EPFIFO(3), 0x000c), + REGDECL(MUSB2_REG_EPFIFO(4), 0x0010), + REGDECL(MUSB2_REG_EPFIFO(5), 0x0014), + REGDECL(MUSB2_REG_POWER, 0x0040), + REGDECL(MUSB2_REG_DEVCTL, 0x0041), + REGDECL(MUSB2_REG_EPINDEX, 0x0042), + REGDECL(MUSB2_REG_AWIN_VEND0, 0x0043), + REGDECL(MUSB2_REG_INTTX, 0x0044), + REGDECL(MUSB2_REG_INTRX, 0x0046), + REGDECL(MUSB2_REG_INTTXE, 0x0048), + REGDECL(MUSB2_REG_INTRXE, 0x004a), + REGDECL(MUSB2_REG_INTUSB, 0x004c), + REGDECL(MUSB2_REG_INTUSBE, 0x0050), + REGDECL(MUSB2_REG_FRAME, 0x0054), + REGDECL(MUSB2_REG_TESTMODE, 0x007c), + REGDECL(MUSB2_REG_TXMAXP, 0x0080), + REGDECL(MUSB2_REG_TXCSRL, 0x0082), + REGDECL(MUSB2_REG_TXCSRH, 0x0083), + REGDECL(MUSB2_REG_RXMAXP, 0x0084), + REGDECL(MUSB2_REG_RXCSRL, 0x0086), + REGDECL(MUSB2_REG_RXCSRH, 0x0087), + REGDECL(MUSB2_REG_RXCOUNT, 0x0088), + REGDECL(MUSB2_REG_TXTI, 0x008c), + REGDECL(MUSB2_REG_TXNAKLIMIT, 0x008d), + REGDECL(MUSB2_REG_RXNAKLIMIT, 0x008d), + REGDECL(MUSB2_REG_RXTI, 0x008e), + REGDECL(MUSB2_REG_TXFIFOSZ, 0x0090), + REGDECL(MUSB2_REG_TXFIFOADD, 0x0092), + REGDECL(MUSB2_REG_RXFIFOSZ, 0x0094), + REGDECL(MUSB2_REG_RXFIFOADD, 0x0096), + REGDECL(MUSB2_REG_FADDR, 0x0098), + REGDECL(MUSB2_REG_TXFADDR(0), 0x0098), + REGDECL(MUSB2_REG_TXHADDR(0), 0x009a), + REGDECL(MUSB2_REG_TXHUBPORT(0), 0x009b), + REGDECL(MUSB2_REG_RXFADDR(0), 0x009c), + REGDECL(MUSB2_REG_RXHADDR(0), 0x009e), + REGDECL(MUSB2_REG_RXHUBPORT(0), 0x009f), + REGDECL(MUSB2_REG_TXFADDR(1), 0x0098), + REGDECL(MUSB2_REG_TXHADDR(1), 0x009a), + REGDECL(MUSB2_REG_TXHUBPORT(1), 0x009b), + REGDECL(MUSB2_REG_RXFADDR(1), 0x009c), + REGDECL(MUSB2_REG_RXHADDR(1), 0x009e), + REGDECL(MUSB2_REG_RXHUBPORT(1), 0x009f), + REGDECL(MUSB2_REG_TXFADDR(2), 0x0098), + REGDECL(MUSB2_REG_TXHADDR(2), 0x009a), + REGDECL(MUSB2_REG_TXHUBPORT(2), 0x009b), + REGDECL(MUSB2_REG_RXFADDR(2), 0x009c), + REGDECL(MUSB2_REG_RXHADDR(2), 0x009e), + REGDECL(MUSB2_REG_RXHUBPORT(2), 0x009f), + REGDECL(MUSB2_REG_TXFADDR(3), 0x0098), + REGDECL(MUSB2_REG_TXHADDR(3), 0x009a), + REGDECL(MUSB2_REG_TXHUBPORT(3), 0x009b), + REGDECL(MUSB2_REG_RXFADDR(3), 0x009c), + REGDECL(MUSB2_REG_RXHADDR(3), 0x009e), + REGDECL(MUSB2_REG_RXHUBPORT(3), 0x009f), + REGDECL(MUSB2_REG_TXFADDR(4), 0x0098), + REGDECL(MUSB2_REG_TXHADDR(4), 0x009a), + REGDECL(MUSB2_REG_TXHUBPORT(4), 0x009b), + REGDECL(MUSB2_REG_RXFADDR(4), 0x009c), + REGDECL(MUSB2_REG_RXHADDR(4), 0x009e), + REGDECL(MUSB2_REG_RXHUBPORT(4), 0x009f), + REGDECL(MUSB2_REG_TXFADDR(5), 0x0098), + REGDECL(MUSB2_REG_TXHADDR(5), 0x00
CVS commit: src/external/bsd/nvi/dist
Module Name:src Committed By: christos Date: Sun Oct 29 15:29:34 UTC 2017 Modified Files: src/external/bsd/nvi/dist/common: multibyte.h src/external/bsd/nvi/dist/regex: regcomp.c Log Message: PR/52671: Ralph Geier: The ignorecase option is not handeled correctly in vi for unicode characters To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/nvi/dist/common/multibyte.h cvs rdiff -u -r1.5 -r1.6 src/external/bsd/nvi/dist/regex/regcomp.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/nvi/dist/common/multibyte.h diff -u src/external/bsd/nvi/dist/common/multibyte.h:1.2 src/external/bsd/nvi/dist/common/multibyte.h:1.3 --- src/external/bsd/nvi/dist/common/multibyte.h:1.2 Fri Nov 22 10:52:05 2013 +++ src/external/bsd/nvi/dist/common/multibyte.h Sun Oct 29 11:29:34 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: multibyte.h,v 1.2 2013/11/22 15:52:05 christos Exp $ */ +/* $NetBSD: multibyte.h,v 1.3 2017/10/29 15:29:34 christos Exp $ */ #ifndef MULTIBYTE_H #define MULTIBYTE_H @@ -53,6 +53,7 @@ typedef wint_t UCHAR_T; #define ISCNTRL iswcntrl #define ISGRAPH iswgraph #define ISLOWER iswlower +#define ISALPHA2 iswalpha #define ISPUNCT iswpunct #define ISSPACE iswspace #define ISUPPER iswupper @@ -86,6 +87,7 @@ typedef unsigned char UCHAR_T; #define ISCNTRL iscntrl #define ISGRAPH isgraph #define ISLOWER islower +#define ISALPHA2 isalpha #define ISPUNCT ispunct #define ISSPACE isspace #define ISUPPER isupper Index: src/external/bsd/nvi/dist/regex/regcomp.c diff -u src/external/bsd/nvi/dist/regex/regcomp.c:1.5 src/external/bsd/nvi/dist/regex/regcomp.c:1.6 --- src/external/bsd/nvi/dist/regex/regcomp.c:1.5 Sun Jan 26 16:47:00 2014 +++ src/external/bsd/nvi/dist/regex/regcomp.c Sun Oct 29 11:29:34 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: regcomp.c,v 1.5 2014/01/26 21:47:00 christos Exp $ */ +/* $NetBSD: regcomp.c,v 1.6 2017/10/29 15:29:34 christos Exp $ */ /*- * Copyright (c) 1992, 1993, 1994 Henry Spencer. * Copyright (c) 1992, 1993, 1994 @@ -44,7 +44,7 @@ static char sccsid[] = "@(#)regcomp.c 8.4 (Berkeley) 3/19/94"; #endif /* LIBC_SCCS and not lint */ #else -__RCSID("$NetBSD: regcomp.c,v 1.5 2014/01/26 21:47:00 christos Exp $"); +__RCSID("$NetBSD: regcomp.c,v 1.6 2017/10/29 15:29:34 christos Exp $"); #endif #include @@ -752,7 +752,7 @@ p_bracket(struct parse *p) int ci; for (i = p->g->csetsize - 1; i >= 0; i--) - if (CHIN(cs, i) && isalpha(i)) { + if (CHIN(cs, i) && ISALPHA2(i)) { ci = othercase(i); if (ci != i) CHadd(cs, ci); @@ -860,7 +860,7 @@ p_b_cclass(struct parse *p, cset *cs) const char *u; char c; - while (MORE() && isalpha(PEEK())) + while (MORE() && ISALPHA2(PEEK())) NEXT(); len = p->next - sp; for (cp = cclasses; cp->name != NULL; cp++) @@ -949,11 +949,11 @@ p_b_coll_elem(struct parse *p, int endc) static char /* if no counterpart, return ch */ othercase(int ch) { - assert(isalpha(ch)); - if (isupper(ch)) - return(tolower(ch)); - else if (islower(ch)) - return(toupper(ch)); + assert(ISALPHA2(ch)); + if (ISUPPER(ch)) + return(TOLOWER(ch)); + else if (ISLOWER(ch)) + return(TOUPPER(ch)); else /* peculiar, but could happen */ return(ch); } @@ -994,7 +994,7 @@ ordinary(struct parse *p, int ch) cat_t *cap = p->g->categories; */ - if ((p->g->cflags®_ICASE) && isalpha(ch) && othercase(ch) != ch) + if ((p->g->cflags®_ICASE) && ISALPHA2(ch) && othercase(ch) != ch) bothcases(p, ch); else { EMIT(OCHAR, (UCHAR_T)ch);
CVS commit: src/sys/arch
Module Name:src Committed By: jmcneill Date: Sun Oct 29 15:00:00 UTC 2017 Modified Files: src/sys/arch/arm/sunxi: sunxi_twi.c src/sys/arch/evbarm/conf: SUNXI Log Message: sunxi_twi: provide custom read/write reg callbacks and remove the GTTWSI_ALLWINNER option from the kernel config To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sunxi/sunxi_twi.c cvs rdiff -u -r1.48 -r1.49 src/sys/arch/evbarm/conf/SUNXI 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/sunxi/sunxi_twi.c diff -u src/sys/arch/arm/sunxi/sunxi_twi.c:1.5 src/sys/arch/arm/sunxi/sunxi_twi.c:1.6 --- src/sys/arch/arm/sunxi/sunxi_twi.c:1.5 Sat Oct 7 20:17:38 2017 +++ src/sys/arch/arm/sunxi/sunxi_twi.c Sun Oct 29 15:00:00 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_twi.c,v 1.5 2017/10/07 20:17:38 jmcneill Exp $ */ +/* $NetBSD: sunxi_twi.c,v 1.6 2017/10/29 15:00:00 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -26,9 +26,14 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#include "opt_gttwsi.h" +#ifdef GTTWSI_ALLWINNER +# error Do not define GTTWSI_ALLWINNER when using this driver +#endif + #include -__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.5 2017/10/07 20:17:38 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c,v 1.6 2017/10/29 15:00:00 jmcneill Exp $"); #include #include @@ -39,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c, #include #include +#include #include @@ -46,6 +52,16 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_twi.c, #define TWI_CCR_CLK_M __BITS(6,3) #define TWI_CCR_CLK_N __BITS(2,0) +static uint8_t sunxi_twi_regmap[] = { + [TWSI_SLAVEADDR] = 0x00, + [TWSI_EXTEND_SLAVEADDR] = 0x04, + [TWSI_DATA] = 0x08, + [TWSI_CONTROL] = 0x0c, + [TWSI_STATUS] = 0x10, + [TWSI_BAUDRATE] = 0x14, + [TWSI_SOFTRESET] = 0x18, +}; + static int sunxi_twi_match(device_t, cfdata_t, void *); static void sunxi_twi_attach(device_t, device_t, void *); @@ -82,6 +98,18 @@ const struct fdtbus_i2c_controller_func .get_tag = sunxi_twi_get_tag, }; +static uint32_t +sunxi_twi_reg_read(struct gttwsi_softc *sc, uint32_t reg) +{ + return bus_space_read_4(sc->sc_bust, sc->sc_bush, sunxi_twi_regmap[reg]); +} + +static void +sunxi_twi_reg_write(struct gttwsi_softc *sc, uint32_t reg, uint32_t val) +{ + bus_space_write_4(sc->sc_bust, sc->sc_bush, sunxi_twi_regmap[reg], val); +} + static int sunxi_twi_match(device_t parent, cfdata_t cf, void *aux) { @@ -149,6 +177,9 @@ sunxi_twi_attach(device_t parent, device __SHIFTIN(m, TWI_CCR_CLK_M); bus_space_write_4(bst, bsh, TWI_CCR_REG, ccr); + sc->sc_reg_read = sunxi_twi_reg_read; + sc->sc_reg_write = sunxi_twi_reg_write; + gttwsi_attach_subr(self, bst, bsh); ih = fdtbus_intr_establish(phandle, 0, IPL_VM, 0, gttwsi_intr, sc); Index: src/sys/arch/evbarm/conf/SUNXI diff -u src/sys/arch/evbarm/conf/SUNXI:1.48 src/sys/arch/evbarm/conf/SUNXI:1.49 --- src/sys/arch/evbarm/conf/SUNXI:1.48 Sun Oct 29 14:07:11 2017 +++ src/sys/arch/evbarm/conf/SUNXI Sun Oct 29 15:00:00 2017 @@ -1,5 +1,5 @@ # -# $NetBSD: SUNXI,v 1.48 2017/10/29 14:07:11 jmcneill Exp $ +# $NetBSD: SUNXI,v 1.49 2017/10/29 15:00:00 jmcneill Exp $ # # Allwinner sunxi family # @@ -170,7 +170,6 @@ com* at fdt? # UART # I2C sunxitwi* at fdt? # TWI -options GTTWSI_ALLWINNER # XXX this should be a driver flag sunxirsb* at fdt? # P2WI/RSB iic* at i2cbus? tcakp* at iic? # TI TCA8418 Keypad Scan IC
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: jmcneill Date: Sun Oct 29 14:59:05 UTC 2017 Modified Files: src/sys/dev/i2c: gttwsi_core.c gttwsivar.h Log Message: Allow drivers to provide their own read/write register functions. While here, sprinkle KASSERTs to verify that the i2c lock is held where it should be. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/i2c/gttwsi_core.c \ src/sys/dev/i2c/gttwsivar.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/gttwsi_core.c diff -u src/sys/dev/i2c/gttwsi_core.c:1.2 src/sys/dev/i2c/gttwsi_core.c:1.3 --- src/sys/dev/i2c/gttwsi_core.c:1.2 Sun Nov 23 13:37:27 2014 +++ src/sys/dev/i2c/gttwsi_core.c Sun Oct 29 14:59:05 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsi_core.c,v 1.2 2014/11/23 13:37:27 jmcneill Exp $ */ +/* $NetBSD: gttwsi_core.c,v 1.3 2017/10/29 14:59:05 jmcneill Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. * All rights reserved. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: gttwsi_core.c,v 1.2 2014/11/23 13:37:27 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: gttwsi_core.c,v 1.3 2017/10/29 14:59:05 jmcneill Exp $"); #include "locators.h" #include @@ -94,7 +94,7 @@ static int gttwsi_write_byte(void *v, ui static int gttwsi_wait(struct gttwsi_softc *, uint32_t, uint32_t, int); static inline uint32_t -gttwsi_read_4(struct gttwsi_softc *sc, uint32_t reg) +gttwsi_default_read_4(struct gttwsi_softc *sc, uint32_t reg) { uint32_t val = bus_space_read_4(sc->sc_bust, sc->sc_bush, reg); #ifdef TWSI_DEBUG @@ -106,7 +106,7 @@ gttwsi_read_4(struct gttwsi_softc *sc, u } static inline void -gttwsi_write_4(struct gttwsi_softc *sc, uint32_t reg, uint32_t val) +gttwsi_default_write_4(struct gttwsi_softc *sc, uint32_t reg, uint32_t val) { bus_space_write_4(sc->sc_bust, sc->sc_bush, reg, val); #ifdef TWSI_DEBUG @@ -117,7 +117,17 @@ gttwsi_write_4(struct gttwsi_softc *sc, return; } +static inline uint32_t +gttwsi_read_4(struct gttwsi_softc *sc, uint32_t reg) +{ + return sc->sc_reg_read(sc, reg); +} +static inline void +gttwsi_write_4(struct gttwsi_softc *sc, uint32_t reg, uint32_t val) +{ + return sc->sc_reg_write(sc, reg, val); +} /* ARGSUSED */ void @@ -133,6 +143,11 @@ gttwsi_attach_subr(device_t self, bus_sp sc->sc_bust = iot; sc->sc_bush = ioh; + if (sc->sc_reg_read == NULL) + sc->sc_reg_read = gttwsi_default_read_4; + if (sc->sc_reg_write == NULL) + sc->sc_reg_write = gttwsi_default_write_4; + mutex_init(&sc->sc_buslock, MUTEX_DEFAULT, IPL_NONE); mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_BIO); cv_init(&sc->sc_cv, device_xname(self)); @@ -213,6 +228,8 @@ gttwsi_send_start(void *v, int flags) struct gttwsi_softc *sc = v; int expect; + KASSERT(mutex_owned(&sc->sc_buslock)); + if (sc->sc_started) expect = STAT_RSCT; else @@ -228,6 +245,8 @@ gttwsi_send_stop(void *v, int flags) int retry = TWSI_RETRY_COUNT; uint32_t control; + KASSERT(mutex_owned(&sc->sc_buslock)); + sc->sc_started = false; /* Interrupt is not generated for STAT_NRS. */ @@ -253,6 +272,8 @@ gttwsi_initiate_xfer(void *v, i2c_addr_t uint32_t data, expect; int error, read; + KASSERT(mutex_owned(&sc->sc_buslock)); + gttwsi_send_start(v, flags); read = (flags & I2C_F_READ) != 0; @@ -297,6 +318,8 @@ gttwsi_read_byte(void *v, uint8_t *valp, struct gttwsi_softc *sc = v; int error; + KASSERT(mutex_owned(&sc->sc_buslock)); + if (flags & I2C_F_LAST) error = gttwsi_wait(sc, 0, STAT_MRRD_ANT, flags); else @@ -314,6 +337,8 @@ gttwsi_write_byte(void *v, uint8_t val, struct gttwsi_softc *sc = v; int error; + KASSERT(mutex_owned(&sc->sc_buslock)); + gttwsi_write_4(sc, TWSI_DATA, val); error = gttwsi_wait(sc, 0, STAT_MTDB_AR, flags); if (flags & I2C_F_STOP) @@ -328,6 +353,8 @@ gttwsi_wait(struct gttwsi_softc *sc, uin uint32_t status; int timo, error = 0; + KASSERT(mutex_owned(&sc->sc_buslock)); + DELAY(5); if (!(flags & I2C_F_POLL)) control |= CONTROL_INTEN; Index: src/sys/dev/i2c/gttwsivar.h diff -u src/sys/dev/i2c/gttwsivar.h:1.2 src/sys/dev/i2c/gttwsivar.h:1.3 --- src/sys/dev/i2c/gttwsivar.h:1.2 Sun Nov 23 13:37:27 2014 +++ src/sys/dev/i2c/gttwsivar.h Sun Oct 29 14:59:05 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: gttwsivar.h,v 1.2 2014/11/23 13:37:27 jmcneill Exp $ */ +/* $NetBSD: gttwsivar.h,v 1.3 2017/10/29 14:59:05 jmcneill Exp $ */ /* * Copyright (c) 2008 Eiji Kawauchi. * All rights reserved. @@ -89,6 +89,9 @@ struct gttwsi_softc { kcondvar_t sc_cv; bool sc_iflg_rwc; + + uint32_t (*sc_reg_read)(struct gttwsi_softc *, uint32_t); + void (*sc_reg_write)(struct gttwsi_softc *, uint32_t, uint32_t); }; void gttwsi_attach_subr(device_t, bus_space_tag_t, bus_space_handle_t);
CVS commit: src/sys/arch
Module Name:src Committed By: jmcneill Date: Sun Oct 29 14:07:11 UTC 2017 Modified Files: src/sys/arch/arm/sunxi: sunxi_com.c src/sys/arch/evbarm/conf: SUNXI Log Message: remove options COM_AWIN and set COM_TYPE_SUNXI in the bus driver instead To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sunxi/sunxi_com.c cvs rdiff -u -r1.47 -r1.48 src/sys/arch/evbarm/conf/SUNXI 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/sunxi/sunxi_com.c diff -u src/sys/arch/arm/sunxi/sunxi_com.c:1.3 src/sys/arch/arm/sunxi/sunxi_com.c:1.4 --- src/sys/arch/arm/sunxi/sunxi_com.c:1.3 Mon Oct 23 21:03:24 2017 +++ src/sys/arch/arm/sunxi/sunxi_com.c Sun Oct 29 14:07:11 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: sunxi_com.c,v 1.3 2017/10/23 21:03:24 jmcneill Exp $ */ +/* $NetBSD: sunxi_com.c,v 1.4 2017/10/29 14:07:11 jmcneill Exp $ */ /*- * Copyright (c) 2017 Jared McNeill @@ -28,7 +28,7 @@ #include -__KERNEL_RCSID(1, "$NetBSD: sunxi_com.c,v 1.3 2017/10/23 21:03:24 jmcneill Exp $"); +__KERNEL_RCSID(1, "$NetBSD: sunxi_com.c,v 1.4 2017/10/29 14:07:11 jmcneill Exp $"); #include #include @@ -122,7 +122,7 @@ sunxi_com_attach(device_t parent, device } sc->sc_frequency = clk_get_rate(ssc->ssc_clk); - sc->sc_type = COM_TYPE_NORMAL; + sc->sc_type = COM_TYPE_SUNXI; error = bus_space_map(bst, addr, size, 0, &bsh); if (error) { @@ -174,7 +174,7 @@ sunxi_com_console_consinit(struct fdt_at speed = 115200; /* default */ flags = fdtbus_get_stdout_flags(); - if (comcnattach(bst, addr, speed, uart_freq, COM_TYPE_NORMAL, flags)) + if (comcnattach(bst, addr, speed, uart_freq, COM_TYPE_SUNXI, flags)) panic("Cannot initialize sunxi com console"); } Index: src/sys/arch/evbarm/conf/SUNXI diff -u src/sys/arch/evbarm/conf/SUNXI:1.47 src/sys/arch/evbarm/conf/SUNXI:1.48 --- src/sys/arch/evbarm/conf/SUNXI:1.47 Sat Oct 28 10:54:18 2017 +++ src/sys/arch/evbarm/conf/SUNXI Sun Oct 29 14:07:11 2017 @@ -1,5 +1,5 @@ # -# $NetBSD: SUNXI,v 1.47 2017/10/28 10:54:18 jmcneill Exp $ +# $NetBSD: SUNXI,v 1.48 2017/10/29 14:07:11 jmcneill Exp $ # # Allwinner sunxi family # @@ -167,7 +167,6 @@ ukphy* at mii? phy ? # UART com* at fdt? # UART -options COM_AWIN # XXX this should be a driver flag # I2C sunxitwi* at fdt? # TWI
CVS commit: src/sys/dev/ic
Module Name:src Committed By: jmcneill Date: Sun Oct 29 14:06:08 UTC 2017 Modified Files: src/sys/dev/ic: com.c comreg.h comvar.h ns16550reg.h Log Message: Make all of the COM_xxx type options runtime selectable. Kernel configs with the existing options (COM_16650, COM_16750, COM_AWIN, COM_HAYESP, and COM_PXA2X0) will select the correct type in com_attach_subr. New code should specify the com type by passing COM_TYPE_xxx to comcnattach and/or setting sc_type. To generate a diff of this commit: cvs rdiff -u -r1.343 -r1.344 src/sys/dev/ic/com.c cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/comreg.h cvs rdiff -u -r1.83 -r1.84 src/sys/dev/ic/comvar.h cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/ns16550reg.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/com.c diff -u src/sys/dev/ic/com.c:1.343 src/sys/dev/ic/com.c:1.344 --- src/sys/dev/ic/com.c:1.343 Sat Oct 28 04:53:55 2017 +++ src/sys/dev/ic/com.c Sun Oct 29 14:06:08 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: com.c,v 1.343 2017/10/28 04:53:55 riastradh Exp $ */ +/* $NetBSD: com.c,v 1.344 2017/10/29 14:06:08 jmcneill Exp $ */ /*- * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.343 2017/10/28 04:53:55 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.344 2017/10/29 14:06:08 jmcneill Exp $"); #include "opt_com.h" #include "opt_ddb.h" @@ -122,9 +122,7 @@ __KERNEL_RCSID(0, "$NetBSD: com.c,v 1.34 #include #include #include -#ifdef COM_HAYESP #include -#endif #define com_lcr com_cfcr #include @@ -252,20 +250,12 @@ void com_kgdb_putc(void *, int); #ifdef COM_REGMAP /* initializer for typical 16550-ish hardware */ -#define COM_REG_16550 { \ - com_data, com_data, com_dlbl, com_dlbh, com_ier, com_iir, com_fifo, \ - com_efr, com_lcr, com_mcr, com_lsr, com_msr } -/* 16750-specific register set, additional UART status register */ -#define COM_REG_16750 { \ +#define COM_REG_STD { \ com_data, com_data, com_dlbl, com_dlbh, com_ier, com_iir, com_fifo, \ com_efr, com_lcr, com_mcr, com_lsr, com_msr, 0, 0, 0, 0, 0, 0, 0, 0, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, com_usr } -#ifdef COM_16750 -const bus_size_t com_std_map[32] = COM_REG_16750; -#else -const bus_size_t com_std_map[16] = COM_REG_16550; -#endif /* COM_16750 */ +const bus_size_t com_std_map[32] = COM_REG_STD; #endif /* COM_REGMAP */ #define COMDIALOUT_MASK TTDIALOUT_MASK @@ -393,9 +383,7 @@ com_attach_subr(struct com_softc *sc) { struct com_regs *regsp = &sc->sc_regs; struct tty *tp; -#if defined(COM_16650) || defined(COM_16750) u_int8_t lcr; -#endif const char *fifo_msg = NULL; prop_dictionary_t dict; bool is_console = true; @@ -407,6 +395,18 @@ com_attach_subr(struct com_softc *sc) callout_init(&sc->sc_diag_callout, 0); mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_HIGH); +#if defined(COM_16650) + sc->sc_type = COM_TYPE_16650; +#elif defined(COM_16750) + sc->sc_type = COM_TYPE_16750; +#elif defined(COM_AWIN) + sc->sc_type = COM_TYPE_SUNXI; +#elif defined(COM_HAYESP) + sc->sc_type = COM_TYPE_HAYESP; +#elif defined(COM_PXA2X0) + sc->sc_type = COM_TYPE_PXA2x0; +#endif + /* Disable interrupts before configuring the device. */ if (sc->sc_type == COM_TYPE_PXA2x0) sc->sc_ier = IER_EUART; @@ -424,10 +424,13 @@ com_attach_subr(struct com_softc *sc) (u_long)comcons_info.regs.cr_iobase); } -#if defined(COM_16750) || defined(COM_AWIN) - /* Use in comintr(). */ - sc->sc_lcr = cflag2lcr(comcons_info.cflag); -#endif + switch (sc->sc_type) { + case COM_TYPE_16750: + case COM_TYPE_SUNXI: + /* Use in comintr(). */ + sc->sc_lcr = cflag2lcr(comcons_info.cflag); + break; + } /* Make sure the console is always "hardwired". */ delay(1); /* wait for output to finish */ @@ -501,7 +504,8 @@ com_attach_subr(struct com_softc *sc) == FIFO_TRIGGER_14) { SET(sc->sc_hwflags, COM_HW_FIFO); -#ifdef COM_16650 + fifo_msg = "ns16550a, working fifo"; + /* * IIR changes into the EFR if LCR is set to LCR_EERS * on 16650s. We also know IIR != 0 at this point. @@ -513,23 +517,32 @@ com_attach_subr(struct com_softc *sc) * setting DLAB enable gives access to the EFR on * these chips. */ - lcr = CSR_READ_1(regsp, COM_REG_LCR); - CSR_WRITE_1(regsp, COM_REG_LCR, LCR_EERS); - CSR_WRITE_1(regsp, COM_REG_EFR, 0); - if (CSR_READ_1(regsp, COM_REG_EFR) == 0) { -CSR_WRITE_1(regsp, COM_REG_LCR, lcr | LCR_DLAB); + if (sc->sc_type == COM_TYPE_16650) { +lcr = CSR_READ_1(regsp, COM_REG_LCR); +CSR_WRITE_1(regsp, COM_REG_LCR, LCR_EERS); +CSR_WRITE_1(regsp, COM_REG_EFR, 0); if (CSR_READ_1(regsp, COM_REG_EFR) == 0) { - CLR(sc->sc_hwflags, COM_HW_FIFO); - sc->sc_fifolen = 0; -} else { - SET(sc->sc_hwflags, COM_HW_FLOW); - sc->sc_fifolen = 32; -} - } else -#endif -sc
CVS commit: src/sys/arch/amd64/stand/prekern
Module Name:src Committed By: maxv Date: Sun Oct 29 11:38:43 UTC 2017 Modified Files: src/sys/arch/amd64/stand/prekern: elf.c mm.c Log Message: Fix a few error messages, and be a little more verbose. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amd64/stand/prekern/elf.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amd64/stand/prekern/mm.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/amd64/stand/prekern/elf.c diff -u src/sys/arch/amd64/stand/prekern/elf.c:1.4 src/sys/arch/amd64/stand/prekern/elf.c:1.5 --- src/sys/arch/amd64/stand/prekern/elf.c:1.4 Sun Oct 29 11:28:30 2017 +++ src/sys/arch/amd64/stand/prekern/elf.c Sun Oct 29 11:38:43 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: elf.c,v 1.4 2017/10/29 11:28:30 maxv Exp $ */ +/* $NetBSD: elf.c,v 1.5 2017/10/29 11:38:43 maxv Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved. @@ -285,7 +285,7 @@ elf_build_head(vaddr_t headva) eif.shdr = (Elf_Shdr *)((uint8_t *)eif.ehdr + eif.ehdr->e_shoff); if (elf_check_header() == -1) { - fatal("elf_build_info: wrong kernel ELF header"); + fatal("elf_build_head: wrong kernel ELF header"); } } @@ -508,10 +508,10 @@ elf_build_boot(vaddr_t bootva, paddr_t b /* Locate the section names */ j = eif.ehdr->e_shstrndx; if (j == SHN_UNDEF) { - fatal("elf_build_info: shstrtab not found"); + fatal("elf_build_boot: shstrtab not found"); } if (j >= eif.ehdr->e_shnum) { - fatal("elf_build_info: wrong shstrtab index"); + fatal("elf_build_boot: wrong shstrtab index"); } eif.shstrtab = (char *)((uint8_t *)eif.ehdr + eif.shdr[j].sh_offset); eif.shstrsz = eif.shdr[j].sh_size; @@ -522,7 +522,7 @@ elf_build_boot(vaddr_t bootva, paddr_t b break; } if (i == eif.ehdr->e_shnum) { - fatal("elf_build_info: symtab not found"); + fatal("elf_build_boot: symtab not found"); } eif.symtab = (Elf_Sym *)((uint8_t *)eif.ehdr + eif.shdr[i].sh_offset); eif.symcnt = eif.shdr[i].sh_size / sizeof(Elf_Sym); @@ -530,10 +530,10 @@ elf_build_boot(vaddr_t bootva, paddr_t b /* Also locate the string table */ j = eif.shdr[i].sh_link; if (j == SHN_UNDEF || j >= eif.ehdr->e_shnum) { - fatal("elf_build_info: wrong strtab index"); + fatal("elf_build_boot: wrong strtab index"); } if (eif.shdr[j].sh_type != SHT_STRTAB) { - fatal("elf_build_info: wrong strtab type"); + fatal("elf_build_boot: wrong strtab type"); } eif.strtab = (char *)((uint8_t *)eif.ehdr + eif.shdr[j].sh_offset); eif.strsz = eif.shdr[j].sh_size; Index: src/sys/arch/amd64/stand/prekern/mm.c diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.6 src/sys/arch/amd64/stand/prekern/mm.c:1.7 --- src/sys/arch/amd64/stand/prekern/mm.c:1.6 Sun Oct 29 11:28:30 2017 +++ src/sys/arch/amd64/stand/prekern/mm.c Sun Oct 29 11:38:43 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: mm.c,v 1.6 2017/10/29 11:28:30 maxv Exp $ */ +/* $NetBSD: mm.c,v 1.7 2017/10/29 11:38:43 maxv Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved. @@ -385,7 +385,10 @@ mm_map_kernel() { memset(&bootspace, 0, sizeof(bootspace)); mm_map_head(); + print_state(true, "Head region mapped"); mm_map_segments(); + print_state(true, "Segments mapped"); mm_map_boot(); + print_state(true, "Boot region mapped"); }
CVS commit: src/sys/arch/amd64/stand/prekern
Module Name:src Committed By: maxv Date: Sun Oct 29 11:28:30 UTC 2017 Modified Files: src/sys/arch/amd64/stand/prekern: elf.c locore.S mm.c prekern.c prekern.h Log Message: Randomize the kernel segments independently. That is to say, put text, rodata and data at different addresses (and in a random order). To achieve that, the mapping order in the prekern is changed. Until now, we were creating the kernel map the following way: -> choose a random VA -> map [kernpa_start; kernpa_end[ at this VA -> parse the ELF structures from there -> determine where exactly the kernel segments are located -> relocate etc Now, we are doing: -> create a read-only view of [kernpa_start; kernpa_end[ -> from this view, compute the size of the "head" region -> choose a random VA in the HEAD window, and map the head there -> for each region in (text, rodata, data, boot) -> compute the size of the region from the RO view -> choose a random VA in the KASLR window -> map the region there -> relocate etc Each time we map a region, we initialize its bootspace fields right away. The "head" region must be put before the other regions in memory, because the kernel uses (headva + sh_offset) to get the addresses of the symbols, and the offset is unsigned. Given that the head does not have an mcmodel constraint, its location is randomized in a window located below the KASLR window. The rest of the regions being in the same window, we need to detect collisions. Note that the module map is embedded in the "boot" region, and that therefore its location is randomized too. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/stand/prekern/elf.c cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amd64/stand/prekern/locore.S \ src/sys/arch/amd64/stand/prekern/prekern.c \ src/sys/arch/amd64/stand/prekern/prekern.h cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amd64/stand/prekern/mm.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/amd64/stand/prekern/elf.c diff -u src/sys/arch/amd64/stand/prekern/elf.c:1.3 src/sys/arch/amd64/stand/prekern/elf.c:1.4 --- src/sys/arch/amd64/stand/prekern/elf.c:1.3 Sun Oct 29 10:07:08 2017 +++ src/sys/arch/amd64/stand/prekern/elf.c Sun Oct 29 11:28:30 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: elf.c,v 1.3 2017/10/29 10:07:08 maxv Exp $ */ +/* $NetBSD: elf.c,v 1.4 2017/10/29 11:28:30 maxv Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved. @@ -56,6 +56,8 @@ struct elfinfo { } data; }; +extern paddr_t kernpa_start, kernpa_end; + static struct elfinfo eif; static const char entrypoint[] = "start_prekern"; @@ -256,6 +258,37 @@ elf_apply_reloc(uintptr_t relocbase, con } } +/* -- */ + +size_t +elf_get_head_size(vaddr_t headva) +{ + Elf_Ehdr *ehdr; + Elf_Shdr *shdr; + size_t size; + + ehdr = (Elf_Ehdr *)headva; + shdr = (Elf_Shdr *)((uint8_t *)ehdr + ehdr->e_shoff); + + size = (vaddr_t)shdr + (vaddr_t)(ehdr->e_shnum * sizeof(Elf_Shdr)) - + (vaddr_t)ehdr; + + return roundup(size, PAGE_SIZE); +} + +void +elf_build_head(vaddr_t headva) +{ + memset(&eif, 0, sizeof(struct elfinfo)); + + eif.ehdr = (Elf_Ehdr *)headva; + eif.shdr = (Elf_Shdr *)((uint8_t *)eif.ehdr + eif.ehdr->e_shoff); + + if (elf_check_header() == -1) { + fatal("elf_build_info: wrong kernel ELF header"); + } +} + static bool elf_section_is_text(Elf_Shdr *shdr) { @@ -296,20 +329,180 @@ elf_section_is_data(Elf_Shdr *shdr) return true; } -static void -elf_build_info(vaddr_t baseva) +void +elf_get_text(paddr_t *pa, size_t *sz) { - vaddr_t secva, minva, maxva; - size_t secsz; - size_t i, j; + const paddr_t basepa = kernpa_start; + paddr_t minpa, maxpa, secpa; + size_t i, secsz; - memset(&eif, 0, sizeof(struct elfinfo)); + minpa = 0x, maxpa = 0; + for (i = 0; i < eif.ehdr->e_shnum; i++) { + if (!elf_section_is_text(&eif.shdr[i])) { + continue; + } + secpa = basepa + eif.shdr[i].sh_offset; + secsz = eif.shdr[i].sh_size; + if (secpa < minpa) { + minpa = secpa; + } + if (secpa + secsz > maxpa) { + maxpa = secpa + secsz; + } + } + ASSERT(minpa % PAGE_SIZE == 0); - eif.ehdr = (Elf_Ehdr *)baseva; - eif.shdr = (Elf_Shdr *)((uint8_t *)eif.ehdr + eif.ehdr->e_shoff); + *pa = minpa; + *sz = roundup(maxpa - minpa, PAGE_SIZE); +} - if (elf_check_header(&eif) == -1) { - fatal("elf_build_info: wrong kernel ELF header"); +void +elf_build_text(vaddr_t textva, paddr_t textpa, size_t textsz) +{ + const paddr_t basepa = kernpa_start; + const vaddr_t headva = (vaddr_t)eif.ehdr; + size_t i, offtext; + + eif.text.va = textva; + eif.text.sz = textsz; + + for (i = 0; i < eif.ehdr->e_shnum; i++) { + if (!elf_section_is_text(&eif.shdr[i])) { + contin
CVS commit: src/sys/arch/amd64/amd64
Module Name:src Committed By: maxv Date: Sun Oct 29 10:25:28 UTC 2017 Modified Files: src/sys/arch/amd64/amd64: machdep.c Log Message: Use bootspace.head.va instead of the direct map. Otherwise there's the assumption that the offsets contained in sh_offset in physical memory are equal to the offsets in virtual memory, which won't be true in the future. To generate a diff of this commit: cvs rdiff -u -r1.273 -r1.274 src/sys/arch/amd64/amd64/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/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.273 src/sys/arch/amd64/amd64/machdep.c:1.274 --- src/sys/arch/amd64/amd64/machdep.c:1.273 Sun Oct 29 10:01:21 2017 +++ src/sys/arch/amd64/amd64/machdep.c Sun Oct 29 10:25:28 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.273 2017/10/29 10:01:21 maxv Exp $ */ +/* $NetBSD: machdep.c,v 1.274 2017/10/29 10:25:28 maxv Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 @@ -110,7 +110,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.273 2017/10/29 10:01:21 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.274 2017/10/29 10:25:28 maxv Exp $"); /* #define XENDEBUG_LOW */ @@ -1481,8 +1481,8 @@ init_x86_64_ksyms(void) symtab = lookup_bootinfo(BTINFO_SYMTAB); if (symtab) { #ifdef KASLR - tssym = PMAP_DIRECT_MAP((paddr_t)symtab->ssym); - tesym = PMAP_DIRECT_MAP((paddr_t)symtab->esym); + tssym = bootspace.head.va; + tesym = bootspace.head.va; /* (unused...) */ #else tssym = (vaddr_t)symtab->ssym + KERNBASE; tesym = (vaddr_t)symtab->esym + KERNBASE;
CVS commit: src/sys/arch/amd64/stand/prekern
Module Name:src Committed By: maxv Date: Sun Oct 29 10:07:08 UTC 2017 Modified Files: src/sys/arch/amd64/stand/prekern: elf.c Log Message: Add three functions and start using them; will be more useful soon. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amd64/stand/prekern/elf.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/stand/prekern/elf.c diff -u src/sys/arch/amd64/stand/prekern/elf.c:1.2 src/sys/arch/amd64/stand/prekern/elf.c:1.3 --- src/sys/arch/amd64/stand/prekern/elf.c:1.2 Wed Oct 11 16:21:06 2017 +++ src/sys/arch/amd64/stand/prekern/elf.c Sun Oct 29 10:07:08 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: elf.c,v 1.2 2017/10/11 16:21:06 maxv Exp $ */ +/* $NetBSD: elf.c,v 1.3 2017/10/29 10:07:08 maxv Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved. @@ -256,6 +256,46 @@ elf_apply_reloc(uintptr_t relocbase, con } } +static bool +elf_section_is_text(Elf_Shdr *shdr) +{ + if (shdr->sh_type != SHT_NOBITS && + shdr->sh_type != SHT_PROGBITS) { + return false; + } + if (!(shdr->sh_flags & SHF_EXECINSTR)) { + return false; + } + return true; +} + +static bool +elf_section_is_rodata(Elf_Shdr *shdr) +{ + if (shdr->sh_type != SHT_NOBITS && + shdr->sh_type != SHT_PROGBITS) { + return false; + } + if (shdr->sh_flags & (SHF_EXECINSTR|SHF_WRITE)) { + return false; + } + return true; +} + +static bool +elf_section_is_data(Elf_Shdr *shdr) +{ + if (shdr->sh_type != SHT_NOBITS && + shdr->sh_type != SHT_PROGBITS) { + return false; + } + if (!(shdr->sh_flags & SHF_WRITE) || + (shdr->sh_flags & SHF_EXECINSTR)) { + return false; + } + return true; +} + static void elf_build_info(vaddr_t baseva) { @@ -314,11 +354,7 @@ elf_build_info(vaddr_t baseva) /* text */ minva = 0x, maxva = 0; for (i = 0; i < eif.ehdr->e_shnum; i++) { - if (eif.shdr[i].sh_type != SHT_NOBITS && - eif.shdr[i].sh_type != SHT_PROGBITS) { - continue; - } - if (!(eif.shdr[i].sh_flags & SHF_EXECINSTR)) { + if (!elf_section_is_text(&eif.shdr[i])) { continue; } secva = baseva + eif.shdr[i].sh_offset; @@ -337,11 +373,7 @@ elf_build_info(vaddr_t baseva) /* rodata */ minva = 0x, maxva = 0; for (i = 0; i < eif.ehdr->e_shnum; i++) { - if (eif.shdr[i].sh_type != SHT_NOBITS && - eif.shdr[i].sh_type != SHT_PROGBITS) { - continue; - } - if ((eif.shdr[i].sh_flags & (SHF_EXECINSTR|SHF_WRITE))) { + if (!elf_section_is_rodata(&eif.shdr[i])) { continue; } secva = baseva + eif.shdr[i].sh_offset; @@ -360,12 +392,7 @@ elf_build_info(vaddr_t baseva) /* data */ minva = 0x, maxva = 0; for (i = 0; i < eif.ehdr->e_shnum; i++) { - if (eif.shdr[i].sh_type != SHT_NOBITS && - eif.shdr[i].sh_type != SHT_PROGBITS) { - continue; - } - if (!(eif.shdr[i].sh_flags & SHF_WRITE) || - (eif.shdr[i].sh_flags & SHF_EXECINSTR)) { + if (!elf_section_is_data(&eif.shdr[i])) { continue; } secva = baseva + eif.shdr[i].sh_offset;
CVS commit: src/sys/arch
Module Name:src Committed By: maxv Date: Sun Oct 29 10:01:22 UTC 2017 Modified Files: src/sys/arch/amd64/amd64: machdep.c src/sys/arch/amd64/stand/prekern: prekern.c prekern.h src/sys/arch/i386/i386: machdep.c src/sys/arch/x86/include: pmap.h src/sys/arch/x86/x86: pmap.c x86_machdep.c Log Message: Add a fifth region, called "head". On kaslr kernels it contains the ELF Header and the ELF Section Headers. On normal kernels it is empty (the headers are in the "boot" region). Note: if you're using GENERIC_KASLR, you also need to rebuild the prekern. To generate a diff of this commit: cvs rdiff -u -r1.272 -r1.273 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/stand/prekern/prekern.c \ src/sys/arch/amd64/stand/prekern/prekern.h cvs rdiff -u -r1.796 -r1.797 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.69 -r1.70 src/sys/arch/x86/include/pmap.h cvs rdiff -u -r1.262 -r1.263 src/sys/arch/x86/x86/pmap.c cvs rdiff -u -r1.100 -r1.101 src/sys/arch/x86/x86/x86_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/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.272 src/sys/arch/amd64/amd64/machdep.c:1.273 --- src/sys/arch/amd64/amd64/machdep.c:1.272 Sat Oct 21 06:55:54 2017 +++ src/sys/arch/amd64/amd64/machdep.c Sun Oct 29 10:01:21 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.272 2017/10/21 06:55:54 maxv Exp $ */ +/* $NetBSD: machdep.c,v 1.273 2017/10/29 10:01:21 maxv Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 @@ -110,7 +110,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.272 2017/10/21 06:55:54 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.273 2017/10/29 10:01:21 maxv Exp $"); /* #define XENDEBUG_LOW */ @@ -1510,6 +1510,10 @@ init_bootspace(void) memset(&bootspace, 0, sizeof(bootspace)); + bootspace.head.va = KERNTEXTOFF; + bootspace.head.pa = KERNTEXTOFF - KERNBASE; + bootspace.head.sz = 0; + bootspace.text.va = KERNTEXTOFF; bootspace.text.pa = KERNTEXTOFF - KERNBASE; bootspace.text.sz = (size_t)&__rodata_start - KERNTEXTOFF; @@ -2004,6 +2008,13 @@ mm_md_kernacc(void *ptr, vm_prot_t prot, const vaddr_t v = (vaddr_t)ptr; vaddr_t kva, kva_end; + kva = bootspace.head.va; + kva_end = kva + bootspace.head.sz; + if (v >= kva && v < kva_end) { + *handled = true; + return 0; + } + kva = bootspace.text.va; kva_end = kva + bootspace.text.sz; if (v >= kva && v < kva_end) { Index: src/sys/arch/amd64/stand/prekern/prekern.c diff -u src/sys/arch/amd64/stand/prekern/prekern.c:1.1 src/sys/arch/amd64/stand/prekern/prekern.c:1.2 --- src/sys/arch/amd64/stand/prekern/prekern.c:1.1 Tue Oct 10 09:29:14 2017 +++ src/sys/arch/amd64/stand/prekern/prekern.c Sun Oct 29 10:01:22 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: prekern.c,v 1.1 2017/10/10 09:29:14 maxv Exp $ */ +/* $NetBSD: prekern.c,v 1.2 2017/10/29 10:01:22 maxv Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved. @@ -250,6 +250,11 @@ init_bootspace(vaddr_t baseva) &bootspace.rodata.sz); elf_get_data(&bootspace.data.va, &bootspace.data.pa, &bootspace.data.sz); + + bootspace.head.va = baseva; + bootspace.head.pa = mm_vatopa(bootspace.head.va); + bootspace.head.sz = bootspace.text.va - baseva; + bootspace.boot.va = bootspace.data.va + bootspace.data.sz; bootspace.boot.pa = mm_vatopa(bootspace.boot.va); bootspace.boot.sz = (size_t)(iom_base + IOM_SIZE) - Index: src/sys/arch/amd64/stand/prekern/prekern.h diff -u src/sys/arch/amd64/stand/prekern/prekern.h:1.1 src/sys/arch/amd64/stand/prekern/prekern.h:1.2 --- src/sys/arch/amd64/stand/prekern/prekern.h:1.1 Tue Oct 10 09:29:14 2017 +++ src/sys/arch/amd64/stand/prekern/prekern.h Sun Oct 29 10:01:22 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: prekern.h,v 1.1 2017/10/10 09:29:14 maxv Exp $ */ +/* $NetBSD: prekern.h,v 1.2 2017/10/29 10:01:22 maxv Exp $ */ /* * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved. @@ -62,6 +62,11 @@ struct bootspace { vaddr_t va; paddr_t pa; size_t sz; + } head; + struct { + vaddr_t va; + paddr_t pa; + size_t sz; } text; struct { vaddr_t va; Index: src/sys/arch/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.796 src/sys/arch/i386/i386/machdep.c:1.797 --- src/sys/arch/i386/i386/machdep.c:1.796 Mon Oct 9 17:49:27 2017 +++ src/sys/arch/i386/i386/machdep.c Sun Oct 29 10:01:21 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.796 2017/10/09 17:49:27 maya Exp $ */ +/* $NetBSD: machdep.c,v 1.797 2017/10/29 10:01:21 maxv Exp $ */ /* * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009, 2017 @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.796 2017/10/09 17:49:27 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.797 2017/10/29 10:01:21 maxv Exp $"); #include "op
CVS commit: src/share/man/man9
Module Name:src Committed By: pgoyette Date: Sun Oct 29 09:51:42 UTC 2017 Modified Files: src/share/man/man9: kernhist.9 Log Message: More improvements in grammar and readability. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/share/man/man9/kernhist.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/kernhist.9 diff -u src/share/man/man9/kernhist.9:1.6 src/share/man/man9/kernhist.9:1.7 --- src/share/man/man9/kernhist.9:1.6 Sun Oct 29 09:17:42 2017 +++ src/share/man/man9/kernhist.9 Sun Oct 29 09:51:42 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: kernhist.9,v 1.6 2017/10/29 09:17:42 pgoyette Exp $ +.\" $NetBSD: kernhist.9,v 1.7 2017/10/29 09:51:42 pgoyette Exp $ .\" .\" Copyright (c) 2015 Matthew R. Green .\" All rights reserved. @@ -70,22 +70,22 @@ format syntax with a maximum of 4 argume must be present in the kernel configuration to enable these functions and macros. .Pp -A kernel history is a fixed-size buffer of an either statically or dynamically -allocated buffer that is used and read in a cycled basis. -It includes the time an entry was made, the CPU from which the entry was -recorded, the +A kernel history is a fixed-size buffer,either statically or dynamically +allocated, that is written and read on a circular basis. +Each entry includes the time the entry was made, the CPU from which the entry +was recorded, the .Xr printf 3 -like format and length, the function name and length, the unique call count -for this function, and the 4 arguments. +like format string and length, the function name and length, the unique call +count for this function, and the 4 arguments. .Pp -The history data can be viewed using the +The history event data can be viewed using the .Fl U and .Fl u .Ar histname options to .Xr vmstat 1 , -or by the +or by using the .Ic show kernhist command in .Xr ddb 4 . @@ -94,10 +94,10 @@ User-written programs can retrieve histo variable kern.hist.histname. .Pp The format string must be a literal string that can be referenced later as it -is not stored with the event, only a pointer to it. +is not stored with the event (only a pointer to the format string is stored). It should only contain conversion specifiers suitable for .Vt uintmax_t -values, such as +sized values, such as .Dq %jx , .Dq %ju , and @@ -107,10 +107,10 @@ and address (pointer) arguments should b to avoid compiler errors on architectures where pointers are smaller than .Vt uintmax_t integers. -Format specifiers without a length modifier, and specifiers with length +Conversion specifiers without a length modifier, and specifiers with length modifiers other than j, should not be used. .Pp -Format specifiers that require additional dereferences of their +Conversion specifiers that require additional dereferences of their corresponding arguments, such as .Dq %s , will not work in @@ -155,14 +155,17 @@ log the format string and arguments in t Declare a function as being called. Either this or .Fn KERNHIST_CALLARGS -must be used near the function entry point to maintain the number of +must be used once, near the function entry point, to maintain the number of times the function has been called. .It Fn KERNHIST_CALLARGS name fmt arg0 arg1 arg2 arg3 -A frontend to +A combination of +.Fn KERNHIST_CALLED +and .Fn KERNHIST_LOG -that avoids that +that avoids having a .Dq called! -log message in addition to normal arguments. +log message in addition to a message containing normal arguments with a +format string. .It Fn KERNHIST_DUMP name Call .Fn kernhist_dump
CVS commit: src/sys/dev
Module Name:src Committed By: mlelstv Date: Sun Oct 29 09:44:17 UTC 2017 Modified Files: src/sys/dev: dksubr.c Log Message: Use driver specific label code as fallback. This fixes the UDF label for CDs. To generate a diff of this commit: cvs rdiff -u -r1.99 -r1.100 src/sys/dev/dksubr.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/dksubr.c diff -u src/sys/dev/dksubr.c:1.99 src/sys/dev/dksubr.c:1.100 --- src/sys/dev/dksubr.c:1.99 Thu Aug 24 11:26:32 2017 +++ src/sys/dev/dksubr.c Sun Oct 29 09:44:17 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: dksubr.c,v 1.99 2017/08/24 11:26:32 maya Exp $ */ +/* $NetBSD: dksubr.c,v 1.100 2017/10/29 09:44:17 mlelstv Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.99 2017/08/24 11:26:32 maya Exp $"); +__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.100 2017/10/29 09:44:17 mlelstv Exp $"); #include #include @@ -931,14 +931,28 @@ dk_getdisklabel(struct dk_softc *dksc, d } } +/* + * Heuristic to conjure a disklabel if reading a disklabel failed. + * + * This is to allow the raw partition to be used for a filesystem + * without caring about the write protected label sector. + * + * If the driver provides it's own callback, use that instead. + */ /* ARGSUSED */ static void dk_makedisklabel(struct dk_softc *dksc) { - struct disklabel *lp = dksc->sc_dkdev.dk_label; + const struct dkdriver *dkd = dksc->sc_dkdev.dk_driver; + struct disklabel *lp = dksc->sc_dkdev.dk_label; - lp->d_partitions[RAW_PART].p_fstype = FS_BSDFFS; strlcpy(lp->d_packname, "default label", sizeof(lp->d_packname)); + + if (dkd->d_label) + dkd->d_label(dksc->sc_dev, lp); + else + lp->d_partitions[RAW_PART].p_fstype = FS_BSDFFS; + lp->d_checksum = dkcksum(lp); }
CVS commit: src/share/man/man9
Module Name:src Committed By: pgoyette Date: Sun Oct 29 09:17:42 UTC 2017 Modified Files: src/share/man/man9: kernhist.9 Log Message: Use correct mark-up for NetBSD version. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/share/man/man9/kernhist.9 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/man/man9/kernhist.9 diff -u src/share/man/man9/kernhist.9:1.5 src/share/man/man9/kernhist.9:1.6 --- src/share/man/man9/kernhist.9:1.5 Sat Oct 28 00:37:11 2017 +++ src/share/man/man9/kernhist.9 Sun Oct 29 09:17:42 2017 @@ -1,4 +1,4 @@ -.\" $NetBSD: kernhist.9,v 1.5 2017/10/28 00:37:11 pgoyette Exp $ +.\" $NetBSD: kernhist.9,v 1.6 2017/10/29 09:17:42 pgoyette Exp $ .\" .\" Copyright (c) 2015 Matthew R. Green .\" All rights reserved. @@ -225,14 +225,14 @@ mechanism. .\" add example here of code usage .\" .Sh HISTORY -The uvm-specific version of the +A uvm-specific version of the .Nm facility first appeared in .Nx 1.4 . The generalized version of .Nm appeared in -.Nm 6.0 . +.Nx 6.0 . The .Xr sysctl 9 interface to