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

2018-09-09 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Sep 10 05:14:42 UTC 2018

Modified Files:
src/sys/arch/aarch64/aarch64: locore.S

Log Message:
Fix typos and DEBUG_MMU output.  From Rin Okuyama.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/aarch64/aarch64/locore.S

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/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.22 src/sys/arch/aarch64/aarch64/locore.S:1.23
--- src/sys/arch/aarch64/aarch64/locore.S:1.22	Tue Sep  4 15:50:25 2018
+++ src/sys/arch/aarch64/aarch64/locore.S	Mon Sep 10 05:14:42 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.22 2018/09/04 15:50:25 skrll Exp $	*/
+/*	$NetBSD: locore.S,v 1.23 2018/09/10 05:14:42 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -35,7 +35,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.22 2018/09/04 15:50:25 skrll Exp $")
+RCSID("$NetBSD: locore.S,v 1.23 2018/09/10 05:14:42 skrll Exp $")
 
 /* #define DEBUG_LOCORE */
 /* #define DEBUG_MMU */
@@ -553,7 +553,7 @@ ENTRY_NP(_print_x0)
 	ret
 END(_print_x0)
 
-/* Preserve x{0,1,2} descpite them being caller saved */
+/* Preserve x{0,1,2} despite them being caller saved */
 ENTRY_NP(print_x0)
 	stp	x0, lr, [sp, #-16]!
 	stp	x1, x2, [sp, #-16]!
@@ -564,7 +564,7 @@ ENTRY_NP(print_x0)
 	ret
 END(print_x0)
 
-/* Preserve x{0,1,2} descpite them being caller saved */
+/* Preserve x{0,1,2} despite them being caller saved */
 ENTRY_NP(printn_x1)
 	stp	x0, lr, [sp, #-16]!
 	stp	x1, x2, [sp, #-16]!
@@ -575,7 +575,7 @@ ENTRY_NP(printn_x1)
 	ret
 END(printn_x1)
 
-/* Preserve x{0,1,2} descpite them being caller saved */
+/* Preserve x{0,1,2} despite them being caller saved */
 ENTRY_NP(print_x2)
 	stp	x0, lr, [sp, #-16]!
 	mov	x0, x2
@@ -802,7 +802,7 @@ ENTRY_NP(l1_setblocks)
 
 #ifdef DEBUG_MMU
 	PRINT("L1 entry[")
-	mov	x1, x19
+	mov	x1, x20
 	bl	printn_x1
 	PRINT("]=")
 	mov	x2, x21
@@ -877,7 +877,7 @@ ENTRY_NP(l2_setblocks)
 
 #ifdef DEBUG_MMU
 	PRINT("L2 entry[")
-	mov	x1, x19
+	mov	x1, x20
 	bl	printn_x1
 	PRINT("]=")
 	mov	x2, x21



CVS commit: src/sys/arch

2018-09-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Sep 10 05:08:55 UTC 2018

Modified Files:
src/sys/arch/x86/x86: intr.c
src/sys/arch/xen/include: intrdefs.h

Log Message:
Make the use of 'irqs' in the range 0 < irq < 255 by xen
as a handle for internal use explicit.

This allows us to pass up the handle as "legacy" irq while
establishing interrupt handlers for xen.

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.127 -r1.128 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/xen/include/intrdefs.h

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

Modified files:

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.127 src/sys/arch/x86/x86/intr.c:1.128
--- src/sys/arch/x86/x86/intr.c:1.127	Tue Jul  3 11:45:54 2018
+++ src/sys/arch/x86/x86/intr.c	Mon Sep 10 05:08:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.127 2018/07/03 11:45:54 kamil Exp $	*/
+/*	$NetBSD: intr.c,v 1.128 2018/09/10 05:08:55 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.127 2018/07/03 11:45:54 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.128 2018/09/10 05:08:55 cherry Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1266,15 +1266,18 @@ intr_establish_xname(int legacy_irq, str
 	intr_handle_t irq;
 	int evtchn;
 
-	KASSERTMSG(legacy_irq == -1 || (0 <= legacy_irq && legacy_irq < 16),
+	KASSERTMSG(legacy_irq == -1 || (0 <= legacy_irq && legacy_irq < NUM_XEN_IRQS),
 	"bad legacy IRQ value: %d", legacy_irq);
 	KASSERTMSG(!(legacy_irq == -1 && pic == _pic),
 	"non-legacy IRQon i8259 ");
 
 	if (pic->pic_type != PIC_I8259) {
 #if NIOAPIC > 0
+		/* Are we passing mp tranmogrified/cascaded irqs ? */
+		irq = (legacy_irq == -1) ? 0 : legacy_irq;
+
 		/* will do interrupts via I/O APIC */
-		irq = APIC_INT_VIA_APIC;
+		irq |= APIC_INT_VIA_APIC;
 		irq |= pic->pic_apicid << APIC_INT_APIC_SHIFT;
 		irq |= pin << APIC_INT_PIN_SHIFT;
 #else /* NIOAPIC */

Index: src/sys/arch/xen/include/intrdefs.h
diff -u src/sys/arch/xen/include/intrdefs.h:1.12 src/sys/arch/xen/include/intrdefs.h:1.13
--- src/sys/arch/xen/include/intrdefs.h:1.12	Mon May 19 22:47:54 2014
+++ src/sys/arch/xen/include/intrdefs.h	Mon Sep 10 05:08:55 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: intrdefs.h,v 1.12 2014/05/19 22:47:54 rmind Exp $ */
+/* $NetBSD: intrdefs.h,v 1.13 2018/09/10 05:08:55 cherry Exp $ */
 
 /* This file co-exists, and is included via machine/intrdefs.h */
 
@@ -17,4 +17,7 @@
 /* Note: IPI_KICK does not have a handler. */
 #define XEN_NIPIS		6
 
+/* The number of 'irqs' that XEN understands */
+#define NUM_XEN_IRQS 		256
+
 #endif /* _XEN_INTRDEFS_H_ */



CVS commit: src/sys/arch/x86/pci

2018-09-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Mon Sep 10 02:49:23 UTC 2018

Modified Files:
src/sys/arch/x86/pci: pci_intr_machdep.c

Log Message:
In the NIOAPIC case, we do not need to support "legacy" irqs,
ie; We don't need to simultaneously pass back the irq in the
range 0 < irq < 16 (which are sometimes described as "legacy"
in src

This was non-obvious, until the semantics of "legacy" were
used in inconsistent ways in Xen (to also mean interrupts in
the 0 < irq < 256 range) which causes problems with attempting
to unify the sys/arch/x86/isa/isa_machdep.c:isa_intr_establish_xname()
function between XEN and !XEN

This commit should not affect current functionality on any
either native or Xen. It is needed for future code reorg, and
published now as a preview.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/x86/pci/pci_intr_machdep.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_intr_machdep.c
diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.43 src/sys/arch/x86/pci/pci_intr_machdep.c:1.44
--- src/sys/arch/x86/pci/pci_intr_machdep.c:1.43	Sun Jun 24 11:51:15 2018
+++ src/sys/arch/x86/pci/pci_intr_machdep.c	Mon Sep 10 02:49:23 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_intr_machdep.c,v 1.43 2018/06/24 11:51:15 jdolecek Exp $	*/
+/*	$NetBSD: pci_intr_machdep.c,v 1.44 2018/09/10 02:49:23 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.43 2018/06/24 11:51:15 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_intr_machdep.c,v 1.44 2018/09/10 02:49:23 cherry Exp $");
 
 #include 
 #include 
@@ -294,9 +294,7 @@ pci_intr_find_intx_irq(pci_intr_handle_t
 			return ENOENT;
 		*pic = >sc_pic;
 		*pin = APIC_IRQ_PIN(ih);
-		*irq = APIC_IRQ_LEGACY_IRQ(ih);
-		if (*irq < 0 || *irq >= NUM_LEGACY_IRQS)
-			*irq = -1;
+		*irq = -1; /* PCI doesn't use legacy irq */
 	}
 #endif
 



CVS commit: [pgoyette-compat] src/sys/conf

2018-09-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep  9 22:35:23 UTC 2018

Added Files:
src/sys/conf [pgoyette-compat]: compat_netbsd80.config

Log Message:
Add compat_netbsd80.config


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/sys/conf/compat_netbsd80.config

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

Added files:

Index: src/sys/conf/compat_netbsd80.config
diff -u /dev/null src/sys/conf/compat_netbsd80.config:1.1.2.1
--- /dev/null	Sun Sep  9 22:35:23 2018
+++ src/sys/conf/compat_netbsd80.config	Sun Sep  9 22:35:23 2018
@@ -0,0 +1,9 @@
+#	$NetBSD: compat_netbsd80.config,v 1.1.2.1 2018/09/09 22:35:23 pgoyette Exp $
+
+# Common fragment for all NetBSD targets wanting NetBSD 7.0 and newer
+# compatibility support.
+#
+# Note that COMPAT_80 implies all newer COMPAT_XX options.
+
+include"conf/compat_netbsd.config"
+options 	COMPAT_80	# NetBSD 8.0 and beyond.



CVS commit: [pgoyette-compat] src/sys/dev/raidframe

2018-09-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep  9 22:12:16 UTC 2018

Modified Files:
src/sys/dev/raidframe [pgoyette-compat]: rf_netbsdkintf.c

Log Message:
In the case of no compat modules (ENOSYS returned from the stubs), reset
the retcode to zero so we don't return the wrong value when there is
nothing to do for the particular command.  This was causing spurious
failures for RAIDFRAME_SET_COMPONENT_LABEL which is wrapped in

#if 0
...
#endif


To generate a diff of this commit:
cvs rdiff -u -r1.356.2.1 -r1.356.2.2 src/sys/dev/raidframe/rf_netbsdkintf.c

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

Modified files:

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.356.2.1 src/sys/dev/raidframe/rf_netbsdkintf.c:1.356.2.2
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.356.2.1	Sat Mar 24 01:59:15 2018
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sun Sep  9 22:12:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.356.2.1 2018/03/24 01:59:15 pgoyette Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.356.2.2 2018/09/09 22:12:16 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.356.2.1 2018/03/24 01:59:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.356.2.2 2018/09/09 22:12:16 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -1123,7 +1123,7 @@ raidioctl(dev_t dev, u_long cmd, void *d
 	retcode = (*raidframe50_ioctl)(cmd, (rs->sc_flags & RAIDF_INITED),
 	raidPtr, unit, data, _cfg);
 	if (retcode == ENOSYS)
-		retcode = EINVAL;
+		retcode = 0;
 	else if (retcode == EAGAIN)
 		goto config;
 	else if (retcode != EPASSTHROUGH)
@@ -1132,11 +1132,12 @@ raidioctl(dev_t dev, u_long cmd, void *d
 	retcode = (*raidframe80_ioctl)(cmd, (rs->sc_flags & RAIDF_INITED),
 	raidPtr, unit, data, _cfg);
 	if (retcode == ENOSYS)
-		retcode = EINVAL;
+		retcode = 0;
 	else if (retcode == EAGAIN)
 		goto config;
 	else if (retcode != EPASSTHROUGH)
 		return retcode;
+
 	/*
 	 * XXX
 	 * Handling of FAIL_DISK80 command requires us to retain retcode's



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

2018-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  9 21:16:05 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: psci_fdt.c

Log Message:
Boot APs with status "disabled" if they have an enable-method property


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/arm/fdt/psci_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/arch/arm/fdt/psci_fdt.c
diff -u src/sys/arch/arm/fdt/psci_fdt.c:1.16 src/sys/arch/arm/fdt/psci_fdt.c:1.17
--- src/sys/arch/arm/fdt/psci_fdt.c:1.16	Sun Sep  9 13:32:26 2018
+++ src/sys/arch/arm/fdt/psci_fdt.c	Sun Sep  9 21:16:05 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: psci_fdt.c,v 1.16 2018/09/09 13:32:26 jmcneill Exp $ */
+/* $NetBSD: psci_fdt.c,v 1.17 2018/09/09 21:16:05 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.16 2018/09/09 13:32:26 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.17 2018/09/09 21:16:05 jmcneill Exp $");
 
 #include 
 #include 
@@ -169,6 +169,27 @@ psci_fdt_mpstart_pa(void)
 }
 #endif
 
+static bool
+psci_fdt_cpu_okay(const int child)
+{
+	const char *s;
+
+	s = fdtbus_get_string(child, "device_type");
+	if (!s || strcmp(s, "cpu") != 0)
+		return false;
+
+	s = fdtbus_get_string(child, "status");
+	if (s) {
+		if (strcmp(s, "okay") == 0)
+			return false;
+		if (strcmp(s, "disabled") == 0)
+			return of_hasprop(child, "enable-method");
+		return false;
+	} else {
+		return true;
+	}
+}
+
 void
 psci_fdt_bootstrap(void)
 {
@@ -202,7 +223,7 @@ psci_fdt_bootstrap(void)
 	/* Boot APs */
 	cpuindex = 1;
 	for (child = OF_child(cpus); child; child = OF_peer(child)) {
-		if (!fdtbus_status_okay(child))
+		if (!psci_fdt_cpu_okay(child))
 			continue;
 		if (fdtbus_get_reg64(child, 0, , NULL) != 0)
 			continue;



CVS commit: src/sys/dev/fdt

2018-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  9 21:15:21 UTC 2018

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

Log Message:
Attach cpu nodes with status "disabled" if they have an enable-method
property. This is a valid configuration according to the devicetree
specification.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/fdt/cpus.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/cpus.c
diff -u src/sys/dev/fdt/cpus.c:1.3 src/sys/dev/fdt/cpus.c:1.4
--- src/sys/dev/fdt/cpus.c:1.3	Sat Jun 30 16:30:35 2018
+++ src/sys/dev/fdt/cpus.c	Sun Sep  9 21:15:21 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpus.c,v 1.3 2018/06/30 16:30:35 jmcneill Exp $ */
+/* $NetBSD: cpus.c,v 1.4 2018/09/09 21:15:21 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.3 2018/06/30 16:30:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.4 2018/09/09 21:15:21 jmcneill Exp $");
 
 #include 
 #include 
@@ -42,6 +42,8 @@ __KERNEL_RCSID(0, "$NetBSD: cpus.c,v 1.3
 static int	cpus_match(device_t, cfdata_t, void *);
 static void	cpus_attach(device_t, device_t, void *);
 
+static bool	cpus_bus_match(void *, int);
+
 CFATTACH_DECL_NEW(cpus, 0, cpus_match, cpus_attach, NULL, NULL);
 
 static int
@@ -61,5 +63,28 @@ cpus_attach(device_t parent, device_t se
 	aprint_naive("\n");
 	aprint_normal("\n");
 
-	fdt_add_bus(self, phandle, faa);
+	fdt_add_bus_match(self, phandle, faa, cpus_bus_match, NULL);
+}
+
+static bool
+cpus_bus_match(void *priv, int child)
+{
+	const char *s;
+
+	/* Only match nodes with device_type = "cpu" */
+	s = fdtbus_get_string(child, "device_type");
+	if (!s || strcmp(s, "cpu") != 0)
+		return false;
+
+	/* If status is set, it must be either "okay" or "disabled" */
+	s = fdtbus_get_string(child, "status");
+	if (s) {
+		if (strcmp(s, "okay") == 0)
+			return false;
+		if (strcmp(s, "disabled") == 0)
+			return of_hasprop(child, "enable-method");
+		return false;
+	} else {
+		return true;
+	}
 }



CVS commit: src/sys/dev/fdt

2018-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  9 21:14:04 UTC 2018

Modified Files:
src/sys/dev/fdt: fdtbus.c fdtvar.h

Log Message:
Add fdt_add_bus_match, which is like fdt_add_bus but allows for the caller to 
filter child nodes on their own


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/fdt/fdtbus.c
cvs rdiff -u -r1.40 -r1.41 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/fdtbus.c
diff -u src/sys/dev/fdt/fdtbus.c:1.22 src/sys/dev/fdt/fdtbus.c:1.23
--- src/sys/dev/fdt/fdtbus.c:1.22	Sat Jun 30 17:28:09 2018
+++ src/sys/dev/fdt/fdtbus.c	Sun Sep  9 21:14:04 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtbus.c,v 1.22 2018/06/30 17:28:09 jmcneill Exp $ */
+/* $NetBSD: fdtbus.c,v 1.23 2018/09/09 21:14:04 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.22 2018/06/30 17:28:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdtbus.c,v 1.23 2018/09/09 21:14:04 jmcneill Exp $");
 
 #include 
 #include 
@@ -157,14 +157,27 @@ fdt_init_attach_args(const struct fdt_at
 	faa->faa_quiet = quiet;
 }
 
+static bool
+fdt_add_bus_stdmatch(void *arg, int child)
+{
+	return fdtbus_status_okay(child);
+}
+
 void
 fdt_add_bus(device_t bus, const int phandle, struct fdt_attach_args *faa)
 {
+	fdt_add_bus_match(bus, phandle, faa, fdt_add_bus_stdmatch, NULL);
+}
+
+void
+fdt_add_bus_match(device_t bus, const int phandle, struct fdt_attach_args *faa,
+bool (*fn)(void *, int), void *fnarg)
+{
 	struct fdt_node *node;
 	int child;
 
 	for (child = OF_child(phandle); child; child = OF_peer(child)) {
-		if (!fdtbus_status_okay(child))
+		if (fn && !fn(fnarg, child))
 			continue;
 
 		/* Add the node to our device list */

Index: src/sys/dev/fdt/fdtvar.h
diff -u src/sys/dev/fdt/fdtvar.h:1.40 src/sys/dev/fdt/fdtvar.h:1.41
--- src/sys/dev/fdt/fdtvar.h:1.40	Sun Sep  9 07:21:18 2018
+++ src/sys/dev/fdt/fdtvar.h	Sun Sep  9 21:14:04 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdtvar.h,v 1.40 2018/09/09 07:21:18 aymeric Exp $ */
+/* $NetBSD: fdtvar.h,v 1.41 2018/09/09 21:14:04 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -358,6 +358,8 @@ const char *	fdtbus_get_string(int, cons
 const char *	fdtbus_get_string_index(int, const char *, u_int);
 
 void		fdt_add_bus(device_t, int, struct fdt_attach_args *);
+void		fdt_add_bus_match(device_t, int, struct fdt_attach_args *,
+  bool (*)(void *, int), void *);
 
 void		fdt_remove_byhandle(int);
 void		fdt_remove_bycompat(const char *[]);



CVS commit: src/tools/compat

2018-09-09 Thread Palle Lyckegaard
Module Name:src
Committed By:   palle
Date:   Sun Sep  9 19:17:21 UTC 2018

Modified Files:
src/tools/compat: README

Log Message:
Add instructions for building NetBSD on modern Solaris 11 hosts


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tools/compat/README

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

Modified files:

Index: src/tools/compat/README
diff -u src/tools/compat/README:1.12 src/tools/compat/README:1.13
--- src/tools/compat/README:1.12	Tue Apr  5 00:21:22 2005
+++ src/tools/compat/README	Sun Sep  9 19:17:21 2018
@@ -1,4 +1,4 @@
-$NetBSD: README,v 1.12 2005/04/05 00:21:22 jmc Exp $
+$NetBSD: README,v 1.13 2018/09/09 19:17:21 palle Exp $
 
 Special notes for cross-hosting a NetBSD build on certain platforms.  
 Only those platforms which have been tested to complete a "build.sh" run
@@ -65,6 +65,8 @@ NETBSD (earlier releases):
 
 SOLARIS:
 
+(updated instruction for Solaris 11 further below)
+
 * Tested on Solaris/x86 8 (5.8) with gcc 2.95.2 and Solaris/sparc 8 (5.8)
   with gcc 3.2 (not yet tested with SUNWspro).
 
@@ -85,3 +87,16 @@ SOLARIS:
   /usr/ucb may optionally be placed before /usr/bin, per your preference,
   but /usr/ucb *MUST NOT* be before /usr/ccs/bin or before the path to
   the host C and C++ compilers.
+
+Solaris 11:
+
+* Solaris 11.3
+ * Set PATH to /usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
+ * Set HOST_CC to /usr/bin/gcc
+
+* Solaris 11.4
+ * Install gcc-5 since the default installed gcc-7 has issues when compiling 
+   toolchain version of groff (hypot())
+ * Set PATH to /usr/xpg7/bin:/usr/xpg6/bin:/usr/xpg4/bin:/usr/bin
+ * set HOST_CC to /usr/gcc/5/bin/gcc
+ * set HOST_CXX to /usr/gcc/5/bin/g++



CVS commit: src/sys/stand/efiboot

2018-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  9 18:00:20 UTC 2018

Modified Files:
src/sys/stand/efiboot: boot.c efiboot.c efiboot.h

Log Message:
Add a reboot command to the bootloader


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/stand/efiboot/boot.c
cvs rdiff -u -r1.5 -r1.6 src/sys/stand/efiboot/efiboot.c \
src/sys/stand/efiboot/efiboot.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/stand/efiboot/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.8 src/sys/stand/efiboot/boot.c:1.9
--- src/sys/stand/efiboot/boot.c:1.8	Sun Sep  9 17:55:22 2018
+++ src/sys/stand/efiboot/boot.c	Sun Sep  9 18:00:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.8 2018/09/09 17:55:22 jmcneill Exp $	*/
+/*	$NetBSD: boot.c,v 1.9 2018/09/09 18:00:20 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -80,6 +80,8 @@ const struct boot_command commands[] = {
 	{ "setenv",	command_setenv,		"setenv  " },
 	{ "clearenv",	command_clearenv,	"clearenv " },
 	{ "resetenv",	command_resetenv,	"resetenv" },
+	{ "reboot",	command_reset,		"reboot|reset" },
+	{ "reset",	command_reset,		NULL },
 	{ "version",	command_version,	"version" },
 	{ "help",	command_help,		"help|?" },
 	{ "?",		command_help,		NULL },
@@ -216,6 +218,12 @@ command_quit(char *arg)
 	efi_exit();
 }
 
+void
+command_reset(char *arg)
+{
+	efi_reboot();
+}
+
 int
 set_default_device(char *arg)
 {

Index: src/sys/stand/efiboot/efiboot.c
diff -u src/sys/stand/efiboot/efiboot.c:1.5 src/sys/stand/efiboot/efiboot.c:1.6
--- src/sys/stand/efiboot/efiboot.c:1.5	Mon Sep  3 00:04:02 2018
+++ src/sys/stand/efiboot/efiboot.c	Sun Sep  9 18:00:20 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: efiboot.c,v 1.5 2018/09/03 00:04:02 jmcneill Exp $ */
+/* $NetBSD: efiboot.c,v 1.6 2018/09/09 18:00:20 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -109,6 +109,14 @@ efi_exit(void)
 }
 
 void
+efi_reboot(void)
+{
+	uefi_call_wrapper(RT->ResetSystem, 4, EfiResetCold, EFI_SUCCESS, 0, NULL);
+
+	printf("WARNING: Reset failed\n");
+}
+
+void
 efi_delay(int us)
 {
 	EFI_STATUS status;
Index: src/sys/stand/efiboot/efiboot.h
diff -u src/sys/stand/efiboot/efiboot.h:1.5 src/sys/stand/efiboot/efiboot.h:1.6
--- src/sys/stand/efiboot/efiboot.h:1.5	Sun Sep  9 13:37:54 2018
+++ src/sys/stand/efiboot/efiboot.h	Sun Sep  9 18:00:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.h,v 1.5 2018/09/09 13:37:54 jmcneill Exp $	*/
+/*	$NetBSD: efiboot.h,v 1.6 2018/09/09 18:00:20 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -67,6 +67,7 @@ extern EFI_LOADED_IMAGE *efi_li;
 void efi_cleanup(void);
 void efi_exit(void);
 void efi_delay(int);
+void efi_reboot(void);
 
 /* efichar.c */
 size_t ucs2len(const CHAR16 *);



CVS commit: src/sys/stand/efiboot

2018-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  9 17:55:22 UTC 2018

Modified Files:
src/sys/stand/efiboot: Makefile.efiboot boot.c version
Added Files:
src/sys/stand/efiboot: efienv.c efienv.h

Log Message:
Add support for setting environment variables. Currently the following env
vars are supported: "fdtfile", "initrd", and "rootdev".


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.7 -r1.8 src/sys/stand/efiboot/boot.c
cvs rdiff -u -r0 -r1.1 src/sys/stand/efiboot/efienv.c \
src/sys/stand/efiboot/efienv.h
cvs rdiff -u -r1.2 -r1.3 src/sys/stand/efiboot/version

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

Modified files:

Index: src/sys/stand/efiboot/Makefile.efiboot
diff -u src/sys/stand/efiboot/Makefile.efiboot:1.3 src/sys/stand/efiboot/Makefile.efiboot:1.4
--- src/sys/stand/efiboot/Makefile.efiboot:1.3	Mon Sep  3 00:04:02 2018
+++ src/sys/stand/efiboot/Makefile.efiboot	Sun Sep  9 17:55:22 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.3 2018/09/03 00:04:02 jmcneill Exp $
+# $NetBSD: Makefile.efiboot,v 1.4 2018/09/09 17:55:22 jmcneill Exp $
 
 S=		${.CURDIR}/../../..
 
@@ -22,7 +22,7 @@ AFLAGS.start.S= ${${ACTIVE_CC} == "clang
 .PATH: ${EFIDIR}/gnuefi
 SOURCES=	crt0-efi-${GNUEFIARCH}.S reloc_${GNUEFIARCH}.c
 SOURCES+=	boot.c conf.c console.c dev_net.c devopen.c exec.c panic.c prompt.c
-SOURCES+=	efiboot.c efichar.c efidev.c efigetsecs.c efifdt.c efifile.c efiblock.c efinet.c efipxe.c
+SOURCES+=	efiboot.c efichar.c efidev.c efienv.c efigetsecs.c efifdt.c efifile.c efiblock.c efinet.c efipxe.c
 
 .PATH: ${S}/external/bsd/libfdt/dist
 CPPFLAGS+=	-I${S}/external/bsd/libfdt/dist

Index: src/sys/stand/efiboot/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.7 src/sys/stand/efiboot/boot.c:1.8
--- src/sys/stand/efiboot/boot.c:1.7	Sun Sep  9 13:37:54 2018
+++ src/sys/stand/efiboot/boot.c	Sun Sep  9 17:55:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.7 2018/09/09 13:37:54 jmcneill Exp $	*/
+/*	$NetBSD: boot.c,v 1.8 2018/09/09 17:55:22 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -30,6 +30,7 @@
 #include "efiboot.h"
 #include "efiblock.h"
 #include "efifdt.h"
+#include "efienv.h"
 
 #include 
 #include 
@@ -61,6 +62,10 @@ void	command_dev(char *);
 void	command_dtb(char *);
 void	command_initrd(char *);
 void	command_ls(char *);
+void	command_printenv(char *);
+void	command_setenv(char *);
+void	command_clearenv(char *);
+void	command_resetenv(char *);
 void	command_reset(char *);
 void	command_version(char *);
 void	command_quit(char *);
@@ -71,6 +76,10 @@ const struct boot_command commands[] = {
 	{ "dtb",	command_dtb,		"dtb [dev:][filename]" },
 	{ "initrd",	command_initrd,		"initrd [dev:][filename]" },
 	{ "ls",		command_ls,		"ls [hdNn:/path]" },
+	{ "printenv",	command_printenv,	"printenv [key]" },
+	{ "setenv",	command_setenv,		"setenv  " },
+	{ "clearenv",	command_clearenv,	"clearenv " },
+	{ "resetenv",	command_resetenv,	"resetenv" },
 	{ "version",	command_version,	"version" },
 	{ "help",	command_help,		"help|?" },
 	{ "?",		command_help,		NULL },
@@ -135,6 +144,53 @@ command_ls(char *arg)
 }
 
 void
+command_printenv(char *arg)
+{
+	char *val;
+
+	if (arg && *arg) {
+		val = efi_env_get(arg);
+		if (val) {
+			printf("\"%s\" = \"%s\"\n", arg, val);
+			FreePool(val);
+		}
+	} else {
+		efi_env_print();
+	}
+}
+
+void
+command_setenv(char *arg)
+{
+	char *spc;
+
+	spc = strchr(arg, ' ');
+	if (spc == NULL || spc[1] == '\0') {
+		command_help("");
+		return;
+	}
+
+	*spc = '\0';
+	efi_env_set(arg, spc + 1);
+}
+
+void
+command_clearenv(char *arg)
+{
+	if (*arg == '\0') {
+		command_help("");
+		return;
+	}
+	efi_env_clear(arg);
+}
+
+void
+command_resetenv(char *arg)
+{
+	efi_env_reset();
+}
+
+void
 command_version(char *arg)
 {
 	char *ufirmware;
@@ -213,11 +269,46 @@ print_banner(void)
 	bootprog_name, bootprog_rev, bootprog_kernrev);
 }
 
+static void
+read_env(void)
+{
+	char *s;
+
+	s = efi_env_get("fdtfile");
+	if (s) {
+#ifdef EFIBOOT_DEBUG
+		printf(">> Setting DTB path to '%s' from environment\n", s);
+#endif
+		set_dtb_path(s);
+		FreePool(s);
+	}
+
+	s = efi_env_get("initrd");
+	if (s) {
+#ifdef EFIBOOT_DEBUG
+		printf(">> Setting initrd path to '%s' from environment\n", s);
+#endif
+		set_initrd_path(s);
+		FreePool(s);
+	}
+
+	s = efi_env_get("rootdev");
+	if (s) {
+#ifdef EFIBOOT_DEBUG
+		printf(">> Setting default device to '%s' from environment\n", s);
+#endif
+		set_default_device(s);
+		FreePool(s);
+	}
+}
+
 void
 boot(void)
 {
 	int currname, c;
 
+	read_env();
+
 	print_banner();
 
 	printf("Press return to boot now, any other key for boot prompt\n");

Index: src/sys/stand/efiboot/version
diff -u src/sys/stand/efiboot/version:1.2 src/sys/stand/efiboot/version:1.3
--- src/sys/stand/efiboot/version:1.2	Mon Sep  3 00:04:02 2018
+++ src/sys/stand/efiboot/version	Sun Sep  9 

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

2018-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  9 13:40:28 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: pcihost_fdt.c

Log Message:
Take interrupt-map-mask into consideration when mapping PCI interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/fdt/pcihost_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/arch/arm/fdt/pcihost_fdt.c
diff -u src/sys/arch/arm/fdt/pcihost_fdt.c:1.1 src/sys/arch/arm/fdt/pcihost_fdt.c:1.2
--- src/sys/arch/arm/fdt/pcihost_fdt.c:1.1	Sat Sep  8 00:40:57 2018
+++ src/sys/arch/arm/fdt/pcihost_fdt.c	Sun Sep  9 13:40:28 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: pcihost_fdt.c,v 1.1 2018/09/08 00:40:57 jmcneill Exp $ */
+/* $NetBSD: pcihost_fdt.c,v 1.2 2018/09/09 13:40:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.1 2018/09/08 00:40:57 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.2 2018/09/09 13:40:28 jmcneill Exp $");
 
 #include 
 #include 
@@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.
 
 #include 
 
-#define	IH_PIN_MASK			0x000f
+#define	IH_INDEX_MASK			0x
 #define	IH_MPSAFE			0x8000
 
 #define	PCIHOST_DEFAULT_BUS_MIN		0
@@ -402,25 +402,69 @@ pcihost_conf_interrupt(void *v, int bus,
 static int
 pcihost_intr_map(const struct pci_attach_args *pa, pci_intr_handle_t *ih)
 {
+	struct pcihost_softc *sc = pa->pa_pc->pc_intr_v;
+	u_int addr_cells, interrupt_cells;
+	const u_int *imap, *imask;
+	int imaplen, imasklen;
+	u_int match[4];
+	int index;
+
 	if (pa->pa_intrpin == 0)
 		return EINVAL;
-	*ih = pa->pa_intrpin;
-	return 0;
+
+	imap = fdtbus_get_prop(sc->sc_phandle, "interrupt-map", );
+	imask = fdtbus_get_prop(sc->sc_phandle, "interrupt-map-mask", );
+	if (imap == NULL || imask == NULL || imasklen != 16)
+		return EINVAL;
+
+	/* Convert attach args to specifier */
+	match[0] = htobe32(
+			__SHIFTIN(pa->pa_bus, PHYS_HI_BUS) |
+			__SHIFTIN(pa->pa_device, PHYS_HI_DEVICE) |
+			__SHIFTIN(pa->pa_function, PHYS_HI_FUNCTION)
+		   ) & imask[0];
+	match[1] = htobe32(0) & imask[1];
+	match[2] = htobe32(0) & imask[2];
+	match[3] = htobe32(pa->pa_intrpin) & imask[3];
+
+	index = 0;
+	while (imaplen >= 20) {
+		const int map_ihandle = fdtbus_get_phandle_from_native(be32toh(imap[4]));
+	if (of_getprop_uint32(map_ihandle, "#address-cells", _cells))
+	addr_cells = 2;
+		if (of_getprop_uint32(map_ihandle, "#interrupt-cells", _cells))
+			interrupt_cells = 0;
+		if (imaplen < (addr_cells + interrupt_cells) * 4)
+			return ENXIO;
+
+		if ((imap[0] & imask[0]) == match[0] &&
+		(imap[1] & imask[1]) == match[1] &&
+		(imap[2] & imask[2]) == match[2] &&
+		(imap[3] & imask[3]) == match[3]) {
+			*ih = index;
+			return 0;
+		}
+
+		imap += (5 + addr_cells + interrupt_cells);
+		imaplen -= (5 + addr_cells + interrupt_cells) * 4;
+		index++;
+	}
+
+	return EINVAL;
 }
 
 static const u_int *
-pcihost_find_intr(struct pcihost_softc *sc, int pin, int *pihandle)
+pcihost_find_intr(struct pcihost_softc *sc, pci_intr_handle_t ih, int *pihandle)
 {
 	u_int addr_cells, interrupt_cells;
+	int imaplen, index;
 	const u_int *imap;
-	int imaplen;
 
 	imap = fdtbus_get_prop(sc->sc_phandle, "interrupt-map", );
-	if (imap == NULL)
-		return NULL;
+	KASSERT(imap != NULL);
 
+	index = 0;
 	while (imaplen >= 20) {
-		const int map_pin = be32toh(imap[3]);
 		const int map_ihandle = fdtbus_get_phandle_from_native(be32toh(imap[4]));
 	if (of_getprop_uint32(map_ihandle, "#address-cells", _cells))
 	addr_cells = 2;
@@ -429,13 +473,14 @@ pcihost_find_intr(struct pcihost_softc *
 		if (imaplen < (addr_cells + interrupt_cells) * 4)
 			return NULL;
 
-		if (map_pin == pin) {
+		if (index == ih) {
 			*pihandle = map_ihandle;
 			return imap + 5 + addr_cells;
 		}
 
-		imap += (addr_cells + interrupt_cells);
-		imaplen -= (addr_cells + interrupt_cells) * 4;
+		imap += (5 + addr_cells + interrupt_cells);
+		imaplen -= (5 + addr_cells + interrupt_cells) * 4;
+		index++;
 	}
 
 	return NULL;
@@ -445,14 +490,10 @@ static const char *
 pcihost_intr_string(void *v, pci_intr_handle_t ih, char *buf, size_t len)
 {
 	struct pcihost_softc *sc = v;
-	u_int pin = ih & IH_PIN_MASK;
 	const u_int *specifier;
 	int ihandle;
 
-	if (pin == PCI_INTERRUPT_PIN_NONE || pin > PCI_INTERRUPT_PIN_MAX)
-		return NULL;
-
-	specifier = pcihost_find_intr(sc, pin, );
+	specifier = pcihost_find_intr(sc, ih & IH_INDEX_MASK, );
 	if (specifier == NULL)
 		return NULL;
 
@@ -488,15 +529,11 @@ pcihost_intr_establish(void *v, pci_intr
 int (*callback)(void *), void *arg)
 {
 	struct pcihost_softc *sc = v;
-	u_int pin = ih & IH_PIN_MASK;
 	const int flags = (ih & IH_MPSAFE) ? FDT_INTR_MPSAFE : 0;
 	const u_int *specifier;
 	int ihandle;
 
-	if (pin == PCI_INTERRUPT_PIN_NONE || pin > 

CVS commit: src/sys/stand/efiboot

2018-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  9 13:37:54 UTC 2018

Modified Files:
src/sys/stand/efiboot: boot.c efiboot.h efifdt.c efifdt.h exec.c

Log Message:
Add "dtb" command for loading a custom .dtb file.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/stand/efiboot/boot.c
cvs rdiff -u -r1.4 -r1.5 src/sys/stand/efiboot/efiboot.h \
src/sys/stand/efiboot/exec.c
cvs rdiff -u -r1.8 -r1.9 src/sys/stand/efiboot/efifdt.c
cvs rdiff -u -r1.3 -r1.4 src/sys/stand/efiboot/efifdt.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/stand/efiboot/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.6 src/sys/stand/efiboot/boot.c:1.7
--- src/sys/stand/efiboot/boot.c:1.6	Fri Sep  7 17:30:58 2018
+++ src/sys/stand/efiboot/boot.c	Sun Sep  9 13:37:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.6 2018/09/07 17:30:58 jmcneill Exp $	*/
+/*	$NetBSD: boot.c,v 1.7 2018/09/09 13:37:54 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -54,9 +54,11 @@ static const char * const names[][2] = {
 
 static char default_device[32];
 static char initrd_path[255];
+static char dtb_path[255];
 
 void	command_boot(char *);
 void	command_dev(char *);
+void	command_dtb(char *);
 void	command_initrd(char *);
 void	command_ls(char *);
 void	command_reset(char *);
@@ -66,6 +68,7 @@ void	command_quit(char *);
 const struct boot_command commands[] = {
 	{ "boot",	command_boot,		"boot [dev:][filename] [args]\n (ex. \"hd0a:\\netbsd.old -s\"" },
 	{ "dev",	command_dev,		"dev" },
+	{ "dtb",	command_dtb,		"dtb [dev:][filename]" },
 	{ "initrd",	command_initrd,		"initrd [dev:][filename]" },
 	{ "ls",		command_ls,		"ls [hdNn:/path]" },
 	{ "version",	command_version,	"version" },
@@ -114,6 +117,12 @@ command_dev(char *arg)
 }
 
 void
+command_dtb(char *arg)
+{
+	set_dtb_path(arg);
+}
+
+void
 command_initrd(char *arg)
 {
 	set_initrd_path(arg);
@@ -181,6 +190,21 @@ get_initrd_path(void)
 	return initrd_path;
 }
 
+int
+set_dtb_path(char *arg)
+{
+	if (strlen(arg) + 1 > sizeof(dtb_path))
+		return ERANGE;
+	strcpy(dtb_path, arg);
+	return 0;
+}
+
+char *
+get_dtb_path(void)
+{
+	return dtb_path;
+}
+
 void
 print_banner(void)
 {

Index: src/sys/stand/efiboot/efiboot.h
diff -u src/sys/stand/efiboot/efiboot.h:1.4 src/sys/stand/efiboot/efiboot.h:1.5
--- src/sys/stand/efiboot/efiboot.h:1.4	Fri Sep  7 17:30:58 2018
+++ src/sys/stand/efiboot/efiboot.h	Sun Sep  9 13:37:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: efiboot.h,v 1.4 2018/09/07 17:30:58 jmcneill Exp $	*/
+/*	$NetBSD: efiboot.h,v 1.5 2018/09/09 13:37:54 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -54,6 +54,8 @@ int set_default_device(char *);
 char *get_default_device(void);
 int set_initrd_path(char *);
 char *get_initrd_path(void);
+int set_dtb_path(char *);
+char *get_dtb_path(void);
 
 /* console.c */
 int ischar(void);
Index: src/sys/stand/efiboot/exec.c
diff -u src/sys/stand/efiboot/exec.c:1.4 src/sys/stand/efiboot/exec.c:1.5
--- src/sys/stand/efiboot/exec.c:1.4	Fri Sep  7 17:30:58 2018
+++ src/sys/stand/efiboot/exec.c	Sun Sep  9 13:37:54 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.4 2018/09/07 17:30:58 jmcneill Exp $ */
+/* $NetBSD: exec.c,v 1.5 2018/09/09 13:37:54 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill 
@@ -36,19 +36,17 @@ u_long load_offset = 0;
 #define	FDT_SPACE	(4 * 1024 * 1024)
 #define	FDT_ALIGN	((2 * 1024 * 1024) - 1)
 
-static EFI_PHYSICAL_ADDRESS initrd_addr;
-static u_long initrd_size = 0;
+static EFI_PHYSICAL_ADDRESS initrd_addr, dtb_addr;
+static u_long initrd_size = 0, dtb_size = 0;
 
 static int
-load_initrd(void)
+load_file(char *path, EFI_PHYSICAL_ADDRESS *paddr, u_long *psize)
 {
 	EFI_STATUS status;
 	struct stat st;
 	ssize_t len;
-	char *path;
 	int fd;
 
-	path = get_initrd_path();
 	if (strlen(path) == 0)
 		return 0;
 
@@ -63,44 +61,44 @@ load_initrd(void)
 		return errno;
 	}
 	if (st.st_size == 0) {
-		printf("boot: empty initrd %s\n", path);
+		printf("boot: empty file %s\n", path);
 		close(fd);
 		return EINVAL;
 	}
 
-	initrd_size = st.st_size;
+	*psize = st.st_size;
 
 #ifdef EFIBOOT_ALLOCATE_MAX_ADDRESS
-	initrd_addr = EFIBOOT_ALLOCATE_MAX_ADDRESS;
+	*paddr = EFIBOOT_ALLOCATE_MAX_ADDRESS;
 	status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress, EfiLoaderData,
-	EFI_SIZE_TO_PAGES(initrd_size), _addr);
+	EFI_SIZE_TO_PAGES(*psize), paddr);
 #else
-	initrd_addr = 0;
+	*paddr = 0;
 	status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateAnyPages, EfiLoaderData,
-	EFI_SIZE_TO_PAGES(initrd_size), _addr);
+	EFI_SIZE_TO_PAGES(*psize), paddr);
 #endif
 	if (EFI_ERROR(status)) {
-		printf("Failed to allocate %lu bytes for initrd image (error %lu)\n",
-		initrd_size, status);
+		printf("Failed to allocate %lu bytes for %s (error %lu)\n",
+		*psize, path, status);
 		close(fd);
 		return ENOMEM;
 	}
 
 	printf("boot: loading %s 

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

2018-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  9 13:32:26 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: psci_fdt.c

Log Message:
Fix previous; PSCI_CPU_ON requires an MPIDR!


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/fdt/psci_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/arch/arm/fdt/psci_fdt.c
diff -u src/sys/arch/arm/fdt/psci_fdt.c:1.15 src/sys/arch/arm/fdt/psci_fdt.c:1.16
--- src/sys/arch/arm/fdt/psci_fdt.c:1.15	Sun Aug 26 18:15:49 2018
+++ src/sys/arch/arm/fdt/psci_fdt.c	Sun Sep  9 13:32:26 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: psci_fdt.c,v 1.15 2018/08/26 18:15:49 ryo Exp $ */
+/* $NetBSD: psci_fdt.c,v 1.16 2018/09/09 13:32:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.15 2018/08/26 18:15:49 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci_fdt.c,v 1.16 2018/09/09 13:32:26 jmcneill Exp $");
 
 #include 
 #include 
@@ -216,7 +216,7 @@ psci_fdt_bootstrap(void)
 		sizeof(arm_cpu_hatch_arg));
 #endif
 
-		int ret = psci_cpu_on(cpuindex, psci_fdt_mpstart_pa(), 0);
+		int ret = psci_cpu_on(mpidr, psci_fdt_mpstart_pa(), 0);
 		if (ret != PSCI_SUCCESS)
 			continue;
 



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

2018-09-09 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Sep  9 13:22:50 UTC 2018

Modified Files:
src/sys/arch/arm/fdt: cpu_fdt.c

Log Message:
Ditch arm,arm-v8 compatible string (everything uses arm,armv8)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/fdt/cpu_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/arch/arm/fdt/cpu_fdt.c
diff -u src/sys/arch/arm/fdt/cpu_fdt.c:1.10 src/sys/arch/arm/fdt/cpu_fdt.c:1.11
--- src/sys/arch/arm/fdt/cpu_fdt.c:1.10	Wed Sep  5 10:38:29 2018
+++ src/sys/arch/arm/fdt/cpu_fdt.c	Sun Sep  9 13:22:50 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_fdt.c,v 1.10 2018/09/05 10:38:29 jmcneill Exp $ */
+/* $NetBSD: cpu_fdt.c,v 1.11 2018/09/09 13:22:50 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.10 2018/09/05 10:38:29 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.11 2018/09/09 13:22:50 jmcneill Exp $");
 
 #include 
 #include 
@@ -68,8 +68,7 @@ static const struct of_compat_data compa
 	{ "arm,cortex-a15",		ARM_CPU_ARMV7 },
 	{ "arm,cortex-a17",		ARM_CPU_ARMV7 },
 
-	{ "arm,armv8",			ARM_CPU_ARMV8 },	/* nonstandard */
-	{ "arm,arm-v8",			ARM_CPU_ARMV8 },
+	{ "arm,armv8",			ARM_CPU_ARMV8 },
 	{ "arm,cortex-a53",		ARM_CPU_ARMV8 },
 	{ "arm,cortex-a57",		ARM_CPU_ARMV8 },
 	{ "arm,cortex-a72",		ARM_CPU_ARMV8 },



CVS commit: [pgoyette-compat] src/sys/kern

2018-09-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep  9 11:54:10 UTC 2018

Modified Files:
src/sys/kern [pgoyette-compat]: kern_module.c

Log Message:
When freeing the required list, make sure we calculate its size based
on the size of the contained elements, not on the size of a pointer to
those elements.


To generate a diff of this commit:
cvs rdiff -u -r1.130.2.22 -r1.130.2.23 src/sys/kern/kern_module.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_module.c
diff -u src/sys/kern/kern_module.c:1.130.2.22 src/sys/kern/kern_module.c:1.130.2.23
--- src/sys/kern/kern_module.c:1.130.2.22	Fri Sep  7 23:32:30 2018
+++ src/sys/kern/kern_module.c	Sun Sep  9 11:54:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.130.2.22 2018/09/07 23:32:30 pgoyette Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.130.2.23 2018/09/09 11:54:10 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.22 2018/09/07 23:32:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.130.2.23 2018/09/09 11:54:10 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -245,7 +245,7 @@ module_free(module_t *mod)
 	specificdata_fini(module_specificdata_domain, >mod_sdref);
 	if (mod->mod_required)
 		kmem_free(mod->mod_required, mod->mod_arequired *
-		sizeof(module_t));
+		sizeof(module_t *));
 	kmem_free(mod, sizeof(*mod));
 }
 



CVS commit: [pgoyette-compat] src/sys/compat/netbsd32

2018-09-09 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Sep  9 11:51:48 UTC 2018

Modified Files:
src/sys/compat/netbsd32 [pgoyette-compat]: netbsd32_mod.c

Log Message:
The compat_netbsd32 module requires compat_09 and above.  Since we
removed the alias names, we need to explicitly refer to the oldest
non-32 required compat module.


To generate a diff of this commit:
cvs rdiff -u -r1.13.16.2 -r1.13.16.3 src/sys/compat/netbsd32/netbsd32_mod.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/compat/netbsd32/netbsd32_mod.c
diff -u src/sys/compat/netbsd32/netbsd32_mod.c:1.13.16.2 src/sys/compat/netbsd32/netbsd32_mod.c:1.13.16.3
--- src/sys/compat/netbsd32/netbsd32_mod.c:1.13.16.2	Wed Mar 21 02:01:34 2018
+++ src/sys/compat/netbsd32/netbsd32_mod.c	Sun Sep  9 11:51:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_mod.c,v 1.13.16.2 2018/03/21 02:01:34 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_mod.c,v 1.13.16.3 2018/09/09 11:51:48 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.13.16.2 2018/03/21 02:01:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.13.16.3 2018/09/09 11:51:48 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -50,7 +50,7 @@ __KERNEL_RCSID(0, "$NetBSD: netbsd32_mod
 #include 
 #include 
 
-# define	DEPS1	"compat,ksem"
+# define	DEPS1	"compat_09,ksem"
 
 #if defined(EXEC_ELF32)
 # define	DEPS2	",exec_elf32"



CVS commit: src/lib/libpthread

2018-09-09 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Sep  9 07:24:59 UTC 2018

Modified Files:
src/lib/libpthread: shlib_version

Log Message:
Add a todo item for a future major bump (rename many symbols)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/lib/libpthread/shlib_version

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

Modified files:

Index: src/lib/libpthread/shlib_version
diff -u src/lib/libpthread/shlib_version:1.17 src/lib/libpthread/shlib_version:1.18
--- src/lib/libpthread/shlib_version:1.17	Sat Apr 23 23:23:17 2016
+++ src/lib/libpthread/shlib_version	Sun Sep  9 07:24:59 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: shlib_version,v 1.17 2016/04/23 23:23:17 christos Exp $
+#	$NetBSD: shlib_version,v 1.18 2018/09/09 07:24:59 maya Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # Things to do when bumping major version:
@@ -15,5 +15,8 @@
 #	inspect them for priority inheritance / inter-process synch,
 #	without compat_netbsd32 shims??
 #
+#	use reserved identifiers for things that shouldn't be visible,
+#	e.g. rename pthread__pagesize to __pthread_pagesize,
+#
 major=1
 minor=3



CVS commit: src/sys

2018-09-09 Thread Aymeric Vincent
Module Name:src
Committed By:   aymeric
Date:   Sun Sep  9 07:21:18 UTC 2018

Modified Files:
src/sys/arch/arm/broadcom: bcm2835_aux.c bcm2835_cprman.c
src/sys/arch/arm/nvidia: tegra124_car.c tegra210_car.c
src/sys/arch/arm/rockchip: rk_cru.c rk_usb.c
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c
src/sys/arch/arm/sunxi: sunxi_ccu.c sunxi_gates.c sunxi_gmacclk.c
src/sys/dev/fdt: fdt_clock.c fdtvar.h fixedclock.c fixedfactorclock.c

Log Message:
Pass clock provider's phandle to fdtbus_clock_controller_func.decode()
and update callers.

This allows to accomodate clock managers whose clocks are identified
directly by a clock instead of a pair (clock provider, index).

ok jmcneill@ on port-arm


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/broadcom/bcm2835_aux.c \
src/sys/arch/arm/broadcom/bcm2835_cprman.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/nvidia/tegra124_car.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/nvidia/tegra210_car.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/rockchip/rk_cru.c \
src/sys/arch/arm/rockchip/rk_usb.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/samsung/exynos5422_clock.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/sunxi/sunxi_ccu.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sunxi/sunxi_gates.c \
src/sys/arch/arm/sunxi/sunxi_gmacclk.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/fdt/fdt_clock.c
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/fdt/fdtvar.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/fdt/fixedclock.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/fdt/fixedfactorclock.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/broadcom/bcm2835_aux.c
diff -u src/sys/arch/arm/broadcom/bcm2835_aux.c:1.1 src/sys/arch/arm/broadcom/bcm2835_aux.c:1.2
--- src/sys/arch/arm/broadcom/bcm2835_aux.c:1.1	Sun Dec 10 21:38:26 2017
+++ src/sys/arch/arm/broadcom/bcm2835_aux.c	Sun Sep  9 07:21:17 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_aux.c,v 1.1 2017/12/10 21:38:26 skrll Exp $ */
+/* $NetBSD: bcm2835_aux.c,v 1.2 2018/09/09 07:21:17 aymeric Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_aux.c,v 1.1 2017/12/10 21:38:26 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_aux.c,v 1.2 2018/09/09 07:21:17 aymeric Exp $");
 
 #include 
 #include 
@@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: bcm2835_aux.
 static int	bcmaux_match(device_t, cfdata_t, void *);
 static void	bcmaux_attach(device_t, device_t, void *);
 
-static struct clk *bcmaux_decode(device_t, const void *, size_t);
+static struct clk *bcmaux_decode(device_t, int, const void *, size_t);
 
 static const struct fdtbus_clock_controller_func bcmaux_fdt_funcs = {
 	.decode = bcmaux_decode
@@ -154,7 +154,7 @@ bcmaux_attach(device_t parent, device_t 
 }
 
 static struct clk *
-bcmaux_decode(device_t dev, const void *data, size_t len)
+bcmaux_decode(device_t dev, int cc_phandle, const void *data, size_t len)
 {
 	struct bcmaux_softc * const sc = device_private(dev);
 	u_int clkid;
Index: src/sys/arch/arm/broadcom/bcm2835_cprman.c
diff -u src/sys/arch/arm/broadcom/bcm2835_cprman.c:1.1 src/sys/arch/arm/broadcom/bcm2835_cprman.c:1.2
--- src/sys/arch/arm/broadcom/bcm2835_cprman.c:1.1	Sun Dec 10 21:38:26 2017
+++ src/sys/arch/arm/broadcom/bcm2835_cprman.c	Sun Sep  9 07:21:17 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_cprman.c,v 1.1 2017/12/10 21:38:26 skrll Exp $ */
+/* $NetBSD: bcm2835_cprman.c,v 1.2 2018/09/09 07:21:17 aymeric Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_cprman.c,v 1.1 2017/12/10 21:38:26 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_cprman.c,v 1.2 2018/09/09 07:21:17 aymeric Exp $");
 
 #include 
 #include 
@@ -74,7 +74,7 @@ struct cprman_softc {
 
 
 static struct clk *
-cprman_decode(device_t dev, const void *data, size_t len)
+cprman_decode(device_t dev, int cc_phandle, const void *data, size_t len)
 {
 	struct cprman_softc * const sc = device_private(dev);
 	struct cprman_clk *clk;

Index: src/sys/arch/arm/nvidia/tegra124_car.c
diff -u src/sys/arch/arm/nvidia/tegra124_car.c:1.14 src/sys/arch/arm/nvidia/tegra124_car.c:1.15
--- src/sys/arch/arm/nvidia/tegra124_car.c:1.14	Fri Jul 21 01:01:22 2017
+++ src/sys/arch/arm/nvidia/tegra124_car.c	Sun Sep  9 07:21:17 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra124_car.c,v 1.14 2017/07/21 01:01:22 jmcneill Exp $ */
+/* $NetBSD: tegra124_car.c,v 1.15 2018/09/09 07:21:17 aymeric Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tegra124_car.c,v 1.14 2017/07/21 01:01:22 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra124_car.c,v 1.15 2018/09/09 07:21:17 aymeric Exp $");
 
 #include 
 #include