Source-Changes-HG archive

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

[src/trunk]: src/sys/modules/emuxki emuxki(4): allow building as a module



details:   https://anonhg.NetBSD.org/src/rev/037c51efe957
branches:  trunk
changeset: 369898:037c51efe957
user:      khorben <khorben%NetBSD.org@localhost>
date:      Wed Sep 07 00:29:23 2022 +0000

description:
emuxki(4): allow building as a module

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

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

Additional sound cards sponsored by the NetBSD Foundation; thanks!

diffstat:

 distrib/sets/lists/modules/md.amd64 |   4 ++-
 distrib/sets/lists/modules/md.i386  |   4 ++-
 sys/arch/i386/conf/MODULAR          |   3 +-
 sys/dev/pci/emuxki.c                |  42 +++++++++++++++++++++++++++++++-----
 sys/modules/Makefile                |   3 +-
 sys/modules/emuxki/Makefile         |   8 +++++++
 sys/modules/emuxki/Makefile.inc     |  10 ++++++++
 sys/modules/emuxki/emuxki.ioconf    |  10 ++++++++
 8 files changed, 74 insertions(+), 10 deletions(-)

diffs (180 lines):

diff -r ffe7ff18a847 -r 037c51efe957 distrib/sets/lists/modules/md.amd64
--- a/distrib/sets/lists/modules/md.amd64       Tue Sep 06 23:14:28 2022 +0000
+++ b/distrib/sets/lists/modules/md.amd64       Wed Sep 07 00:29:23 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.96 2022/08/05 08:48:36 riastradh Exp $
+# $NetBSD: md.amd64,v 1.97 2022/09/07 00:29:23 khorben Exp $
 #
 ./@MODULEDIR@/acpiacad                         modules-base-kernel     kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod           modules-base-kernel     kmod
@@ -134,6 +134,8 @@
 ./@MODULEDIR@/dtrace_syscall_netbsd32/dtrace_syscall_netbsd32.kmod     modules-base-kernel     kmod,dtrace
 ./@MODULEDIR@/emdtv                            modules-base-kernel     kmod
 ./@MODULEDIR@/emdtv/emdtv.kmod                 modules-base-kernel     kmod
+./@MODULEDIR@/emuxki                           modules-base-kernel     kmod
+./@MODULEDIR@/emuxki/emuxki.kmod               modules-base-kernel     kmod
 ./@MODULEDIR@/est                              modules-base-kernel     kmod
 ./@MODULEDIR@/est/est.kmod                     modules-base-kernel     kmod
 ./@MODULEDIR@/exec_elf32                       modules-base-kernel     kmod
diff -r ffe7ff18a847 -r 037c51efe957 distrib/sets/lists/modules/md.i386
--- a/distrib/sets/lists/modules/md.i386        Tue Sep 06 23:14:28 2022 +0000
+++ b/distrib/sets/lists/modules/md.i386        Wed Sep 07 00:29:23 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.94 2022/08/05 08:48:36 riastradh Exp $
+# $NetBSD: md.i386,v 1.95 2022/09/07 00:29:23 khorben Exp $
 #
 ./@MODULEDIR@/acpiacad                         modules-base-kernel     kmod
 ./@MODULEDIR@/acpiacad/acpiacad.kmod           modules-base-kernel     kmod
@@ -86,6 +86,8 @@
 ./@MODULEDIR@/dtrace_syscall_linux/dtrace_syscall_linux.kmod   modules-base-kernel     kmod,dtrace
 ./@MODULEDIR@/emdtv                            modules-base-kernel     kmod
 ./@MODULEDIR@/emdtv/emdtv.kmod                 modules-base-kernel     kmod
+./@MODULEDIR@/emuxki                           modules-base-kernel     kmod
+./@MODULEDIR@/emuxki/emuxki.kmod               modules-base-kernel     kmod
 ./@MODULEDIR@/est                              modules-base-kernel     kmod
 ./@MODULEDIR@/est/est.kmod                     modules-base-kernel     kmod
 ./@MODULEDIR@/exec_aout                                modules-base-kernel     kmod
diff -r ffe7ff18a847 -r 037c51efe957 sys/arch/i386/conf/MODULAR
--- a/sys/arch/i386/conf/MODULAR        Tue Sep 06 23:14:28 2022 +0000
+++ b/sys/arch/i386/conf/MODULAR        Wed Sep 07 00:29:23 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: MODULAR,v 1.9 2021/08/17 22:00:29 andvar Exp $
+# $NetBSD: MODULAR,v 1.10 2022/09/07 00:29:23 khorben Exp $
 #
 # MODULAR kernel
 # This kernel config prefers loading kernel drivers from file system.
@@ -54,6 +54,7 @@
 no uvideo*
 no pseye*
 
+no emuxki*
 no hdaudio*
 no hdafg*
 
diff -r ffe7ff18a847 -r 037c51efe957 sys/dev/pci/emuxki.c
--- a/sys/dev/pci/emuxki.c      Tue Sep 06 23:14:28 2022 +0000
+++ b/sys/dev/pci/emuxki.c      Wed Sep 07 00:29:23 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emuxki.c,v 1.72 2022/08/29 09:04:27 khorben Exp $      */
+/*     $NetBSD: emuxki.c,v 1.73 2022/09/07 00:29:23 khorben Exp $      */
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -38,10 +38,11 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.72 2022/08/29 09:04:27 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emuxki.c,v 1.73 2022/09/07 00:29:23 khorben Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
+#include <sys/module.h>
 #include <sys/errno.h>
 #include <sys/systm.h>
 #include <sys/audioio.h>
@@ -164,10 +165,10 @@
        void                    (*pintr)(void *);
        void                    *pintrarg;
        audio_params_t          play;
-       int                     pframesize;
-       int                     pblksize;
-       int                     plength;
-       int                     poffset;
+       uint32_t                pframesize;
+       uint32_t                pblksize;
+       uint32_t                plength;
+       uint32_t                poffset;
 
        struct dmamem           *rmem;          /* rec internal memory */
        void                    (*rintr)(void *);
@@ -1431,3 +1432,32 @@
 
        return AC97_HOST_SWAPPED_CHANNELS;
 }
+
+MODULE(MODULE_CLASS_DRIVER, emuxki, "pci,audio");
+
+#ifdef _MODULE
+#include "ioconf.c"
+#endif
+
+static int
+emuxki_modcmd(modcmd_t cmd, void *opaque)
+{
+       int error = 0;
+
+       switch (cmd) {
+       case MODULE_CMD_INIT:
+#ifdef _MODULE
+               error = config_init_component(cfdriver_ioconf_emuxki,
+                   cfattach_ioconf_emuxki, cfdata_ioconf_emuxki);
+#endif
+               return error;
+       case MODULE_CMD_FINI:
+#ifdef _MODULE
+               error = config_fini_component(cfdriver_ioconf_emuxki,
+                   cfattach_ioconf_emuxki, cfdata_ioconf_emuxki);
+#endif
+               return error;
+       default:
+               return ENOTTY;
+       }
+}
diff -r ffe7ff18a847 -r 037c51efe957 sys/modules/Makefile
--- a/sys/modules/Makefile      Tue Sep 06 23:14:28 2022 +0000
+++ b/sys/modules/Makefile      Wed Sep 07 00:29:23 2022 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.269 2022/07/28 22:00:23 riastradh Exp $
+#      $NetBSD: Makefile,v 1.270 2022/09/07 00:29:23 khorben Exp $
 
 .include <bsd.own.mk>
 
@@ -225,6 +225,7 @@
 SUBDIR+=       amdtemp
 SUBDIR+=       amdzentemp
 SUBDIR+=       coretemp
+SUBDIR+=       emuxki
 SUBDIR+=       est
 SUBDIR+=       hdafg
 SUBDIR+=       hdaudio
diff -r ffe7ff18a847 -r 037c51efe957 sys/modules/emuxki/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/emuxki/Makefile       Wed Sep 07 00:29:23 2022 +0000
@@ -0,0 +1,8 @@
+#      $NetBSD: Makefile,v 1.1 2022/09/07 00:29:23 khorben Exp $
+
+.include "../Makefile.inc"
+.include "${.CURDIR}/Makefile.inc"
+
+KMOD=  emuxki
+
+.include <bsd.kmodule.mk>
diff -r ffe7ff18a847 -r 037c51efe957 sys/modules/emuxki/Makefile.inc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/emuxki/Makefile.inc   Wed Sep 07 00:29:23 2022 +0000
@@ -0,0 +1,10 @@
+#      $NetBSD: Makefile.inc,v 1.1 2022/09/07 00:29:23 khorben Exp $
+
+# This file is used by modules and rump kernels
+
+IOCONFDIR:=    ${.PARSEDIR}
+
+.PATH: ${NETBSDSRCDIR}/sys/dev/pci ${IOCONFDIR}
+
+IOCONF=        emuxki.ioconf
+SRCS+= emuxki.c
diff -r ffe7ff18a847 -r 037c51efe957 sys/modules/emuxki/emuxki.ioconf
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/modules/emuxki/emuxki.ioconf  Wed Sep 07 00:29:23 2022 +0000
@@ -0,0 +1,10 @@
+#      $NetBSD: emuxki.ioconf,v 1.1 2022/09/07 00:29:23 khorben Exp $
+
+ioconf emuxki
+
+include "conf/files"
+include "dev/pci/files.pci"
+
+pseudo-root pci*
+
+emuxki* at pci? dev ? function ?



Home | Main Index | Thread Index | Old Index