CVS commit: xsrc/external/mit

2019-03-02 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Sun Mar  3 07:08:48 UTC 2019

Modified Files:
xsrc/external/mit/libXau/dist: AuFileName.c
Removed Files:
xsrc/external/mit/libfontenc/dist: README

Log Message:
merge libXau 1.0.9 and libfontenc 1.1.4.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/libXau/dist/AuFileName.c
cvs rdiff -u -r1.1.1.2 -r0 xsrc/external/mit/libfontenc/dist/README

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libXau/dist/AuFileName.c
diff -u xsrc/external/mit/libXau/dist/AuFileName.c:1.2 xsrc/external/mit/libXau/dist/AuFileName.c:1.3
--- xsrc/external/mit/libXau/dist/AuFileName.c:1.2	Fri Jan  4 18:53:36 2019
+++ xsrc/external/mit/libXau/dist/AuFileName.c	Sun Mar  3 07:08:47 2019
@@ -29,6 +29,7 @@ in this Software without prior written a
 #endif
 #include 
 #include 
+#include 
 #include 
 
 static char *buf = NULL;
@@ -71,12 +72,14 @@ XauFileName (void)
 	return NULL;
 }
 size = strlen (name) + strlen([1]) + 2;
-if (size > bsize) {
-	if (buf)
-	free (buf);
+if ((size > bsize) || (buf == NULL)) {
+	free (buf);
+assert(size > 0);
 	buf = malloc (size);
-	if (!buf)
+	if (!buf) {
+	bsize = 0;
 	return NULL;
+	}
 
 #ifndef __NetBSD__
 if (!atexit_registered) {
@@ -88,6 +91,6 @@ XauFileName (void)
 	bsize = size;
 }
 snprintf (buf, bsize, "%s%s", name,
-  slashDotXauthority + (name[1] == '\0' ? 1 : 0));
+  slashDotXauthority + (name[0] == '/' && name[1] == '\0' ? 1 : 0));
 return buf;
 }



CVS commit: src/sys/arch/aarch64/conf

2019-03-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Mar  3 07:04:40 UTC 2019

Modified Files:
src/sys/arch/aarch64/conf: Makefile.aarch64

Log Message:
Add KASAN use-after-scope detection in aarch64, tested by Ryo Shimizu,
thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/aarch64/conf/Makefile.aarch64

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/aarch64/conf/Makefile.aarch64
diff -u src/sys/arch/aarch64/conf/Makefile.aarch64:1.14 src/sys/arch/aarch64/conf/Makefile.aarch64:1.15
--- src/sys/arch/aarch64/conf/Makefile.aarch64:1.14	Thu Nov  8 08:28:07 2018
+++ src/sys/arch/aarch64/conf/Makefile.aarch64	Sun Mar  3 07:04:40 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.aarch64,v 1.14 2018/11/08 08:28:07 maxv Exp $
+#	$NetBSD: Makefile.aarch64,v 1.15 2019/03/03 07:04:40 maxv Exp $
 
 # Makefile for NetBSD
 #
@@ -42,6 +42,7 @@ CFLAGS+=	-mno-omit-leaf-frame-pointer
 .if ${KASAN:U0} > 0 && ${HAVE_GCC:U0} > 0
 KASANFLAGS=	-fsanitize=kernel-address \
 		--param asan-globals=1 --param asan-stack=1 \
+		-fsanitize-address-use-after-scope \
 		-fasan-shadow-offset=0xDFFF2080
 .for f in subr_asan.c
 KASANFLAGS.${f}=	# empty



CVS import: xsrc/external/mit/libXau/dist

2019-03-02 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Sun Mar  3 07:03:35 UTC 2019

Update of /cvsroot/xsrc/external/mit/libXau/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv25234

Log Message:
initial import of libXau-1.0.9

Status:

Vendor Tag: xorg
Release Tags:   libXau-1-0-9

U xsrc/external/mit/libXau/dist/AuRead.c
U xsrc/external/mit/libXau/dist/INSTALL
U xsrc/external/mit/libXau/dist/Makefile.in
U xsrc/external/mit/libXau/dist/ltmain.sh
U xsrc/external/mit/libXau/dist/AuGetBest.c
U xsrc/external/mit/libXau/dist/AuUnlock.c
U xsrc/external/mit/libXau/dist/config.sub
U xsrc/external/mit/libXau/dist/AuGetAddr.c
U xsrc/external/mit/libXau/dist/Makefile.am
C xsrc/external/mit/libXau/dist/AuFileName.c
U xsrc/external/mit/libXau/dist/configure.ac
U xsrc/external/mit/libXau/dist/test-driver
U xsrc/external/mit/libXau/dist/xau.pc.in
U xsrc/external/mit/libXau/dist/config.guess
U xsrc/external/mit/libXau/dist/configure
U xsrc/external/mit/libXau/dist/AuDispose.c
U xsrc/external/mit/libXau/dist/install-sh
U xsrc/external/mit/libXau/dist/AUTHORS
U xsrc/external/mit/libXau/dist/aclocal.m4
N xsrc/external/mit/libXau/dist/compile
U xsrc/external/mit/libXau/dist/README
U xsrc/external/mit/libXau/dist/COPYING
U xsrc/external/mit/libXau/dist/config.h.in
U xsrc/external/mit/libXau/dist/AuLock.c
U xsrc/external/mit/libXau/dist/ChangeLog
U xsrc/external/mit/libXau/dist/depcomp
U xsrc/external/mit/libXau/dist/Autest.c
U xsrc/external/mit/libXau/dist/missing
U xsrc/external/mit/libXau/dist/AuWrite.c
U xsrc/external/mit/libXau/dist/include/X11/Xauth.h
U xsrc/external/mit/libXau/dist/man/Makefile.am
U xsrc/external/mit/libXau/dist/man/XauReadAuth.man
U xsrc/external/mit/libXau/dist/man/XauGetBestAuthByAddr.man
U xsrc/external/mit/libXau/dist/man/XauFileName.man
U xsrc/external/mit/libXau/dist/man/Makefile.in
U xsrc/external/mit/libXau/dist/man/XauDisposeAuth.man
U xsrc/external/mit/libXau/dist/man/Xau.man
U xsrc/external/mit/libXau/dist/man/XauGetAuthByAddr.man
U xsrc/external/mit/libXau/dist/man/XauLockAuth.man
U xsrc/external/mit/libXau/dist/man/XauUnlockAuth.man
U xsrc/external/mit/libXau/dist/man/XauWriteAuth.man

1 conflicts created by this import.
Use the following command to help the merge:

cvs checkout -jxorg:yesterday -jxorg xsrc/external/mit/libXau/dist



CVS import: xsrc/external/mit/libfontenc/dist

2019-03-02 Thread matthew green
Module Name:xsrc
Committed By:   mrg
Date:   Sun Mar  3 07:03:39 UTC 2019

Update of /cvsroot/xsrc/external/mit/libfontenc/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv17396

Log Message:
initial import of libfontenc-1.1.4

Status:

Vendor Tag: xorg
Release Tags:   libfontenc-1-1-4

U xsrc/external/mit/libfontenc/dist/missing
U xsrc/external/mit/libfontenc/dist/depcomp
U xsrc/external/mit/libfontenc/dist/Makefile.in
U xsrc/external/mit/libfontenc/dist/COPYING
U xsrc/external/mit/libfontenc/dist/config.guess
U xsrc/external/mit/libfontenc/dist/ltmain.sh
U xsrc/external/mit/libfontenc/dist/aclocal.m4
U xsrc/external/mit/libfontenc/dist/Makefile.am
U xsrc/external/mit/libfontenc/dist/compile
U xsrc/external/mit/libfontenc/dist/install-sh
U xsrc/external/mit/libfontenc/dist/config.h.in
U xsrc/external/mit/libfontenc/dist/configure.ac
U xsrc/external/mit/libfontenc/dist/fontenc.pc.in
U xsrc/external/mit/libfontenc/dist/config.sub
U xsrc/external/mit/libfontenc/dist/ChangeLog
N xsrc/external/mit/libfontenc/dist/README.md
U xsrc/external/mit/libfontenc/dist/configure
U xsrc/external/mit/libfontenc/dist/INSTALL
U xsrc/external/mit/libfontenc/dist/include/X11/fonts/fontenc.h
U xsrc/external/mit/libfontenc/dist/src/fontenc.c
U xsrc/external/mit/libfontenc/dist/src/encparse.c
U xsrc/external/mit/libfontenc/dist/src/Makefile.am
U xsrc/external/mit/libfontenc/dist/src/Makefile.in
U xsrc/external/mit/libfontenc/dist/src/fontencI.h

No conflicts created by this import



CVS commit: src/sys/dev/nvmm/x86

2019-03-02 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Mar  3 07:01:09 UTC 2019

Modified Files:
src/sys/dev/nvmm/x86: nvmm_x86.c nvmm_x86.h nvmm_x86_svm.c
nvmm_x86_vmx.c

Log Message:
Choose which CPUID bits to allow, rather than which bits to disallow. This
is clearer, and also forward compatible with future CPUs.

While here be more consistent when allowing the bits, and sync between
nvmm-amd and nvmm-intel. Also make sure to disallow AVX, because the guest
state we provide is only x86+SSE. Fixes a CentOS panic when booting on
NVMM, reported by Jared McNeill, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/nvmm/x86/nvmm_x86.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/nvmm/x86/nvmm_x86.h
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/nvmm/x86/nvmm_x86_svm.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/nvmm/x86/nvmm_x86_vmx.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/nvmm/x86/nvmm_x86.c
diff -u src/sys/dev/nvmm/x86/nvmm_x86.c:1.2 src/sys/dev/nvmm/x86/nvmm_x86.c:1.3
--- src/sys/dev/nvmm/x86/nvmm_x86.c:1.2	Tue Feb 26 12:23:12 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86.c	Sun Mar  3 07:01:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86.c,v 1.2 2019/02/26 12:23:12 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86.c,v 1.3 2019/03/03 07:01:09 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018-2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvmm_x86.c,v 1.2 2019/02/26 12:23:12 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvmm_x86.c,v 1.3 2019/03/03 07:01:09 maxv Exp $");
 
 #include 
 #include 
@@ -226,3 +226,89 @@ const struct nvmm_x64_state nvmm_x86_res
 		.fx_mxcsr = 0x1F80,
 	}
 };
+
+const struct nvmm_x86_cpuid_mask nvmm_cpuid_0001 = {
+	.eax = ~0,
+	.ebx = ~0,
+	.ecx =
+	/* Excluded: MONITOR, VMX, SMX, EST, TM2, PDCM, PCID, X2APIC,
+	 * DEADLINE, RAZ. */
+	CPUID2_SSE3 | CPUID2_PCLMUL |
+	CPUID2_DTES64 | CPUID2_DS_CPL |
+	CPUID2_SSSE3 | CPUID2_CID |
+	CPUID2_SDBG | CPUID2_FMA |
+	CPUID2_CX16 | CPUID2_xTPR |
+	CPUID2_DCA | CPUID2_SSE41 |
+	CPUID2_SSE42 | CPUID2_MOVBE |
+	CPUID2_POPCNT | CPUID2_AES |
+	CPUID2_XSAVE | CPUID2_OSXSAVE |
+	CPUID2_F16C | CPUID2_RDRAND,
+	.edx =
+	/* Excluded: MCE, MTRR, MCA, DS, ACPI, TM. */
+	CPUID_FPU | CPUID_VME |
+	CPUID_DE | CPUID_PSE |
+	CPUID_TSC | CPUID_MSR |
+	CPUID_PAE | CPUID_CX8 |
+	CPUID_APIC | CPUID_B10 |	
+	CPUID_SEP | CPUID_PGE |
+	CPUID_CMOV | CPUID_PAT |
+	CPUID_PSE36 | CPUID_PN |
+	CPUID_CFLUSH | CPUID_B20 |
+	CPUID_MMX | CPUID_FXSR |
+	CPUID_SSE | CPUID_SSE2 |
+	CPUID_SS | CPUID_HTT |
+	CPUID_IA64 | CPUID_SBF
+};
+
+const struct nvmm_x86_cpuid_mask nvmm_cpuid_0007 = {
+	.eax = ~0,
+	.ebx =
+	/* Excluded: TSC_ADJUST, AVX2, INVPCID, AVX512*, PT, SHA. */
+	CPUID_SEF_FSGSBASE |
+	CPUID_SEF_SGX | CPUID_SEF_BMI1 |
+	CPUID_SEF_HLE | CPUID_SEF_FDPEXONLY |
+	CPUID_SEF_SMEP | CPUID_SEF_BMI2 |
+	CPUID_SEF_ERMS | CPUID_SEF_RTM |
+	CPUID_SEF_QM | CPUID_SEF_FPUCSDS |
+	CPUID_SEF_PQE | CPUID_SEF_RDSEED |
+	CPUID_SEF_ADX | CPUID_SEF_SMAP |
+	CPUID_SEF_CLFLUSHOPT | CPUID_SEF_CLWB,
+	.ecx =
+	/* Excluded: AVX512*, MAWAU, RDPID. */
+	CPUID_SEF_PREFETCHWT1 | CPUID_SEF_UMIP |
+	CPUID_SEF_PKU | CPUID_SEF_OSPKE |
+	CPUID_SEF_WAITPKG | CPUID_SEF_GFNI |
+	CPUID_SEF_VAES | CPUID_SEF_VPCLMULQDQ |
+	CPUID_SEF_CLDEMOTE | CPUID_SEF_MOVDIRI |
+	CPUID_SEF_MOVDIR64B | CPUID_SEF_SGXLC,
+	.edx =
+	/* Excluded: all except CAP. */
+	CPUID_SEF_ARCH_CAP
+};
+
+const struct nvmm_x86_cpuid_mask nvmm_cpuid_8001 = {
+	.eax = ~0,
+	.ebx = ~0,
+	.ecx =
+	/* Excluded: SVM, EAPIC, OSVW. */
+	CPUID_LAHF | CPUID_CMPLEGACY |
+	CPUID_ALTMOVCR0 | CPUID_LZCNT |
+	CPUID_SSE4A | CPUID_MISALIGNSSE |
+	CPUID_3DNOWPF | CPUID_IBS |
+	CPUID_XOP | CPUID_SKINIT |
+	CPUID_WDT | CPUID_LWP |
+	CPUID_FMA4 | CPUID_TCE |
+	CPUID_NODEID | CPUID_TBM |
+	CPUID_TOPOEXT | CPUID_PCEC |
+	CPUID_PCENB | CPUID_SPM |
+	CPUID_DBE | CPUID_PTSC |
+	CPUID_L2IPERFC | CPUID_MWAITX,
+	.edx =
+	/* Excluded: RDTSCP. */
+	CPUID_SYSCALL | CPUID_MPC |
+	CPUID_XD | CPUID_MMXX |
+	CPUID_MMX | CPUID_FXSR |
+	CPUID_FFXSR | CPUID_P1GB |
+	CPUID_EM64T | CPUID_3DNOW2 |
+	CPUID_3DNOW
+};

Index: src/sys/dev/nvmm/x86/nvmm_x86.h
diff -u src/sys/dev/nvmm/x86/nvmm_x86.h:1.7 src/sys/dev/nvmm/x86/nvmm_x86.h:1.8
--- src/sys/dev/nvmm/x86/nvmm_x86.h:1.7	Tue Feb 26 12:23:12 2019
+++ src/sys/dev/nvmm/x86/nvmm_x86.h	Sun Mar  3 07:01:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvmm_x86.h,v 1.7 2019/02/26 12:23:12 maxv Exp $	*/
+/*	$NetBSD: nvmm_x86.h,v 1.8 2019/03/03 07:01:09 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -175,7 +175,16 @@ struct nvmm_x86_conf_cpuid {
 };
 
 #ifdef _KERNEL
+struct nvmm_x86_cpuid_mask {

CVS commit: src/sbin/atactl

2019-03-02 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar  3 04:51:57 UTC 2019

Modified Files:
src/sbin/atactl: atactl.8 atactl.c

Log Message:
- smart vendor support now does try to guess the vendor,
  adjust the BUGS to suit
- claim some copyright


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sbin/atactl/atactl.8
cvs rdiff -u -r1.81 -r1.82 src/sbin/atactl/atactl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/atactl/atactl.8
diff -u src/sbin/atactl/atactl.8:1.28 src/sbin/atactl/atactl.8:1.29
--- src/sbin/atactl/atactl.8:1.28	Wed Dec  5 14:45:59 2018
+++ src/sbin/atactl/atactl.8	Sun Mar  3 04:51:57 2019
@@ -1,10 +1,10 @@
-.\"	$NetBSD: atactl.8,v 1.28 2018/12/05 14:45:59 wiz Exp $
+.\"	$NetBSD: atactl.8,v 1.29 2019/03/03 04:51:57 mrg Exp $
 .\"
-.\" Copyright (c) 1998 The NetBSD Foundation, Inc.
+.\" Copyright (c) 1998, 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
 .\"
 .\" This code is derived from software contributed to The NetBSD Foundation
-.\" by Ken Hornstein.
+.\" by Ken Hornstein and Matthew R. Green.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 5, 2018
+.Dd March 2, 2019
 .Dt ATACTL 8
 .Os
 .Sh NAME
@@ -293,6 +293,5 @@ locked.
 .Pp
 The
 .Cm smart status
-command is currently unable to automatically determine the vendor
-attribute name table to use.
-The vendor must be specified manually.
+command currently guesses the vendor attribute name table to use,
+and may be wrong or miss supported devices.

Index: src/sbin/atactl/atactl.c
diff -u src/sbin/atactl/atactl.c:1.81 src/sbin/atactl/atactl.c:1.82
--- src/sbin/atactl/atactl.c:1.81	Sun Mar  3 04:48:19 2019
+++ src/sbin/atactl/atactl.c	Sun Mar  3 04:51:57 2019
@@ -1,11 +1,11 @@
-/*	$NetBSD: atactl.c,v 1.81 2019/03/03 04:48:19 mrg Exp $	*/
+/*	$NetBSD: atactl.c,v 1.82 2019/03/03 04:51:57 mrg Exp $	*/
 
 /*-
- * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2019 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
- * by Ken Hornstein.
+ * by Ken Hornstein and Matthew R. Green.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -35,7 +35,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: atactl.c,v 1.81 2019/03/03 04:48:19 mrg Exp $");
+__RCSID("$NetBSD: atactl.c,v 1.82 2019/03/03 04:51:57 mrg Exp $");
 #endif
 
 



CVS commit: src/sbin/atactl

2019-03-02 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Mar  3 04:48:20 UTC 2019

Modified Files:
src/sbin/atactl: atactl.c

Log Message:
add a samsung specific SMART table with:

235 - POR Recovery Count
243 - SATA Downshift Count
244 - Thermal Throttle Status
245 - Timed Workload Media Wear
251 - NAND Writes

all 5 turn up on newer samsung SSDs, though 3 of them all
read 65535 for me across muliplte devices.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sbin/atactl/atactl.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/atactl/atactl.c
diff -u src/sbin/atactl/atactl.c:1.80 src/sbin/atactl/atactl.c:1.81
--- src/sbin/atactl/atactl.c:1.80	Fri Mar  1 02:33:43 2019
+++ src/sbin/atactl/atactl.c	Sun Mar  3 04:48:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: atactl.c,v 1.80 2019/03/01 02:33:43 mrg Exp $	*/
+/*	$NetBSD: atactl.c,v 1.81 2019/03/03 04:48:19 mrg Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include 
 
 #ifndef lint
-__RCSID("$NetBSD: atactl.c,v 1.80 2019/03/01 02:33:43 mrg Exp $");
+__RCSID("$NetBSD: atactl.c,v 1.81 2019/03/03 04:48:19 mrg Exp $");
 #endif
 
 
@@ -380,6 +380,18 @@ static const struct attr_table intel_sma
 };
 
 /*
+ * Samsung specific SMART attributes.  Fill me in with more.
+ */
+static const struct attr_table samsung_smart_names[] = {
+	{ 235,  "POR Recovery Count", NULL },
+	{ 243,  "SATA Downshift Count", NULL },
+	{ 244,  "Thermal Throttle Status", NULL },
+	{ 245,  "Timed Workload Media Wear", NULL },
+	{ 251,  "NAND Writes", NULL },
+};
+
+
+/*
  * Vendor-specific SMART attribute table.  Can be used to override
  * a particular attribute name and special printer function, with the
  * default is the main table.
@@ -390,6 +402,7 @@ static const struct vendor_name_table {
 } vendor_smart_names[] = {
 	{ "Micron",		micron_smart_names },
 	{ "Intel",		intel_smart_names },
+	{ "Samsung",		samsung_smart_names },
 };
 
 /*
@@ -410,6 +423,7 @@ static const struct model_to_vendor_tabl
 	{ "MTFDDA",		"Micron" },
 	{ "EEFDDA",		"Micron" },
 	{ "INTEL",		"Intel" },
+	{ "SAMSUNG",		"Samsung" },
 };
 
 static const struct bitinfo ata_sec_st[] = {



CVS commit: src/sbin/gpt

2019-03-02 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sun Mar  3 03:20:43 UTC 2019

Modified Files:
src/sbin/gpt: show.c

Log Message:
Make it clear when displaying data from the MBR.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sbin/gpt/show.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/show.c
diff -u src/sbin/gpt/show.c:1.41 src/sbin/gpt/show.c:1.42
--- src/sbin/gpt/show.c:1.41	Thu Sep  7 10:23:33 2017
+++ src/sbin/gpt/show.c	Sun Mar  3 03:20:42 2019
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/show.c,v 1.14 2006/06/22 22:22:32 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: show.c,v 1.41 2017/09/07 10:23:33 christos Exp $");
+__RCSID("$NetBSD: show.c,v 1.42 2019/03/03 03:20:42 jnemeth Exp $");
 #endif
 
 #include 
@@ -344,6 +344,9 @@ cmd_show(gpt_t gpt, int argc, char *argv
 	if (argc != optind)
 		return usage();
 
+	if (map_find(gpt, MAP_TYPE_PRI_GPT_HDR) == NULL)
+		printf("GPT not found, displaying data from MBR.\n\n");
+
 	if (xshow & SHOW_ALL)
 		return show_all(gpt);
 



CVS commit: src/sbin/gpt

2019-03-02 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Sun Mar  3 02:28:14 UTC 2019

Modified Files:
src/sbin/gpt: migrate.c

Log Message:
add some more FAT file system types


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sbin/gpt/migrate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/gpt/migrate.c
diff -u src/sbin/gpt/migrate.c:1.34 src/sbin/gpt/migrate.c:1.35
--- src/sbin/gpt/migrate.c:1.34	Sun Feb 10 10:35:51 2019
+++ src/sbin/gpt/migrate.c	Sun Mar  3 02:28:14 2019
@@ -33,7 +33,7 @@
 __FBSDID("$FreeBSD: src/sbin/gpt/migrate.c,v 1.16 2005/09/01 02:42:52 marcel Exp $");
 #endif
 #ifdef __RCSID
-__RCSID("$NetBSD: migrate.c,v 1.34 2019/02/10 10:35:51 martin Exp $");
+__RCSID("$NetBSD: migrate.c,v 1.35 2019/03/03 02:28:14 jnemeth Exp $");
 #endif
 
 #include 
@@ -289,13 +289,20 @@ migrate(gpt_t gpt, u_int parts, int forc
 			type = GPT_TYPE_EFI;
 			break;
 
-		case MBR_PTYPE_NTFS:
 		case MBR_PTYPE_FAT12:
 		case MBR_PTYPE_FAT16S:
 		case MBR_PTYPE_FAT16B:
+		case MBR_PTYPE_NTFS:
 		case MBR_PTYPE_FAT32:
 		case MBR_PTYPE_FAT32L:
 		case MBR_PTYPE_FAT16L:
+		case MBR_PTYPE_OS2_DOS12:
+		case MBR_PTYPE_OS2_DOS16S:
+		case MBR_PTYPE_OS2_DOS16B:
+		case MBR_PTYPE_OS2_IFS:
+		case MBR_PTYPE_HID_FAT32:
+		case MBR_PTYPE_HID_FAT32_LBA:
+		case MBR_PTYPE_HID_FAT16_LBA:
 			type = GPT_TYPE_MS_BASIC_DATA;
 			break;
 



CVS commit: src/external/gpl2/xcvs/dist/doc

2019-03-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  3 02:21:07 UTC 2019

Modified Files:
src/external/gpl2/xcvs/dist/doc: cvs.texinfo

Log Message:
Fix the build by merging duplicate "init" sections.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/gpl2/xcvs/dist/doc/cvs.texinfo

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl2/xcvs/dist/doc/cvs.texinfo
diff -u src/external/gpl2/xcvs/dist/doc/cvs.texinfo:1.6 src/external/gpl2/xcvs/dist/doc/cvs.texinfo:1.7
--- src/external/gpl2/xcvs/dist/doc/cvs.texinfo:1.6	Sat Mar  2 16:30:40 2019
+++ src/external/gpl2/xcvs/dist/doc/cvs.texinfo	Sat Mar  2 21:21:07 2019
@@ -1939,26 +1939,6 @@ possible to use @sc{cvs} to read from a 
 which one only has read access to; @sc{cvs} needs to be
 able to create lock files (@pxref{Concurrency}).
 
-@cindex init (subcommand)
-To create a repository, run the @code{cvs init}
-command.  It will set up an empty repository in the
-@sc{cvs} root specified in the usual way
-(@pxref{Repository}).  For example,
-
-@example
-cvs -d /usr/local/cvsroot init
-@end example
-
-@code{cvs init} is careful to never overwrite any
-existing files in the repository, so no harm is done if
-you run @code{cvs init} on an already set-up
-repository. Note you may need to be a member of the
-group @code{cvsadmin} to do this.
-
-@code{cvs init} will enable history logging; if you
-don't want that, remove the history file after running
-@code{cvs init}.  @xref{history file}.
-
 @node Backing up
 @section Backing up a repository
 @cindex Repository, backing up
@@ -10875,7 +10855,7 @@ See @ref{Tracking sources}, and @ref{Fro
 
 @itemize @bullet
 @item
-init
+Synopsis: init
 @item
 Requires: working directory.
 @item
@@ -10886,12 +10866,23 @@ The @code{init} command initializes a re
 @file{CVSROOT} subdirectory and some default control files. You must
 use this command or initialize the repository in some other way before
 you can use it. Specify the root of the repository with the general
-@code{-d} option.
+@code{-d} option.  This will set up an empty repository in the
+@sc{cvs} root specified in the usual way (@pxref{Repository}).
+For example,
+
+@code{cvs init} is careful to never overwrite any
+existing files in the repository, so no harm is done if
+you run @code{cvs init} on an already set-up
+repository. Note you may need to be a member of the
+group @code{cvsadmin} to do this.
 
 Note @code{init} will enable history logging; if you don't want that,
-remove the history file after running @code{init}.
+remove the history file after running @code{init}.  @xref{history file}.
+
+@menu
+* init examples:  init examples
+@end menu
 
-@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
 @node init examples
 @appendixsubsec init examples
 



CVS commit: src/external/gpl2/xcvs/dist/doc

2019-03-02 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sat Mar  2 21:30:40 UTC 2019

Modified Files:
src/external/gpl2/xcvs/dist/doc: cvs.1 cvs.texinfo

Log Message:
cvs.1 & cvs.texinfo: add details about "init"

Add a section about the "init" command that has been missing all this
time. Part of the basic description is resurrected from r. 1.20 of
cvs.1 (in its prior incarnation in the CVS project tree under /man
rather than /doc), contributed by Tom Lees back in 1999. The caveat
about the history file is copied from elsewhere in the current
cvs.texinfo file. Additional fragments written by me. Addresses the
PR bin/45446.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/gpl2/xcvs/dist/doc/cvs.1
cvs rdiff -u -r1.5 -r1.6 src/external/gpl2/xcvs/dist/doc/cvs.texinfo

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl2/xcvs/dist/doc/cvs.1
diff -u src/external/gpl2/xcvs/dist/doc/cvs.1:1.6 src/external/gpl2/xcvs/dist/doc/cvs.1:1.7
--- src/external/gpl2/xcvs/dist/doc/cvs.1:1.6	Tue Feb 12 01:32:08 2019
+++ src/external/gpl2/xcvs/dist/doc/cvs.1	Sat Mar  2 21:30:40 2019
@@ -3081,6 +3081,36 @@ see node `modules\(aq in the CVS manual.
 .SP
 See see node `Tracking sources\(aq in the CVS manual, and see node `From files\(aq in the CVS manual.
 .SP
+.SH "init"
+.SS "Initialize a repository"
+.IX "init (subcommand)"
+.SP
+.IP "\(bu" 2
+init
+.IP "\(bu" 2
+Requires: working directory.
+.IP "\(bu" 2
+Changes: repository, working directory.
+.SP
+The \fBinit\fR command initializes a repository by adding the
+\fBCVSROOT\fR subdirectory and some default control files. You must
+use this command or initialize the repository in some other way before
+you can use it. Specify the root of the repository with the general
+\fB-d\fR option.
+.SP
+Note \fBinit\fR will enable history logging; if you don\(aqt want that,
+remove the history file after running \fBinit\fR.
+.SP
+.SH "init examples"
+.SP
+.PD 0
+.SP
+.IP "" 2
+$ cvs -d /usr/local/cvsroot init
+
+.PD
+.IP "" 0
+.SP
 .SH "log"
 .SS "Print out log information for files"
 .IX "log (subcommand)"

Index: src/external/gpl2/xcvs/dist/doc/cvs.texinfo
diff -u src/external/gpl2/xcvs/dist/doc/cvs.texinfo:1.5 src/external/gpl2/xcvs/dist/doc/cvs.texinfo:1.6
--- src/external/gpl2/xcvs/dist/doc/cvs.texinfo:1.5	Tue Feb 12 01:32:08 2019
+++ src/external/gpl2/xcvs/dist/doc/cvs.texinfo	Sat Mar  2 21:30:40 2019
@@ -1952,7 +1952,8 @@ cvs -d /usr/local/cvsroot init
 @code{cvs init} is careful to never overwrite any
 existing files in the repository, so no harm is done if
 you run @code{cvs init} on an already set-up
-repository.
+repository. Note you may need to be a member of the
+group @code{cvsadmin} to do this.
 
 @code{cvs init} will enable history logging; if you
 don't want that, remove the history file after running
@@ -8126,6 +8127,7 @@ reference to @sc{cvs} commands, @pxref{I
 * export::  Export sources from CVS, similar to checkout
 * history:: Show status of files and users
 * import::  Import sources into CVS, using vendor branches
+* init::Initialize a repository
 * log:: Show log messages for files
 * ls & rls::List files in the repository
 * rdiff::   'patch' format diffs between releases
@@ -10867,6 +10869,37 @@ to recreate symbolic links on checkout, 
 See @ref{Tracking sources}, and @ref{From files}.
 
 @c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+@node init
+@appendixsec init---Initialize a repository
+@cindex init (subcommand)
+
+@itemize @bullet
+@item
+init
+@item
+Requires: working directory.
+@item
+Changes: repository, working directory.
+@end itemize
+
+The @code{init} command initializes a repository by adding the
+@file{CVSROOT} subdirectory and some default control files. You must
+use this command or initialize the repository in some other way before
+you can use it. Specify the root of the repository with the general
+@code{-d} option.
+
+Note @code{init} will enable history logging; if you don't want that,
+remove the history file after running @code{init}.
+
+@c . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
+@node init examples
+@appendixsubsec init examples
+
+@example
+$ cvs -d /usr/local/cvsroot init
+@end example
+
+@c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 @node log
 @appendixsec log---Print out log information for files
 @cindex log (subcommand)



CVS commit: src/sys/arch/evbarm/conf

2019-03-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Mar  2 19:59:06 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf: README.evbarm
Removed Files:
src/sys/arch/evbarm/conf: ODROID-C1_INSTALL

Log Message:
ODROID-C1 kernel is no more


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/sys/arch/evbarm/conf/ODROID-C1_INSTALL
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/evbarm/conf/README.evbarm

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/README.evbarm
diff -u src/sys/arch/evbarm/conf/README.evbarm:1.18 src/sys/arch/evbarm/conf/README.evbarm:1.19
--- src/sys/arch/evbarm/conf/README.evbarm:1.18	Sun Apr  8 13:19:17 2018
+++ src/sys/arch/evbarm/conf/README.evbarm	Sat Mar  2 19:59:06 2019
@@ -1,4 +1,4 @@
-$NetBSD: README.evbarm,v 1.18 2018/04/08 13:19:17 jmcneill Exp $
+$NetBSD: README.evbarm,v 1.19 2019/03/02 19:59:06 jmcneill Exp $
 
 config		date		boards
 ---
@@ -39,7 +39,6 @@ N900		2012/12/07	Nokia N900 smartphone
 NAPPI		2002/07/15	Netwise APlication Platform Board
 NETWALKER	2010/11/13	Sharp NetWalker
 NSLU2		2006/02/28	Linksys NSLU2 (a.k.a. "Slug")
-ODROID-C1	2015/02/07	Hardkernel ODROID-C1
 OPENBLOCKS_A6	2012/08/01	Plat'Home. OpenBlockS A6
 OPENBLOCKS_AX3	2013/09/30	Plat'Home. OpenBlockS AX3
 OPENRD		2012/08/10	open-rd.org Marvell Orion board



CVS commit: src/sys/arch/arm/sunxi

2019-03-02 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat Mar  2 16:55:13 UTC 2019

Modified Files:
src/sys/arch/arm/sunxi: sun6i_dma.c

Log Message:
Validate burst and width arguments.

Also add some more register definitions, and a (disabled) example of
how to set the DMA flow control mode.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/sunxi/sun6i_dma.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/sunxi/sun6i_dma.c
diff -u src/sys/arch/arm/sunxi/sun6i_dma.c:1.7 src/sys/arch/arm/sunxi/sun6i_dma.c:1.8
--- src/sys/arch/arm/sunxi/sun6i_dma.c:1.7	Sat Mar  2 03:21:17 2019
+++ src/sys/arch/arm/sunxi/sun6i_dma.c	Sat Mar  2 16:55:13 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sun6i_dma.c,v 1.7 2019/03/02 03:21:17 jakllsch Exp $ */
+/* $NetBSD: sun6i_dma.c,v 1.8 2019/03/02 16:55:13 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_ddb.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sun6i_dma.c,v 1.7 2019/03/02 03:21:17 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sun6i_dma.c,v 1.8 2019/03/02 16:55:13 jakllsch Exp $");
 
 #include 
 #include 
@@ -79,6 +79,13 @@ __KERNEL_RCSID(0, "$NetBSD: sun6i_dma.c,
 #define DMA_PARA_REG(n)			(0x0100 + (n) * 0x40 + 0x1C)
 #define  DMA_PARA_DATA_BLK_SIZE			__BITS(15,8)
 #define  DMA_PARA_WAIT_CYC			__BITS(7,0)
+#define DMA_MODE_REG(n)			(0x0100 + (n) * 0x40 + 0x28)
+#define  MODE_WAIT0b0
+#define  MODE_HANDSHAKE0b1
+#define  DMA_MODE_DST(m)			__SHIFTIN((m), __BIT(3))
+#define  DMA_MODE_SRC(m)			__SHIFTIN((m), __BIT(2))
+#define DMA_FDESC_ADDR_REG(n)		(0x0100 + (n) * 0x40 + 0x2C)
+#define DMA_PKG_NUM_REG(n)		(0x0100 + (n) * 0x40 + 0x30)
 
 struct sun6idma_desc {
 	uint32_t	dma_config;
@@ -93,14 +100,25 @@ struct sun6idma_desc {
 struct sun6idma_config {
 	u_int		num_channels;
 	bool		autogate;
+	uint8_t		bursts;
+	uint8_t		widths;
 	bus_size_t	autogate_reg;
 	uint32_t	autogate_mask;
 	uint32_t	burst_mask;
 };
 
+#define IL2B(x)			__BIT(ilog2(x))
+#define IL2B_RANGE(x, y)	__BITS(ilog2(x), ilog2(y))
+#define WIDTHS_1_2_4		IL2B_RANGE(4, 1)
+#define WIDTHS_1_2_4_8		IL2B_RANGE(8, 1)
+#define BURSTS_1_8		(IL2B(8)|IL2B(1))
+#define BURSTS_1_4_8_16		(IL2B(16)|IL2B(8)|IL2B(4)|IL2B(1))
+
 static const struct sun6idma_config sun6i_a31_dma_config = {
 	.num_channels = 16,
 	.burst_mask = __BITS(8,7),
+	.bursts = BURSTS_1_8,
+	.widths = WIDTHS_1_2_4,
 };
 
 static const struct sun6idma_config sun8i_a83t_dma_config = {
@@ -109,6 +127,8 @@ static const struct sun6idma_config sun8
 	.autogate_reg = 0x20,
 	.autogate_mask = 0x4,
 	.burst_mask = __BITS(8,7),
+	.bursts = BURSTS_1_8,
+	.widths = WIDTHS_1_2_4,
 };
 
 static const struct sun6idma_config sun8i_h3_dma_config = {
@@ -117,6 +137,8 @@ static const struct sun6idma_config sun8
 	.autogate_reg = 0x28,
 	.autogate_mask = 0x4,
 	.burst_mask = __BITS(7,6),
+	.bursts = BURSTS_1_4_8_16,
+	.widths = WIDTHS_1_2_4_8,
 };
 
 static const struct sun6idma_config sun50i_a64_dma_config = {
@@ -125,6 +147,8 @@ static const struct sun6idma_config sun5
 	.autogate_reg = 0x28,
 	.autogate_mask = 0x4,
 	.burst_mask = __BITS(7,6),
+	.bursts = BURSTS_1_4_8_16,
+	.widths = WIDTHS_1_2_4_8,
 };
 
 static const struct of_compat_data compat_data[] = {
@@ -158,6 +182,8 @@ struct sun6idma_softc {
 	struct sun6idma_channel	*sc_chan;
 	u_int			sc_nchan;
 	u_int			sc_ndesc_ch;
+	uint8_t			sc_widths;
+	uint8_t			sc_bursts;
 
 	bus_dma_segment_t	sc_dmasegs[1];
 	bus_dmamap_t		sc_dmamap;
@@ -259,6 +285,19 @@ sun6idma_transfer(device_t dev, void *pr
 	if (req->dreq_nsegs > sc->sc_ndesc_ch)
 		return EINVAL;
 
+	if ((sc->sc_widths &
+	IL2B(req->dreq_mem_opt.opt_bus_width/NBBY)) == 0)
+		return EINVAL;
+	if ((sc->sc_widths &
+	IL2B(req->dreq_dev_opt.opt_bus_width/NBBY)) == 0)
+		return EINVAL;
+	if ((sc->sc_bursts &
+	IL2B(req->dreq_mem_opt.opt_burst_len)) == 0)
+		return EINVAL;
+	if ((sc->sc_bursts &
+	IL2B(req->dreq_dev_opt.opt_burst_len)) == 0)
+		return EINVAL;
+
 	mem_width = DMA_CFG_DATA_WIDTH(req->dreq_mem_opt.opt_bus_width);
 	dev_width = DMA_CFG_DATA_WIDTH(req->dreq_dev_opt.opt_bus_width);
 	mem_burst = DMA_CFG_BST_LEN(req->dreq_mem_opt.opt_burst_len);
@@ -296,6 +335,11 @@ sun6idma_transfer(device_t dev, void *pr
 			desc[j].dma_next = htole32(DMA_NULL);
 	}
 
+#if maybenever
+	DMA_WRITE(sc, DMA_MODE_REG(ch->ch_index),
+	DMA_MODE_DST(MODE_HANDSHAKE)|DMA_MODE_SRC(MODE_HANDSHAKE));
+#endif
+
 	bus_dmamap_sync(sc->sc_dmat, sc->sc_dmamap, DESC_OFFS(ch->ch_index, 0),
 	DESC_LEN(req->dreq_nsegs), BUS_DMASYNC_PREWRITE);
 
@@ -419,6 +463,8 @@ sun6idma_attach(device_t parent, device_
 
 	sc->sc_burst_mask = conf->burst_mask;
 	sc->sc_nchan = conf->num_channels;
+	sc->sc_widths = conf->widths;
+	sc->sc_bursts = conf->bursts;
 	sc->sc_chan = kmem_alloc(sizeof(*sc->sc_chan) * sc->sc_nchan, KM_SLEEP);
 	desclen = DESC_OFFS(sc->sc_nchan, 0);
 	

CVS commit: src/sys/arch/sparc/sparc

2019-03-02 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Mar  2 14:21:19 UTC 2019

Modified Files:
src/sys/arch/sparc/sparc: pci_fixup.c

Log Message:
Catch up with MI pci changes.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sparc/sparc/pci_fixup.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/sparc/sparc/pci_fixup.c
diff -u src/sys/arch/sparc/sparc/pci_fixup.c:1.2 src/sys/arch/sparc/sparc/pci_fixup.c:1.3
--- src/sys/arch/sparc/sparc/pci_fixup.c:1.2	Fri Mar  1 04:25:59 2019
+++ src/sys/arch/sparc/sparc/pci_fixup.c	Sat Mar  2 09:21:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_fixup.c,v 1.2 2019/03/01 09:25:59 msaitoh Exp $	*/
+/*	$NetBSD: pci_fixup.c,v 1.3 2019/03/02 14:21:19 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
@@ -323,8 +323,8 @@ mspcic_pci_fixup(int depth, pcitag_t sta
 
 	/* Secondary bus = startbus, subordinate bus = 0xff */
 	pci_conf_write(NULL, starttag, PCI_BRIDGE_BUS_REG,
-	((startbus & 0xff) << PCI_BRIDGE_BUS_SECONDARY_SHIFT) |
-	(0xff << PCI_BRIDGE_BUS_SUBORDINATE_SHIFT));
+	__SHIFTIN(startbus & 0xff,  PCI_BRIDGE_BUS_SECONDARY) |
+	__SHIFTIN(0xff, PCI_BRIDGE_BUS_SUBORDINATE));
 
 	/*
 	 * Fix up bus numbering, bus addresses, device addresses,
@@ -441,8 +441,8 @@ mspcic_pci_fixup(int depth, pcitag_t sta
 
 	/* Secondary bus = startbus, subordinate bus = maxbus */
 	pci_conf_write(NULL, starttag, PCI_BRIDGE_BUS_REG,
-	((startbus & 0xff) << PCI_BRIDGE_BUS_SECONDARY_SHIFT) |
-	((*maxbus & 0xff) << PCI_BRIDGE_BUS_SUBORDINATE_SHIFT));
+	__SHIFTIN(startbus & 0xff,  PCI_BRIDGE_BUS_SECONDARY) |
+	__SHIFTIN(*maxbus & 0xff, PCI_BRIDGE_BUS_SUBORDINATE));
 
 	/* 16-bit I/O range */
 	val = ((startio & 0xf000) >> 8) | ((*(io) - 1) & 0xf000);



CVS commit: src/sys/dev/fdt

2019-03-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Mar  2 13:21:08 UTC 2019

Modified Files:
src/sys/dev/fdt: dwc2_fdt.c

Log Message:
Add support for Meson GXBB


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/dwc2_fdt.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/fdt/dwc2_fdt.c
diff -u src/sys/dev/fdt/dwc2_fdt.c:1.4 src/sys/dev/fdt/dwc2_fdt.c:1.5
--- src/sys/dev/fdt/dwc2_fdt.c:1.4	Sat Jan 19 20:53:32 2019
+++ src/sys/dev/fdt/dwc2_fdt.c	Sat Mar  2 13:21:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc2_fdt.c,v 1.4 2019/01/19 20:53:32 jmcneill Exp $	*/
+/*	$NetBSD: dwc2_fdt.c,v 1.5 2019/03/02 13:21:08 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dwc2_fdt.c,v 1.4 2019/01/19 20:53:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2_fdt.c,v 1.5 2019/03/02 13:21:08 jmcneill Exp $");
 
 #include 
 #include 
@@ -84,6 +84,7 @@ static const struct dwc2_fdt_config dwc2
 
 static const struct of_compat_data compat_data[] = {
 	{ "amlogic,meson8b-usb",	(uintptr_t)_fdt_meson8b_config },
+	{ "amlogic,meson-gxbb-usb",	(uintptr_t)_fdt_meson8b_config },
 	{ "rockchip,rk3066-usb",	(uintptr_t)_fdt_rk3066_config },
 	{ "snps,dwc2",			(uintptr_t)_fdt_generic_config },
 	{ NULL }
@@ -209,11 +210,14 @@ dwc2_fdt_amlogic_params(struct dwc2_fdt_
 
 	params->otg_cap = DWC2_CAP_PARAM_NO_HNP_SRP_CAPABLE;
 	params->speed = DWC2_SPEED_PARAM_HIGH;
+	params->dma_enable = 1;
+	params->enable_dynamic_fifo = 1,
 	params->host_rx_fifo_size = 512;
 	params->host_nperio_tx_fifo_size = 500;
 	params->host_perio_tx_fifo_size = 500;
 	params->host_channels = 16;
 	params->phy_type = DWC2_PHY_TYPE_PARAM_UTMI;
+	params->reload_ctl = 1,
 	params->ahbcfg = GAHBCFG_HBSTLEN_INCR8 << GAHBCFG_HBSTLEN_SHIFT;
 #ifdef DWC2_POWER_DOWN_PARAM_NONE
 	params->power_down = DWC2_POWER_DOWN_PARAM_NONE;



CVS commit: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic

2019-03-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Mar  2 12:25:15 UTC 2019

Modified Files:
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic:
meson-gx.dtsi

Log Message:
Fix IRQ trigger type for macirq, from upstream.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.6 -r1.2 \
src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-gx.dtsi

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-gx.dtsi
diff -u src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-gx.dtsi:1.1.1.6 src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-gx.dtsi:1.2
--- src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-gx.dtsi:1.1.1.6	Tue Jan 22 14:57:03 2019
+++ src/sys/external/gpl2/dts/dist/arch/arm64/boot/dts/amlogic/meson-gx.dtsi	Sat Mar  2 12:25:15 2019
@@ -462,7 +462,7 @@
 			compatible = "amlogic,meson-gx-dwmac", "amlogic,meson-gxbb-dwmac", "snps,dwmac";
 			reg = <0x0 0xc941 0x0 0x1
 			   0x0 0xc8834540 0x0 0x4>;
-			interrupts = ;
+			interrupts = ;
 			interrupt-names = "macirq";
 			status = "disabled";
 		};



CVS commit: src/sys/arch/arm/amlogic

2019-03-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Mar  2 12:24:44 UTC 2019

Modified Files:
src/sys/arch/arm/amlogic: meson_dwmac.c

Log Message:
Setup RGMII mode for Meson DWMAC


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/amlogic/meson_dwmac.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/amlogic/meson_dwmac.c
diff -u src/sys/arch/arm/amlogic/meson_dwmac.c:1.3 src/sys/arch/arm/amlogic/meson_dwmac.c:1.4
--- src/sys/arch/arm/amlogic/meson_dwmac.c:1.3	Mon Feb 25 19:30:17 2019
+++ src/sys/arch/arm/amlogic/meson_dwmac.c	Sat Mar  2 12:24:44 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_dwmac.c,v 1.3 2019/02/25 19:30:17 jmcneill Exp $ */
+/* $NetBSD: meson_dwmac.c,v 1.4 2019/03/02 12:24:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.3 2019/02/25 19:30:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_dwmac.c,v 1.4 2019/03/02 12:24:44 jmcneill Exp $");
 
 #include 
 #include 
@@ -48,8 +48,12 @@ __KERNEL_RCSID(0, "$NetBSD: meson_dwmac.
 
 #include 
 
-#define	GMAC_TX_RATE_MII		2500
-#define	GMAC_TX_RATE_RGMII		12500
+#define	PRG_ETHERNET_ADDR0		0x00
+#define	 CLKGEN_ENABLE			__BIT(12)
+#define	 PHY_CLK_ENABLE			__BIT(10)
+#define	 MP2_CLK_OUT_DIV		__BITS(9,7)
+#define	 TX_CLK_DELAY			__BITS(6,5)
+#define	 PHY_INTERFACE_SEL		__BIT(0)
 
 static const char * compatible[] = {
 	"amlogic,meson8b-dwmac",
@@ -87,6 +91,29 @@ meson_dwmac_reset(const int phandle)
 	return 0;
 }
 
+static void
+meson_dwmac_set_mode_rgmii(int phandle, bus_space_tag_t bst,
+bus_space_handle_t bsh, struct clk *clkin)
+{
+	u_int tx_delay;
+	uint32_t val;
+
+	const u_int div = clk_get_rate(clkin) / 25000;
+
+	if (of_getprop_uint32(phandle, "amlogic,tx-delay-ns", _delay) != 0)
+		tx_delay = 2;
+
+	val = bus_space_read_4(bst, bsh, PRG_ETHERNET_ADDR0);
+	val |= PHY_INTERFACE_SEL;
+	val &= ~TX_CLK_DELAY;
+	val |= __SHIFTIN((tx_delay >> 1), TX_CLK_DELAY);
+	val &= ~MP2_CLK_OUT_DIV;
+	val |= __SHIFTIN(div, MP2_CLK_OUT_DIV);
+	val |= PHY_CLK_ENABLE;
+	val |= CLKGEN_ENABLE;
+	bus_space_write_4(bst, bsh, PRG_ETHERNET_ADDR0, val);
+}
+
 static int
 meson_dwmac_intr(void *arg)
 {
@@ -109,21 +136,24 @@ meson_dwmac_attach(device_t parent, devi
 	struct dwc_gmac_softc * const sc = device_private(self);
 	struct fdt_attach_args * const faa = aux;
 	const int phandle = faa->faa_phandle;
+	bus_space_handle_t prgeth_bsh;
 	struct fdtbus_reset *rst_gmac;
-	struct clk *clk_gmac;
+	struct clk *clk_gmac, *clk_in[2];
 	const char *phy_mode;
 	char intrstr[128];
-	bus_addr_t addr;
-	bus_size_t size;
+	bus_addr_t addr[2];
+	bus_size_t size[2];
 
-	if (fdtbus_get_reg(phandle, 0, , ) != 0) {
+	if (fdtbus_get_reg(phandle, 0, [0], [0]) != 0 ||
+	fdtbus_get_reg(phandle, 1, [1], [1]) != 0) {
 		aprint_error(": couldn't get registers\n");
 		return;
 	}
 
 	sc->sc_dev = self;
 	sc->sc_bst = faa->faa_bst;
-	if (bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh) != 0) {
+	if (bus_space_map(sc->sc_bst, addr[0], size[0], 0, >sc_bsh) != 0 ||
+	bus_space_map(sc->sc_bst, addr[1], size[1], 0, _bsh) != 0) {
 		aprint_error(": couldn't map registers\n");
 		return;
 	}
@@ -135,7 +165,9 @@ meson_dwmac_attach(device_t parent, devi
 	}
 
 	clk_gmac = fdtbus_clock_get(phandle, "stmmaceth");
-	if (clk_gmac == NULL) {
+	clk_in[0] = fdtbus_clock_get(phandle, "clkin0");
+	clk_in[1] = fdtbus_clock_get(phandle, "clkin1");
+	if (clk_gmac == NULL || clk_in[0] == NULL || clk_in[1] == NULL) {
 		aprint_error(": couldn't get clocks\n");
 		return;
 	}
@@ -147,22 +179,13 @@ meson_dwmac_attach(device_t parent, devi
 		aprint_error(": missing 'phy-mode' property\n");
 		return;
 	}
-#if notyet
-	if (strcmp(phy_mode, "mii") == 0) {
-		if (clk_set_rate(clk_gmac_tx, GMAC_TX_RATE_MII) != 0) {
-			aprint_error(": failed to set TX clock rate (MII)\n");
-			return;
-		}
-	} else if (strcmp(phy_mode, "rgmii") == 0) {
-		if (clk_set_rate(clk_gmac_tx, GMAC_TX_RATE_RGMII) != 0) {
-			aprint_error(": failed to set TX clock rate (RGMII)\n");
-			return;
-		}
+
+	if (strcmp(phy_mode, "rgmii") == 0) {
+		meson_dwmac_set_mode_rgmii(phandle, sc->sc_bst, prgeth_bsh, clk_in[0]);
 	} else {
 		aprint_error(": unsupported phy-mode '%s'\n", phy_mode);
 		return;
 	}
-#endif
 
 	if (clk_enable(clk_gmac) != 0) {
 		aprint_error(": couldn't enable clock\n");



CVS commit: src/sys/arch/arm/amlogic

2019-03-02 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Mar  2 11:15:55 UTC 2019

Modified Files:
src/sys/arch/arm/amlogic: meson_pinctrl.c

Log Message:
When acquiring a GPIO, disable any conflicting pinctrl function groups


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/amlogic/meson_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/amlogic/meson_pinctrl.c
diff -u src/sys/arch/arm/amlogic/meson_pinctrl.c:1.3 src/sys/arch/arm/amlogic/meson_pinctrl.c:1.4
--- src/sys/arch/arm/amlogic/meson_pinctrl.c:1.3	Mon Feb 25 19:30:17 2019
+++ src/sys/arch/arm/amlogic/meson_pinctrl.c	Sat Mar  2 11:15:55 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_pinctrl.c,v 1.3 2019/02/25 19:30:17 jmcneill Exp $ */
+/* $NetBSD: meson_pinctrl.c,v 1.4 2019/03/02 11:15:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "opt_soc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.3 2019/02/25 19:30:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_pinctrl.c,v 1.4 2019/03/02 11:15:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -321,8 +321,10 @@ meson_pinctrl_gpio_acquire(device_t dev,
 {
 	struct meson_pinctrl_softc * const sc = device_private(dev);
 	const struct meson_pinctrl_gpio *pin_def;
+	const struct meson_pinctrl_group *group;
 	struct meson_pinctrl_gpio_pin *gpin;
 	const u_int *gpio = data;
+	u_int n, bank;
 
 	if (len != 12)
 		return NULL;
@@ -334,6 +336,15 @@ meson_pinctrl_gpio_acquire(device_t dev,
 	if (pin_def == NULL)
 		return NULL;
 
+	/* Disable conflicting groups */
+	for (n = 0; n < sc->sc_conf->ngroups; n++) {
+		group = >sc_conf->groups[n];
+		for (bank = 0; bank < group->nbank; bank++) {
+			if (group->bank[bank] == pin_def->id)
+meson_pinctrl_set_group(sc, group, false);
+		}
+	}
+
 	mutex_enter(>sc_lock);
 	meson_pinctrl_pin_dir(sc, pin_def, flags);
 	mutex_exit(>sc_lock);