summaryrefslogtreecommitdiff
path: root/arch_init.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2013-04-18 18:43:58 +0200
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-29 12:16:36 -0500
commit36cd6f6f20724d49aac1910e310f81a43e0cb657 (patch)
tree2e6e7d689d79dfb2da14684e1415cd3003cb89ec /arch_init.c
parent8c444a1978fd9956c9712572d9ad0b83bbbc0a63 (diff)
downloadqemu-36cd6f6f20724d49aac1910e310f81a43e0cb657.tar.gz
audio: remove the need for audio card CONFIG_* symbols
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 1366303444-24620-3-git-send-email-pbonzini@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'arch_init.c')
-rw-r--r--arch_init.c128
1 files changed, 31 insertions, 97 deletions
diff --git a/arch_init.c b/arch_init.c
index 92de1bde49..050418485c 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -899,96 +899,30 @@ struct soundhw {
} init;
};
-static struct soundhw soundhw[] = {
-#ifdef HAS_AUDIO_CHOICE
-#ifdef CONFIG_PCSPK
- {
- "pcspk",
- "PC speaker",
- 0,
- 1,
- { .init_isa = pcspk_audio_init }
- },
-#endif
-
-#ifdef CONFIG_SB16
- {
- "sb16",
- "Creative Sound Blaster 16",
- 0,
- 1,
- { .init_isa = SB16_init }
- },
-#endif
-
-#ifdef CONFIG_CS4231A
- {
- "cs4231a",
- "CS4231A",
- 0,
- 1,
- { .init_isa = cs4231a_init }
- },
-#endif
-
-#ifdef CONFIG_ADLIB
- {
- "adlib",
-#ifdef HAS_YMF262
- "Yamaha YMF262 (OPL3)",
-#else
- "Yamaha YM3812 (OPL2)",
-#endif
- 0,
- 1,
- { .init_isa = Adlib_init }
- },
-#endif
-
-#ifdef CONFIG_GUS
- {
- "gus",
- "Gravis Ultrasound GF1",
- 0,
- 1,
- { .init_isa = GUS_init }
- },
-#endif
-
-#ifdef CONFIG_AC97
- {
- "ac97",
- "Intel 82801AA AC97 Audio",
- 0,
- 0,
- { .init_pci = ac97_init }
- },
-#endif
+static struct soundhw soundhw[9];
+static int soundhw_count;
-#ifdef CONFIG_ES1370
- {
- "es1370",
- "ENSONIQ AudioPCI ES1370",
- 0,
- 0,
- { .init_pci = es1370_init }
- },
-#endif
-
-#ifdef CONFIG_HDA
- {
- "hda",
- "Intel HD Audio",
- 0,
- 0,
- { .init_pci = intel_hda_and_codec_init }
- },
-#endif
-
-#endif /* HAS_AUDIO_CHOICE */
+void isa_register_soundhw(const char *name, const char *descr,
+ int (*init_isa)(ISABus *bus))
+{
+ assert(soundhw_count < ARRAY_SIZE(soundhw) - 1);
+ soundhw[soundhw_count].name = name;
+ soundhw[soundhw_count].descr = descr;
+ soundhw[soundhw_count].isa = 1;
+ soundhw[soundhw_count].init.init_isa = init_isa;
+ soundhw_count++;
+}
- { NULL, NULL, 0, 0, { NULL } }
-};
+void pci_register_soundhw(const char *name, const char *descr,
+ int (*init_pci)(PCIBus *bus))
+{
+ assert(soundhw_count < ARRAY_SIZE(soundhw) - 1);
+ soundhw[soundhw_count].name = name;
+ soundhw[soundhw_count].descr = descr;
+ soundhw[soundhw_count].isa = 0;
+ soundhw[soundhw_count].init.init_pci = init_pci;
+ soundhw_count++;
+}
void select_soundhw(const char *optarg)
{
@@ -997,16 +931,16 @@ void select_soundhw(const char *optarg)
if (is_help_option(optarg)) {
show_valid_cards:
-#ifdef HAS_AUDIO_CHOICE
- printf("Valid sound card names (comma separated):\n");
- for (c = soundhw; c->name; ++c) {
- printf ("%-11s %s\n", c->name, c->descr);
+ if (soundhw_count) {
+ printf("Valid sound card names (comma separated):\n");
+ for (c = soundhw; c->name; ++c) {
+ printf ("%-11s %s\n", c->name, c->descr);
+ }
+ printf("\n-soundhw all will enable all of the above\n");
+ } else {
+ printf("Machine has no user-selectable audio hardware "
+ "(it may or may not have always-present audio hardware).\n");
}
- printf("\n-soundhw all will enable all of the above\n");
-#else
- printf("Machine has no user-selectable audio hardware "
- "(it may or may not have always-present audio hardware).\n");
-#endif
exit(!is_help_option(optarg));
}
else {