consolidate audio_init() and remove references to shoundhw.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-struct soundhw soundhw[] = {
+struct soundhw {
+ const char *name;
+ const char *descr;
+ int enabled;
+ int isa;
+ union {
+ int (*init_isa) (qemu_irq *pic);
+ int (*init_pci) (PCIBus *bus);
+ } init;
+};
+
+static struct soundhw soundhw[] = {
#ifdef HAS_AUDIO_CHOICE
#if defined(TARGET_I386) || defined(TARGET_MIPS)
{
#ifdef HAS_AUDIO_CHOICE
#if defined(TARGET_I386) || defined(TARGET_MIPS)
{
+
+void audio_init(qemu_irq *isa_pic, PCIBus *pci_bus)
+{
+ struct soundhw *c;
+
+ for (c = soundhw; c->name; ++c) {
+ if (c->enabled) {
+ if (c->isa) {
+ if (isa_pic) {
+ c->init.init_isa(isa_pic);
+ }
+ } else {
+ if (pci_bus) {
+ c->init.init_pci(pci_bus);
+ }
+ }
+ }
+ }
+}
#else
void select_soundhw(const char *optarg)
{
}
#else
void select_soundhw(const char *optarg)
{
}
+void audio_init(qemu_irq *isa_pic, PCIBus *pci_bus)
+{
+}
#endif
int qemu_uuid_parse(const char *str, uint8_t *uuid)
#endif
int qemu_uuid_parse(const char *str, uint8_t *uuid)
void do_smbios_option(const char *optarg);
void cpudef_init(void);
int audio_available(void);
void do_smbios_option(const char *optarg);
void cpudef_init(void);
int audio_available(void);
+void audio_init(qemu_irq *isa_pic, PCIBus *pci_bus);
int kvm_available(void);
int xen_available(void);
int kvm_available(void);
int xen_available(void);
#include "isa.h"
#include "fdc.h"
#include "sysemu.h"
#include "isa.h"
#include "fdc.h"
#include "sysemu.h"
-#include "audio/audio.h"
#include "boards.h"
#include "net.h"
#include "esp.h"
#include "boards.h"
#include "net.h"
#include "esp.h"
-static void audio_init(qemu_irq *pic)
-{
- struct soundhw *c;
- int audio_enabled = 0;
-
- for (c = soundhw; !audio_enabled && c->name; ++c) {
- audio_enabled = c->enabled;
- }
-
- if (audio_enabled) {
- for (c = soundhw; c->name; ++c) {
- if (c->enabled) {
- if (c->isa) {
- c->init.init_isa(pic);
- }
- }
- }
- }
-}
-
#define MAGNUM_BIOS_SIZE_MAX 0x7e000
#define MAGNUM_BIOS_SIZE (BIOS_SIZE < MAGNUM_BIOS_SIZE_MAX ? BIOS_SIZE : MAGNUM_BIOS_SIZE_MAX)
#define MAGNUM_BIOS_SIZE_MAX 0x7e000
#define MAGNUM_BIOS_SIZE (BIOS_SIZE < MAGNUM_BIOS_SIZE_MAX ? BIOS_SIZE : MAGNUM_BIOS_SIZE_MAX)
/* Sound card */
/* FIXME: missing Jazz sound at 0x8000c000, rc4030[2] */
/* Sound card */
/* FIXME: missing Jazz sound at 0x8000c000, rc4030[2] */
+ audio_init(i8259, NULL);
/* NVRAM: Unprotected at 0x9000, Protected at 0xa000, Read only at 0xb000 */
ds1225y_init(0x80009000, "nvram");
/* NVRAM: Unprotected at 0x9000, Protected at 0xa000, Read only at 0xb000 */
ds1225y_init(0x80009000, "nvram");
#include "vmware_vga.h"
#include "qemu-char.h"
#include "sysemu.h"
#include "vmware_vga.h"
#include "qemu-char.h"
#include "sysemu.h"
-#include "audio/audio.h"
#include "boards.h"
#include "qemu-log.h"
#include "mips-bios.h"
#include "boards.h"
#include "qemu-log.h"
#include "mips-bios.h"
-/* Audio support */
-static void audio_init (PCIBus *pci_bus)
-{
- struct soundhw *c;
- int audio_enabled = 0;
-
- for (c = soundhw; !audio_enabled && c->name; ++c) {
- audio_enabled = c->enabled;
- }
-
- if (audio_enabled) {
- for (c = soundhw; c->name; ++c) {
- if (c->enabled) {
- c->init.init_pci(pci_bus);
- }
- }
- }
-}
-
/* Network support */
static void network_init(void)
{
/* Network support */
static void network_init(void)
{
fdctrl_init_isa(fd);
/* Sound card */
fdctrl_init_isa(fd);
/* Sound card */
+ audio_init(NULL, pci_bus);
/* Network card */
network_init();
/* Network card */
network_init();
static const int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc };
static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
static const int parallel_io[MAX_PARALLEL_PORTS] = { 0x378, 0x278, 0x3bc };
static const int parallel_irq[MAX_PARALLEL_PORTS] = { 7, 7, 7 };
-void pc_audio_init (PCIBus *pci_bus, qemu_irq *pic)
-{
- struct soundhw *c;
-
- for (c = soundhw; c->name; ++c) {
- if (c->enabled) {
- if (c->isa) {
- c->init.init_isa(pic);
- } else {
- if (pci_bus) {
- c->init.init_pci(pci_bus);
- }
- }
- }
- }
-}
-
void pc_init_ne2k_isa(NICInfo *nd)
{
static int nb_ne2k = 0;
void pc_init_ne2k_isa(NICInfo *nd)
{
static int nb_ne2k = 0;
FDCtrl **floppy_controller,
ISADevice **rtc_state);
void pc_init_ne2k_isa(NICInfo *nd);
FDCtrl **floppy_controller,
ISADevice **rtc_state);
void pc_init_ne2k_isa(NICInfo *nd);
-#ifdef HAS_AUDIO
-void pc_audio_init (PCIBus *pci_bus, qemu_irq *pic);
-#endif
void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
const char *boot_device,
BusState *ide0, BusState *ide1,
void pc_cmos_init(ram_addr_t ram_size, ram_addr_t above_4g_mem_size,
const char *boot_device,
BusState *ide0, BusState *ide1,
#include "kvm.h"
#include "sysemu.h"
#include "sysbus.h"
#include "kvm.h"
#include "sysemu.h"
#include "sysbus.h"
#include "blockdev.h"
#define MAX_IDE_BUS 2
#include "blockdev.h"
#define MAX_IDE_BUS 2
- pc_audio_init(pci_enabled ? pci_bus : NULL, isa_irq);
+ audio_init(isa_irq, pci_enabled ? pci_bus : NULL);
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
idebus[0], idebus[1], floppy_controller, rtc_state);
pc_cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device,
idebus[0], idebus[1], floppy_controller, rtc_state);
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
-#ifdef HAS_AUDIO
-struct soundhw {
- const char *name;
- const char *descr;
- int enabled;
- int isa;
- union {
- int (*init_isa) (qemu_irq *pic);
- int (*init_pci) (PCIBus *bus);
- } init;
-};
-
-extern struct soundhw soundhw[];
-#endif
-
void do_usb_add(Monitor *mon, const QDict *qdict);
void do_usb_del(Monitor *mon, const QDict *qdict);
void usb_info(Monitor *mon);
void do_usb_add(Monitor *mon, const QDict *qdict);
void do_usb_del(Monitor *mon, const QDict *qdict);
void usb_info(Monitor *mon);