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

2018-10-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sun Oct  7 05:28:51 UTC 2018

Modified Files:
src/sys/arch/x86/x86: i8259.c ioapic.c

Log Message:
While we're here, fix pic->pic_delroute() to DTRT on XEN and
cleanup after itself.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/x86/x86/i8259.c
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/x86/x86/ioapic.c

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

Modified files:

Index: src/sys/arch/x86/x86/i8259.c
diff -u src/sys/arch/x86/x86/i8259.c:1.18 src/sys/arch/x86/x86/i8259.c:1.19
--- src/sys/arch/x86/x86/i8259.c:1.18	Sun Oct  7 05:23:01 2018
+++ src/sys/arch/x86/x86/i8259.c	Sun Oct  7 05:28:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i8259.c,v 1.18 2018/10/07 05:23:01 cherry Exp $	*/
+/*	$NetBSD: i8259.c,v 1.19 2018/10/07 05:28:51 cherry Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.18 2018/10/07 05:23:01 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.19 2018/10/07 05:28:51 cherry Exp $");
 
 #include  
 #include 
@@ -291,6 +291,11 @@ i8259_unsetup(struct pic *pic, struct cp
 	port = unbind_pirq_from_evtch(irq);
 
 	KASSERT(port < NR_EVENT_CHANNELS);
+
+	KASSERT(irq2port[irq] != 0);
+	irq2port[irq] = 0;
+
+	xen_atomic_clear_bit(>ci_evtmask[0], port);
 #else
 	if (CPU_IS_PRIMARY(ci))
 		i8259_reinit_irqs();

Index: src/sys/arch/x86/x86/ioapic.c
diff -u src/sys/arch/x86/x86/ioapic.c:1.56 src/sys/arch/x86/x86/ioapic.c:1.57
--- src/sys/arch/x86/x86/ioapic.c:1.56	Wed Dec 13 16:30:18 2017
+++ src/sys/arch/x86/x86/ioapic.c	Sun Oct  7 05:28:51 2018
@@ -1,4 +1,4 @@
-/* 	$NetBSD: ioapic.c,v 1.56 2017/12/13 16:30:18 bouyer Exp $	*/
+/* 	$NetBSD: ioapic.c,v 1.57 2018/10/07 05:28:51 cherry Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2009 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.56 2017/12/13 16:30:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioapic.c,v 1.57 2018/10/07 05:28:51 cherry Exp $");
 
 #include "opt_ddb.h"
 
@@ -601,6 +601,12 @@ ioapic_delroute(struct pic *pic, struct 
 	port = unbind_pirq_from_evtch(irq);
 
 	KASSERT(port < NR_EVENT_CHANNELS);
+
+	KASSERT(irq2port[irq] != 0);
+	irq2port[irq] = 0;
+
+	xen_atomic_clear_bit(>ci_evtmask[0], port);
+
 #endif
 
 }



CVS commit: src/sys/arch

2018-10-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sun Oct  7 05:23:01 UTC 2018

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

Log Message:
Switch over to a "GSI" concept for guest irqs.

On XEN there is a namespace called GSI which includes:

i) legacy_irq (0 - 16)
ii) "gsi" (16-nr_irqs_gsi)
iii) msi

We try to mirror this in guest space, but are mindful that legacy_irq
is 1:1 bound to actual hardware legacy_irq. Apart from this, XEN doesn't
really care what number scheme we use, as long as it doesn't encroach
on the MSI space, which is TBD for us.

Thus we trust the mpbios.c/mpacpi.c code to correctly map the pic,pin
tuples into the correct global gsi space, which we then register with
xen. As we now do, we allow for duplicate gsi registrations, in case
any hardware shares the same (pic,pin);

This enables us to now use the (pic,pin) tuple as the canonical reference
for device interrupt addresses, and leave any global mappings to specific
code. Thus xen_pic_to_gsi().

Note that this requires separate support for MSI, which I will get around to
once things stabilise - however the API change facilitates this nicely.

I note that the msi addroute() function does not use the "pin" parameter.
This can be made use of, to encode the gsi number, for XEN. This is however
TBD.

We further tweak the xen_vec_alloc() code to be uniform for the NIOAPICS
and other cases, and ensure that i8259.c DTRT wrt to route().

This will allow us to use pic->pic_addroute() without needing to worry about
pic specific issues.

The next step is to consolidate the pic_addroute() XEN related #ifdefs into
a -DXEN specific file, so that we don't clutter x86/ code with #ifdef XENs.

This change has functional implications, and there is likely breakage coming
especially on bespoke platforms that I haven't been able to test yet.

I am especially interested in bug reports from platforms with legacy (esp. i386)
and with multiple ioapics.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x86/x86/i8259.c
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/xen/x86/pintr.c

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

Modified files:

Index: src/sys/arch/x86/x86/i8259.c
diff -u src/sys/arch/x86/x86/i8259.c:1.17 src/sys/arch/x86/x86/i8259.c:1.18
--- src/sys/arch/x86/x86/i8259.c:1.17	Sat Feb 17 18:51:53 2018
+++ src/sys/arch/x86/x86/i8259.c	Sun Oct  7 05:23:01 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: i8259.c,v 1.17 2018/02/17 18:51:53 maxv Exp $	*/
+/*	$NetBSD: i8259.c,v 1.18 2018/10/07 05:23:01 cherry Exp $	*/
 
 /*
  * Copyright 2002 (c) Wasabi Systems, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.17 2018/02/17 18:51:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.18 2018/10/07 05:23:01 cherry Exp $");
 
 #include  
 #include 
@@ -88,6 +88,9 @@ __KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.
 #include 
 #include 
 
+#ifdef XEN
+#include 
+#endif
 
 #ifndef __x86_64__
 #include "mca.h"
@@ -99,6 +102,7 @@ __KERNEL_RCSID(0, "$NetBSD: i8259.c,v 1.
 static void i8259_hwmask(struct pic *, int);
 static void i8259_hwunmask(struct pic *, int);
 static void i8259_setup(struct pic *, struct cpu_info *, int, int, int);
+static void i8259_unsetup(struct pic *, struct cpu_info *, int, int, int);
 static void i8259_reinit_irqs(void);
 
 unsigned i8259_imen;
@@ -115,7 +119,7 @@ struct pic i8259_pic = {
 	.pic_hwmask = i8259_hwmask,
 	.pic_hwunmask = i8259_hwunmask,
 	.pic_addroute = i8259_setup,
-	.pic_delroute = i8259_setup,
+	.pic_delroute = i8259_unsetup,
 	.pic_level_stubs = legacy_stubs,
 	.pic_edge_stubs = legacy_stubs,
 };
@@ -252,10 +256,48 @@ static void
 i8259_setup(struct pic *pic, struct cpu_info *ci,
 int pin, int idtvec, int type)
 {
+#if defined(XEN)
+	/*
+	 * This is kludgy, and not the right place, but we can't bind
+	 * before the routing has been set to the appropriate 'vector'.
+	 * in x86/intr.c, this is done after idt_vec_set(), where this
+	 * would have been more appropriate to put this.
+	 */
+
+	int port, irq;
+	irq = vect2irq[idtvec];
+	KASSERT(irq != 0);
+	port = bind_pirq_to_evtch(irq);
+	KASSERT(port < NR_EVENT_CHANNELS);
+	KASSERT(port >= 0);
+
+	KASSERT(irq2port[irq] == 0);
+	irq2port[irq] = port + 1;
+
+	xen_atomic_set_bit(>ci_evtmask[0], port);
+#else
+	if (CPU_IS_PRIMARY(ci))
+		i8259_reinit_irqs();
+#endif
+}
+
+static void
+i8259_unsetup(struct pic *pic, struct cpu_info *ci,
+int pin, int idtvec, int type)
+{
+#if defined(XEN)
+	int port, irq;
+	irq = vect2irq[idtvec];
+	port = unbind_pirq_from_evtch(irq);
+
+	KASSERT(port < NR_EVENT_CHANNELS);
+#else
 	if (CPU_IS_PRIMARY(ci))
 		i8259_reinit_irqs();
+#endif
 }
 
+
 void
 i8259_reinit(void)
 {

Index: src/sys/arch/x86/x86/intr.c
diff -u 

CVS commit: src/lib/libutil

2018-10-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  6 23:48:00 UTC 2018

Modified Files:
src/lib/libutil: getfsspecname.c

Log Message:
use the right type.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libutil/getfsspecname.c

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

Modified files:

Index: src/lib/libutil/getfsspecname.c
diff -u src/lib/libutil/getfsspecname.c:1.6 src/lib/libutil/getfsspecname.c:1.7
--- src/lib/libutil/getfsspecname.c:1.6	Sat Oct  6 09:09:53 2018
+++ src/lib/libutil/getfsspecname.c	Sat Oct  6 19:48:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: getfsspecname.c,v 1.6 2018/10/06 13:09:53 jmcneill Exp $	*/
+/*	$NetBSD: getfsspecname.c,v 1.7 2018/10/06 23:48:00 christos Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: getfsspecname.c,v 1.6 2018/10/06 13:09:53 jmcneill Exp $");
+__RCSID("$NetBSD: getfsspecname.c,v 1.7 2018/10/06 23:48:00 christos Exp $");
 
 #include 
 #include 
@@ -68,7 +68,7 @@ getfsspecname(char *buf, size_t bufsiz, 
 	 */
 	if (strncasecmp(name, "ROOT.", 5) == 0 && strchr(name, ':') == NULL) {
 		static const int mib_root[] = { CTL_KERN, KERN_ROOT_DEVICE };
-		static const int mib_rootlen = __arraycount(mib_root);
+		static const unsigned int mib_rootlen = __arraycount(mib_root);
 
 		strlcpy(buf, "/dev/", bufsiz);
 		len = bufsiz - 5;



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-10-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Oct  6 21:19:55 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: ata.c ata_subr.c atavar.h wd.c

Log Message:
actually, just make dump use the same queue skip as recovery, and remove the
no longer necessary ata_queue_reset() call from wd(4)

also for PR kern/47041


To generate a diff of this commit:
cvs rdiff -u -r1.141.6.14 -r1.141.6.15 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.6.2.6 -r1.6.2.7 src/sys/dev/ata/ata_subr.c
cvs rdiff -u -r1.99.2.9 -r1.99.2.10 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.441.2.11 -r1.441.2.12 src/sys/dev/ata/wd.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.141.6.14 src/sys/dev/ata/ata.c:1.141.6.15
--- src/sys/dev/ata/ata.c:1.141.6.14	Sat Oct  6 20:27:36 2018
+++ src/sys/dev/ata/ata.c	Sat Oct  6 21:19:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.141.6.14 2018/10/06 20:27:36 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.141.6.15 2018/10/06 21:19:55 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.14 2018/10/06 20:27:36 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.15 2018/10/06 21:19:55 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -961,7 +961,7 @@ ata_read_log_ext_ncq(struct ata_drive_da
 	 * and to make this a little faster. Realistically, it
 	 * should not matter.
 	 */
-	xfer->c_flags |= C_RECOVERY;
+	xfer->c_flags |= C_SKIP_QUEUE;
 	xfer->c_ata_c.r_command = WDCC_READ_LOG_EXT;
 	xfer->c_ata_c.r_lba = page = WDCC_LOG_PAGE_NCQ;
 	xfer->c_ata_c.r_st_bmask = WDCS_DRDY;
@@ -1087,7 +1087,7 @@ ata_exec_xfer(struct ata_channel *chp, s
 	 * Standard commands are added to the end of command list, but
 	 * recovery commands must be run immediatelly.
 	 */
-	if ((xfer->c_flags & C_RECOVERY) == 0)
+	if ((xfer->c_flags & C_SKIP_QUEUE) == 0)
 		SIMPLEQ_INSERT_TAIL(>ch_queue->queue_xfer, xfer,
 		c_xferchain);
 	else
@@ -1137,7 +1137,7 @@ atastart(struct ata_channel *chp)
 	struct atac_softc *atac = chp->ch_atac;
 	struct ata_queue *chq = chp->ch_queue;
 	struct ata_xfer *xfer, *axfer;
-	bool recovery;
+	bool skipq;
 
 #ifdef ATA_DEBUG
 	int spl1, spl2;
@@ -1174,18 +1174,18 @@ again:
 		goto out;
 	}
 
-	recovery = ISSET(xfer->c_flags, C_RECOVERY);
+	skipq = ISSET(xfer->c_flags, C_SKIP_QUEUE);
 
 	/* is the queue frozen? */
-	if (__predict_false(!recovery && chq->queue_freeze > 0)) {
+	if (__predict_false(!skipq && chq->queue_freeze > 0)) {
 		if (chq->queue_flags & QF_IDLE_WAIT) {
 			chq->queue_flags &= ~QF_IDLE_WAIT;
 			cv_signal(>ch_queue->queue_idle);
 		}
 		ATADEBUG_PRINT(("%s(chp=%p): channel %d drive %d "
-		"queue frozen: %d (recovery: %d)\n",
+		"queue frozen: %d\n",
 		__func__, chp, chp->ch_channel, xfer->c_drive,
-		chq->queue_freeze, recovery),
+		chq->queue_freeze),
 		DEBUG_XFERS);
 		goto out;
 	}
@@ -1201,7 +1201,7 @@ again:
 	 * Need only check first xfer.
 	 * XXX FIS-based switching - revisit
 	 */
-	if (!recovery && (axfer = TAILQ_FIRST(>ch_queue->active_xfers))) {
+	if (!skipq && (axfer = TAILQ_FIRST(>ch_queue->active_xfers))) {
 		if (!ISSET(xfer->c_flags, C_NCQ) ||
 		!ISSET(axfer->c_flags, C_NCQ) ||
 		xfer->c_drive != axfer->c_drive)
@@ -1211,17 +1211,17 @@ again:
 	struct ata_drive_datas * const drvp = >ch_drive[xfer->c_drive];
 
 	/*
-	 * Are we on limit of active xfers ?
-	 * For recovery, we must leave one slot available at all times.
+	 * Are we on limit of active xfers ? If the queue has more
+	 * than 1 openings, we keep one slot reserved for recovery or dump.
 	 */
 	KASSERT(chq->queue_active <= chq->queue_openings);
-	const uint8_t chq_openings = (!recovery && chq->queue_openings > 1)
+	const uint8_t chq_openings = (!skipq && chq->queue_openings > 1)
 	? (chq->queue_openings - 1) : chq->queue_openings;
 	const uint8_t drv_openings = ISSET(xfer->c_flags, C_NCQ)
 	? drvp->drv_openings : ATA_MAX_OPENINGS;
 	if (chq->queue_active >= MIN(chq_openings, drv_openings)) {
-		if (recovery) {
-			panic("%s: channel %d busy, recovery not possible",
+		if (skipq) {
+			panic("%s: channel %d busy, xfer not possible",
 			__func__, chp->ch_channel);
 		}
 
@@ -1272,8 +1272,8 @@ again:
 		break;
 	}
 
-	/* Queue more commands if possible, but not during recovery */
-	if (!recovery && chq->queue_active < chq->queue_openings)
+	/* Queue more commands if possible, but not during recovery or dump */
+	if (!skipq && chq->queue_active < chq->queue_openings)
 		goto again;
 
 out:
@@ -1321,17 +1321,9 @@ ata_activate_xfer_locked(struct ata_chan
 	struct ata_queue * const chq = chp->ch_queue;
 
 	KASSERT(mutex_owned(>ch_lock));
-
-	/*
-	 * When openings is just 1, can't reserve anything for
-	 * recovery. KASSERT() here is to catch code which naively
-	 * relies on 

CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-10-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Oct  6 20:27:28 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: TODO.ncq

Log Message:
move the entry for error recovery on thread up, it will be done on ncqfixes
branch


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.11 -r1.4.2.12 src/sys/dev/ata/TODO.ncq

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/ata/TODO.ncq
diff -u src/sys/dev/ata/TODO.ncq:1.4.2.11 src/sys/dev/ata/TODO.ncq:1.4.2.12
--- src/sys/dev/ata/TODO.ncq:1.4.2.11	Thu Oct  4 19:42:01 2018
+++ src/sys/dev/ata/TODO.ncq	Sat Oct  6 20:27:28 2018
@@ -2,6 +2,8 @@ jdolecek-ncqfixes goals:
 - re-check READ LOG EXT handling under native and Parallels to make sure
   the NOERROR under Parallels is their bug and not ours
 - run recovery via atathread, move to new function and share ahci/siisata/mvsata
+- maybe do device error handling in not-interrupt-context (maybe this should be
+  done on a mpata branch?)
 - remove controller-specific slot bitmaps (ic/siisata.c, ic/ahcisata_core.c)
 
 Bugs
@@ -18,9 +20,6 @@ implement support for PM FIS-based switc
 for hw which supports it, adjust error handling in controller drivers to handle
 xfers for several different drives
 
-maybe do device error handling in not-interrupt-context (maybe this should be
-done on a mpata branch?)
-
 dump to unopened disk fails (e.g. dump do wd1b when wd1a not mounted), due
 to the open path executing ata_get_params(), which eventually tsleeps()
 while waiting for the command to finish; specifically, if WDF_LOADED is not



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-10-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Oct  6 20:27:36 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: ata.c atavar.h wd.c

Log Message:
remove AT_RST_EMERG, do the queue reset explicitly in wd(4)

this should explicitly fix PR kern/47041 with sync during heavy
disk activity, even thought it was actually already implicitly fixed by calling
ata_thread_run() for drive reset in previous commit already, since the
function already called ata_queue_reset()

drop now unused ch_reset_flags and drive_reset_flags


To generate a diff of this commit:
cvs rdiff -u -r1.141.6.13 -r1.141.6.14 src/sys/dev/ata/ata.c
cvs rdiff -u -r1.99.2.8 -r1.99.2.9 src/sys/dev/ata/atavar.h
cvs rdiff -u -r1.441.2.10 -r1.441.2.11 src/sys/dev/ata/wd.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.141.6.13 src/sys/dev/ata/ata.c:1.141.6.14
--- src/sys/dev/ata/ata.c:1.141.6.13	Sat Oct  6 20:13:12 2018
+++ src/sys/dev/ata/ata.c	Sat Oct  6 20:27:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.141.6.13 2018/10/06 20:13:12 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.141.6.14 2018/10/06 20:27:36 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.13 2018/10/06 20:13:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.14 2018/10/06 20:27:36 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -480,20 +480,17 @@ atabus_thread(void *arg)
 		}
 		if (chp->ch_flags & ATACH_TH_RESET) {
 			/* this will unfreeze the channel */
-			ata_thread_run(chp, AT_WAIT | chp->ch_reset_flags,
+			ata_thread_run(chp, AT_WAIT,
 			ATACH_TH_RESET, ATACH_NODRIVE);
 		} else if (chp->ch_flags & ATACH_TH_DRIVE_RESET) {
 			for (i = 0; i < chp->ch_ndrives; i++) {
 struct ata_drive_datas *drvp;
-int drv_reset_flags;
 
 drvp = >ch_drive[i];
-drv_reset_flags = drvp->drive_reset_flags;
 
 if (drvp->drive_flags & ATA_DRIVE_TH_RESET) {
 	ata_thread_run(chp,
-	AT_WAIT | drv_reset_flags,
-	ATACH_TH_DRIVE_RESET, i);
+	AT_WAIT, ATACH_TH_DRIVE_RESET, i);
 }
 			}
 			chp->ch_flags &= ~ATACH_TH_DRIVE_RESET;
@@ -1527,9 +1524,6 @@ ata_kill_active(struct ata_channel *chp,
 	TAILQ_FOREACH_SAFE(xfer, >active_xfers, c_activechain, xfernext) {
 		xfer->ops->c_kill_xfer(xfer->c_chp, xfer, reason);
 	}
-
-	if (flags & AT_RST_EMERG)
-		ata_queue_reset(chq);
 }
 
 /*
@@ -1651,7 +1645,6 @@ ata_thread_run(struct ata_channel *chp, 
 /* No need to schedule another reset */
 return;
 			}
-			chp->ch_reset_flags = flags & AT_RST_EMERG;
 			break;
 		case ATACH_TH_DRIVE_RESET:
 			KASSERT(drive <= chp->ch_ndrives);
@@ -1662,7 +1655,6 @@ ata_thread_run(struct ata_channel *chp, 
 return;
 			}
 			drvp->drive_flags |= ATA_DRIVE_TH_RESET;
-			drvp->drive_reset_flags = flags;
 			break;
 		default:
 			panic("%s: unknown type: %x", __func__, type);
@@ -1726,11 +1718,6 @@ ata_thread_run(struct ata_channel *chp, 
 
 	/* Signal the thread in case there is an xfer to run */
 	cv_signal(>ch_thr_idle);
-
-	if (flags & AT_RST_EMERG) {
-		/* make sure that we can use polled commands */
-		ata_queue_reset(chp->ch_queue);
-	}
 }
 
 int

Index: src/sys/dev/ata/atavar.h
diff -u src/sys/dev/ata/atavar.h:1.99.2.8 src/sys/dev/ata/atavar.h:1.99.2.9
--- src/sys/dev/ata/atavar.h:1.99.2.8	Wed Oct  3 19:20:48 2018
+++ src/sys/dev/ata/atavar.h	Sat Oct  6 20:27:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: atavar.h,v 1.99.2.8 2018/10/03 19:20:48 jdolecek Exp $	*/
+/*	$NetBSD: atavar.h,v 1.99.2.9 2018/10/06 20:27:36 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -275,7 +275,6 @@ struct ata_drive_datas {
 #define ATA_DRIVE_NCQ		0x0200	/* drive supports NCQ feature set */
 #define ATA_DRIVE_NCQ_PRIO	0x0400	/* drive supports NCQ PRIO field */
 #define ATA_DRIVE_TH_RESET	0x0800	/* drive waits for thread drive reset */
-	int drive_reset_flags;	/* flags for drive reset via thread */
 
 	uint8_t drive_type;
 #define	ATA_DRIVET_NONE		0
@@ -365,9 +364,6 @@ struct ata_bustype {
 	int	(*ata_bio)(struct ata_drive_datas *, struct ata_xfer *);
 	void	(*ata_reset_drive)(struct ata_drive_datas *, int, uint32_t *);
 	void	(*ata_reset_channel)(struct ata_channel *, int);
-/* extra flags for ata_reset_*(), in addition to AT_* */
-#define AT_RST_EMERG 0x1 /* emergency - e.g. for a dump */
-
 	int	(*ata_exec_command)(struct ata_drive_datas *,
 struct ata_xfer *);
 
@@ -421,9 +417,6 @@ struct ata_channel {
 
 #define ATACH_NODRIVE	0xff	/* no drive selected for reset */
 
-	/* for the reset callback */
-	int ch_reset_flags;
-
 	/* for the timeout callout */
 	struct callout c_timo_callout;	/* timeout callout handle */
 

Index: src/sys/dev/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.441.2.10 src/sys/dev/ata/wd.c:1.441.2.11
--- 

CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-10-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Oct  6 20:13:12 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: ata.c

Log Message:
remove extra newline


To generate a diff of this commit:
cvs rdiff -u -r1.141.6.12 -r1.141.6.13 src/sys/dev/ata/ata.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.141.6.12 src/sys/dev/ata/ata.c:1.141.6.13
--- src/sys/dev/ata/ata.c:1.141.6.12	Sat Oct  6 20:12:37 2018
+++ src/sys/dev/ata/ata.c	Sat Oct  6 20:13:12 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.141.6.12 2018/10/06 20:12:37 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.141.6.13 2018/10/06 20:13:12 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.12 2018/10/06 20:12:37 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.13 2018/10/06 20:13:12 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -1676,7 +1676,6 @@ ata_thread_run(struct ata_channel *chp, 
 		ata_channel_freeze_locked(chp);
 		chp->ch_flags |= type;
 
-
 		cv_signal(>ch_thr_idle);
 		return;
 	}



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-10-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Oct  6 20:12:37 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: ata.c

Log Message:
fix ata_thread_run() for drive reset to set and check correct drive_flags


To generate a diff of this commit:
cvs rdiff -u -r1.141.6.11 -r1.141.6.12 src/sys/dev/ata/ata.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.141.6.11 src/sys/dev/ata/ata.c:1.141.6.12
--- src/sys/dev/ata/ata.c:1.141.6.11	Wed Oct  3 19:20:48 2018
+++ src/sys/dev/ata/ata.c	Sat Oct  6 20:12:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.141.6.11 2018/10/03 19:20:48 jdolecek Exp $	*/
+/*	$NetBSD: ata.c,v 1.141.6.12 2018/10/06 20:12:37 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.11 2018/10/03 19:20:48 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.12 2018/10/06 20:12:37 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -490,7 +490,7 @@ atabus_thread(void *arg)
 drvp = >ch_drive[i];
 drv_reset_flags = drvp->drive_reset_flags;
 
-if (drvp->drive_flags & ATACH_TH_DRIVE_RESET) {
+if (drvp->drive_flags & ATA_DRIVE_TH_RESET) {
 	ata_thread_run(chp,
 	AT_WAIT | drv_reset_flags,
 	ATACH_TH_DRIVE_RESET, i);
@@ -1645,26 +1645,23 @@ ata_thread_run(struct ata_channel *chp, 
 	ATADEBUG_PRINT(("%s flags 0x%x ch_flags 0x%x\n",
 	__func__, flags, chp->ch_flags), DEBUG_FUNCS | DEBUG_XFERS);
 	if ((flags & (AT_POLL | AT_WAIT)) == 0) {
-		if (chp->ch_flags & type) {
-			/* No need to schedule a reset more than one time. */
-			return;
-		}
-
-		/*
-		 * Block execution of other commands while reset is scheduled
-		 * to a thread.
-		 */
-		ata_channel_freeze_locked(chp);
-		chp->ch_flags |= type;
-
-
 		switch (type) {
 		case ATACH_TH_RESET:
+			if (chp->ch_flags & ATACH_TH_RESET) {
+/* No need to schedule another reset */
+return;
+			}
 			chp->ch_reset_flags = flags & AT_RST_EMERG;
 			break;
 		case ATACH_TH_DRIVE_RESET:
+			KASSERT(drive <= chp->ch_ndrives);
 			drvp = >ch_drive[drive];
-			drvp->drive_flags |= ATACH_TH_DRIVE_RESET;
+
+			if (drvp->drive_flags & ATA_DRIVE_TH_RESET) {
+/* No need to schedule another reset */
+return;
+			}
+			drvp->drive_flags |= ATA_DRIVE_TH_RESET;
 			drvp->drive_reset_flags = flags;
 			break;
 		default:
@@ -1672,6 +1669,14 @@ ata_thread_run(struct ata_channel *chp, 
 			/* NOTREACHED */
 		}
 
+		/*
+		 * Block execution of other commands while reset is scheduled
+		 * to a thread.
+		 */
+		ata_channel_freeze_locked(chp);
+		chp->ch_flags |= type;
+
+
 		cv_signal(>ch_thr_idle);
 		return;
 	}



CVS commit: [jdolecek-ncqfixes] src/sys/dev/ata

2018-10-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat Oct  6 19:25:43 UTC 2018

Modified Files:
src/sys/dev/ata [jdolecek-ncqfixes]: wd.c

Log Message:
fix dump to also hold channel lock for the drive reset


To generate a diff of this commit:
cvs rdiff -u -r1.441.2.9 -r1.441.2.10 src/sys/dev/ata/wd.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/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.441.2.9 src/sys/dev/ata/wd.c:1.441.2.10
--- src/sys/dev/ata/wd.c:1.441.2.9	Thu Oct  4 19:42:01 2018
+++ src/sys/dev/ata/wd.c	Sat Oct  6 19:25:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.441.2.9 2018/10/04 19:42:01 jdolecek Exp $ */
+/*	$NetBSD: wd.c,v 1.441.2.10 2018/10/06 19:25:43 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.441.2.9 2018/10/04 19:42:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.441.2.10 2018/10/06 19:25:43 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -1492,8 +1492,11 @@ wd_dumpblocks(device_t dev, void *va, da
 	/* Recalibrate, if first dump transfer. */
 	if (wddumprecalibrated == 0) {
 		wddumprecalibrated = 1;
-		(*wd->atabus->ata_reset_drive)(wd->drvp,
-	   AT_POLL | AT_RST_EMERG, NULL);
+		ata_channel_lock(wd->drvp->chnl_softc);
+		/* This will directly execute the reset due to AT_POLL */
+		ata_thread_run(wd->drvp->chnl_softc, AT_POLL | AT_RST_EMERG,
+		ATACH_TH_DRIVE_RESET, wd->drvp->drive);
+		ata_channel_unlock(wd->drvp->chnl_softc);
 		wd->drvp->state = RESET;
 	}
 



CVS commit: src/share/mk

2018-10-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct  6 18:52:59 UTC 2018

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Remove duplicate conditional assignment in previous - pointed out by wiz@


To generate a diff of this commit:
cvs rdiff -u -r1.1077 -r1.1078 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1077 src/share/mk/bsd.own.mk:1.1078
--- src/share/mk/bsd.own.mk:1.1077	Sat Oct  6 18:47:29 2018
+++ src/share/mk/bsd.own.mk	Sat Oct  6 18:52:59 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1077 2018/10/06 18:47:29 martin Exp $
+#	$NetBSD: bsd.own.mk,v 1.1078 2018/10/06 18:52:59 martin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1366,7 +1366,6 @@ USE_XZ_SETS?= yes
 .else
 USE_XZ_SETS?= no
 .endif 
-USE_XZ_SETS?= no
 
 #
 # TOOL_GZIP and friends.  These might refer to TOOL_PIGZ or to the host gzip.



CVS commit: src/share/mk

2018-10-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct  6 18:47:29 UTC 2018

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Switch amd64, sparc64 and alpha to .tar.xz sets


To generate a diff of this commit:
cvs rdiff -u -r1.1076 -r1.1077 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1076 src/share/mk/bsd.own.mk:1.1077
--- src/share/mk/bsd.own.mk:1.1076	Sat Sep 29 06:48:22 2018
+++ src/share/mk/bsd.own.mk	Sat Oct  6 18:47:29 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1076 2018/09/29 06:48:22 martin Exp $
+#	$NetBSD: bsd.own.mk,v 1.1077 2018/10/06 18:47:29 martin Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -1361,7 +1361,11 @@ ${var}?= no
 
 # Default to USE_XZ_SETS on some 64bit architectures where decompressor
 # memory will likely not be in short supply.
-# XXX incomplete feature, set to no everywhere
+.if ${MACHINE} == "amd64" || ${MACHINE} == "sparc64" || ${MACHINE} == "alpha"
+USE_XZ_SETS?= yes
+.else
+USE_XZ_SETS?= no
+.endif 
 USE_XZ_SETS?= no
 
 #



CVS commit: src/usr.sbin/sysinst

2018-10-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct  6 18:45:37 UTC 2018

Modified Files:
src/usr.sbin/sysinst: Makefile.inc defs.h main.c net.c util.c

Log Message:
Support sets in .tar.xz format


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/sysinst/Makefile.inc
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/sysinst/defs.h
cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/sysinst/main.c
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/sysinst/net.c
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/sysinst/util.c

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

Modified files:

Index: src/usr.sbin/sysinst/Makefile.inc
diff -u src/usr.sbin/sysinst/Makefile.inc:1.13 src/usr.sbin/sysinst/Makefile.inc:1.14
--- src/usr.sbin/sysinst/Makefile.inc:1.13	Thu Sep 20 12:27:42 2018
+++ src/usr.sbin/sysinst/Makefile.inc	Sat Oct  6 18:45:37 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.13 2018/09/20 12:27:42 rin Exp $
+#	$NetBSD: Makefile.inc,v 1.14 2018/10/06 18:45:37 martin Exp $
 #
 # Makefile for sysinst
 
@@ -47,9 +47,11 @@ LDADD=		-lcurses -ltermlib -lutil
 UNIF_AWK=	${.CURDIR}/../../unif.awk
 MSG_XLAT_SH=	${.CURDIR}/../../msg_xlat.sh
 
+SETS_TAR_SUFF=${"${USE_XZ_SETS:Uno}"!="no":?"tar.xz":"tgz"}
 
 CATALOGDIR=	/usr/share/sysinst/catalog
 CPPFLAGS+=	-I. -I${.CURDIR}/../.. -I${.CURDIR} \
+		-DSETS_TAR_SUFF=${SETS_TAR_SUFF:Q} \
 		-DREL=\"${DISTRIBVER}\" -DMACH=\"${MACHINE}\" \
 		-DMACH_${MACHINE} -DARCH_${MACHINE_ARCH} \
 		${NODISKLABEL:D-DNO_DISKLABEL} \

Index: src/usr.sbin/sysinst/defs.h
diff -u src/usr.sbin/sysinst/defs.h:1.19 src/usr.sbin/sysinst/defs.h:1.20
--- src/usr.sbin/sysinst/defs.h:1.19	Thu Sep 20 12:27:42 2018
+++ src/usr.sbin/sysinst/defs.h	Sat Oct  6 18:45:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: defs.h,v 1.19 2018/09/20 12:27:42 rin Exp $	*/
+/*	$NetBSD: defs.h,v 1.20 2018/10/06 18:45:37 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -192,6 +192,7 @@ typedef struct arg_rv {
 typedef struct distinfo {
 	const char	*name;
 	uint		set;
+	bool		force_tgz;	/* this set is always in .tgz format */
 	const char	*desc;
 	const char	*marker_file;	/* set assumed installed if exists */
 } distinfo;
@@ -376,6 +377,10 @@ int  clean_xfer_dir;
 #define SYSINST_PKGSRC_HTTP_HOST	SYSINST_PKG_HTTP_HOST
 #endif
 
+#ifndef SETS_TAR_SUFF
+#define	SETS_TAR_SUFF	 "tgz"
+#endif
+
 /* Abs. path we extract binary sets from */
 char ext_dir_bin[STRSIZE];
 
@@ -433,6 +438,7 @@ char targetroot_mnt[SSTRSIZE];
 int  mnt2_mounted;
 
 char dist_postfix[SSTRSIZE];
+char dist_tgz_postfix[SSTRSIZE];
 
 /* needed prototypes */
 void set_menu_numopts(int, int);
@@ -579,6 +585,8 @@ int	extract_file(distinfo *, int);
 void	do_coloring (unsigned int, unsigned int);
 int set_menu_select(menudesc *, void *);
 const char *safectime(time_t *);
+bool	use_tgz_for_set(const char*);
+const char *set_postfix(const char*);
 
 /* from target.c */
 #if defined(DEBUG)  ||	defined(DEBUG_ROOT)

Index: src/usr.sbin/sysinst/main.c
diff -u src/usr.sbin/sysinst/main.c:1.10 src/usr.sbin/sysinst/main.c:1.11
--- src/usr.sbin/sysinst/main.c:1.10	Thu Sep 20 12:27:42 2018
+++ src/usr.sbin/sysinst/main.c	Sat Oct  6 18:45:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.10 2018/09/20 12:27:42 rin Exp $	*/
+/*	$NetBSD: main.c,v 1.11 2018/10/06 18:45:37 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -107,7 +107,8 @@ static const struct f_arg fflagopts[] = 
 	{"local fs", "ffs", localfs_fs, sizeof localfs_fs},
 	{"local dir", "release", localfs_dir, sizeof localfs_dir},
 	{"targetroot mount", "/targetroot", targetroot_mnt, sizeof targetroot_mnt},
-	{"dist postfix", ".tgz", dist_postfix, sizeof dist_postfix},
+	{"dist postfix", "." SETS_TAR_SUFF, dist_postfix, sizeof dist_postfix},
+	{"dist tgz postfix", ".tgz", dist_tgz_postfix, sizeof dist_tgz_postfix},
 	{"diskname", "mydisk", bsddiskname, sizeof bsddiskname},
 	{"pkg host", SYSINST_PKG_HOST, pkg.xfer_host[XFER_FTP], sizeof pkg.xfer_host[XFER_FTP]},
 	{"pkg http host", SYSINST_PKG_HTTP_HOST, pkg.xfer_host[XFER_HTTP], sizeof pkg.xfer_host[XFER_HTTP]},

Index: src/usr.sbin/sysinst/net.c
diff -u src/usr.sbin/sysinst/net.c:1.25 src/usr.sbin/sysinst/net.c:1.26
--- src/usr.sbin/sysinst/net.c:1.25	Tue Sep 11 08:05:18 2018
+++ src/usr.sbin/sysinst/net.c	Sat Oct  6 18:45:37 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: net.c,v 1.25 2018/09/11 08:05:18 martin Exp $	*/
+/*	$NetBSD: net.c,v 1.26 2018/10/06 18:45:37 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -909,23 +909,24 @@ make_url(char *urlbuffer, struct ftpinfo
 
 
 /* ftp_fetch() and pkgsrc_fetch() are essentially the same, with a different
- * ftpinfo var. */
-static int do_ftp_fetch(const char *, struct ftpinfo *);
+ * ftpinfo var and pkgsrc always using .tgz suffix, while for
+ * regular sets we only use .tgz for source sets on some architectures. */
+static int do_ftp_fetch(const char *, bool, struct 

CVS commit: src/sys/arch

2018-10-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct  6 17:46:46 UTC 2018

Modified Files:
src/sys/arch/aarch64/conf: files.aarch64
src/sys/arch/arm/conf: files.arm

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/aarch64/conf/files.aarch64
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/arm/conf/files.arm

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/files.aarch64
diff -u src/sys/arch/aarch64/conf/files.aarch64:1.5 src/sys/arch/aarch64/conf/files.aarch64:1.6
--- src/sys/arch/aarch64/conf/files.aarch64:1.5	Thu Oct  4 23:53:14 2018
+++ src/sys/arch/aarch64/conf/files.aarch64	Sat Oct  6 17:46:46 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.aarch64,v 1.5 2018/10/04 23:53:14 ryo Exp $
+#	$NetBSD: files.aarch64,v 1.6 2018/10/06 17:46:46 skrll Exp $
 
 defflag opt_cpuoptions.h	AARCH64_ALIGNMENT_CHECK
 defflag opt_cpuoptions.h	AARCH64_EL0_STACK_ALIGNMENT_CHECK
@@ -15,8 +15,8 @@ defflag	opt_cputypes.h		CPU_CORTEXA57: C
 defparam opt_arm_intr_impl.h	ARM_INTR_IMPL
 
 # ARM-specific debug options (for compat arch/arm/*)
-defflag opt_arm_debug.h		ARM_LOCK_CAS_DEBUG
-defflag opt_arm_debug.h		VERBOSE_INIT_ARM
+defflag  opt_arm_debug.h	ARM_LOCK_CAS_DEBUG
+defflag  opt_arm_debug.h	VERBOSE_INIT_ARM
 
 # Timer options
 defflag opt_arm_timer.h		__HAVE_GENERIC_CPU_INITCLOCKS

Index: src/sys/arch/arm/conf/files.arm
diff -u src/sys/arch/arm/conf/files.arm:1.143 src/sys/arch/arm/conf/files.arm:1.144
--- src/sys/arch/arm/conf/files.arm:1.143	Fri Sep 21 12:04:06 2018
+++ src/sys/arch/arm/conf/files.arm	Sat Oct  6 17:46:46 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.arm,v 1.143 2018/09/21 12:04:06 skrll Exp $
+#	$NetBSD: files.arm,v 1.144 2018/10/06 17:46:46 skrll Exp $
 
 # temporary define to allow easy moving to ../arch/arm/arm32
 defflagARM32
@@ -74,8 +74,8 @@ defparam opt_cpuoptions.h	ARM_CBAR
 defparam opt_arm_intr_impl.h	ARM_INTR_IMPL
 
 # ARM-specific debug options
-defflag	opt_arm_debug.h		ARM_LOCK_CAS_DEBUG
-defflag	opt_arm_debug.h		VERBOSE_INIT_ARM
+defflag  opt_arm_debug.h	ARM_LOCK_CAS_DEBUG
+defflag  opt_arm_debug.h	VERBOSE_INIT_ARM
 
 # Board-specific bus_space(9)/bus_dma(9) definitions
 defflag  opt_arm_bus_space.h	__BUS_SPACE_HAS_STREAM_METHODS



CVS commit: src/sys/arch

2018-10-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Oct  6 16:49:54 UTC 2018

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

Log Message:
Change the name of xen_pirq_alloc() to xen_vec_alloc() to reflect
its actual job.

The idea is that we will strip this down until it is as close to
idt_vec_alloc() as possible.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/xen/x86/pintr.c

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

Modified files:

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.131 src/sys/arch/x86/x86/intr.c:1.132
--- src/sys/arch/x86/x86/intr.c:1.131	Sat Oct  6 16:44:55 2018
+++ src/sys/arch/x86/x86/intr.c	Sat Oct  6 16:49:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.131 2018/10/06 16:44:55 cherry Exp $	*/
+/*	$NetBSD: intr.c,v 1.132 2018/10/06 16:49:54 cherry Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.131 2018/10/06 16:44:55 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.132 2018/10/06 16:49:54 cherry Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1290,7 +1290,8 @@ intr_establish_xname(int legacy_irq, str
 	intrstr = intr_create_intrid(irq, pic, pin, intrstr_buf,
 	sizeof(intrstr_buf));
 
-	vector = xen_pirq_alloc(, type);
+	vector = xen_vec_alloc(irq);
+	irq = vect2irq[vector];
 	irq = (legacy_irq == -1) ? irq : legacy_irq; /* ISA compat */
 
 #if NIOAPIC > 0

Index: src/sys/arch/xen/include/intr.h
diff -u src/sys/arch/xen/include/intr.h:1.46 src/sys/arch/xen/include/intr.h:1.47
--- src/sys/arch/xen/include/intr.h:1.46	Sun Jun 24 13:35:32 2018
+++ src/sys/arch/xen/include/intr.h	Sat Oct  6 16:49:54 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.46 2018/06/24 13:35:32 jdolecek Exp $	*/
+/*	$NetBSD: intr.h,v 1.47 2018/10/06 16:49:54 cherry Exp $	*/
 /*	NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp	*/
 
 /*-
@@ -71,7 +71,7 @@ int xen_intr_biglock_wrapper(void *);
 #endif
 
 #if defined(DOM0OPS) || NPCI > 0
-int xen_pirq_alloc(intr_handle_t *, int);
+int xen_vec_alloc(intr_handle_t);
 #endif /* defined(DOM0OPS) || NPCI > 0 */
 
 #ifdef MULTIPROCESSOR

Index: src/sys/arch/xen/x86/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.5 src/sys/arch/xen/x86/pintr.c:1.6
--- src/sys/arch/xen/x86/pintr.c:1.5	Sat Oct  6 16:44:55 2018
+++ src/sys/arch/xen/x86/pintr.c	Sat Oct  6 16:49:54 2018
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.5 2018/10/06 16:44:55 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.6 2018/10/06 16:49:54 cherry Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -160,10 +160,10 @@ int vect2irq[256] = {0};
 
 #if defined(DOM0OPS) || NPCI > 0
 int
-xen_pirq_alloc(intr_handle_t *pirq, int type)
+xen_vec_alloc(intr_handle_t pirq)
 {
 	physdev_op_t op;
-	int irq = *pirq;
+	int irq = pirq;
 #if NIOAPIC > 0
 
 	/*
@@ -178,14 +178,14 @@ xen_pirq_alloc(intr_handle_t *pirq, int 
 	 * or none is available.
 	 */
 	static int xen_next_irq = 200;
-	struct ioapic_softc *ioapic = ioapic_find(APIC_IRQ_APIC(*pirq));
-	int pin = APIC_IRQ_PIN(*pirq);
+	struct ioapic_softc *ioapic = ioapic_find(APIC_IRQ_APIC(pirq));
+	int pin = APIC_IRQ_PIN(pirq);
 
-	if (*pirq & APIC_INT_VIA_APIC) {
+	if (pirq & APIC_INT_VIA_APIC) {
 		irq = vect2irq[ioapic->sc_pins[pin].ip_vector];
 		if (ioapic->sc_pins[pin].ip_vector == 0 || irq == 0) {
 			/* allocate IRQ */
-			irq = APIC_IRQ_LEGACY_IRQ(*pirq);
+			irq = APIC_IRQ_LEGACY_IRQ(pirq);
 			if (irq <= 0 || irq > 15)
 irq = xen_next_irq--;
 retry:
@@ -207,8 +207,6 @@ retry:
  vect2irq[op.u.irq_op.vector] == irq));
 			vect2irq[op.u.irq_op.vector] = irq;
 		}
-		*pirq &= ~0xff;
-		*pirq |= irq;
 	} else
 #endif /* NIOAPIC */
 	{



CVS commit: src/sys/arch

2018-10-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Oct  6 16:44:55 UTC 2018

Modified Files:
src/sys/arch/x86/x86: intr.c
src/sys/arch/xen/x86: pintr.c

Log Message:
Move the pic->pic_addroute() call from within pintr.c:xen_pirq_alloc() to
intr.c:intr_establish_xname()

xen_pirq_alloc() now returns a vector value, as is intended by
the semantics of the call to the hypervisor, PHYSDEVOP_ASSIGN_VECTOR.

This also brings our usage closer to native.


To generate a diff of this commit:
cvs rdiff -u -r1.130 -r1.131 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/xen/x86/pintr.c

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

Modified files:

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.130 src/sys/arch/x86/x86/intr.c:1.131
--- src/sys/arch/x86/x86/intr.c:1.130	Thu Sep 20 05:08:45 2018
+++ src/sys/arch/x86/x86/intr.c	Sat Oct  6 16:44:55 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.130 2018/09/20 05:08:45 cherry Exp $	*/
+/*	$NetBSD: intr.c,v 1.131 2018/10/06 16:44: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.130 2018/09/20 05:08:45 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.131 2018/10/06 16:44:55 cherry Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -1264,7 +1264,7 @@ intr_establish_xname(int legacy_irq, str
 #if NPCI > 0 || NISA > 0
 	struct pintrhand *pih;
 	intr_handle_t irq;
-	int evtchn;
+	int vector, evtchn;
 
 	KASSERTMSG(legacy_irq == -1 || (0 <= legacy_irq && legacy_irq < NUM_XEN_IRQS),
 	"bad legacy IRQ value: %d", legacy_irq);
@@ -1290,10 +1290,21 @@ intr_establish_xname(int legacy_irq, str
 	intrstr = intr_create_intrid(irq, pic, pin, intrstr_buf,
 	sizeof(intrstr_buf));
 
-	evtchn = xen_pirq_alloc(, type);
-	irq = (legacy_irq == -1) ? irq : legacy_irq; /* ISA compat */	
+	vector = xen_pirq_alloc(, type);
+	irq = (legacy_irq == -1) ? irq : legacy_irq; /* ISA compat */
+
+#if NIOAPIC > 0
+	extern struct cpu_info phycpu_info_primary; /* XXX */
+	struct cpu_info *ci = _info_primary;
+	pic->pic_addroute(pic, ci, pin, vector, type);
+#else
+
+#endif /* NIOAPIC */
+	evtchn = irq2port[vect2irq[vector]];
+	KASSERT(evtchn > 0);
+
 	pih = pirq_establish(irq & 0xff, evtchn, handler, arg, level,
-	intrstr, xname);
+			 intrstr, xname);
 	pih->pic_type = pic->pic_type;
 	return pih;
 #endif /* NPCI > 0 || NISA > 0 */

Index: src/sys/arch/xen/x86/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.4 src/sys/arch/xen/x86/pintr.c:1.5
--- src/sys/arch/xen/x86/pintr.c:1.4	Sat Oct  6 16:37:11 2018
+++ src/sys/arch/xen/x86/pintr.c	Sat Oct  6 16:44:55 2018
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.4 2018/10/06 16:37:11 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.5 2018/10/06 16:44:55 cherry Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -165,7 +165,7 @@ xen_pirq_alloc(intr_handle_t *pirq, int 
 	physdev_op_t op;
 	int irq = *pirq;
 #if NIOAPIC > 0
-	extern struct cpu_info phycpu_info_primary; /* XXX */
+
 	/*
 	 * The hypervisor has already allocated vectors and IRQs for the
 	 * devices. Reusing the same IRQ doesn't work because as we bind
@@ -179,7 +179,6 @@ xen_pirq_alloc(intr_handle_t *pirq, int 
 	 */
 	static int xen_next_irq = 200;
 	struct ioapic_softc *ioapic = ioapic_find(APIC_IRQ_APIC(*pirq));
-	struct pic *pic = >sc_pic;
 	int pin = APIC_IRQ_PIN(*pirq);
 
 	if (*pirq & APIC_INT_VIA_APIC) {
@@ -207,8 +206,6 @@ retry:
 (irq > 0 && irq < 16 &&
  vect2irq[op.u.irq_op.vector] == irq));
 			vect2irq[op.u.irq_op.vector] = irq;
-			pic->pic_addroute(pic, _info_primary, pin,
-			op.u.irq_op.vector, type);
 		}
 		*pirq &= ~0xff;
 		*pirq |= irq;
@@ -229,7 +226,6 @@ retry:
 			irq2port[irq] = bind_pirq_to_evtch(irq) + 1;
 		}
 	}
-	KASSERT(irq2port[irq] > 0);
-	return (irq2port[irq] - 1);
+	return (irq2vect[irq]);
 }
 #endif /* defined(DOM0OPS) || NPCI > 0 */



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

2018-10-06 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Sat Oct  6 16:37:11 UTC 2018

Modified Files:
src/sys/arch/xen/x86: pintr.c

Log Message:
Teach intr_establish_xname() for XEN to tolerate shared legacy_irq
registrations.

The current XEN code has not been able to tolerate shared legacy_irq
requests in xen_pirq_alloc(). This was never a problem because:

i) The only potential callpath with shared legacy_irq was
   isa_intr_establish_xname().
ii) The other callpath, namely pci_intr_establish_xname() passed
legacy_irq to intr_establish_xname(). However, this was ignored,
and a value of zero was passed to xen_pirq_alloc() which in
turn, allocated a new irq value, thus effectively demultiplexing
any shared legacy_irq value intended across randomly allocated
new irq values.
iii) Presumably on all platforms that XEN runs on, the isa callpath
 mentioned in i) never had shared irqs, and thus this was never
 a problem.

Except:
We now use a unified path for both isa_intr_establish_xname() and
pci_intr_establish_xname(). This means that now, intr_establish_xname()
which is a callee of both, needs to have a way to discern who the caller
was, and decide to pass on or discard the legacy_irq value, to preserve
the old semantics. However, this is impossible to do so, because the
callpath doesn't explicitly provide a mechanism for this discernment.

This is however not a problem, because from XEN's point of view, a
repeat registration of an irq is only a warning. legacy_irq is the only
case in which this repeat should occur, per the current implementation of
xen_pirq_alloc(). We thus tweak the KASSERT()s to tolerate a repeat value
in the legacy_irq, while maintaining the original intent of the KASSERT()
which was to ensure that existing unrelated irq registrations should never
be overwritten.

Once we re-organise XEN specific code and unify with the native
intr_establish_xname() path, we will not run into this problem, because
legacy_irq will be treated as the pin number of the i8259 pic
exactly as it is now treated in native.

In short, this commit should fix some of the panics being seen on
-current for certain configurations of hardware on which dom0 runs.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/xen/x86/pintr.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/xen/x86/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.3 src/sys/arch/xen/x86/pintr.c:1.4
--- src/sys/arch/xen/x86/pintr.c:1.3	Sat Feb 17 18:51:53 2018
+++ src/sys/arch/xen/x86/pintr.c	Sat Oct  6 16:37:11 2018
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.3 2018/02/17 18:51:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.4 2018/10/06 16:37:11 cherry Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -199,9 +199,13 @@ retry:
 	panic("PHYSDEVOP_ASSIGN_VECTOR irq %d", irq);
 goto retry;
 			}
-			KASSERT(irq2vect[irq] == 0);
+			KASSERT(irq2vect[irq] == 0 ||
+(irq > 0 && irq < 16 &&
+ irq2vect[irq] == op.u.irq_op.vector));
 			irq2vect[irq] = op.u.irq_op.vector;
-			KASSERT(vect2irq[op.u.irq_op.vector] == 0);
+			KASSERT(vect2irq[op.u.irq_op.vector] == 0 ||
+(irq > 0 && irq < 16 &&
+ vect2irq[op.u.irq_op.vector] == irq));
 			vect2irq[op.u.irq_op.vector] = irq;
 			pic->pic_addroute(pic, _info_primary, pin,
 			op.u.irq_op.vector, type);



CVS commit: src/usr.bin/gzip

2018-10-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Oct  6 16:36:45 UTC 2018

Modified Files:
src/usr.bin/gzip: gzip.c unxz.c

Log Message:
Add -l support for xz files


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/usr.bin/gzip/gzip.c
cvs rdiff -u -r1.7 -r1.8 src/usr.bin/gzip/unxz.c

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

Modified files:

Index: src/usr.bin/gzip/gzip.c
diff -u src/usr.bin/gzip/gzip.c:1.113 src/usr.bin/gzip/gzip.c:1.114
--- src/usr.bin/gzip/gzip.c:1.113	Tue Jun 12 00:42:17 2018
+++ src/usr.bin/gzip/gzip.c	Sat Oct  6 16:36:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: gzip.c,v 1.113 2018/06/12 00:42:17 kamil Exp $	*/
+/*	$NetBSD: gzip.c,v 1.114 2018/10/06 16:36:45 martin Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008, 2009, 2010, 2011, 2015, 2017
@@ -31,7 +31,7 @@
 #ifndef lint
 __COPYRIGHT("@(#) Copyright (c) 1997, 1998, 2003, 2004, 2006, 2008,\
  2009, 2010, 2011, 2015, 2017 Matthew R. Green.  All rights reserved.");
-__RCSID("$NetBSD: gzip.c,v 1.113 2018/06/12 00:42:17 kamil Exp $");
+__RCSID("$NetBSD: gzip.c,v 1.114 2018/10/06 16:36:45 martin Exp $");
 #endif /* not lint */
 
 /*
@@ -213,6 +213,7 @@ __dead static	void	display_version(void)
 static	const suffixes_t *check_suffix(char *, int);
 static	ssize_t	read_retry(int, void *, size_t);
 static	ssize_t	write_retry(int, const void *, size_t);
+static void	print_list_out(off_t, off_t, const char*);
 
 #ifdef SMALL
 #define infile_set(f,t) infile_set(f)
@@ -256,6 +257,7 @@ static	off_t	unpack(int, int, char *, si
 
 #ifndef NO_XZ_SUPPORT
 static	off_t	unxz(int, int, char *, size_t, off_t *);
+static	off_t	unxz_len(int);
 #endif
 
 #ifdef SMALL
@@ -1579,10 +1581,10 @@ file_uncompress(char *file, char *outfil
 #ifndef NO_XZ_SUPPORT
 	case FT_XZ:
 		if (lflag) {
-			maybe_warnx("no -l with xz files");
-			goto lose;
+			size = unxz_len(fd);
+			print_list_out(in_size, size, file);
+			return -1;
 		}
-
 		size = unxz(fd, zfd, NULL, 0, NULL);
 		break;
 #endif
@@ -2147,6 +2149,12 @@ print_list(int fd, off_t out, const char
 	in_tot += in;
 	out_tot += out;
 #endif
+	print_list_out(out, in, outfile);
+}
+
+static void
+print_list_out(off_t out, off_t in, const char *outfile)
+{
 	printf("%12llu %12llu ", (unsigned long long)out, (unsigned long long)in);
 	print_ratio(in, out, stdout);
 	printf(" %s\n", outfile);

Index: src/usr.bin/gzip/unxz.c
diff -u src/usr.bin/gzip/unxz.c:1.7 src/usr.bin/gzip/unxz.c:1.8
--- src/usr.bin/gzip/unxz.c:1.7	Fri Aug  4 07:27:08 2017
+++ src/usr.bin/gzip/unxz.c	Sat Oct  6 16:36:45 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: unxz.c,v 1.7 2017/08/04 07:27:08 mrg Exp $	*/
+/*	$NetBSD: unxz.c,v 1.8 2018/10/06 16:36:45 martin Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: unxz.c,v 1.7 2017/08/04 07:27:08 mrg Exp $");
+__RCSID("$NetBSD: unxz.c,v 1.8 2018/10/06 16:36:45 martin Exp $");
 
 #include 
 #include 
@@ -154,3 +154,322 @@ unxz(int i, int o, char *pre, size_t pre
 		}
 	}
 }
+
+#include 
+
+/*
+ * Copied various bits and pieces from xz support code or brute force
+ * replacements.
+ */
+
+#define	my_min(A,B)	((A)<(B)?(A):(B))
+
+// Some systems have suboptimal BUFSIZ. Use a bit bigger value on them.
+// We also need that IO_BUFFER_SIZE is a multiple of 8 (sizeof(uint64_t))
+#if BUFSIZ <= 1024
+#   define IO_BUFFER_SIZE 8192
+#else
+#   define IO_BUFFER_SIZE (BUFSIZ & ~7U)
+#endif
+
+/// is_sparse() accesses the buffer as uint64_t for maximum speed.
+/// Use an union to make sure that the buffer is properly aligned.
+typedef union {
+uint8_t u8[IO_BUFFER_SIZE];
+uint32_t u32[IO_BUFFER_SIZE / sizeof(uint32_t)];
+uint64_t u64[IO_BUFFER_SIZE / sizeof(uint64_t)];
+} io_buf;
+
+
+static bool
+io_pread(int fd, io_buf *buf, size_t size, off_t pos)
+{
+	// Using lseek() and read() is more portable than pread() and
+	// for us it is as good as real pread().
+	if (lseek(fd, pos, SEEK_SET) != pos) {
+		return true;
+	}
+
+	const size_t amount = read(fd, buf, size);
+	if (amount == SIZE_MAX)
+		return true;
+
+	if (amount != size) {
+		return true;
+	}
+
+	return false;
+}
+
+/*
+ * Most of the following is copied (mostly verbatim) from the xz
+ * distribution, from file src/xz/list.c
+ */
+
+///
+//
+/// \file   list.c
+/// \brief  Listing information about .xz files
+//
+//  Author: Lasse Collin
+//
+//  This file has been put into the public domain.
+//  You can do whatever you want with this file.
+//
+///
+
+
+/// Information about a .xz file
+typedef struct {
+	/// Combined Index of all Streams in the file
+	lzma_index *idx;
+
+	/// Total amount of Stream Padding
+	uint64_t stream_padding;
+
+	/// Highest 

CVS commit: src/sys/dev/fdt

2018-10-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct  6 16:28:21 UTC 2018

Modified Files:
src/sys/dev/fdt: fdt_subr.c files.fdt

Log Message:
Provide an FDTBASE option which allows kernels to access FDT parsing
functions without requiring full blown FDTisation.

This will be used by ODROID-C1 in move to generic start code.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/fdt/fdt_subr.c
cvs rdiff -u -r1.38 -r1.39 src/sys/dev/fdt/files.fdt

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

Modified files:

Index: src/sys/dev/fdt/fdt_subr.c
diff -u src/sys/dev/fdt/fdt_subr.c:1.23 src/sys/dev/fdt/fdt_subr.c:1.24
--- src/sys/dev/fdt/fdt_subr.c:1.23	Tue Jul 17 00:42:06 2018
+++ src/sys/dev/fdt/fdt_subr.c	Sat Oct  6 16:28:21 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: fdt_subr.c,v 1.23 2018/07/17 00:42:06 christos Exp $ */
+/* $NetBSD: fdt_subr.c,v 1.24 2018/10/06 16:28:21 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -27,7 +27,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.23 2018/07/17 00:42:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fdt_subr.c,v 1.24 2018/10/06 16:28:21 skrll Exp $");
+
+#include "opt_fdt.h"
 
 #include 
 #include 
@@ -298,6 +300,7 @@ fdtbus_get_reg64(int phandle, u_int inde
 	return 0;
 }
 
+#if defined(FDT)
 const struct fdt_console *
 fdtbus_get_console(void)
 {
@@ -323,6 +326,7 @@ fdtbus_get_console(void)
 
 	return booted_console == NULL ? NULL : booted_console->ops;
 }
+#endif
 
 const char *
 fdtbus_get_stdout_path(void)

Index: src/sys/dev/fdt/files.fdt
diff -u src/sys/dev/fdt/files.fdt:1.38 src/sys/dev/fdt/files.fdt:1.39
--- src/sys/dev/fdt/files.fdt:1.38	Wed Sep 26 19:06:33 2018
+++ src/sys/dev/fdt/files.fdt	Sat Oct  6 16:28:21 2018
@@ -1,8 +1,9 @@
-# $NetBSD: files.fdt,v 1.38 2018/09/26 19:06:33 jakllsch Exp $
+# $NetBSD: files.fdt,v 1.39 2018/10/06 16:28:21 skrll Exp $
 
 include	"external/bsd/libfdt/conf/files.libfdt"
 
-defflag	opt_fdt.hFDT: libfdt, ofw_subr
+defflag	opt_fdt.hFDTBASE : libfdt, ofw_subr
+defflag	opt_fdt.hFDT: FDTBASE
 
 define	fdt { [pass = 10] } : clk, pwm
 
@@ -44,8 +45,8 @@ device	panel: fdt_port
 attach	panel at fdt with fdt_panel
 file	dev/fdt/panel_fdt.c			fdt_panel
 
-file	dev/fdt/fdt_openfirm.c			fdt
-file	dev/fdt/fdt_subr.c			fdt
+file	dev/fdt/fdt_openfirm.c			fdtbase
+file	dev/fdt/fdt_subr.c			fdtbase
 file	dev/fdt/fdt_clock.c			fdt
 file	dev/fdt/fdt_dai.c			fdt
 file	dev/fdt/fdt_dma.c			fdt



CVS commit: src/sys/arch/arm

2018-10-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct  6 16:04:21 UTC 2018

Modified Files:
src/sys/arch/arm/arm32: cpu.c
src/sys/arch/arm/broadcom: bcm283x_platform.c

Log Message:
Use __BIT.  NFC.


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/arm/arm32/cpu.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/broadcom/bcm283x_platform.c

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

Modified files:

Index: src/sys/arch/arm/arm32/cpu.c
diff -u src/sys/arch/arm/arm32/cpu.c:1.120 src/sys/arch/arm/arm32/cpu.c:1.121
--- src/sys/arch/arm/arm32/cpu.c:1.120	Wed Aug 15 06:06:05 2018
+++ src/sys/arch/arm/arm32/cpu.c	Sat Oct  6 16:04:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.120 2018/08/15 06:06:05 skrll Exp $	*/
+/*	$NetBSD: cpu.c,v 1.121 2018/10/06 16:04:21 skrll Exp $	*/
 
 /*
  * Copyright (c) 1995 Mark Brinicombe.
@@ -46,7 +46,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.120 2018/08/15 06:06:05 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.121 2018/10/06 16:04:21 skrll Exp $");
 
 #include 
 #include 
@@ -116,7 +116,7 @@ cpu_attach(device_t dv, cpuid_t id)
 		ci->ci_ctrl = cpu_info_store.ci_ctrl;
 		ci->ci_undefsave[2] = cpu_info_store.ci_undefsave[2];
 		cpu_info[ci->ci_cpuid] = ci;
-		if ((arm_cpu_hatched & (1 << id)) == 0) {
+		if ((arm_cpu_hatched & __BIT(id)) == 0) {
 			ci->ci_dev = dv;
 			dv->dv_private = ci;
 			aprint_naive(": disabled\n");

Index: src/sys/arch/arm/broadcom/bcm283x_platform.c
diff -u src/sys/arch/arm/broadcom/bcm283x_platform.c:1.18 src/sys/arch/arm/broadcom/bcm283x_platform.c:1.19
--- src/sys/arch/arm/broadcom/bcm283x_platform.c:1.18	Mon Sep 10 11:05:12 2018
+++ src/sys/arch/arm/broadcom/bcm283x_platform.c	Sat Oct  6 16:04:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bcm283x_platform.c,v 1.18 2018/09/10 11:05:12 ryo Exp $	*/
+/*	$NetBSD: bcm283x_platform.c,v 1.19 2018/10/06 16:04:21 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2017 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.18 2018/09/10 11:05:12 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm283x_platform.c,v 1.19 2018/10/06 16:04:21 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_bcm283x.h"
@@ -771,7 +771,7 @@ bcm2836_bootstrap(void)
 		}
 
 		for (size_t i = 1; i < arm_cpu_max; i++) {
-			if ((arm_cpu_hatched & (1 << i)) == 0) {
+			if ((arm_cpu_hatched & __BIT(i)) == 0) {
 printf("%s: warning: cpu%zu failed to hatch\n",
 __func__, i);
 			}



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

2018-10-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Oct  6 15:54:55 UTC 2018

Modified Files:
src/sys/arch/arm/arm: cpufunc_asm_armv7.S

Log Message:
Add the ARM ARM cache operation name in some comments


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/arm/arm/cpufunc_asm_armv7.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/arm/arm/cpufunc_asm_armv7.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.27 src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.28
--- src/sys/arch/arm/arm/cpufunc_asm_armv7.S:1.27	Thu Aug 24 14:19:36 2017
+++ src/sys/arch/arm/arm/cpufunc_asm_armv7.S	Sat Oct  6 15:54:55 2018
@@ -347,7 +347,7 @@ ENTRY_NP(armv7_icache_inv_all)
 	mov	r2, ip			@ r2 now contains set way decr
 
 	/* r3 = ways/sets, r2 = way decr, r1 = set decr, r0 and ip are free */
-1:	mcr	p15, 0, r3, c7, c6, 2	@ invalidate line
+1:	mcr	p15, 0, r3, c7, c6, 2	@ DCISW (data cache invalidate by set/way)
 	movs	r0, r3			@ get current way/set
 	beq	2f			@ at 0 means we are done.
 	lsls	r0, r0, #10		@ clear way bits leaving only set bits
@@ -391,7 +391,7 @@ ENTRY_NP(armv7_dcache_l1inv_all)
 	sub	r2, r2, r0		@ subtract from way decr
 
 	/* r3 = ways/sets/level, r2 = way decr, r1 = set decr, r0 and ip are free */
-1:	mcr	p15, 0, r3, c7, c6, 2	@ invalidate line
+1:	mcr	p15, 0, r3, c7, c6, 2	@ DCISW (data cache invalidate by set/way)
 	cmp	r3, #15			@ are we done with this level (way/set == 0)
 	bls	.Ldone_l1inv		@ yes, we've finished
 	ubfx	r0, r3, #4, #18		@ extract set bits
@@ -445,7 +445,7 @@ ENTRY_NP(armv7_dcache_inv_all)
 	sub	r2, r2, r0		@ subtract from way decr
 
 	/* r3 = ways/sets/level, r2 = way decr, r1 = set decr, r0 and ip are free */
-1:	mcr	p15, 0, r3, c7, c6, 2	@ invalidate line
+1:	mcr	p15, 0, r3, c7, c6, 2	@ DCISW (data cache invalidate by set/way)
 	cmp	r3, #15			@ are we done with this level (way/set == 0)
 	bls	.Lnext_level_inv	@ yes, go to next level
 	ubfx	r0, r3, #4, #18		@ extract set bits
@@ -506,7 +506,7 @@ ENTRY_NP(armv7_dcache_wbinv_all)
 	sub	r2, r2, r0		@ subtract from way decr
 
 	/* r3 = ways/sets/level, r2 = way decr, r1 = set decr, r0 and ip are free */
-1:	mcr	p15, 0, r3, c7, c14, 2	@ writeback and invalidate line
+1:	mcr	p15, 0, r3, c7, c14, 2	@ DCCISW (data cache clean and invalidate by set/way)
 	cmp	r3, #15			@ are we done with this level (way/set == 0)
 	bls	.Lnext_level_wbinv	@ yes, go to next level
 	ubfx	r0, r3, #4, #18		@ extract set bits



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2018-10-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  6 15:33:35 UTC 2018

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: intel_panel.c

Log Message:
conditionally disable unused functions (clang)


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.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/external/bsd/drm2/dist/drm/i915/intel_panel.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c:1.11 src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c:1.12
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c:1.11	Thu Sep 13 04:25:55 2018
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_panel.c	Sat Oct  6 11:33:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_panel.c,v 1.11 2018/09/13 08:25:55 mrg Exp $	*/
+/*	$NetBSD: intel_panel.c,v 1.12 2018/10/06 15:33:35 christos Exp $	*/
 
 /*
  * Copyright © 2006-2010 Intel Corporation
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_panel.c,v 1.11 2018/09/13 08:25:55 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_panel.c,v 1.12 2018/10/06 15:33:35 christos Exp $");
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
@@ -432,6 +432,7 @@ static uint32_t scale(uint32_t source_va
 	return target_val;
 }
 
+#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
 /* Scale user_level in range [0..user_max] to [hw_min..hw_max]. */
 static inline u32 scale_user_to_hw(struct intel_connector *connector,
    u32 user_level, u32 user_max)
@@ -441,6 +442,7 @@ static inline u32 scale_user_to_hw(struc
 	return scale(user_level, 0, user_max,
 		 panel->backlight.min, panel->backlight.max);
 }
+#endif
 
 /* Scale user_level in range [0..user_max] to [0..hw_max], clamping the result
  * to [hw_min..hw_max]. */
@@ -456,6 +458,7 @@ static inline u32 clamp_user_to_hw(struc
 	return hw_level;
 }
 
+#if IS_ENABLED(CONFIG_BACKLIGHT_CLASS_DEVICE)
 /* Scale hw_level in range [hw_min..hw_max] to [0..user_max]. */
 static inline u32 scale_hw_to_user(struct intel_connector *connector,
    u32 hw_level, u32 user_max)
@@ -465,6 +468,7 @@ static inline u32 scale_hw_to_user(struc
 	return scale(hw_level, panel->backlight.min, panel->backlight.max,
 		 0, user_max);
 }
+#endif
 
 static u32 intel_panel_compute_brightness(struct intel_connector *connector,
 	  u32 val)



CVS commit: src/crypto/external/bsd/openssl/lib/libcrypto

2018-10-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  6 15:31:09 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/lib/libcrypto: Makefile

Log Message:
disable another clang warning


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 \
src/crypto/external/bsd/openssl/lib/libcrypto/Makefile

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

Modified files:

Index: src/crypto/external/bsd/openssl/lib/libcrypto/Makefile
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/Makefile:1.18 src/crypto/external/bsd/openssl/lib/libcrypto/Makefile:1.19
--- src/crypto/external/bsd/openssl/lib/libcrypto/Makefile:1.18	Thu Sep 27 14:18:53 2018
+++ src/crypto/external/bsd/openssl/lib/libcrypto/Makefile	Sat Oct  6 11:31:09 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.18 2018/09/27 18:18:53 christos Exp $
+#	$NetBSD: Makefile,v 1.19 2018/10/06 15:31:09 christos Exp $
 
 # RCSid:
 #	Id: Makefile,v 1.33 1998/11/11 11:53:53 sjg Exp
@@ -25,9 +25,11 @@ USE_FIPS=	no
 .include 
 .include 
 
-# XXX There's a bit of work to do before we can enable warnings.
+# XXX: There's a bit of work to do before we can enable warnings.
 WARNS=0
 CWARNFLAGS.clang+=	-Wno-empty-body -Wno-unused-value -Wno-parentheses
+# XXX: This warning seems to trigger incorrectly
+CWARNFLAGS.clang+=	-Wno-atomic-alignment
 
 # XXX Not yet.
 LINTFLAGS+=-D__int128='long long'



CVS commit: src/sys/compat/netbsd32

2018-10-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  6 15:22:16 UTC 2018

Modified Files:
src/sys/compat/netbsd32: netbsd32_ioctl.c

Log Message:
comment out unused


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/sys/compat/netbsd32/netbsd32_ioctl.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_ioctl.c
diff -u src/sys/compat/netbsd32/netbsd32_ioctl.c:1.96 src/sys/compat/netbsd32/netbsd32_ioctl.c:1.97
--- src/sys/compat/netbsd32/netbsd32_ioctl.c:1.96	Sat Sep 29 10:41:35 2018
+++ src/sys/compat/netbsd32/netbsd32_ioctl.c	Sat Oct  6 11:22:16 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_ioctl.c,v 1.96 2018/09/29 14:41:35 rmind Exp $	*/
+/*	$NetBSD: netbsd32_ioctl.c,v 1.97 2018/10/06 15:22:16 christos Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.96 2018/09/29 14:41:35 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_ioctl.c,v 1.97 2018/10/06 15:22:16 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ntp.h"
@@ -293,12 +293,14 @@ netbsd32_to_u_long(netbsd32_u_long *s32p
 	*p = (u_long)*s32p;
 }
 
+#ifdef notdef
 static inline void
 netbsd32_to_voidp(netbsd32_voidp *s32p, voidp *p, u_long cmd)
 {
 
 	*p = (void *)NETBSD32PTR64(*s32p);
 }
+#endif
 
 static inline void
 netbsd32_to_wdog_conf(struct netbsd32_wdog_conf *s32p, struct wdog_conf *p, u_long cmd)
@@ -855,13 +857,14 @@ netbsd32_from_u_long(u_long *p, netbsd32
 	*s32p = (netbsd32_u_long)*p;
 }
 
+#ifdef notdef
 static inline void
 netbsd32_from_voidp(voidp *p, netbsd32_voidp *s32p, u_long cmd)
 {
 
 	NETBSD32PTR32(*s32p, *p);
 }
-
+#endif
 
 static inline void
 netbsd32_from_clockctl_settimeofday(



CVS commit: src/sys/dev/dm

2018-10-06 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Oct  6 14:59:11 UTC 2018

Modified Files:
src/sys/dev/dm: device-mapper.c

Log Message:
Add ioctls to query geometry.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/dm/device-mapper.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/dm/device-mapper.c
diff -u src/sys/dev/dm/device-mapper.c:1.39 src/sys/dev/dm/device-mapper.c:1.40
--- src/sys/dev/dm/device-mapper.c:1.39	Sat Oct 28 04:53:55 2017
+++ src/sys/dev/dm/device-mapper.c	Sat Oct  6 14:59:11 2018
@@ -1,4 +1,4 @@
-/*$NetBSD: device-mapper.c,v 1.39 2017/10/28 04:53:55 riastradh Exp $ */
+/*$NetBSD: device-mapper.c,v 1.40 2018/10/06 14:59:11 mlelstv Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -508,6 +508,42 @@ disk_ioctl_switch(dev_t dev, u_long cmd,
 		break;
 	}
 
+	case DIOCGSECTORSIZE:
+	{
+		u_int *valp = data;
+		uint64_t numsec;
+		unsigned int secsize;
+
+		if ((dmv = dm_dev_lookup(NULL, NULL, minor(dev))) == NULL)
+			return ENODEV;
+
+		aprint_debug("DIOCGSECTORSIZE ioctl called\n");
+
+		dm_table_disksize(>table_head, , );
+		*valp = secsize;
+
+		dm_dev_unbusy(dmv);
+		break;
+	}
+
+	case DIOCGMEDIASIZE:
+	{
+		off_t *valp = data;
+		uint64_t numsec;
+		unsigned int secsize;
+
+		if ((dmv = dm_dev_lookup(NULL, NULL, minor(dev))) == NULL)
+			return ENODEV;
+
+		aprint_debug("DIOCGMEDIASIZE ioctl called\n");
+
+		dm_table_disksize(>table_head, , );
+		*valp = numsec;
+
+		dm_dev_unbusy(dmv);
+		break;
+	}
+
 
 	default:
 		aprint_debug("unknown disk_ioctl called\n");



CVS commit: src/share/man/man7

2018-10-06 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Oct  6 13:53:58 UTC 2018

Modified Files:
src/share/man/man7: sysctl.7

Log Message:
Fix some xrefs.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/share/man/man7/sysctl.7

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

Modified files:

Index: src/share/man/man7/sysctl.7
diff -u src/share/man/man7/sysctl.7:1.132 src/share/man/man7/sysctl.7:1.133
--- src/share/man/man7/sysctl.7:1.132	Fri Oct  5 22:16:50 2018
+++ src/share/man/man7/sysctl.7	Sat Oct  6 13:53:58 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.7,v 1.132 2018/10/05 22:16:50 christos Exp $
+.\"	$NetBSD: sysctl.7,v 1.133 2018/10/06 13:53:58 wiz Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -2137,9 +2137,9 @@ The variables are as follows:
 .It Li dgram.pcblist
 The Protocol Control Block list structure for datagram sockets.
 Parsed by
-.Xr netstat 8
+.Xr netstat 1
 or
-.Xr sockstat 8 .
+.Xr sockstat 1 .
 .It Li dgram.recvspace
 The default datagram receive buffer size.
 .It Li dgram.sendspace
@@ -2147,15 +2147,15 @@ The default datagram send buffer size.
 .It Li seqpacket.pcblist
 The Protocol Control Block list structure for Sequential Packet sockets.
 Parsed by
-.Xr netstat 8
+.Xr netstat 1
 or
-.Xr sockstat 8 .
+.Xr sockstat 1 .
 .It Li stream.pcblist
 The Protocol Control Block list structure for stream sockets.
 Parsed by
-.Xr netstat 8
+.Xr netstat 1
 or
-.Xr sockstat 8 .
+.Xr sockstat 1 .
 .It Li stream.recvspace
 The default stream receive buffer size.
 .It Li stream.sendspace
@@ -2618,7 +2618,7 @@ See
 .Xr secmodel 9
 for more information.
 .It Li security.pax
-Settings for PaX -- exploit mitigation features.
+Settings for PaX \(em exploit mitigation features.
 For more information on any of the PaX features, please see
 .Xr paxctl 8
 and



CVS commit: src/distrib/utils/embedded/conf

2018-10-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct  6 13:11:22 UTC 2018

Modified Files:
src/distrib/utils/embedded/conf: evbarm.conf

Log Message:
Use special ROOT. prefix in fstab entries instead of assuming ld0


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/distrib/utils/embedded/conf/evbarm.conf

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

Modified files:

Index: src/distrib/utils/embedded/conf/evbarm.conf
diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.29 src/distrib/utils/embedded/conf/evbarm.conf:1.30
--- src/distrib/utils/embedded/conf/evbarm.conf:1.29	Sat Oct  6 09:58:55 2018
+++ src/distrib/utils/embedded/conf/evbarm.conf	Sat Oct  6 13:11:22 2018
@@ -1,4 +1,4 @@
-# $NetBSD: evbarm.conf,v 1.29 2018/10/06 09:58:55 jmcneill Exp $
+# $NetBSD: evbarm.conf,v 1.30 2018/10/06 13:11:22 jmcneill Exp $
 # evbarm shared config
 #
 image=$HOME/${board}.img
@@ -67,9 +67,9 @@ make_fstab_evbarm_normal() {
 	cat > ${mnt}/etc/fstab << EOF
 # NetBSD /etc/fstab
 # See /usr/share/examples/fstab/ for more examples.
-/dev/ld0a	/		ffs	rw,noatime	1 1
-/dev/ld0b	none		swap	sw	0 0
-/dev/ld0e	/boot		msdos	rw	1 1
+ROOT.a		/		ffs	rw,noatime	1 1
+ROOT.b		none		swap	sw	0 0
+ROOT.e		/boot		msdos	rw	1 1
 kernfs		/kern		kernfs	rw
 ptyfs		/dev/pts	ptyfs	rw
 procfs		/proc		procfs	rw
@@ -84,9 +84,9 @@ make_fstab_evbarm_minwrites() {
 	cat > ${mnt}/etc/fstab << EOF
 # NetBSD /etc/fstab
 # See /usr/share/examples/fstab/ for more examples.
-/dev/ld0a	/			ffs	rw,log,noatime,nodevmtime 1 1
-/dev/ld0b	none			swap	sw			  0 0
-/dev/ld0e	/boot			msdos	rw			  1 1
+ROOT.a		/			ffs	rw,log,noatime,nodevmtime 1 1
+ROOT.b		none			swap	sw			  0 0
+ROOT.e		/boot			msdos	rw			  1 1
 kernfs		/kern			kernfs	rw
 ptyfs		/dev/pts		ptyfs	rw
 procfs		/proc			procfs	rw



CVS commit: src

2018-10-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct  6 13:09:53 UTC 2018

Modified Files:
src/etc/rc.d: resize_root
src/lib/libutil: getfsspecname.3 getfsspecname.c
src/share/man/man5: fstab.5

Log Message:
If fs_spec starts with the special string "ROOT.", replace it with a device
path derived from the value of the kern.root_device sysctl.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/etc/rc.d/resize_root
cvs rdiff -u -r1.5 -r1.6 src/lib/libutil/getfsspecname.3 \
src/lib/libutil/getfsspecname.c
cvs rdiff -u -r1.43 -r1.44 src/share/man/man5/fstab.5

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

Modified files:

Index: src/etc/rc.d/resize_root
diff -u src/etc/rc.d/resize_root:1.3 src/etc/rc.d/resize_root:1.4
--- src/etc/rc.d/resize_root:1.3	Tue Apr  7 18:02:11 2015
+++ src/etc/rc.d/resize_root	Sat Oct  6 13:09:53 2018
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: resize_root,v 1.3 2015/04/07 18:02:11 jmcneill Exp $
+# $NetBSD: resize_root,v 1.4 2018/10/06 13:09:53 jmcneill Exp $
 #
 
 # PROVIDE: resize_root
@@ -45,6 +45,7 @@ resize_root_start()
 		# skip comment or blank line
 		case "${fs_spec}" in
 		\#*|'') continue ;;
+		ROOT\.*) fs_spec="/dev/$(sysctl -n kern.root_device)${fs_spec#ROOT.}" ;;
 		esac
 
 		# skip non-root

Index: src/lib/libutil/getfsspecname.3
diff -u src/lib/libutil/getfsspecname.3:1.5 src/lib/libutil/getfsspecname.3:1.6
--- src/lib/libutil/getfsspecname.3:1.5	Sat Jun 13 19:52:58 2015
+++ src/lib/libutil/getfsspecname.3	Sat Oct  6 13:09:53 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: getfsspecname.3,v 1.5 2015/06/13 19:52:58 dholland Exp $
+.\"	$NetBSD: getfsspecname.3,v 1.6 2018/10/06 13:09:53 jmcneill Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -28,7 +28,7 @@
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd August 18, 2014
+.Dd October 6, 2018
 .Dt GETFSSPECNAME 3
 .Os
 .Sh NAME
@@ -65,6 +65,26 @@ is copied
 to
 .Fa buf
 and returned.
+.Pp
+If the
+.Fa spec
+argument starts with
+.Dq ROOT. ,
+a path in the form
+.Dq /dev/[root_device][suffix]
+is copied to
+.Fa buf ,
+where
+.Bq root_device
+is the value of the
+.Dq kern.root_device
+sysctl and
+.Bq suffix
+is the characters following
+.Dq ROOT.
+in the
+.Fa spec
+argument.
 .Sh RETURN VALUES
 On success the absolute pathname of the underlying wedge device is returned,
 or the original
Index: src/lib/libutil/getfsspecname.c
diff -u src/lib/libutil/getfsspecname.c:1.5 src/lib/libutil/getfsspecname.c:1.6
--- src/lib/libutil/getfsspecname.c:1.5	Sun May 25 13:46:07 2014
+++ src/lib/libutil/getfsspecname.c	Sat Oct  6 13:09:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: getfsspecname.c,v 1.5 2014/05/25 13:46:07 christos Exp $	*/
+/*	$NetBSD: getfsspecname.c,v 1.6 2018/10/06 13:09:53 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__RCSID("$NetBSD: getfsspecname.c,v 1.5 2014/05/25 13:46:07 christos Exp $");
+__RCSID("$NetBSD: getfsspecname.c,v 1.6 2018/10/06 13:09:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -59,6 +59,28 @@ getfsspecname(char *buf, size_t bufsiz, 
 	char *vname;
 
 	p = drives = vname = NULL;
+
+	/*
+	 * If the name starts with "ROOT.", replace it with "/dev/",
+	 * where  is the value of the kern.root_device sysctl. Any
+	 * characters after the special "ROOT." token are appended to the end
+	 * of this path.
+	 */
+	if (strncasecmp(name, "ROOT.", 5) == 0 && strchr(name, ':') == NULL) {
+		static const int mib_root[] = { CTL_KERN, KERN_ROOT_DEVICE };
+		static const int mib_rootlen = __arraycount(mib_root);
+
+		strlcpy(buf, "/dev/", bufsiz);
+		len = bufsiz - 5;
+		if (sysctl(mib_root, mib_rootlen, buf + 5, , NULL, 0) == -1) {
+			savee = errno;
+			strlcpy(buf, "sysctl kern.root_device failed", bufsiz);
+			goto out;
+		}
+		strlcat(buf, name + 5, bufsiz);
+		return buf;
+	}
+
 	if (strncasecmp(name, "NAME=", 5) != 0) {
 #ifdef COMPAT_DKWEDGE
 		/*

Index: src/share/man/man5/fstab.5
diff -u src/share/man/man5/fstab.5:1.43 src/share/man/man5/fstab.5:1.44
--- src/share/man/man5/fstab.5:1.43	Mon Dec 21 13:15:04 2015
+++ src/share/man/man5/fstab.5	Sat Oct  6 13:09:53 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: fstab.5,v 1.43 2015/12/21 13:15:04 ryoon Exp $
+.\"	$NetBSD: fstab.5,v 1.44 2018/10/06 13:09:53 jmcneill Exp $
 .\"
 .\" Copyright (c) 1980, 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)fstab.5	8.1 (Berkeley) 6/5/93
 .\"
-.Dd December 21, 2015
+.Dd October 6, 2018
 .Dt FSTAB 5
 .Os
 .Sh NAME
@@ -91,6 +91,16 @@ wedge partitions are searched for one th
 .Ar 
 and the device corresponding to it is selected.
 .Pp
+If the first field starts with the prefix
+.Dq ROOT.
+the prefix is replaced with
+.Dq /dev/[root_device] ,
+where
+.Bq root_device
+is the value of the
+.Dq kern.root_device
+sysctl.
+.Pp
 The 

CVS commit: src/sys/sys

2018-10-06 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sat Oct  6 13:03:55 UTC 2018

Modified Files:
src/sys/sys: timetc.h

Log Message:
Add a forward declaration to make including this header require less
other headers.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/sys/timetc.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/sys/timetc.h
diff -u src/sys/sys/timetc.h:1.6 src/sys/sys/timetc.h:1.7
--- src/sys/sys/timetc.h:1.6	Sun Jan 11 02:45:56 2009
+++ src/sys/sys/timetc.h	Sat Oct  6 13:03:55 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: timetc.h,v 1.6 2009/01/11 02:45:56 christos Exp $ */
+/* $NetBSD: timetc.h,v 1.7 2018/10/06 13:03:55 maya Exp $ */
 
 /*-
  * 
@@ -40,6 +40,7 @@
  */
 
 struct timecounter;
+struct timespec;
 typedef u_int timecounter_get_t(struct timecounter *);
 typedef void timecounter_pps_t(struct timecounter *);
 



CVS commit: src/etc/etc.aarch64

2018-10-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct  6 10:00:32 UTC 2018

Modified Files:
src/etc/etc.aarch64: MAKEDEV.conf

Log Message:
Create ld[4-7] device nodes, matching evbarm


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/etc/etc.aarch64/MAKEDEV.conf

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

Modified files:

Index: src/etc/etc.aarch64/MAKEDEV.conf
diff -u src/etc/etc.aarch64/MAKEDEV.conf:1.5 src/etc/etc.aarch64/MAKEDEV.conf:1.6
--- src/etc/etc.aarch64/MAKEDEV.conf:1.5	Sun Sep 23 09:20:57 2018
+++ src/etc/etc.aarch64/MAKEDEV.conf	Sat Oct  6 10:00:32 2018
@@ -1,8 +1,8 @@
-# $NetBSD: MAKEDEV.conf,v 1.5 2018/09/23 09:20:57 maxv Exp $
+# $NetBSD: MAKEDEV.conf,v 1.6 2018/10/06 10:00:32 jmcneill Exp $
 
 all_md)
 	makedev wscons fd0 fd1 wd0 wd1 wd2 wd3 sd0 sd1 sd2 sd3
-	makedev ld0 ld1 ld2 ld3 dk0 dk1 dk2 dk3 dk4 dk5 dk6 dk7
+	makedev ld0 ld1 ld2 ld3 ld4 ld5 ld6 ld7 dk0 dk1 dk2 dk3 dk4 dk5 dk6 dk7
 	makedev flash0 flash1 flash2 flash3 flash4 flash5 flash6 flash7
 	makedev tty0 tty1 plcom0 st0 st1 ch0 cd0 cd1
 	makedev uk0 uk1 ss0
@@ -23,7 +23,7 @@ all_md)
 
 ramdisk|floppy)
 	makedev std bpf fd0 fd1 wd0 wd1 wd2 wd3 md0 md1 sd0 sd1 sd2 sd3
-	makedev ld0 ld1 ld2 ld3 dk0 dk1 dk2 dk3 dk4 dk5 dk6 dk7
+	makedev ld0 ld1 ld2 ld3 ld4 ld5 ld6 ld7 dk0 dk1 dk2 dk3 dk4 dk5 dk6 dk7
 	makedev flash0 flash1 flash2 flash3 flash4 flash5 flash6 flash7
 	makedev tty0 tty1 opty
 	makedev st0 st1 cd0 cd1



CVS commit: src/distrib/utils/embedded

2018-10-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Oct  6 09:58:55 UTC 2018

Modified Files:
src/distrib/utils/embedded/conf: evbarm.conf
src/distrib/utils/embedded/files: resize_disklabel

Log Message:
resize_disklabel: if disk and partition is not specified, use 
kern.root_device/kern.root_partition sysctls


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/distrib/utils/embedded/conf/evbarm.conf
cvs rdiff -u -r1.2 -r1.3 src/distrib/utils/embedded/files/resize_disklabel

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

Modified files:

Index: src/distrib/utils/embedded/conf/evbarm.conf
diff -u src/distrib/utils/embedded/conf/evbarm.conf:1.28 src/distrib/utils/embedded/conf/evbarm.conf:1.29
--- src/distrib/utils/embedded/conf/evbarm.conf:1.28	Tue Jun 19 15:12:05 2018
+++ src/distrib/utils/embedded/conf/evbarm.conf	Sat Oct  6 09:58:55 2018
@@ -1,4 +1,4 @@
-# $NetBSD: evbarm.conf,v 1.28 2018/06/19 15:12:05 jmcneill Exp $
+# $NetBSD: evbarm.conf,v 1.29 2018/10/06 09:58:55 jmcneill Exp $
 # evbarm shared config
 #
 image=$HOME/${board}.img
@@ -138,8 +138,6 @@ EOF
 	if $resize; then
 		cat >> ${mnt}/etc/rc.conf << EOF
 resize_disklabel=YES
-resize_disklabel_disk=ld0
-resize_disklabel_part=a
 resize_root=YES
 resize_root_flags="-p"
 resize_root_postcmd="/sbin/reboot -n"

Index: src/distrib/utils/embedded/files/resize_disklabel
diff -u src/distrib/utils/embedded/files/resize_disklabel:1.2 src/distrib/utils/embedded/files/resize_disklabel:1.3
--- src/distrib/utils/embedded/files/resize_disklabel:1.2	Fri Apr 14 13:47:21 2017
+++ src/distrib/utils/embedded/files/resize_disklabel	Sat Oct  6 09:58:55 2018
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: resize_disklabel,v 1.2 2017/04/14 13:47:21 jmcneill Exp $
+# $NetBSD: resize_disklabel,v 1.3 2018/10/06 09:58:55 jmcneill Exp $
 #
 
 # PROVIDE: resize_disklabel
@@ -80,12 +80,10 @@ grow_disklabel()
 resize_disklabel_start()
 {
 	if [ x"${resize_disklabel_disk}" = "x" ]; then
-		warn "\${resize_disklabel_disk} is not set, not resizing disklabel"
-		return
+		resize_disklabel_disk="$(/sbin/sysctl -n kern.root_device)"
 	fi
 	if [ x"${resize_disklabel_part}" = "x" ]; then
-		warn "\${resize_disklabel_part} is not set, not resizing disklabel"
-		return
+		resize_disklabel_part=$(printf \\$(printf '%03o' $(( 97 + $(sysctl -n kern.root_partition) 
 	fi
 
 	grow_mbrpart "${resize_disklabel_disk}"