Skip to contentSkip to conversation

Add Intel HD Audio support to qemu.

PATCH Applied Gerd Hoffmann 2 participants 2 messages Nov 1, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add Intel HD Audio support to qemu.

This patch adds three devices to qemu:

intel-hda
Intel HD Audio Controller, the PCI device. Provides a HDA bus. Emulates ICH6 at the moment. Adding a ICH9 PCIE variant shouldn't be hard.

hda-duplex

	HDA Codec.  Attaches to the HDA bus.  Supports 16bit stereo,
	rates 16k -> 96k, playback, recording and volume control
	(with CONFIG_MIXEMU=y).

hda-output
HDA Codec without recording support. Subset of the hda-duplex codec. Use this if you don't want your guests access your mic.

Usage: add '-device intel-hda -device hda-duplex' to your command line.

Tested guests:
* Linux works.
* Win7 works.
* DOS (mpxplay) works.
* WinXP doesn't work.

[ v2 changes ]
* Fixed endianess, big endian hosts work now.
* Fixed some emulation bugs.
* Added immediate command emulation.
* Added vmstate support.
* Make it behave like all other sound card drivers:
- can be configured via '--audio-card-list=hda'
- can be added to a VM using '-soundhw hda'
* Code style fixups.
* Zapped guest-triggerable asserts.
* Handle partial reads/writes of audio data correctly.

---
 Makefile.objs       |    1 +
 arch_init.c         |   10 +
 configure           |    4 +-
 hw/audiodev.h       |    3 +
 hw/hda-audio.c      |  902 +++++++++++++++++++++++++++++++++++++
 hw/intel-hda-defs.h |  717 +++++++++++++++++++++++++++++
 hw/intel-hda.c      | 1250 +++++++++++++++++++++++++++++++++++++++++++++++++++
 hw/intel-hda.h      |   61 +++
 8 files changed, 2946 insertions(+), 2 deletions(-)
 create mode 100644 hw/hda-audio.c
 create mode 100644 hw/intel-hda-defs.h
 create mode 100644 hw/intel-hda.c
 create mode 100644 hw/intel-hda.h
Makefile.objs +1 -0
index 0d5ae43..78e0e30 100644
@@ -254,6 +254,7 @@ sound-obj-$(CONFIG_AC97) += ac97.o
 sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
 sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
 sound-obj-$(CONFIG_CS4231A) += cs4231a.o
+sound-obj-$(CONFIG_HDA) += intel-hda.o hda-audio.o
 
 adlib.o fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0
 hw-obj-$(CONFIG_SOUND) += $(sound-obj-y)
arch_init.c +10 -0
index 0b36ae5..af70331 100644
@@ -506,6 +506,16 @@ struct soundhw soundhw[] = {
     },
 #endif
 
+#ifdef CONFIG_HDA
+    {
+        "hda",
+        "Intel HD Audio",
+        0,
+        0,
+        { .init_pci = intel_hda_and_codec_init }
+    },
+#endif
+
 #endif /* HAS_AUDIO_CHOICE */
 
     { NULL, NULL, 0, 0, { NULL } }
configure +2 -2
index f62c1fe..7025d2b 100755
@@ -76,8 +76,8 @@ sparc_cpu=""
 cross_prefix=""
 cc="gcc"
 audio_drv_list=""
-audio_card_list="ac97 es1370 sb16"
-audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus"
+audio_card_list="ac97 es1370 sb16 hda"
+audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
 block_drv_whitelist=""
 host_cc="gcc"
 ar="ar"
hw/audiodev.h +3 -0
index 39a729b..8e930b2 100644
@@ -15,3 +15,6 @@ int ac97_init(PCIBus *buf);
 
 /* cs4231a.c */
 int cs4231a_init(qemu_irq *pic);
+
+/* intel-hda.c + hda-audio.c */
+int intel_hda_and_codec_init(PCIBus *bus);
hw/hda-audio.c new file +902 -0

902 lines not on this page · raw message

hw/intel-hda-defs.h new file +717 -0

717 lines not on this page · raw message

hw/intel-hda.c new file +1250 -0

1,250 lines not on this page · raw message

hw/intel-hda.h new file +61 -0

61 lines not on this page · raw message

Signature · 1 line
1.7.1
Applied
#1 lore raw
Quoted 12 lines · Gerd Hoffmann

This patch adds three devices to qemu:

intel-hda
Intel HD Audio Controller, the PCI device. Provides a HDA bus. Emulates ICH6 at the moment. Adding a ICH9 PCIE variant shouldn't be hard.

hda-duplex

	HDA Codec.  Attaches to the HDA bus.  Supports 16bit stereo,
	rates 16k -> 96k, playback, recording and volume control
	(with CONFIG_MIXEMU=y).
Quoted 6 lines

hda-output
HDA Codec without recording support. Subset of the hda-duplex codec. Use this if you don't want your guests access your mic.

Usage: add '-device intel-hda -device hda-duplex' to your command line.

[..snip..]

Applied, thanks.

Signature · 1 line
mailto:[email protected]