Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci/hdaudio Pull out the device list and auto-genera...
details: https://anonhg.NetBSD.org/src/rev/1bed8eb9e116
branches: trunk
changeset: 332389:1bed8eb9e116
user: christos <christos%NetBSD.org@localhost>
date: Fri Sep 19 17:23:35 2014 +0000
description:
Pull out the device list and auto-generate it.
diffstat:
sys/dev/pci/hdaudio/Makefile.hdaudiodevs | 18 ++
sys/dev/pci/hdaudio/files.hdaudio | 6 +-
sys/dev/pci/hdaudio/hdafg.c | 24 +-
sys/dev/pci/hdaudio/hdaudio.c | 46 ++++-
sys/dev/pci/hdaudio/hdaudio_ids.c | 273 -------------------------------
sys/dev/pci/hdaudio/hdaudio_ids.h | 50 -----
sys/dev/pci/hdaudio/hdaudio_verbose.c | 113 ++++++++++++
sys/dev/pci/hdaudio/hdaudio_verbose.h | 45 +++++
sys/dev/pci/hdaudio/hdaudiodevs | 245 +++++++++++++++++++++++++++
9 files changed, 480 insertions(+), 340 deletions(-)
diffs (truncated from 924 to 300 lines):
diff -r fb2f7ffe56b9 -r 1bed8eb9e116 sys/dev/pci/hdaudio/Makefile.hdaudiodevs
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/dev/pci/hdaudio/Makefile.hdaudiodevs Fri Sep 19 17:23:35 2014 +0000
@@ -0,0 +1,18 @@
+# $NetBSD: Makefile.hdaudiodevs,v 1.1 2014/09/19 17:23:35 christos Exp $
+
+# The header files depend on the correct version of hdaudiodevs.
+#
+# Thus, the procedure is:
+# 1) change hdaudiodevs
+# 2) commit hdaudiodevs
+# 3) _then_ generate header files
+# 4) commit them
+
+.include <bsd.own.mk>
+
+UNAME= uname
+RM= rm
+
+hdaudiodevs.h hdaudiodevs_data.h: hdaudiodevs devlist2h.awk
+ ${RM} -f hdaudiodevs.h hdaudiodevs_data.h
+ ${TOOL_AWK} -v os=`${UNAME} -s` -f devlist2h.awk hdaudiodevs
diff -r fb2f7ffe56b9 -r 1bed8eb9e116 sys/dev/pci/hdaudio/files.hdaudio
--- a/sys/dev/pci/hdaudio/files.hdaudio Fri Sep 19 17:23:23 2014 +0000
+++ b/sys/dev/pci/hdaudio/files.hdaudio Fri Sep 19 17:23:35 2014 +0000
@@ -1,12 +1,12 @@
-# $NetBSD: files.hdaudio,v 1.5 2011/02/12 15:15:34 jmcneill Exp $
+# $NetBSD: files.hdaudio,v 1.6 2014/09/19 17:23:35 christos Exp $
#
# Intel High Definition Audio (Revision 1.0)
#
define hdaudiobus {[nid = -1]}
device hdaudio: hdaudiobus
-file dev/pci/hdaudio/hdaudio.c hdaudio
-file dev/pci/hdaudio/hdaudio_ids.c hdaudio
+file dev/pci/hdaudio/hdaudio.c hdaudio
+file dev/pci/hdaudio/hdaudio_verbose.c hdaudio & hdaudioverbose
device hdafg: audiobus, auconv, aurateconv, mulaw
attach hdafg at hdaudiobus
diff -r fb2f7ffe56b9 -r 1bed8eb9e116 sys/dev/pci/hdaudio/hdafg.c
--- a/sys/dev/pci/hdaudio/hdafg.c Fri Sep 19 17:23:23 2014 +0000
+++ b/sys/dev/pci/hdaudio/hdafg.c Fri Sep 19 17:23:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.21 2014/05/23 13:57:04 msaitoh Exp $ */
+/* $NetBSD: hdafg.c,v 1.22 2014/09/19 17:23:35 christos Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.21 2014/05/23 13:57:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.22 2014/09/19 17:23:35 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -82,7 +82,8 @@
#include "hdaudioreg.h"
#include "hdaudio_mixer.h"
#include "hdaudioio.h"
-#include "hdaudio_ids.h"
+#include "hdaudio_verbose.h"
+#include "hdaudiodevs.h"
#include "hdafg_dd.h"
#include "hdmireg.h"
@@ -685,7 +686,7 @@
w->w_waspin = false;
switch (sc->sc_vendor) {
- case HDA_VENDOR_ANALOG_DEVICES:
+ case HDAUDIO_VENDOR_ANALOG:
/*
* help the parser by marking the analog
* beeper as a beep generator
@@ -3612,10 +3613,9 @@
prop_dictionary_get_uint16(args, "vendor-id", &sc->sc_vendor);
prop_dictionary_get_uint16(args, "product-id", &sc->sc_product);
- hdaudio_id2name(sc->sc_vendor, HDA_PRODUCT_ANY,
- vendor, sizeof(vendor));
- hdaudio_id2name(sc->sc_vendor, sc->sc_product,
- product, sizeof(product));
+ get_hdaudio_vendor(vendor, sizeof(vendor), sc->sc_vendor);
+ get_hdaudio_product(product, sizeof(product), sc->sc_vendor,
+ sc->sc_product);
hda_print1(sc, ": %s %s%s\n", vendor, product,
sc->sc_config ? " (custom configuration)" : "");
@@ -3965,10 +3965,10 @@
struct hdaudio_audiodev *ad = opaque;
struct hdafg_softc *sc = ad->ad_sc;
- hdaudio_id2name(sc->sc_vendor, HDA_PRODUCT_ANY,
- audiodev->name, sizeof(audiodev->name));
- hdaudio_id2name(sc->sc_vendor, sc->sc_product,
- audiodev->version, sizeof(audiodev->version));
+ get_hdaudio_vendor(audiodev->name, sizeof(audiodev->name),
+ sc->sc_vendor);
+ get_hdaudio_product(audiodev->version, sizeof(audiodev->version),
+ sc->sc_vendor, sc->sc_product);
snprintf(audiodev->config, sizeof(audiodev->config) - 1,
"%02Xh", sc->sc_nid);
diff -r fb2f7ffe56b9 -r 1bed8eb9e116 sys/dev/pci/hdaudio/hdaudio.c
--- a/sys/dev/pci/hdaudio/hdaudio.c Fri Sep 19 17:23:23 2014 +0000
+++ b/sys/dev/pci/hdaudio/hdaudio.c Fri Sep 19 17:23:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudio.c,v 1.22 2014/07/25 08:10:38 dholland Exp $ */
+/* $NetBSD: hdaudio.c,v 1.23 2014/09/19 17:23:35 christos Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.22 2014/07/25 08:10:38 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdaudio.c,v 1.23 2014/09/19 17:23:35 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -44,6 +44,7 @@
#include "hdaudiovar.h"
#include "hdaudioreg.h"
#include "hdaudioio.h"
+#include "hdaudio_verbose.h"
/* #define HDAUDIO_DEBUG */
@@ -1629,3 +1630,44 @@
return ENOTTY;
}
}
+
+void hdaudio_load_verbose(void);
+
+void get_hdaudio_vendor_stub(char *, size_t, hdaudio_vendor_id_t);
+void get_hdaudio_product_stub(char *, size_t, hdaudio_vendor_id_t,
+ hdaudio_product_id_t);
+
+void (*get_hdaudio_vendor)(char *, size_t, hdaudio_vendor_id_t) =
+ get_hdaudio_vendor_stub;
+void (*get_hdaudio_product)(char *, size_t, hdaudio_vendor_id_t,
+ hdaudio_product_id_t) = get_hdaudio_product_stub;
+
+int hdaudio_verbose_loaded = 0;
+
+/*
+ * Load the hdaudioverbose module
+ */
+void hdaudio_load_verbose(void)
+{
+ if (hdaudio_verbose_loaded == 0)
+ module_autoload("hdaudioverbose", MODULE_CLASS_MISC);
+}
+
+void get_hdaudio_vendor_stub(char *v, size_t l, hdaudio_vendor_id_t v_id)
+{
+ hdaudio_load_verbose();
+ if (hdaudio_verbose_loaded)
+ get_hdaudio_vendor(v, l, v_id);
+ else
+ snprintf(v, l, "vendor 0x%.4x", v_id);
+}
+
+void get_hdaudio_product_stub(char *p, size_t l, hdaudio_vendor_id_t v_id,
+ hdaudio_product_id_t p_id)
+{
+ hdaudio_load_verbose();
+ if (hdaudio_verbose_loaded)
+ get_hdaudio_product(p, l, v_id, p_id);
+ else
+ snprintf(p, l, "product 0x%.4x", p_id);
+}
diff -r fb2f7ffe56b9 -r 1bed8eb9e116 sys/dev/pci/hdaudio/hdaudio_ids.c
--- a/sys/dev/pci/hdaudio/hdaudio_ids.c Fri Sep 19 17:23:23 2014 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,273 +0,0 @@
-/* $NetBSD: hdaudio_ids.c,v 1.8 2014/04/07 21:35:41 njoly Exp $ */
-
-/*
- * Copyright (c) 2010 Jared D. McNeill <jmcneill%invisible.ca@localhost>
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Precedence Technologies Ltd
- *
- * 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. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * 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 <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdaudio_ids.c,v 1.8 2014/04/07 21:35:41 njoly Exp $");
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-
-#include "hdaudio_ids.h"
-
-static const struct hdaudio_id {
- uint16_t vendor;
- uint16_t product;
- const char *name;
-} hdaudio_ids[] = {
- /* ATI */
- { HDA_VENDOR_ATI, 0x7919, "RS600 HDMI" },
- { HDA_VENDOR_ATI, 0x793c, "RS600 HDMI" },
- { HDA_VENDOR_ATI, 0x791a, "RS690/780 HDMI" },
- { HDA_VENDOR_ATI, 0xaa01, "R6xx HDMI" },
- { HDA_VENDOR_ATI, HDA_PRODUCT_ANY, "ATI" },
- /* NVIDIA */
- { HDA_VENDOR_NVIDIA, 0x0002, "MCP77/78 HDMI" },
- { HDA_VENDOR_NVIDIA, 0x0003, "MCP77/78 HDMI" },
- { HDA_VENDOR_NVIDIA, 0x0005, "MCP77/78 HDMI" },
- { HDA_VENDOR_NVIDIA, 0x0006, "MCP77/78 HDMI" },
- { HDA_VENDOR_NVIDIA, 0x0007, "MCP79/7A HDMI" },
- { HDA_VENDOR_NVIDIA, 0x000a, "GT220 HDMI" },
- { HDA_VENDOR_NVIDIA, 0x000b, "GT21x HDMI" },
- { HDA_VENDOR_NVIDIA, 0x000c, "MCP89 HDMI" },
- { HDA_VENDOR_NVIDIA, 0x000d, "GT240 HDMI" },
- { HDA_VENDOR_NVIDIA, 0x0015, "GT5xx HDMI/DP" }, /* ??? GTX 550 Ti */
- { HDA_VENDOR_NVIDIA, 0x0067, "MCP67 HDMI" },
- { HDA_VENDOR_NVIDIA, 0x8001, "MCP73 HDMI" },
- { HDA_VENDOR_NVIDIA, HDA_PRODUCT_ANY, "NVIDIA" },
- /* Realtek */
- { HDA_VENDOR_REALTEK, 0x0260, "ALC260" },
- { HDA_VENDOR_REALTEK, 0x0262, "ALC262" },
- { HDA_VENDOR_REALTEK, 0x0267, "ALC267" },
- { HDA_VENDOR_REALTEK, 0x0268, "ALC268" },
- { HDA_VENDOR_REALTEK, 0x0269, "ALC269" },
- { HDA_VENDOR_REALTEK, 0x0270, "ALC270" },
- { HDA_VENDOR_REALTEK, 0x0272, "ALC272" },
- { HDA_VENDOR_REALTEK, 0x0275, "ALC275" },
- { HDA_VENDOR_REALTEK, 0x0660, "ALC660-VD" },
- { HDA_VENDOR_REALTEK, 0x0662, "ALC662" },
- { HDA_VENDOR_REALTEK, 0x0663, "ALC663" },
- { HDA_VENDOR_REALTEK, 0x0670, "ALC670" },
- { HDA_VENDOR_REALTEK, 0x0861, "ALC861" },
- { HDA_VENDOR_REALTEK, 0x0862, "ALC861-VD" },
- { HDA_VENDOR_REALTEK, 0x0880, "ALC880" },
- { HDA_VENDOR_REALTEK, 0x0882, "ALC882" },
- { HDA_VENDOR_REALTEK, 0x0883, "ALC883" },
- { HDA_VENDOR_REALTEK, 0x0885, "ALC885" },
- { HDA_VENDOR_REALTEK, 0x0887, "ALC887" },
- { HDA_VENDOR_REALTEK, 0x0888, "ALC888" },
- { HDA_VENDOR_REALTEK, 0x0889, "ALC889" },
- { HDA_VENDOR_REALTEK, 0x0892, "ALC892" },
- { HDA_VENDOR_REALTEK, HDA_PRODUCT_ANY, "Realtek" },
- /* VIA */
- { HDA_VENDOR_VIA, 0x1708, "VT1708" },
- { HDA_VENDOR_VIA, 0x1709, "VT1708" },
- { HDA_VENDOR_VIA, 0x170a, "VT1708" },
- { HDA_VENDOR_VIA, 0x170b, "VT1708" },
- { HDA_VENDOR_VIA, 0xe710, "VT1709 10ch" },
- { HDA_VENDOR_VIA, 0xe711, "VT1709 10ch" },
- { HDA_VENDOR_VIA, 0xe712, "VT1709 10ch" },
- { HDA_VENDOR_VIA, 0xe713, "VT1709 10ch" },
- { HDA_VENDOR_VIA, 0xe714, "VT1709 6ch" },
- { HDA_VENDOR_VIA, 0xe715, "VT1709 6ch" },
- { HDA_VENDOR_VIA, 0xe716, "VT1709 6ch" },
- { HDA_VENDOR_VIA, 0xe717, "VT1709 6ch" },
- { HDA_VENDOR_VIA, 0xe720, "VT1708B 8ch" },
- { HDA_VENDOR_VIA, 0xe721, "VT1708B 8ch" },
- { HDA_VENDOR_VIA, 0xe722, "VT1708B 8ch" },
- { HDA_VENDOR_VIA, 0xe723, "VT1708B 8ch" },
- { HDA_VENDOR_VIA, 0xe724, "VT1708B 4ch" },
- { HDA_VENDOR_VIA, 0xe725, "VT1708B 4ch" },
- { HDA_VENDOR_VIA, 0xe726, "VT1708B 4ch" },
- { HDA_VENDOR_VIA, 0xe727, "VT1708B 4ch" },
- { HDA_VENDOR_VIA, 0x0397, "VT1708S" },
- { HDA_VENDOR_VIA, 0x1397, "VT1708S" },
- { HDA_VENDOR_VIA, 0x2397, "VT1708S" },
- { HDA_VENDOR_VIA, 0x3397, "VT1708S" },
- { HDA_VENDOR_VIA, 0x4397, "VT1708S" },
- { HDA_VENDOR_VIA, 0x5397, "VT1708S" },
- { HDA_VENDOR_VIA, 0x6397, "VT1708S" },
- { HDA_VENDOR_VIA, 0x7397, "VT1708S" },
Home |
Main Index |
Thread Index |
Old Index