qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 49/61] pci hot add: pass opaque argument to callback


From: Isaku Yamahata
Subject: [Qemu-devel] [PATCH 49/61] pci hot add: pass opaque argument to callback.
Date: Wed, 30 Sep 2009 19:18:25 +0900

pass opaque argument to callback.

Signed-off-by: Isaku Yamahata <address@hidden>
---
 hw/acpi.c       |    8 ++++++--
 hw/acpi_piix4.c |    6 +++---
 sysemu.h        |    4 ++--
 3 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/hw/acpi.c b/hw/acpi.c
index 44056a1..4b1c5c8 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -22,15 +22,19 @@
 #include "acpi.h"
 
 static qemu_system_device_hot_add_t device_hot_add_callback;
-void qemu_system_device_hot_add_register(qemu_system_device_hot_add_t callback)
+static void *device_hot_add_arg;
+
+void qemu_system_device_hot_add_register(qemu_system_device_hot_add_t callback,
+void *opaque)
 {
     device_hot_add_callback = callback;
+    device_hot_add_arg = opaque;
 }
 
 void qemu_system_device_hot_add(int pcibus, int slot, int state)
 {
     if (device_hot_add_callback)
-        device_hot_add_callback(pcibus, slot, state);
+        device_hot_add_callback(pcibus, slot, state, device_hot_add_arg);
 }
 
 struct acpi_table_header
diff --git a/hw/acpi_piix4.c b/hw/acpi_piix4.c
index 5f3ee9a..c11e1b9 100644
--- a/hw/acpi_piix4.c
+++ b/hw/acpi_piix4.c
@@ -526,7 +526,7 @@ static void pciej_write(void *opaque, uint32_t addr, 
uint32_t val)
 #endif
 }
 
-static void piix4_device_hot_add(int bus, int slot, int state);
+static void piix4_device_hot_add(int bus, int slot, int state, void* opaque);
 
 void piix4_acpi_system_hot_add_init(void)
 {
@@ -539,7 +539,7 @@ void piix4_acpi_system_hot_add_init(void)
     register_ioport_write(PCI_EJ_BASE, 4, 4, pciej_write, NULL);
     register_ioport_read(PCI_EJ_BASE, 4, 4,  pciej_read, NULL);
 
-    qemu_system_device_hot_add_register(piix4_device_hot_add);
+    qemu_system_device_hot_add_register(piix4_device_hot_add, NULL);
 }
 
 static void enable_device(struct pci_status *p, struct gpe_regs *g, int slot)
@@ -554,7 +554,7 @@ static void disable_device(struct pci_status *p, struct 
gpe_regs *g, int slot)
     p->down |= (1 << slot);
 }
 
-static void piix4_device_hot_add(int bus, int slot, int state)
+static void piix4_device_hot_add(int bus, int slot, int state, void *opaque)
 {
     pci0_status.up = 0;
     pci0_status.down = 0;
diff --git a/sysemu.h b/sysemu.h
index 8bf90ee..1450c65 100644
--- a/sysemu.h
+++ b/sysemu.h
@@ -198,8 +198,8 @@ extern QemuOpts *drive_add(const char *file, const char 
*fmt, ...);
 extern DriveInfo *drive_init(QemuOpts *arg, void *machine, int *fatal_error);
 
 /* acpi */
-typedef void (*qemu_system_device_hot_add_t)(int pcibus, int slot, int state);
-void qemu_system_device_hot_add_register(qemu_system_device_hot_add_t 
callback);
+typedef void (*qemu_system_device_hot_add_t)(int pcibus, int slot, int state, 
void *opaque);
+void qemu_system_device_hot_add_register(qemu_system_device_hot_add_t 
callback, void *opaque);
 void qemu_system_device_hot_add(int pcibus, int slot, int state);
 
 /* device-hotplug */
-- 
1.6.0.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]