CVS commit: src/sys/arch/x86/x86
Module Name:src Committed By: tls Date: Fri Jan 1 19:46:48 UTC 2016 Modified Files: src/sys/arch/x86/x86: identcpu.c Log Message: Enable second noise source on newer VIA CPUs To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/sys/arch/x86/x86/identcpu.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/x86/x86/identcpu.c diff -u src/sys/arch/x86/x86/identcpu.c:1.49 src/sys/arch/x86/x86/identcpu.c:1.50 --- src/sys/arch/x86/x86/identcpu.c:1.49 Sun Dec 13 15:02:19 2015 +++ src/sys/arch/x86/x86/identcpu.c Fri Jan 1 19:46:48 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: identcpu.c,v 1.49 2015/12/13 15:02:19 maxv Exp $ */ +/* $NetBSD: identcpu.c,v 1.50 2016/01/01 19:46:48 tls Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.49 2015/12/13 15:02:19 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.50 2016/01/01 19:46:48 tls Exp $"); #include "opt_xen.h" @@ -554,8 +554,14 @@ cpu_probe_c3(struct cpu_info *ci) /* Actually do the enables. */ if (rng_enable) { msr = rdmsr(MSR_VIA_RNG); - wrmsr(MSR_VIA_RNG, msr | MSR_VIA_RNG_ENABLE); + msr |= MSR_VIA_RNG_ENABLE; + /* C7 stepping 8 and subsequent CPUs have dual RNG */ + if (model > 0xA || (model == 0xA && stepping > 0x7)) { +msr |= MSR_VIA_RNG_2NOISE; + } + wrmsr(MSR_VIA_RNG, msr); } + if (ace_enable) { msr = rdmsr(MSR_VIA_ACE); wrmsr(MSR_VIA_ACE, msr | MSR_VIA_ACE_ENABLE);
CVS commit: src/tests/lib/libusbhid
Module Name:src Committed By: jakllsch Date: Fri Jan 1 22:47:35 UTC 2016 Modified Files: src/tests/lib/libusbhid: t_usbhid.c Log Message: value debugging for the Logical/Physical range checks To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libusbhid/t_usbhid.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libusbhid/t_usbhid.c diff -u src/tests/lib/libusbhid/t_usbhid.c:1.1 src/tests/lib/libusbhid/t_usbhid.c:1.2 --- src/tests/lib/libusbhid/t_usbhid.c:1.1 Fri Jan 1 21:38:54 2016 +++ src/tests/lib/libusbhid/t_usbhid.c Fri Jan 1 22:47:34 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: t_usbhid.c,v 1.1 2016/01/01 21:38:54 jakllsch Exp $ */ +/* $NetBSD: t_usbhid.c,v 1.2 2016/01/01 22:47:34 jakllsch Exp $ */ /* * Copyright (c) 2016 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_usbhid.c,v 1.1 2016/01/01 21:38:54 jakllsch Exp $"); +__RCSID("$NetBSD: t_usbhid.c,v 1.2 2016/01/01 22:47:34 jakllsch Exp $"); #include @@ -199,6 +199,12 @@ ATF_TC_BODY(check_hid_usage, tc) 0xff2a); } +#define MYd_ATF_CHECK_EQ(d, v) \ + ATF_CHECK_EQ_MSG(d, v, "== %d", (d)) + +#define MYu_ATF_CHECK_EQ(d, v) \ + ATF_CHECK_EQ_MSG(d, v, "== %u", (d)) + ATF_TC_HEAD(check_hid_logical_range, tc) { @@ -218,16 +224,16 @@ ATF_TC_BODY(check_hid_logical_range, tc) __arraycount(range_test_report_descriptor))) != NULL); ATF_REQUIRE(hid_locate(hrd, 0xff01U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ(hi.logical_minimum, -128); - ATF_CHECK_EQ(hi.logical_maximum, 127); + MYd_ATF_CHECK_EQ(hi.logical_minimum, -128); + MYd_ATF_CHECK_EQ(hi.logical_maximum, 127); ATF_REQUIRE(hid_locate(hrd, 0xff02U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ(hi.logical_minimum, -32768); - ATF_CHECK_EQ(hi.logical_maximum, 32767); + MYd_ATF_CHECK_EQ(hi.logical_minimum, -32768); + MYd_ATF_CHECK_EQ(hi.logical_maximum, 32767); ATF_REQUIRE(hid_locate(hrd, 0xff03U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ(hi.logical_minimum, -2147483648); - ATF_CHECK_EQ(hi.logical_maximum, 2147483647); + MYd_ATF_CHECK_EQ(hi.logical_minimum, -2147483648); + MYd_ATF_CHECK_EQ(hi.logical_maximum, 2147483647); hid_dispose_report_desc(hrd); hrd = NULL; @@ -238,16 +244,16 @@ ATF_TC_BODY(check_hid_logical_range, tc) ATF_REQUIRE(hid_locate(hrd, 0xff11U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ((uint32_t)hi.logical_minimum, 0); - ATF_CHECK_EQ((uint32_t)hi.logical_maximum, 255); + MYu_ATF_CHECK_EQ((uint32_t)hi.logical_minimum, 0); + MYu_ATF_CHECK_EQ((uint32_t)hi.logical_maximum, 255); ATF_REQUIRE(hid_locate(hrd, 0xff12U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ((uint32_t)hi.logical_minimum, 0); - ATF_CHECK_EQ((uint32_t)hi.logical_maximum, 65535); + MYu_ATF_CHECK_EQ((uint32_t)hi.logical_minimum, 0); + MYu_ATF_CHECK_EQ((uint32_t)hi.logical_maximum, 65535); ATF_REQUIRE(hid_locate(hrd, 0xff13U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ((uint32_t)hi.logical_minimum, 0); - ATF_CHECK_EQ((uint32_t)hi.logical_maximum, 4294967295); + MYu_ATF_CHECK_EQ((uint32_t)hi.logical_minimum, 0); + MYu_ATF_CHECK_EQ((uint32_t)hi.logical_maximum, 4294967295); hid_dispose_report_desc(hrd); hrd = NULL; @@ -272,16 +278,16 @@ ATF_TC_BODY(check_hid_physical_range, tc __arraycount(range_test_report_descriptor))) != NULL); ATF_REQUIRE(hid_locate(hrd, 0xff01U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ(hi.physical_minimum, -128); - ATF_CHECK_EQ(hi.physical_maximum, 127); + MYd_ATF_CHECK_EQ(hi.physical_minimum, -128); + MYd_ATF_CHECK_EQ(hi.physical_maximum, 127); ATF_REQUIRE(hid_locate(hrd, 0xff02U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ(hi.physical_minimum, -32768); - ATF_CHECK_EQ(hi.physical_maximum, 32767); + MYd_ATF_CHECK_EQ(hi.physical_minimum, -32768); + MYd_ATF_CHECK_EQ(hi.physical_maximum, 32767); ATF_REQUIRE(hid_locate(hrd, 0xff03U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ(hi.physical_minimum, -2147483648); - ATF_CHECK_EQ(hi.physical_maximum, 2147483647); + MYd_ATF_CHECK_EQ(hi.physical_minimum, -2147483648); + MYd_ATF_CHECK_EQ(hi.physical_maximum, 2147483647); hid_dispose_report_desc(hrd); hrd = NULL; @@ -292,16 +298,16 @@ ATF_TC_BODY(check_hid_physical_range, tc ATF_REQUIRE(hid_locate(hrd, 0xff11U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ((uint32_t)hi.physical_minimum, 0); - ATF_CHECK_EQ((uint32_t)hi.physical_maximum, 255); + MYu_ATF_CHECK_EQ((uint32_t)hi.physical_minimum, 0); + MYu_ATF_CHECK_EQ((uint32_t)hi.physical_maximum, 255); ATF_REQUIRE(hid_locate(hrd, 0xff12U, hid_input, , NO_REPORT_ID) > 0); - ATF_CHECK_EQ((uint32_t)hi.physical_minimum, 0); - ATF_CHECK_EQ((uint32_t)hi.physical_maximum, 65535); + MYu_ATF_CHECK_EQ((uint32_t)hi.physical_minimum, 0); + MYu_ATF_CHECK_EQ((uint32_t)hi.physical_maximum,
CVS commit: src/sys/dev/pci
Module Name:src Committed By: macallan Date: Fri Jan 1 20:48:15 UTC 2016 Modified Files: src/sys/dev/pci: voyager.c Log Message: zero out struct i2cbus_attach_args and i2c_controller before messing with them To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/voyager.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/voyager.c diff -u src/sys/dev/pci/voyager.c:1.10 src/sys/dev/pci/voyager.c:1.11 --- src/sys/dev/pci/voyager.c:1.10 Sat Mar 29 19:28:25 2014 +++ src/sys/dev/pci/voyager.c Fri Jan 1 20:48:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: voyager.c,v 1.10 2014/03/29 19:28:25 christos Exp $ */ +/* $NetBSD: voyager.c,v 1.11 2016/01/01 20:48:15 macallan Exp $ */ /* * Copyright (c) 2009, 2011 Michael Lorenz @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: voyager.c,v 1.10 2014/03/29 19:28:25 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: voyager.c,v 1.11 2016/01/01 20:48:15 macallan Exp $"); #include #include @@ -244,6 +244,8 @@ voyager_attach(device_t parent, device_t voyager_gpio_dir(sc, 0x, GPIO_I2C_BITS); /* Fill in the i2c tag */ + memset(>sc_i2c, 0, sizeof(sc->sc_i2c)); + memset(, 0, sizeof(iba)); sc->sc_i2c.ic_cookie = sc; sc->sc_i2c.ic_acquire_bus = voyager_i2c_acquire_bus; sc->sc_i2c.ic_release_bus = voyager_i2c_release_bus;
CVS commit: src
Module Name:src Committed By: jakllsch Date: Fri Jan 1 21:38:54 UTC 2016 Modified Files: src/distrib/sets/lists/debug: mi src/distrib/sets/lists/tests: mi src/etc/mtree: NetBSD.dist.tests src/tests/lib: Makefile Added Files: src/tests/lib/libusbhid: Makefile t_usbhid.c test_usb_hid_usages Log Message: tests for libusbhid (many of which fail) To generate a diff of this commit: cvs rdiff -u -r1.138 -r1.139 src/distrib/sets/lists/debug/mi cvs rdiff -u -r1.657 -r1.658 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.122 -r1.123 src/etc/mtree/NetBSD.dist.tests cvs rdiff -u -r1.24 -r1.25 src/tests/lib/Makefile cvs rdiff -u -r0 -r1.1 src/tests/lib/libusbhid/Makefile \ src/tests/lib/libusbhid/t_usbhid.c \ src/tests/lib/libusbhid/test_usb_hid_usages 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/debug/mi diff -u src/distrib/sets/lists/debug/mi:1.138 src/distrib/sets/lists/debug/mi:1.139 --- src/distrib/sets/lists/debug/mi:1.138 Fri Dec 18 19:00:45 2015 +++ src/distrib/sets/lists/debug/mi Fri Jan 1 21:38:53 2016 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.138 2015/12/18 19:00:45 christos Exp $ +# $NetBSD: mi,v 1.139 2016/01/01 21:38:53 jakllsch 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 @@ -2149,6 +2149,7 @@ ./usr/libdata/debug/usr/tests/lib/libtre/h_regex_att.debug tests-obsolete obsolete,compattestfile ./usr/libdata/debug/usr/tests/lib/libtre/t_exhaust.debug tests-lib-debug debug,atf,compattestfile ./usr/libdata/debug/usr/tests/lib/libtre/t_regex_att.debug tests-lib-debug debug,atf,compattestfile +./usr/libdata/debug/usr/tests/lib/libusbhid/t_usbhid.debug tests-lib-debug debug,atf,compattestfile ./usr/libdata/debug/usr/tests/lib/libutil/t_efun.debug tests-lib-debug debug,atf,compattestfile ./usr/libdata/debug/usr/tests/lib/libutil/t_parsedate.debug tests-lib-debug debug,atf,compattestfile ./usr/libdata/debug/usr/tests/lib/libutil/t_pidfile.debug tests-lib-debug debug,atf,compattestfile Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.657 src/distrib/sets/lists/tests/mi:1.658 --- src/distrib/sets/lists/tests/mi:1.657 Sat Dec 5 18:47:43 2015 +++ src/distrib/sets/lists/tests/mi Fri Jan 1 21:38:54 2016 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.657 2015/12/05 18:47:43 christos Exp $ +# $NetBSD: mi,v 1.658 2016/01/01 21:38:54 jakllsch Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -131,6 +131,7 @@ ./usr/libdata/debug/usr/tests/lib/libskeytests-lib-debug compattestfile,atf ./usr/libdata/debug/usr/tests/lib/libsljittests-lib-debug compattestfile,atf ./usr/libdata/debug/usr/tests/lib/libtretests-lib-debug compattestfile,atf +./usr/libdata/debug/usr/tests/lib/libusbhidtests-lib-debug compattestfile,atf ./usr/libdata/debug/usr/tests/lib/libutiltests-lib-debug compattestfile,atf ./usr/libdata/debug/usr/tests/lib/semaphoretests-lib-debug compattestfile,atf ./usr/libdata/debug/usr/tests/lib/semaphore/pthread tests-lib-debug compattestfile,atf @@ -3042,6 +3043,10 @@ ./usr/tests/lib/libtre/h_regex_att tests-obsolete obsolete ./usr/tests/lib/libtre/t_exhaust tests-lib-tests compattestfile,atf ./usr/tests/lib/libtre/t_regex_att tests-lib-tests compattestfile,atf +./usr/tests/lib/libusbhid tests-lib-tests compattestfile,atf +./usr/tests/lib/libusbhid/Atffile tests-lib-tests compattestfile,atf +./usr/tests/lib/libusbhid/t_usbhid tests-lib-tests compattestfile,atf +./usr/tests/lib/libusbhid/test_usb_hid_usages tests-lib-tests compattestfile,atf ./usr/tests/lib/libutiltests-lib-tests compattestfile,atf ./usr/tests/lib/libutil/Atffile tests-lib-tests compattestfile,atf ./usr/tests/lib/libutil/Kyuafile tests-lib-tests compattestfile,atf,kyua Index: src/etc/mtree/NetBSD.dist.tests diff -u src/etc/mtree/NetBSD.dist.tests:1.122 src/etc/mtree/NetBSD.dist.tests:1.123 --- src/etc/mtree/NetBSD.dist.tests:1.122 Fri Dec 4 17:20:12 2015 +++ src/etc/mtree/NetBSD.dist.tests Fri Jan 1 21:38:54 2016 @@ -1,4 +1,4 @@ -# $NetBSD: NetBSD.dist.tests,v 1.122 2015/12/04 17:20:12 christos Exp $ +# $NetBSD: NetBSD.dist.tests,v 1.123 2016/01/01 21:38:54 jakllsch Exp $ ./usr/libdata/debug/usr/tests ./usr/libdata/debug/usr/tests/atf @@ -119,6 +119,7 @@ ./usr/libdata/debug/usr/tests/lib/libskey ./usr/libdata/debug/usr/tests/lib/libsljit ./usr/libdata/debug/usr/tests/lib/libtre +./usr/libdata/debug/usr/tests/lib/libusbhid ./usr/libdata/debug/usr/tests/lib/libutil ./usr/libdata/debug/usr/tests/libexec ./usr/libdata/debug/usr/tests/libexec/ld.elf_so @@ -300,6 +301,7 @@ ./usr/tests/lib/libsljit ./usr/tests/lib/libtre ./usr/tests/lib/libtre/data +./usr/tests/lib/libusbhid
CVS commit: src
Module Name:src Committed By: jakllsch Date: Sat Jan 2 01:24:45 UTC 2016 Modified Files: src/lib/libusbhid: usage.c src/tests/lib/libusbhid: t_usbhid.c Log Message: Teach hid_parse_usage_in_page() how to understand hex literals, in addition to the usual table lookup. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/lib/libusbhid/usage.c cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libusbhid/t_usbhid.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libusbhid/usage.c diff -u src/lib/libusbhid/usage.c:1.8 src/lib/libusbhid/usage.c:1.9 --- src/lib/libusbhid/usage.c:1.8 Sat Jan 2 01:04:15 2016 +++ src/lib/libusbhid/usage.c Sat Jan 2 01:24:44 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: usage.c,v 1.8 2016/01/02 01:04:15 jakllsch Exp $ */ +/* $NetBSD: usage.c,v 1.9 2016/01/02 01:24:44 jakllsch Exp $ */ /* * Copyright (c) 1999 Lennart Augustsson@@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: usage.c,v 1.8 2016/01/02 01:04:15 jakllsch Exp $"); +__RCSID("$NetBSD: usage.c,v 1.9 2016/01/02 01:24:44 jakllsch Exp $"); #include #include @@ -214,7 +214,6 @@ hid_parse_usage_page(const char *name) return -1; } -/* XXX handle hex */ int hid_parse_usage_in_page(const char *name) { @@ -231,6 +230,9 @@ hid_parse_usage_in_page(const char *name for (k = 0; k < npages; k++) if (strncmp(pages[k].name, name, l) == 0) goto found; + if (sscanf(name, "%x:%x", , ) == 2) { + return (k << 16) | j; + } return -1; found: sep++; Index: src/tests/lib/libusbhid/t_usbhid.c diff -u src/tests/lib/libusbhid/t_usbhid.c:1.5 src/tests/lib/libusbhid/t_usbhid.c:1.6 --- src/tests/lib/libusbhid/t_usbhid.c:1.5 Sat Jan 2 01:04:15 2016 +++ src/tests/lib/libusbhid/t_usbhid.c Sat Jan 2 01:24:44 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: t_usbhid.c,v 1.5 2016/01/02 01:04:15 jakllsch Exp $ */ +/* $NetBSD: t_usbhid.c,v 1.6 2016/01/02 01:24:44 jakllsch Exp $ */ /* * Copyright (c) 2016 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_usbhid.c,v 1.5 2016/01/02 01:04:15 jakllsch Exp $"); +__RCSID("$NetBSD: t_usbhid.c,v 1.6 2016/01/02 01:24:44 jakllsch Exp $"); #include @@ -158,6 +158,9 @@ ATF_TC_HEAD(check_hid_usage, tc) atf_tc_set_md_var(tc, "descr", "Test libusbhid usage.c"); } +#define MYx_ATF_CHECK_EQ(d, v) \ + ATF_CHECK_EQ_MSG(d, v, "== %x", (d)) + ATF_TC_BODY(check_hid_usage, tc) { char usages_path[PATH_MAX]; @@ -194,6 +197,9 @@ ATF_TC_BODY(check_hid_usage, tc) ATF_CHECK_EQ((uint32_t)hid_parse_usage_in_page( "Quick_zephyrs_blow_vexing_daft_Jim_:Usage_ID_65535_%"), 0xff2a); + + MYx_ATF_CHECK_EQ((uint32_t)hid_parse_usage_in_page("0xff2a:0xff1b"), + 0xff2aff1b); } #define MYd_ATF_CHECK_EQ(d, v) \
CVS commit: src/tests/lib/libusbhid
Module Name:src Committed By: jakllsch Date: Fri Jan 1 23:46:04 UTC 2016 Modified Files: src/tests/lib/libusbhid: t_usbhid.c Log Message: Rework unsigned range test cases. If the USB HID 1.11 spec is interperted to the letter, there's no such thing as a unsigned Logical/Physical Minimum/Maximum. When the (signed) Minimum is greater than the (signed) Maximum, it's a possibility that the device is attempting to present unsigned report data. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libusbhid/t_usbhid.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libusbhid/t_usbhid.c diff -u src/tests/lib/libusbhid/t_usbhid.c:1.3 src/tests/lib/libusbhid/t_usbhid.c:1.4 --- src/tests/lib/libusbhid/t_usbhid.c:1.3 Fri Jan 1 22:59:12 2016 +++ src/tests/lib/libusbhid/t_usbhid.c Fri Jan 1 23:46:04 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: t_usbhid.c,v 1.3 2016/01/01 22:59:12 jakllsch Exp $ */ +/* $NetBSD: t_usbhid.c,v 1.4 2016/01/01 23:46:04 jakllsch Exp $ */ /* * Copyright (c) 2016 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_usbhid.c,v 1.3 2016/01/01 22:59:12 jakllsch Exp $"); +__RCSID("$NetBSD: t_usbhid.c,v 1.4 2016/01/01 23:46:04 jakllsch Exp $"); #include @@ -216,6 +216,7 @@ ATF_TC_BODY(check_hid_logical_range, tc) { report_desc_t hrd; hid_item_t hi; + uint32_t minimum, maximum; atf_tc_expect_fail("only the 32-bit opcode works, " "8 and 16-bit is broken"); @@ -241,19 +242,27 @@ ATF_TC_BODY(check_hid_logical_range, tc) ATF_REQUIRE((hrd = hid_use_report_desc( unsigned_range_test_report_descriptor, __arraycount(unsigned_range_test_report_descriptor))) != NULL); - ATF_REQUIRE(hid_locate(hrd, 0xff11U, hid_input, , NO_REPORT_ID) > 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.logical_minimum, 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.logical_maximum, 255); + ATF_CHECK(hi.logical_minimum > hi.logical_maximum); + minimum = (uint32_t)hi.logical_minimum & ((1ULL<0); - MYu_ATF_CHECK_EQ((uint32_t)hi.logical_minimum, 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.logical_maximum, 65535); + ATF_CHECK(hi.logical_minimum > hi.logical_maximum); + minimum = hi.logical_minimum & ((1ULL< 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.logical_minimum, 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.logical_maximum, 4294967295); + ATF_CHECK(hi.logical_minimum > hi.logical_maximum); + minimum = hi.logical_minimum & ((1ULL< 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.physical_minimum, 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.physical_maximum, 255); + ATF_CHECK(hi.physical_minimum > hi.physical_maximum); + minimum = (uint32_t)hi.physical_minimum & ((1ULL< 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.physical_minimum, 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.physical_maximum, 65535); + ATF_CHECK(hi.physical_minimum > hi.physical_maximum); + minimum = hi.physical_minimum & ((1ULL< 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.physical_minimum, 0); - MYu_ATF_CHECK_EQ((uint32_t)hi.physical_maximum, 4294967295); + ATF_CHECK(hi.physical_minimum > hi.physical_maximum); + minimum = hi.physical_minimum & ((1ULL<
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: jdc Date: Fri Jan 1 20:13:50 UTC 2016 Modified Files: src/sys/dev/i2c: lm75.c Log Message: Read the Tos limit from the chip, instead of assuming 80'C, in case firmware has altered it. Make the *decode functions return temperatures in either uK or C for envsys and sysctl, respectively. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/sys/dev/i2c/lm75.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/i2c/lm75.c diff -u src/sys/dev/i2c/lm75.c:1.26 src/sys/dev/i2c/lm75.c:1.27 --- src/sys/dev/i2c/lm75.c:1.26 Sun Sep 27 13:02:21 2015 +++ src/sys/dev/i2c/lm75.c Fri Jan 1 20:13:50 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: lm75.c,v 1.26 2015/09/27 13:02:21 phx Exp $ */ +/* $NetBSD: lm75.c,v 1.27 2016/01/01 20:13:50 jdc Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.26 2015/09/27 13:02:21 phx Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.27 2016/01/01 20:13:50 jdc Exp $"); #include #include @@ -58,7 +58,7 @@ struct lmtemp_softc { envsys_data_t sc_sensor; int sc_tmax; - uint32_t (*sc_lmtemp_decode)(const uint8_t *); + uint32_t (*sc_lmtemp_decode)(const uint8_t *, int); }; static int lmtemp_match(device_t, cfdata_t, void *); @@ -71,9 +71,11 @@ static void lmtemp_refresh(struct sysmon static int lmtemp_config_write(struct lmtemp_softc *, uint8_t); static int lmtemp_temp_write(struct lmtemp_softc *, int, uint16_t); -static uint32_t lmtemp_decode_lm75(const uint8_t *); -static uint32_t lmtemp_decode_ds75(const uint8_t *); -static uint32_t lmtemp_decode_lm77(const uint8_t *); +static int lmtemp_temp_read(struct lmtemp_softc *, uint8_t, uint32_t *, +int); +static uint32_t lmtemp_decode_lm75(const uint8_t *, int); +static uint32_t lmtemp_decode_ds75(const uint8_t *, int); +static uint32_t lmtemp_decode_lm77(const uint8_t *, int); static void lmtemp_setup_sysctl(struct lmtemp_softc *); static int sysctl_lm75_temp(SYSCTLFN_ARGS); @@ -97,7 +99,7 @@ static const struct { const char *lmtemp_name; int lmtemp_addrmask; int lmtemp_addr; - uint32_t (*lmtemp_decode)(const uint8_t *); + uint32_t (*lmtemp_decode)(const uint8_t *, int); } lmtemptbl[] = { { lmtemp_lm75, "LM75", LM75_ADDRMASK, LM75_ADDR, lmtemp_decode_lm75 }, @@ -177,16 +179,21 @@ lmtemp_attach(device_t parent, device_t lmtemptbl[i].lmtemp_name); } - /* - * according to the LM75 data sheet 80C is the default, so leave it - * there to avoid unexpected behaviour - */ - sc->sc_tmax = 80; + sc->sc_lmtemp_decode = lmtemptbl[i].lmtemp_decode; + + iic_acquire_bus(sc->sc_tag, I2C_F_POLL); + + /* Read temperature limit and remember initial value. */ + if (lmtemp_temp_read(sc, LM75_REG_TOS_SET_POINT, >sc_tmax, 1) + != 0) { + iic_release_bus(sc->sc_tag, I2C_F_POLL); + return; + } + if (i == lmtemp_lm75) lmtemp_setup_sysctl(sc); /* Set the configuration of the LM75 to defaults. */ - iic_acquire_bus(sc->sc_tag, I2C_F_POLL); if (lmtemp_config_write(sc, LM75_CONFIG_FAULT_QUEUE_4) != 0) { aprint_error_dev(self, "unable to write config register\n"); iic_release_bus(sc->sc_tag, I2C_F_POLL); @@ -206,8 +213,6 @@ lmtemp_attach(device_t parent, device_t return; } - sc->sc_lmtemp_decode = lmtemptbl[i].lmtemp_decode; - /* Hook into system monitor. */ sc->sc_sme->sme_name = device_xname(self); sc->sc_sme->sme_cookie = sc; @@ -245,7 +250,8 @@ lmtemp_temp_write(struct lmtemp_softc *s } static int -lmtemp_temp_read(struct lmtemp_softc *sc, uint8_t which, uint32_t *valp) +lmtemp_temp_read(struct lmtemp_softc *sc, uint8_t which, uint32_t *valp, +int degc) { int error; uint8_t cmdbuf[1]; @@ -258,7 +264,7 @@ lmtemp_temp_read(struct lmtemp_softc *sc if (error) return error; - *valp = sc->sc_lmtemp_decode(buf); + *valp = sc->sc_lmtemp_decode(buf, degc); return 0; } @@ -268,7 +274,7 @@ lmtemp_refresh_sensor_data(struct lmtemp uint32_t val; int error; - error = lmtemp_temp_read(sc, LM75_REG_TEMP, ); + error = lmtemp_temp_read(sc, LM75_REG_TEMP, , 0); if (error) { #if 0 aprint_error_dev(sc->sc_dev, "unable to read temperature, error = %d\n", @@ -293,7 +299,7 @@ lmtemp_refresh(struct sysmon_envsys *sme } static uint32_t -lmtemp_decode_lm75(const uint8_t *buf) +lmtemp_decode_lm75(const uint8_t *buf, int degc) { int temp; uint32_t val; @@ -305,14 +311,17 @@ lmtemp_decode_lm75(const uint8_t *buf) temp = (int8_t) buf[0]; temp = (temp << 1) + ((buf[1] >> 7) & 0x1); - /* Temp is given in 1/2 deg. C, we convert to uK. */ - val = temp * 50 + 27315; + /* Temp is given in 1/2 deg. C, we convert to C or uK. */ + if (degc) + val = temp / 2; + else + val = temp * 50 + 27315; return val; } static uint32_t -lmtemp_decode_ds75(const uint8_t *buf) +lmtemp_decode_ds75(const uint8_t *buf, int degc) {
CVS commit: src
Module Name:src Committed By: jakllsch Date: Sat Jan 2 01:04:15 UTC 2016 Modified Files: src/lib/libusbhid: usage.c src/tests/lib/libusbhid: t_usbhid.c Log Message: Fix round-trip of hid_usage_in_page(hid_parse_usage_in_page()) when the usage is a catch-all format string. This should allow usbhidctl(1) to understand an item argument of "Button:Button_65535". To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/lib/libusbhid/usage.c cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libusbhid/t_usbhid.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libusbhid/usage.c diff -u src/lib/libusbhid/usage.c:1.7 src/lib/libusbhid/usage.c:1.8 --- src/lib/libusbhid/usage.c:1.7 Sun Apr 9 00:49:55 2006 +++ src/lib/libusbhid/usage.c Sat Jan 2 01:04:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: usage.c,v 1.7 2006/04/09 00:49:55 christos Exp $ */ +/* $NetBSD: usage.c,v 1.8 2016/01/02 01:04:15 jakllsch Exp $ */ /* * Copyright (c) 1999 Lennart Augustsson@@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: usage.c,v 1.7 2006/04/09 00:49:55 christos Exp $"); +__RCSID("$NetBSD: usage.c,v 1.8 2016/01/02 01:04:15 jakllsch Exp $"); #include #include @@ -235,7 +235,12 @@ hid_parse_usage_in_page(const char *name found: sep++; for (j = 0; j < pages[k].pagesize; j++) - if (strcmp(pages[k].page_contents[j].name, sep) == 0) + if (pages[k].page_contents[j].usage == -1) { + if (sscanf(sep, fmtcheck( + pages[k].page_contents[j].name, "%u"), ) == 1) { +return (pages[k].usage << 16) | l; + } + } else if (strcmp(pages[k].page_contents[j].name, sep) == 0) return (pages[k].usage << 16) | pages[k].page_contents[j].usage; return (-1); } Index: src/tests/lib/libusbhid/t_usbhid.c diff -u src/tests/lib/libusbhid/t_usbhid.c:1.4 src/tests/lib/libusbhid/t_usbhid.c:1.5 --- src/tests/lib/libusbhid/t_usbhid.c:1.4 Fri Jan 1 23:46:04 2016 +++ src/tests/lib/libusbhid/t_usbhid.c Sat Jan 2 01:04:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: t_usbhid.c,v 1.4 2016/01/01 23:46:04 jakllsch Exp $ */ +/* $NetBSD: t_usbhid.c,v 1.5 2016/01/02 01:04:15 jakllsch Exp $ */ /* * Copyright (c) 2016 Jonathan A. Kollasch @@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: t_usbhid.c,v 1.4 2016/01/01 23:46:04 jakllsch Exp $"); +__RCSID("$NetBSD: t_usbhid.c,v 1.5 2016/01/02 01:04:15 jakllsch Exp $"); #include @@ -167,9 +167,6 @@ ATF_TC_BODY(check_hid_usage, tc) (void)strlcat(usages_path, "/test_usb_hid_usages", sizeof(usages_path)); - atf_tc_expect_fail("hid_parse_*() fails because it doesn't use " - "scanf()"); - hid_init(usages_path); ATF_CHECK_STREQ("t_usbhid_page", hid_usage_page(0xff1b));
CVS commit: src/sys/dev/fdt
Module Name:src Committed By: marty Date: Fri Jan 1 22:35:44 UTC 2016 Modified Files: src/sys/dev/fdt: fdt_pinctrl.c fdtvar.h Log Message: FDT pinctl - review from Jared These changes reflect a redesign based on a preliminary review by Jared. Instead of the acquire/release/set/get approach of the original, this uses a much simpler, and cleaner register/set approach. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/dev/fdt/fdt_pinctrl.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdtvar.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/fdt/fdt_pinctrl.c diff -u src/sys/dev/fdt/fdt_pinctrl.c:1.1 src/sys/dev/fdt/fdt_pinctrl.c:1.2 --- src/sys/dev/fdt/fdt_pinctrl.c:1.1 Wed Dec 30 04:23:39 2015 +++ src/sys/dev/fdt/fdt_pinctrl.c Fri Jan 1 22:35:44 2016 @@ -1,7 +1,7 @@ -/* $NetBSD: fdt_pinctrl.c,v 1.1 2015/12/30 04:23:39 marty Exp $ */ +/* $NetBSD: fdt_pinctrl.c,v 1.2 2016/01/01 22:35:44 marty Exp $ */ /*- - * Copyright (c) 2015 Jared D. McNeill+ * Copyright (c) 2015 Martin Fouts * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.1 2015/12/30 04:23:39 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl.c,v 1.2 2016/01/01 22:35:44 marty Exp $"); #include #include @@ -37,8 +37,8 @@ __KERNEL_RCSID(0, "$NetBSD: fdt_pinctrl. #include struct fdtbus_pinctrl_controller { - device_t pc_dev; int pc_phandle; + void *pc_cookie; const struct fdtbus_pinctrl_controller_func *pc_funcs; struct fdtbus_pinctrl_controller *pc_next; @@ -47,13 +47,13 @@ struct fdtbus_pinctrl_controller { static struct fdtbus_pinctrl_controller *fdtbus_pc = NULL; int -fdtbus_register_pinctrl_controller(device_t dev, int phandle, +fdtbus_register_pinctrl_config(void *cookie, int phandle, const struct fdtbus_pinctrl_controller_func *funcs) { struct fdtbus_pinctrl_controller *pc; pc = kmem_alloc(sizeof(*pc), KM_SLEEP); - pc->pc_dev = dev; + pc->pc_cookie = cookie; pc->pc_phandle = phandle; pc->pc_funcs = funcs; @@ -63,49 +63,70 @@ fdtbus_register_pinctrl_controller(devic return 0; } -struct fdtbus_pinctrl_pin * -fdtbus_pinctrl_acquire(int phandle, const char *prop) +static struct fdtbus_pinctrl_controller * +fdtbus_pinctrl_lookup(int phandle) { struct fdtbus_pinctrl_controller *pc; - struct fdtbus_pinctrl_pin *gp; - gp = kmem_alloc(sizeof(*gp), KM_SLEEP); - for (pc = fdtbus_pc; pc; pc = pc->pc_next) { - gp->pp_pc = pc; - gp->pp_priv = pc->pc_funcs->acquire(pc->pc_dev, prop); - if (gp->pp_priv != NULL) - break; - } - - if (gp->pp_priv == NULL) { - kmem_free(gp, sizeof(*gp)); - return NULL; - } + for (pc = fdtbus_pc; pc; pc = pc->pc_next) + if (pc->pc_phandle == phandle) + return pc; - return gp; + return NULL; } -void -fdtbus_pinctrl_release(struct fdtbus_pinctrl_pin *gp) +int +fdtbus_pinctrl_set_config_index(int phandle, u_int index) { - struct fdtbus_pinctrl_controller *pc = gp->pp_pc; + char buf[80]; + int len, handle; + struct fdtbus_pinctrl_controller *pc; - pc->pc_funcs->release(pc->pc_dev, gp->pp_priv); - kmem_free(gp, sizeof(*gp)); -} + snprintf(buf, 80, "pinctrl-%d", index); -void -fdtbus_pinctrl_get_cfg(struct fdtbus_pinctrl_pin *gp, void *cookie) -{ - struct fdtbus_pinctrl_controller *pc = gp->pp_pc; + len = OF_getprop(phandle, buf, (char *), +sizeof(handle)); + if (len != sizeof(int)) { + printf("%s: couldn't get %s.\n", __func__, buf); + return -1; + } + + handle = fdtbus_get_phandle_from_native(be32toh(handle)); + + pc = fdtbus_pinctrl_lookup(handle); + if (!pc) { + printf("%s: Couldn't get handle %d for %s\n", __func__, handle, + buf); + return -1; + } - pc->pc_funcs->get(gp, cookie); + return pc->pc_funcs->set_config(pc->pc_cookie); } -void -fdtbus_pinctrl_set_cfg(struct fdtbus_pinctrl_pin *gp, void *cookie) +int +fdtbus_pinctrl_set_config(int phandle, const char *cfgname) { - struct fdtbus_pinctrl_controller *pc = gp->pp_pc; + int index = 0; + int len; + char *result; + char *next; + + len = OF_getproplen(phandle, "pinctrl-names"); + if (len <= 0) + return -1; + result = kmem_zalloc(len, KM_SLEEP); + OF_getprop(phandle, "pinctrl-names", result, len); + + next = result; + while (next - result < len) { + if (!strcmp(next, cfgname)) { + return fdtbus_pinctrl_set_config_index(phandle, index); + } + index++; + while (*next) + next++; + next++; + } - pc->pc_funcs->set(gp, cookie); + return -1; } Index: src/sys/dev/fdt/fdtvar.h diff -u src/sys/dev/fdt/fdtvar.h:1.5 src/sys/dev/fdt/fdtvar.h:1.6 --- src/sys/dev/fdt/fdtvar.h:1.5 Wed Dec 30 04:23:39 2015 +++ src/sys/dev/fdt/fdtvar.h Fri Jan 1 22:35:44 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: fdtvar.h,v 1.5 2015/12/30 04:23:39 marty Exp $ */ +/* $NetBSD:
CVS commit: src
Module Name:src Committed By: jakllsch Date: Fri Jan 1 22:59:12 UTC 2016 Modified Files: src/lib/libusbhid: data.c src/tests/lib/libusbhid: t_usbhid.c Log Message: Fix hid_get_data() for negative or 32-bit report data. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libusbhid/data.c cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libusbhid/t_usbhid.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libusbhid/data.c diff -u src/lib/libusbhid/data.c:1.6 src/lib/libusbhid/data.c:1.7 --- src/lib/libusbhid/data.c:1.6 Wed May 12 18:28:20 2010 +++ src/lib/libusbhid/data.c Fri Jan 1 22:59:12 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: data.c,v 1.6 2010/05/12 18:28:20 plunky Exp $ */ +/* $NetBSD: data.c,v 1.7 2016/01/01 22:59:12 jakllsch Exp $ */ /* * Copyright (c) 1999 Lennart Augustsson@@ -27,7 +27,7 @@ */ #include -__RCSID("$NetBSD: data.c,v 1.6 2010/05/12 18:28:20 plunky Exp $"); +__RCSID("$NetBSD: data.c,v 1.7 2016/01/01 22:59:12 jakllsch Exp $"); #include #include @@ -57,10 +57,12 @@ hid_get_data(const void *p, const hid_it for (i = 0; i < end; i++) data |= buf[offs + i] << (i*8); data >>= hpos % 8; - data &= (1 << hsize) - 1; - if (h->logical_minimum < 0 && (data & (1<<(hsize-1 { - /* Need to sign extend */ - data |= 0x & ~((1< logical_minimum < 0 && (data & (1<<(hsize-1 { + /* Need to sign extend */ + data |= 0x & ~((1<
CVS commit: src/sys/arch/arm/samsung
Module Name:src Committed By: marty Date: Fri Jan 1 22:37:07 UTC 2016 Modified Files: src/sys/arch/arm/samsung: exynos_i2c.c exynos_pinctrl.c Log Message: XU4 FDT pinctrl Rewrite the use of pinctrl to reflect the new model from Jared. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/samsung/exynos_i2c.c cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos_pinctrl.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/samsung/exynos_i2c.c diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.9 src/sys/arch/arm/samsung/exynos_i2c.c:1.10 --- src/sys/arch/arm/samsung/exynos_i2c.c:1.9 Wed Dec 30 04:30:27 2015 +++ src/sys/arch/arm/samsung/exynos_i2c.c Fri Jan 1 22:37:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_i2c.c,v 1.9 2015/12/30 04:30:27 marty Exp $ */ +/* $NetBSD: exynos_i2c.c,v 1.10 2016/01/01 22:37:07 marty Exp $ */ /* * Copyright (c) 2015 Jared D. McNeill@@ -31,7 +31,7 @@ #include "opt_arm_debug.h" #include -__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.9 2015/12/30 04:30:27 marty Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.10 2016/01/01 22:37:07 marty Exp $"); #include #include @@ -144,18 +144,11 @@ exynos_i2c_attach(device_t parent, devic bus_size_t size; int error; - char result[64]; - int i2c_handle; - int len; - int handle; - int func, pud, drv; - if (fdtbus_get_reg(phandle, 0, , ) != 0) { aprint_error(": couldn't get registers\n"); return; } - sc->sc_dev = self; sc->sc_bst = faa->faa_bst; error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh); @@ -182,66 +175,8 @@ exynos_i2c_attach(device_t parent, devic return; } aprint_normal_dev(self, "interrupting on %s\n", intrstr); - - len = OF_getprop(phandle, "pinctrl-0", (char *), - sizeof(handle)); - if (len != sizeof(int)) { - aprint_error_dev(self, "couldn't get pinctrl-0.\n"); - return; - } - - i2c_handle = fdtbus_get_phandle_from_native(be32toh(handle)); - len = OF_getprop(i2c_handle, "samsung,pins", result, sizeof(result)); - if (len <= 0) { - aprint_error_dev(self, "couldn't get pins.\n"); - return; - } - len = OF_getprop(i2c_handle, "samsung,pin-function", - , sizeof(handle)); - if (len <= 0) { - aprint_error_dev(self, "couldn't get pin-function.\n"); - return; - } else - func = be32toh(handle); - - sc->sc_sda = fdtbus_pinctrl_acquire(phandle, [0]); - if (sc->sc_sda == NULL) { - printf("could not acquire sda gpio %s\n", [0]); - return; - } - - sc->sc_scl = fdtbus_pinctrl_acquire(phandle, [7]); - if (sc->sc_scl == NULL) { - printf("could not acquire scl gpio %s\n", [7]); - return; - } - - len = OF_getprop(i2c_handle, "samsung,pin-pud", , - sizeof()); - if (len <= 0) { - aprint_error_dev(self, "couldn't get pin-pud.\n"); - return; - } else - pud = be32toh(handle); - - len = OF_getprop(i2c_handle, "samsung,pin-drv", , - sizeof()); - if (len <= 0) { - aprint_error_dev(self, "couldn't get pin-drv.\n"); - return; - } else - drv = be32toh(handle); - - struct exynos_gpio_pin_cfg cfg; - cfg.cfg = func; - cfg.pud = pud; - cfg.drv = drv; - cfg.conpwd = 0; - cfg.pudpwd = 0; - - fdtbus_pinctrl_set_cfg(sc->sc_scl, ); - fdtbus_pinctrl_set_cfg(sc->sc_sda, ); + fdtbus_pinctrl_set_config_index(phandle, 0); sc->sc_ic.ic_cookie = sc; sc->sc_ic.ic_acquire_bus = exynos_i2c_acquire_bus; Index: src/sys/arch/arm/samsung/exynos_pinctrl.c diff -u src/sys/arch/arm/samsung/exynos_pinctrl.c:1.8 src/sys/arch/arm/samsung/exynos_pinctrl.c:1.9 --- src/sys/arch/arm/samsung/exynos_pinctrl.c:1.8 Wed Dec 30 04:30:27 2015 +++ src/sys/arch/arm/samsung/exynos_pinctrl.c Fri Jan 1 22:37:07 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: exynos_pinctrl.c,v 1.8 2015/12/30 04:30:27 marty Exp $ */ +/* $NetBSD: exynos_pinctrl.c,v 1.9 2016/01/01 22:37:07 marty Exp $ */ /*- * Copyright (c) 2015 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ #include "gpio.h" #include -__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.8 2015/12/30 04:30:27 marty Exp $"); +__KERNEL_RCSID(1, "$NetBSD: exynos_pinctrl.c,v 1.9 2016/01/01 22:37:07 marty Exp $"); #include #include @@ -53,19 +53,21 @@ __KERNEL_RCSID(1, "$NetBSD: exynos_pinct #include +struct exynos_pinctrl_config { + int pc_phandle; + struct exynos_gpio_pin_cfg *pc_pincfg; + struct exynos_pinctrl_softc *pc_sc; +}; + static int exynos_pinctrl_match(device_t, cfdata_t, void *); static void exynos_pinctrl_attach(device_t, device_t, void *); -static void *exynos_pinctrl_acquire(device_t, const char *); -static void exynos_pinctrl_release(device_t, void *); -static void exynos_pinctrl_get_cfg(struct fdtbus_pinctrl_pin *, void *); -static void exynos_pinctrl_set_cfg(struct fdtbus_pinctrl_pin *, void *); +static int exynos_pinctrl_set_cfg(void *); +static struct exynos_gpio_pin_cfg * +exynos_parse_config(struct exynos_pinctrl_config *pc); static struct
CVS commit: src/tests/fs/vfs
Module Name:src Committed By: pooka Date: Fri Jan 1 15:13:57 UTC 2016 Modified Files: src/tests/fs/vfs: t_vnops.c Log Message: Add a test which creates many directory entries. To generate a diff of this commit: cvs rdiff -u -r1.49 -r1.50 src/tests/fs/vfs/t_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/vfs/t_vnops.c diff -u src/tests/fs/vfs/t_vnops.c:1.49 src/tests/fs/vfs/t_vnops.c:1.50 --- src/tests/fs/vfs/t_vnops.c:1.49 Thu Apr 9 19:47:05 2015 +++ src/tests/fs/vfs/t_vnops.c Fri Jan 1 15:13:57 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: t_vnops.c,v 1.49 2015/04/09 19:47:05 riastradh Exp $ */ +/* $NetBSD: t_vnops.c,v 1.50 2016/01/01 15:13:57 pooka Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -439,6 +439,47 @@ rename_reg_nodir(const atf_tc_t *tc, con } static void +create_many(const atf_tc_t *tc, const char *mp) +{ + char buf[64]; + int nfiles = 2324; /* #Nancy */ + int i; + + /* fs doesn't support many files */ + if (FSTYPE_SYSVBFS(tc)) + nfiles = 5; + + /* takes forever with many files */ + if (FSTYPE_MSDOS(tc)) + nfiles /= 4; + + RL(rump_sys_chdir(mp)); + + /* msdosfs doesn't like many entries in the root directory */ + RL(rump_sys_mkdir("subdir", 0777)); + RL(rump_sys_chdir("subdir")); + + /* create them */ +#define TESTFN "this_is_the_filename" + for (i = 0; i < nfiles; i++) { + int fd; + + sprintf(buf, TESTFN "%d\n", i); + RL(fd = rump_sys_open(buf, O_RDWR|O_CREAT|O_EXCL, 0666)); + RL(rump_sys_close(fd)); + } + + /* wipe them out */ + for (i = 0; i < nfiles; i++) { + sprintf(buf, TESTFN "%d\n", i); + RL(rump_sys_unlink(buf)); + } +#undef TESTFN + + rump_sys_chdir("/"); +} + +static void create_nametoolong(const atf_tc_t *tc, const char *mp) { char *name; @@ -958,6 +999,10 @@ ATF_TC_FSAPPLY(access_simple, "access(2) ATF_TC_FSAPPLY(read_directory, "read(2) on directories"); ATF_TC_FSAPPLY(lstat_symlink, "lstat(2) values for symbolic links"); +#undef FSTEST_IMGSIZE +#define FSTEST_IMGSIZE (1024*1024*64) +ATF_TC_FSAPPLY(create_many, "create many directory entries"); + ATF_TP_ADD_TCS(tp) { @@ -969,6 +1014,7 @@ ATF_TP_ADD_TCS(tp) ATF_TP_FSAPPLY(rename_dir); ATF_TP_FSAPPLY(rename_dotdot); ATF_TP_FSAPPLY(rename_reg_nodir); + ATF_TP_FSAPPLY(create_many); ATF_TP_FSAPPLY(create_nametoolong); ATF_TP_FSAPPLY(create_exist); ATF_TP_FSAPPLY(rename_nametoolong);
CVS commit: src/tests/fs/vfs
Module Name:src Committed By: pooka Date: Fri Jan 1 15:18:39 UTC 2016 Modified Files: src/tests/fs/vfs: t_vnops.c Log Message: use a shorter filename template in previous (for v7fs) To generate a diff of this commit: cvs rdiff -u -r1.50 -r1.51 src/tests/fs/vfs/t_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/fs/vfs/t_vnops.c diff -u src/tests/fs/vfs/t_vnops.c:1.50 src/tests/fs/vfs/t_vnops.c:1.51 --- src/tests/fs/vfs/t_vnops.c:1.50 Fri Jan 1 15:13:57 2016 +++ src/tests/fs/vfs/t_vnops.c Fri Jan 1 15:18:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: t_vnops.c,v 1.50 2016/01/01 15:13:57 pooka Exp $ */ +/* $NetBSD: t_vnops.c,v 1.51 2016/01/01 15:18:39 pooka Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -460,7 +460,7 @@ create_many(const atf_tc_t *tc, const ch RL(rump_sys_chdir("subdir")); /* create them */ -#define TESTFN "this_is_the_filename" +#define TESTFN "testfile" for (i = 0; i < nfiles; i++) { int fd;
CVS commit: src/sys/kern
Module Name:src Committed By: tls Date: Fri Jan 1 16:09:00 UTC 2016 Modified Files: src/sys/kern: kern_rndq.c Log Message: Fix callout-skew source so it runs only when needed (remove second callout, eliminate race). To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/kern/kern_rndq.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/kern/kern_rndq.c diff -u src/sys/kern/kern_rndq.c:1.73 src/sys/kern/kern_rndq.c:1.74 --- src/sys/kern/kern_rndq.c:1.73 Sat Aug 29 10:00:19 2015 +++ src/sys/kern/kern_rndq.c Fri Jan 1 16:09:00 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_rndq.c,v 1.73 2015/08/29 10:00:19 mlelstv Exp $ */ +/* $NetBSD: kern_rndq.c,v 1.74 2016/01/01 16:09:00 tls Exp $ */ /*- * Copyright (c) 1997-2013 The NetBSD Foundation, Inc. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.73 2015/08/29 10:00:19 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.74 2016/01/01 16:09:00 tls Exp $"); #include #include @@ -407,8 +407,8 @@ rnd_dv_estimate(krndsource_t *rs, uint32 #if defined(__HAVE_CPU_COUNTER) static struct { kmutex_t lock; + int iter; struct callout callout; - struct callout stop_callout; krndsource_t source; } rnd_skew __cacheline_aligned; @@ -426,21 +426,14 @@ rnd_skew_enable(krndsource_t *rs, bool e } static void -rnd_skew_stop_intr(void *arg) -{ - - callout_stop(_skew.callout); -} - -static void rnd_skew_get(size_t bytes, void *priv) { krndsource_t *skewsrcp = priv; KASSERT(skewsrcp == _skew.source); if (RND_ENABLED(skewsrcp)) { - /* Measure for 30s */ - callout_schedule(_skew.stop_callout, hz * 30); + /* Measure 100 times */ + rnd_skew.iter = 100; callout_schedule(_skew.callout, 1); } } @@ -448,8 +441,6 @@ rnd_skew_get(size_t bytes, void *priv) static void rnd_skew_intr(void *arg) { - static int flipflop; - /* * Even on systems with seemingly stable clocks, the * delta-time entropy estimator seems to think we get 1 bit here @@ -457,14 +448,15 @@ rnd_skew_intr(void *arg) * */ mutex_spin_enter(_skew.lock); - flipflop = !flipflop; if (RND_ENABLED(_skew.source)) { - if (flipflop) { + int next_ticks = 1; + if (rnd_skew.iter & 1) { rnd_add_uint32(_skew.source, rnd_counter()); - callout_schedule(_skew.callout, hz / 10); - } else { - callout_schedule(_skew.callout, 1); + next_ticks = hz / 10; + } + if (--rnd_skew.iter > 0) { + callout_schedule(_skew.callout, next_ticks); } } mutex_spin_exit(_skew.lock); @@ -559,14 +551,13 @@ rnd_init(void) /* IPL_VM because taken while rnd_global.lock is held. */ mutex_init(_skew.lock, MUTEX_DEFAULT, IPL_VM); callout_init(_skew.callout, CALLOUT_MPSAFE); - callout_init(_skew.stop_callout, CALLOUT_MPSAFE); callout_setfunc(_skew.callout, rnd_skew_intr, NULL); - callout_setfunc(_skew.stop_callout, rnd_skew_stop_intr, NULL); rndsource_setcb(_skew.source, rnd_skew_get, _skew.source); rndsource_setenable(_skew.source, rnd_skew_enable); rnd_attach_source(_skew.source, "callout", RND_TYPE_SKEW, RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_VALUE| RND_FLAG_HASCB|RND_FLAG_HASENABLE); + rnd_skew.iter = 100; rnd_skew_intr(NULL); #endif
CVS commit: src/sys/kern
Module Name:src Committed By: martin Date: Fri Jan 1 18:58:58 UTC 2016 Modified Files: src/sys/kern: vfs_bio.c Log Message: KASSERT->KASSERTMSG to allow debugging a double-free'd buffer in ddb. To generate a diff of this commit: cvs rdiff -u -r1.256 -r1.257 src/sys/kern/vfs_bio.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/kern/vfs_bio.c diff -u src/sys/kern/vfs_bio.c:1.256 src/sys/kern/vfs_bio.c:1.257 --- src/sys/kern/vfs_bio.c:1.256 Mon Aug 24 22:50:32 2015 +++ src/sys/kern/vfs_bio.c Fri Jan 1 18:58:58 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_bio.c,v 1.256 2015/08/24 22:50:32 pooka Exp $ */ +/* $NetBSD: vfs_bio.c,v 1.257 2016/01/01 18:58:58 martin Exp $ */ /*- * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -123,7 +123,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.256 2015/08/24 22:50:32 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_bio.c,v 1.257 2016/01/01 18:58:58 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_bufcache.h" @@ -328,7 +328,8 @@ binstailfree(buf_t *bp, struct bqueue *d { KASSERT(mutex_owned(_lock)); - KASSERT(bp->b_freelistindex == -1); + KASSERTMSG(bp->b_freelistindex == -1, "double free of buffer? " + "bp=%p, b_freelistindex=%d\n", bp, bp->b_freelistindex); TAILQ_INSERT_TAIL(>bq_queue, bp, b_freelist); dp->bq_bytes += bp->b_bufsize; bp->b_freelistindex = dp - bufqueues;
CVS commit: src/lib/libusbhid
Module Name:src Committed By: jakllsch Date: Fri Jan 1 19:14:45 UTC 2016 Modified Files: src/lib/libusbhid: usb_hid_usages Log Message: Alphanumeric is spelled Alphanumeric To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/lib/libusbhid/usb_hid_usages Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libusbhid/usb_hid_usages diff -u src/lib/libusbhid/usb_hid_usages:1.6 src/lib/libusbhid/usb_hid_usages:1.7 --- src/lib/libusbhid/usb_hid_usages:1.6 Wed May 9 16:21:06 2012 +++ src/lib/libusbhid/usb_hid_usages Fri Jan 1 19:14:45 2016 @@ -1,4 +1,4 @@ -# $NetBSD: usb_hid_usages,v 1.6 2012/05/09 16:21:06 khorben Exp $ +# $NetBSD: usb_hid_usages,v 1.7 2016/01/01 19:14:45 jakllsch Exp $ # # USB HID usage table # Syntax: @@ -1138,7 +1138,7 @@ 16 Unicode * Unicode Char u%04x -20 Alphnumeric Display +20 Alphanumeric Display 0x00 Undefined 0x01 Alphanumeric Display 0x02 Bitmapped Display
CVS commit: src/share/mk
Module Name:src Committed By: christos Date: Fri Jan 1 17:06:21 UTC 2016 Modified Files: src/share/mk: bsd.hostprog.mk Log Message: Add the pthread libraries, documented already in bsd.README; sort To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/share/mk/bsd.hostprog.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/share/mk/bsd.hostprog.mk diff -u src/share/mk/bsd.hostprog.mk:1.75 src/share/mk/bsd.hostprog.mk:1.76 --- src/share/mk/bsd.hostprog.mk:1.75 Sat Nov 21 23:59:15 2015 +++ src/share/mk/bsd.hostprog.mk Fri Jan 1 12:06:21 2016 @@ -1,4 +1,4 @@ -# $NetBSD: bsd.hostprog.mk,v 1.75 2015/11/22 04:59:15 kamil Exp $ +# $NetBSD: bsd.hostprog.mk,v 1.76 2016/01/01 17:06:21 christos Exp $ # @(#)bsd.prog.mk 8.2 (Berkeley) 4/2/94 .include @@ -12,11 +12,11 @@ LIBATF_CXX?= /usr/lib/libatf-c++.a LIBBLUETOOTH?= /usr/lib/libbluetooth.a LIBBZ2?= /usr/lib/libbz2.a LIBC?= /usr/lib/libc.a -LIBC_PIC?= /usr/lib/libc_pic.a -LIBC_SO?= /usr/lib/libc.so LIBCOMPAT?= /usr/lib/libcompat.a LIBCRYPT?= /usr/lib/libcrypt.a LIBCURSES?= /usr/lib/libcurses.a +LIBC_PIC?= /usr/lib/libc_pic.a +LIBC_SO?= /usr/lib/libc.so LIBDBM?= /usr/lib/libdbm.a LIBDES?= /usr/lib/libdes.a LIBEDIT?= /usr/lib/libedit.a @@ -47,6 +47,8 @@ LIBPCAP?= /usr/lib/libpcap.a LIBPCI?= /usr/lib/libpci.a LIBPLOT?= /usr/lib/libplot.a LIBPOSIX?= /usr/lib/libposix.a +LIBPTHREAD?=/usr/lib/libpthread.a +LIBPTHREAD_DBG?=/usr/lib/libpthread_dbg.a LIBPUFFS?= /usr/lib/libpuffs.a LIBQUOTA?= /usr/lib/libquota.a LIBRESOLV?= /usr/lib/libresolv.a @@ -62,9 +64,9 @@ LIBSSP?= /usr/lib/libssp.a LIBSTDCXX?= /usr/lib/libstdc++.a LIBSUPCXX?= /usr/lib/libsupc++.a LIBTERMINFO?= /usr/lib/libterminfo.a +LIBUKFS?= /usr/lib/libukfs.a LIBUTIL?= /usr/lib/libutil.a LIBWRAP?= /usr/lib/libwrap.a -LIBUKFS?= /usr/lib/libukfs.a LIBY?= /usr/lib/liby.a LIBZ?= /usr/lib/libz.a