hw/i386: Enable goldfish audio

Follow the same way in which goldfish battery, events, etc. were added
to the default virtual board for x86/x86_64. See commit 16a8f17 for
details.

N.B. While there is no known issue with audio output, audio input does
not work reliably/correctly at this point. Nevertheless, enable both
functions and gradually fix the latter.

Change-Id: Ib0a253c0f73f8fdd44d727504cfddb325056dc2b
Signed-off-by: Yu Ning <yu.ning@intel.com>
diff --git a/hw/i386/acpi-dsdt-goldfish.dsl b/hw/i386/acpi-dsdt-goldfish.dsl
index 703669e..bed182e 100644
--- a/hw/i386/acpi-dsdt-goldfish.dsl
+++ b/hw/i386/acpi-dsdt-goldfish.dsl
@@ -78,4 +78,19 @@
             }
         })
     }
+
+    /* Audio */
+    Device(GFAU) {
+        Name(_HID, "GFSH0005")
+        Name(_STR, Unicode("goldfish audio"))
+        Name(_CRS, ResourceTemplate() {
+            Memory32Fixed(ReadWrite,
+                GF_AUDIO_IOMEM_BASE,
+                GF_AUDIO_IOMEM_SIZE
+                )
+            Interrupt(, Edge, ActiveHigh) {
+                GF_AUDIO_IRQ
+            }
+        })
+    }
 }
diff --git a/hw/i386/acpi-dsdt.hex.generated b/hw/i386/acpi-dsdt.hex.generated
index 8b91043..b01d3b3 100644
--- a/hw/i386/acpi-dsdt.hex.generated
+++ b/hw/i386/acpi-dsdt.hex.generated
@@ -3,12 +3,12 @@
 0x53,
 0x44,
 0x54,
-0x95,
+0xf3,
 0xf,
 0x0,
 0x0,
 0x1,
-0xff,
+0x5e,
 0x42,
 0x58,
 0x50,
@@ -110,8 +110,8 @@
 0x47,
 0x42,
 0x10,
-0x4c,
-0x18,
+0x4a,
+0x1e,
 0x5f,
 0x53,
 0x42,
@@ -506,6 +506,100 @@
 0x0,
 0x79,
 0x0,
+0x5b,
+0x82,
+0x4c,
+0x5,
+0x47,
+0x46,
+0x41,
+0x55,
+0x8,
+0x5f,
+0x48,
+0x49,
+0x44,
+0xd,
+0x47,
+0x46,
+0x53,
+0x48,
+0x30,
+0x30,
+0x30,
+0x35,
+0x0,
+0x8,
+0x5f,
+0x53,
+0x54,
+0x52,
+0x11,
+0x21,
+0xa,
+0x1e,
+0x67,
+0x0,
+0x6f,
+0x0,
+0x6c,
+0x0,
+0x64,
+0x0,
+0x66,
+0x0,
+0x69,
+0x0,
+0x73,
+0x0,
+0x68,
+0x0,
+0x20,
+0x0,
+0x61,
+0x0,
+0x75,
+0x0,
+0x64,
+0x0,
+0x69,
+0x0,
+0x6f,
+0x0,
+0x0,
+0x0,
+0x8,
+0x5f,
+0x43,
+0x52,
+0x53,
+0x11,
+0x1a,
+0xa,
+0x17,
+0x86,
+0x9,
+0x0,
+0x1,
+0x0,
+0x30,
+0x1,
+0xff,
+0x0,
+0x1,
+0x0,
+0x0,
+0x89,
+0x6,
+0x0,
+0x3,
+0x1,
+0x14,
+0x0,
+0x0,
+0x0,
+0x79,
+0x0,
 0x10,
 0x22,
 0x5f,
@@ -3990,5 +4084,5 @@
 0x0
 };
 static unsigned short piix_dsdt_applesmc_sta[] = {
-0x4e0
+0x53e
 };
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 5a07418..be07d3b 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -242,6 +242,7 @@
                          gsi[GF_EVENTS_IRQ]);
     sysbus_create_simple("android_pipe", GF_PIPE_IOMEM_BASE, gsi[GF_PIPE_IRQ]);
     sysbus_create_simple("goldfish_fb", GF_FB_IOMEM_BASE, gsi[GF_FB_IRQ]);
+    sysbus_create_simple("goldfish_audio", GF_AUDIO_IOMEM_BASE, gsi[GF_AUDIO_IRQ]);
 #endif  /* CONFIG_ANDROID */
 
     pc_vga_init(isa_bus, pci_enabled ? pci_bus : NULL);
diff --git a/include/hw/acpi/goldfish_defs.h b/include/hw/acpi/goldfish_defs.h
index bd37cf2..9f95f64 100644
--- a/include/hw/acpi/goldfish_defs.h
+++ b/include/hw/acpi/goldfish_defs.h
@@ -42,4 +42,9 @@
 #define GF_FB_IOMEM_SIZE        0x00000100
 #define GF_FB_IRQ               19
 
+/* goldfish audio */
+#define GF_AUDIO_IOMEM_BASE     0xff013000
+#define GF_AUDIO_IOMEM_SIZE     0x00000100
+#define GF_AUDIO_IRQ            20
+
 #endif  /* !ACPI_GOLDFISH_DEFS_H */