Module Name: src
Committed By: martin
Date: Sat Mar 21 15:31:51 UTC 2020
Modified Files:
src/sys/arch/amiga/dev [netbsd-9]: aucc.c
src/sys/dev/pci [netbsd-9]: auacer.c auich.c auixp.c auvia.c
gcscaudio.c
src/sys/dev/sbus [netbsd-9]: dbri.c
Log Message:
Pull up following revision(s) (requested by isaki in ticket #792):
sys/arch/amiga/dev/aucc.c: revision 1.48
sys/dev/pci/auixp.c: revision 1.49
sys/dev/pci/gcscaudio.c: revision 1.19
sys/dev/pci/auich.c: revision 1.159
sys/dev/sbus/dbri.c: revision 1.42
sys/dev/pci/auvia.c: revision 1.85
sys/dev/pci/auacer.c: revision 1.39
Drop 512 bytes limit on auvia_round_blocksize().
This fixes attach on 6 channels device.
PR kern/55017.
round_blocksize must return a multiple of the framesize.
aucc(4) supports 3 channels mode.
round_blocksize must return a multiple of the framesize
even if passed blocksize is greater than the upper limit.
round_blocksize must return a multiple of the framesize.
It's not divisible when blk=GCSCAUDI_PRD_SIZE_MAX and channels=4.
round_blocksize must return a multiple of the framesize
even if 6 channels mode.
I believe that keeping "good alignment" is just a wish, not constraint.
To generate a diff of this commit:
cvs rdiff -u -r1.46.2.1 -r1.46.2.2 src/sys/arch/amiga/dev/aucc.c
cvs rdiff -u -r1.38 -r1.38.2.1 src/sys/dev/pci/auacer.c
cvs rdiff -u -r1.157 -r1.157.2.1 src/sys/dev/pci/auich.c
cvs rdiff -u -r1.47 -r1.47.2.1 src/sys/dev/pci/auixp.c
cvs rdiff -u -r1.84 -r1.84.2.1 src/sys/dev/pci/auvia.c
cvs rdiff -u -r1.18 -r1.18.2.1 src/sys/dev/pci/gcscaudio.c
cvs rdiff -u -r1.41 -r1.41.2.1 src/sys/dev/sbus/dbri.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.46.2.1 src/sys/arch/amiga/dev/aucc.c:1.46.2.2
--- src/sys/arch/amiga/dev/aucc.c:1.46.2.1 Sat Sep 7 18:04:48 2019
+++ src/sys/arch/amiga/dev/aucc.c Sat Mar 21 15:31:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: aucc.c,v 1.46.2.1 2019/09/07 18:04:48 snj Exp $ */
+/* $NetBSD: aucc.c,v 1.46.2.2 2020/03/21 15:31:50 martin Exp $ */
/*
* Copyright (c) 1999 Bernardo Innocenti
@@ -46,7 +46,7 @@
#if NAUCC > 0
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.46.2.1 2019/09/07 18:04:48 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aucc.c,v 1.46.2.2 2020/03/21 15:31:50 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -404,8 +404,11 @@ aucc_round_blocksize(void *addr, int blk
int mode, const audio_params_t *param)
{
- /* round up to even size */
- return blk > AUDIO_BUF_SIZE ? AUDIO_BUF_SIZE : blk;
+ if (blk > AUDIO_BUF_SIZE)
+ blk = AUDIO_BUF_SIZE;
+
+ blk = rounddown(blk, param->channels * param->precision / NBBY);
+ return blk;
}
int
Index: src/sys/dev/pci/auacer.c
diff -u src/sys/dev/pci/auacer.c:1.38 src/sys/dev/pci/auacer.c:1.38.2.1
--- src/sys/dev/pci/auacer.c:1.38 Sat Jun 8 08:02:38 2019
+++ src/sys/dev/pci/auacer.c Sat Mar 21 15:31:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: auacer.c,v 1.38 2019/06/08 08:02:38 isaki Exp $ */
+/* $NetBSD: auacer.c,v 1.38.2.1 2020/03/21 15:31:50 martin Exp $ */
/*-
* Copyright (c) 2004, 2008 The NetBSD Foundation, Inc.
@@ -44,7 +44,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.38 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auacer.c,v 1.38.2.1 2020/03/21 15:31:50 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -154,8 +154,6 @@ static int auacer_query_format(void *, a
static int auacer_set_format(void *, int,
const audio_params_t *, const audio_params_t *,
audio_filter_reg_t *, audio_filter_reg_t *);
-static int auacer_round_blocksize(void *, int, int,
- const audio_params_t *);
static int auacer_halt_output(void *);
static int auacer_halt_input(void *);
static int auacer_getdev(void *, struct audio_device *);
@@ -188,7 +186,6 @@ static void auacer_reset(struct auacer_s
static const struct audio_hw_if auacer_hw_if = {
.query_format = auacer_query_format,
.set_format = auacer_set_format,
- .round_blocksize = auacer_round_blocksize,
.halt_output = auacer_halt_output,
.halt_input = auacer_halt_input,
.getdev = auacer_getdev,
@@ -562,14 +559,6 @@ auacer_set_format(void *v, int setmode,
return 0;
}
-static int
-auacer_round_blocksize(void *v, int blk, int mode,
- const audio_params_t *param)
-{
-
- return blk & ~0x3f; /* keep good alignment */
-}
-
static void
auacer_halt(struct auacer_softc *sc, struct auacer_chan *chan)
{
Index: src/sys/dev/pci/auich.c
diff -u src/sys/dev/pci/auich.c:1.157 src/sys/dev/pci/auich.c:1.157.2.1
--- src/sys/dev/pci/auich.c:1.157 Sat Jun 8 08:02:38 2019
+++ src/sys/dev/pci/auich.c Sat Mar 21 15:31:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: auich.c,v 1.157 2019/06/08 08:02:38 isaki Exp $ */
+/* $NetBSD: auich.c,v 1.157.2.1 2020/03/21 15:31:50 martin Exp $ */
/*-
* Copyright (c) 2000, 2004, 2005, 2008 The NetBSD Foundation, Inc.
@@ -111,7 +111,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.157 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auich.c,v 1.157.2.1 2020/03/21 15:31:50 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -259,7 +259,6 @@ static int auich_query_format(void *, st
static int auich_set_format(void *, int,
const audio_params_t *, const audio_params_t *,
audio_filter_reg_t *, audio_filter_reg_t *);
-static int auich_round_blocksize(void *, int, int, const audio_params_t *);
static void auich_halt_pipe(struct auich_softc *, int);
static int auich_halt_output(void *);
static int auich_halt_input(void *);
@@ -304,7 +303,6 @@ static const struct audio_hw_if auich_hw
.close = auich_close,
.query_format = auich_query_format,
.set_format = auich_set_format,
- .round_blocksize = auich_round_blocksize,
.halt_output = auich_halt_output,
.halt_input = auich_halt_input,
.getdev = auich_getdev,
@@ -1053,17 +1051,6 @@ auich_set_format(void *v, int setmode,
return 0;
}
-static int
-auich_round_blocksize(void *v, int blk, int mode,
- const audio_params_t *param)
-{
-
- if (blk < 0x40)
- return 0x40; /* avoid 0 block size */
-
- return blk & ~0x3f; /* keep good alignment */
-}
-
static void
auich_halt_pipe(struct auich_softc *sc, int pipe)
{
Index: src/sys/dev/pci/auixp.c
diff -u src/sys/dev/pci/auixp.c:1.47 src/sys/dev/pci/auixp.c:1.47.2.1
--- src/sys/dev/pci/auixp.c:1.47 Sat Jun 8 08:02:38 2019
+++ src/sys/dev/pci/auixp.c Sat Mar 21 15:31:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: auixp.c,v 1.47 2019/06/08 08:02:38 isaki Exp $ */
+/* $NetBSD: auixp.c,v 1.47.2.1 2020/03/21 15:31:50 martin Exp $ */
/*
* Copyright (c) 2004, 2005 Reinoud Zandijk <[email protected]>
@@ -50,7 +50,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.47 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auixp.c,v 1.47.2.1 2020/03/21 15:31:50 martin Exp $");
#include <sys/types.h>
#include <sys/errno.h>
@@ -429,16 +429,13 @@ static int
auixp_round_blocksize(void *hdl, int bs, int mode,
const audio_params_t *param)
{
- uint32_t new_bs;
- new_bs = bs;
- /* Be conservative; align to 32 bytes and maximise it to 64 kb */
/* 256 kb possible */
- if (new_bs > 0x10000)
+ if (bs > 0x10000)
bs = 0x10000; /* 64 kb max */
- new_bs = (bs & ~0x20); /* 32 bytes align */
+ bs = rounddown(bs, param->channels * param->precision / NBBY);
- return new_bs;
+ return bs;
}
Index: src/sys/dev/pci/auvia.c
diff -u src/sys/dev/pci/auvia.c:1.84 src/sys/dev/pci/auvia.c:1.84.2.1
--- src/sys/dev/pci/auvia.c:1.84 Sat Jun 8 08:02:38 2019
+++ src/sys/dev/pci/auvia.c Sat Mar 21 15:31:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: auvia.c,v 1.84 2019/06/08 08:02:38 isaki Exp $ */
+/* $NetBSD: auvia.c,v 1.84.2.1 2020/03/21 15:31:50 martin Exp $ */
/*-
* Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.84 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.84.2.1 2020/03/21 15:31:50 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -749,8 +749,7 @@ auvia_round_blocksize(void *addr, int bl
if (sc->sc_flags & AUVIA_FLAGS_VT8233 && blk < 288)
blk = 288;
- /* Avoid too many dma_ops. */
- return uimin((blk & -32), AUVIA_MINBLKSZ);
+ return (blk & -32);
}
static int
Index: src/sys/dev/pci/gcscaudio.c
diff -u src/sys/dev/pci/gcscaudio.c:1.18 src/sys/dev/pci/gcscaudio.c:1.18.2.1
--- src/sys/dev/pci/gcscaudio.c:1.18 Sat Jun 8 08:02:38 2019
+++ src/sys/dev/pci/gcscaudio.c Sat Mar 21 15:31:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: gcscaudio.c,v 1.18 2019/06/08 08:02:38 isaki Exp $ */
+/* $NetBSD: gcscaudio.c,v 1.18.2.1 2020/03/21 15:31:50 martin Exp $ */
/*-
* Copyright (c) 2008 SHIMIZU Ryo <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: gcscaudio.c,v 1.18 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: gcscaudio.c,v 1.18.2.1 2020/03/21 15:31:50 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -549,9 +549,10 @@ static int
gcscaudio_round_blocksize(void *arg, int blk, int mode,
const audio_params_t *param)
{
- blk &= -4;
+
if (blk > GCSCAUDIO_PRD_SIZE_MAX)
blk = GCSCAUDIO_PRD_SIZE_MAX;
+ blk = rounddown(blk, param->channels * param->precision / NBBY);
return blk;
}
Index: src/sys/dev/sbus/dbri.c
diff -u src/sys/dev/sbus/dbri.c:1.41 src/sys/dev/sbus/dbri.c:1.41.2.1
--- src/sys/dev/sbus/dbri.c:1.41 Sat Jun 8 08:02:38 2019
+++ src/sys/dev/sbus/dbri.c Sat Mar 21 15:31:51 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dbri.c,v 1.41 2019/06/08 08:02:38 isaki Exp $ */
+/* $NetBSD: dbri.c,v 1.41.2.1 2020/03/21 15:31:51 martin Exp $ */
/*
* Copyright (C) 1997 Rudolf Koenig ([email protected])
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.41 2019/06/08 08:02:38 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dbri.c,v 1.41.2.1 2020/03/21 15:31:51 martin Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -1636,8 +1636,8 @@ dbri_round_blocksize(void *hdl, int bs,
const audio_params_t *param)
{
- if (bs > 0x1fff)
- return 0x1fff;
+ if (bs > 0x1ffc)
+ return 0x1ffc;
return bs;
}