dcavalca / rpms / qemu

Forked from rpms/qemu a year ago
Clone

Blame 0214-ac97-don-t-override-the-pci-subsystem-id.patch

cd9d16
From 498a3d8b7d28b8c114d65d9db5ccf3e96e2458f1 Mon Sep 17 00:00:00 2001
cd9d16
From: Gerd Hoffmann <kraxel@redhat.com>
cd9d16
Date: Mon, 7 Nov 2011 16:33:09 +0100
cd9d16
Subject: [PATCH] ac97: don't override the pci subsystem id
cd9d16
MIME-Version: 1.0
cd9d16
Content-Type: text/plain; charset=UTF-8
cd9d16
Content-Transfer-Encoding: 8bit
cd9d16
cd9d16
This patch removes the code lines which set the subsystem id for the
cd9d16
emulated ac97 card to 8086:0000.  Due to the device id being zero the
cd9d16
subsystem id isn't vaild anyway.  With the patch applied the sound card
cd9d16
gets the default qemu subsystem id (1af4:1100) instead.
cd9d16
cd9d16
[ v2: old & broken id is maintained for -M pc-$oldqemuversion ]
cd9d16
cd9d16
Cc: Takashi Iwai <tiwai@suse.de>
cd9d16
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
cd9d16
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
cd9d16
(cherry picked from commit 25a21c94c0055e078acb7f7455e66c8a15f32385)
cd9d16
cd9d16
Signed-off-by: Bruce Rogers <brogers@suse.com>
cd9d16
Signed-off-by: Andreas Färber <afaerber@suse.de>
cd9d16
---
cd9d16
 hw/ac97.c    | 16 +++++++++++-----
cd9d16
 hw/pc_piix.c | 16 ++++++++++++++++
cd9d16
 2 files changed, 27 insertions(+), 5 deletions(-)
cd9d16
cd9d16
diff --git a/hw/ac97.c b/hw/ac97.c
cd9d16
index 0b59896..a039481 100644
cd9d16
--- a/hw/ac97.c
cd9d16
+++ b/hw/ac97.c
cd9d16
@@ -149,6 +149,7 @@ typedef struct AC97BusMasterRegs {
cd9d16
 typedef struct AC97LinkState {
cd9d16
     PCIDevice dev;
cd9d16
     QEMUSoundCard card;
cd9d16
+    uint32_t use_broken_id;
cd9d16
     uint32_t glob_cnt;
cd9d16
     uint32_t glob_sta;
cd9d16
     uint32_t cas;
cd9d16
@@ -1301,11 +1302,12 @@ static int ac97_initfn (PCIDevice *dev)
cd9d16
     c[PCI_BASE_ADDRESS_0 + 6] = 0x00;
cd9d16
     c[PCI_BASE_ADDRESS_0 + 7] = 0x00;
cd9d16
 
cd9d16
-    c[PCI_SUBSYSTEM_VENDOR_ID] = 0x86;      /* svid subsystem vendor id rwo */
cd9d16
-    c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x80;
cd9d16
-
cd9d16
-    c[PCI_SUBSYSTEM_ID] = 0x00;      /* sid subsystem id rwo */
cd9d16
-    c[PCI_SUBSYSTEM_ID + 1] = 0x00;
cd9d16
+    if (s->use_broken_id) {
cd9d16
+        c[PCI_SUBSYSTEM_VENDOR_ID] = 0x86;
cd9d16
+        c[PCI_SUBSYSTEM_VENDOR_ID + 1] = 0x80;
cd9d16
+        c[PCI_SUBSYSTEM_ID] = 0x00;
cd9d16
+        c[PCI_SUBSYSTEM_ID + 1] = 0x00;
cd9d16
+    }
cd9d16
 
cd9d16
     c[PCI_INTERRUPT_LINE] = 0x00;      /* intr_ln interrupt line rw */
cd9d16
     /* TODO: RST# value should be 0. */
cd9d16
@@ -1336,6 +1338,10 @@ static PCIDeviceInfo ac97_info = {
cd9d16
     .device_id    = PCI_DEVICE_ID_INTEL_82801AA_5,
cd9d16
     .revision     = 0x01,
cd9d16
     .class_id     = PCI_CLASS_MULTIMEDIA_AUDIO,
cd9d16
+    .qdev.props   = (Property[]) {
cd9d16
+        DEFINE_PROP_UINT32("use_broken_id", AC97LinkState, use_broken_id, 0),
cd9d16
+        DEFINE_PROP_END_OF_LIST(),
cd9d16
+    }
cd9d16
 };
cd9d16
 
cd9d16
 static void ac97_register (void)
cd9d16
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
cd9d16
index c5c16b4..31552fd 100644
cd9d16
--- a/hw/pc_piix.c
cd9d16
+++ b/hw/pc_piix.c
cd9d16
@@ -300,6 +300,10 @@ static QEMUMachine pc_machine_v0_13 = {
cd9d16
             .driver   = "virtio-net-pci",
cd9d16
             .property = "event_idx",
cd9d16
             .value    = "off",
cd9d16
+        },{
cd9d16
+            .driver   = "AC97",
cd9d16
+            .property = "use_broken_id",
cd9d16
+            .value    = stringify(1),
cd9d16
         },
cd9d16
         { /* end of list */ }
cd9d16
     },
cd9d16
@@ -343,6 +347,10 @@ static QEMUMachine pc_machine_v0_12 = {
cd9d16
             .driver   = "virtio-net-pci",
cd9d16
             .property = "event_idx",
cd9d16
             .value    = "off",
cd9d16
+        },{
cd9d16
+            .driver   = "AC97",
cd9d16
+            .property = "use_broken_id",
cd9d16
+            .value    = stringify(1),
cd9d16
         },
cd9d16
         { /* end of list */ }
cd9d16
     }
cd9d16
@@ -394,6 +402,10 @@ static QEMUMachine pc_machine_v0_11 = {
cd9d16
             .driver   = "virtio-net-pci",
cd9d16
             .property = "event_idx",
cd9d16
             .value    = "off",
cd9d16
+        },{
cd9d16
+            .driver   = "AC97",
cd9d16
+            .property = "use_broken_id",
cd9d16
+            .value    = stringify(1),
cd9d16
         },
cd9d16
         { /* end of list */ }
cd9d16
     }
cd9d16
@@ -457,6 +469,10 @@ static QEMUMachine pc_machine_v0_10 = {
cd9d16
             .driver   = "virtio-net-pci",
cd9d16
             .property = "event_idx",
cd9d16
             .value    = "off",
cd9d16
+        },{
cd9d16
+            .driver   = "AC97",
cd9d16
+            .property = "use_broken_id",
cd9d16
+            .value    = stringify(1),
cd9d16
         },
cd9d16
         { /* end of list */ }
cd9d16
     },
cd9d16
-- 
cd9d16
1.7.11.2
cd9d16