Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/hdaudio Replace the HDAUDIO_32BIT_ACCESS option with...
details: https://anonhg.NetBSD.org/src/rev/3ea93ab260e7
branches: trunk
changeset: 962564:3ea93ab260e7
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Thu Jul 25 00:30:45 2019 +0000
description:
Replace the HDAUDIO_32BIT_ACCESS option with a runtime option. Set it for
tegra_hdaudio, but not for the pci attachment. Add hdaudio@pci to GENERIC64
diffstat:
sys/arch/arm/nvidia/tegra_hdaudio.c | 5 +-
sys/arch/evbarm/conf/GENERIC | 3 +-
sys/arch/evbarm/conf/GENERIC64 | 4 +-
sys/dev/hdaudio/files.hdaudio | 3 +-
sys/dev/hdaudio/hdaudiovar.h | 69 ++++++++++++++++++++----------------
5 files changed, 46 insertions(+), 38 deletions(-)
diffs (195 lines):
diff -r 67e802247860 -r 3ea93ab260e7 sys/arch/arm/nvidia/tegra_hdaudio.c
--- a/sys/arch/arm/nvidia/tegra_hdaudio.c Thu Jul 25 00:02:55 2019 +0000
+++ b/sys/arch/arm/nvidia/tegra_hdaudio.c Thu Jul 25 00:30:45 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_hdaudio.c,v 1.10 2018/07/16 23:11:47 christos Exp $ */
+/* $NetBSD: tegra_hdaudio.c,v 1.11 2019/07/25 00:30:45 jmcneill Exp $ */
/*-
* Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_hdaudio.c,v 1.10 2018/07/16 23:11:47 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_hdaudio.c,v 1.11 2019/07/25 00:30:45 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -156,6 +156,7 @@
size - TEGRA_HDAUDIO_OFFSET, &sc->sc.sc_memh);
sc->sc.sc_memvalid = true;
sc->sc.sc_dmat = faa->faa_dmat;
+ sc->sc.sc_flags = HDAUDIO_FLAG_32BIT;
aprint_naive("\n");
aprint_normal(": HDA\n");
diff -r 67e802247860 -r 3ea93ab260e7 sys/arch/evbarm/conf/GENERIC
--- a/sys/arch/evbarm/conf/GENERIC Thu Jul 25 00:02:55 2019 +0000
+++ b/sys/arch/evbarm/conf/GENERIC Thu Jul 25 00:30:45 2019 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: GENERIC,v 1.44 2019/07/23 12:32:40 jmcneill Exp $
+# $NetBSD: GENERIC,v 1.45 2019/07/25 00:30:45 jmcneill Exp $
#
# GENERIC ARM (aarch32) kernel
#
@@ -507,7 +507,6 @@
hdaudio* at fdt? # Intel HDA
hdafg* at hdaudiobus?
options HDAUDIOVERBOSE
-options HDAUDIO_32BIT_ACCESS
options HDAUDIO_ENABLE_HDMI
options HDAUDIO_ENABLE_DISPLAYPORT
sun8icodec* at fdt? # Audio codec (sun8i)
diff -r 67e802247860 -r 3ea93ab260e7 sys/arch/evbarm/conf/GENERIC64
--- a/sys/arch/evbarm/conf/GENERIC64 Thu Jul 25 00:02:55 2019 +0000
+++ b/sys/arch/evbarm/conf/GENERIC64 Thu Jul 25 00:30:45 2019 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: GENERIC64,v 1.102 2019/07/16 09:47:41 jmcneill Exp $
+# $NetBSD: GENERIC64,v 1.103 2019/07/25 00:30:45 jmcneill Exp $
#
# GENERIC ARM (aarch64) kernel
#
@@ -403,9 +403,9 @@
# Audio support
hdaudio* at fdt? # Intel HDA
+hdaudio* at pci? dev ? function ?
hdafg* at hdaudiobus?
options HDAUDIOVERBOSE
-options HDAUDIO_32BIT_ACCESS
options HDAUDIO_ENABLE_HDMI
options HDAUDIO_ENABLE_DISPLAYPORT
ausoc* at fdt? # Simple SoC audio card
diff -r 67e802247860 -r 3ea93ab260e7 sys/dev/hdaudio/files.hdaudio
--- a/sys/dev/hdaudio/files.hdaudio Thu Jul 25 00:02:55 2019 +0000
+++ b/sys/dev/hdaudio/files.hdaudio Thu Jul 25 00:30:45 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.hdaudio,v 1.4 2019/05/08 13:40:18 isaki Exp $
+# $NetBSD: files.hdaudio,v 1.5 2019/07/25 00:30:45 jmcneill Exp $
#
# Intel High Definition Audio (Revision 1.0)
@@ -7,7 +7,6 @@
defflag opt_hdaudio.h HDAUDIO_ENABLE_HDMI
defflag opt_hdaudio.h HDAUDIO_ENABLE_DISPLAYPORT
defflag opt_hdaudio.h HDAUDIO_DEBUG
-defflag opt_hdaudio.h HDAUDIO_32BIT_ACCESS
defflag opt_hdaudio.h HDAFG_DEBUG
defflag opt_hdaudio.h HDAFG_HDMI_DEBUG
diff -r 67e802247860 -r 3ea93ab260e7 sys/dev/hdaudio/hdaudiovar.h
--- a/sys/dev/hdaudio/hdaudiovar.h Thu Jul 25 00:02:55 2019 +0000
+++ b/sys/dev/hdaudio/hdaudiovar.h Thu Jul 25 00:30:45 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdaudiovar.h,v 1.7 2019/05/08 13:40:18 isaki Exp $ */
+/* $NetBSD: hdaudiovar.h,v 1.8 2019/07/25 00:30:45 jmcneill Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -145,6 +145,9 @@
bus_size_t sc_memsize;
bool sc_memvalid;
+ uint32_t sc_flags;
+#define HDAUDIO_FLAG_32BIT __BIT(0)
+
uint32_t sc_subsystem;
kmutex_t sc_corb_mtx;
@@ -184,58 +187,64 @@
int hdaudio_stream_tag(struct hdaudio_stream *);
uint16_t hdaudio_stream_param(struct hdaudio_stream *, const audio_params_t *);
-#ifdef HDAUDIO_32BIT_ACCESS
static __inline uint8_t
_hda_read1(struct hdaudio_softc *sc, bus_size_t off)
{
- return bus_space_read_4(sc->sc_memt, sc->sc_memh, off & -4) >>
- (8 * (off & 3));
+ if (ISSET(sc->sc_flags, HDAUDIO_FLAG_32BIT)) {
+ return bus_space_read_4(sc->sc_memt, sc->sc_memh, off & -4) >>
+ (8 * (off & 3));
+ } else {
+ return bus_space_read_1(sc->sc_memt, sc->sc_memh, off);
+ }
}
+
static __inline uint16_t
_hda_read2(struct hdaudio_softc *sc, bus_size_t off)
{
- return bus_space_read_4(sc->sc_memt, sc->sc_memh, off & -4) >>
- (8 * (off & 2));
+ if (ISSET(sc->sc_flags, HDAUDIO_FLAG_32BIT)) {
+ return bus_space_read_4(sc->sc_memt, sc->sc_memh, off & -4) >>
+ (8 * (off & 2));
+ } else {
+ return bus_space_read_2(sc->sc_memt, sc->sc_memh, off);
+ }
}
+
#define hda_read1 _hda_read1
#define hda_read2 _hda_read2
#define hda_read4(sc, off) \
bus_space_read_4((sc)->sc_memt, (sc)->sc_memh, (off))
+
static __inline void
_hda_write1(struct hdaudio_softc *sc, bus_size_t off, uint8_t val)
{
- const size_t shift = 8 * (off & 3);
- off &= -4;
- uint32_t tmp = bus_space_read_4(sc->sc_memt, sc->sc_memh, off);
- tmp = (val << shift) | (tmp & ~(0xff << shift));
- bus_space_write_4(sc->sc_memt, sc->sc_memh, off, tmp);
+ if (ISSET(sc->sc_flags, HDAUDIO_FLAG_32BIT)) {
+ const size_t shift = 8 * (off & 3);
+ off &= -4;
+ uint32_t tmp = bus_space_read_4(sc->sc_memt, sc->sc_memh, off);
+ tmp = (val << shift) | (tmp & ~(0xff << shift));
+ bus_space_write_4(sc->sc_memt, sc->sc_memh, off, tmp);
+ } else {
+ bus_space_write_1(sc->sc_memt, sc->sc_memh, off, val);
+ }
}
+
static __inline void
_hda_write2(struct hdaudio_softc *sc, bus_size_t off, uint16_t val)
{
- const size_t shift = 8 * (off & 2);
- off &= -4;
- uint32_t tmp = bus_space_read_4(sc->sc_memt, sc->sc_memh, off);
- tmp = (val << shift) | (tmp & ~(0xffff << shift));
- bus_space_write_4(sc->sc_memt, sc->sc_memh, off, tmp);
+ if (ISSET(sc->sc_flags, HDAUDIO_FLAG_32BIT)) {
+ const size_t shift = 8 * (off & 2);
+ off &= -4;
+ uint32_t tmp = bus_space_read_4(sc->sc_memt, sc->sc_memh, off);
+ tmp = (val << shift) | (tmp & ~(0xffff << shift));
+ bus_space_write_4(sc->sc_memt, sc->sc_memh, off, tmp);
+ } else {
+ bus_space_write_2(sc->sc_memt, sc->sc_memh, off, val);
+ }
}
+
#define hda_write1 _hda_write1
#define hda_write2 _hda_write2
#define hda_write4(sc, off, val) \
bus_space_write_4((sc)->sc_memt, (sc)->sc_memh, (off), (val))
-#else
-#define hda_read1(sc, off) \
- bus_space_read_1((sc)->sc_memt, (sc)->sc_memh, (off))
-#define hda_read2(sc, off) \
- bus_space_read_2((sc)->sc_memt, (sc)->sc_memh, (off))
-#define hda_read4(sc, off) \
- bus_space_read_4((sc)->sc_memt, (sc)->sc_memh, (off))
-#define hda_write1(sc, off, val) \
- bus_space_write_1((sc)->sc_memt, (sc)->sc_memh, (off), (val))
-#define hda_write2(sc, off, val) \
- bus_space_write_2((sc)->sc_memt, (sc)->sc_memh, (off), (val))
-#define hda_write4(sc, off, val) \
- bus_space_write_4((sc)->sc_memt, (sc)->sc_memh, (off), (val))
-#endif
#endif /* !_HDAUDIOVAR_H */
Home |
Main Index |
Thread Index |
Old Index