CVS commit: src/bin/sh

2019-04-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Apr 22 04:10:33 UTC 2019

Modified Files:
src/bin/sh: sh.1

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.222 -r1.223 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.222 src/bin/sh/sh.1:1.223
--- src/bin/sh/sh.1:1.222	Mon Apr 22 04:04:35 2019
+++ src/bin/sh/sh.1	Mon Apr 22 04:10:33 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.222 2019/04/22 04:04:35 kre Exp $
+.\"	$NetBSD: sh.1,v 1.223 2019/04/22 04:10:33 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -31,7 +31,7 @@
 .\"
 .\"	@(#)sh.1	8.6 (Berkeley) 5/4/95
 .\"
-.Dd February 14, 2019
+.Dd April 22, 2019
 .Dt SH 1
 .\" everything except c o and s (keep them ordered)
 .ds flags abCEeFfhIiLmnpquVvXx



CVS commit: src/bin/sh

2019-04-21 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Apr 22 04:04:36 UTC 2019

Modified Files:
src/bin/sh: sh.1

Log Message:
PR standards/40554

Update the description of the <& and >& redirection operators
(as indicated would happen in a message appended to the PR a week ago,
which received no opposition - no feedback).

Some rewriting of the section on redirects (including how the word
expansion of the "file" works) to make this simpler & more accurate.


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/bin/sh/sh.1

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

Modified files:

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.221 src/bin/sh/sh.1:1.222
--- src/bin/sh/sh.1:1.221	Mon Apr 15 20:35:25 2019
+++ src/bin/sh/sh.1	Mon Apr 22 04:04:35 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.221 2019/04/15 20:35:25 uwe Exp $
+.\"	$NetBSD: sh.1,v 1.222 2019/04/22 04:04:35 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -907,17 +907,42 @@ The overall format used for redirection 
 where
 .Va redir-op
 is one of the redirection operators mentioned previously.
-The following is a list of the possible redirections.
+A list of the possible redirections, and their meanings, follows.
+.Pp
 The
 .Op Ar n
 is an optional number, as in
 .Sq Li 3
 (not
-.Li [3] ) ,
+.Sq Li [3] ) ,
 that refers to a file descriptor.
-If present it must occur immediately before the redirection
+If present it must occur unquoted, immediately before the redirection
 operator, with no intervening white space, and becomes a
 part of that operator.
+If file descriptor
+.Ar n
+was open prior to the redirection, its previous use is closed.
+.Pp
+All redirections have a single word
+.Ar file
+argument following the operator
+(white space is allowed between the redirection operator and
+.Ar file ) ,
+though it is sometimes expressed as
+.Ar n2 .
+That argument is expanded
+(see
+.Sx "Word Expansions"
+below) using tilde expansion, parameter expansion,
+arithmetic expansion, command substitution and quote removal
+to produce the path name (or file descriptor) to be used.
+No field splitting or pathname expansion takes place.
+In the list below, where the
+.Ar file
+is given as
+.Ar n2
+the result of the expansions must be a number which
+refers to a suitable open file descriptor.
 .Bl -tag -width aaabsfiles -offset indent
 .It Oo Ar n Oc Ns Ic > Ar file
 Redirect standard output (or
@@ -938,22 +963,32 @@ Redirect standard input (or
 .Ar n )
 from
 .Ar file .
-.It Oo Ar n1 Oc Ns Ic <& Ns Ar n2
-Duplicate standard input (or
+.It Oo Ar n1 Oc Ns Ic <& Ar n2
+Redirect standard input (or
 .Ar n1 )
-from file descriptor
+from a duplicate of file descriptor
 .Ar n2 .
-.Ar n2
-is expanded if not a digit string, the result must be a number.
-.It Oo Ar n Oc Ns Ic <&-
+.It Oo Ar n Oc Ns Ic <& \(mi
 Close standard input (or
 .Ar n ) .
-.It Oo Ar n1 Oc Ns Ic >& Ns Ar n2
-Duplicate standard output (or
+Note that the
+.Sq \&\(mi
+is minus sign (or hyphen) given literally or resulting
+from the expansion of
+.Ar file
+(or
+.Ar n2 )
+for this format.
+When given literally there is usually no space between
+the redirection operator and the
+.Sq \&\(mi ,
+though that is just a convention.
+.It Oo Ar n1 Oc Ns Ic >& Ar n2
+Redirect standard output (or
 .Ar n1 )
-to
+to be a duplicate of
 .Ar n2 .
-.It Oo Ar n Oc Ns Ic >&-
+.It Oo Ar n Oc Ns Ic >& \(mi
 Close standard output (or
 .Ar n ) .
 .It Oo Ar n Oc Ns Ic <> Ar file



CVS commit: src/sys/dev/pckbport

2019-04-21 Thread Brett Lymn
Module Name:src
Committed By:   blymn
Date:   Mon Apr 22 00:53:59 UTC 2019

Modified Files:
src/sys/dev/pckbport: synaptics.c synapticsreg.h

Log Message:
Modify driver to use bits(3) to extract capabilities.  Thanks to
Anon Ymous for the fix.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/pckbport/synaptics.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pckbport/synapticsreg.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/pckbport/synaptics.c
diff -u src/sys/dev/pckbport/synaptics.c:1.47 src/sys/dev/pckbport/synaptics.c:1.48
--- src/sys/dev/pckbport/synaptics.c:1.47	Sun Apr 21 02:40:35 2019
+++ src/sys/dev/pckbport/synaptics.c	Mon Apr 22 00:53:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: synaptics.c,v 1.47 2019/04/21 02:40:35 blymn Exp $	*/
+/*	$NetBSD: synaptics.c,v 1.48 2019/04/22 00:53:59 blymn Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -48,7 +48,7 @@
 #include "opt_pms.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.47 2019/04/21 02:40:35 blymn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: synaptics.c,v 1.48 2019/04/22 00:53:59 blymn Exp $");
 
 #include 
 #include 
@@ -302,20 +302,23 @@ pms_synaptics_probe_extended(struct pms_
  * 1	0x20	report min		query 0x0f gives min coord reported
  */
 		if (res == 0) {
-			u_char clickpad_type = (resp[0] & 0x10);
-			clickpad_type |=   (resp[1] & 0x01);
+			uint val = SYN_CCAP_VALUE(resp);
 
 			aprint_debug_dev(psc->sc_dev, "%s: Continued "
 			"Capabilities 0x%02x 0x%02x 0x%02x.\n", __func__,
 			resp[0], resp[1], resp[2]);
-			switch (clickpad_type) {
-			case 0x10:
+			switch (SYN_CCAP_CLICKPAD_TYPE(val)) {
+			case 0: /* not a clickpad */
+break;
+			case 1:
 sc->flags |= SYN_FLAG_HAS_ONE_BUTTON_CLICKPAD;
 break;
-			case 0x01:
+			case 2:
 sc->flags |= SYN_FLAG_HAS_TWO_BUTTON_CLICKPAD;
 break;
+			case 3: /* reserved */
 			default:
+/* unreached */
 break;
 			}
 		}
@@ -395,7 +398,7 @@ pms_synaptics_probe_init(void *vsc)
 		goto doreset;
 	}
 
-	sc->caps = (resp[0] << 8) | resp[2];
+	sc->caps = SYNAPTICS_CAP_VALUE(resp);
 
 	if (sc->caps & SYNAPTICS_CAP_MBUTTON)
 		sc->flags |= SYN_FLAG_HAS_MIDDLE_BUTTON;

Index: src/sys/dev/pckbport/synapticsreg.h
diff -u src/sys/dev/pckbport/synapticsreg.h:1.10 src/sys/dev/pckbport/synapticsreg.h:1.11
--- src/sys/dev/pckbport/synapticsreg.h:1.10	Sat Jul 14 00:47:33 2018
+++ src/sys/dev/pckbport/synapticsreg.h	Mon Apr 22 00:53:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: synapticsreg.h,v 1.10 2018/07/14 00:47:33 maya Exp $	*/
+/*	$NetBSD: synapticsreg.h,v 1.11 2019/04/22 00:53:59 blymn Exp $	*/
 
 /*
  * Copyright (c) 2005, Steve C. Woodford
@@ -56,16 +56,39 @@
 #define	SYNAPTICS_MAGIC_BYTE		0x47
 
 /* Capability bits. */
+/* (byte[0] << 8) | byte[2] */
+#define SYNAPTICS_CAP_VALUE(b)	(((b)[0] << 8) | (b)[2])
 #define	SYNAPTICS_CAP_EXTENDED		(1 << 15)
 #define	SYNAPTICS_CAP_EXTNUM		(1 << 14 | 1 << 13 | 1 << 12)
 #define	SYNAPTICS_CAP_MBUTTON		(1 << 10)
 #define	SYNAPTICS_CAP_PASSTHROUGH	(1 << 7)
+#define	SYNAPTICS_CAP_LOWPOWER		(1 << 6)
 #define	SYNAPTICS_CAP_MULTIFINGERREPORT (1 << 5)
 #define	SYNAPTICS_CAP_SLEEP		(1 << 4)
 #define	SYNAPTICS_CAP_4BUTTON		(1 << 3)
 #define	SYNAPTICS_CAP_MULTIDETECT	(1 << 1)
 #define	SYNAPTICS_CAP_PALMDETECT	(1 << 0)
 
+/* Continued Capability bits */
+/* (byte[0] << 8) | byte[1] */
+#define SYN_CCAP_VALUE(b)	(((b)[0] << 8) | (b)[1])
+#define SYN_CCAP_COVERED_PAD		__BIT(15)
+#define SYN_CCAP_MULTIFINGER_MODE	__BITS(13,14)
+#define SYN_CCAP_CLICKPAD_BIT_0		__BIT(12) /* one-button clickpad */
+#define SYN_CCAP_HAS_ADV_GESTURE_MODE	__BIT(11)
+#define SYN_CCAP_CLEARPAD		__BIT(10)
+#define SYN_CCAP_REPORT_MAX		__BIT(9)
+#define SYN_CCAP_ADJ_THRESHOLD		__BIT(8)
+#define SYN_CCAP_REPORT_MIN		__BIT(5)
+#define SYN_CCAP_UNIFORM_CLICKPAD	__BIT(4)
+#define SYN_CCAP_IMAGE_SENSOR		__BIT(3)  /* reports V */
+#define SYN_CCAP_REDUCED_FILTERING	__BIT(2)
+#define SYN_CCAP_DELUX_LED_CONTROLS	__BIT(1)
+#define SYN_CCAP_CLICKPAD_BIT_1		__BIT(0)  /* two-button clickpad */
+#define SYN_CCAP_CLICKPAD_TYPE(v)	\
+	((__SHIFTOUT((v), SYN_CCAP_CLICKPAD_BIT_1) << 1) | \
+ 	  __SHIFTOUT((v), SYN_CCAP_CLICKPAD_BIT_0))
+
 /* Mode bits. */
 #define	SYNAPTICS_MODE_ABSOLUTE		(1 << 7)
 #define	SYNAPTICS_MODE_RATE		(1 << 6)
@@ -73,7 +96,7 @@
 #define	SYNAPTICS_MODE_EXTENDED_W	(1 << 2) /* double meaning */
 #define	SYNAPTICS_MODE_GEST		(1 << 2)
 #define	SYNAPTICS_MODE_4BYTE_CLIENT	(1 << 1)
-#define	SYNAPTICS_MODE_W		(1)
+#define	SYNAPTICS_MODE_W		(1 << 0)
 
 /* Extended mode button masks. */
 #define	SYN_1BUTMASK			0x1



CVS commit: src/doc

2019-04-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Apr 21 22:32:12 UTC 2019

Modified Files:
src/doc: CHANGES

Log Message:
Note efiboot.plist / device tree overlay changes.


To generate a diff of this commit:
cvs rdiff -u -r1.2527 -r1.2528 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2527 src/doc/CHANGES:1.2528
--- src/doc/CHANGES:1.2527	Sun Apr 21 06:46:03 2019
+++ src/doc/CHANGES	Sun Apr 21 22:32:12 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2527 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2528 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -358,3 +358,5 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	dhcpcd(8): Import dhcpcd-7.2.0 [roy 20190418]
 	evbarm: Add support for Amlogic GXL family SoCs. [jmcneill 20190419]
 	OpenSSH: Import 8.0 [christos 20180420]
+	evbarm: Add support for boot configuration (efiboot.plist) and
+		applying device tree overlays to efiboot. [thorpej 20190421]



CVS commit: src/sys/stand/efiboot

2019-04-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Apr 21 22:30:41 UTC 2019

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

Log Message:
- Add support for a boot configuration file, defaulting to /etc/efiboot.plist.
- Add support for pre-loading EFI environment variables from efiboot.plist.
- Add support for device tree overlays specified in efiboot.plist.

(Man page for efiboot forthcoming.)


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/stand/efiboot/Makefile.efiboot
cvs rdiff -u -r1.17 -r1.18 src/sys/stand/efiboot/boot.c
cvs rdiff -u -r1.15 -r1.16 src/sys/stand/efiboot/efiboot.c
cvs rdiff -u -r1.9 -r1.10 src/sys/stand/efiboot/efiboot.h \
src/sys/stand/efiboot/exec.c src/sys/stand/efiboot/version
cvs rdiff -u -r1.3 -r1.4 src/sys/stand/efiboot/efienv.c
cvs rdiff -u -r1.1 -r1.2 src/sys/stand/efiboot/efienv.h
cvs rdiff -u -r1.14 -r1.15 src/sys/stand/efiboot/efifdt.c
cvs rdiff -u -r1.4 -r1.5 src/sys/stand/efiboot/efifdt.h

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

Modified files:

Index: src/sys/stand/efiboot/Makefile.efiboot
diff -u src/sys/stand/efiboot/Makefile.efiboot:1.6 src/sys/stand/efiboot/Makefile.efiboot:1.7
--- src/sys/stand/efiboot/Makefile.efiboot:1.6	Fri Oct 12 22:08:04 2018
+++ src/sys/stand/efiboot/Makefile.efiboot	Sun Apr 21 22:30:41 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.6 2018/10/12 22:08:04 jmcneill Exp $
+# $NetBSD: Makefile.efiboot,v 1.7 2019/04/21 22:30:41 thorpej Exp $
 
 S=		${.CURDIR}/../../..
 
@@ -26,7 +26,7 @@ SOURCES+=	efiboot.c efichar.c efidev.c e
 
 .PATH: ${S}/external/bsd/libfdt/dist
 CPPFLAGS+=	-I${S}/external/bsd/libfdt/dist
-SOURCES+=	fdt.c fdt_addresses.c fdt_empty_tree.c
+SOURCES+=	fdt.c fdt_addresses.c fdt_empty_tree.c fdt_overlay.c
 SOURCES+=	fdt_ro.c fdt_rw.c fdt_strerror.c fdt_sw.c fdt_wip.c
 
 SRCS= ${SOURCES} ${EXTRA_SOURCES}
@@ -51,6 +51,7 @@ LDFLAGS+= -nostdlib -T${LDSCRIPT} -Bsymb
 CPPFLAGS+= -I$S -I${.CURDIR} -I${.CURDIR}/../common -I$S/lib/libsa
 CPPFLAGS+= -I${.OBJDIR}
 CPPFLAGS+= -I${.CURDIR}/../../lib
+CPPFLAGS+= -I${S}/../common/include
 
 COPTS+=	-fpic -g -O2
 COPTS+=	-fshort-wchar -fno-strict-aliasing
@@ -77,6 +78,7 @@ CPPFLAGS+= -DSUPPORT_DHCP
 CPPFLAGS+= -DSUPPORT_TFTP
 CPPFLAGS+= -DLIBSA_ENABLE_LS_OP
 
+#CPPFLAGS+= -DEFIBOOT_DEBUG
 #CPPFLAGS+= -DARP_DEBUG
 #CPPFLAGS+= -DBOOTP_DEBUG
 #CPPFLAGS+= -DNET_DEBUG

Index: src/sys/stand/efiboot/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.17 src/sys/stand/efiboot/boot.c:1.18
--- src/sys/stand/efiboot/boot.c:1.17	Sat Apr 20 11:28:53 2019
+++ src/sys/stand/efiboot/boot.c	Sun Apr 21 22:30:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.17 2019/04/20 11:28:53 jmcneill Exp $	*/
+/*	$NetBSD: boot.c,v 1.18 2019/04/21 22:30:41 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka 
@@ -72,6 +72,7 @@ static const char *efi_memory_type[] = {
 static char default_device[32];
 static char initrd_path[255];
 static char dtb_path[255];
+static char efibootplist_path[255];
 static char netbsd_path[255];
 static char netbsd_args[255];
 
@@ -84,6 +85,7 @@ int	set_bootargs(const char *);
 void	command_boot(char *);
 void	command_dev(char *);
 void	command_dtb(char *);
+void	command_plist(char *);
 void	command_initrd(char *);
 void	command_ls(char *);
 void	command_mem(char *);
@@ -99,6 +101,7 @@ const struct boot_command commands[] = {
 	{ "boot",	command_boot,		"boot [dev:][filename] [args]\n (ex. \"hd0a:\\netbsd.old -s\"" },
 	{ "dev",	command_dev,		"dev" },
 	{ "dtb",	command_dtb,		"dtb [dev:][filename]" },
+	{ "plist",	command_plist,		"plist [dev:][filename]" },
 	{ "initrd",	command_initrd,		"initrd [dev:][filename]" },
 	{ "ls",		command_ls,		"ls [hdNn:/path]" },
 	{ "mem",	command_mem,		"mem" },
@@ -166,6 +169,13 @@ command_dtb(char *arg)
 }
 
 void
+command_plist(char *arg)
+{
+	if (set_efibootplist_path(arg) == 0)
+		load_efibootplist(false);
+}
+
+void
 command_initrd(char *arg)
 {
 	set_initrd_path(arg);
@@ -324,6 +334,20 @@ get_dtb_path(void)
 }
 
 int
+set_efibootplist_path(const char *arg)
+{
+	if (strlen(arg) + 1 > sizeof(efibootplist_path))
+		return ERANGE;
+	strcpy(efibootplist_path, arg);
+	return 0;
+}
+
+char *get_efibootplist_path(void)
+{
+	return efibootplist_path;
+}
+
+int
 set_bootfile(const char *arg)
 {
 	if (strlen(arg) + 1 > sizeof(netbsd_path))
@@ -354,6 +378,21 @@ read_env(void)
 {
 	char *s;
 
+	s = efi_env_get("efibootplist");
+	if (s) {
+#ifdef EFIBOOT_DEBUG
+		printf(">> Setting efiboot.plist path to '%s' from environment\n", s);
+#endif
+		set_efibootplist_path(s);
+		FreePool(s);
+	}
+
+	/*
+	 * Read the efiboot.plist now as it may contain additional
+	 * environment variables.
+	 */
+	load_efibootplist(true);
+
 	s = efi_env_get("fdtfile");
 	if (s) {
 #ifdef EFIBOOT_DEBUG

Index: src/sys/stand/efiboot/efiboot.c
diff -u 

CVS commit: src/sys/dev/acpi

2019-04-21 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Apr 21 21:52:10 UTC 2019

Modified Files:
src/sys/dev/acpi: acpi_tz.c

Log Message:
use cpu_name() on a struct cpu_info *.  don't assume it has a ci_dev
member that is valid input to device_xname().

fixes build on arm64.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/dev/acpi/acpi_tz.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/acpi/acpi_tz.c
diff -u src/sys/dev/acpi/acpi_tz.c:1.89 src/sys/dev/acpi/acpi_tz.c:1.90
--- src/sys/dev/acpi/acpi_tz.c:1.89	Thu Jun  1 02:45:09 2017
+++ src/sys/dev/acpi/acpi_tz.c	Sun Apr 21 21:52:09 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_tz.c,v 1.89 2017/06/01 02:45:09 chs Exp $ */
+/* $NetBSD: acpi_tz.c,v 1.90 2019/04/21 21:52:09 mrg Exp $ */
 
 /*
  * Copyright (c) 2003 Jared D. McNeill 
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.89 2017/06/01 02:45:09 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.90 2019/04/21 21:52:09 mrg Exp $");
 
 #include 
 #include 
@@ -39,6 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -748,7 +749,7 @@ acpitz_print_processor_list(device_t dv)
 		if (cnt == 0)
 			aprint_normal(":");
 
-		aprint_normal(" %s", device_xname(ci->ci_dev));
+		aprint_normal(" %s", cpu_name(ci));
 
 		sc->sc_psl[cnt] = ci;
 		++cnt;



CVS commit: xsrc/external/mit/MesaLib/dist/src/egl/main

2019-04-21 Thread Christos Zoulas
Module Name:xsrc
Committed By:   christos
Date:   Sun Apr 21 18:52:56 UTC 2019

Modified Files:
xsrc/external/mit/MesaLib/dist/src/egl/main: eglglobals.c

Log Message:
The third argument of mincore(2) is unsigned only on linux.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
xsrc/external/mit/MesaLib/dist/src/egl/main/eglglobals.c

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

Modified files:

Index: xsrc/external/mit/MesaLib/dist/src/egl/main/eglglobals.c
diff -u xsrc/external/mit/MesaLib/dist/src/egl/main/eglglobals.c:1.3 xsrc/external/mit/MesaLib/dist/src/egl/main/eglglobals.c:1.4
--- xsrc/external/mit/MesaLib/dist/src/egl/main/eglglobals.c:1.3	Sat Mar  9 23:15:35 2019
+++ xsrc/external/mit/MesaLib/dist/src/egl/main/eglglobals.c	Sun Apr 21 14:52:56 2019
@@ -162,7 +162,10 @@ _eglPointerIsDereferencable(void *p)
 {
 #ifdef HAVE_MINCORE
uintptr_t addr = (uintptr_t) p;
-   unsigned char valid = 0;
+#ifdef __linux__
+   unsigned
+#endif
+   char valid = 0;
const long page_size = getpagesize();
 
if (p == NULL)



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

2019-04-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 21 15:57:33 UTC 2019

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

Log Message:
Fix SOC_MESON8B build


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/arm/amlogic/meson_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/amlogic/meson_platform.c
diff -u src/sys/arch/arm/amlogic/meson_platform.c:1.10 src/sys/arch/arm/amlogic/meson_platform.c:1.11
--- src/sys/arch/arm/amlogic/meson_platform.c:1.10	Sun Apr 21 13:49:47 2019
+++ src/sys/arch/arm/amlogic/meson_platform.c	Sun Apr 21 15:57:33 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_platform.c,v 1.10 2019/04/21 13:49:47 jmcneill Exp $ */
+/* $NetBSD: meson_platform.c,v 1.11 2019/04/21 15:57:33 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "arml2cc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.10 2019/04/21 13:49:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.11 2019/04/21 15:57:33 jmcneill Exp $");
 
 #include 
 #include 
@@ -442,11 +442,11 @@ meson8b_mpstart(void)
 }
 
 static const struct arm_platform meson8b_platform = {
-	.ap_devmap = meson8b_platform_devmap,
+	.ap_devmap = meson_platform_devmap,
 	.ap_bootstrap = meson8b_platform_bootstrap,
 	.ap_init_attach_args = meson_platform_init_attach_args,
 	.ap_device_register = meson8b_platform_device_register,
-	.ap_reset = meson_platform_reset,
+	.ap_reset = meson8b_platform_reset,
 	.ap_delay = a9tmr_delay,
 	.ap_uart_freq = meson_platform_uart_freq,
 	.ap_mpstart = meson8b_mpstart,



CVS commit: src/sys/external/bsd/drm2/ttm

2019-04-21 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Apr 21 15:49:50 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/ttm: ttm_bus_dma.c

Log Message:
in ttm_bus_dma_populate(), move the clearing of TTM_PAGE_FLAG_SWAPPED to be
earlier to avoid wrongly asserting if bus_dmamap_load_pglist() fails.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c

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

Modified files:

Index: src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c
diff -u src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.7 src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.8
--- src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c:1.7	Thu Mar  9 08:27:18 2017
+++ src/sys/external/bsd/drm2/ttm/ttm_bus_dma.c	Sun Apr 21 15:49:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ttm_bus_dma.c,v 1.7 2017/03/09 08:27:18 maya Exp $	*/
+/*	$NetBSD: ttm_bus_dma.c,v 1.8 2019/04/21 15:49:50 chs Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.c,v 1.7 2017/03/09 08:27:18 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ttm_bus_dma.c,v 1.8 2019/04/21 15:49:50 chs Exp $");
 
 #include 
 
@@ -70,6 +70,9 @@ ttm_bus_dma_populate(struct ttm_dma_tt *
 	/* Mark it populated but unbound.  */
 	ttm_dma->ttm.state = tt_unbound;
 
+	/* Mark it wired.  */
+	ttm_dma->ttm.page_flags &= ~TTM_PAGE_FLAG_SWAPPED;
+
 	/* Load the DMA map.  */
 	/* XXX errno NetBSD->Linux */
 	ret = -bus_dmamap_load_pglist(ttm_dma->ttm.bdev->dmat,
@@ -78,9 +81,6 @@ ttm_bus_dma_populate(struct ttm_dma_tt *
 	if (ret)
 		goto fail1;
 
-	/* Mark it wired.  */
-	ttm_dma->ttm.page_flags &= ~TTM_PAGE_FLAG_SWAPPED;
-
 	/* Success!  */
 	return 0;
 



CVS commit: src/sys/uvm

2019-04-21 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Apr 21 15:32:18 UTC 2019

Modified Files:
src/sys/uvm: uvm_pdaemon.c

Log Message:
Draining pools from the pagedaemon thread can deadlock, because draining
a pool can involve taking a lock which can be held by a thread which is
blocked waiting for memory.  Avoid this by moving the pool-draining work
to a separate worker thread.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_pdaemon.c
diff -u src/sys/uvm/uvm_pdaemon.c:1.109 src/sys/uvm/uvm_pdaemon.c:1.110
--- src/sys/uvm/uvm_pdaemon.c:1.109	Sat Oct 28 00:37:13 2017
+++ src/sys/uvm/uvm_pdaemon.c	Sun Apr 21 15:32:18 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pdaemon.c,v 1.109 2017/10/28 00:37:13 pgoyette Exp $	*/
+/*	$NetBSD: uvm_pdaemon.c,v 1.110 2019/04/21 15:32:18 chs Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.109 2017/10/28 00:37:13 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.110 2019/04/21 15:32:18 chs Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_readahead.h"
@@ -79,6 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -105,9 +106,16 @@ UVMHIST_DEFINE(pdhist);
 static void	uvmpd_scan(void);
 static void	uvmpd_scan_queue(void);
 static void	uvmpd_tune(void);
+static void	uvmpd_pool_drain_thread(void *);
+static void	uvmpd_pool_drain_wakeup(void);
 
 static unsigned int uvm_pagedaemon_waiters;
 
+/* State for the pool drainer thread */
+static kmutex_t uvmpd_pool_drain_lock;
+static kcondvar_t uvmpd_pool_drain_cv;
+static bool uvmpd_pool_drain_run = false;
+
 /*
  * XXX hack to avoid hangs when large processes fork.
  */
@@ -229,14 +237,21 @@ uvmpd_tune(void)
 void
 uvm_pageout(void *arg)
 {
-	int bufcnt, npages = 0;
+	int npages = 0;
 	int extrapages = 0;
-	struct pool *pp;
 	
 	UVMHIST_FUNC("uvm_pageout"); UVMHIST_CALLED(pdhist);
 
 	UVMHIST_LOG(pdhist,"", 0, 0, 0, 0);
 
+	mutex_init(_pool_drain_lock, MUTEX_DEFAULT, IPL_VM);
+	cv_init(_pool_drain_cv, "pooldrain");
+
+	/* Create the pool drainer kernel thread. */
+	if (kthread_create(PRI_VM, KTHREAD_MPSAFE, NULL,
+	uvmpd_pool_drain_thread, NULL, NULL, "pooldrain"))
+		panic("fork pooldrain");
+
 	/*
 	 * ensure correct priority and set paging parameters...
 	 */
@@ -288,9 +303,6 @@ uvm_pageout(void *arg)
 		 * system only when entire pool page is empty.
 		 */
 		mutex_spin_enter(_fpageqlock);
-		bufcnt = uvmexp.freetarg - uvmexp.free;
-		if (bufcnt < 0)
-			bufcnt = 0;
 
 		UVMHIST_LOG(pdhist,"  free/ftarg=%jd/%jd",
 		uvmexp.free, uvmexp.freetarg, 0,0);
@@ -331,16 +343,10 @@ uvm_pageout(void *arg)
 			continue;
 
 		/*
-		 * kill unused metadata buffers.
+		 * kick the pool drainer thread.
 		 */
-		mutex_enter(_lock);
-		buf_drain(bufcnt << PAGE_SHIFT);
-		mutex_exit(_lock);
 
-		/*
-		 * drain the pools.
-		 */
-		pool_drain();
+		uvmpd_pool_drain_wakeup();
 	}
 	/*NOTREACHED*/
 }
@@ -1022,3 +1028,53 @@ uvm_estimatepageable(int *active, int *i
 	uvmpdpol_estimatepageable(active, inactive);
 }
 
+
+/*
+ * Use a separate thread for draining pools.
+ * This work can't done from the main pagedaemon thread because
+ * some pool allocators need to take vm_map locks.
+ */
+
+static void
+uvmpd_pool_drain_thread(void *arg)
+{
+	int bufcnt;
+
+	for (;;) {
+		mutex_enter(_pool_drain_lock);
+		if (!uvmpd_pool_drain_run) {
+			cv_wait(_pool_drain_cv, _pool_drain_lock);
+		}
+		uvmpd_pool_drain_run = false;
+		mutex_exit(_pool_drain_lock);
+
+		/*
+		 * kill unused metadata buffers.
+		 */
+		mutex_spin_enter(_fpageqlock);
+		bufcnt = uvmexp.freetarg - uvmexp.free;
+		mutex_spin_exit(_fpageqlock);
+		if (bufcnt < 0)
+			bufcnt = 0;
+
+		mutex_enter(_lock);
+		buf_drain(bufcnt << PAGE_SHIFT);
+		mutex_exit(_lock);
+
+		/*
+		 * drain a pool.
+		 */
+		pool_drain(NULL);
+	}
+	/*NOTREACHED*/
+}
+
+static void
+uvmpd_pool_drain_wakeup(void)
+{
+
+	mutex_enter(_pool_drain_lock);
+	uvmpd_pool_drain_run = true;
+	cv_signal(_pool_drain_cv);
+	mutex_exit(_pool_drain_lock);
+}



CVS commit: src/sys/uvm

2019-04-21 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Apr 21 15:27:59 UTC 2019

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
If a pager fault method returns ENOMEM but some memory appears to be 
reclaimable,
wake up the pagedaemon and retry the fault.  This fixes the problems with Xorg
being killed with an "out of swap" message due to a transient memory shortage.


To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.204 src/sys/uvm/uvm_fault.c:1.205
--- src/sys/uvm/uvm_fault.c:1.204	Tue May  8 19:33:57 2018
+++ src/sys/uvm/uvm_fault.c	Sun Apr 21 15:27:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.204 2018/05/08 19:33:57 christos Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.205 2019/04/21 15:27:59 chs Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.204 2018/05/08 19:33:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.205 2019/04/21 15:27:59 chs Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -901,6 +901,16 @@ norng:
  * object fault routine responsible for
  * pmap_update().
  */
+
+/*
+ * Wake up the pagedaemon if the fault method
+ * failed for lack of memory but some can be
+ * reclaimed.
+ */
+if (error == ENOMEM && uvm_reclaimable()) {
+	uvm_wait("pgo_fault");
+	error = ERESTART;
+}
 			} else {
 error = uvm_fault_lower(, , pages);
 			}



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

2019-04-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 21 14:14:14 UTC 2019

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
Add mesonrng


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/evbarm/conf/GENERIC64

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.89 src/sys/arch/evbarm/conf/GENERIC64:1.90
--- src/sys/arch/evbarm/conf/GENERIC64:1.89	Sun Apr 21 13:51:04 2019
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Apr 21 14:14:14 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.89 2019/04/21 13:51:04 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.90 2019/04/21 14:14:14 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -337,9 +337,10 @@ rkreg*		at rkpmic?
 tcagpio*	at iic?
 
 # Random number generators
-bcmrng*		at fdt?			# Broadcom BCM283x RNG
 amdccp*		at fdt?			# AMD Cryptograhic Coprocessor RNG
 amdccp*		at acpi?
+bcmrng*		at fdt?			# Broadcom BCM283x RNG
+mesonrng*	at fdt?			# Amlogic Meson RNG
 
 # RTC
 plrtc*		at fdt?			# ARM PrimeCell RTC



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

2019-04-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 21 14:13:55 UTC 2019

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

Log Message:
Add support for Meson GXBB and GXL


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/amlogic/meson_rng.c

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

Modified files:

Index: src/sys/arch/arm/amlogic/meson_rng.c
diff -u src/sys/arch/arm/amlogic/meson_rng.c:1.1 src/sys/arch/arm/amlogic/meson_rng.c:1.2
--- src/sys/arch/arm/amlogic/meson_rng.c:1.1	Sat Jan 19 20:56:03 2019
+++ src/sys/arch/arm/amlogic/meson_rng.c	Sun Apr 21 14:13:55 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_rng.c,v 1.1 2019/01/19 20:56:03 jmcneill Exp $ */
+/* $NetBSD: meson_rng.c,v 1.2 2019/04/21 14:13:55 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015-2019 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: meson_rng.c,v 1.1 2019/01/19 20:56:03 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_rng.c,v 1.2 2019/04/21 14:13:55 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ struct meson_rng_softc {
 };
 
 static const char * const compatible[] = {
-	"amlogic,meson8b-rng",
+	"amlogic,meson-rng",
 	NULL
 };
 
@@ -94,12 +94,9 @@ meson_rng_attach(device_t parent, device
 
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_VM);
 
+	/* Core clock is optional */
 	clk = fdtbus_clock_get(phandle, "core");
-	if (clk == NULL) {
-		aprint_error(": couldn't get core clock\n");
-		return;
-	}
-	if (clk_enable(clk) != 0) {
+	if (clk != NULL && clk_enable(clk) != 0) {
 		aprint_error(": couldn't enable core clock\n");
 		return;
 	}
@@ -118,15 +115,15 @@ static void
 meson_rng_get(size_t bytes_wanted, void *priv)
 {
 	struct meson_rng_softc * const sc = priv;
-	uint32_t data[2];
+	uint32_t data;
 
 	mutex_spin_enter(>sc_lock);
 	while (bytes_wanted) {
-		bus_space_read_region_4(sc->sc_bst, sc->sc_bsh, 0, data, 2);
-		rnd_add_data_sync(>sc_rndsource, data, sizeof(data),
+		data = bus_space_read_4(sc->sc_bst, sc->sc_bsh, 0);
+		rnd_add_data_sync(>sc_rndsource, , sizeof(data),
 		sizeof(data) * NBBY);
 		bytes_wanted -= MIN(bytes_wanted, sizeof(data));
 	}
-	explicit_memset(data, 0, sizeof(data));
+	explicit_memset(, 0, sizeof(data));
 	mutex_spin_exit(>sc_lock);
 }



CVS commit: [isaki-audio2] src/sys

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 14:00:19 UTC 2019

Modified Files:
src/sys/arch/x68k/dev [isaki-audio2]: vs.c vsvar.h
src/sys/dev/ic [isaki-audio2]: msm6258.c msm6258var.h

Log Message:
Adapt to audio2.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.50.2.1 src/sys/arch/x68k/dev/vs.c
cvs rdiff -u -r1.16 -r1.16.6.1 src/sys/arch/x68k/dev/vsvar.h
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/dev/ic/msm6258.c
cvs rdiff -u -r1.10 -r1.10.8.1 src/sys/dev/ic/msm6258var.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/x68k/dev/vs.c
diff -u src/sys/arch/x68k/dev/vs.c:1.50 src/sys/arch/x68k/dev/vs.c:1.50.2.1
--- src/sys/arch/x68k/dev/vs.c:1.50	Sat Mar 16 12:09:57 2019
+++ src/sys/arch/x68k/dev/vs.c	Sun Apr 21 14:00:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vs.c,v 1.50 2019/03/16 12:09:57 isaki Exp $	*/
+/*	$NetBSD: vs.c,v 1.50.2.1 2019/04/21 14:00:19 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.50 2019/03/16 12:09:57 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.50.2.1 2019/04/21 14:00:19 isaki Exp $");
 
 #include "audio.h"
 #include "vs.h"
@@ -43,7 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: vs.c,v 1.50 
 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -75,11 +74,11 @@ static int  vs_dmaerrintr(void *);
 /* MI audio layer interface */
 static int  vs_open(void *, int);
 static void vs_close(void *);
-static int  vs_query_encoding(void *, struct audio_encoding *);
-static int  vs_set_params(void *, int, int, audio_params_t *,
-	audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
-static int  vs_init_output(void *, void *, int);
-static int  vs_init_input(void *, void *, int);
+static int  vs_query_format(void *, audio_format_query_t *);
+static int  vs_set_format(void *, int,
+	const audio_params_t *, const audio_params_t *,
+	audio_filter_reg_t *, audio_filter_reg_t *);
+static int  vs_commit_settings(void *);
 static int  vs_start_input(void *, void *, int, void (*)(void *), void *);
 static int  vs_start_output(void *, void *, int, void (*)(void *), void *);
 static int  vs_halt_output(void *);
@@ -99,8 +98,7 @@ static void vs_get_locks(void *, kmutex_
 
 /* lower functions */
 static int vs_round_sr(u_long);
-static void vs_set_sr(struct vs_softc *, int);
-static inline void vs_set_po(struct vs_softc *, u_long);
+static inline void vs_set_panout(struct vs_softc *, u_long);
 
 extern struct cfdriver vs_cd;
 
@@ -112,10 +110,9 @@ static int vs_attached;
 static const struct audio_hw_if vs_hw_if = {
 	.open			= vs_open,
 	.close			= vs_close,
-	.query_encoding		= vs_query_encoding,
-	.set_params		= vs_set_params,
-	.init_output		= vs_init_output,
-	.init_input		= vs_init_input,
+	.query_format		= vs_query_format,
+	.set_format		= vs_set_format,
+	.commit_settings	= vs_commit_settings,
 	.start_output		= vs_start_output,
 	.start_input		= vs_start_input,
 	.halt_output		= vs_halt_output,
@@ -137,6 +134,18 @@ static struct audio_device vs_device = {
 	"vs"
 };
 
+static const struct audio_format vs_formats = {
+	.mode		= AUMODE_PLAY | AUMODE_RECORD,
+	.encoding	= AUDIO_ENCODING_ADPCM,
+	.validbits	= 4,
+	.precision	= 4,
+	.channels	= 1,
+	.channel_mask	= AUFMT_MONAURAL,
+	.frequency_type	= 5,
+	.frequency	= { VS_RATE_3K, VS_RATE_5K, VS_RATE_7K,
+	VS_RATE_10K, VS_RATE_15K },
+};
+
 struct {
 	u_long rate;
 	u_char clk;
@@ -213,7 +222,7 @@ vs_attach(device_t parent, device_t self
 	sc->sc_prev_vd = NULL;
 	sc->sc_active = 0;
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_NONE);
-	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_SCHED);
+	mutex_init(>sc_intr_lock, MUTEX_DEFAULT, IPL_VM);
 
 	/* XXX */
 	bus_space_map(iot, PPI_ADDR, PPI_MAPSIZE, BUS_SPACE_MAP_SHIFTED,
@@ -298,172 +307,87 @@ vs_close(void *hdl)
 }
 
 static int
-vs_query_encoding(void *hdl, struct audio_encoding *fp)
+vs_query_format(void *hdl, audio_format_query_t *afp)
 {
 
-	DPRINTF(1, ("vs_query_encoding\n"));
-
-	if (fp->index == 0) {
-		strcpy(fp->name, AudioEslinear);
-		fp->encoding = AUDIO_ENCODING_SLINEAR;
-		fp->precision = 8;
-		fp->flags = 0;
-		return 0;
-	}
-	if (fp->index == 1) {
-		strcpy(fp->name, AudioEslinear_be);
-		fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
-		fp->precision = 16;
-		fp->flags = 0;
-		return 0;
-	}
-	return EINVAL;
+	return audio_query_format(_formats, 1, afp);
 }
 
 static int
 vs_round_sr(u_long rate)
 {
 	int i;
-	int diff;
-	int nearest;
 
-	diff = rate;
-	nearest = 0;
 	for (i = 0; i < NUM_RATE; i++) {
-		if (rate >= vs_l2r[i].rate) {
-			if (rate - vs_l2r[i].rate < diff) {
-diff = rate - vs_l2r[i].rate;
-nearest = i;
-			}
-		} else {
-			if (vs_l2r[i].rate - rate < diff) {
-diff = vs_l2r[i].rate - rate;
-nearest = i;
-			}
-		}
+		if (rate == vs_l2r[i].rate)
+			return i;
 	}
-	if (diff * 100 / 

CVS commit: src/sys/arch

2019-04-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 21 13:51:04 UTC 2019

Modified Files:
src/sys/arch/arm/amlogic: files.meson
src/sys/arch/evbarm/conf: GENERIC64
Added Files:
src/sys/arch/arm/amlogic: mesongx_wdt.c

Log Message:
Add driver for Meson GX EE-domain watchdog timer.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/amlogic/files.meson
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/amlogic/mesongx_wdt.c
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/evbarm/conf/GENERIC64

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

Modified files:

Index: src/sys/arch/arm/amlogic/files.meson
diff -u src/sys/arch/arm/amlogic/files.meson:1.8 src/sys/arch/arm/amlogic/files.meson:1.9
--- src/sys/arch/arm/amlogic/files.meson:1.8	Sun Apr 21 11:02:32 2019
+++ src/sys/arch/arm/amlogic/files.meson	Sun Apr 21 13:51:04 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.meson,v 1.8 2019/04/21 11:02:32 jmcneill Exp $
+#	$NetBSD: files.meson,v 1.9 2019/04/21 13:51:04 jmcneill Exp $
 #
 # Configuration info for Amlogic Meson family SoCs
 #
@@ -104,11 +104,16 @@ device	gxlphy: mii_phy
 attach  gxlphy at mii
 filearch/arm/amlogic/gxlphy.c		gxlphy
 
-# Watchdog
+# Meson8b Watchdog
 device	mesonwdt: sysmon_wdog
 attach	mesonwdt at fdt with meson_wdt
 file	arch/arm/amlogic/meson_wdt.c		meson_wdt
 
+# Meson GX Watchdog
+device	mesongxwdt: sysmon_wdog
+attach	mesongxwdt at fdt with mesongx_wdt
+file	arch/arm/amlogic/mesongx_wdt.c		mesongx_wdt
+
 # SOC parameters
 defflag	opt_soc.h			SOC_MESON
 defflag	opt_soc.h			SOC_MESON8B: SOC_MESON

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.88 src/sys/arch/evbarm/conf/GENERIC64:1.89
--- src/sys/arch/evbarm/conf/GENERIC64:1.88	Sun Apr 21 11:02:33 2019
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Apr 21 13:51:04 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.88 2019/04/21 11:02:33 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.89 2019/04/21 13:51:04 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -179,6 +179,7 @@ armgtmr0	at gtmr?
 tegratimer*	at fdt?			# Timers
 
 # Watchdog
+mesongxwdt*	at fdt?			# Amlogic Meson GX watchdog
 sbsawdt*	at acpi?		# ARM SBSA-compliant watchdog
 sunxiwdt*	at fdt?			# Allwinner watchdog
 watchdog*	at fdt?			# Broadcom BCM283x watchdog

Added files:

Index: src/sys/arch/arm/amlogic/mesongx_wdt.c
diff -u /dev/null src/sys/arch/arm/amlogic/mesongx_wdt.c:1.1
--- /dev/null	Sun Apr 21 13:51:05 2019
+++ src/sys/arch/arm/amlogic/mesongx_wdt.c	Sun Apr 21 13:51:04 2019
@@ -0,0 +1,172 @@
+/* $NetBSD: mesongx_wdt.c,v 1.1 2019/04/21 13:51:04 jmcneill Exp $ */
+
+/*-
+ * Copyright (c) 2019 Jared McNeill 
+ * All rights reserved.
+ *
+ * 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 disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: mesongx_wdt.c,v 1.1 2019/04/21 13:51:04 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+
+#define	CBUS_REG(x)		((x) << 2)
+
+#define	WATCHDOG_CNTL		CBUS_REG(0)
+#define	 CNTL_CLK_DIV_EN		__BIT(25)
+#define	 CNTL_CLK_EN			__BIT(24)
+#define	 CNTL_SYS_RESET_N_EN		__BIT(21)
+#define	 CNTL_WATCHDOG_EN		__BIT(18)
+#define	 CNTL_CLK_DIV_TCNT		__BITS(17,0)
+#define	WATCHDOG_CNTL1		CBUS_REG(1)
+#define	WATCHDOG_TCNT		CBUS_REG(2)
+#define	WATCHDOG_RESET		CBUS_REG(3)
+
+#define	WATCHDOG_PERIOD_DEFAULT		8
+#define	WATCHDOG_PERIOD_MAX		8
+
+static const char * compatible[] = {
+	"amlogic,meson-gx-wdt",
+	NULL
+};
+
+struct mesongx_wdt_softc {
+	device_t		sc_dev;
+	bus_space_tag_t		sc_bst;
+	bus_space_handle_t	sc_bsh;
+
+	struct sysmon_wdog	sc_wdog;
+	u_int			sc_rate;
+};
+
+#define	WDT_READ(sc, reg)		\
+	bus_space_read_4((sc)->sc_bst, (sc)->sc_bsh, (reg))

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

2019-04-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 21 13:49:47 UTC 2019

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

Log Message:
Don't rely on the existing state of the GX watchdog control register when
resetting.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/amlogic/meson_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/amlogic/meson_platform.c
diff -u src/sys/arch/arm/amlogic/meson_platform.c:1.9 src/sys/arch/arm/amlogic/meson_platform.c:1.10
--- src/sys/arch/arm/amlogic/meson_platform.c:1.9	Sun Apr 21 12:36:39 2019
+++ src/sys/arch/arm/amlogic/meson_platform.c	Sun Apr 21 13:49:47 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_platform.c,v 1.9 2019/04/21 12:36:39 jmcneill Exp $ */
+/* $NetBSD: meson_platform.c,v 1.10 2019/04/21 13:49:47 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "arml2cc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.9 2019/04/21 12:36:39 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.10 2019/04/21 13:49:47 jmcneill Exp $");
 
 #include 
 #include 
@@ -81,7 +81,9 @@ __KERNEL_RCSID(0, "$NetBSD: meson_platfo
 #define	MESONGX_WATCHDOG_BASE	0xc11098d0
 #define	MESONGX_WATCHDOG_SIZE	0x10
 #define	 MESONGX_WATCHDOG_CNTL	0x00
-#define	  MESONGX_WATCHDOG_CNTL_WDOG_EN	__BIT(18)
+#define	  MESONGX_WATCHDOG_CNTL_CLK_EN		__BIT(24)
+#define	  MESONGX_WATCHDOG_CNTL_SYS_RESET_N_EN	__BIT(21)
+#define	  MESONGX_WATCHDOG_CNTL_WDOG_EN		__BIT(18)
 #define	 MESONGX_WATCHDOG_CNTL1	0x04
 #define	 MESONGX_WATCHDOG_TCNT	0x08
 #define	  MESONGX_WATCHDOG_TCNT_COUNT	__BITS(15,0)
@@ -463,8 +465,9 @@ mesongx_platform_reset(void)
 
 	bus_space_map(bst, MESONGX_WATCHDOG_BASE, MESONGX_WATCHDOG_SIZE, 0, );
 
-	val = bus_space_read_4(bst, bsh, MESONGX_WATCHDOG_CNTL);
-	val |= MESONGX_WATCHDOG_CNTL_WDOG_EN;
+	val = MESONGX_WATCHDOG_CNTL_SYS_RESET_N_EN |
+	  MESONGX_WATCHDOG_CNTL_WDOG_EN |
+	  MESONGX_WATCHDOG_CNTL_CLK_EN;
 	bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_CNTL, val);
 
 	bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_TCNT, 1);



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

2019-04-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 21 13:08:48 UTC 2019

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

Log Message:
Fix module clock rate in DDR52 mode and support mmc-ddr-3_3v DT property


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/amlogic/mesongx_mmc.c

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

Modified files:

Index: src/sys/arch/arm/amlogic/mesongx_mmc.c
diff -u src/sys/arch/arm/amlogic/mesongx_mmc.c:1.4 src/sys/arch/arm/amlogic/mesongx_mmc.c:1.5
--- src/sys/arch/arm/amlogic/mesongx_mmc.c:1.4	Sat Mar 16 12:52:47 2019
+++ src/sys/arch/arm/amlogic/mesongx_mmc.c	Sun Apr 21 13:08:48 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mesongx_mmc.c,v 1.4 2019/03/16 12:52:47 jmcneill Exp $ */
+/* $NetBSD: mesongx_mmc.c,v 1.5 2019/04/21 13:08:48 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.c,v 1.4 2019/03/16 12:52:47 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mesongx_mmc.c,v 1.5 2019/04/21 13:08:48 jmcneill Exp $");
 
 #include 
 #include 
@@ -463,7 +463,7 @@ mesongx_mmc_set_clock(struct mesongx_mmc
 	best_sel = 0;
 	best_div = 0;
 
-	const u_int target_rate = (freq * 1000) >> ddr;
+	const u_int target_rate = (freq * 1000) << ddr;
 	for (sel = 0; sel <= 1; sel++) {
 		const u_int parent_rate = clk_get_rate(sc->sc_clk_clkin[sel]);
 		for (div = 1; div <= 63; div++) {
@@ -541,6 +541,10 @@ mesongx_mmc_attach_i(device_t self)
 	if (of_getprop_bool(sc->sc_phandle, "cap-mmc-highspeed"))
 		saa.saa_caps |= SMC_CAPS_MMC_HIGHSPEED;
 
+	if (of_getprop_bool(sc->sc_phandle, "mmc-ddr-3_3v")) {
+		saa.saa_caps |= SMC_CAPS_MMC_DDR52;
+	}
+
 	if (of_getprop_bool(sc->sc_phandle, "mmc-ddr-1_8v")) {
 		saa.saa_caps |= SMC_CAPS_MMC_DDR52;
 		sc->sc_host_ocr |= MMC_OCR_1_65V_1_95V;



CVS commit: [isaki-audio2] src/sys/arch/sgimips/mace

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 13:05:46 UTC 2019

Modified Files:
src/sys/arch/sgimips/mace [isaki-audio2]: mavb.c

Log Message:
Adapt to audio2.
- The driver does not support recording so drop CAPTURE property.


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/arch/sgimips/mace/mavb.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/sgimips/mace/mavb.c
diff -u src/sys/arch/sgimips/mace/mavb.c:1.12.2.1 src/sys/arch/sgimips/mace/mavb.c:1.12.2.2
--- src/sys/arch/sgimips/mace/mavb.c:1.12.2.1	Sun Apr 21 05:11:21 2019
+++ src/sys/arch/sgimips/mace/mavb.c	Sun Apr 21 13:05:46 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: mavb.c,v 1.12.2.1 2019/04/21 05:11:21 isaki Exp $ */
+/* $NetBSD: mavb.c,v 1.12.2.2 2019/04/21 13:05:46 isaki Exp $ */
 /* $OpenBSD: mavb.c,v 1.6 2005/04/15 13:05:14 mickey Exp $ */
 
 /*
@@ -29,7 +29,6 @@
 #include 
 
 #include 
-#include 
 #include 
 
 #include 
@@ -108,22 +107,19 @@ const char *ad1843_input[] = {
 	AudioNmono		/* AD1843_MISC_SETTINGS */
 };
 
-#define MAVB_NFORMATS 2
-#define MAVB_FORMAT(ch, chmask) \
-	{ \
-		.mode		= AUMODE_PLAY | AUMODE_RECORD, \
-		.encoding	= AUDIO_ENCODING_SLINEAR_BE, \
-		.validbits	= 16, \
-		.precision	= 16, \
-		.channels	= (ch), \
-		.channel_mask	= (chmask), \
-		.frequency_type	= 0, \
-		.frequency	= { 8000, 48000 }, \
-	}
-static const struct audio_format mavb_formats[MAVB_NFORMATS] = {
-	MAVB_FORMAT(1, AUFMT_MONAURAL),
-	MAVB_FORMAT(2, AUFMT_STEREO),
+static const struct audio_format mavb_formats[] = {
+	{
+		.mode		= AUMODE_PLAY,
+		.encoding	= AUDIO_ENCODING_SLINEAR_BE,
+		.validbits	= 16,
+		.precision	= 16,
+		.channels	= 2,
+		.channel_mask	= AUFMT_STEREO,
+		.frequency_type	= 0,
+		.frequency	= { 8000, 48000 },
+	},
 };
+#define MAVB_NFORMATS __arraycount(mavb_formats)
 
 struct mavb_softc {
 	device_t sc_dev;
@@ -152,101 +148,8 @@ struct mavb_softc {
 	u_int sc_play_format;
 
 	struct callout sc_volume_button_ch;
-
-	struct audio_format sc_formats[MAVB_NFORMATS];
-	struct audio_encoding_set *sc_encodings;
-};
-
-struct mavb_codecvar {
-	stream_filter_t base;
 };
 
-static stream_filter_t *mavb_factory
-(struct audio_softc *,
- int (*)(struct audio_softc *, stream_fetcher_t *, audio_stream_t *, int));
-static void mavb_dtor(stream_filter_t *);
-
-/* XXX I'm going to complain every time I have to copy this macro */
-#define DEFINE_FILTER(name)		\
-static int\
-name##_fetch_to(struct audio_softc *, stream_fetcher_t *,		\
-		audio_stream_t *, int);	\
-stream_filter_t *name(struct audio_softc *,\
-const audio_params_t *, const audio_params_t *);			\
-stream_filter_t *			\
-name(struct audio_softc *sc, const audio_params_t *from,		\
-const audio_params_t *to)		\
-{	\
-	return mavb_factory(sc, name##_fetch_to);			\
-}	\
-static int\
-name##_fetch_to(struct audio_softc *asc, stream_fetcher_t *self,	\
-audio_stream_t *dst, int max_used)
-
-DEFINE_FILTER(mavb_16to24)
-{
-	stream_filter_t *this;
-	int m, err;
-
-	this = (stream_filter_t *)self;
-	max_used = (max_used + 1) & ~1;
-	if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used)))
-		return err;
-	m = (dst->end - dst->start) & ~1;
-	m = uimin(m, max_used);
-	FILTER_LOOP_PROLOGUE(this->src, 2, dst, 4, m) {
-		d[3] = 0;
-		d[2] = s[1];
-		d[1] = s[0];
-		d[0] = (s[0] & 0x80) ? 0xff : 0;
-	} FILTER_LOOP_EPILOGUE(this->src, dst);
-
-	return 0;
-}
-
-DEFINE_FILTER(mavb_mts)
-{
-	stream_filter_t *this;
-	int m, err;
-
-	this = (stream_filter_t *)self;
-	max_used = (max_used + 1) & ~1;
-	if ((err = this->prev->fetch_to(asc, this->prev, this->src, max_used)))
-		return err;
-	m = (dst->end - dst->start) & ~1;
-	m = uimin(m, max_used);
-	FILTER_LOOP_PROLOGUE(this->src, 4, dst, 8, m) {
-		d[3] = d[7] = s[3];
-		d[2] = d[6] = s[2];
-		d[1] = d[5] = s[1];
-		d[0] = d[4] = s[0];
-	} FILTER_LOOP_EPILOGUE(this->src, dst);
-
-	return 0;
-}
-
-static stream_filter_t *
-mavb_factory(struct audio_softc *asc, int (*fetch_to)(struct audio_softc *, stream_fetcher_t *, audio_stream_t *, int))
-{
-	struct mavb_codecvar *this;
-
-	this = kmem_zalloc(sizeof(*this), KM_SLEEP);
-	this->base.base.fetch_to = fetch_to;
-	this->base.dtor = mavb_dtor;
-	this->base.set_fetcher = stream_filter_set_fetcher;
-	this->base.set_inputbuffer = stream_filter_set_inputbuffer;
-
-	return >base;
-}
-
-static void
-mavb_dtor(stream_filter_t *this)
-{
-
-	if (this != NULL)
-		kmem_free(this, sizeof(struct mavb_codecvar));
-}
-
 typedef uint64_t ad1843_addr_t;
 
 uint16_t ad1843_reg_read(struct mavb_softc *, ad1843_addr_t);
@@ -258,13 +161,11 @@ void mavb_attach(device_t, device_t, voi
 
 CFATTACH_DECL_NEW(mavb, sizeof(struct mavb_softc),
 mavb_match, mavb_attach, NULL, NULL);
-
-int mavb_open(void *, int);
-void mavb_close(void *);
-int mavb_query_encoding(void *, struct audio_encoding 

CVS commit: [isaki-audio2] src/sys/arch/sgimips/hpc

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 12:54:25 UTC 2019

Modified Files:
src/sys/arch/sgimips/hpc [isaki-audio2]: haltwo.c

Log Message:
Adapt to audio2.
- The driver doesn't seem to support recording.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.24.2.1 src/sys/arch/sgimips/hpc/haltwo.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/sgimips/hpc/haltwo.c
diff -u src/sys/arch/sgimips/hpc/haltwo.c:1.24 src/sys/arch/sgimips/hpc/haltwo.c:1.24.2.1
--- src/sys/arch/sgimips/hpc/haltwo.c:1.24	Sat Mar 16 12:09:57 2019
+++ src/sys/arch/sgimips/hpc/haltwo.c	Sun Apr 21 12:54:25 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: haltwo.c,v 1.24 2019/03/16 12:09:57 isaki Exp $ */
+/* $NetBSD: haltwo.c,v 1.24.2.1 2019/04/21 12:54:25 isaki Exp $ */
 
 /*
  * Copyright (c) 2003 Ilpo Ruotsalainen
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: haltwo.c,v 1.24 2019/03/16 12:09:57 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: haltwo.c,v 1.24.2.1 2019/04/21 12:54:25 isaki Exp $");
 
 #include 
 #include 
@@ -38,10 +38,6 @@ __KERNEL_RCSID(0, "$NetBSD: haltwo.c,v 1
 #include 
 #include 
 #include 
-#include 
-#include 
-
-#include 
 
 #include 
 #include 
@@ -58,9 +54,10 @@ __KERNEL_RCSID(0, "$NetBSD: haltwo.c,v 1
 #define DPRINTF(x)
 #endif
 
-static int haltwo_query_encoding(void *, struct audio_encoding *);
-static int haltwo_set_params(void *, int, int, audio_params_t *,
-	audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
+static int haltwo_query_format(void *, audio_format_query_t *);
+static int haltwo_set_format(void *, int,
+	const audio_params_t *, const audio_params_t *,
+	audio_filter_reg_t *, audio_filter_reg_t *);
 static int haltwo_round_blocksize(void *, int, int, const audio_params_t *);
 static int haltwo_halt_output(void *);
 static int haltwo_halt_input(void *);
@@ -79,8 +76,8 @@ static void haltwo_get_locks(void *, kmu
 static bool haltwo_shutdown(device_t, int);
 
 static const struct audio_hw_if haltwo_hw_if = {
-	.query_encoding		= haltwo_query_encoding,
-	.set_params		= haltwo_set_params,
+	.query_format		= haltwo_query_format,
+	.set_format		= haltwo_set_format,
 	.round_blocksize	= haltwo_round_blocksize,
 	.halt_output		= haltwo_halt_output,
 	.halt_input		= haltwo_halt_input,
@@ -102,6 +99,18 @@ static const struct audio_device haltwo_
 	"haltwo"
 };
 
+static const struct audio_format haltwo_formats = {
+	.mode		= AUMODE_PLAY,
+	.encoding	= AUDIO_ENCODING_SLINEAR_NE,
+	.validbits	= 16,
+	.precision	= 16,
+	.channels	= 2,
+	.channel_mask	= AUFMT_STEREO,
+	.frequency_type	= 2,
+	.frequency	= { 44100, 48000 },
+};
+#define HALTWO_NFORMATS __arraycount(haltwo_formats)
+
 static int  haltwo_match(device_t, cfdata_t, void *);
 static void haltwo_attach(device_t, device_t, void *);
 static int  haltwo_intr(void *);
@@ -381,96 +390,29 @@ haltwo_intr(void *v)
 }
 
 static int
-haltwo_query_encoding(void *v, struct audio_encoding *e)
+haltwo_query_format(void *v, audio_format_query_t *afp)
 {
 
-	switch (e->index) {
-	case 0:
-		strcpy(e->name, AudioEslinear_le);
-		e->encoding = AUDIO_ENCODING_SLINEAR_LE;
-		e->precision = 16;
-		e->flags = 0;
-		break;
-
-	case 1:
-		strcpy(e->name, AudioEslinear_be);
-		e->encoding = AUDIO_ENCODING_SLINEAR_BE;
-		e->precision = 16;
-		e->flags = 0;
-		break;
-
-	case 2:
-		strcpy(e->name, AudioEmulaw);
-		e->encoding = AUDIO_ENCODING_ULAW;
-		e->precision = 8;
-		e->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		break;
-
-	default:
-		return EINVAL;
-	}
-
-	return 0;
+	return audio_query_format(_formats, 1, afp);
 }
 
 static int
-haltwo_set_params(void *v, int setmode, int usemode,
-		  audio_params_t *play, audio_params_t *rec,
-		  stream_filter_list_t *pfil, stream_filter_list_t *rfil)
+haltwo_set_format(void *v, int setmode,
+		  const audio_params_t *play, const audio_params_t *rec,
+		  audio_filter_reg_t *pfil, audio_filter_reg_t *rfil)
 {
-	audio_params_t hw;
 	struct haltwo_softc *sc;
-	int master, inc, mod;
+	int inc;
 	uint16_t tmp;
 
 	sc = v;
-	if (play->sample_rate < 4000)
-		play->sample_rate = 4000;
-	if (play->sample_rate > 48000)
-		play->sample_rate = 48000;
-
-	if (44100 % play->sample_rate < 48000 % play->sample_rate)
-		master = 44100;
-	else
-		master = 48000;
-
-	/* HAL2 specification 3.1.2.21: Codecs should be driven with INC/MOD
-	 * fractions equivalent to 4/N, where N is a positive integer. */
 	inc = 4;
-	mod = master * inc / play->sample_rate;
-
-	/* Fixup upper layers idea of HW sample rate to the actual final rate */
-	play->sample_rate = master * inc / mod;
-
-	DPRINTF(("haltwo_set_params: master = %d inc = %d mod = %d"
-	" sample_rate = %ld\n", master, inc, mod,
-	play->sample_rate));
-
-	hw = *play;
-	switch (play->encoding) {
-	case AUDIO_ENCODING_ULAW:
-		if (play->precision != 8)
-			return EINVAL;
-
-		hw.encoding = AUDIO_ENCODING_SLINEAR_LE;
-		pfil->append(pfil, 

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

2019-04-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 21 12:36:39 UTC 2019

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

Log Message:
Provide a separate ap_reset for Meson GX family SoCs


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/amlogic/meson_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/amlogic/meson_platform.c
diff -u src/sys/arch/arm/amlogic/meson_platform.c:1.8 src/sys/arch/arm/amlogic/meson_platform.c:1.9
--- src/sys/arch/arm/amlogic/meson_platform.c:1.8	Fri Apr 19 19:07:56 2019
+++ src/sys/arch/arm/amlogic/meson_platform.c	Sun Apr 21 12:36:39 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_platform.c,v 1.8 2019/04/19 19:07:56 jmcneill Exp $ */
+/* $NetBSD: meson_platform.c,v 1.9 2019/04/21 12:36:39 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared McNeill 
@@ -33,7 +33,7 @@
 #include "arml2cc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.8 2019/04/19 19:07:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_platform.c,v 1.9 2019/04/21 12:36:39 jmcneill Exp $");
 
 #include 
 #include 
@@ -69,14 +69,23 @@ __KERNEL_RCSID(0, "$NetBSD: meson_platfo
 
 #define	MESON_CBUS_OFFSET	0x0110
 
-#define	MESON_WATCHDOG_BASE	0xc1109900
-#define	MESON_WATCHDOG_SIZE	0x8
-#define	 MESON_WATCHDOG_TC	0x00
-#define	  WATCHDOG_TC_CPUS	__BITS(27,24)
-#define	  WATCHDOG_TC_ENABLE	__BIT(19)
-#define	  WATCHDOG_TC_TCNT	__BITS(15,0)
-#define	 MESON_WATCHDOG_RESET	0x04
-#define	  WATCHDOG_RESET_COUNT	__BITS(15,0)
+#define	MESON8B_WATCHDOG_BASE	0xc1109900
+#define	MESON8B_WATCHDOG_SIZE	0x8
+#define	 MESON8B_WATCHDOG_TC	0x00
+#define	  MESON8B_WATCHDOG_TC_CPUS	__BITS(27,24)
+#define	  MESON8B_WATCHDOG_TC_ENABLE	__BIT(19)
+#define	  MESON8B_WATCHDOG_TC_TCNT	__BITS(15,0)
+#define	 MESON8B_WATCHDOG_RESET	0x04
+#define	  MESON8B_WATCHDOG_RESET_COUNT	__BITS(15,0)
+
+#define	MESONGX_WATCHDOG_BASE	0xc11098d0
+#define	MESONGX_WATCHDOG_SIZE	0x10
+#define	 MESONGX_WATCHDOG_CNTL	0x00
+#define	  MESONGX_WATCHDOG_CNTL_WDOG_EN	__BIT(18)
+#define	 MESONGX_WATCHDOG_CNTL1	0x04
+#define	 MESONGX_WATCHDOG_TCNT	0x08
+#define	  MESONGX_WATCHDOG_TCNT_COUNT	__BITS(15,0)
+#define	 MESONGX_WATCHDOG_RESET	0x0c
 
 #define	MESON8B_ARM_VBASE	(MESON_CORE_APB3_VBASE + MESON_CORE_APB3_SIZE)
 #define	MESON8B_ARM_PBASE	0xc420
@@ -295,26 +304,24 @@ meson8b_platform_bootstrap(void)
 
 	meson_platform_bootstrap();
 }
-#endif
 
 static void
-meson_platform_reset(void)
+meson8b_platform_reset(void)
 {
 	bus_space_tag_t bst = _bs_tag;
 	bus_space_handle_t bsh;
 
-	bus_space_map(bst, MESON_WATCHDOG_BASE, MESON_WATCHDOG_SIZE, 0, );
+	bus_space_map(bst, MESON8B_WATCHDOG_BASE, MESON8B_WATCHDOG_SIZE, 0, );
 
-	bus_space_write_4(bst, bsh, MESON_WATCHDOG_TC,
-	WATCHDOG_TC_CPUS | WATCHDOG_TC_ENABLE | __SHIFTIN(0xfff, WATCHDOG_TC_TCNT));
-	bus_space_write_4(bst, bsh, MESON_WATCHDOG_RESET, 0);
+	bus_space_write_4(bst, bsh, MESON8B_WATCHDOG_TC,
+	MESON8B_WATCHDOG_TC_CPUS | MESON8B_WATCHDOG_TC_ENABLE | __SHIFTIN(0xfff, MESON8B_WATCHDOG_TC_TCNT));
+	bus_space_write_4(bst, bsh, MESON8B_WATCHDOG_RESET, 0);
 
 	for (;;) {
 		__asm("wfi");
 	}
 }
 
-#if defined(SOC_MESON8B)
 static void
 meson8b_mpinit_delay(u_int n)
 {
@@ -433,7 +440,7 @@ meson8b_mpstart(void)
 }
 
 static const struct arm_platform meson8b_platform = {
-	.ap_devmap = meson_platform_devmap,
+	.ap_devmap = meson8b_platform_devmap,
 	.ap_bootstrap = meson8b_platform_bootstrap,
 	.ap_init_attach_args = meson_platform_init_attach_args,
 	.ap_device_register = meson8b_platform_device_register,
@@ -447,12 +454,34 @@ ARM_PLATFORM(meson8b, "amlogic,meson8b",
 #endif	/* SOC_MESON8B */
 
 #if defined(SOC_MESONGX)
+static void
+mesongx_platform_reset(void)
+{
+	bus_space_tag_t bst = _bs_tag;
+	bus_space_handle_t bsh;
+	uint32_t val;
+
+	bus_space_map(bst, MESONGX_WATCHDOG_BASE, MESONGX_WATCHDOG_SIZE, 0, );
+
+	val = bus_space_read_4(bst, bsh, MESONGX_WATCHDOG_CNTL);
+	val |= MESONGX_WATCHDOG_CNTL_WDOG_EN;
+	bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_CNTL, val);
+
+	bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_TCNT, 1);
+
+	bus_space_write_4(bst, bsh, MESONGX_WATCHDOG_RESET, 0);
+
+	for (;;) {
+		__asm("wfi");
+	}
+}
+
 static const struct arm_platform mesongx_platform = {
 	.ap_devmap = meson_platform_devmap,
 	.ap_bootstrap = meson_platform_bootstrap,
 	.ap_init_attach_args = meson_platform_init_attach_args,
 	.ap_device_register = meson_platform_device_register,
-	.ap_reset = meson_platform_reset,
+	.ap_reset = mesongx_platform_reset,
 	.ap_delay = gtmr_delay,
 	.ap_uart_freq = meson_platform_uart_freq,
 	.ap_mpstart = arm_fdt_cpu_mpstart,



CVS commit: src

2019-04-21 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Apr 21 11:45:09 UTC 2019

Modified Files:
src/sbin/resize_ffs: resize_ffs.c
src/sys/arch/sparc64/dev: pyro.c
src/sys/dev: dksubr.c
src/sys/dev/iscsi: iscsi_globals.h iscsi_text.c iscsi_utils.c
src/sys/dev/pci: voyager.c
src/tests/modules: t_modctl.c

Log Message:
wether -> whether


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sbin/resize_ffs/resize_ffs.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sparc64/dev/pyro.c
cvs rdiff -u -r1.107 -r1.108 src/sys/dev/dksubr.c
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/iscsi/iscsi_globals.h
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/iscsi/iscsi_text.c
cvs rdiff -u -r1.26 -r1.27 src/sys/dev/iscsi/iscsi_utils.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/voyager.c
cvs rdiff -u -r1.13 -r1.14 src/tests/modules/t_modctl.c

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

Modified files:

Index: src/sbin/resize_ffs/resize_ffs.c
diff -u src/sbin/resize_ffs/resize_ffs.c:1.53 src/sbin/resize_ffs/resize_ffs.c:1.54
--- src/sbin/resize_ffs/resize_ffs.c:1.53	Mon Oct  9 05:24:26 2017
+++ src/sbin/resize_ffs/resize_ffs.c	Sun Apr 21 11:45:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: resize_ffs.c,v 1.53 2017/10/09 05:24:26 mlelstv Exp $	*/
+/*	$NetBSD: resize_ffs.c,v 1.54 2019/04/21 11:45:08 maya Exp $	*/
 /* From sources sent on February 17, 2003 */
 /*-
  * As its sole author, I explicitly place this code in the public
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: resize_ffs.c,v 1.53 2017/10/09 05:24:26 mlelstv Exp $");
+__RCSID("$NetBSD: resize_ffs.c,v 1.54 2019/04/21 11:45:08 maya Exp $");
 
 #include 
 #include 
@@ -2086,7 +2086,7 @@ write_sbs(void)
 }
 
 /*
- * Check to see wether new size changes the filesystem
+ * Check to see whether new size changes the filesystem
  *  return exit code
  */
 static int

Index: src/sys/arch/sparc64/dev/pyro.c
diff -u src/sys/arch/sparc64/dev/pyro.c:1.18 src/sys/arch/sparc64/dev/pyro.c:1.19
--- src/sys/arch/sparc64/dev/pyro.c:1.18	Thu Nov 10 06:44:35 2016
+++ src/sys/arch/sparc64/dev/pyro.c	Sun Apr 21 11:45:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pyro.c,v 1.18 2016/11/10 06:44:35 macallan Exp $	*/
+/*	$NetBSD: pyro.c,v 1.19 2019/04/21 11:45:08 maya Exp $	*/
 /*	from: $OpenBSD: pyro.c,v 1.20 2010/12/05 15:15:14 kettenis Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pyro.c,v 1.18 2016/11/10 06:44:35 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pyro.c,v 1.19 2019/04/21 11:45:08 maya Exp $");
 
 #include 
 #include 
@@ -497,7 +497,7 @@ pyro_bus_map(bus_space_tag_t t, bus_addr
 
 	/*
 	 * BUS_SPACE_MAP_PREFETCHABLE causes hard hangs on schizo, so weed it
-	 * out for now until someone can verify wether it works on pyro
+	 * out for now until someone can verify whether it works on pyro
 	 */
 	flags &= ~BUS_SPACE_MAP_PREFETCHABLE;
 
@@ -535,7 +535,7 @@ pyro_bus_mmap(bus_space_tag_t t, bus_add
 
 	/*
 	 * BUS_SPACE_MAP_PREFETCHABLE causes hard hangs on schizo, so weed it
-	 * out for now until someone can verify wether it works on pyro
+	 * out for now until someone can verify whether it works on pyro
 	 */
 	flags &= ~BUS_SPACE_MAP_PREFETCHABLE;
 

Index: src/sys/dev/dksubr.c
diff -u src/sys/dev/dksubr.c:1.107 src/sys/dev/dksubr.c:1.108
--- src/sys/dev/dksubr.c:1.107	Wed Mar 27 19:13:34 2019
+++ src/sys/dev/dksubr.c	Sun Apr 21 11:45:08 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: dksubr.c,v 1.107 2019/03/27 19:13:34 martin Exp $ */
+/* $NetBSD: dksubr.c,v 1.108 2019/04/21 11:45:08 maya Exp $ */
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 1999, 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.107 2019/03/27 19:13:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dksubr.c,v 1.108 2019/04/21 11:45:08 maya Exp $");
 
 #include 
 #include 
@@ -812,7 +812,7 @@ dk_dump(struct dk_softc *dksc, dev_t dev
 			p->p_fstype));
 			return ENXIO;
 		}
-		/* Check wether dump goes to a wedge */
+		/* Check whether dump goes to a wedge */
 		if (dksc->sc_dkdev.dk_nwedges == 0) {
 			DPRINTF(DKDB_DUMP, ("%s: dump to raw\n", __func__));
 			return ENXIO;

Index: src/sys/dev/iscsi/iscsi_globals.h
diff -u src/sys/dev/iscsi/iscsi_globals.h:1.24 src/sys/dev/iscsi/iscsi_globals.h:1.25
--- src/sys/dev/iscsi/iscsi_globals.h:1.24	Sun Apr 21 11:26:46 2019
+++ src/sys/dev/iscsi/iscsi_globals.h	Sun Apr 21 11:45:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_globals.h,v 1.24 2019/04/21 11:26:46 mlelstv Exp $	*/
+/*	$NetBSD: iscsi_globals.h,v 1.25 2019/04/21 11:45:08 maya Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -532,7 +532,7 @@ extern login_isid_t iscsi_InitiatorISID;
 #ifdef ISCSI_DEBUG
 
 extern int iscsi_debug_level;	/* How much debug info to display */
-extern bool iscsi_hex_bignums;	/* Wether to encode parameters in hex or base64 */
+extern bool iscsi_hex_bignums;	/* 

CVS commit: src/sys/dev/iscsi

2019-04-21 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Apr 21 11:26:46 UTC 2019

Modified Files:
src/sys/dev/iscsi: iscsi_globals.h iscsi_main.c iscsi_text.c

Log Message:
Replace build option to enable hex encoded bignum parameters with a sysctl.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/iscsi/iscsi_globals.h
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/iscsi/iscsi_main.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/iscsi/iscsi_text.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/iscsi/iscsi_globals.h
diff -u src/sys/dev/iscsi/iscsi_globals.h:1.23 src/sys/dev/iscsi/iscsi_globals.h:1.24
--- src/sys/dev/iscsi/iscsi_globals.h:1.23	Sun Dec  3 19:07:10 2017
+++ src/sys/dev/iscsi/iscsi_globals.h	Sun Apr 21 11:26:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_globals.h,v 1.23 2017/12/03 19:07:10 christos Exp $	*/
+/*	$NetBSD: iscsi_globals.h,v 1.24 2019/04/21 11:26:46 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -532,6 +532,7 @@ extern login_isid_t iscsi_InitiatorISID;
 #ifdef ISCSI_DEBUG
 
 extern int iscsi_debug_level;	/* How much debug info to display */
+extern bool iscsi_hex_bignums;	/* Wether to encode parameters in hex or base64 */
 
 #define DEBOUT(x) printf x
 #define DEB(lev,x) { if (iscsi_debug_level >= lev) printf x ;}

Index: src/sys/dev/iscsi/iscsi_main.c
diff -u src/sys/dev/iscsi/iscsi_main.c:1.28 src/sys/dev/iscsi/iscsi_main.c:1.29
--- src/sys/dev/iscsi/iscsi_main.c:1.28	Thu Apr 11 11:40:58 2019
+++ src/sys/dev/iscsi/iscsi_main.c	Sun Apr 21 11:26:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_main.c,v 1.28 2019/04/11 11:40:58 kamil Exp $	*/
+/*	$NetBSD: iscsi_main.c,v 1.29 2019/04/21 11:26:46 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -47,6 +47,7 @@ extern struct cfdriver iscsi_cd;
 #if defined(ISCSI_DEBUG)
 int iscsi_debug_level = ISCSI_DEBUG;
 #endif
+bool iscsi_hex_bignums = false;
 
 bool iscsi_detaching;
 
@@ -383,7 +384,7 @@ map_session(session_t *sess, device_t de
 	chan->chan_channel = 0;
 	chan->chan_flags = SCSIPI_CHAN_NOSETTLE | SCSIPI_CHAN_CANGROW;
 	chan->chan_ntargets = 1;
-	chan->chan_nluns = 16;		/* ToDo: ??? */
+	chan->chan_nluns = 16;
 	chan->chan_id = sess->s_id;
 
 	sess->s_child_dev = config_found(dev, chan, scsiprint);
@@ -618,6 +619,12 @@ SYSCTL_SETUP(sysctl_iscsi_setup, "ISCSI 
 		SYSCTL_DESCR("iscsi controls"),
 		NULL, 0, NULL, 0,
 		CTL_HW, CTL_CREATE, CTL_EOL);
+	sysctl_createv(clog, 0, , NULL,
+		CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+		CTLTYPE_BOOL, "hexbignums",
+		SYSCTL_DESCR("encode parameters in hex"),
+		NULL, 0,  _hex_bignums, 0,
+		CTL_CREATE, CTL_EOL);
 
 #ifdef ISCSI_DEBUG
 	sysctl_createv(clog, 0, , NULL,

Index: src/sys/dev/iscsi/iscsi_text.c
diff -u src/sys/dev/iscsi/iscsi_text.c:1.11 src/sys/dev/iscsi/iscsi_text.c:1.12
--- src/sys/dev/iscsi/iscsi_text.c:1.11	Sun Dec  3 19:07:10 2017
+++ src/sys/dev/iscsi/iscsi_text.c	Sun Apr 21 11:26:46 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: iscsi_text.c,v 1.11 2017/12/03 19:07:10 christos Exp $	*/
+/*	$NetBSD: iscsi_text.c,v 1.12 2019/04/21 11:26:46 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 2005,2006,2011 The NetBSD Foundation, Inc.
@@ -34,9 +34,6 @@
 #include 
 #include 
 
-/* define to send T_BIGNUM in hex format instead of base64 */
-/* #define ISCSI_HEXBIGNUMS */
-
 #define isdigit(x) ((x) >= '0' && (x) <= '9')
 #define toupper(x) ((x) & ~0x20)
 
@@ -175,6 +172,7 @@ typedef struct
 {
 	text_key_t key;/* the key */
 	int list_num;/* number of elements in list, doubles as */
+	bool hex_bignums;			/* wether to encode in hex or base64 */
 	/* data size for large numeric values */
 	union
 	{
@@ -633,22 +631,21 @@ my_strcpy(uint8_t *dest, const uint8_t *
 STATIC unsigned
 put_bignumval(negotiation_parameter_t *par, uint8_t *buf)
 {
-#ifdef ISCSI_HEXBIGNUMS
 	int k, c;
 
-	my_strcpy(buf, "0x");
-	for (k=0; klist_num; ++k) {
-		c = par->val.sval[k] >> 4;
-		buf[2+2*k] = c < 10 ? '0' + c : 'a' + (c-10);
-		c = par->val.sval[k] & 0xf;
-		buf[2+2*k+1] = c < 10 ? '0' + c : 'a' + (c-10);
-	}
-	buf[2+2*k] = '\0';
+	if (par->hex_bignums) {
+		my_strcpy(buf, "0x");
+		for (k=0; klist_num; ++k) {
+			c = par->val.sval[k] >> 4;
+			buf[2+2*k] = c < 10 ? '0' + c : 'a' + (c-10);
+			c = par->val.sval[k] & 0xf;
+			buf[2+2*k+1] = c < 10 ? '0' + c : 'a' + (c-10);
+		}
+		buf[2+2*k] = '\0';
 
-	return 2+2*par->list_num;
-#else
+		return 2+2*par->list_num;
+	}
 	return base64_encode(par->val.sval, par->list_num, buf);
-#endif
 }
 
 /*
@@ -829,11 +826,10 @@ parameter_size(negotiation_parameter_t *
 
 		case T_BIGNUM:
 			/* list_num holds value size */
-#ifdef ISCSI_HEXBIGNUMS
-			size += 2 + 2*par->list_num;
-#else
-			size += base64_enclen(par->list_num);
-#endif
+			if (par->hex_bignums)
+size += 2 + 2*par->list_num;
+			else
+size += base64_enclen(par->list_num);
 			i = par->list_num;
 			break;

CVS commit: src/sys/arch

2019-04-21 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 21 11:02:33 UTC 2019

Modified Files:
src/sys/arch/arm/amlogic: files.meson
src/sys/arch/evbarm/conf: GENERIC64
Added Files:
src/sys/arch/arm/amlogic: gxlphy.c

Log Message:
Add support for Meson GXL internal PHY.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/arm/amlogic/files.meson
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/amlogic/gxlphy.c
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/evbarm/conf/GENERIC64

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

Modified files:

Index: src/sys/arch/arm/amlogic/files.meson
diff -u src/sys/arch/arm/amlogic/files.meson:1.7 src/sys/arch/arm/amlogic/files.meson:1.8
--- src/sys/arch/arm/amlogic/files.meson:1.7	Fri Apr 19 19:07:56 2019
+++ src/sys/arch/arm/amlogic/files.meson	Sun Apr 21 11:02:32 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.meson,v 1.7 2019/04/19 19:07:56 jmcneill Exp $
+#	$NetBSD: files.meson,v 1.8 2019/04/21 11:02:32 jmcneill Exp $
 #
 # Configuration info for Amlogic Meson family SoCs
 #
@@ -99,6 +99,11 @@ file	arch/arm/amlogic/meson_rng.c		meson
 attach	awge at fdt with meson_dwmac
 file	arch/arm/amlogic/meson_dwmac.c		meson_dwmac
 
+# Meson GXL internal PHY
+device	gxlphy: mii_phy
+attach  gxlphy at mii
+filearch/arm/amlogic/gxlphy.c		gxlphy
+
 # Watchdog
 device	mesonwdt: sysmon_wdog
 attach	mesonwdt at fdt with meson_wdt

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.87 src/sys/arch/evbarm/conf/GENERIC64:1.88
--- src/sys/arch/evbarm/conf/GENERIC64:1.87	Fri Apr 19 19:36:26 2019
+++ src/sys/arch/evbarm/conf/GENERIC64	Sun Apr 21 11:02:33 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.87 2019/04/19 19:36:26 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.88 2019/04/21 11:02:33 jmcneill Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -275,6 +275,7 @@ exphy* 		at mii? phy ?		# 3Com internal 
 gentbi* 	at mii? phy ?		# Generic Ten-Bit 1000BASE-[CLS]X PHYs
 glxtphy*	at mii? phy ?		# Level One LXT-1000 PHYs
 gphyter* 	at mii? phy ?		# NS83861 Gig-E PHY
+gxlphy*		at mii? phy ?		# Amlogic Meson GX internal PHY
 icsphy*		at mii? phy ?		# Integrated Circuit Systems ICS189x
 igphy*		at mii? phy ?		# Intel IGP01E1000
 ihphy*		at mii? phy ?		# Intel 82577 PHYs

Added files:

Index: src/sys/arch/arm/amlogic/gxlphy.c
diff -u /dev/null src/sys/arch/arm/amlogic/gxlphy.c:1.1
--- /dev/null	Sun Apr 21 11:02:33 2019
+++ src/sys/arch/arm/amlogic/gxlphy.c	Sun Apr 21 11:02:32 2019
@@ -0,0 +1,276 @@
+/* $NetBSD: gxlphy.c,v 1.1 2019/04/21 11:02:32 jmcneill Exp $ */
+
+/*
+ * Copyright (c) 2019 Jared McNeill 
+ * All rights reserved.
+ *
+ * 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 disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Amlogic Meson GXL 10/100 internal PHY
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: gxlphy.c,v 1.1 2019/04/21 11:02:32 jmcneill Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#define	TSTCNTL		20
+#define	 TSTCNTL_READ		__BIT(15)
+#define	 TSTCNTL_WRITE		__BIT(14)
+#define	 TSTCNTL_REG_BANK_SEL	__BITS(12,11)
+#define	 TSTCNTL_TEST_MODE	__BIT(10)
+#define	 TSTCNTL_READ_ADDR	__BITS(9,5)
+#define	 TSTCNTL_WRITE_ADDR	__BITS(4,0)
+#define	TSTREAD1	21
+#define	TSTWRITE	23
+
+#define	BANK_WOL	1
+#define	BANK_BIST	3
+
+#define	LPI_STATUS	0x0c
+#define	 LPI_STATUS_RSV12	__BIT(12)
+
+#define	BIST_PLL_CTRL	0x1b
+#define	BIST_PLL_DIV0	0x1c
+#define	BIST_PLL_DIV1	0x1d
+
+static int	gxlphymatch(device_t, cfdata_t, void *);
+static void	gxlphyattach(device_t, device_t, void *);
+
+CFATTACH_DECL3_NEW(gxlphy, sizeof(struct mii_softc),
+

CVS commit: [isaki-audio2] src/sys/arch/hppa/gsc

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 10:11:44 UTC 2019

Modified Files:
src/sys/arch/hppa/gsc [isaki-audio2]: harmony.c harmonyvar.h

Log Message:
Adapt to audio2.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.2.1 src/sys/arch/hppa/gsc/harmony.c
cvs rdiff -u -r1.1 -r1.1.38.1 src/sys/arch/hppa/gsc/harmonyvar.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/hppa/gsc/harmony.c
diff -u src/sys/arch/hppa/gsc/harmony.c:1.5 src/sys/arch/hppa/gsc/harmony.c:1.5.2.1
--- src/sys/arch/hppa/gsc/harmony.c:1.5	Sat Mar 16 12:09:56 2019
+++ src/sys/arch/hppa/gsc/harmony.c	Sun Apr 21 10:11:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: harmony.c,v 1.5 2019/03/16 12:09:56 isaki Exp $	*/
+/*	$NetBSD: harmony.c,v 1.5.2.1 2019/04/21 10:11:44 isaki Exp $	*/
 
 /*	$OpenBSD: harmony.c,v 1.23 2004/02/13 21:28:19 mickey Exp $	*/
 
@@ -77,7 +77,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -92,9 +91,10 @@
 
 int	harmony_open(void *, int);
 void	harmony_close(void *);
-int	harmony_query_encoding(void *, struct audio_encoding *);
-int	harmony_set_params(void *, int, int, audio_params_t *,
-audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
+int	harmony_query_format(void *, audio_format_query_t *);
+int	harmony_set_format(void *, int,
+const audio_params_t *, const audio_params_t *,
+audio_filter_reg_t *, audio_filter_reg_t *);
 int	harmony_round_blocksize(void *, int, int, const audio_params_t *);
 
 int	harmony_control_wait(struct harmony_softc *);
@@ -119,8 +119,8 @@ void	harmony_get_locks(void *, kmutex_t 
 const struct audio_hw_if harmony_sa_hw_if = {
 	.open			= harmony_open,
 	.close			= harmony_close,
-	.query_encoding		= harmony_query_encoding,
-	.set_params		= harmony_set_params,
+	.query_format		= harmony_query_format,
+	.set_format		= harmony_set_format,
 	.round_blocksize	= harmony_round_blocksize,
 	.commit_settings	= harmony_commit_settings,
 	.halt_output		= harmony_halt_output,
@@ -138,6 +138,25 @@ const struct audio_hw_if harmony_sa_hw_i
 	.get_locks		= harmony_get_locks,
 };
 
+/* The HW actually supports more frequencies, but these looks enough. */
+#define HARMONY_FORMAT(enc, prec) \
+	{ \
+		.mode		= AUMODE_PLAY | AUMODE_RECORD, \
+		.encoding	= (enc), \
+		.validbits	= (prec), \
+		.precision	= (prec), \
+		.channels	= 2, \
+		.channel_mask	= AUFMT_STEREO, \
+		.frequency_type = 4, \
+		.frequency	= { 16000, 32000, 44100, 48000 }, \
+	}
+static struct audio_format harmony_formats[] = {
+	HARMONY_FORMAT(AUDIO_ENCODING_ULAW,8),
+	HARMONY_FORMAT(AUDIO_ENCODING_ALAW,8),
+	HARMONY_FORMAT(AUDIO_ENCODING_SLINEAR_BE, 16),
+};
+#define HARMONY_NFORMATS __arraycount(harmony_formats)
+
 int harmony_match(device_t, struct cfdata *, void *);
 void harmony_attach(device_t, device_t, void *);
 
@@ -298,9 +317,6 @@ harmony_attach(device_t parent, device_t
 		printf(", teleshare");
 	aprint_normal("\n");
 
-	if ((rev & CS4215_REV_VER) >= CS4215_REV_VER_E)
-		sc->sc_hasulinear8 = 1;
-
 	strlcpy(sc->sc_audev.name, ga->ga_name, sizeof(sc->sc_audev.name));
 	snprintf(sc->sc_audev.version, sizeof sc->sc_audev.version,
 	"%u.%u;%u", ga->ga_type.iodc_sv_rev,
@@ -422,167 +438,39 @@ harmony_close(void *vsc)
 	struct harmony_softc *sc;
 
 	sc = vsc;
-	harmony_halt_input(sc);
-	harmony_halt_output(sc);
 	harmony_intr_disable(sc);
 	sc->sc_open = 0;
 }
 
 int
-harmony_query_encoding(void *vsc, struct audio_encoding *fp)
+harmony_query_format(void *vsc, audio_format_query_t *afp)
 {
-	struct harmony_softc *sc;
-	int err;
 
-	sc = vsc;
-	err = 0;
-	switch (fp->index) {
-	case 0:
-		strlcpy(fp->name, AudioEmulaw, sizeof fp->name);
-		fp->encoding = AUDIO_ENCODING_ULAW;
-		fp->precision = 8;
-		fp->flags = 0;
-		break;
-	case 1:
-		strlcpy(fp->name, AudioEalaw, sizeof fp->name);
-		fp->encoding = AUDIO_ENCODING_ALAW;
-		fp->precision = 8;
-		fp->flags = 0;
-		break;
-	case 2:
-		strlcpy(fp->name, AudioEslinear_be, sizeof fp->name);
-		fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
-		fp->precision = 16;
-		fp->flags = 0;
-		break;
-	case 3:
-		strlcpy(fp->name, AudioEslinear_le, sizeof fp->name);
-		fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
-		fp->precision = 16;
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		break;
-	case 4:
-		strlcpy(fp->name, AudioEulinear_be, sizeof fp->name);
-		fp->encoding = AUDIO_ENCODING_ULINEAR_BE;
-		fp->precision = 16;
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		break;
-	case 5:
-		strlcpy(fp->name, AudioEulinear_le, sizeof fp->name);
-		fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
-		fp->precision = 16;
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		break;
-	case 6:
-		if (sc->sc_hasulinear8) {
-			strlcpy(fp->name, AudioEulinear, sizeof fp->name);
-			fp->encoding = AUDIO_ENCODING_ULINEAR;
-			fp->precision = 8;
-			fp->flags = 0;
-			break;
-		}
-		/*FALLTHROUGH*/
-	case 7:
-		if (sc->sc_hasulinear8) {
-	

CVS commit: [isaki-audio2] src/sys/arch/hpcmips/vr

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 09:54:00 UTC 2019

Modified Files:
src/sys/arch/hpcmips/vr [isaki-audio2]: vraiu.c

Log Message:
Adapt to audio2.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.16.2.1 src/sys/arch/hpcmips/vr/vraiu.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/hpcmips/vr/vraiu.c
diff -u src/sys/arch/hpcmips/vr/vraiu.c:1.16 src/sys/arch/hpcmips/vr/vraiu.c:1.16.2.1
--- src/sys/arch/hpcmips/vr/vraiu.c:1.16	Sat Mar 16 12:09:56 2019
+++ src/sys/arch/hpcmips/vr/vraiu.c	Sun Apr 21 09:54:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vraiu.c,v 1.16 2019/03/16 12:09:56 isaki Exp $	*/
+/*	$NetBSD: vraiu.c,v 1.16.2.1 2019/04/21 09:54:00 isaki Exp $	*/
 
 /*
  * Copyright (c) 2001 HAMAJIMA Katsuomi. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vraiu.c,v 1.16 2019/03/16 12:09:56 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vraiu.c,v 1.16.2.1 2019/04/21 09:54:00 isaki Exp $");
 
 #include 
 #include 
@@ -74,12 +74,7 @@ struct vraiu_softc {
 	u_short	*sc_buf;	/* DMA buffer pointer */
 	int	sc_status;	/* status */
 	u_int	sc_rate;	/* sampling rate */
-	u_int	sc_channels;	/* # of channels used */
-	u_int	sc_encoding;	/* encoding type */
-	int	sc_precision;	/* 8 or 16 bits */
-/* pointer to format conversion routine */
 	u_char	sc_volume;	/* volume */
-	void	(*sc_decodefunc)(struct vraiu_softc *, u_short *, void *, int);
 	void	(*sc_intr)(void *);	/* interrupt routine */
 	void	*sc_intrdata;		/* interrupt data */
 };
@@ -97,12 +92,23 @@ struct audio_device aiu_device = {
 	"aiu"
 };
 
+const struct audio_format vraiu_formats = {
+	.mode		= AUMODE_PLAY,
+	.encoding	= AUDIO_ENCODING_SLINEAR_NE,
+	.validbits	= 10,
+	.precision	= 16,
+	.channels	= 1,
+	.channel_mask	= AUFMT_MONAURAL,
+	.frequency_type	= 4,
+	.frequency	= { 8000, 11025, 22050, 44100 },
+};
+
 /*
  * Define our interface to the higher level audio driver.
  */
 int vraiu_open(void *, int);
 void vraiu_close(void *);
-int vraiu_query_encoding(void *, struct audio_encoding *);
+int vraiu_query_format(void *, audio_format_query_t *);
 int vraiu_round_blocksize(void *, int, int, const audio_params_t *);
 int vraiu_commit_settings(void *);
 int vraiu_init_output(void *, void*, int);
@@ -114,16 +120,17 @@ int vraiu_getdev(void *, struct audio_de
 int vraiu_set_port(void *, mixer_ctrl_t *);
 int vraiu_get_port(void *, mixer_ctrl_t *);
 int vraiu_query_devinfo(void *, mixer_devinfo_t *);
-int vraiu_set_params(void *, int, int, audio_params_t *, audio_params_t *,
-		 stream_filter_list_t *, stream_filter_list_t *);
+int vraiu_set_format(void *, int,
+const audio_params_t *, const audio_params_t *,
+audio_filter_reg_t *, audio_filter_reg_t *);
 int vraiu_get_props(void *);
 void vraiu_get_locks(void *, kmutex_t **, kmutex_t **);
 
 const struct audio_hw_if vraiu_hw_if = {
 	.open			= vraiu_open,
 	.close			= vraiu_close,
-	.query_encoding		= vraiu_query_encoding,
-	.set_params		= vraiu_set_params,
+	.query_format		= vraiu_query_format,
+	.set_format		= vraiu_set_format,
 	.round_blocksize	= vraiu_round_blocksize,
 	.commit_settings	= vraiu_commit_settings,
 	.init_output		= vraiu_init_output,
@@ -143,20 +150,7 @@ const struct audio_hw_if vraiu_hw_if = {
 /*
  * convert to 1ch 10bit unsigned PCM data.
  */
-static void vraiu_slinear8_1(struct vraiu_softc *, u_short *, void *, int);
-static void vraiu_slinear8_2(struct vraiu_softc *, u_short *, void *, int);
-static void vraiu_ulinear8_1(struct vraiu_softc *, u_short *, void *, int);
-static void vraiu_ulinear8_2(struct vraiu_softc *, u_short *, void *, int);
-static void vraiu_mulaw_1(struct vraiu_softc *, u_short *, void *, int);
-static void vraiu_mulaw_2(struct vraiu_softc *, u_short *, void *, int);
 static void vraiu_slinear16_1(struct vraiu_softc *, u_short *, void *, int);
-static void vraiu_slinear16_2(struct vraiu_softc *, u_short *, void *, int);
-static void vraiu_slinear16sw_1(struct vraiu_softc *, u_short *, void *, int);
-static void vraiu_slinear16sw_2(struct vraiu_softc *, u_short *, void *, int);
-/*
- * software volume control
- */
-static void vraiu_volume(struct vraiu_softc *, u_short *, void *, int);
 
 int
 vraiu_match(device_t parent, cfdata_t cf, void *aux)
@@ -261,10 +255,6 @@ vraiu_attach(device_t parent, device_t s
 
 	sc->sc_status = 0;
 	sc->sc_rate = SPS8000;
-	sc->sc_channels = 1;
-	sc->sc_precision = 8;
-	sc->sc_encoding = AUDIO_ENCODING_ULAW;
-	sc->sc_decodefunc = vraiu_mulaw_1;
 	DPRINTFN(1, ("vraiu_attach: reset AIU\n"))
 	bus_space_write_2(sc->sc_iot, sc->sc_ioh, SEQ_REG_W, AIURST);
 	/* attach audio subsystem */
@@ -293,89 +283,28 @@ vraiu_close(void *self)
 
 	DPRINTFN(1, ("vraiu_close\n"));
 	sc = self;
-	vraiu_halt_output(self);
 	sc->sc_status = 0;
 }
 
 int
-vraiu_query_encoding(void *self, struct audio_encoding *ae)
+vraiu_query_format(void *self, 

CVS commit: [isaki-audio2] src/sys/arch/amiga/dev

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 09:41:59 UTC 2019

Modified Files:
src/sys/arch/amiga/dev [isaki-audio2]: repulse.c

Log Message:
Adapt to audio2.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.21.2.1 src/sys/arch/amiga/dev/repulse.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/amiga/dev/repulse.c
diff -u src/sys/arch/amiga/dev/repulse.c:1.21 src/sys/arch/amiga/dev/repulse.c:1.21.2.1
--- src/sys/arch/amiga/dev/repulse.c:1.21	Sat Mar 16 12:09:56 2019
+++ src/sys/arch/amiga/dev/repulse.c	Sun Apr 21 09:41:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: repulse.c,v 1.21 2019/03/16 12:09:56 isaki Exp $ */
+/*	$NetBSD: repulse.c,v 1.21.2.1 2019/04/21 09:41:58 isaki Exp $ */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: repulse.c,v 1.21 2019/03/16 12:09:56 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: repulse.c,v 1.21.2.1 2019/04/21 09:41:58 isaki Exp $");
 
 #include 
 #include 
@@ -42,7 +42,6 @@ __KERNEL_RCSID(0, "$NetBSD: repulse.c,v 
 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -72,19 +71,17 @@ enum ac97_host_flag repac_flags(void *);
 
 /* audio attachment functions */
 
-void rep_close(void *);
 int rep_getdev(void *, struct audio_device *);
 int rep_get_props(void *);
 int rep_halt_output(void *);
 int rep_halt_input(void *);
-int rep_query_encoding(void *, struct audio_encoding *);
-int rep_set_params(void *, int, int, audio_params_t *,
-audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
+int rep_query_format(void *, audio_format_query_t *);
+int rep_set_format(void *, int, const audio_params_t *, const audio_params_t *,
+	audio_filter_reg_t *, audio_filter_reg_t *);
 int rep_round_blocksize(void *, int, int, const audio_params_t *);
 int rep_set_port(void *, mixer_ctrl_t *);
 int rep_get_port(void *, mixer_ctrl_t *);
 int rep_query_devinfo(void *, mixer_devinfo_t *);
-size_t rep_round_buffersize(void *, int, size_t);
 void rep_get_locks(void *, kmutex_t **, kmutex_t **);
 
 int rep_start_input(void *, void *, int, void (*)(void *), void *);
@@ -96,9 +93,8 @@ int rep_intr(void *);
 /* audio attachment */
 
 const struct audio_hw_if rep_hw_if = {
-	.close			= rep_close,
-	.query_encoding		= rep_query_encoding,
-	.set_params		= rep_set_params,
+	.query_format		= rep_query_format,
+	.set_format		= rep_set_format,
 	.round_blocksize	= rep_round_blocksize,
 	.start_output		= rep_start_output,
 	.start_input		= rep_start_input,
@@ -108,7 +104,6 @@ const struct audio_hw_if rep_hw_if = {
 	.set_port		= rep_set_port,
 	.get_port		= rep_get_port,
 	.query_devinfo		= rep_query_devinfo,
-	.round_buffersize	= rep_round_buffersize,
 	.get_props		= rep_get_props,
 	.get_locks		= rep_get_locks,
 };
@@ -168,16 +163,6 @@ struct repulse_hw {
 #define REPFIFO_PLAYFIFOGAUGE(x) ((x << 4) & 0xf000)
 #define REPFIFO_RECFIFOGAUGE(x)		(x & 0xf000)
 
-/* ac97 data stream transfer functions */
-void rep_read_16_stereo(struct repulse_hw *, uint8_t *, int, unsigned);
-void rep_read_16_mono(struct repulse_hw *, uint8_t *, int, unsigned);
-void rep_write_16_stereo(struct repulse_hw *, uint8_t *, int, unsigned);
-void rep_write_16_mono(struct repulse_hw *, uint8_t *, int, unsigned);
-void rep_read_8_stereo(struct repulse_hw *, uint8_t *, int, unsigned);
-void rep_read_8_mono(struct repulse_hw *, uint8_t *, int, unsigned);
-void rep_write_8_stereo(struct repulse_hw *, uint8_t *, int, unsigned);
-void rep_write_8_mono(struct repulse_hw *, uint8_t *, int, unsigned);
-
 /* AmigaDOS Delay() ticks */
 
 #define USECPERTICK	(100/50)
@@ -195,7 +180,6 @@ struct repulse_softc {
 	void	(*sc_captmore)(void *);
 	void	 *sc_captarg;
 
-	void	(*sc_captfun)(struct repulse_hw *, uint8_t *, int, unsigned);
 	void	 *sc_captbuf;
 	int	  sc_captscale;
 	int	  sc_captbufsz;
@@ -204,7 +188,6 @@ struct repulse_softc {
 
 	void	(*sc_playmore)(void *);
 	void	 *sc_playarg;
-	void	(*sc_playfun)(struct repulse_hw *, uint8_t *, int, unsigned);
 	int	  sc_playscale;
 	unsigned  sc_playflags;
 
@@ -212,6 +195,17 @@ struct repulse_softc {
 	kmutex_t  sc_intr_lock;
 };
 
+const struct audio_format repulse_format = {
+	.mode		= AUMODE_PLAY | AUMODE_RECORD,
+	.encoding	= AUDIO_ENCODING_SLINEAR_BE,
+	.validbits	= 16,
+	.precision	= 16,
+	.channels	= 2,
+	.channel_mask	= AUFMT_STEREO,
+	.frequency_type	= 6,
+	.frequency	= { 8000, 16000, 22050, 32000, 44100, 48000 },
+};
+
 int repulse_match (device_t, cfdata_t, void *);
 void repulse_attach (device_t, device_t, void *);
 
@@ -249,6 +243,8 @@ repulse_attach(device_t parent, device_t
 	zap = aux;
 	bp = (struct repulse_hw *)zap->va;
 	sc->sc_boardp = bp;
+	sc->sc_playscale = 4;
+	sc->sc_captscale = 4;
 
 	needs_firmware = 0;
 	if (bp->rhw_fifostatus & 0x00f0)
@@ -421,16 +417,6 @@ repac_attach(void *arg, struct ac97_code
 
 /* audio(9) support stuff which is not 

CVS commit: [isaki-audio2] src/sys/arch/amiga/dev

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 09:33:54 UTC 2019

Modified Files:
src/sys/arch/amiga/dev [isaki-audio2]: aucc.c

Log Message:
Adapt to audio2.
- Remove its own mulaw converter.
- XXX I'm not sure about 3,4ch mode vs 8/14bit mode.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.44.2.1 src/sys/arch/amiga/dev/aucc.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/amiga/dev/aucc.c
diff -u src/sys/arch/amiga/dev/aucc.c:1.44 src/sys/arch/amiga/dev/aucc.c:1.44.2.1
--- src/sys/arch/amiga/dev/aucc.c:1.44	Sat Mar 16 12:09:56 2019
+++ src/sys/arch/amiga/dev/aucc.c	Sun Apr 21 09:33:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: aucc.c,v 1.44 2019/03/16 12:09:56 isaki Exp $ */
+/*	$NetBSD: aucc.c,v 1.44.2.1 2019/04/21 09:33:54 isaki Exp $ */
 
 /*
  * Copyright (c) 1999 Bernardo Innocenti
@@ -35,14 +35,7 @@
 
 /* TODO:
  *
- * - mu-law -> 14bit conversion
  * - channel allocation is wrong for 14bit mono
- * - convert the... err... conversion routines to 68k asm for best performance
- * 	XXX: NO. aucc audio is limited by chipmem speed, anyway. You dont
- *	want to make life difficult for amigappc work.
- *		-is
- *
- * - rely on auconv.c routines for mu-law/A-law conversions
  * - perhaps use a calibration table for better 14bit output
  * - set 31 kHz AGA video mode to allow 44.1 kHz even if grfcc is missing
  *	in the kernel
@@ -53,7 +46,7 @@
 #if NAUCC > 0
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.44 2019/03/16 12:09:56 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.44.2.1 2019/04/21 09:33:54 isaki Exp $");
 
 #include 
 #include 
@@ -65,6 +58,8 @@ __KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.4
 
 #include 
 #include 
+#include 	/* for AUDIO_MIN_FREQUENCY */
+
 #include 
 #include 
 #include 
@@ -144,48 +139,13 @@ struct audio_device aucc_device = {
 struct aucc_softc *aucc = NULL;
 
 
-unsigned char mulaw_to_lin[] = {
-	0x82, 0x86, 0x8a, 0x8e, 0x92, 0x96, 0x9a, 0x9e,
-	0xa2, 0xa6, 0xaa, 0xae, 0xb2, 0xb6, 0xba, 0xbe,
-	0xc1, 0xc3, 0xc5, 0xc7, 0xc9, 0xcb, 0xcd, 0xcf,
-	0xd1, 0xd3, 0xd5, 0xd7, 0xd9, 0xdb, 0xdd, 0xdf,
-	0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8,
-	0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0,
-	0xf0, 0xf1, 0xf1, 0xf2, 0xf2, 0xf3, 0xf3, 0xf4,
-	0xf4, 0xf5, 0xf5, 0xf6, 0xf6, 0xf7, 0xf7, 0xf8,
-	0xf8, 0xf8, 0xf9, 0xf9, 0xf9, 0xf9, 0xfa, 0xfa,
-	0xfa, 0xfa, 0xfb, 0xfb, 0xfb, 0xfb, 0xfc, 0xfc,
-	0xfc, 0xfc, 0xfc, 0xfc, 0xfd, 0xfd, 0xfd, 0xfd,
-	0xfd, 0xfd, 0xfd, 0xfd, 0xfe, 0xfe, 0xfe, 0xfe,
-	0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe,
-	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
-	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00,
-	0x7d, 0x79, 0x75, 0x71, 0x6d, 0x69, 0x65, 0x61,
-	0x5d, 0x59, 0x55, 0x51, 0x4d, 0x49, 0x45, 0x41,
-	0x3e, 0x3c, 0x3a, 0x38, 0x36, 0x34, 0x32, 0x30,
-	0x2e, 0x2c, 0x2a, 0x28, 0x26, 0x24, 0x22, 0x20,
-	0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 0x17,
-	0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f,
-	0x0f, 0x0e, 0x0e, 0x0d, 0x0d, 0x0c, 0x0c, 0x0b,
-	0x0b, 0x0a, 0x0a, 0x09, 0x09, 0x08, 0x08, 0x07,
-	0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x05, 0x05,
-	0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03,
-	0x03, 0x03, 0x03, 0x03, 0x02, 0x02, 0x02, 0x02,
-	0x02, 0x02, 0x02, 0x02, 0x01, 0x01, 0x01, 0x01,
-	0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
 /*
  * Define our interface to the higher level audio driver.
  */
 int	aucc_open(void *, int);
 void	aucc_close(void *);
 int	aucc_set_out_sr(void *, u_int);
-int	aucc_query_encoding(void *, struct audio_encoding *);
+int	aucc_query_format(void *, audio_format_query_t *);
 int	aucc_round_blocksize(void *, int, int, const audio_params_t *);
 int	aucc_commit_settings(void *);
 int	aucc_start_output(void *, void *, int, void (*)(void *), void *);
@@ -197,44 +157,24 @@ int	aucc_set_port(void *, mixer_ctrl_t *
 int	aucc_get_port(void *, mixer_ctrl_t *);
 int	aucc_query_devinfo(void *, mixer_devinfo_t *);
 void	aucc_encode(int, int, int, int, u_char *, u_short **);
-int	aucc_set_params(void *, int, int, audio_params_t *, audio_params_t *,
-			stream_filter_list_t *, stream_filter_list_t *);
+int	aucc_set_format(void *, int,
+			const audio_params_t *, const audio_params_t *,
+			audio_filter_reg_t *, audio_filter_reg_t *);
 int	aucc_get_props(void *);
 void	aucc_get_locks(void *, kmutex_t **, kmutex_t **);
 
 
-static void aucc_decode_slinear8_1ch(u_char **, u_char *, int);
-static void aucc_decode_slinear8_2ch(u_char **, u_char *, int);
-static void aucc_decode_slinear8_3ch(u_char **, u_char *, int);
-static void aucc_decode_slinear8_4ch(u_char **, u_char *, int);
-
-static void aucc_decode_ulinear8_1ch(u_char **, u_char *, int);
-static void 

CVS commit: [isaki-audio2] src/sys/arch/arm/iomd

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 09:12:34 UTC 2019

Modified Files:
src/sys/arch/arm/iomd [isaki-audio2]: vidcaudio.c

Log Message:
Adapt to audio2.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.57.2.1 src/sys/arch/arm/iomd/vidcaudio.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/iomd/vidcaudio.c
diff -u src/sys/arch/arm/iomd/vidcaudio.c:1.57 src/sys/arch/arm/iomd/vidcaudio.c:1.57.2.1
--- src/sys/arch/arm/iomd/vidcaudio.c:1.57	Sat Mar 16 12:09:56 2019
+++ src/sys/arch/arm/iomd/vidcaudio.c	Sun Apr 21 09:12:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vidcaudio.c,v 1.57 2019/03/16 12:09:56 isaki Exp $	*/
+/*	$NetBSD: vidcaudio.c,v 1.57.2.1 2019/04/21 09:12:34 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995 Melvin Tang-Richardson
@@ -65,7 +65,7 @@
 
 #include 	/* proc.h */
 
-__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.57 2019/03/16 12:09:56 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,v 1.57.2.1 2019/04/21 09:12:34 isaki Exp $");
 
 #include 
 #include/* autoconfig functions */
@@ -79,8 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: vidcaudio.c,
 
 #include 
 #include 
-#include 
-#include 
+#include 
 
 #include 
 #include 
@@ -138,19 +137,14 @@ static int vidcaudio_intr(void *);
 static void vidcaudio_rate(int);
 static void vidcaudio_ctrl(int);
 static void vidcaudio_stereo(int, int);
-static stream_filter_factory_t mulaw_to_vidc;
-static stream_filter_factory_t mulaw_to_vidc_stereo;
-static int mulaw_to_vidc_fetch_to(struct audio_softc *, stream_fetcher_t *,
-audio_stream_t *, int);
-static int mulaw_to_vidc_stereo_fetch_to(struct audio_softc *, stream_fetcher_t *,
-audio_stream_t *, int);
 
 CFATTACH_DECL_NEW(vidcaudio, sizeof(struct vidcaudio_softc),
 vidcaudio_probe, vidcaudio_attach, NULL, NULL);
 
-static intvidcaudio_query_encoding(void *, struct audio_encoding *);
-static intvidcaudio_set_params(void *, int, int, audio_params_t *,
-audio_params_t *, stream_filter_list_t *, stream_filter_list_t *);
+static intvidcaudio_query_format(void *, audio_format_query_t *);
+static intvidcaudio_set_format(void *, int,
+const audio_params_t *, const audio_params_t *,
+audio_filter_reg_t *, audio_filter_reg_t *);
 static intvidcaudio_round_blocksize(void *, int, int, const audio_params_t *);
 static intvidcaudio_trigger_output(void *, void *, void *, int,
 void (*)(void *), void *, const audio_params_t *);
@@ -173,8 +167,8 @@ static struct audio_device vidcaudio_dev
 
 static const struct audio_hw_if vidcaudio_hw_if = {
 	.close			= vidcaudio_close,
-	.query_encoding		= vidcaudio_query_encoding,
-	.set_params		= vidcaudio_set_params,
+	.query_format		= vidcaudio_query_format,
+	.set_format		= vidcaudio_set_format,
 	.round_blocksize	= vidcaudio_round_blocksize,
 	.halt_output		= vidcaudio_halt_output,
 	.halt_input		= vidcaudio_halt_input,
@@ -188,6 +182,43 @@ static const struct audio_hw_if vidcaudi
 	.get_locks		= vidcaudio_get_locks,
 };
 
+static const struct audio_format vidcaudio_formats_16bit = {
+	.mode		= AUMODE_PLAY,
+	.encoding	= AUDIO_ENCODING_SLINEAR_LE,
+	.validbits	= 16,
+	.precision	= 16,
+	.channels	= 2,
+	.channel_mask	= AUFMT_STEREO,
+	/* There are more selectable frequencies but these should be enough. */
+	.frequency_type	= 6,
+	.frequency	= {
+		19600,	/* /9 */
+		22050,	/* /8 */
+		25200,	/* /7 */
+		29400,	/* /6 */
+		35280,	/* /5 */
+		44100,	/* /4 */
+	},
+};
+static const struct audio_format vidcaudio_formats_8bit = {
+	.mode		= AUMODE_PLAY,
+	.encoding	= AUDIO_ENCODING_ULAW,
+	.validbits	= 8,
+	.precision	= 8,
+	.channels	= 2,	/* we use stereo always */
+	.channel_mask	= AUFMT_STEREO,
+	/* frequency is preferably an integer. */
+	.frequency_type	= 6,
+	.frequency	= {
+		1,	/* 50us */
+		12500,	/* 40us */
+		2,	/* 25us */
+		25000,	/* 20us */
+		31250,	/* 16us */
+		5,	/* 10us */
+	},
+};
+
 static int
 vidcaudio_probe(device_t parent, cfdata_t cf, void *aux)
 {
@@ -283,149 +314,51 @@ vidcaudio_close(void *addr)
  */
 
 static int
-vidcaudio_query_encoding(void *addr, struct audio_encoding *fp)
+vidcaudio_query_format(void *addr, audio_format_query_t *afp)
 {
 	struct vidcaudio_softc *sc;
 
 	sc = addr;
-	switch (fp->index) {
-	case 0:
-		strcpy(fp->name, AudioEmulaw);
-		fp->encoding = AUDIO_ENCODING_ULAW;
-		fp->precision = 8;
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		break;
-
-	case 1:
-		if (sc->sc_is16bit) {
-			strcpy(fp->name, AudioEslinear_le);
-			fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
-			fp->precision = 16;
-			fp->flags = 0;
-			break;
-		}
-		/* FALLTHROUGH */
-	default:
-		return EINVAL;
-	}
-	return 0;
-}
-
-#define MULAW_TO_VIDC(m) (~((m) << 1 | (m) >> 7))
-
-static stream_filter_t *
-mulaw_to_vidc(struct audio_softc *sc, const audio_params_t *from,
-	  const audio_params_t *to)
-{
-
-	return 

CVS commit: [isaki-audio2] src/sys/arch/arm/broadcom

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 08:11:27 UTC 2019

Modified Files:
src/sys/arch/arm/broadcom [isaki-audio2]: bcm2835_vcaudio.c

Log Message:
Adapt to audio2.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.2.1 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c

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

Modified files:

Index: src/sys/arch/arm/broadcom/bcm2835_vcaudio.c
diff -u src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.13 src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.13.2.1
--- src/sys/arch/arm/broadcom/bcm2835_vcaudio.c:1.13	Tue Apr  2 03:52:17 2019
+++ src/sys/arch/arm/broadcom/bcm2835_vcaudio.c	Sun Apr 21 08:11:27 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: bcm2835_vcaudio.c,v 1.13 2019/04/02 03:52:17 isaki Exp $ */
+/* $NetBSD: bcm2835_vcaudio.c,v 1.13.2.1 2019/04/21 08:11:27 isaki Exp $ */
 
 /*-
  * Copyright (c) 2013 Jared D. McNeill 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.13 2019/04/02 03:52:17 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bcm2835_vcaudio.c,v 1.13.2.1 2019/04/21 08:11:27 isaki Exp $");
 
 #include 
 #include 
@@ -43,8 +43,6 @@ __KERNEL_RCSID(0, "$NetBSD: bcm2835_vcau
 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
@@ -95,10 +93,11 @@ enum vcaudio_dest {
  * 50ms.
  */
 
-#define VCAUDIO_MSGSIZE		1600
+/* 40ms block of 16bit 48kHz stereo is 7680 bytes. */
+#define VCAUDIO_MSGSIZE		1920
 #define VCAUDIO_NUMMSGS		4
 #define VCAUDIO_BLOCKSIZE	(VCAUDIO_MSGSIZE * VCAUDIO_NUMMSGS)
-#define VCAUDIO_BUFFERSIZE	128000
+/* The driver seems to have no buffer size restrictions. */
 #define VCAUDIO_PREFILLCOUNT	2
 
 struct vcaudio_softc {
@@ -115,7 +114,6 @@ struct vcaudio_softc {
 	kcondvar_t			sc_msgcv;
 
 	struct audio_format		sc_format;
-	struct audio_encoding_set	*sc_encodings;
 
 	void(*sc_pint)(void *);
 	void*sc_pintarg;
@@ -156,12 +154,10 @@ static int	vcaudio_msg_sync(struct vcaud
 size_t);
 static void	vcaudio_worker(void *);
 
-static int	vcaudio_open(void *, int);
-static void	vcaudio_close(void *);
-static int	vcaudio_query_encoding(void *, struct audio_encoding *);
-static int	vcaudio_set_params(void *, int, int,
-audio_params_t *, audio_params_t *,
-stream_filter_list_t *, stream_filter_list_t *);
+static int	vcaudio_query_format(void *, audio_format_query_t *);
+static int	vcaudio_set_format(void *, int,
+const audio_params_t *, const audio_params_t *,
+audio_filter_reg_t *, audio_filter_reg_t *);
 static int	vcaudio_halt_output(void *);
 static int	vcaudio_halt_input(void *);
 static int	vcaudio_set_port(void *, mixer_ctrl_t *);
@@ -172,7 +168,6 @@ static int	vcaudio_get_props(void *);
 
 static int	vcaudio_round_blocksize(void *, int, int,
 const audio_params_t *);
-static size_t	vcaudio_round_buffersize(void *, int, size_t);
 
 static int	vcaudio_trigger_output(void *, void *, void *, int,
 void (*)(void *), void *, const audio_params_t *);
@@ -181,15 +176,11 @@ static int	vcaudio_trigger_input(void *,
 
 static void	vcaudio_get_locks(void *, kmutex_t **, kmutex_t **);
 
-static stream_filter_t *vcaudio_swvol_filter(struct audio_softc *,
-const audio_params_t *, const audio_params_t *);
-static void	vcaudio_swvol_dtor(stream_filter_t *);
+static void vcaudio_swvol_codec(audio_filter_arg_t *);
 
 static const struct audio_hw_if vcaudio_hw_if = {
-	.open = vcaudio_open,
-	.close = vcaudio_close,
-	.query_encoding = vcaudio_query_encoding,
-	.set_params = vcaudio_set_params,
+	.query_format = vcaudio_query_format,
+	.set_format = vcaudio_set_format,
 	.halt_output = vcaudio_halt_output,
 	.halt_input = vcaudio_halt_input,
 	.getdev = vcaudio_getdev,
@@ -198,7 +189,6 @@ static const struct audio_hw_if vcaudio_
 	.query_devinfo = vcaudio_query_devinfo,
 	.get_props = vcaudio_get_props,
 	.round_blocksize = vcaudio_round_blocksize,
-	.round_buffersize = vcaudio_round_buffersize,
 	.trigger_output = vcaudio_trigger_output,
 	.trigger_input = vcaudio_trigger_input,
 	.get_locks = vcaudio_get_locks,
@@ -295,13 +285,6 @@ vcaudio_init(struct vcaudio_softc *sc)
 	sc->sc_format.frequency[0] = 48000;
 	sc->sc_format.frequency[1] = 48000;
 
-	error = auconv_create_encodings(>sc_format, 1, >sc_encodings);
-	if (error) {
-		aprint_error_dev(sc->sc_dev,
-		"couldn't create encodings (error=%d)\n", error);
-		return error;
-	}
-
 	error = vchi_initialise(>sc_instance);
 	if (error) {
 		aprint_error_dev(sc->sc_dev,
@@ -579,41 +562,22 @@ done:
 }
 
 static int
-vcaudio_open(void *priv, int flags)
-{
-	return 0;
-}
-
-static void
-vcaudio_close(void *priv)
-{
-}
-
-static int
-vcaudio_query_encoding(void *priv, struct audio_encoding *ae)
+vcaudio_query_format(void *priv, audio_format_query_t *afp)
 {
 	struct vcaudio_softc *sc = priv;
 
-	return auconv_query_encoding(sc->sc_encodings, ae);
+	return audio_query_format(>sc_format, 1, afp);
 }
 
 static int

CVS commit: [isaki-audio2] src/sys/dev/pci

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 07:59:01 UTC 2019

Modified Files:
src/sys/dev/pci [isaki-audio2]: emuxki.c

Log Message:
Make it compilable (on this branch).
flags here is F(READ|WRITE), not AUOPEN_(READ|WRITE).


To generate a diff of this commit:
cvs rdiff -u -r1.67.2.1 -r1.67.2.2 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.67.2.1 src/sys/dev/pci/emuxki.c:1.67.2.2
--- src/sys/dev/pci/emuxki.c:1.67.2.1	Sun Apr 21 05:11:22 2019
+++ src/sys/dev/pci/emuxki.c	Sun Apr 21 07:59:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: emuxki.c,v 1.67.2.1 2019/04/21 05:11:22 isaki Exp $	*/
+/*	$NetBSD: emuxki.c,v 1.67.2.2 2019/04/21 07:59:01 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.67.2.1 2019/04/21 05:11:22 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.67.2.2 2019/04/21 07:59:01 isaki Exp $");
 
 #include 
 #include 
@@ -60,6 +60,7 @@ __KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -2043,7 +2044,7 @@ emuxki_open(void *addr, int flags)
 	 * recording source(s) which is necessary when setting recording
 	 * params This will be addressed very soon
 	 */
-	if (flags & AUOPEN_READ) {
+	if (flags & FREAD) {
 		sc->rvoice = emuxki_voice_new(sc, 0 /* EMU_VOICE_USE_RECORD */);
 		if (sc->rvoice == NULL)
 			return EBUSY;
@@ -2052,7 +2053,7 @@ emuxki_open(void *addr, int flags)
 		sc->rvoice->dataloc.source = EMU_RECSRC_ADC;
 	}
 
-	if (flags & AUOPEN_WRITE) {
+	if (flags & FWRITE) {
 		sc->pvoice = emuxki_voice_new(sc, EMU_VOICE_USE_PLAY);
 		if (sc->pvoice == NULL) {
 			if (sc->rvoice) {



CVS commit: [isaki-audio2] src/sys/dev/pci

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 07:55:25 UTC 2019

Modified Files:
src/sys/dev/pci [isaki-audio2]: eap.c

Log Message:
Adapt to audio2.
- Drop INDEPENDENT property from es1370 which has only one clock.


To generate a diff of this commit:
cvs rdiff -u -r1.99.2.1 -r1.99.2.2 src/sys/dev/pci/eap.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/eap.c
diff -u src/sys/dev/pci/eap.c:1.99.2.1 src/sys/dev/pci/eap.c:1.99.2.2
--- src/sys/dev/pci/eap.c:1.99.2.1	Sun Apr 21 05:11:22 2019
+++ src/sys/dev/pci/eap.c	Sun Apr 21 07:55:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: eap.c,v 1.99.2.1 2019/04/21 05:11:22 isaki Exp $	*/
+/*	$NetBSD: eap.c,v 1.99.2.2 2019/04/21 07:55:25 isaki Exp $	*/
 /*  $OpenBSD: eap.c,v 1.6 1999/10/05 19:24:42 csapuntz Exp $ */
 
 /*
@@ -51,7 +51,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.99.2.1 2019/04/21 05:11:22 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.99.2.2 2019/04/21 07:55:25 isaki Exp $");
 
 #include "midi.h"
 #include "joy_eap.h"
@@ -69,10 +69,8 @@ __KERNEL_RCSID(0, "$NetBSD: eap.c,v 1.99
 #include 
 
 #include 
-#include 
-#include 
-#include 
 #include 
+#include 
 
 #include 
 #include 
@@ -110,11 +108,10 @@ CFATTACH_DECL_NEW(eap, sizeof(struct eap
 eap_match, eap_attach, eap_detach, NULL);
 
 static int	eap_open(void *, int);
-static int	eap_query_encoding(void *, struct audio_encoding *);
+static int	eap_query_format(void *, struct audio_format_query *);
 static int	eap_set_params(void *, int, int, audio_params_t *,
 			   audio_params_t *, stream_filter_list_t *,
 			   stream_filter_list_t *);
-static int	eap_round_blocksize(void *, int, int, const audio_params_t *);
 static int	eap_trigger_output(void *, void *, void *, int,
    void (*)(void *), void *,
    const audio_params_t *);
@@ -133,7 +130,6 @@ static int	eap1370_query_devinfo(void *,
 static void	*eap_malloc(void *, int, size_t);
 static void	eap_free(void *, void *, size_t);
 static size_t	eap_round_buffersize(void *, int, size_t);
-static paddr_t	eap_mappage(void *, void *, off_t, int);
 static int	eap_get_props(void *);
 static void	eap1370_set_mixer(struct eap_softc *, int, int);
 static uint32_t eap1371_src_wait(struct eap_softc *);
@@ -160,9 +156,8 @@ static void	eap_uart_txrdy(struct eap_so
 
 static const struct audio_hw_if eap1370_hw_if = {
 	.open			= eap_open,
-	.query_encoding		= eap_query_encoding,
+	.query_format		= eap_query_format,
 	.set_params		= eap_set_params,
-	.round_blocksize	= eap_round_blocksize,
 	.halt_output		= eap_halt_output,
 	.halt_input		= eap_halt_input,
 	.getdev			= eap_getdev,
@@ -172,7 +167,6 @@ static const struct audio_hw_if eap1370_
 	.allocm			= eap_malloc,
 	.freem			= eap_free,
 	.round_buffersize	= eap_round_buffersize,
-	.mappage		= eap_mappage,
 	.get_props		= eap_get_props,
 	.trigger_output		= eap_trigger_output,
 	.trigger_input		= eap_trigger_input,
@@ -181,9 +175,8 @@ static const struct audio_hw_if eap1370_
 
 static const struct audio_hw_if eap1371_hw_if = {
 	.open			= eap_open,
-	.query_encoding		= eap_query_encoding,
+	.query_format		= eap_query_format,
 	.set_params		= eap_set_params,
-	.round_blocksize	= eap_round_blocksize,
 	.halt_output		= eap_halt_output,
 	.halt_input		= eap_halt_input,
 	.getdev			= eap_getdev,
@@ -193,7 +186,6 @@ static const struct audio_hw_if eap1371_
 	.allocm			= eap_malloc,
 	.freem			= eap_free,
 	.round_buffersize	= eap_round_buffersize,
-	.mappage		= eap_mappage,
 	.get_props		= eap_get_props,
 	.trigger_output		= eap_trigger_output,
 	.trigger_input		= eap_trigger_input,
@@ -945,61 +937,10 @@ eap_open(void *addr, int flags)
 }
 
 static int
-eap_query_encoding(void *addr, struct audio_encoding *fp)
+eap_query_format(void *addr, struct audio_format_query *afp)
 {
 
-	switch (fp->index) {
-	case 0:
-		strcpy(fp->name, AudioEulinear);
-		fp->encoding = AUDIO_ENCODING_ULINEAR;
-		fp->precision = 8;
-		fp->flags = 0;
-		return 0;
-	case 1:
-		strcpy(fp->name, AudioEmulaw);
-		fp->encoding = AUDIO_ENCODING_ULAW;
-		fp->precision = 8;
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		return 0;
-	case 2:
-		strcpy(fp->name, AudioEalaw);
-		fp->encoding = AUDIO_ENCODING_ALAW;
-		fp->precision = 8;
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		return 0;
-	case 3:
-		strcpy(fp->name, AudioEslinear);
-		fp->encoding = AUDIO_ENCODING_SLINEAR;
-		fp->precision = 8;
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		return 0;
-	case 4:
-		strcpy(fp->name, AudioEslinear_le);
-		fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
-		fp->precision = 16;
-		fp->flags = 0;
-		return 0;
-	case 5:
-		strcpy(fp->name, AudioEulinear_le);
-		fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
-		fp->precision = 16;
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		return 0;
-	case 6:
-		strcpy(fp->name, AudioEslinear_be);
-		fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
-		fp->precision = 

CVS commit: src/usr.sbin/sysinst

2019-04-21 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 21 07:50:59 UTC 2019

Modified Files:
src/usr.sbin/sysinst: partman.c

Log Message:
Use FOREACH_SAFE when removing devices from our internal list.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/usr.sbin/sysinst/partman.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/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.30 src/usr.sbin/sysinst/partman.c:1.31
--- src/usr.sbin/sysinst/partman.c:1.30	Tue Feb 12 18:32:15 2019
+++ src/usr.sbin/sysinst/partman.c	Sun Apr 21 07:50:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.30 2019/02/12 18:32:15 martin Exp $ */
+/*	$NetBSD: partman.c,v 1.31 2019/04/21 07:50:59 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -1998,9 +1998,9 @@ static int
 pm_clean(void)
 {
 	int count = 0;
-	pm_devs_t *pm_i;
+	pm_devs_t *pm_i, *tmp;
 
-	SLIST_FOREACH(pm_i, _head, l)
+	SLIST_FOREACH_SAFE(pm_i, _head, l, tmp)
 		if (! pm_i->found) {
 			count++;
 			SLIST_REMOVE(_head, pm_i, pm_devs_t, l);



CVS commit: [isaki-audio2] src/sys/dev/pci

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 07:49:16 UTC 2019

Modified Files:
src/sys/dev/pci [isaki-audio2]: cs4280.c cs4281.c cs428x.c cs428x.h

Log Message:
Adapt cs428x families to audio2.
- recording on cs4280 seems to have its own conversion.
  I will see it later but first make it compilable.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.71.2.1 src/sys/dev/pci/cs4280.c
cvs rdiff -u -r1.54 -r1.54.2.1 src/sys/dev/pci/cs4281.c
cvs rdiff -u -r1.18 -r1.18.14.1 src/sys/dev/pci/cs428x.c
cvs rdiff -u -r1.16 -r1.16.42.1 src/sys/dev/pci/cs428x.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/cs4280.c
diff -u src/sys/dev/pci/cs4280.c:1.71 src/sys/dev/pci/cs4280.c:1.71.2.1
--- src/sys/dev/pci/cs4280.c:1.71	Sat Mar 16 12:09:58 2019
+++ src/sys/dev/pci/cs4280.c	Sun Apr 21 07:49:16 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs4280.c,v 1.71 2019/03/16 12:09:58 isaki Exp $	*/
+/*	$NetBSD: cs4280.c,v 1.71.2.1 2019/04/21 07:49:16 isaki Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000 Tatoku Ogaito.  All rights reserved.
@@ -52,7 +52,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.71 2019/03/16 12:09:58 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1.71.2.1 2019/04/21 07:49:16 isaki Exp $");
 
 #include "midi.h"
 
@@ -70,8 +70,6 @@ __KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1
 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
@@ -90,10 +88,10 @@ __KERNEL_RCSID(0, "$NetBSD: cs4280.c,v 1
 static int  cs4280_match(device_t, cfdata_t, void *);
 static void cs4280_attach(device_t, device_t, void *);
 static int  cs4280_intr(void *);
-static int  cs4280_query_encoding(void *, struct audio_encoding *);
-static int  cs4280_set_params(void *, int, int, audio_params_t *,
-			  audio_params_t *, stream_filter_list_t *,
-			  stream_filter_list_t *);
+static int  cs4280_query_format(void *, audio_format_query_t *);
+static int  cs4280_set_format(void *, int,
+			  const audio_params_t *, const audio_params_t *,
+			  audio_filter_reg_t *, audio_filter_reg_t *);
 static int  cs4280_halt_output(void *);
 static int  cs4280_halt_input(void *);
 static int  cs4280_getdev(void *, struct audio_device *);
@@ -159,8 +157,8 @@ static const struct cs4280_card_t cs4280
 #define CS4280_CARDS_SIZE (sizeof(cs4280_cards)/sizeof(cs4280_cards[0]))
 
 static const struct audio_hw_if cs4280_hw_if = {
-	.query_encoding		= cs4280_query_encoding,
-	.set_params		= cs4280_set_params,
+	.query_format		= cs4280_query_format,
+	.set_format		= cs4280_set_format,
 	.round_blocksize	= cs428x_round_blocksize,
 	.halt_output		= cs4280_halt_output,
 	.halt_input		= cs4280_halt_input,
@@ -171,7 +169,6 @@ static const struct audio_hw_if cs4280_h
 	.allocm			= cs428x_malloc,
 	.freem			= cs428x_free,
 	.round_buffersize	= cs428x_round_buffersize,
-	.mappage		= cs428x_mappage,
 	.get_props		= cs428x_get_props,
 	.trigger_output		= cs4280_trigger_output,
 	.trigger_input		= cs4280_trigger_input,
@@ -205,6 +202,26 @@ static struct audio_device cs4280_device
 	"cs4280"
 };
 
+/*
+ * XXX recording must be 16bit stereo and sample rate range from
+ * 11025Hz to 48000Hz.  However, it looks like to work with 8000Hz,
+ * although data sheets say lower limit is 11025Hz.
+ * XXX The combination of available formats is complicated, so I use
+ * a common format only.  Please fix it if not suitable.
+ */
+static const struct audio_format cs4280_formats[] = {
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_SLINEAR_LE,
+		.validbits	= 16,
+		.precision	= 16,
+		.channels	= 2,
+		.channel_mask	= AUFMT_STEREO,
+		.frequency_type	= 0,
+		.frequency	= { 8000, 48000 },
+	}
+};
+#define CS4280_NFORMATS __arraycount(cs4280_formats)
 
 static int
 cs4280_match(device_t parent, cfdata_t match, void *aux)
@@ -550,161 +567,20 @@ cs4280_intr(void *p)
 }
 
 static int
-cs4280_query_encoding(void *addr, struct audio_encoding *fp)
+cs4280_query_format(void *addr, audio_format_query_t *afp)
 {
-	switch (fp->index) {
-	case 0:
-		strcpy(fp->name, AudioEulinear);
-		fp->encoding = AUDIO_ENCODING_ULINEAR;
-		fp->precision = 8;
-		fp->flags = 0;
-		break;
-	case 1:
-		strcpy(fp->name, AudioEmulaw);
-		fp->encoding = AUDIO_ENCODING_ULAW;
-		fp->precision = 8;
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		break;
-	case 2:
-		strcpy(fp->name, AudioEalaw);
-		fp->encoding = AUDIO_ENCODING_ALAW;
-		fp->precision = 8;
-		fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-		break;
-	case 3:
-		strcpy(fp->name, AudioEslinear);
-		fp->encoding = AUDIO_ENCODING_SLINEAR;
-		fp->precision = 8;
-		fp->flags = 0;
-		break;
-	case 4:
-		strcpy(fp->name, AudioEslinear_le);
-		fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
-		fp->precision = 16;
-		fp->flags = 0;
-		break;
-	case 5:
-		strcpy(fp->name, AudioEulinear_le);
-		fp->encoding = AUDIO_ENCODING_ULINEAR_LE;
-		fp->precision = 16;
-		

CVS commit: [isaki-audio2] src/sys/dev/ic

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 07:09:13 UTC 2019

Modified Files:
src/sys/dev/ic [isaki-audio2]: arcofi.c

Log Message:
Oops, add accidentally dropped chunks.


To generate a diff of this commit:
cvs rdiff -u -r1.1.28.2 -r1.1.28.3 src/sys/dev/ic/arcofi.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/arcofi.c
diff -u src/sys/dev/ic/arcofi.c:1.1.28.2 src/sys/dev/ic/arcofi.c:1.1.28.3
--- src/sys/dev/ic/arcofi.c:1.1.28.2	Sun Apr 21 06:55:34 2019
+++ src/sys/dev/ic/arcofi.c	Sun Apr 21 07:09:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: arcofi.c,v 1.1.28.2 2019/04/21 06:55:34 isaki Exp $	*/
+/*	$NetBSD: arcofi.c,v 1.1.28.3 2019/04/21 07:09:13 isaki Exp $	*/
 /*	$OpenBSD: arcofi.c,v 1.6 2013/05/15 08:29:24 ratchov Exp $	*/
 
 /*
@@ -195,6 +195,8 @@ static int	arcofi_cr3_to_portmask(uint, 
 static int	arcofi_gain_to_mi(uint);
 static uint	arcofi_mi_to_gain(int);
 static uint	arcofi_portmask_to_cr3(int);
+static int	arcofi_recv_data(struct arcofi_softc *);
+static int	arcofi_xmit_data(struct arcofi_softc *);
 
 static int	arcofi_open(void *, int);
 static void	arcofi_close(void *);
@@ -568,6 +570,9 @@ arcofi_start_output(void *v, void *wbuf,
 	sc->sc_xmit.cb = cb;
 	sc->sc_xmit.cbarg = cbarg;
 
+	/* Fill FIFO */
+	arcofi_xmit_data(sc);
+
 	/* enable output FIFO interrupts */
 	arcofi_write(sc, ARCOFI_FIFO_IR, arcofi_read(sc, ARCOFI_FIFO_IR) |
 	FIFO_IR_ENABLE(FIFO_IR_OUT_HALF_EMPTY));



CVS commit: [isaki-audio2] src/sys

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 06:55:34 UTC 2019

Modified Files:
src/sys/arch/hp300/dev [isaki-audio2]: arcofi_dio.c
src/sys/dev/ic [isaki-audio2]: arcofi.c arcofivar.h

Log Message:
Adapt to audio2.
- Use mulaw as default format.  HW supports slinear_be:16 actually
  but it's hard to use due to several hardware restrictions.
- Improve data transfer and interrupt.
Tested by tsutsui@ (a few months ago).  Thank you.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.1.26.1 src/sys/arch/hp300/dev/arcofi_dio.c
cvs rdiff -u -r1.1.28.1 -r1.1.28.2 src/sys/dev/ic/arcofi.c
cvs rdiff -u -r1.1 -r1.1.28.1 src/sys/dev/ic/arcofivar.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/hp300/dev/arcofi_dio.c
diff -u src/sys/arch/hp300/dev/arcofi_dio.c:1.1 src/sys/arch/hp300/dev/arcofi_dio.c:1.1.26.1
--- src/sys/arch/hp300/dev/arcofi_dio.c:1.1	Sun Aug 24 08:17:44 2014
+++ src/sys/arch/hp300/dev/arcofi_dio.c	Sun Apr 21 06:55:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: arcofi_dio.c,v 1.1 2014/08/24 08:17:44 tsutsui Exp $	*/
+/*	$NetBSD: arcofi_dio.c,v 1.1.26.1 2019/04/21 06:55:34 isaki Exp $	*/
 /*	$OpenBSD: arcofi_dio.c,v 1.1 2011/12/21 23:12:03 miod Exp $	*/
 
 /*
@@ -80,11 +80,6 @@ arcofi_dio_attach(device_t parent, devic
 		return;
 	}
 
-	sc->sc_sih = softint_establish(SOFTINT_AUDIO, arcofi_swintr, sc);
-	if (sc->sc_sih == NULL) {
-		aprint_error(": can't register soft interrupt\n");
-		return;
-	}
 	ipl = da->da_ipl;
 	dio_intr_establish(arcofi_hwintr, sc, ipl, IPL_AUDIO);
 

Index: src/sys/dev/ic/arcofi.c
diff -u src/sys/dev/ic/arcofi.c:1.1.28.1 src/sys/dev/ic/arcofi.c:1.1.28.2
--- src/sys/dev/ic/arcofi.c:1.1.28.1	Sun Apr 21 05:11:22 2019
+++ src/sys/dev/ic/arcofi.c	Sun Apr 21 06:55:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: arcofi.c,v 1.1.28.1 2019/04/21 05:11:22 isaki Exp $	*/
+/*	$NetBSD: arcofi.c,v 1.1.28.2 2019/04/21 06:55:34 isaki Exp $	*/
 /*	$OpenBSD: arcofi.c,v 1.6 2013/05/15 08:29:24 ratchov Exp $	*/
 
 /*
@@ -36,15 +36,13 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
 
 #include 
-#include 
-#include 
+#include 
 
 #include 
 
@@ -200,11 +198,10 @@ static uint	arcofi_portmask_to_cr3(int);
 
 static int	arcofi_open(void *, int);
 static void	arcofi_close(void *);
-static int	arcofi_drain(void *);
-static int	arcofi_query_encoding(void *, struct audio_encoding *);
-static int	arcofi_set_params(void *, int, int,
-		struct audio_params *, struct audio_params *,
-		stream_filter_list_t *, stream_filter_list_t *);
+static int	arcofi_query_format(void *, audio_format_query_t *);
+static int	arcofi_set_format(void *, int,
+		const audio_params_t *, const audio_params_t *,
+		audio_filter_reg_t *, audio_filter_reg_t *);
 static int	arcofi_round_blocksize(void *, int, int,
 		const audio_params_t *);
 static int	arcofi_commit_settings(void *);
@@ -224,9 +221,8 @@ static void	arcofi_get_locks(void *, kmu
 static const struct audio_hw_if arcofi_hw_if = {
 	.open		  = arcofi_open,
 	.close		  = arcofi_close,
-	.drain		  = arcofi_drain,
-	.query_encoding	  = arcofi_query_encoding,
-	.set_params	  = arcofi_set_params,
+	.query_format	  = arcofi_query_format,
+	.set_format	  = arcofi_set_format,
 	.round_blocksize  = arcofi_round_blocksize,
 	.commit_settings  = arcofi_commit_settings,
 	.start_output	  = arcofi_start_output,
@@ -250,9 +246,10 @@ static const struct audio_hw_if arcofi_h
 	.get_locks	  = arcofi_get_locks,
 };
 
-#define ARCOFI_FORMAT(enc, prec) \
+#define ARCOFI_FORMAT(prio, enc, prec) \
 	{ \
 		.mode		= AUMODE_PLAY | AUMODE_RECORD, \
+		.priority	= (prio), \
 		.encoding	= (enc), \
 		.validbits	= (prec), \
 		.precision	= (prec), \
@@ -263,18 +260,15 @@ static const struct audio_hw_if arcofi_h
 	}
 static const struct audio_format arcofi_formats[] = {
 	/*
-	 * 8-bit encodings:
-	 *  - u-Law and A-Law are native
-	 *  - linear are converted to 16-bit by auconv
+	 * 8-bit u-Law and A-Law are native.
 	 */
-	ARCOFI_FORMAT(AUDIO_ENCODING_ULAW,8),
-	ARCOFI_FORMAT(AUDIO_ENCODING_ALAW,8),
+	ARCOFI_FORMAT(1, AUDIO_ENCODING_ULAW,8),
+	ARCOFI_FORMAT(0, AUDIO_ENCODING_ALAW,8),
 	/*
-	 * 16-bit encodings:
-	 *  - slinear big-endian is native
-	 *  - unsigned or little-endian are converted by auconv
+	 * 16-bit slinear big-endian is native.
+	 * But it's hard to use due to hardware restrictions.
 	 */
-	ARCOFI_FORMAT(AUDIO_ENCODING_SLINEAR_BE, 16),
+	ARCOFI_FORMAT(0, AUDIO_ENCODING_SLINEAR_BE, 16),
 };
 #define ARCOFI_NFORMATS  __arraycount(arcofi_formats)
 
@@ -339,107 +333,60 @@ arcofi_close(void *v)
 {
 	struct arcofi_softc *sc = (struct arcofi_softc *)v;
 
-	arcofi_halt_input(v);
-	arcofi_halt_output(v);
 	sc->sc_open = 0;
 }
 
 static int
-arcofi_drain(void *v)
+arcofi_query_format(void *v, audio_format_query_t *afp)
 {
-	struct arcofi_softc *sc = (struct arcofi_softc *)v;
-

CVS commit: src/doc

2019-04-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 21 06:48:37 UTC 2019

Modified Files:
src/doc: TODO.nvmm

Log Message:
update


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/doc/TODO.nvmm

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

Modified files:

Index: src/doc/TODO.nvmm
diff -u src/doc/TODO.nvmm:1.1 src/doc/TODO.nvmm:1.2
--- src/doc/TODO.nvmm:1.1	Thu Feb 21 14:56:23 2019
+++ src/doc/TODO.nvmm	Sun Apr 21 06:48:37 2019
@@ -2,8 +2,9 @@ Known issues in NVMM, low priority in mo
 
 == KERNEL NVMM DRIVER ==
 
- * Currently you can't modunload NVMM while a VM is running, otherwise you hit
-   a panic. See TODO in nvmm_fini().
+ * 32bit-PAE guests can misbehave on Intel, because we need to manually
+   install the PDPTEs, and currently we don't do it. In practice they don't
+   misbehave because the emulator never has to interfere with CR3.
 
  * Maybe we will want a way to return to userland when the guest TPR changes.
On Intel that's not complicated, but on old AMD CPUs, we need to disassemble



CVS commit: src/doc

2019-04-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 21 06:46:03 UTC 2019

Modified Files:
src/doc: CHANGES

Log Message:
Note removal of COMPAT_OSF1.


To generate a diff of this commit:
cvs rdiff -u -r1.2526 -r1.2527 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2526 src/doc/CHANGES:1.2527
--- src/doc/CHANGES:1.2526	Sat Apr 20 17:25:14 2019
+++ src/doc/CHANGES	Sun Apr 21 06:46:03 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2526 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2527 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -347,6 +347,7 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	mdocml: Import 1.14.5. [christos 20190310]
 	OpenSSL: Imported 1.1.1b. [christos 20190312]
 	ssdfb(4): Added driver for SSD1306 & SH1106 displays [tnn 20190317]
+	kernel: Remove COMPAT_OSF1. [maxv 20190325]
 	tzdata Updated to 2019a. [kre 20190326]
 	evbarm: Add UEFI bootloader support (bootarm.efi). [jmcneill 20190330]
 	indent(1): Upgraded to the FreeBSD HEAD checkout [kamil 20190404]



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

2019-04-21 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 21 06:37:21 UTC 2019

Modified Files:
src/sys/arch/x86/x86: bus_dma.c db_memrw.c kgdb_machdep.c svs.c
x86_tlb.c

Log Message:
Rename the PTE bits.


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/x86/x86/bus_dma.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/x86/x86/db_memrw.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x86/x86/kgdb_machdep.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/x86/x86/svs.c
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/x86/x86_tlb.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/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.77 src/sys/arch/x86/x86/bus_dma.c:1.78
--- src/sys/arch/x86/x86/bus_dma.c:1.77	Mon Jul 31 19:29:19 2017
+++ src/sys/arch/x86/x86/bus_dma.c	Sun Apr 21 06:37:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.77 2017/07/31 19:29:19 jdolecek Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.78 2019/04/21 06:37:21 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.77 2017/07/31 19:29:19 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.78 2019/04/21 06:37:21 maxv Exp $");
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -1176,8 +1176,8 @@ _bus_dmamem_unmap(bus_dma_tag_t t, void 
 	for (va = sva; va < eva; va += PAGE_SIZE) {
 		pte = kvtopte(va);
 		opte = *pte;
-		if ((opte & PG_N) != 0)
-			pmap_pte_clearbits(pte, PG_N);
+		if ((opte & PTE_PCD) != 0)
+			pmap_pte_clearbits(pte, PTE_PCD);
 	}
 	pmap_remove(pmap_kernel(), (vaddr_t)kva, (vaddr_t)kva + size);
 	pmap_update(pmap_kernel());

Index: src/sys/arch/x86/x86/db_memrw.c
diff -u src/sys/arch/x86/x86/db_memrw.c:1.10 src/sys/arch/x86/x86/db_memrw.c:1.11
--- src/sys/arch/x86/x86/db_memrw.c:1.10	Sat Mar  9 08:42:26 2019
+++ src/sys/arch/x86/x86/db_memrw.c	Sun Apr 21 06:37:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_memrw.c,v 1.10 2019/03/09 08:42:26 maxv Exp $	*/
+/*	$NetBSD: db_memrw.c,v 1.11 2019/04/21 06:37:21 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2000 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.10 2019/03/09 08:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_memrw.c,v 1.11 2019/04/21 06:37:21 maxv Exp $");
 
 #include 
 #include 
@@ -159,7 +159,7 @@ db_write_text(vaddr_t addr, size_t size,
 		 * with this mapping and subtract it from the
 		 * total size.
 		 */
-		if (pte & PG_PS)
+		if (pte & PTE_PS)
 			limit = NBPD_L2 - (addr & (NBPD_L2 - 1));
 		else
 			limit = PAGE_SIZE - (addr & PGOFSET);

Index: src/sys/arch/x86/x86/kgdb_machdep.c
diff -u src/sys/arch/x86/x86/kgdb_machdep.c:1.4 src/sys/arch/x86/x86/kgdb_machdep.c:1.5
--- src/sys/arch/x86/x86/kgdb_machdep.c:1.4	Sat Mar  9 08:42:26 2019
+++ src/sys/arch/x86/x86/kgdb_machdep.c	Sun Apr 21 06:37:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kgdb_machdep.c,v 1.4 2019/03/09 08:42:26 maxv Exp $	*/
+/*	$NetBSD: kgdb_machdep.c,v 1.5 2019/04/21 06:37:21 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997, 2017 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.4 2019/03/09 08:42:26 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kgdb_machdep.c,v 1.5 2019/04/21 06:37:21 maxv Exp $");
 
 #include "opt_ddb.h"
 
@@ -93,8 +93,8 @@ kgdb_acc(vaddr_t va, size_t len)
 			pte = kvtopte(va);
 		if ((*pte & PTE_P) == 0)
 			return 0;
-		if (*pte & PG_PS)
-			va = (va & PG_LGFRAME) + NBPD_L2;
+		if (*pte & PTE_PS)
+			va = (va & PTE_LGFRAME) + NBPD_L2;
 		else
 			va += PAGE_SIZE;
 	} while (va < last_va);

Index: src/sys/arch/x86/x86/svs.c
diff -u src/sys/arch/x86/x86/svs.c:1.24 src/sys/arch/x86/x86/svs.c:1.25
--- src/sys/arch/x86/x86/svs.c:1.24	Sat Mar 23 10:02:05 2019
+++ src/sys/arch/x86/x86/svs.c	Sun Apr 21 06:37:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: svs.c,v 1.24 2019/03/23 10:02:05 maxv Exp $	*/
+/*	$NetBSD: svs.c,v 1.25 2019/04/21 06:37:21 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.24 2019/03/23 10:02:05 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: svs.c,v 1.25 2019/04/21 06:37:21 maxv Exp $");
 
 #include "opt_svs.h"
 
@@ -259,7 +259,7 @@ svs_tree_add(struct cpu_info *ci, vaddr_
 			dstpde[pidx] = PTE_P | PTE_W | pa;
 		}
 
-		pa = (paddr_t)(dstpde[pidx] & PG_FRAME);
+		pa = (paddr_t)(dstpde[pidx] & PTE_FRAME);
 		dstpde = (pd_entry_t *)PMAP_DIRECT_MAP(pa);
 	}
 
@@ -287,10 +287,10 @@ svs_page_add(struct cpu_info *ci, vaddr_
 	if (!pmap_valid_entry(srcpde[idx])) {
 		panic("%s: L2 page not mapped", __func__);
 	}
-	if (srcpde[idx] & PG_PS) {
-		pa = srcpde[idx] & PG_2MFRAME;
+	if (srcpde[idx] & PTE_PS) {
+		pa = srcpde[idx] & PTE_2MFRAME;
 		pa += (paddr_t)(va % NBPD_L2);
-		pde = (srcpde[idx] & 

CVS commit: [isaki-audio2] src/sys/dev/isa

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 06:17:03 UTC 2019

Modified Files:
src/sys/dev/isa [isaki-audio2]: sbdsp.c

Log Message:
Not yet fully adapted to audio2 but make it compilable.
- Drop FULLDUPLEX property.  It is done in a tricky way.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.139.2.1 src/sys/dev/isa/sbdsp.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/isa/sbdsp.c
diff -u src/sys/dev/isa/sbdsp.c:1.139 src/sys/dev/isa/sbdsp.c:1.139.2.1
--- src/sys/dev/isa/sbdsp.c:1.139	Sun Feb  3 03:19:27 2019
+++ src/sys/dev/isa/sbdsp.c	Sun Apr 21 06:17:02 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sbdsp.c,v 1.139 2019/02/03 03:19:27 mrg Exp $	*/
+/*	$NetBSD: sbdsp.c,v 1.139.2.1 2019/04/21 06:17:02 isaki Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2008 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.139 2019/02/03 03:19:27 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.139.2.1 2019/04/21 06:17:02 isaki Exp $");
 
 #include "midi.h"
 #include "mpu.h"
@@ -96,8 +96,6 @@ __KERNEL_RCSID(0, "$NetBSD: sbdsp.c,v 1.
 #include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
@@ -412,9 +410,8 @@ sbdsp_attach(struct sbdsp_softc *sc)
 	   SBVER_MAJOR(sc->sc_version), SBVER_MINOR(sc->sc_version),
 	   sc->sc_model == SB_JAZZ ? ": " : "");
 
-	sc->sc_fullduplex = ISSB16CLASS(sc) &&
-	sc->sc_drq8 != -1 && sc->sc_drq16 != -1 &&
-	sc->sc_drq8 != sc->sc_drq16;
+	/* XXX It's not true full duplex. */
+	sc->sc_fullduplex = 0;
 
 	if (sc->sc_drq8 != -1) {
 		sc->sc_drq8_maxsize = isa_dmamaxsize(sc->sc_ic,
@@ -574,12 +571,10 @@ sbdsp_set_params(
 	struct sbdsp_softc *sc;
 	struct sbmode *m;
 	u_int rate, tc, bmode;
-	stream_filter_factory_t *swcode;
 	int model;
 	int chan;
 	struct audio_params *p;
-	audio_params_t hw;
-	stream_filter_list_t *fil;
+	audio_params_t hw __unused;
 	int mode;
 
 	sc = addr;
@@ -627,55 +622,17 @@ sbdsp_set_params(
 		if (m->model == -1)
 			return EINVAL;
 		rate = p->sample_rate;
-		swcode = NULL;
-		fil = mode ==  AUMODE_PLAY ? pfil : rfil;
 		hw = *p;
 		tc = 1;
 		bmode = -1;
 		if (model == SB_16) {
 			switch (p->encoding) {
-			case AUDIO_ENCODING_SLINEAR_BE:
-if (p->precision == 16) {
-	hw.encoding = AUDIO_ENCODING_SLINEAR_LE;
-	swcode = swap_bytes;
-}
 /* FALLTHROUGH */
 			case AUDIO_ENCODING_SLINEAR:
 			case AUDIO_ENCODING_SLINEAR_LE:
 bmode = SB_BMODE_SIGNED;
 break;
 
-			case AUDIO_ENCODING_ULINEAR_BE:
-if (p->precision == 16) {
-	hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
-	swcode = swap_bytes;
-}
-/* FALLTHROUGH */
-			case AUDIO_ENCODING_ULINEAR_LE:
-bmode = SB_BMODE_UNSIGNED;
-break;
-
-			case AUDIO_ENCODING_ULAW:
-hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
-if (mode == AUMODE_PLAY) {
-	hw.precision = hw.validbits = 16;
-	swcode = mulaw_to_linear16;
-	m = [PLAY16];
-} else
-	swcode = linear8_to_mulaw;
-bmode = SB_BMODE_UNSIGNED;
-break;
-
-			case AUDIO_ENCODING_ALAW:
-hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
-if (mode == AUMODE_PLAY) {
-	hw.precision = hw.validbits = 16;
-	swcode = alaw_to_linear16;
-	m = [PLAY16];
-} else
-	swcode = linear8_to_alaw;
-bmode = SB_BMODE_UNSIGNED;
-break;
 			default:
 return EINVAL;
 			}
@@ -686,28 +643,6 @@ sbdsp_set_params(
 			case AUDIO_ENCODING_SLINEAR:
 			case AUDIO_ENCODING_SLINEAR_LE:
 break;
-			case AUDIO_ENCODING_ULINEAR_LE:
-hw.encoding = AUDIO_ENCODING_SLINEAR_LE;
-swcode = change_sign16;
-break;
-			case AUDIO_ENCODING_SLINEAR_BE:
-hw.encoding = AUDIO_ENCODING_SLINEAR_LE;
-swcode = swap_bytes;
-break;
-			case AUDIO_ENCODING_ULINEAR_BE:
-hw.encoding = AUDIO_ENCODING_SLINEAR_LE;
-swcode = swap_bytes_change_sign16;
-break;
-			case AUDIO_ENCODING_ULAW:
-hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
-swcode = mode == AUMODE_PLAY ?
-	mulaw_to_linear8 : linear8_to_mulaw;
-break;
-			case AUDIO_ENCODING_ALAW:
-hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
-swcode = mode == AUMODE_PLAY ?
-	alaw_to_linear8 : linear8_to_alaw;
-break;
 			default:
 return EINVAL;
 			}
@@ -715,32 +650,7 @@ sbdsp_set_params(
 			p->sample_rate = SB_TC_TO_RATE(tc) / p->channels;
 			hw.sample_rate = p->sample_rate;
 		} else {
-			switch (p->encoding) {
-			case AUDIO_ENCODING_SLINEAR_BE:
-			case AUDIO_ENCODING_SLINEAR_LE:
-			case AUDIO_ENCODING_SLINEAR:
-hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
-swcode = change_sign8;
-break;
-			case AUDIO_ENCODING_ULINEAR_BE:
-			case AUDIO_ENCODING_ULINEAR_LE:
-break;
-			case AUDIO_ENCODING_ULAW:
-hw.encoding = AUDIO_ENCODING_ULINEAR_LE;
-swcode = mode == AUMODE_PLAY ?
-	mulaw_to_linear8 : linear8_to_mulaw;
-break;
-			case AUDIO_ENCODING_ALAW:
-hw.encoding = 

CVS commit: [isaki-audio2] src/sys/dev/isa

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 06:09:01 UTC 2019

Modified Files:
src/sys/dev/isa [isaki-audio2]: aria.c

Log Message:
Adapt to audio2.
- Drop FULLDUPLEX property.  The driver doesn't seem to be written
  as full duplex.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/dev/isa/aria.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/isa/aria.c
diff -u src/sys/dev/isa/aria.c:1.39 src/sys/dev/isa/aria.c:1.39.2.1
--- src/sys/dev/isa/aria.c:1.39	Sat Mar 16 12:09:58 2019
+++ src/sys/dev/isa/aria.c	Sun Apr 21 06:09:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: aria.c,v 1.39 2019/03/16 12:09:58 isaki Exp $	*/
+/*	$NetBSD: aria.c,v 1.39.2.1 2019/04/21 06:09:01 isaki Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1996, 1998 The NetBSD Foundation, Inc.
@@ -36,12 +36,7 @@
  *  o   Look into where aria_prometheus_kludge() belongs.
  *  o   Add some DMA code.  It accomplishes its goal by
  *  direct IO at the moment.
- *  o   Different programs should be able to open the device
- *  with O_RDONLY and O_WRONLY at the same time.  But I
- *  do not see support for this in /sys/dev/audio.c, so
  *	I cannot effectively code it.
- *  o   We should nicely deal with the cards that can do mu-law
- *  and A-law output.
  *  o   Rework the mixer interface.
  *   o   Deal with the lvls better.  We need to do better mapping
  *   between logarithmic scales and the one byte that
@@ -50,7 +45,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.39 2019/03/16 12:09:58 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.39.2.1 2019/04/21 06:09:01 isaki Exp $");
 
 #include 
 #include 
@@ -66,8 +61,6 @@ __KERNEL_RCSID(0, "$NetBSD: aria.c,v 1.3
 #include 
 
 #include 
-#include 
-#include 
 
 #include 
 #include 
@@ -147,12 +140,13 @@ void	aria_do_kludge(bus_space_tag_t, bus
 		   u_short, u_short, u_short, u_short);
 void	aria_prometheus_kludge(struct isa_attach_args *, bus_space_handle_t);
 
-int	aria_query_encoding(void *, struct audio_encoding *);
+int	aria_query_format(void *, audio_format_query_t *);
 int	aria_round_blocksize(void *, int, int, const audio_params_t *);
 int	aria_speaker_ctl(void *, int);
 int	aria_commit_settings(void *);
-int	aria_set_params(void *, int, int, audio_params_t *, audio_params_t *,
-			stream_filter_list_t *, stream_filter_list_t *);
+int	aria_set_format(void *, int,
+			const audio_params_t *, const audio_params_t *,
+			audio_filter_reg_t *, audio_filter_reg_t *);
 int	aria_get_props(void *);
 void	aria_get_locks(void *, kmutex_t **, kmutex_t **);
 
@@ -196,6 +190,24 @@ struct audio_device aria_device = {
 	"aria"
 };
 
+#define ARIA_FORMAT(enc, prec) \
+	{ \
+		.mode		= AUMODE_PLAY | AUMODE_RECORD, \
+		.encoding	= (enc), \
+		.validbits	= (prec), \
+		.precision	= (prec), \
+		.channels	= 2, \
+		.channel_mask	= AUFMT_STEREO, \
+		.frequency_type	= 6, \
+		.frequency	= { 7875, 11025, 15750, 22050, 31500, 44100 }, \
+	}
+/* XXX Some models seem to support mulaw/alaw.  */
+const struct audio_format aria_formats[] = {
+	ARIA_FORMAT(AUDIO_ENCODING_ULINEAR, 8),
+	ARIA_FORMAT(AUDIO_ENCODING_SLINEAR_LE, 16),
+};
+#define ARIA_NFORMATS __arraycount(aria_formats)
+
 /*
  * Define our interface to the higher level audio driver.
  */
@@ -203,8 +215,8 @@ struct audio_device aria_device = {
 const struct audio_hw_if aria_hw_if = {
 	.open			= ariaopen,
 	.close			= ariaclose,
-	.query_encoding		= aria_query_encoding,
-	.set_params		= aria_set_params,
+	.query_format		= aria_query_format,
+	.set_format		= aria_set_format,
 	.round_blocksize	= aria_round_blocksize,
 	.commit_settings	= aria_commit_settings,
 	.start_output		= aria_start_output,
@@ -500,68 +512,10 @@ aria_getdev(void *addr, struct audio_dev
  */
 
 int
-aria_query_encoding(void *addr, struct audio_encoding *fp)
+aria_query_format(void *addr, audio_format_query_t *afp)
 {
-	struct aria_softc *sc;
 
-	sc = addr;
-	switch (fp->index) {
-		case 0:
-			strcpy(fp->name, AudioEmulaw);
-			fp->encoding = AUDIO_ENCODING_ULAW;
-			fp->precision = 8;
-			if ((ARIA_MODEL>sc_hardware) == 0)
-fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-			break;
-		case 1:
-			strcpy(fp->name, AudioEalaw);
-			fp->encoding = AUDIO_ENCODING_ALAW;
-			fp->precision = 8;
-			if ((ARIA_MODEL>sc_hardware) == 0)
-fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-			break;
-		case 2:
-			strcpy(fp->name, AudioEslinear);
-			fp->encoding = AUDIO_ENCODING_SLINEAR;
-			fp->precision = 8;
-			fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-			break;
-		case 3:
-			strcpy(fp->name, AudioEslinear_le);
-			fp->encoding = AUDIO_ENCODING_SLINEAR_LE;
-			fp->precision = 16;
-			fp->flags = 0;
-			break;
-		case 4:
-			strcpy(fp->name, AudioEslinear_be);
-			fp->encoding = AUDIO_ENCODING_SLINEAR_BE;
-			fp->precision = 16;
-			fp->flags = AUDIO_ENCODINGFLAG_EMULATED;
-			break;
-		case 5:
-			

CVS commit: [isaki-audio2] src/sys

2019-04-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 21 06:00:00 UTC 2019

Modified Files:
src/sys/arch/amiga/dev [isaki-audio2]: toccata.c
src/sys/arch/prep/isa [isaki-audio2]: paud_isa.c
src/sys/dev/ebus [isaki-audio2]: cs4231_ebus.c
src/sys/dev/ic [isaki-audio2]: ad1848.c ad1848var.h interwave.c
interwavevar.h
src/sys/dev/isa [isaki-audio2]: gus.c wss.c ym.c
src/sys/dev/isapnp [isaki-audio2]: gus_isapnp.c
src/sys/dev/sbus [isaki-audio2]: cs4231_sbus.c

Log Message:
Adapt ad1848/cs4231 families to audio2.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.18.2.1 src/sys/arch/amiga/dev/toccata.c
cvs rdiff -u -r1.17 -r1.17.2.1 src/sys/arch/prep/isa/paud_isa.c
cvs rdiff -u -r1.38 -r1.38.2.1 src/sys/dev/ebus/cs4231_ebus.c
cvs rdiff -u -r1.31 -r1.31.54.1 src/sys/dev/ic/ad1848.c
cvs rdiff -u -r1.18 -r1.18.54.1 src/sys/dev/ic/ad1848var.h
cvs rdiff -u -r1.40 -r1.40.2.1 src/sys/dev/ic/interwave.c
cvs rdiff -u -r1.18 -r1.18.42.1 src/sys/dev/ic/interwavevar.h
cvs rdiff -u -r1.115 -r1.115.2.1 src/sys/dev/isa/gus.c
cvs rdiff -u -r1.72 -r1.72.2.1 src/sys/dev/isa/wss.c
cvs rdiff -u -r1.45 -r1.45.2.1 src/sys/dev/isa/ym.c
cvs rdiff -u -r1.39 -r1.39.2.1 src/sys/dev/isapnp/gus_isapnp.c
cvs rdiff -u -r1.51 -r1.51.2.1 src/sys/dev/sbus/cs4231_sbus.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/amiga/dev/toccata.c
diff -u src/sys/arch/amiga/dev/toccata.c:1.18 src/sys/arch/amiga/dev/toccata.c:1.18.2.1
--- src/sys/arch/amiga/dev/toccata.c:1.18	Sat Mar 16 12:09:56 2019
+++ src/sys/arch/amiga/dev/toccata.c	Sun Apr 21 05:59:59 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: toccata.c,v 1.18 2019/03/16 12:09:56 isaki Exp $ */
+/* $NetBSD: toccata.c,v 1.18.2.1 2019/04/21 05:59:59 isaki Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.18 2019/03/16 12:09:56 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: toccata.c,v 1.18.2.1 2019/04/21 05:59:59 isaki Exp $");
 
 #include 
 #include 
@@ -185,8 +185,8 @@ const struct audio_hw_if audiocs_hw_if =
 	 * sample data, otherwise up to 1024.
 	 */
 	.drain			= NULL,
-	.query_encoding		= ad1848_query_encoding,
-	.set_params		= ad1848_set_params,
+	.query_format		= ad1848_query_format,
+	.set_format		= ad1848_set_format,
 	.round_blocksize	= toccata_round_blocksize,
 	.commit_settings	= ad1848_commit_settings,
 	.init_output		= NULL,	/* XXX need this to prefill? */

Index: src/sys/arch/prep/isa/paud_isa.c
diff -u src/sys/arch/prep/isa/paud_isa.c:1.17 src/sys/arch/prep/isa/paud_isa.c:1.17.2.1
--- src/sys/arch/prep/isa/paud_isa.c:1.17	Sat Mar 16 12:09:57 2019
+++ src/sys/arch/prep/isa/paud_isa.c	Sun Apr 21 05:59:59 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: paud_isa.c,v 1.17 2019/03/16 12:09:57 isaki Exp $	*/
+/*	$NetBSD: paud_isa.c,v 1.17.2.1 2019/04/21 05:59:59 isaki Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: paud_isa.c,v 1.17 2019/03/16 12:09:57 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: paud_isa.c,v 1.17.2.1 2019/04/21 05:59:59 isaki Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -96,8 +96,8 @@ static int paud_query_devinfo(void *, mi
 static const struct audio_hw_if paud_hw_if = {
 	.open			= ad1848_isa_open,
 	.close			= ad1848_isa_close,
-	.query_encoding		= ad1848_query_encoding,
-	.set_params		= ad1848_set_params,
+	.query_format		= ad1848_query_format,
+	.set_format		= ad1848_set_format,
 	.round_blocksize	= ad1848_round_blocksize,
 	.commit_settings	= ad1848_commit_settings,
 	.halt_output		= ad1848_isa_halt_output,
@@ -109,7 +109,6 @@ static const struct audio_hw_if paud_hw_
 	.allocm			= ad1848_isa_malloc,
 	.freem			= ad1848_isa_free,
 	.round_buffersize	= ad1848_isa_round_buffersize,
-	.mappage		= ad1848_isa_mappage,
 	.get_props		= ad1848_isa_get_props,
 	.trigger_output		= ad1848_isa_trigger_output,
 	.trigger_input		= ad1848_isa_trigger_input,

Index: src/sys/dev/ebus/cs4231_ebus.c
diff -u src/sys/dev/ebus/cs4231_ebus.c:1.38 src/sys/dev/ebus/cs4231_ebus.c:1.38.2.1
--- src/sys/dev/ebus/cs4231_ebus.c:1.38	Sat Mar 16 12:09:57 2019
+++ src/sys/dev/ebus/cs4231_ebus.c	Sun Apr 21 06:00:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cs4231_ebus.c,v 1.38 2019/03/16 12:09:57 isaki Exp $ */
+/*	$NetBSD: cs4231_ebus.c,v 1.38.2.1 2019/04/21 06:00:00 isaki Exp $ */
 
 /*
  * Copyright (c) 2002 Valeriy E. Ushakov
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cs4231_ebus.c,v 1.38 2019/03/16 12:09:57 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cs4231_ebus.c,v 1.38.2.1 2019/04/21 06:00:00 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sparc_arch.h"
@@ -98,8 +98,8 @@ static int	cs4231_ebus_halt_input(void *
 const struct audio_hw_if audiocs_ebus_hw_if = {
 	.open			= cs4231_open,
 	.close			= cs4231_close,
-