Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/sys Pull up following revision(s) (requested by isaki in ...



details:   https://anonhg.NetBSD.org/src/rev/111104144ffc
branches:  netbsd-9
changeset: 746077:111104144ffc
user:      martin <martin%NetBSD.org@localhost>
date:      Sat Mar 21 15:31:50 2020 +0000

description:
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.

diffstat:

 sys/arch/amiga/dev/aucc.c |  11 +++++++----
 sys/dev/pci/auacer.c      |  15 ++-------------
 sys/dev/pci/auich.c       |  17 ++---------------
 sys/dev/pci/auixp.c       |  13 +++++--------
 sys/dev/pci/auvia.c       |   7 +++----
 sys/dev/pci/gcscaudio.c   |   7 ++++---
 sys/dev/sbus/dbri.c       |   8 ++++----
 7 files changed, 27 insertions(+), 51 deletions(-)

diffs (259 lines):

diff -r 7f3d35faa1d0 -r 111104144ffc sys/arch/amiga/dev/aucc.c
--- a/sys/arch/amiga/dev/aucc.c Sat Mar 21 15:27:40 2020 +0000
+++ b/sys/arch/amiga/dev/aucc.c Sat Mar 21 15:31:50 2020 +0000
@@ -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 @@
                     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
diff -r 7f3d35faa1d0 -r 111104144ffc sys/dev/pci/auacer.c
--- a/sys/dev/pci/auacer.c      Sat Mar 21 15:27:40 2020 +0000
+++ b/sys/dev/pci/auacer.c      Sat Mar 21 15:31:50 2020 +0000
@@ -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_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 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 @@
        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)
 {
diff -r 7f3d35faa1d0 -r 111104144ffc sys/dev/pci/auich.c
--- a/sys/dev/pci/auich.c       Sat Mar 21 15:27:40 2020 +0000
+++ b/sys/dev/pci/auich.c       Sat Mar 21 15:31:50 2020 +0000
@@ -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_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 @@
        .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 @@
        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)
 {
diff -r 7f3d35faa1d0 -r 111104144ffc sys/dev/pci/auixp.c
--- a/sys/dev/pci/auixp.c       Sat Mar 21 15:27:40 2020 +0000
+++ b/sys/dev/pci/auixp.c       Sat Mar 21 15:31:50 2020 +0000
@@ -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 <reinoud%netbsd.org@localhost>
@@ -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 @@
 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;
 }
 
 
diff -r 7f3d35faa1d0 -r 111104144ffc sys/dev/pci/auvia.c
--- a/sys/dev/pci/auvia.c       Sat Mar 21 15:27:40 2020 +0000
+++ b/sys/dev/pci/auvia.c       Sat Mar 21 15:31:50 2020 +0000
@@ -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 @@
        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
diff -r 7f3d35faa1d0 -r 111104144ffc sys/dev/pci/gcscaudio.c
--- a/sys/dev/pci/gcscaudio.c   Sat Mar 21 15:27:40 2020 +0000
+++ b/sys/dev/pci/gcscaudio.c   Sat Mar 21 15:31:50 2020 +0000
@@ -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 <ryo%nerv.org@localhost>
@@ -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 @@
 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;
 }
diff -r 7f3d35faa1d0 -r 111104144ffc sys/dev/sbus/dbri.c
--- a/sys/dev/sbus/dbri.c       Sat Mar 21 15:27:40 2020 +0000
+++ b/sys/dev/sbus/dbri.c       Sat Mar 21 15:31:50 2020 +0000
@@ -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 (rfkoenig%immd4.informatik.uni-erlangen.de@localhost)
@@ -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 @@
                        const audio_params_t *param)
 {
 
-       if (bs > 0x1fff)
-               return 0x1fff;
+       if (bs > 0x1ffc)
+               return 0x1ffc;
        return bs;
 }
 



Home | Main Index | Thread Index | Old Index