CVS commit: src/sys

2022-09-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep  7 03:34:44 UTC 2022

Modified Files:
src/sys/dev/pci: emuxki.c emuxkivar.h
src/sys/modules/emuxki: Makefile.inc
Added Files:
src/sys/dev/pci: emuxki_boards.c emuxki_boards.h

Log Message:
emuxki(4): import a list of board definitions

This is inspired by the cxdtv(4) driver.

Tested on NetBSD/amd64 with a Sound Blaster Live! Value (CT4870, PCI)
and with a Sound Blaster Audigy Rx 7.1 (SB1550, PCIe).

Additional sound cards sponsored by the NetBSD Foundation; thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/emuxki.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/emuxki_boards.c \
src/sys/dev/pci/emuxki_boards.h
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/emuxkivar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/emuxki/Makefile.inc

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

Modified files:

Index: src/sys/dev/pci/emuxki.c
diff -u src/sys/dev/pci/emuxki.c:1.75 src/sys/dev/pci/emuxki.c:1.76
--- src/sys/dev/pci/emuxki.c:1.75	Wed Sep  7 01:00:37 2022
+++ src/sys/dev/pci/emuxki.c	Wed Sep  7 03:34:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: emuxki.c,v 1.75 2022/09/07 01:00:37 khorben Exp $	*/
+/*	$NetBSD: emuxki.c,v 1.76 2022/09/07 03:34:43 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.75 2022/09/07 01:00:37 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.76 2022/09/07 03:34:43 khorben Exp $");
 
 #include 
 #include 
@@ -56,6 +56,7 @@ __KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1
 
 #include 
 #include 
+#include 
 
 /* #define EMUXKI_DEBUG 1 */
 #ifdef EMUXKI_DEBUG
@@ -74,7 +75,6 @@ __KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1
  */
 
 #define EMU_PCI_CBIO		(0x10)
-#define EMU_SUBSYS_APS		(0x40011102)
 
 /* blackmagic */
 #define X1(x)		((sc->sc_type & EMUXKI_AUDIGY) ? EMU_A_##x : EMU_##x)
@@ -357,20 +357,17 @@ static int
 emuxki_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa;
+	pcireg_t reg;
 
 	pa = aux;
-	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_CREATIVELABS)
-		return 0;
 
-	switch (PCI_PRODUCT(pa->pa_id)) {
-	case PCI_PRODUCT_CREATIVELABS_SBLIVE:
-	case PCI_PRODUCT_CREATIVELABS_SBLIVE2:
-	case PCI_PRODUCT_CREATIVELABS_AUDIGY:
-	case PCI_PRODUCT_CREATIVELABS_SBAUDIGY4:
+	reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
+	if (emuxki_board_lookup(PCI_VENDOR(pa->pa_id),
+PCI_PRODUCT(pa->pa_id), reg,
+PCI_REVISION(pa->pa_class)) != NULL)
 		return 1;
-	default:
-		return 0;
-	}
+
+	return 0;
 }
 
 static void
@@ -378,6 +375,7 @@ emuxki_attach(device_t parent, device_t 
 {
 	struct emuxki_softc *sc;
 	struct pci_attach_args *pa;
+	const struct emuxki_board *sb;
 	pci_intr_handle_t ih;
 	const char *intrstr;
 	char intrbuf[PCI_INTRSTR_LEN];
@@ -387,7 +385,14 @@ emuxki_attach(device_t parent, device_t 
 	sc->sc_dev = self;
 	pa = aux;
 
+	reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_SUBSYS_ID_REG);
+	sb = emuxki_board_lookup(PCI_VENDOR(pa->pa_id),
+  PCI_PRODUCT(pa->pa_id), reg,
+  PCI_REVISION(pa->pa_class));
+	KASSERT(sb != NULL);
+
 	pci_aprint_devinfo(pa, "Audio controller");
+	aprint_normal_dev(self, "%s [%s]\n", sb->sb_name, sb->sb_board);
 	DPRINTF("dmat=%p\n", (char *)pa->pa_dmat);
 
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
@@ -434,28 +439,17 @@ emuxki_attach(device_t parent, device_t 
 	aprint_normal_dev(self, "interrupting at %s\n", intrstr);
 
 	/* XXX it's unknown whether APS is made from Audigy as well */
-	if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CREATIVELABS_SBAUDIGY4) {
-		sc->sc_type = EMUXKI_AUDIGY;
-		sc->sc_type |= EMUXKI_AUDIGY2;
-		sc->sc_type |= EMUXKI_AUDIGY2_VALUE;
-		strlcpy(sc->sc_audv.name, "Audigy2 (value)",
+	sc->sc_type = sb->sb_flags;
+	if (sc->sc_type & EMUXKI_AUDIGY2_CA0108) {
+		strlcpy(sc->sc_audv.name, "Audigy2+CA0108",
 		sizeof(sc->sc_audv.name));
-	} else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_CREATIVELABS_AUDIGY) {
-		sc->sc_type = EMUXKI_AUDIGY;
-		if (PCI_REVISION(pa->pa_class) == 0x04) {
-			sc->sc_type |= EMUXKI_AUDIGY2;
-			strlcpy(sc->sc_audv.name, "Audigy2",
-			sizeof(sc->sc_audv.name));
-		} else {
-			strlcpy(sc->sc_audv.name, "Audigy",
-			sizeof(sc->sc_audv.name));
-		}
-	} else if (pci_conf_read(pa->pa_pc, pa->pa_tag,
-	PCI_SUBSYS_ID_REG) == EMU_SUBSYS_APS) {
-		sc->sc_type = EMUXKI_APS;
+	} else if (sc->sc_type & EMUXKI_AUDIGY2) {
+		strlcpy(sc->sc_audv.name, "Audigy2", sizeof(sc->sc_audv.name));
+	} else if (sc->sc_type & EMUXKI_AUDIGY) {
+		strlcpy(sc->sc_audv.name, "Audigy", sizeof(sc->sc_audv.name));
+	} else if (sc->sc_type & EMUXKI_APS) {
 		strlcpy(sc->sc_audv.name, "E-mu APS", sizeof(sc->sc_audv.name));
 	} else {
-		sc->sc_type = EMUXKI_SBLIVE;
 		strlcpy(sc->sc_audv.name, "SB Live!", sizeof(sc->sc_audv.name));
 	}
 	snprintf(sc->sc_audv.version, 

CVS commit: src/sys

2022-09-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep  7 03:34:44 UTC 2022

Modified Files:
src/sys/dev/pci: emuxki.c emuxkivar.h
src/sys/modules/emuxki: Makefile.inc
Added Files:
src/sys/dev/pci: emuxki_boards.c emuxki_boards.h

Log Message:
emuxki(4): import a list of board definitions

This is inspired by the cxdtv(4) driver.

Tested on NetBSD/amd64 with a Sound Blaster Live! Value (CT4870, PCI)
and with a Sound Blaster Audigy Rx 7.1 (SB1550, PCIe).

Additional sound cards sponsored by the NetBSD Foundation; thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/emuxki.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/emuxki_boards.c \
src/sys/dev/pci/emuxki_boards.h
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/emuxkivar.h
cvs rdiff -u -r1.1 -r1.2 src/sys/modules/emuxki/Makefile.inc

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Sep  7 02:41:39 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.h

Log Message:
Turn fpu_sub() macro into static inline function for clarity.
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.h
diff -u src/sys/arch/powerpc/fpu/fpu_emu.h:1.11 src/sys/arch/powerpc/fpu/fpu_emu.h:1.12
--- src/sys/arch/powerpc/fpu/fpu_emu.h:1.11	Tue Sep  6 23:07:53 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.h	Wed Sep  7 02:41:39 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.h,v 1.11 2022/09/06 23:07:53 rin Exp $ */
+/*	$NetBSD: fpu_emu.h,v 1.12 2022/09/07 02:41:39 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -163,12 +163,20 @@ struct fpemu {
  * Each returns a pointer to the result and/or sets exceptions.
  */
 struct	fpn *fpu_add(struct fpemu *);
-#define	fpu_sub(fe)			\
-((ISNAN(&(fe)->fe_f2) ? 0 : ((fe)->fe_f2.fp_sign ^= 1)), fpu_add(fe))
 struct	fpn *fpu_mul(struct fpemu *);
 struct	fpn *fpu_div(struct fpemu *);
 struct	fpn *fpu_sqrt(struct fpemu *);
 
+static inline struct fpn *
+fpu_sub(struct fpemu *fe)
+{
+	struct fpn *fp = >fe_f2;
+
+	if (!ISNAN(fp))
+		fp->fp_sign ^= 1;
+	return fpu_add(fe);
+}
+
 /*
  * Other functions.
  */



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Sep  7 02:41:39 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.h

Log Message:
Turn fpu_sub() macro into static inline function for clarity.
No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/fpu/fpu_emu.h

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



CVS commit: src/share/man/man9

2022-09-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Sep  7 01:18:33 UTC 2022

Modified Files:
src/share/man/man9: sysctl.9

Log Message:
Update to match recent changes in implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/share/man/man9/sysctl.9

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

Modified files:

Index: src/share/man/man9/sysctl.9
diff -u src/share/man/man9/sysctl.9:1.23 src/share/man/man9/sysctl.9:1.24
--- src/share/man/man9/sysctl.9:1.23	Wed Aug  7 19:58:50 2019
+++ src/share/man/man9/sysctl.9	Wed Sep  7 01:18:32 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.9,v 1.23 2019/08/07 19:58:50 wiz Exp $
+.\"	$NetBSD: sysctl.9,v 1.24 2022/09/07 01:18:32 pgoyette Exp $
 .\"
 .\" Copyright (c) 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd August 7, 2019
+.Dd September 6, 2022
 .Dt SYSCTL 9
 .Os
 .Sh NAME
@@ -546,7 +546,8 @@ specifically ignores any arguments given
 to zero, and returns success.
 .Sh SETUP FUNCTIONS
 Although nodes can be added to the SYSCTL tree at any time, in order to
-add nodes during the kernel bootstrap phase, a proper
+add nodes during the kernel bootstrap phase (and during loadable module
+initialization), a proper
 .Dq setup
 function must be used.
 Setup functions are declared using the
@@ -565,11 +566,11 @@ The address of the function is added to 
 traverses during initialization.
 For loadable kernel modules (see
 .Xr module 9 ) ,
-the list of functions is called from the module loader after the module's
+the list of functions is called from the module loader before the module's
 initialization routine.
 Any sysctl nodes created for the loadable module are removed using
 .Fn sysctl_teardown
-before calling the module's termination code.
+after calling the module's termination code.
 .Pp
 Setup functions do not have to add nodes to the main tree, but can set
 up their own trees for emulation or other purposes.



CVS commit: src/share/man/man9

2022-09-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Sep  7 01:18:33 UTC 2022

Modified Files:
src/share/man/man9: sysctl.9

Log Message:
Update to match recent changes in implementation.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/share/man/man9/sysctl.9

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



CVS commit: src/sys/dev/pci

2022-09-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep  7 01:00:37 UTC 2022

Modified Files:
src/sys/dev/pci: emuxki.c
Added Files:
src/sys/dev/pci: emuxkivar.h

Log Message:
emuxki(4): place struct emuxki_softc into its own file

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pci/emuxki.c
cvs rdiff -u -r0 -r1.15 src/sys/dev/pci/emuxkivar.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/pci/emuxki.c
diff -u src/sys/dev/pci/emuxki.c:1.74 src/sys/dev/pci/emuxki.c:1.75
--- src/sys/dev/pci/emuxki.c:1.74	Wed Sep  7 00:44:07 2022
+++ src/sys/dev/pci/emuxki.c	Wed Sep  7 01:00:37 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: emuxki.c,v 1.74 2022/09/07 00:44:07 khorben Exp $	*/
+/*	$NetBSD: emuxki.c,v 1.75 2022/09/07 01:00:37 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.74 2022/09/07 00:44:07 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.75 2022/09/07 01:00:37 khorben Exp $");
 
 #include 
 #include 
@@ -54,16 +54,8 @@ __KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1
 #include 
 #include 
 
-#include 
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-
 #include 
+#include 
 
 /* #define EMUXKI_DEBUG 1 */
 #ifdef EMUXKI_DEBUG
@@ -84,109 +76,6 @@ __KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1
 #define EMU_PCI_CBIO		(0x10)
 #define EMU_SUBSYS_APS		(0x40011102)
 
-#define EMU_PTESIZE		(4096)
-#define EMU_MINPTE		(3)
-/*
- * Hardware limit of PTE is 4096 entry but it's too big for single voice.
- * Reasonable candidate is:
- *  48kHz * 2ch * 2byte * 1sec * 3buf/EMU_PTESIZE = 141
- * and then round it up to 2^n.
- */
-#define EMU_MAXPTE		(256)
-#define EMU_NUMCHAN		(64)
-
-/*
- * Internal recording DMA buffer
- */
-/* Recommend the same size as EMU_PTESIZE to be symmetrical for play/rec */
-#define EMU_REC_DMABLKSIZE	(4096)
-/* must be EMU_REC_DMABLKSIZE * 2 */
-#define EMU_REC_DMASIZE		(8192)
-/* must be EMU_RECBS_BUFSIZE_(EMU_REC_DMASIZE) */
-#define EMU_REC_BUFSIZE_RECBS	EMU_RECBS_BUFSIZE_8192
-
-/*
- * DMA memory management
- */
-
-#define EMU_DMA_ALIGN		(4096)
-#define EMU_DMA_NSEGS		(1)
-
-struct dmamem {
-	bus_dma_tag_t		dmat;
-	bus_size_t		size;
-	bus_size_t		align;
-	bus_size_t		bound;
-	bus_dma_segment_t	*segs;
-	int			nsegs;
-	int			rsegs;
-	void *			kaddr;
-	bus_dmamap_t		map;
-};
-
-#define KERNADDR(ptr)		((void *)((ptr)->kaddr))
-/*
- * (ptr)->segs[] is CPU's PA translated by CPU's MMU.
- * (ptr)->map->dm_segs[] is PCI device's PA translated by PCI's MMU.
- */
-#define DMASEGADDR(ptr, segno)	((ptr)->map->dm_segs[segno].ds_addr)
-#define DMAADDR(ptr)		DMASEGADDR(ptr, 0)
-#define DMASIZE(ptr)		((ptr)->size)
-
-struct emuxki_softc {
-	device_t		sc_dev;
-	device_t		sc_audev;
-	enum {
-		EMUXKI_SBLIVE = 0x00,
-		EMUXKI_AUDIGY = 0x01,
-		EMUXKI_AUDIGY2 = 0x02,
-		EMUXKI_AUDIGY2_VALUE = 0x04,
-		EMUXKI_LIVE_5_1 = 0x08,
-		EMUXKI_APS = 0x10
-	} sc_type;
-	audio_device_t		sc_audv;	/* for GETDEV */
-
-	/* Autoconfig parameters */
-	bus_space_tag_t		sc_iot;
-	bus_space_handle_t	sc_ioh;
-	bus_addr_t		sc_iob;
-	bus_size_t		sc_ios;
-	pci_chipset_tag_t	sc_pc;		/* PCI tag */
-	bus_dma_tag_t		sc_dmat;
-	void			*sc_ih;		/* interrupt handler */
-	kmutex_t		sc_intr_lock;
-	kmutex_t		sc_lock;
-	kmutex_t		sc_index_lock;
-
-	/* register parameters */
-	struct dmamem		*ptb;		/* page table */
-
-	struct dmamem		*pmem;		/* play memory */
-	void			(*pintr)(void *);
-	void			*pintrarg;
-	audio_params_t		play;
-	uint32_t		pframesize;
-	uint32_t		pblksize;
-	uint32_t		plength;
-	uint32_t		poffset;
-
-	struct dmamem		*rmem;		/* rec internal memory */
-	void			(*rintr)(void *);
-	void			*rintrarg;
-	audio_params_t		rec;
-	void			*rptr;		/* rec MI ptr */
-	int			rcurrent;	/* rec software trans count */
-	int			rframesize;
-	int			rblksize;
-	int			rlength;
-	int			roffset;
-
-	/* others */
-
-	struct ac97_host_if	hostif;
-	struct ac97_codec_if	*codecif;
-};
-
 /* blackmagic */
 #define X1(x)		((sc->sc_type & EMUXKI_AUDIGY) ? EMU_A_##x : EMU_##x)
 #define X2(x, y)	((sc->sc_type & EMUXKI_AUDIGY) \

Added files:

Index: src/sys/dev/pci/emuxkivar.h
diff -u /dev/null src/sys/dev/pci/emuxkivar.h:1.15
--- /dev/null	Wed Sep  7 01:00:37 2022
+++ src/sys/dev/pci/emuxkivar.h	Wed Sep  7 01:00:37 2022
@@ -0,0 +1,153 @@
+/*	$NetBSD: emuxkivar.h,v 1.15 2022/09/07 01:00:37 khorben Exp $	*/
+
+/*-
+ * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Yannick Montulet, and by Andrew Doran.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following 

CVS commit: src/sys/dev/pci

2022-09-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep  7 01:00:37 UTC 2022

Modified Files:
src/sys/dev/pci: emuxki.c
Added Files:
src/sys/dev/pci: emuxkivar.h

Log Message:
emuxki(4): place struct emuxki_softc into its own file

NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/dev/pci/emuxki.c
cvs rdiff -u -r0 -r1.15 src/sys/dev/pci/emuxkivar.h

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



CVS commit: src/sys/dev/pci

2022-09-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep  7 00:44:07 UTC 2022

Modified Files:
src/sys/dev/pci: emuxki.c

Log Message:
emuxki(4): restrict DMA memory within the first 2GB

As implemented in the driver, the EMU10K1 chip can only address memory
up to 31-bit addresses.

Tested on NetBSD/amd64 with a Sound Blaster Live! Value (CT4870, PCI)
and with a Sound Blaster Audigy Rx 7.1 (SB1550, PCIe).

Additional sound cards sponsored by the NetBSD Foundation; thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/pci/emuxki.c

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

Modified files:

Index: src/sys/dev/pci/emuxki.c
diff -u src/sys/dev/pci/emuxki.c:1.73 src/sys/dev/pci/emuxki.c:1.74
--- src/sys/dev/pci/emuxki.c:1.73	Wed Sep  7 00:29:23 2022
+++ src/sys/dev/pci/emuxki.c	Wed Sep  7 00:44:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: emuxki.c,v 1.73 2022/09/07 00:29:23 khorben Exp $	*/
+/*	$NetBSD: emuxki.c,v 1.74 2022/09/07 00:44:07 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.73 2022/09/07 00:29:23 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.74 2022/09/07 00:44:07 khorben Exp $");
 
 #include 
 #include 
@@ -506,7 +506,15 @@ emuxki_attach(device_t parent, device_t 
 	mutex_init(>sc_index_lock, MUTEX_DEFAULT, IPL_AUDIO);
 
 	sc->sc_pc   = pa->pa_pc;
-	sc->sc_dmat = pa->pa_dmat;
+
+	/* EMU10K1 can only address 31 bits (2GB) */
+	if (bus_dmatag_subregion(pa->pa_dmat, 0, ((uint32_t)1 << 31) - 1,
+	&(sc->sc_dmat), BUS_DMA_NOWAIT) != 0) {
+		aprint_error_dev(self,
+		"WARNING: failed to restrict dma range,"
+		" falling back to parent bus dma range\n");
+		sc->sc_dmat = pa->pa_dmat;
+	}
 
 	reg = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
 	reg |= PCI_COMMAND_IO_ENABLE | PCI_COMMAND_MASTER_ENABLE |



CVS commit: src/sys/dev/pci

2022-09-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep  7 00:44:07 UTC 2022

Modified Files:
src/sys/dev/pci: emuxki.c

Log Message:
emuxki(4): restrict DMA memory within the first 2GB

As implemented in the driver, the EMU10K1 chip can only address memory
up to 31-bit addresses.

Tested on NetBSD/amd64 with a Sound Blaster Live! Value (CT4870, PCI)
and with a Sound Blaster Audigy Rx 7.1 (SB1550, PCIe).

Additional sound cards sponsored by the NetBSD Foundation; thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/pci/emuxki.c

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



CVS commit: src/sys/arch

2022-09-06 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Sep  7 00:40:19 UTC 2022

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S genassym.cf lock_stubs.S
locore.S spl.S vector.S
src/sys/arch/i386/i386: genassym.cf i386_trap.S lock_stubs.S locore.S
spl.S vector.S
src/sys/arch/x86/include: cpu.h intr.h intrdefs.h
src/sys/arch/x86/x86: intr.c lapic.c x86_softintr.c
src/sys/arch/xen/include: hypervisor.h intr.h
src/sys/arch/xen/x86: hypervisor_machdep.c
src/sys/arch/xen/xen: evtchn.c xenevt.c

Log Message:
NetBSD/x86: Raise the number of interrupt sources per CPU from 32 to 56.

There has been no objection for three years.
https://mail-index.netbsd.org/port-amd64/2019/09/22/msg003012.html
Implemented by nonaka@n.o, updated by me.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.213 -r1.214 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/i386/i386/lock_stubs.S
cvs rdiff -u -r1.189 -r1.190 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/x86/include/intrdefs.h
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/x86/x86/lapic.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/x86_softintr.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/xen/x86/hypervisor_machdep.c
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/xen/xen/xenevt.c

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



CVS commit: src/sys/arch

2022-09-06 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Sep  7 00:40:19 UTC 2022

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S genassym.cf lock_stubs.S
locore.S spl.S vector.S
src/sys/arch/i386/i386: genassym.cf i386_trap.S lock_stubs.S locore.S
spl.S vector.S
src/sys/arch/x86/include: cpu.h intr.h intrdefs.h
src/sys/arch/x86/x86: intr.c lapic.c x86_softintr.c
src/sys/arch/xen/include: hypervisor.h intr.h
src/sys/arch/xen/x86: hypervisor_machdep.c
src/sys/arch/xen/xen: evtchn.c xenevt.c

Log Message:
NetBSD/x86: Raise the number of interrupt sources per CPU from 32 to 56.

There has been no objection for three years.
https://mail-index.netbsd.org/port-amd64/2019/09/22/msg003012.html
Implemented by nonaka@n.o, updated by me.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amd64/amd64/lock_stubs.S
cvs rdiff -u -r1.213 -r1.214 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.125 -r1.126 src/sys/arch/i386/i386/genassym.cf
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/i386/i386/i386_trap.S
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/i386/i386/lock_stubs.S
cvs rdiff -u -r1.189 -r1.190 src/sys/arch/i386/i386/locore.S
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/i386/i386/vector.S
cvs rdiff -u -r1.132 -r1.133 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/x86/include/intrdefs.h
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/x86/x86/lapic.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/x86_softintr.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/xen/x86/hypervisor_machdep.c
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/xen/xen/xenevt.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.53 src/sys/arch/amd64/amd64/amd64_trap.S:1.54
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.53	Mon Jun 29 23:04:56 2020
+++ src/sys/arch/amd64/amd64/amd64_trap.S	Wed Sep  7 00:40:18 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_trap.S,v 1.53 2020/06/29 23:04:56 riastradh Exp $	*/
+/*	$NetBSD: amd64_trap.S,v 1.54 2022/09/07 00:40:18 knakahara Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -347,7 +347,7 @@ IDTVEC(trap07)
 	ZTRAP_NJ(T_DNA)
 	INTRENTRY
 #ifdef DIAGNOSTIC
-	movl	CPUVAR(ILEVEL),%ebx
+	movzbl	CPUVAR(ILEVEL),%ebx
 #endif
 	movq	%rsp,%rdi
 	call	_C_LABEL(fpudna)
@@ -439,7 +439,7 @@ IDTVEC(trap15)
 	ZTRAP_NJ(T_ASTFLT)
 	INTRENTRY
 #ifdef DIAGNOSTIC
-	movl	CPUVAR(ILEVEL),%ebx
+	movzbl	CPUVAR(ILEVEL),%ebx
 #endif
 	jmp	.Lalltraps_checkusr
 IDTVEC_END(trap15)
@@ -457,7 +457,7 @@ IDTVEC(trap16)
 	HANDLE_DEFERRED_FPU
 #endif /* XENPV */
 #ifdef DIAGNOSTIC
-	movl	CPUVAR(ILEVEL),%ebx
+	movzbl	CPUVAR(ILEVEL),%ebx
 #endif
 	movq	%rsp,%rdi
 	call	_C_LABEL(fputrap)
@@ -508,7 +508,7 @@ IDTVEC(intrspurious)
 	ZTRAP_NJ(T_ASTFLT)
 	INTRENTRY
 #ifdef DIAGNOSTIC
-	movl	CPUVAR(ILEVEL),%ebx
+	movzbl	CPUVAR(ILEVEL),%ebx
 #endif
 	jmp	.Lalltraps_checkusr
 IDTVEC_END(intrspurious)
@@ -658,7 +658,7 @@ ENTRY(alltraps)
 
 calltrap:
 #ifdef DIAGNOSTIC
-	movl	CPUVAR(ILEVEL),%ebx
+	movzbl	CPUVAR(ILEVEL),%ebx
 #endif
 	movq	%rsp,%rdi
 	incq	CPUVAR(NTRAP)
@@ -688,7 +688,7 @@ calltrap:
 
 6:
 #ifdef DIAGNOSTIC
-	cmpl	CPUVAR(ILEVEL),%ebx
+	cmpb	CPUVAR(ILEVEL),%bl
 	jne	.Lspl_error
 #endif
 	INTRFASTEXIT
@@ -701,7 +701,7 @@ calltrap:
 .Lspl_error:
 	STI(si)
 	movabsq	$4f,%rdi
-	movl	CPUVAR(ILEVEL),%esi
+	movzbl	CPUVAR(ILEVEL),%esi
 	call	_C_LABEL(panic)
 4:	.asciz	"spl not lowered on trap exit, ilevel=%x"
 #endif

Index: src/sys/arch/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.88 src/sys/arch/amd64/amd64/genassym.cf:1.89
--- src/sys/arch/amd64/amd64/genassym.cf:1.88	Sat Aug 20 23:48:50 2022
+++ src/sys/arch/amd64/amd64/genassym.cf	Wed Sep  7 00:40:18 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.88 2022/08/20 23:48:50 riastradh Exp $
+#	$NetBSD: genassym.cf,v 1.89 2022/09/07 00:40:18 knakahara Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -247,9 +247,9 @@ define	CPU_INFO_NINTR		offsetof(struct c
 define	CPU_INFO_CURPRIORITY	offsetof(struct cpu_info, ci_schedstate.spc_curpriority)
 
 define	CPU_INFO_GDT		offsetof(struct cpu_info, ci_gdt)
-define	CPU_INFO_ILEVEL		offsetof(struct 

CVS commit: src/sys/dev/ic

2022-09-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep  7 00:34:20 UTC 2022

Modified Files:
src/sys/dev/ic: tpm.c

Log Message:
tpm(4): add missing newline character in device_printf()

Observed with on a Sun Ultra 24, NetBSD/amd64:

tpm0 at acpi0 (TPM, IFX0102-1): io 0x4e-0x4f,0x4700-0x470b mem 
0xfed4-0xfed44fff
tpm0: device 0x000b15d1 rev 0x10
tpm0: read 8 bytes, expected 10tpm0: deactivating entropy source


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/tpm.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/ic/tpm.c
diff -u src/sys/dev/ic/tpm.c:1.25 src/sys/dev/ic/tpm.c:1.26
--- src/sys/dev/ic/tpm.c:1.25	Sat Jan 29 12:27:30 2022
+++ src/sys/dev/ic/tpm.c	Wed Sep  7 00:34:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tpm.c,v 1.25 2022/01/29 12:27:30 riastradh Exp $	*/
+/*	$NetBSD: tpm.c,v 1.26 2022/09/07 00:34:19 khorben Exp $	*/
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.25 2022/01/29 12:27:30 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tpm.c,v 1.26 2022/09/07 00:34:19 khorben Exp $");
 
 #include 
 #include 
@@ -543,7 +543,7 @@ tpm12_rng(struct tpm_softc *sc, unsigned
 
 	/* Verify the response header looks sensible.  */
 	if (nread != sizeof(response.hdr)) {
-		device_printf(sc->sc_dev, "read %zu bytes, expected %zu",
+		device_printf(sc->sc_dev, "read %zu bytes, expected %zu\n",
 		nread, sizeof(response.hdr));
 		goto out;
 	}



CVS commit: src/sys/dev/ic

2022-09-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep  7 00:34:20 UTC 2022

Modified Files:
src/sys/dev/ic: tpm.c

Log Message:
tpm(4): add missing newline character in device_printf()

Observed with on a Sun Ultra 24, NetBSD/amd64:

tpm0 at acpi0 (TPM, IFX0102-1): io 0x4e-0x4f,0x4700-0x470b mem 
0xfed4-0xfed44fff
tpm0: device 0x000b15d1 rev 0x10
tpm0: read 8 bytes, expected 10tpm0: deactivating entropy source


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/ic/tpm.c

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



CVS commit: src

2022-09-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep  7 00:29:23 UTC 2022

Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386
src/sys/arch/i386/conf: MODULAR
src/sys/dev/pci: emuxki.c
src/sys/modules: Makefile
Added Files:
src/sys/modules/emuxki: Makefile Makefile.inc emuxki.ioconf

Log Message:
emuxki(4): allow building as a module

Tested on NetBSD/amd64 with a Sound Blaster Live! Value (CT4870)

Note that this required setting outputs.master to the maximum value
allowed (255) to get sound out, and then cranking the volume pretty
high.

Additional sound cards sponsored by the NetBSD Foundation; thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.94 -r1.95 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/conf/MODULAR
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/emuxki.c
cvs rdiff -u -r1.269 -r1.270 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/emuxki/Makefile \
src/sys/modules/emuxki/Makefile.inc src/sys/modules/emuxki/emuxki.ioconf

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

Modified files:

Index: src/distrib/sets/lists/modules/md.amd64
diff -u src/distrib/sets/lists/modules/md.amd64:1.96 src/distrib/sets/lists/modules/md.amd64:1.97
--- src/distrib/sets/lists/modules/md.amd64:1.96	Fri Aug  5 08:48:36 2022
+++ src/distrib/sets/lists/modules/md.amd64	Wed Sep  7 00:29:23 2022
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.96 2022/08/05 08:48:36 riastradh Exp $
+# $NetBSD: md.amd64,v 1.97 2022/09/07 00:29:23 khorben Exp $
 #
 ./@MODULEDIR@/acpiacadmodules-base-kernel	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		modules-base-kernel	kmod
@@ -134,6 +134,8 @@
 ./@MODULEDIR@/dtrace_syscall_netbsd32/dtrace_syscall_netbsd32.kmod	modules-base-kernel	kmod,dtrace
 ./@MODULEDIR@/emdtvmodules-base-kernel	kmod
 ./@MODULEDIR@/emdtv/emdtv.kmod			modules-base-kernel	kmod
+./@MODULEDIR@/emuxkimodules-base-kernel	kmod
+./@MODULEDIR@/emuxki/emuxki.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/estmodules-base-kernel	kmod
 ./@MODULEDIR@/est/est.kmod			modules-base-kernel	kmod
 ./@MODULEDIR@/exec_elf32			modules-base-kernel	kmod

Index: src/distrib/sets/lists/modules/md.i386
diff -u src/distrib/sets/lists/modules/md.i386:1.94 src/distrib/sets/lists/modules/md.i386:1.95
--- src/distrib/sets/lists/modules/md.i386:1.94	Fri Aug  5 08:48:36 2022
+++ src/distrib/sets/lists/modules/md.i386	Wed Sep  7 00:29:23 2022
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.94 2022/08/05 08:48:36 riastradh Exp $
+# $NetBSD: md.i386,v 1.95 2022/09/07 00:29:23 khorben Exp $
 #
 ./@MODULEDIR@/acpiacadmodules-base-kernel	kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod		modules-base-kernel	kmod
@@ -86,6 +86,8 @@
 ./@MODULEDIR@/dtrace_syscall_linux/dtrace_syscall_linux.kmod	modules-base-kernel	kmod,dtrace
 ./@MODULEDIR@/emdtvmodules-base-kernel	kmod
 ./@MODULEDIR@/emdtv/emdtv.kmod			modules-base-kernel	kmod
+./@MODULEDIR@/emuxkimodules-base-kernel	kmod
+./@MODULEDIR@/emuxki/emuxki.kmod		modules-base-kernel	kmod
 ./@MODULEDIR@/estmodules-base-kernel	kmod
 ./@MODULEDIR@/est/est.kmod			modules-base-kernel	kmod
 ./@MODULEDIR@/exec_aoutmodules-base-kernel	kmod

Index: src/sys/arch/i386/conf/MODULAR
diff -u src/sys/arch/i386/conf/MODULAR:1.9 src/sys/arch/i386/conf/MODULAR:1.10
--- src/sys/arch/i386/conf/MODULAR:1.9	Tue Aug 17 22:00:29 2021
+++ src/sys/arch/i386/conf/MODULAR	Wed Sep  7 00:29:23 2022
@@ -1,4 +1,4 @@
-# $NetBSD: MODULAR,v 1.9 2021/08/17 22:00:29 andvar Exp $
+# $NetBSD: MODULAR,v 1.10 2022/09/07 00:29:23 khorben Exp $
 #
 # MODULAR kernel
 # This kernel config prefers loading kernel drivers from file system.
@@ -54,6 +54,7 @@ no pseudo-device	vcoda		   # coda mi
 no uvideo*
 no pseye*
 
+no emuxki*
 no hdaudio*
 no hdafg*
 

Index: src/sys/dev/pci/emuxki.c
diff -u src/sys/dev/pci/emuxki.c:1.72 src/sys/dev/pci/emuxki.c:1.73
--- src/sys/dev/pci/emuxki.c:1.72	Mon Aug 29 09:04:27 2022
+++ src/sys/dev/pci/emuxki.c	Wed Sep  7 00:29:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: emuxki.c,v 1.72 2022/08/29 09:04:27 khorben Exp $	*/
+/*	$NetBSD: emuxki.c,v 1.73 2022/09/07 00:29:23 khorben Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -38,10 +38,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.72 2022/08/29 09:04:27 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.73 2022/09/07 00:29:23 khorben Exp $");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -164,10 +165,10 @@ struct emuxki_softc {
 	void			(*pintr)(void *);
 	void			*pintrarg;
 	audio_params_t		play;
-	int			pframesize;
-	int			pblksize;
-	int			plength;
-	int			poffset;
+	uint32_t		pframesize;
+	uint32_t		pblksize;
+	uint32_t		plength;
+	uint32_t		poffset;
 
 	struct dmamem		*rmem;		/* rec internal memory */
 	void			(*rintr)(void *);
@@ 

CVS commit: src

2022-09-06 Thread Pierre Pronchery
Module Name:src
Committed By:   khorben
Date:   Wed Sep  7 00:29:23 UTC 2022

Modified Files:
src/distrib/sets/lists/modules: md.amd64 md.i386
src/sys/arch/i386/conf: MODULAR
src/sys/dev/pci: emuxki.c
src/sys/modules: Makefile
Added Files:
src/sys/modules/emuxki: Makefile Makefile.inc emuxki.ioconf

Log Message:
emuxki(4): allow building as a module

Tested on NetBSD/amd64 with a Sound Blaster Live! Value (CT4870)

Note that this required setting outputs.master to the maximum value
allowed (255) to get sound out, and then cranking the volume pretty
high.

Additional sound cards sponsored by the NetBSD Foundation; thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/distrib/sets/lists/modules/md.amd64
cvs rdiff -u -r1.94 -r1.95 src/distrib/sets/lists/modules/md.i386
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/i386/conf/MODULAR
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/emuxki.c
cvs rdiff -u -r1.269 -r1.270 src/sys/modules/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/modules/emuxki/Makefile \
src/sys/modules/emuxki/Makefile.inc src/sys/modules/emuxki/emuxki.ioconf

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:14:28 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_sqrt.c

Log Message:
Style sync with other parts of this file, as well as FreeBSD:
https://cgit.freebsd.org/src/commit/sys/powerpc/fpu/fpu_sqrt.c?id=81dd9c5e69a2709ae3317dd383093e1c8a970d9e

NFC since q is initialized to zero just above.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/fpu/fpu_sqrt.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/powerpc/fpu/fpu_sqrt.c
diff -u src/sys/arch/powerpc/fpu/fpu_sqrt.c:1.13 src/sys/arch/powerpc/fpu/fpu_sqrt.c:1.14
--- src/sys/arch/powerpc/fpu/fpu_sqrt.c:1.13	Tue Sep  6 23:12:42 2022
+++ src/sys/arch/powerpc/fpu/fpu_sqrt.c	Tue Sep  6 23:14:28 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_sqrt.c,v 1.13 2022/09/06 23:12:42 rin Exp $ */
+/*	$NetBSD: fpu_sqrt.c,v 1.14 2022/09/06 23:14:28 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_sqrt.c,v 1.13 2022/09/06 23:12:42 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_sqrt.c,v 1.14 2022/09/06 23:14:28 rin Exp $");
 
 #include 
 #if defined(DIAGNOSTIC)||defined(DEBUG)
@@ -352,7 +352,7 @@ fpu_sqrt(struct fpemu *fe)
 	FPU_SUBC(d0, x0, t0);
 	if ((int)d0 >= 0) {
 		x0 = d0, x1 = d1, x2 = d2;
-		q |= bit;
+		q = bit;
 		y1 |= 1;		/* now t1, y1 are set in concrete */
 	}
 	ODD_DOUBLE;
@@ -386,7 +386,7 @@ fpu_sqrt(struct fpemu *fe)
 	FPU_SUBC(d0, x0, t0);
 	if ((int)d0 >= 0) {
 		x0 = d0, x1 = d1, x2 = d2; x3 = d3;
-		q |= bit;
+		q = bit;
 		y2 |= 1;
 	}
 	ODD_DOUBLE;



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:14:28 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_sqrt.c

Log Message:
Style sync with other parts of this file, as well as FreeBSD:
https://cgit.freebsd.org/src/commit/sys/powerpc/fpu/fpu_sqrt.c?id=81dd9c5e69a2709ae3317dd383093e1c8a970d9e

NFC since q is initialized to zero just above.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/fpu/fpu_sqrt.c

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:12:42 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_sqrt.c

Log Message:
Fix errors in calculation of intermediate mantissa bits > 95.

NFC since this does not affect the final results; we do not
support any extended-precision formats at the moment (never?).

Taken from FreeBSD:
https://cgit.freebsd.org/src/commit/sys/powerpc/fpu/fpu_sqrt.c?id=81dd9c5e69a2709ae3317dd383093e1c8a970d9e
except for stylistic changes that will be committed soon.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/fpu/fpu_sqrt.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/powerpc/fpu/fpu_sqrt.c
diff -u src/sys/arch/powerpc/fpu/fpu_sqrt.c:1.12 src/sys/arch/powerpc/fpu/fpu_sqrt.c:1.13
--- src/sys/arch/powerpc/fpu/fpu_sqrt.c:1.12	Tue Sep  6 23:00:43 2022
+++ src/sys/arch/powerpc/fpu/fpu_sqrt.c	Tue Sep  6 23:12:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_sqrt.c,v 1.12 2022/09/06 23:00:43 rin Exp $ */
+/*	$NetBSD: fpu_sqrt.c,v 1.13 2022/09/06 23:12:42 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_sqrt.c,v 1.12 2022/09/06 23:00:43 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_sqrt.c,v 1.13 2022/09/06 23:12:42 rin Exp $");
 
 #include 
 #if defined(DIAGNOSTIC)||defined(DEBUG)
@@ -380,16 +380,16 @@ fpu_sqrt(struct fpemu *fe)
 	bit = 1 << 31;
 	EVEN_DOUBLE;
 	t3 = bit;
-	FPU_SUBS(d3, x3, t3); __USE(d3);
+	FPU_SUBS(d3, x3, t3);
 	FPU_SUBCS(d2, x2, t2);
 	FPU_SUBCS(d1, x1, t1);
 	FPU_SUBC(d0, x0, t0);
-	ODD_DOUBLE;
 	if ((int)d0 >= 0) {
-		x0 = d0, x1 = d1, x2 = d2;
+		x0 = d0, x1 = d1, x2 = d2; x3 = d3;
 		q |= bit;
 		y2 |= 1;
 	}
+	ODD_DOUBLE;
 	while ((bit >>= 1) != 0) {
 		EVEN_DOUBLE;
 		t3 = y3 | bit;
@@ -398,7 +398,7 @@ fpu_sqrt(struct fpemu *fe)
 		FPU_SUBCS(d1, x1, t1);
 		FPU_SUBC(d0, x0, t0);
 		if ((int)d0 >= 0) {
-			x0 = d0, x1 = d1, x2 = d2;
+			x0 = d0, x1 = d1, x2 = d2; x3 = d3;
 			q |= bit;
 			y3 |= bit << 1;
 		}



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:12:42 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_sqrt.c

Log Message:
Fix errors in calculation of intermediate mantissa bits > 95.

NFC since this does not affect the final results; we do not
support any extended-precision formats at the moment (never?).

Taken from FreeBSD:
https://cgit.freebsd.org/src/commit/sys/powerpc/fpu/fpu_sqrt.c?id=81dd9c5e69a2709ae3317dd383093e1c8a970d9e
except for stylistic changes that will be committed soon.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/powerpc/fpu/fpu_sqrt.c

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:07:53 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.h

Log Message:
fpu_sub(): Do not invert sign bit of NaN.

Taken from FreeBSD:
https://cgit.freebsd.org/src/commit/lib/libc/sparc64/fpu?h=releng/12.3=8ff9d52cd08cbf31efde4052d3593a5680eaa2a5


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/fpu/fpu_emu.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/powerpc/fpu/fpu_emu.h
diff -u src/sys/arch/powerpc/fpu/fpu_emu.h:1.10 src/sys/arch/powerpc/fpu/fpu_emu.h:1.11
--- src/sys/arch/powerpc/fpu/fpu_emu.h:1.10	Mon Sep  5 00:27:16 2022
+++ src/sys/arch/powerpc/fpu/fpu_emu.h	Tue Sep  6 23:07:53 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_emu.h,v 1.10 2022/09/05 00:27:16 rin Exp $ */
+/*	$NetBSD: fpu_emu.h,v 1.11 2022/09/06 23:07:53 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -163,7 +163,8 @@ struct fpemu {
  * Each returns a pointer to the result and/or sets exceptions.
  */
 struct	fpn *fpu_add(struct fpemu *);
-#define	fpu_sub(fe) ((fe)->fe_f2.fp_sign ^= 1, fpu_add(fe))
+#define	fpu_sub(fe)			\
+((ISNAN(&(fe)->fe_f2) ? 0 : ((fe)->fe_f2.fp_sign ^= 1)), fpu_add(fe))
 struct	fpn *fpu_mul(struct fpemu *);
 struct	fpn *fpu_div(struct fpemu *);
 struct	fpn *fpu_sqrt(struct fpemu *);



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:07:53 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_emu.h

Log Message:
fpu_sub(): Do not invert sign bit of NaN.

Taken from FreeBSD:
https://cgit.freebsd.org/src/commit/lib/libc/sparc64/fpu?h=releng/12.3=8ff9d52cd08cbf31efde4052d3593a5680eaa2a5


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/fpu/fpu_emu.h

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:05:52 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_mul.c

Log Message:
fpu_mul(): Do not multiply sign bits for NaN.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/fpu/fpu_mul.c

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:05:52 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_mul.c

Log Message:
fpu_mul(): Do not multiply sign bits for NaN.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/fpu/fpu_mul.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/powerpc/fpu/fpu_mul.c
diff -u src/sys/arch/powerpc/fpu/fpu_mul.c:1.7 src/sys/arch/powerpc/fpu/fpu_mul.c:1.8
--- src/sys/arch/powerpc/fpu/fpu_mul.c:1.7	Tue Sep  6 23:04:08 2022
+++ src/sys/arch/powerpc/fpu/fpu_mul.c	Tue Sep  6 23:05:52 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_mul.c,v 1.7 2022/09/06 23:04:08 rin Exp $ */
+/*	$NetBSD: fpu_mul.c,v 1.8 2022/09/06 23:05:52 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.7 2022/09/06 23:04:08 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.8 2022/09/06 23:05:52 rin Exp $");
 
 #include 
 #if defined(DIAGNOSTIC)||defined(DEBUG)
@@ -135,8 +135,7 @@ fpu_mul(struct fpemu *fe)
 		if (ISSNAN(x) || ISSNAN(y))
 			fe->fe_cx |= FPSCR_VXSNAN;
 		if (ISNAN(x))
-			SWAP(x, y);
-		y->fp_sign ^= x->fp_sign;
+			y = x;
 		DUMPFPN(FPE_REG, y);
 		return (y);
 	}



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:04:08 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_add.c fpu_div.c fpu_mul.c

Log Message:
Fix priority for NaN propagation: frA > frB > frC.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/fpu/fpu_add.c \
src/sys/arch/powerpc/fpu/fpu_mul.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/fpu/fpu_div.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/powerpc/fpu/fpu_add.c
diff -u src/sys/arch/powerpc/fpu/fpu_add.c:1.6 src/sys/arch/powerpc/fpu/fpu_add.c:1.7
--- src/sys/arch/powerpc/fpu/fpu_add.c:1.6	Thu Sep  1 06:10:58 2022
+++ src/sys/arch/powerpc/fpu/fpu_add.c	Tue Sep  6 23:04:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_add.c,v 1.6 2022/09/01 06:10:58 rin Exp $ */
+/*	$NetBSD: fpu_add.c,v 1.7 2022/09/06 23:04:08 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -47,7 +47,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_add.c,v 1.6 2022/09/01 06:10:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_add.c,v 1.7 2022/09/06 23:04:08 rin Exp $");
 
 #include 
 #if defined(DIAGNOSTIC)||defined(DEBUG)
@@ -93,13 +93,15 @@ fpu_add(struct fpemu *fe)
 	DUMPFPN(FPE_REG, x);
 	DUMPFPN(FPE_REG, y);
 	DPRINTF(FPE_REG, ("=>\n"));
-	ORDER(x, y);
-	if (ISNAN(y)) {
-		if (ISSNAN(y))
+	if (ISNAN(x) || ISNAN(y)) {
+		if (ISSNAN(x) || ISSNAN(y))
 			fe->fe_cx |= FPSCR_VXSNAN;
+		if (ISNAN(x))
+			y = x;
 		DUMPFPN(FPE_REG, y);
 		return (y);
 	}
+	ORDER(x, y);
 	if (ISINF(y)) {
 		if (ISINF(x) && x->fp_sign != y->fp_sign) {
 			fe->fe_cx |= FPSCR_VXISI;
Index: src/sys/arch/powerpc/fpu/fpu_mul.c
diff -u src/sys/arch/powerpc/fpu/fpu_mul.c:1.6 src/sys/arch/powerpc/fpu/fpu_mul.c:1.7
--- src/sys/arch/powerpc/fpu/fpu_mul.c:1.6	Thu Sep  1 06:10:58 2022
+++ src/sys/arch/powerpc/fpu/fpu_mul.c	Tue Sep  6 23:04:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_mul.c,v 1.6 2022/09/01 06:10:58 rin Exp $ */
+/*	$NetBSD: fpu_mul.c,v 1.7 2022/09/06 23:04:08 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.6 2022/09/01 06:10:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_mul.c,v 1.7 2022/09/06 23:04:08 rin Exp $");
 
 #include 
 #if defined(DIAGNOSTIC)||defined(DEBUG)
@@ -131,14 +131,16 @@ fpu_mul(struct fpemu *fe)
 	DUMPFPN(FPE_REG, y);
 	DPRINTF(FPE_REG, ("=>\n"));
 
-	ORDER(x, y);
-	if (ISNAN(y)) {
-		y->fp_sign ^= x->fp_sign;
-		if (ISSNAN(y))
+	if (ISNAN(x) || ISNAN(y)) {
+		if (ISSNAN(x) || ISSNAN(y))
 			fe->fe_cx |= FPSCR_VXSNAN;
+		if (ISNAN(x))
+			SWAP(x, y);
+		y->fp_sign ^= x->fp_sign;
 		DUMPFPN(FPE_REG, y);
 		return (y);
 	}
+	ORDER(x, y);
 	if (ISINF(y)) {
 		if (ISZERO(x)) {
 			fe->fe_cx |= FPSCR_VXIMZ;

Index: src/sys/arch/powerpc/fpu/fpu_div.c
diff -u src/sys/arch/powerpc/fpu/fpu_div.c:1.8 src/sys/arch/powerpc/fpu/fpu_div.c:1.9
--- src/sys/arch/powerpc/fpu/fpu_div.c:1.8	Sun Sep  4 13:32:14 2022
+++ src/sys/arch/powerpc/fpu/fpu_div.c	Tue Sep  6 23:04:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_div.c,v 1.8 2022/09/04 13:32:14 rin Exp $ */
+/*	$NetBSD: fpu_div.c,v 1.9 2022/09/06 23:04:08 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.8 2022/09/04 13:32:14 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_div.c,v 1.9 2022/09/06 23:04:08 rin Exp $");
 
 #include 
 #if defined(DIAGNOSTIC)||defined(DEBUG)
@@ -182,9 +182,10 @@ fpu_div(struct fpemu *fe)
 	DUMPFPN(FPE_REG, y);
 	DPRINTF(FPE_REG, ("=>\n"));
 	if (ISNAN(x) || ISNAN(y)) {
-		ORDER(x, y);
 		if (ISSNAN(x) || ISSNAN(y))
 			fe->fe_cx |= FPSCR_VXSNAN;
+		if (ISNAN(x))
+			y = x;
 		DUMPFPN(FPE_REG, y);
 		return (y);
 	}



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:04:08 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_add.c fpu_div.c fpu_mul.c

Log Message:
Fix priority for NaN propagation: frA > frB > frC.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/powerpc/fpu/fpu_add.c \
src/sys/arch/powerpc/fpu/fpu_mul.c
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/fpu/fpu_div.c

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:02:36 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_subr.c

Log Message:
FPU generates QNaN with all payload bits being cleared.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/fpu/fpu_subr.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/powerpc/fpu/fpu_subr.c
diff -u src/sys/arch/powerpc/fpu/fpu_subr.c:1.8 src/sys/arch/powerpc/fpu/fpu_subr.c:1.9
--- src/sys/arch/powerpc/fpu/fpu_subr.c:1.8	Sun Sep  4 22:34:58 2022
+++ src/sys/arch/powerpc/fpu/fpu_subr.c	Tue Sep  6 23:02:36 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_subr.c,v 1.8 2022/09/04 22:34:58 rin Exp $ */
+/*	$NetBSD: fpu_subr.c,v 1.9 2022/09/06 23:02:36 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_subr.c,v 1.8 2022/09/04 22:34:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_subr.c,v 1.9 2022/09/06 23:02:36 rin Exp $");
 
 #include 
 #include 
@@ -209,8 +209,8 @@ fpu_newnan(struct fpemu *fe)
 	fp = >fe_f3;
 	fp->fp_class = FPC_QNAN;
 	fp->fp_sign = 0;
-	fp->fp_mant[0] = FP_1 - 1;
-	fp->fp_mant[1] = fp->fp_mant[2] = fp->fp_mant[3] = ~0;
+	fp->fp_mant[0] = FP_QUIETBIT;
+	fp->fp_mant[1] = fp->fp_mant[2] = fp->fp_mant[3] = 0;
 	DUMPFPN(FPE_REG, fp);
 	return (fp);
 }



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:02:36 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_subr.c

Log Message:
FPU generates QNaN with all payload bits being cleared.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/fpu/fpu_subr.c

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:00:43 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_sqrt.c

Log Message:
IEEE 754 and Power ISA require sqrt(+0) = +0 and sqrt(-0) = -0, not Inf.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/fpu/fpu_sqrt.c

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



CVS commit: src/sys/arch/powerpc/fpu

2022-09-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Tue Sep  6 23:00:43 UTC 2022

Modified Files:
src/sys/arch/powerpc/fpu: fpu_sqrt.c

Log Message:
IEEE 754 and Power ISA require sqrt(+0) = +0 and sqrt(-0) = -0, not Inf.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/powerpc/fpu/fpu_sqrt.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/powerpc/fpu/fpu_sqrt.c
diff -u src/sys/arch/powerpc/fpu/fpu_sqrt.c:1.11 src/sys/arch/powerpc/fpu/fpu_sqrt.c:1.12
--- src/sys/arch/powerpc/fpu/fpu_sqrt.c:1.11	Thu Sep  1 06:10:58 2022
+++ src/sys/arch/powerpc/fpu/fpu_sqrt.c	Tue Sep  6 23:00:43 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: fpu_sqrt.c,v 1.11 2022/09/01 06:10:58 rin Exp $ */
+/*	$NetBSD: fpu_sqrt.c,v 1.12 2022/09/06 23:00:43 rin Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fpu_sqrt.c,v 1.11 2022/09/01 06:10:58 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fpu_sqrt.c,v 1.12 2022/09/06 23:00:43 rin Exp $");
 
 #include 
 #if defined(DIAGNOSTIC)||defined(DEBUG)
@@ -221,8 +221,6 @@ fpu_sqrt(struct fpemu *fe)
 		return (x);
 	}
 	if (ISZERO(x)) {
-		fe->fe_cx |= FPSCR_ZX;
-		x->fp_class = FPC_INF;
 		DUMPFPN(FPE_REG, x);
 		return (x);
 	}



CVS commit: src/lib/libc/stdlib

2022-09-06 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Sep  6 22:54:41 UTC 2022

Modified Files:
src/lib/libc/stdlib: posix_openpt.3

Log Message:
posix_openpt.3: add caveats about oflags

The NetBSD implementation differs from other BSDs in that it does not
return EINVAL if invalid oflags are submitted, since it completely
ignores them. This is surprising to upstream projects that may expect
otherwise.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/stdlib/posix_openpt.3

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

Modified files:

Index: src/lib/libc/stdlib/posix_openpt.3
diff -u src/lib/libc/stdlib/posix_openpt.3:1.6 src/lib/libc/stdlib/posix_openpt.3:1.7
--- src/lib/libc/stdlib/posix_openpt.3:1.6	Thu May  5 07:36:44 2011
+++ src/lib/libc/stdlib/posix_openpt.3	Tue Sep  6 22:54:41 2022
@@ -1,4 +1,4 @@
-.\" $NetBSD: posix_openpt.3,v 1.6 2011/05/05 07:36:44 wiz Exp $
+.\" $NetBSD: posix_openpt.3,v 1.7 2022/09/06 22:54:41 gutteridge Exp $
 .\"
 .\" Copyright (c) 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd May 25, 2004
+.Dd September 6, 2022
 .Dt POSIX_OPENPT 3
 .Os
 .Sh NAME
@@ -51,6 +51,9 @@ The
 argument has the same meaning as in the
 .Xr open 2
 call.
+However, the value of
+.Fa oflag
+is ignored; it exists for compatibility reasons only.
 .Sh RETURN VALUES
 If successful,
 .Fn posix_openpt
@@ -59,6 +62,19 @@ pointing to the master pseudo-terminal d
 Otherwise, a value of \-1 is returned and
 .Va errno
 is set to indicate the error.
+.Pp
+Note that unlike implementations on some other operating systems,
+.Fn posix_openpt
+does not return
+.Er EINVAL
+if the value of
+.Fa oflag
+would be deemed invalid, instead it is simply ignored.
+This means it is not possible to dynamically test which
+.Xr open 2
+flags are possible to set, and apply a fallback if
+.Er EINVAL
+is received.
 .Sh SEE ALSO
 .Xr ioctl 2 ,
 .Xr open 2 ,



CVS commit: src/lib/libc/stdlib

2022-09-06 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Sep  6 22:54:41 UTC 2022

Modified Files:
src/lib/libc/stdlib: posix_openpt.3

Log Message:
posix_openpt.3: add caveats about oflags

The NetBSD implementation differs from other BSDs in that it does not
return EINVAL if invalid oflags are submitted, since it completely
ignores them. This is surprising to upstream projects that may expect
otherwise.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/lib/libc/stdlib/posix_openpt.3

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



CVS commit: src

2022-09-06 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Sep  6 17:50:18 UTC 2022

Modified Files:
src/distrib/amiga/stand: loadbsd.uue
src/sys/arch/amiga/stand/loadbsd: Makefile README loadbsd.c

Log Message:
Update loadbsd source and distribution binary to version 3.2.
Including the following changes by Gunther Nikl:
- Added detection of A600.
- Fix handling of multiple -n options.
Make it compile with recent AmigaOS gcc ports (for example gcc6), as
older ports no longer work with current NetBSD header files.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/amiga/stand/loadbsd.uue
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amiga/stand/loadbsd/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amiga/stand/loadbsd/README
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amiga/stand/loadbsd/loadbsd.c

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

Modified files:

Index: src/distrib/amiga/stand/loadbsd.uue
diff -u src/distrib/amiga/stand/loadbsd.uue:1.2 src/distrib/amiga/stand/loadbsd.uue:1.3
--- src/distrib/amiga/stand/loadbsd.uue:1.2	Wed Nov 11 16:13:55 2015
+++ src/distrib/amiga/stand/loadbsd.uue	Tue Sep  6 17:50:18 2022
@@ -1,484 +1,611 @@
 begin 755 loadbsd
-M```#\P`"``$``!"D```!70```^D``!"D,CP!0$GY``!_
-M_F<*0^R$-D*964%F^BE(A&8I0(1N*4^%2BQX``0I3H1JD\E.KO[:)D!*JP"L
-M9A1!ZP!<3J[^@$'K`%Q.KOZ,*4"$8D7L@]8D<<)EHB:P`$("R#TDZN_=@F
-M@&8&2'@`%&$B4X)FY$7L@^982G3_850O+(5"+RR$2B\LA%IA``3Z+T``!$7L
-MA`982G0`838L;(1J1>R#UB0:9Q`B6B`19P8B0$ZN_F)3@F;P)"R$8F<*3J[_
-M?")"3J[^AB`O``0N;(5*3G4F2DOLA#8@0!E>'!A;G-I;VXN;
-M0!C86XG="!O<&5N(&5X<&%N"!A='1R:6)U=&4])3`T;'@@<')I
-M/25D"@!K97)N96P@"P@)6QD32!#2$E0345-
-M"@!N97=E6]U('-H;W5L9`HJ*BH@=7!D871E('1O(&$@;F5W97(@=F5R`H`2V5R;F5L(&%T("4P.+"!&87-T;65M('5S
-M960@870@)3`X;'@*`$-A;B=T(&-O<'D@=7!W87)D6]U2!A9V%I;B!/4B!T2!T:&4@+5H@;W!T:6]N"!T
-M;R!&87-T;65M("4P.("HJ*@H`2V5R;F5L('-I>F4@)6QD(&5X8V5E9',@
-M0VAI<"!-96UO`)8CW`!L(-M!&$`#+9%[(`*+$:D/Z^Y1"@$ZN
-M_=@D@&8,2'K[ETAX`!1A`!-.1>R`!BQLA#^ON?0H!.KOW8)(!F``%\2'K[
-MH4AX`!1A`!,JR%1B\LA6YA`"Y4<@KCJ&!0<`*(@&```*@(Q``08```H`C$`!%@``"8
-M2'KZ)$AZ^NT@;(!&+R@`"&$`(F)/[P`,8'QR`2E!A59@='!`B(!@;D7LA6(O
-M+(5N80`N`DA`0D`D@%B/8%AR`8.LA6I@4"\LA6YA`"WH)`!8CW`#L()E"B`"
-MT("!K(5J8#1(>OJ32'@`%&$`$>1(>``00JR`$I:0
-M(!!'\PP`<`@V<$80`*U"X380`'S$AM_^A(;?_D2_X&$`!'9A``D880`)
-M2D*&0H5/[P`,+`!B!&OEI2'@`%&$`$!P@+?_\5H!R_,*`*T'__$JLA3YG
-M$`:M`$```/_@!JW_P```_^1![(5&2I!G#")0L^W_Y&($*TG_Y`@$``!G"DAZ
-M^4IA`"6&6(\@+?_HOD580`E1B!M__`T*/_^3^\`%`Q"3G-F`D)"
-M#$(`"6,0/P)"9TAZ^1M(>``480`/;`Q"``-C'$AZ^25A`"4.6(]*K(5>9@PL
-M;(.V9@HL;(.VOF[80`D=%"/("H`(`:``P```"5``"!*K(5>9PPO`$AZ^;UA`"144(]%
-MZ@!$8)0I2H520>R$=B(())"7R[?09")#\[H`(`GEB"1!0_((!"!LA5+1P%B(
-M(-D@V2"14HNWTF7>#$(``F,``(9*K(5F9GY![(4Z)%"U[?_@9!HO+?_@+PI(
-M>OEC80`C\$AZ^8-(>``480`.-$?LA3H@;?_4T=,K2/_OF?80`CHD_O``Q*
-MK(5>9D0L;(.VOG"
-M2'@`%&$`#;AP`2E`A68O+(4Z2'KYT&$`(U90CTJLA5YG!D*G80#T\BQL@`J3
-MR4ZN_R)*K(5F5\!)P$2`+P`O+(1R+RR%:B\LA%(O+(5B+P,O!"\M_^@O+?_D
-M+RW_X"(M__"2K?_L+P$O+?_4+RR%.B!M_]Q.D$*`3^\`-$SM3/S_L$Y=3G54
-M"!T;R`E,#AX('-Z("4P.'@*`'IK:6-K
-M(6]R>0!/[__L2.<_-I?+'WP`@``S(&\`1""+(F\`2"*+1>R$:BQ23J[_
-M?"!2)&@!0BI22HUG``)N0>R$=EB(+T@`*B@J`!0J*@`8FH0O10`T+$:B!$
-M0^\`-$*`3J[]!B0`FJ\`--BO`#1*KP`T9P`"*D'LA'9!Z``,+T@`+D'LA'9^
-M#MZ(+`A0ADJLA5YG(B\O`#0O`B`%T*\`/"\`(@22KP!`+P%(>O\F80`B"D_O
-M`!0F`M:O`#0,+`!]A6)F``"4("\`-%.``(``#___4H`O0``T)`.4@`R"0```
-M`&6((&\`+C``X(`!(J``E(@2!',8$(`")&([P`
-M(```"``@;P`J(8((`%*+!H(`(```!J__X#1![(1V0_.Z`"`)(@#EB2)O
-M`"XSJ@`.&``0*@`)2(`B1S.`&`!#Z``((Z\`-!@`6(@A@A@`,"H`#@)```8,
-M0``"9C!"L!@`("\`-`:```?__P*`__@``"]``#0C@!@`(F\`-"!O`$BST&,`
-M`+0@B6```*X"0N``!H,``!__`D/@``R#!_@``&8&)CP(#((`*```9B`@
-M:@`*0_K^!T*!0H`0&!(9D(%F#$H!9O)*@&8$="!(0B`"`H#_\```#(`1
-M9@(D`):"+T,`-$'SN@`@".6((F\`*B.""``@1B`#0(``RO`!___P`T8RY!
-M[(5.2I!G#&``480`)ED'LA6(@$$)`2H!G>"`0
-M#!``?6<``1Y"0$A`#(2P9P`!$&(D#()89P`!!&(,#('T9P``
-M^&`N#(/H9P``[&`B#(NX9P``X&(,#(?09P``U&`*#(^@
-M9P``R$*`,"R%8B\`2'K^Y&$`'LI(>``!80#P;$7LA/Z_O-.KO^@2H!F
-M'"Q20_K^\4ZN_Z!*@&8.+%)#^O[O3J[_H$J`9PH`K`^@``"%8F!H1>R$:BQ2
-M0_K^WTZN_Z!*@&8.+%)#^O[=3J[_H$J`9PH`K`NX``"%8F`^+$:D/Z_L].
-MKOX.2H!G"@"L!+```(5B8"0L;(1J0_K^PTZN_@Y*@&<4(#P``'T`@#D"```)
-M2$!"0()![(5B2E!F!@"0!]```"1?+%].=2!LA,:``D`!1C""EH`CB$
-M4DYU0^R$4B!L@`H@/``*[(4(*``"`,]G!B`\``K3`R*`3G5.<4YU3G$F3RQX
-M``1+^@`&3N[_XD;\)P!/^O_L(FL`!"0K``@L:P`,(`$"`K`!0B*P`8+BL`
-M'"AK`"`J*P`D*"L`*"8K`"PD:P`P+"L`-)O-#"L`?0`D9U0S_`(``-_PE@@%
-M``-G()?+3GNP`TY[N`9.>[@'3GNP!$Y[L`5.>[`&3GNP!V`F1_H`C/`30`!'
-M^@"`\!-,`/`32``(!0`"9PQ'^@!R\!,(`/`3#`!*AF<$*DC=R"K968)D^D/Z
-M`!PO#71`*ME9@F3Z"`4``V<"]/AT`$Y[(`).=20%X9H,`@!]9AZ7RTY[L`-.
-M>[@&3GNX!TY[L`1.>[`%3GNP!DY[L`=T`'P`(D8F1BI&+DXL1D[7?_\``0``
-M``!U2!M;V1E+"!I9B!A
-M=F%I;&%B;&4N"@DM8B`@07-K(&9O7!E+B!;92YG
-M(#,P,#`[('5S92`S,C`P,"M.(&9O2P@9F]R(&9I;F1I;F<@;6EN
-M:6UU;2!A;6]U;G0*"2`@("!O9B!M96UO71E2!F87-T97(*"2`@("`H:2YE
-M+B`S,B!B:70@;65M;W)Y*2P@8G5T('-O;64@<&5O<(=F4@2X*"2UQ("!";V]T('5P

CVS commit: src

2022-09-06 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Tue Sep  6 17:50:18 UTC 2022

Modified Files:
src/distrib/amiga/stand: loadbsd.uue
src/sys/arch/amiga/stand/loadbsd: Makefile README loadbsd.c

Log Message:
Update loadbsd source and distribution binary to version 3.2.
Including the following changes by Gunther Nikl:
- Added detection of A600.
- Fix handling of multiple -n options.
Make it compile with recent AmigaOS gcc ports (for example gcc6), as
older ports no longer work with current NetBSD header files.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/amiga/stand/loadbsd.uue
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amiga/stand/loadbsd/Makefile
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/amiga/stand/loadbsd/README
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amiga/stand/loadbsd/loadbsd.c

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



CVS commit: src/sys/kern

2022-09-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Sep  6 13:31:09 UTC 2022

Modified Files:
src/sys/kern: kern_module.c

Log Message:
Resequence the sysctl_setup and evcnt stuff so that they always occur
_before_ the module's MODULE_CMD_INIT call.  Also update the unload
code to invoke the sysctl_setup and evcnt stuff _after_ the module's
MODULE_CMD_FINI call.  This makes the behaviour and order consistent
whether the module is built-in or loaded at run-time.

As reported by riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 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.



CVS commit: src/sys/kern

2022-09-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Sep  6 13:31:09 UTC 2022

Modified Files:
src/sys/kern: kern_module.c

Log Message:
Resequence the sysctl_setup and evcnt stuff so that they always occur
_before_ the module's MODULE_CMD_INIT call.  Also update the unload
code to invoke the sysctl_setup and evcnt stuff _after_ the module's
MODULE_CMD_FINI call.  This makes the behaviour and order consistent
whether the module is built-in or loaded at run-time.

As reported by riastradh@


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 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.158 src/sys/kern/kern_module.c:1.159
--- src/sys/kern/kern_module.c:1.158	Fri Aug 12 15:17:10 2022
+++ src/sys/kern/kern_module.c	Tue Sep  6 13:31:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.158 2022/08/12 15:17:10 riastradh Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.159 2022/09/06 13:31:09 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.158 2022/08/12 15:17:10 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.159 2022/09/06 13:31:09 pgoyette Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -1371,6 +1371,17 @@ module_do_load(const char *name, bool is
 
 	prev_active = module_active;
 	module_active = mod;
+
+	/*
+	 * Note that we handle sysctl and evcnt setup _before_ we
+	 * initialize the module itself.  This maintains a consistent
+	 * order between built-in and run-time-loaded modules.  If
+	 * initialization then fails, we'll need to undo these, too.
+	 */
+	module_load_sysctl(mod);	/* Set-up module's sysctl if any */
+	module_load_evcnt(mod);		/* Attach any static evcnt needed */
+
+
 	error = (*mi->mi_modcmd)(MODULE_CMD_INIT, filedict ? filedict : props);
 	module_active = prev_active;
 	if (filedict) {
@@ -1380,7 +1391,7 @@ module_do_load(const char *name, bool is
 	if (error != 0) {
 		module_error("modcmd(CMD_INIT) failed for `%s', error %d",
 		mi->mi_name, error);
-		goto fail;
+		goto fail3;
 	}
 
 	/*
@@ -1395,9 +1406,6 @@ module_do_load(const char *name, bool is
 		goto fail1;
 	}
 
-	module_load_sysctl(mod);	/* Set-up module's sysctl if any */
-	module_load_evcnt(mod);		/* Attach any static evcnt needed */
-
 	/*
 	 * Good, the module loaded successfully.  Put it onto the
 	 * list and add references to its requisite modules.
@@ -1423,6 +1431,16 @@ module_do_load(const char *name, bool is
 
  fail1:
 	(*mi->mi_modcmd)(MODULE_CMD_FINI, NULL);
+ fail3:
+	/*
+	 * If there were any registered SYSCTL_SETUP funcs, make sure
+	 * we release the sysctl entries
+	 */
+	if (mod->mod_sysctllog) {
+		sysctl_teardown(>mod_sysctllog);
+	}
+	/* Also detach any static evcnt's */
+	module_unload_evcnt(mod);
  fail:
 	kobj_unload(mod->mod_kobj);
  fail2:
@@ -1478,20 +1496,22 @@ module_do_unload(const char *name, bool 
 	module_active = mod;
 	module_callback_unload(mod);
 
+	/* let the module clean up after itself */
+	error = (*mod->mod_info->mi_modcmd)(MODULE_CMD_FINI, NULL);
+
 	/*
 	 * If there were any registered SYSCTL_SETUP funcs, make sure
-	 * we release the sysctl entries
+	 * we release the sysctl entries.  Same for static evcnt.
 	 */
-	if (mod->mod_sysctllog) {
-		sysctl_teardown(>mod_sysctllog);
+	if (error == 0) {
+		if (mod->mod_sysctllog) {
+			sysctl_teardown(>mod_sysctllog);
+		}
+		module_unload_evcnt(mod);
 	}
-	module_unload_evcnt(mod);
-	error = (*mod->mod_info->mi_modcmd)(MODULE_CMD_FINI, NULL);
 	module_active = prev_active;
 	if (error != 0) {
-		module_load_sysctl(mod);	/* re-enable sysctl stuff */
-		module_load_evcnt(mod);		/* and reenable evcnts */
-		module_print("cannot unload module `%s' error=%d", name,
+		module_print("could not unload module `%s' error=%d", name,
 		error);
 		return error;
 	}



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

2022-09-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  6 11:55:52 UTC 2022

Modified Files:
src/sys/arch/arm/acpi: acpi_platform.c

Log Message:
Use the ACPICA define ACPI_DBG2_16550_WITH_GAS


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/acpi/acpi_platform.c

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



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

2022-09-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  6 11:55:52 UTC 2022

Modified Files:
src/sys/arch/arm/acpi: acpi_platform.c

Log Message:
Use the ACPICA define ACPI_DBG2_16550_WITH_GAS


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/arm/acpi/acpi_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/acpi/acpi_platform.c
diff -u src/sys/arch/arm/acpi/acpi_platform.c:1.32 src/sys/arch/arm/acpi/acpi_platform.c:1.33
--- src/sys/arch/arm/acpi/acpi_platform.c:1.32	Sun Oct 24 11:58:23 2021
+++ src/sys/arch/arm/acpi/acpi_platform.c	Tue Sep  6 11:55:51 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.32 2021/10/24 11:58:23 jmcneill Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.33 2022/09/06 11:55:51 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.32 2021/10/24 11:58:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.33 2022/09/06 11:55:51 skrll Exp $");
 
 #include 
 #include 
@@ -83,8 +83,6 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_platfor
 
 #include 
 
-#define	ACPI_DBG2_16550_GAS			0x0012
-
 #define	SPCR_BAUD_DEFAULT			0
 #define	SPCR_BAUD_96003
 #define	SPCR_BAUD_192004
@@ -203,7 +201,7 @@ acpi_platform_attach_uart(ACPI_TABLE_SPC
 #if NCOM > 0
 	case ACPI_DBG2_16550_COMPATIBLE:
 	case ACPI_DBG2_16550_SUBSET:
-	case ACPI_DBG2_16550_GAS:
+	case ACPI_DBG2_16550_WITH_GAS:
 		memset(_bsh, 0, sizeof(dummy_bsh));
 		switch (spcr->SerialPort.BitWidth) {
 		case 8:



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

2022-09-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  6 11:55:07 UTC 2022

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

Log Message:
pcihost: Track MSI/MSI-X interrupt handlers.

Track the MSI/MSI-X interrupt handlers so that fdtbus_intr_disestablish
doesn't get called for them.

This avoids a KASSERT firing when using 'drvctl -d' on a pci device that
uses MSI/MSI-X interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/fdt/pcihost_fdt.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/fdt/pcihost_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/arch/arm/fdt/pcihost_fdt.c
diff -u src/sys/arch/arm/fdt/pcihost_fdt.c:1.30 src/sys/arch/arm/fdt/pcihost_fdt.c:1.31
--- src/sys/arch/arm/fdt/pcihost_fdt.c:1.30	Sun Sep  4 16:01:25 2022
+++ src/sys/arch/arm/fdt/pcihost_fdt.c	Tue Sep  6 11:55:07 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: pcihost_fdt.c,v 1.30 2022/09/04 16:01:25 skrll Exp $ */
+/* $NetBSD: pcihost_fdt.c,v 1.31 2022/09/06 11:55:07 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.30 2022/09/04 16:01:25 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcihost_fdt.c,v 1.31 2022/09/06 11:55:07 skrll Exp $");
 
 #include 
 
@@ -101,6 +101,12 @@ static const struct device_compatible_en
 	DEVICE_COMPAT_EOL
 };
 
+struct pcihost_msi_handler {
+	LIST_ENTRY(pcihost_msi_handler) pmh_next;
+	void *pmh_ih;
+};
+
+
 static int
 pcihost_match(device_t parent, cfdata_t cf, void *aux)
 {
@@ -178,6 +184,8 @@ pcihost_init2(struct pcihost_softc *sc)
 	if (of_getprop_uint32(sc->sc_phandle, "linux,pci-domain", >sc_seg))
 		sc->sc_seg = pcihost_segment++;
 
+	mutex_init(>sc_msi_handlers_mutex, MUTEX_DEFAULT, IPL_NONE);
+
 	if (pcihost_config(sc) != 0)
 		return;
 
@@ -601,18 +609,30 @@ pcihost_intr_setattr(void *v, pci_intr_h
 }
 
 static void *
-pcihost_intr_establish(void *v, pci_intr_handle_t ih, int ipl,
+pcihost_intr_establish(void *v, pci_intr_handle_t pih, int ipl,
 int (*callback)(void *), void *arg, const char *xname)
 {
 	struct pcihost_softc *sc = v;
-	const int flags = (ih & ARM_PCI_INTR_MPSAFE) ? FDT_INTR_MPSAFE : 0;
+	const int flags = (pih & ARM_PCI_INTR_MPSAFE) ? FDT_INTR_MPSAFE : 0;
 	const u_int *specifier;
 	int ihandle;
 
-	if ((ih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0)
-		return arm_pci_msi_intr_establish(>sc_pc, ih, ipl, callback, arg, xname);
+	if ((pih & (ARM_PCI_INTR_MSI | ARM_PCI_INTR_MSIX)) != 0) {
+		void *ih = arm_pci_msi_intr_establish(>sc_pc, pih, ipl,
+		callback, arg, xname);
+
+		if (ih) {
+			struct pcihost_msi_handler * const pmh =
+			kmem_alloc(sizeof(*pmh), KM_SLEEP);
+			pmh->pmh_ih = ih;
+			mutex_enter(>sc_msi_handlers_mutex);
+			LIST_INSERT_HEAD(>sc_msi_handlers, pmh, pmh_next);
+			mutex_exit(>sc_msi_handlers_mutex);
+		}
+		return ih;
+	}
 
-	specifier = pcihost_find_intr(sc, ih & ARM_PCI_INTR_IRQ, );
+	specifier = pcihost_find_intr(sc, pih & ARM_PCI_INTR_IRQ, );
 	if (specifier == NULL)
 		return NULL;
 
@@ -625,6 +645,18 @@ pcihost_intr_disestablish(void *v, void 
 {
 	struct pcihost_softc *sc = v;
 
+	mutex_enter(>sc_msi_handlers_mutex);
+	struct pcihost_msi_handler *pmh;
+	LIST_FOREACH(pmh, >sc_msi_handlers, pmh_next) {
+		if (pmh->pmh_ih == vih) {
+			LIST_REMOVE(pmh, pmh_next);
+			mutex_exit(>sc_msi_handlers_mutex);
+			kmem_free(pmh, sizeof(*pmh));
+			return;
+		}
+	}
+	mutex_exit(>sc_msi_handlers_mutex);
+
 	fdtbus_intr_disestablish(sc->sc_phandle, vih);
 }
 

Index: src/sys/arch/arm/fdt/pcihost_fdtvar.h
diff -u src/sys/arch/arm/fdt/pcihost_fdtvar.h:1.4 src/sys/arch/arm/fdt/pcihost_fdtvar.h:1.5
--- src/sys/arch/arm/fdt/pcihost_fdtvar.h:1.4	Mon Sep  6 14:03:17 2021
+++ src/sys/arch/arm/fdt/pcihost_fdtvar.h	Tue Sep  6 11:55:07 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: pcihost_fdtvar.h,v 1.4 2021/09/06 14:03:17 jmcneill Exp $ */
+/* $NetBSD: pcihost_fdtvar.h,v 1.5 2022/09/06 11:55:07 skrll Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared D. McNeill 
@@ -47,6 +47,8 @@ enum pcihost_type {
 	PCIHOST_ECAM,
 };
 
+struct pcihost_msi_handlers;
+
 struct pcih_bus_space {
 	struct bus_space	bst;
 
@@ -85,6 +87,10 @@ struct pcihost_softc {
 
 	const u_int		*sc_pci_ranges;
 	u_int			sc_pci_ranges_cells;
+
+	kmutex_t 		sc_msi_handlers_mutex;
+	LIST_HEAD(, pcihost_msi_handler)
+sc_msi_handlers;
 };
 
 void	pcihost_init2(struct pcihost_softc *);



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

2022-09-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Sep  6 11:55:07 UTC 2022

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

Log Message:
pcihost: Track MSI/MSI-X interrupt handlers.

Track the MSI/MSI-X interrupt handlers so that fdtbus_intr_disestablish
doesn't get called for them.

This avoids a KASSERT firing when using 'drvctl -d' on a pci device that
uses MSI/MSI-X interrupts.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/arm/fdt/pcihost_fdt.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/fdt/pcihost_fdtvar.h

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