* [Qemu-devel] [RFC PATCH 1/6] adlib: qdev-ify
2013-04-02 14:50 [Qemu-devel] [RFC PATCH 0/6] audio: simplify -soundhw machinery, use default-configs Paolo Bonzini
@ 2013-04-02 14:50 ` Paolo Bonzini
2013-04-09 17:28 ` Andreas Färber
2013-04-02 14:50 ` [Qemu-devel] [RFC PATCH 2/6] audio: remove the need for audio card CONFIG_* symbols Paolo Bonzini
` (5 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Paolo Bonzini @ 2013-04-02 14:50 UTC (permalink / raw)
To: qemu-devel; +Cc: av1474
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/adlib.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 64 insertions(+), 18 deletions(-)
diff --git a/hw/adlib.c b/hw/adlib.c
index e6bce59..ca47b55 100644
--- a/hw/adlib.c
+++ b/hw/adlib.c
@@ -31,6 +31,12 @@
#define ADLIB_KILL_TIMERS 1
+#ifdef HAS_YMF262
+#define ADLIB_DESC "Yamaha YMF262 (OPL3)"
+#else
+#define ADLIB_DESC "Yamaha YM3812 (OPL2)"
+#endif
+
#ifdef DEBUG
#include "qemu/timer.h"
#endif
@@ -56,13 +62,11 @@ void YMF262UpdateOneQEMU (int which, INT16 *dst, int length);
#define IO_WRITE_PROTO(name) \
void name (void *opaque, uint32_t nport, uint32_t val)
-static struct {
- int port;
- int freq;
-} conf = {0x220, 44100};
-
typedef struct {
+ ISADevice dev;
QEMUSoundCard card;
+ uint32_t freq;
+ uint32_t port;
int ticking[2];
int enabled;
int active;
@@ -80,7 +84,7 @@ typedef struct {
#endif
} AdlibState;
-static AdlibState glob_adlib;
+static AdlibState *glob_adlib;
static void adlib_stop_opl_timer (AdlibState *s, size_t n)
{
@@ -150,7 +154,7 @@ static IO_READ_PROTO (adlib_read)
static void timer_handler (int c, double interval_Sec)
{
- AdlibState *s = &glob_adlib;
+ AdlibState *s = glob_adlib;
unsigned n = c & 1;
#ifdef DEBUG
double interval;
@@ -275,14 +279,21 @@ static void Adlib_fini (AdlibState *s)
AUD_remove_card (&s->card);
}
-int Adlib_init (ISABus *bus)
+static int Adlib_initfn (ISADevice *dev)
{
- AdlibState *s = &glob_adlib;
+ AdlibState *s;
struct audsettings as;
+ if (glob_adlib) {
+ dolog ("Cannot create more than 1 adlib device\n");
+ return -1;
+ }
+ s = DO_UPCAST (AdlibState, dev, dev);
+ glob_adlib = s;
+
#ifdef HAS_YMF262
- if (YMF262Init (1, 14318180, conf.freq)) {
- dolog ("YMF262Init %d failed\n", conf.freq);
+ if (YMF262Init (1, 14318180, s->freq)) {
+ dolog ("YMF262Init %d failed\n", s->freq);
return -1;
}
else {
@@ -290,9 +301,9 @@ int Adlib_init (ISABus *bus)
s->enabled = 1;
}
#else
- s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, conf.freq);
+ s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, s->freq);
if (!s->opl) {
- dolog ("OPLCreate %d failed\n", conf.freq);
+ dolog ("OPLCreate %d failed\n", s->freq);
return -1;
}
else {
@@ -301,7 +312,7 @@ int Adlib_init (ISABus *bus)
}
#endif
- as.freq = conf.freq;
+ as.freq = s->freq;
as.nchannels = SHIFT;
as.fmt = AUD_FMT_S16;
as.endianness = AUDIO_HOST_ENDIANNESS;
@@ -327,11 +338,46 @@ int Adlib_init (ISABus *bus)
register_ioport_read (0x388, 4, 1, adlib_read, s);
register_ioport_write (0x388, 4, 1, adlib_write, s);
- register_ioport_read (conf.port, 4, 1, adlib_read, s);
- register_ioport_write (conf.port, 4, 1, adlib_write, s);
+ register_ioport_read (s->port, 4, 1, adlib_read, s);
+ register_ioport_write (s->port, 4, 1, adlib_write, s);
- register_ioport_read (conf.port + 8, 2, 1, adlib_read, s);
- register_ioport_write (conf.port + 8, 2, 1, adlib_write, s);
+ register_ioport_read (s->port + 8, 2, 1, adlib_read, s);
+ register_ioport_write (s->port + 8, 2, 1, adlib_write, s);
return 0;
}
+
+static Property adlib_properties[] = {
+ DEFINE_PROP_HEX32 ("iobase", AdlibState, port, 0x220),
+ DEFINE_PROP_UINT32 ("freq", AdlibState, freq, 44100),
+ DEFINE_PROP_END_OF_LIST (),
+};
+
+static void adlib_class_initfn (ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS (klass);
+ ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
+ ic->init = Adlib_initfn;
+ dc->desc = ADLIB_DESC;
+ dc->props = adlib_properties;
+}
+
+static TypeInfo adlib_info = {
+ .name = "adlib",
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof (AdlibState),
+ .class_init = adlib_class_initfn,
+};
+
+int Adlib_init (ISABus *bus)
+{
+ isa_create_simple (bus, "adlib");
+ return 0;
+}
+
+static void adlib_register_types (void)
+{
+ type_register_static (&adlib_info);
+}
+
+type_init (adlib_register_types)
--
1.8.1.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 1/6] adlib: qdev-ify
2013-04-02 14:50 ` [Qemu-devel] [RFC PATCH 1/6] adlib: qdev-ify Paolo Bonzini
@ 2013-04-09 17:28 ` Andreas Färber
2013-04-10 8:03 ` Paolo Bonzini
2013-04-10 14:13 ` Paolo Bonzini
0 siblings, 2 replies; 13+ messages in thread
From: Andreas Färber @ 2013-04-09 17:28 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: av1474, qemu-devel
Am 02.04.2013 16:50, schrieb Paolo Bonzini:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/adlib.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++++--------------
> 1 file changed, 64 insertions(+), 18 deletions(-)
>
> diff --git a/hw/adlib.c b/hw/adlib.c
> index e6bce59..ca47b55 100644
> --- a/hw/adlib.c
> +++ b/hw/adlib.c
> @@ -31,6 +31,12 @@
>
> #define ADLIB_KILL_TIMERS 1
>
> +#ifdef HAS_YMF262
> +#define ADLIB_DESC "Yamaha YMF262 (OPL3)"
> +#else
> +#define ADLIB_DESC "Yamaha YM3812 (OPL2)"
> +#endif
Shouldn't in the process of QOM'ifying this be split into two devices?
Is HAS_YMF262 user-selected or dependent on libraries or something?
> +
> #ifdef DEBUG
> #include "qemu/timer.h"
> #endif
> @@ -56,13 +62,11 @@ void YMF262UpdateOneQEMU (int which, INT16 *dst, int length);
> #define IO_WRITE_PROTO(name) \
> void name (void *opaque, uint32_t nport, uint32_t val)
>
> -static struct {
> - int port;
> - int freq;
> -} conf = {0x220, 44100};
> -
> typedef struct {
> + ISADevice dev;
parent_obj and white line please. :)
> QEMUSoundCard card;
> + uint32_t freq;
> + uint32_t port;
> int ticking[2];
> int enabled;
> int active;
> @@ -80,7 +84,7 @@ typedef struct {
> #endif
> } AdlibState;
>
> -static AdlibState glob_adlib;
> +static AdlibState *glob_adlib;
>
> static void adlib_stop_opl_timer (AdlibState *s, size_t n)
> {
> @@ -150,7 +154,7 @@ static IO_READ_PROTO (adlib_read)
>
> static void timer_handler (int c, double interval_Sec)
> {
> - AdlibState *s = &glob_adlib;
> + AdlibState *s = glob_adlib;
> unsigned n = c & 1;
> #ifdef DEBUG
> double interval;
> @@ -275,14 +279,21 @@ static void Adlib_fini (AdlibState *s)
> AUD_remove_card (&s->card);
> }
>
> -int Adlib_init (ISABus *bus)
> +static int Adlib_initfn (ISADevice *dev)
Hm, obviously that conflicts with my series converting ISADevices to QOM
realize that I was hoping to still get into 1.5...
> {
> - AdlibState *s = &glob_adlib;
> + AdlibState *s;
> struct audsettings as;
>
> + if (glob_adlib) {
> + dolog ("Cannot create more than 1 adlib device\n");
> + return -1;
> + }
> + s = DO_UPCAST (AdlibState, dev, dev);
No new DO_UPCAST() for QOM objects please!
> + glob_adlib = s;
> +
> #ifdef HAS_YMF262
> - if (YMF262Init (1, 14318180, conf.freq)) {
> - dolog ("YMF262Init %d failed\n", conf.freq);
> + if (YMF262Init (1, 14318180, s->freq)) {
> + dolog ("YMF262Init %d failed\n", s->freq);
> return -1;
> }
> else {
> @@ -290,9 +301,9 @@ int Adlib_init (ISABus *bus)
> s->enabled = 1;
> }
> #else
> - s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, conf.freq);
> + s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, s->freq);
> if (!s->opl) {
> - dolog ("OPLCreate %d failed\n", conf.freq);
> + dolog ("OPLCreate %d failed\n", s->freq);
> return -1;
> }
> else {
> @@ -301,7 +312,7 @@ int Adlib_init (ISABus *bus)
> }
> #endif
>
> - as.freq = conf.freq;
> + as.freq = s->freq;
> as.nchannels = SHIFT;
> as.fmt = AUD_FMT_S16;
> as.endianness = AUDIO_HOST_ENDIANNESS;
> @@ -327,11 +338,46 @@ int Adlib_init (ISABus *bus)
> register_ioport_read (0x388, 4, 1, adlib_read, s);
> register_ioport_write (0x388, 4, 1, adlib_write, s);
>
> - register_ioport_read (conf.port, 4, 1, adlib_read, s);
> - register_ioport_write (conf.port, 4, 1, adlib_write, s);
> + register_ioport_read (s->port, 4, 1, adlib_read, s);
> + register_ioport_write (s->port, 4, 1, adlib_write, s);
>
> - register_ioport_read (conf.port + 8, 2, 1, adlib_read, s);
> - register_ioport_write (conf.port + 8, 2, 1, adlib_write, s);
> + register_ioport_read (s->port + 8, 2, 1, adlib_read, s);
> + register_ioport_write (s->port + 8, 2, 1, adlib_write, s);
>
> return 0;
> }
> +
> +static Property adlib_properties[] = {
> + DEFINE_PROP_HEX32 ("iobase", AdlibState, port, 0x220),
> + DEFINE_PROP_UINT32 ("freq", AdlibState, freq, 44100),
> + DEFINE_PROP_END_OF_LIST (),
> +};
> +
> +static void adlib_class_initfn (ObjectClass *klass, void *data)
> +{
> + DeviceClass *dc = DEVICE_CLASS (klass);
> + ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
> + ic->init = Adlib_initfn;
> + dc->desc = ADLIB_DESC;
> + dc->props = adlib_properties;
> +}
> +
> +static TypeInfo adlib_info = {
static const please.
> + .name = "adlib",
> + .parent = TYPE_ISA_DEVICE,
> + .instance_size = sizeof (AdlibState),
> + .class_init = adlib_class_initfn,
> +};
> +
> +int Adlib_init (ISABus *bus)
> +{
> + isa_create_simple (bus, "adlib");
> + return 0;
> +}
> +
> +static void adlib_register_types (void)
> +{
> + type_register_static (&adlib_info);
> +}
> +
> +type_init (adlib_register_types)
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 1/6] adlib: qdev-ify
2013-04-09 17:28 ` Andreas Färber
@ 2013-04-10 8:03 ` Paolo Bonzini
2013-04-10 14:13 ` Paolo Bonzini
1 sibling, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2013-04-10 8:03 UTC (permalink / raw)
To: Andreas Färber; +Cc: av1474, qemu-devel
Il 09/04/2013 19:28, Andreas Färber ha scritto:
>> > +#ifdef HAS_YMF262
>> > +#define ADLIB_DESC "Yamaha YMF262 (OPL3)"
>> > +#else
>> > +#define ADLIB_DESC "Yamaha YM3812 (OPL2)"
>> > +#endif
> Shouldn't in the process of QOM'ifying this be split into two devices?
> Is HAS_YMF262 user-selected or dependent on libraries or something?
>
IIRC the OPL3 code is not under a GPL-compatible license (perhaps the
MAME license?), the code is just there for people who want to combine it
themselves.
Paolo
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 1/6] adlib: qdev-ify
2013-04-09 17:28 ` Andreas Färber
2013-04-10 8:03 ` Paolo Bonzini
@ 2013-04-10 14:13 ` Paolo Bonzini
1 sibling, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2013-04-10 14:13 UTC (permalink / raw)
To: Andreas Färber; +Cc: av1474, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 3579 bytes --]
Il 09/04/2013 19:28, Andreas Färber ha scritto:
>> -int Adlib_init (ISABus *bus)
>> +static int Adlib_initfn (ISADevice *dev)
>
> Hm, obviously that conflicts with my series converting ISADevices to QOM
> realize that I was hoping to still get into 1.5...
Just put this patch in front of your series (I attach an updated
version). The patch will just disappear at the next rebase for whoever
submits last.
Paolo
>> {
>> - AdlibState *s = &glob_adlib;
>> + AdlibState *s;
>> struct audsettings as;
>>
>> + if (glob_adlib) {
>> + dolog ("Cannot create more than 1 adlib device\n");
>> + return -1;
>> + }
>> + s = DO_UPCAST (AdlibState, dev, dev);
>
> No new DO_UPCAST() for QOM objects please!
>
>> + glob_adlib = s;
>> +
>> #ifdef HAS_YMF262
>> - if (YMF262Init (1, 14318180, conf.freq)) {
>> - dolog ("YMF262Init %d failed\n", conf.freq);
>> + if (YMF262Init (1, 14318180, s->freq)) {
>> + dolog ("YMF262Init %d failed\n", s->freq);
>> return -1;
>> }
>> else {
>> @@ -290,9 +301,9 @@ int Adlib_init (ISABus *bus)
>> s->enabled = 1;
>> }
>> #else
>> - s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, conf.freq);
>> + s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, s->freq);
>> if (!s->opl) {
>> - dolog ("OPLCreate %d failed\n", conf.freq);
>> + dolog ("OPLCreate %d failed\n", s->freq);
>> return -1;
>> }
>> else {
>> @@ -301,7 +312,7 @@ int Adlib_init (ISABus *bus)
>> }
>> #endif
>>
>> - as.freq = conf.freq;
>> + as.freq = s->freq;
>> as.nchannels = SHIFT;
>> as.fmt = AUD_FMT_S16;
>> as.endianness = AUDIO_HOST_ENDIANNESS;
>> @@ -327,11 +338,46 @@ int Adlib_init (ISABus *bus)
>> register_ioport_read (0x388, 4, 1, adlib_read, s);
>> register_ioport_write (0x388, 4, 1, adlib_write, s);
>>
>> - register_ioport_read (conf.port, 4, 1, adlib_read, s);
>> - register_ioport_write (conf.port, 4, 1, adlib_write, s);
>> + register_ioport_read (s->port, 4, 1, adlib_read, s);
>> + register_ioport_write (s->port, 4, 1, adlib_write, s);
>>
>> - register_ioport_read (conf.port + 8, 2, 1, adlib_read, s);
>> - register_ioport_write (conf.port + 8, 2, 1, adlib_write, s);
>> + register_ioport_read (s->port + 8, 2, 1, adlib_read, s);
>> + register_ioport_write (s->port + 8, 2, 1, adlib_write, s);
>>
>> return 0;
>> }
>> +
>> +static Property adlib_properties[] = {
>> + DEFINE_PROP_HEX32 ("iobase", AdlibState, port, 0x220),
>> + DEFINE_PROP_UINT32 ("freq", AdlibState, freq, 44100),
>> + DEFINE_PROP_END_OF_LIST (),
>> +};
>> +
>> +static void adlib_class_initfn (ObjectClass *klass, void *data)
>> +{
>> + DeviceClass *dc = DEVICE_CLASS (klass);
>> + ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
>> + ic->init = Adlib_initfn;
>> + dc->desc = ADLIB_DESC;
>> + dc->props = adlib_properties;
>> +}
>> +
>> +static TypeInfo adlib_info = {
>
> static const please.
>
>> + .name = "adlib",
>> + .parent = TYPE_ISA_DEVICE,
>> + .instance_size = sizeof (AdlibState),
>> + .class_init = adlib_class_initfn,
>> +};
>> +
>> +int Adlib_init (ISABus *bus)
>> +{
>> + isa_create_simple (bus, "adlib");
>> + return 0;
>> +}
>> +
>> +static void adlib_register_types (void)
>> +{
>> + type_register_static (&adlib_info);
>> +}
>> +
>> +type_init (adlib_register_types)
>
> Andreas
>
[-- Attachment #2: 0001-adlib-qdev-ify.patch --]
[-- Type: text/x-patch, Size: 4500 bytes --]
>From 2e03021695ed22fb02906eca8fc98c29a6ad50e6 Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Tue, 2 Apr 2013 15:14:55 +0200
Subject: [PATCH] adlib: qdev-ify
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/audio/adlib.c | 83 ++++++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 66 insertions(+), 17 deletions(-)
diff --git a/hw/audio/adlib.c b/hw/audio/adlib.c
index 4a58e6e..fb41f9d 100644
--- a/hw/audio/adlib.c
+++ b/hw/audio/adlib.c
@@ -31,6 +31,12 @@
#define ADLIB_KILL_TIMERS 1
+#ifdef HAS_YMF262
+#define ADLIB_DESC "Yamaha YMF262 (OPL3)"
+#else
+#define ADLIB_DESC "Yamaha YM3812 (OPL2)"
+#endif
+
#ifdef DEBUG
#include "qemu/timer.h"
#endif
@@ -56,13 +62,15 @@ void YMF262UpdateOneQEMU (int which, INT16 *dst, int length);
#define IO_WRITE_PROTO(name) \
void name (void *opaque, uint32_t nport, uint32_t val)
-static struct {
- int port;
- int freq;
-} conf = {0x220, 44100};
+#define TYPE_ADLIB "adlib"
+#define ADLIB(obj) OBJECT_CHECK(AdlibState, (obj), TYPE_ADLIB)
typedef struct {
+ ISADevice parent_obj;
+
QEMUSoundCard card;
+ uint32_t freq;
+ uint32_t port;
int ticking[2];
int enabled;
int active;
@@ -80,7 +88,7 @@ typedef struct {
#endif
} AdlibState;
-static AdlibState glob_adlib;
+static AdlibState *glob_adlib;
static void adlib_stop_opl_timer (AdlibState *s, size_t n)
{
@@ -150,7 +158,7 @@ static IO_READ_PROTO (adlib_read)
static void timer_handler (int c, double interval_Sec)
{
- AdlibState *s = &glob_adlib;
+ AdlibState *s = glob_adlib;
unsigned n = c & 1;
#ifdef DEBUG
double interval;
@@ -275,14 +283,20 @@ static void Adlib_fini (AdlibState *s)
AUD_remove_card (&s->card);
}
-int Adlib_init (ISABus *bus)
+static int Adlib_initfn (ISADevice *dev)
{
- AdlibState *s = &glob_adlib;
+ AdlibState *s = ADLIB(dev);
struct audsettings as;
+ if (glob_adlib) {
+ dolog ("Cannot create more than 1 adlib device\n");
+ return -1;
+ }
+ glob_adlib = s;
+
#ifdef HAS_YMF262
- if (YMF262Init (1, 14318180, conf.freq)) {
- dolog ("YMF262Init %d failed\n", conf.freq);
+ if (YMF262Init (1, 14318180, s->freq)) {
+ dolog ("YMF262Init %d failed\n", s->freq);
return -1;
}
else {
@@ -290,9 +304,9 @@ int Adlib_init (ISABus *bus)
s->enabled = 1;
}
#else
- s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, conf.freq);
+ s->opl = OPLCreate (OPL_TYPE_YM3812, 3579545, s->freq);
if (!s->opl) {
- dolog ("OPLCreate %d failed\n", conf.freq);
+ dolog ("OPLCreate %d failed\n", s->freq);
return -1;
}
else {
@@ -301,7 +315,7 @@ int Adlib_init (ISABus *bus)
}
#endif
- as.freq = conf.freq;
+ as.freq = s->freq;
as.nchannels = SHIFT;
as.fmt = AUD_FMT_S16;
as.endianness = AUDIO_HOST_ENDIANNESS;
@@ -327,11 +341,46 @@ int Adlib_init (ISABus *bus)
register_ioport_read (0x388, 4, 1, adlib_read, s);
register_ioport_write (0x388, 4, 1, adlib_write, s);
- register_ioport_read (conf.port, 4, 1, adlib_read, s);
- register_ioport_write (conf.port, 4, 1, adlib_write, s);
+ register_ioport_read (s->port, 4, 1, adlib_read, s);
+ register_ioport_write (s->port, 4, 1, adlib_write, s);
- register_ioport_read (conf.port + 8, 2, 1, adlib_read, s);
- register_ioport_write (conf.port + 8, 2, 1, adlib_write, s);
+ register_ioport_read (s->port + 8, 2, 1, adlib_read, s);
+ register_ioport_write (s->port + 8, 2, 1, adlib_write, s);
return 0;
}
+
+static Property adlib_properties[] = {
+ DEFINE_PROP_HEX32 ("iobase", AdlibState, port, 0x220),
+ DEFINE_PROP_UINT32 ("freq", AdlibState, freq, 44100),
+ DEFINE_PROP_END_OF_LIST (),
+};
+
+static void adlib_class_initfn (ObjectClass *klass, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS (klass);
+ ISADeviceClass *ic = ISA_DEVICE_CLASS (klass);
+ ic->init = Adlib_initfn;
+ dc->desc = ADLIB_DESC;
+ dc->props = adlib_properties;
+}
+
+static const TypeInfo adlib_info = {
+ .name = TYPE_ADLIB,
+ .parent = TYPE_ISA_DEVICE,
+ .instance_size = sizeof (AdlibState),
+ .class_init = adlib_class_initfn,
+};
+
+int Adlib_init (ISABus *bus)
+{
+ isa_create_simple (bus, TYPE_ADLIB);
+ return 0;
+}
+
+static void adlib_register_types (void)
+{
+ type_register_static (&adlib_info);
+}
+
+type_init (adlib_register_types)
--
1.8.1.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [RFC PATCH 2/6] audio: remove the need for audio card CONFIG_* symbols
2013-04-02 14:50 [Qemu-devel] [RFC PATCH 0/6] audio: simplify -soundhw machinery, use default-configs Paolo Bonzini
2013-04-02 14:50 ` [Qemu-devel] [RFC PATCH 1/6] adlib: qdev-ify Paolo Bonzini
@ 2013-04-02 14:50 ` Paolo Bonzini
2013-04-02 14:50 ` [Qemu-devel] [RFC PATCH 3/6] audio: remove HAS_AUDIO Paolo Bonzini
` (4 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2013-04-02 14:50 UTC (permalink / raw)
To: qemu-devel; +Cc: av1474
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch_init.c | 136 +++++++++++++----------------------------------------
configure | 8 +---
hw/ac97.c | 3 +-
hw/adlib.c | 3 +-
hw/audiodev.h | 23 ++-------
hw/cs4231a.c | 3 +-
hw/es1370.c | 3 +-
hw/gus.c | 3 +-
hw/intel-hda.c | 22 ++++-----
hw/pcspk.c | 4 +-
hw/pcspk.h | 2 -
hw/sb16.c | 3 +-
hw/usb/dev-audio.c | 1 -
13 files changed, 64 insertions(+), 150 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index 4ef5a15..f9ad23b 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -899,97 +899,31 @@ 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
-
-#ifdef CONFIG_ES1370
- {
- "es1370",
- "ENSONIQ AudioPCI ES1370",
- 0,
- 0,
- { .init_pci = es1370_init }
- },
-#endif
+static struct soundhw soundhw[9];
+static int soundhw_count;
-#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 } }
-};
+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++;
+}
+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)
{
struct soundhw *c;
@@ -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 {
@@ -1132,11 +1066,7 @@ void cpudef_init(void)
int audio_available(void)
{
-#ifdef HAS_AUDIO
- return 1;
-#else
- return 0;
-#endif
+ return soundhw_count > 0;
}
int tcg_available(void)
diff --git a/configure b/configure
index 98716ae..dec699d 100755
--- a/configure
+++ b/configure
@@ -4322,15 +4322,9 @@ esac
if test "$target_softmmu" = "yes" ; then
case "$TARGET_BASE_ARCH" in
- arm)
+ arm|lm32|i386|mips|ppc)
cflags="-DHAS_AUDIO $cflags"
;;
- lm32)
- cflags="-DHAS_AUDIO $cflags"
- ;;
- i386|mips|ppc)
- cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
- ;;
esac
fi
diff --git a/hw/ac97.c b/hw/ac97.c
index c7d601f..40656e8 100644
--- a/hw/ac97.c
+++ b/hw/ac97.c
@@ -1396,7 +1396,7 @@ static void ac97_exitfn (PCIDevice *dev)
memory_region_destroy (&s->io_nabm);
}
-int ac97_init (PCIBus *bus)
+static int ac97_init (PCIBus *bus)
{
pci_create_simple (bus, -1, "AC97");
return 0;
@@ -1433,6 +1433,7 @@ static const TypeInfo ac97_info = {
static void ac97_register_types (void)
{
type_register_static (&ac97_info);
+ pci_register_soundhw("ac97", "Intel 82801AA AC97 Audio", ac97_init);
}
type_init (ac97_register_types)
diff --git a/hw/adlib.c b/hw/adlib.c
index ca47b55..b4617ae 100644
--- a/hw/adlib.c
+++ b/hw/adlib.c
@@ -369,7 +369,7 @@ static TypeInfo adlib_info = {
.class_init = adlib_class_initfn,
};
-int Adlib_init (ISABus *bus)
+static int Adlib_init (ISABus *bus)
{
isa_create_simple (bus, "adlib");
return 0;
@@ -378,6 +378,7 @@ int Adlib_init (ISABus *bus)
static void adlib_register_types (void)
{
type_register_static (&adlib_info);
+ isa_register_soundhw("adlib", ADLIB_DESC, Adlib_init);
}
type_init (adlib_register_types)
diff --git a/hw/audiodev.h b/hw/audiodev.h
index 428274f..b28abdd 100644
--- a/hw/audiodev.h
+++ b/hw/audiodev.h
@@ -1,25 +1,10 @@
#ifndef HW_AUDIODEV_H
#define HW_AUDIODEV_H 1
-/* es1370.c */
-int es1370_init(PCIBus *bus);
+void isa_register_soundhw(const char *name, const char *descr,
+ int (*init_isa)(ISABus *bus));
-/* sb16.c */
-int SB16_init(ISABus *bus);
-
-/* adlib.c */
-int Adlib_init(ISABus *bus);
-
-/* gus.c */
-int GUS_init(ISABus *bus);
-
-/* ac97.c */
-int ac97_init(PCIBus *bus);
-
-/* cs4231a.c */
-int cs4231a_init(ISABus *bus);
-
-/* intel-hda.c + hda-audio.c */
-int intel_hda_and_codec_init(PCIBus *bus);
+void pci_register_soundhw(const char *name, const char *descr,
+ int (*init_pci)(PCIBus *bus));
#endif
diff --git a/hw/cs4231a.c b/hw/cs4231a.c
index f005f25..d660ebd 100644
--- a/hw/cs4231a.c
+++ b/hw/cs4231a.c
@@ -659,7 +659,7 @@ static int cs4231a_initfn (ISADevice *dev)
return 0;
}
-int cs4231a_init (ISABus *bus)
+static int cs4231a_init (ISABus *bus)
{
isa_create_simple (bus, "cs4231a");
return 0;
@@ -692,6 +692,7 @@ static const TypeInfo cs4231a_info = {
static void cs4231a_register_types (void)
{
type_register_static (&cs4231a_info);
+ isa_register_soundhw("cs4231a", "CS4231A", cs4231a_init);
}
type_init (cs4231a_register_types)
diff --git a/hw/es1370.c b/hw/es1370.c
index e64cf23..540ed4c 100644
--- a/hw/es1370.c
+++ b/hw/es1370.c
@@ -1051,7 +1051,7 @@ static void es1370_exitfn (PCIDevice *dev)
memory_region_destroy (&s->io);
}
-int es1370_init (PCIBus *bus)
+static int es1370_init (PCIBus *bus)
{
pci_create_simple (bus, -1, "ES1370");
return 0;
@@ -1083,6 +1083,7 @@ static const TypeInfo es1370_info = {
static void es1370_register_types (void)
{
type_register_static (&es1370_info);
+ pci_register_soundhw("es1370", "ENSONIQ AudioPCI ES1370", es1370_init);
}
type_init (es1370_register_types)
diff --git a/hw/gus.c b/hw/gus.c
index d268224..b49cdca 100644
--- a/hw/gus.c
+++ b/hw/gus.c
@@ -293,7 +293,7 @@ static int gus_initfn (ISADevice *dev)
return 0;
}
-int GUS_init (ISABus *bus)
+static int GUS_init (ISABus *bus)
{
isa_create_simple (bus, "gus");
return 0;
@@ -327,6 +327,7 @@ static const TypeInfo gus_info = {
static void gus_register_types (void)
{
type_register_static (&gus_info);
+ isa_register_soundhw("gus", "Gravis Ultrasound GF1", GUS_init);
}
type_init (gus_register_types)
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
index 728b60f..020a850 100644
--- a/hw/intel-hda.c
+++ b/hw/intel-hda.c
@@ -1300,21 +1300,11 @@ static const TypeInfo hda_codec_device_type_info = {
.class_init = hda_codec_device_class_init,
};
-static void intel_hda_register_types(void)
-{
- type_register_static(&hda_codec_bus_info);
- type_register_static(&intel_hda_info_ich6);
- type_register_static(&intel_hda_info_ich9);
- type_register_static(&hda_codec_device_type_info);
-}
-
-type_init(intel_hda_register_types)
-
/*
* create intel hda controller with codec attached to it,
* so '-soundhw hda' works.
*/
-int intel_hda_and_codec_init(PCIBus *bus)
+static int intel_hda_and_codec_init(PCIBus *bus)
{
PCIDevice *controller;
BusState *hdabus;
@@ -1327,3 +1317,13 @@ int intel_hda_and_codec_init(PCIBus *bus)
return 0;
}
+static void intel_hda_register_types(void)
+{
+ type_register_static(&hda_codec_bus_info);
+ type_register_static(&intel_hda_info_ich6);
+ type_register_static(&intel_hda_info_ich9);
+ type_register_static(&hda_codec_device_type_info);
+ pci_register_soundhw("hda", "Intel HD Audio", intel_hda_and_codec_init);
+}
+
+type_init(intel_hda_register_types)
diff --git a/hw/pcspk.c b/hw/pcspk.c
index d533415..f245998 100644
--- a/hw/pcspk.c
+++ b/hw/pcspk.c
@@ -25,6 +25,7 @@
#include "hw/hw.h"
#include "hw/pc.h"
#include "hw/isa.h"
+#include "hw/audiodev.h"
#include "audio/audio.h"
#include "qemu/timer.h"
#include "hw/i8254.h"
@@ -105,7 +106,7 @@ static void pcspk_callback(void *opaque, int free)
}
}
-int pcspk_audio_init(ISABus *bus)
+static int pcspk_audio_init(ISABus *bus)
{
PCSpkState *s = pcspk_state;
struct audsettings as = {PCSPK_SAMPLE_RATE, 1, AUD_FMT_U8, 0};
@@ -197,5 +198,6 @@ static const TypeInfo pcspk_info = {
static void pcspk_register(void)
{
type_register_static(&pcspk_info);
+ isa_register_soundhw("pcspk", "PC speaker", pcspk_audio_init);
}
type_init(pcspk_register)
diff --git a/hw/pcspk.h b/hw/pcspk.h
index f448d22..f9dda02 100644
--- a/hw/pcspk.h
+++ b/hw/pcspk.h
@@ -40,6 +40,4 @@ static inline ISADevice *pcspk_init(ISABus *bus, ISADevice *pit)
return dev;
}
-int pcspk_audio_init(ISABus *bus);
-
#endif /* !HW_PCSPK_H */
diff --git a/hw/sb16.c b/hw/sb16.c
index bd51ceb..046ce98 100644
--- a/hw/sb16.c
+++ b/hw/sb16.c
@@ -1384,7 +1384,7 @@ static int sb16_initfn (ISADevice *dev)
return 0;
}
-int SB16_init (ISABus *bus)
+static int SB16_init (ISABus *bus)
{
isa_create_simple (bus, "sb16");
return 0;
@@ -1419,6 +1419,7 @@ static const TypeInfo sb16_info = {
static void sb16_register_types (void)
{
type_register_static (&sb16_info);
+ isa_register_soundhw("sb16", "Creative Sound Blaster 16", SB16_init);
}
type_init (sb16_register_types)
diff --git a/hw/usb/dev-audio.c b/hw/usb/dev-audio.c
index b8c79b8..04933a9 100644
--- a/hw/usb/dev-audio.c
+++ b/hw/usb/dev-audio.c
@@ -33,7 +33,6 @@
#include "hw/usb.h"
#include "hw/usb/desc.h"
#include "hw/hw.h"
-#include "hw/audiodev.h"
#include "audio/audio.h"
#define USBAUDIO_VENDOR_NUM 0x46f4 /* CRC16() of "QEMU" */
--
1.8.1.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [RFC PATCH 3/6] audio: remove HAS_AUDIO
2013-04-02 14:50 [Qemu-devel] [RFC PATCH 0/6] audio: simplify -soundhw machinery, use default-configs Paolo Bonzini
2013-04-02 14:50 ` [Qemu-devel] [RFC PATCH 1/6] adlib: qdev-ify Paolo Bonzini
2013-04-02 14:50 ` [Qemu-devel] [RFC PATCH 2/6] audio: remove the need for audio card CONFIG_* symbols Paolo Bonzini
@ 2013-04-02 14:50 ` Paolo Bonzini
2013-04-02 14:50 ` [Qemu-devel] [RFC PATCH 4/6] audio: remove CONFIG_* symbols Paolo Bonzini
` (3 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2013-04-02 14:50 UTC (permalink / raw)
To: qemu-devel; +Cc: av1474
Several targets can have wavcapture/-soundhw support via PCI cards.
HAS_AUDIO is a useless limitation, remove it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
arch_init.c | 9 ---------
configure | 8 --------
hmp-commands.hx | 4 ----
monitor.c | 2 --
4 files changed, 23 deletions(-)
diff --git a/arch_init.c b/arch_init.c
index f9ad23b..94b5c27 100644
--- a/arch_init.c
+++ b/arch_init.c
@@ -887,7 +887,6 @@ SaveVMHandlers savevm_ram_handlers = {
.cancel = ram_migration_cancel,
};
-#ifdef HAS_AUDIO
struct soundhw {
const char *name;
const char *descr;
@@ -1006,14 +1005,6 @@ void audio_init(ISABus *isa_bus, PCIBus *pci_bus)
}
}
}
-#else
-void select_soundhw(const char *optarg)
-{
-}
-void audio_init(ISABus *isa_bus, PCIBus *pci_bus)
-{
-}
-#endif
int qemu_uuid_parse(const char *str, uint8_t *uuid)
{
diff --git a/configure b/configure
index dec699d..16380f6 100755
--- a/configure
+++ b/configure
@@ -4320,14 +4320,6 @@ alpha)
;;
esac
-if test "$target_softmmu" = "yes" ; then
- case "$TARGET_BASE_ARCH" in
- arm|lm32|i386|mips|ppc)
- cflags="-DHAS_AUDIO $cflags"
- ;;
- esac
-fi
-
if test "$gprof" = "yes" ; then
echo "TARGET_GPROF=yes" >> $config_target_mak
if test "$target_linux_user" = "yes" ; then
diff --git a/hmp-commands.hx b/hmp-commands.hx
index 3d98604..67d452b 100644
--- a/hmp-commands.hx
+++ b/hmp-commands.hx
@@ -736,7 +736,6 @@ info mice
@end example
ETEXI
-#ifdef HAS_AUDIO
{
.name = "wavcapture",
.args_type = "path:F,freq:i?,bits:i?,nchannels:i?",
@@ -744,7 +743,6 @@ ETEXI
.help = "capture audio to a wave file (default frequency=44100 bits=16 channels=2)",
.mhandler.cmd = do_wav_capture,
},
-#endif
STEXI
@item wavcapture @var{filename} [@var{frequency} [@var{bits} [@var{channels}]]]
@findex wavcapture
@@ -759,7 +757,6 @@ Defaults:
@end itemize
ETEXI
-#ifdef HAS_AUDIO
{
.name = "stopcapture",
.args_type = "n:i",
@@ -767,7 +764,6 @@ ETEXI
.help = "stop capture",
.mhandler.cmd = do_stop_capture,
},
-#endif
STEXI
@item stopcapture @var{index}
@findex stopcapture
diff --git a/monitor.c b/monitor.c
index 4ec1db9..b3c707c 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1853,7 +1853,6 @@ static void do_info_capture(Monitor *mon, const QDict *qdict)
}
}
-#ifdef HAS_AUDIO
static void do_stop_capture(Monitor *mon, const QDict *qdict)
{
int i;
@@ -1894,7 +1893,6 @@ static void do_wav_capture(Monitor *mon, const QDict *qdict)
}
QLIST_INSERT_HEAD (&capture_head, s, entries);
}
-#endif
static qemu_acl *find_acl(Monitor *mon, const char *name)
{
--
1.8.1.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [RFC PATCH 4/6] audio: remove CONFIG_* symbols
2013-04-02 14:50 [Qemu-devel] [RFC PATCH 0/6] audio: simplify -soundhw machinery, use default-configs Paolo Bonzini
` (2 preceding siblings ...)
2013-04-02 14:50 ` [Qemu-devel] [RFC PATCH 3/6] audio: remove HAS_AUDIO Paolo Bonzini
@ 2013-04-02 14:50 ` Paolo Bonzini
2013-04-10 17:45 ` Andreas Färber
2013-04-02 14:51 ` [Qemu-devel] [RFC PATCH 5/6] audio: replace audio card configuration with default-configs Paolo Bonzini
` (2 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Paolo Bonzini @ 2013-04-02 14:50 UTC (permalink / raw)
To: qemu-devel; +Cc: av1474
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/configure b/configure
index 16380f6..1b2dc53 100755
--- a/configure
+++ b/configure
@@ -3557,10 +3557,6 @@ fi
if test "$cap_ng" = "yes" ; then
echo "CONFIG_LIBCAP=y" >> $config_host_mak
fi
-for card in $audio_card_list; do
- def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
- echo "$def=y" >> $config_host_mak
-done
echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
for drv in $audio_drv_list; do
def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
@@ -4226,11 +4222,6 @@ if test "$target_bsd_user" = "yes" ; then
echo "CONFIG_BSD_USER=y" >> $config_target_mak
fi
-# the static way of configuring available audio cards requires this workaround
-if test "$target_user_only" != "yes" && grep -q CONFIG_PCSPK $source_path/default-configs/$target.mak; then
- echo "CONFIG_PCSPK=y" >> $config_target_mak
-fi
-
# generate QEMU_CFLAGS/LDFLAGS for targets
cflags=""
--
1.8.1.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 4/6] audio: remove CONFIG_* symbols
2013-04-02 14:50 ` [Qemu-devel] [RFC PATCH 4/6] audio: remove CONFIG_* symbols Paolo Bonzini
@ 2013-04-10 17:45 ` Andreas Färber
2013-04-11 6:30 ` Paolo Bonzini
0 siblings, 1 reply; 13+ messages in thread
From: Andreas Färber @ 2013-04-10 17:45 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: av1474, qemu-devel
Am 02.04.2013 16:50, schrieb Paolo Bonzini:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Could this patch be squashed into 2/6? Or does it depend on anything
else - commit message doesn't indicate.
Andreas
> ---
> configure | 9 ---------
> 1 file changed, 9 deletions(-)
>
> diff --git a/configure b/configure
> index 16380f6..1b2dc53 100755
> --- a/configure
> +++ b/configure
> @@ -3557,10 +3557,6 @@ fi
> if test "$cap_ng" = "yes" ; then
> echo "CONFIG_LIBCAP=y" >> $config_host_mak
> fi
> -for card in $audio_card_list; do
> - def=CONFIG_`echo $card | LC_ALL=C tr '[a-z]' '[A-Z]'`
> - echo "$def=y" >> $config_host_mak
> -done
> echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
> for drv in $audio_drv_list; do
> def=CONFIG_`echo $drv | LC_ALL=C tr '[a-z]' '[A-Z]'`
> @@ -4226,11 +4222,6 @@ if test "$target_bsd_user" = "yes" ; then
> echo "CONFIG_BSD_USER=y" >> $config_target_mak
> fi
>
> -# the static way of configuring available audio cards requires this workaround
> -if test "$target_user_only" != "yes" && grep -q CONFIG_PCSPK $source_path/default-configs/$target.mak; then
> - echo "CONFIG_PCSPK=y" >> $config_target_mak
> -fi
> -
> # generate QEMU_CFLAGS/LDFLAGS for targets
>
> cflags=""
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Qemu-devel] [RFC PATCH 5/6] audio: replace audio card configuration with default-configs
2013-04-02 14:50 [Qemu-devel] [RFC PATCH 0/6] audio: simplify -soundhw machinery, use default-configs Paolo Bonzini
` (3 preceding siblings ...)
2013-04-02 14:50 ` [Qemu-devel] [RFC PATCH 4/6] audio: remove CONFIG_* symbols Paolo Bonzini
@ 2013-04-02 14:51 ` Paolo Bonzini
2013-04-02 14:51 ` [Qemu-devel] [RFC PATCH 6/6] audio: move PCI audio cards to pci.mak Paolo Bonzini
2013-04-09 17:06 ` [Qemu-devel] [RFC PATCH 0/6] audio: simplify -soundhw machinery, use default-configs Paolo Bonzini
6 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2013-04-02 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: av1474
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 7 -------
default-configs/i386-softmmu.mak | 2 +-
default-configs/mips-softmmu.mak | 2 +-
default-configs/mips64-softmmu.mak | 2 +-
default-configs/mips64el-softmmu.mak | 2 +-
default-configs/mipsel-softmmu.mak | 2 +-
default-configs/ppc-softmmu.mak | 2 +-
default-configs/ppc64-softmmu.mak | 2 +-
default-configs/ppcemb-softmmu.mak | 2 +-
default-configs/sound.mak | 7 +++++++
default-configs/x86_64-softmmu.mak | 2 +-
hw/Makefile.objs | 17 +++++++----------
12 files changed, 23 insertions(+), 26 deletions(-)
create mode 100644 default-configs/sound.mak
diff --git a/configure b/configure
index 1b2dc53..ec51b0b 100755
--- a/configure
+++ b/configure
@@ -113,8 +113,6 @@ interp_prefix="/usr/gnemul/qemu-%M"
static="no"
cross_prefix=""
audio_drv_list=""
-audio_card_list="ac97 es1370 sb16 hda"
-audio_possible_cards="ac97 es1370 sb16 cs4231a adlib gus hda"
block_drv_whitelist=""
host_cc="cc"
libs_softmmu=""
@@ -695,8 +693,6 @@ for opt do
;;
--oss-lib=*) oss_lib="$optarg"
;;
- --audio-card-list=*) audio_card_list=`echo "$optarg" | sed -e 's/,/ /g'`
- ;;
--audio-drv-list=*) audio_drv_list="$optarg"
;;
--block-drv-whitelist=*) block_drv_whitelist=`echo "$optarg" | sed -e 's/,/ /g'`
@@ -1081,8 +1077,6 @@ echo " --disable-cocoa disable Cocoa (Mac OS X only)"
echo " --enable-cocoa enable Cocoa (default on Mac OS X)"
echo " --audio-drv-list=LIST set audio drivers list:"
echo " Available drivers: $audio_possible_drivers"
-echo " --audio-card-list=LIST set list of emulated audio cards [$audio_card_list]"
-echo " Available cards: $audio_possible_cards"
echo " --block-drv-whitelist=L set block driver whitelist"
echo " (affects only QEMU, not qemu-img)"
echo " --enable-mixemu enable mixer emulation"
@@ -3393,7 +3387,6 @@ echo "curses support $curses"
echo "curl support $curl"
echo "mingw32 support $mingw32"
echo "Audio drivers $audio_drv_list"
-echo "Extra audio cards $audio_card_list"
echo "Block whitelist $block_drv_whitelist"
echo "Mixer emulation $mixemu"
echo "VirtFS support $virtfs"
diff --git a/default-configs/i386-softmmu.mak b/default-configs/i386-softmmu.mak
index df9e126..6bf6ff3 100644
--- a/default-configs/i386-softmmu.mak
+++ b/default-configs/i386-softmmu.mak
@@ -1,6 +1,7 @@
# Default configuration for i386-softmmu
include pci.mak
+include sound.mak
include usb.mak
CONFIG_VGA=y
CONFIG_VGA_PCI=y
@@ -21,7 +22,6 @@ CONFIG_IDE_ISA=y
CONFIG_IDE_PIIX=y
CONFIG_NE2000_ISA=y
CONFIG_PIIX_PCI=y
-CONFIG_SOUND=y
CONFIG_HPET=y
CONFIG_APPLESMC=y
CONFIG_I8259=y
diff --git a/default-configs/mips-softmmu.mak b/default-configs/mips-softmmu.mak
index 4f04a33..329256a 100644
--- a/default-configs/mips-softmmu.mak
+++ b/default-configs/mips-softmmu.mak
@@ -1,6 +1,7 @@
# Default configuration for mips-softmmu
include pci.mak
+include sound.mak
include usb.mak
CONFIG_ISA_MMIO=y
CONFIG_ESP=y
@@ -23,7 +24,6 @@ CONFIG_PIIX4=y
CONFIG_IDE_ISA=y
CONFIG_IDE_PIIX=y
CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
CONFIG_RC4030=y
CONFIG_DP8393X=y
CONFIG_DS1225Y=y
diff --git a/default-configs/mips64-softmmu.mak b/default-configs/mips64-softmmu.mak
index a5b6c3c..8353aff 100644
--- a/default-configs/mips64-softmmu.mak
+++ b/default-configs/mips64-softmmu.mak
@@ -1,6 +1,7 @@
# Default configuration for mips64-softmmu
include pci.mak
+include sound.mak
include usb.mak
CONFIG_ISA_MMIO=y
CONFIG_ESP=y
@@ -23,7 +24,6 @@ CONFIG_PIIX4=y
CONFIG_IDE_ISA=y
CONFIG_IDE_PIIX=y
CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
CONFIG_RC4030=y
CONFIG_DP8393X=y
CONFIG_DS1225Y=y
diff --git a/default-configs/mips64el-softmmu.mak b/default-configs/mips64el-softmmu.mak
index a0e6de8..f3f4491 100644
--- a/default-configs/mips64el-softmmu.mak
+++ b/default-configs/mips64el-softmmu.mak
@@ -1,6 +1,7 @@
# Default configuration for mips64el-softmmu
include pci.mak
+include sound.mak
include usb.mak
CONFIG_ISA_MMIO=y
CONFIG_ESP=y
@@ -24,7 +25,6 @@ CONFIG_IDE_ISA=y
CONFIG_IDE_PIIX=y
CONFIG_IDE_VIA=y
CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
CONFIG_RC4030=y
CONFIG_DP8393X=y
CONFIG_DS1225Y=y
diff --git a/default-configs/mipsel-softmmu.mak b/default-configs/mipsel-softmmu.mak
index 753dd76..2e49f80 100644
--- a/default-configs/mipsel-softmmu.mak
+++ b/default-configs/mipsel-softmmu.mak
@@ -1,6 +1,7 @@
# Default configuration for mipsel-softmmu
include pci.mak
+include sound.mak
include usb.mak
CONFIG_ISA_MMIO=y
CONFIG_ESP=y
@@ -23,7 +24,6 @@ CONFIG_PIIX4=y
CONFIG_IDE_ISA=y
CONFIG_IDE_PIIX=y
CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
CONFIG_RC4030=y
CONFIG_DP8393X=y
CONFIG_DS1225Y=y
diff --git a/default-configs/ppc-softmmu.mak b/default-configs/ppc-softmmu.mak
index c209a8d..01c80b6 100644
--- a/default-configs/ppc-softmmu.mak
+++ b/default-configs/ppc-softmmu.mak
@@ -1,6 +1,7 @@
# Default configuration for ppc-softmmu
include pci.mak
+include sound.mak
include usb.mak
CONFIG_GDBSTUB_XML=y
CONFIG_ISA_MMIO=y
@@ -34,7 +35,6 @@ CONFIG_IDE_ISA=y
CONFIG_IDE_CMD646=y
CONFIG_IDE_MACIO=y
CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
CONFIG_PFLASH_CFI01=y
CONFIG_PFLASH_CFI02=y
CONFIG_PTIMER=y
diff --git a/default-configs/ppc64-softmmu.mak b/default-configs/ppc64-softmmu.mak
index 8d490bd..d36462d 100644
--- a/default-configs/ppc64-softmmu.mak
+++ b/default-configs/ppc64-softmmu.mak
@@ -1,6 +1,7 @@
# Default configuration for ppc64-softmmu
include pci.mak
+include sound.mak
include usb.mak
CONFIG_GDBSTUB_XML=y
CONFIG_ISA_MMIO=y
@@ -34,7 +35,6 @@ CONFIG_IDE_ISA=y
CONFIG_IDE_CMD646=y
CONFIG_IDE_MACIO=y
CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
CONFIG_PFLASH_CFI01=y
CONFIG_PFLASH_CFI02=y
CONFIG_PTIMER=y
diff --git a/default-configs/ppcemb-softmmu.mak b/default-configs/ppcemb-softmmu.mak
index 7f13421..423cf7f 100644
--- a/default-configs/ppcemb-softmmu.mak
+++ b/default-configs/ppcemb-softmmu.mak
@@ -1,6 +1,7 @@
# Default configuration for ppcemb-softmmu
include pci.mak
+include sound.mak
include usb.mak
CONFIG_GDBSTUB_XML=y
CONFIG_ISA_MMIO=y
@@ -29,7 +30,6 @@ CONFIG_IDE_ISA=y
CONFIG_IDE_CMD646=y
CONFIG_IDE_MACIO=y
CONFIG_NE2000_ISA=y
-CONFIG_SOUND=y
CONFIG_PFLASH_CFI01=y
CONFIG_PFLASH_CFI02=y
CONFIG_PTIMER=y
diff --git a/default-configs/sound.mak b/default-configs/sound.mak
new file mode 100644
index 0000000..ed20388
--- /dev/null
+++ b/default-configs/sound.mak
@@ -0,0 +1,7 @@
+CONFIG_SB16=y
+CONFIG_AC97=y
+CONFIG_HDA=y
+CONFIG_ES1370=y
+#CONFIG_ADLIB=y
+#CONFIG_GUS=y
+#CONFIG_CS4231A=y
diff --git a/default-configs/x86_64-softmmu.mak b/default-configs/x86_64-softmmu.mak
index ab3cd5f..dedf0b1 100644
--- a/default-configs/x86_64-softmmu.mak
+++ b/default-configs/x86_64-softmmu.mak
@@ -1,6 +1,7 @@
# Default configuration for x86_64-softmmu
include pci.mak
+include sound.mak
include usb.mak
CONFIG_VGA=y
CONFIG_VGA_PCI=y
@@ -21,7 +22,6 @@ CONFIG_IDE_ISA=y
CONFIG_IDE_PIIX=y
CONFIG_NE2000_ISA=y
CONFIG_PIIX_PCI=y
-CONFIG_SOUND=y
CONFIG_HPET=y
CONFIG_APPLESMC=y
CONFIG_I8259=y
diff --git a/hw/Makefile.objs b/hw/Makefile.objs
index d0b2ecb..fcb7520 100644
--- a/hw/Makefile.objs
+++ b/hw/Makefile.objs
@@ -152,19 +152,16 @@ common-obj-$(CONFIG_MIPSNET) += mipsnet.o
common-obj-y += null-machine.o
# Sound
-sound-obj-y =
-sound-obj-$(CONFIG_SB16) += sb16.o
-sound-obj-$(CONFIG_ES1370) += es1370.o
-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
+common-obj-$(CONFIG_SB16) += sb16.o
+common-obj-$(CONFIG_ES1370) += es1370.o
+common-obj-$(CONFIG_AC97) += ac97.o
+common-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
+common-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
+common-obj-$(CONFIG_CS4231A) += cs4231a.o
+common-obj-$(CONFIG_HDA) += intel-hda.o hda-audio.o
$(obj)/adlib.o $(obj)/fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0
-common-obj-$(CONFIG_SOUND) += $(sound-obj-y)
-
common-obj-$(CONFIG_REALLY_VIRTFS) += 9pfs/
common-obj-y += usb/
--
1.8.1.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [Qemu-devel] [RFC PATCH 6/6] audio: move PCI audio cards to pci.mak
2013-04-02 14:50 [Qemu-devel] [RFC PATCH 0/6] audio: simplify -soundhw machinery, use default-configs Paolo Bonzini
` (4 preceding siblings ...)
2013-04-02 14:51 ` [Qemu-devel] [RFC PATCH 5/6] audio: replace audio card configuration with default-configs Paolo Bonzini
@ 2013-04-02 14:51 ` Paolo Bonzini
2013-04-09 17:06 ` [Qemu-devel] [RFC PATCH 0/6] audio: simplify -soundhw machinery, use default-configs Paolo Bonzini
6 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2013-04-02 14:51 UTC (permalink / raw)
To: qemu-devel; +Cc: av1474
This way, all PCI targets get them.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
default-configs/pci.mak | 3 +++
default-configs/sound.mak | 3 ---
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/default-configs/pci.mak b/default-configs/pci.mak
index ce56d58..d32ddee 100644
--- a/default-configs/pci.mak
+++ b/default-configs/pci.mak
@@ -9,6 +9,9 @@ CONFIG_NE2000_PCI=y
CONFIG_EEPRO100_PCI=y
CONFIG_PCNET_PCI=y
CONFIG_PCNET_COMMON=y
+CONFIG_AC97=y
+CONFIG_HDA=y
+CONFIG_ES1370=y
CONFIG_LSI_SCSI_PCI=y
CONFIG_MEGASAS_SCSI_PCI=y
CONFIG_RTL8139_PCI=y
diff --git a/default-configs/sound.mak b/default-configs/sound.mak
index ed20388..ff69c4d 100644
--- a/default-configs/sound.mak
+++ b/default-configs/sound.mak
@@ -1,7 +1,4 @@
CONFIG_SB16=y
-CONFIG_AC97=y
-CONFIG_HDA=y
-CONFIG_ES1370=y
#CONFIG_ADLIB=y
#CONFIG_GUS=y
#CONFIG_CS4231A=y
--
1.8.1.4
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [Qemu-devel] [RFC PATCH 0/6] audio: simplify -soundhw machinery, use default-configs
2013-04-02 14:50 [Qemu-devel] [RFC PATCH 0/6] audio: simplify -soundhw machinery, use default-configs Paolo Bonzini
` (5 preceding siblings ...)
2013-04-02 14:51 ` [Qemu-devel] [RFC PATCH 6/6] audio: move PCI audio cards to pci.mak Paolo Bonzini
@ 2013-04-09 17:06 ` Paolo Bonzini
6 siblings, 0 replies; 13+ messages in thread
From: Paolo Bonzini @ 2013-04-09 17:06 UTC (permalink / raw)
To: av1474; +Cc: qemu-devel
Il 02/04/2013 16:50, Paolo Bonzini ha scritto:
> This avoids audio-specific hacks in configure, so that the
> same mechanism is used for all targets and all devices.
>
> Not yet tested enough, hence RFC.
malc, any news? This is now ready to go in.
Paolo
> Paolo
>
> Paolo Bonzini (6):
> adlib: qdev-ify
> audio: remove the need for audio card CONFIG_* symbols
> audio: remove HAS_AUDIO
> audio: remove CONFIG_* symbols
> audio: replace audio card configuration with default-configs
> audio: move PCI audio cards to pci.mak
>
> arch_init.c | 145 ++++++++---------------------------
> configure | 30 --------
> default-configs/i386-softmmu.mak | 2 +-
> default-configs/mips-softmmu.mak | 2 +-
> default-configs/mips64-softmmu.mak | 2 +-
> default-configs/mips64el-softmmu.mak | 2 +-
> default-configs/mipsel-softmmu.mak | 2 +-
> default-configs/pci.mak | 3 +
> default-configs/ppc-softmmu.mak | 2 +-
> default-configs/ppc64-softmmu.mak | 2 +-
> default-configs/ppcemb-softmmu.mak | 2 +-
> default-configs/sound.mak | 4 +
> default-configs/x86_64-softmmu.mak | 2 +-
> hmp-commands.hx | 4 -
> hw/Makefile.objs | 17 ++--
> hw/ac97.c | 3 +-
> hw/adlib.c | 83 +++++++++++++++-----
> hw/audiodev.h | 23 +-----
> hw/cs4231a.c | 3 +-
> hw/es1370.c | 3 +-
> hw/gus.c | 3 +-
> hw/intel-hda.c | 22 +++---
> hw/pcspk.c | 4 +-
> hw/pcspk.h | 2 -
> hw/sb16.c | 3 +-
> hw/usb/dev-audio.c | 1 -
> monitor.c | 2 -
> 27 files changed, 149 insertions(+), 224 deletions(-)
> create mode 100644 default-configs/sound.mak
>
^ permalink raw reply [flat|nested] 13+ messages in thread