From 1f8621842ebba95002f500935ac84e7dcf71a540 Mon Sep 17 00:00:00 2001 From: Igor Mammedov Date: Mon, 2 Jun 2014 15:25:22 +0200 Subject: acpi:ich9: add memory hotplug handling Add memory hotplug initialization/handling to ICH9 LPC device and enable it by default for post 2.0 machine types Signed-off-by: Igor Mammedov Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/isa/lpc_ich9.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'hw/isa/lpc_ich9.c') diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c index ad43475..fb2b82d 100644 --- a/hw/isa/lpc_ich9.c +++ b/hw/isa/lpc_ich9.c @@ -599,6 +599,19 @@ static int ich9_lpc_init(PCIDevice *d) return 0; } +static void ich9_device_plug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ + ICH9LPCState *lpc = ICH9_LPC_DEVICE(hotplug_dev); + + ich9_pm_device_plug_cb(&lpc->pm, dev, errp); +} + +static void ich9_device_unplug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ +} + static bool ich9_rst_cnt_needed(void *opaque) { ICH9LPCState *lpc = opaque; @@ -642,6 +655,7 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); PCIDeviceClass *k = PCI_DEVICE_CLASS(klass); + HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass); set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); dc->reset = ich9_lpc_reset; @@ -658,6 +672,8 @@ static void ich9_lpc_class_init(ObjectClass *klass, void *data) * pc_q35_init() */ dc->cannot_instantiate_with_device_add_yet = true; + hc->plug = ich9_device_plug_cb; + hc->unplug = ich9_device_unplug_cb; } static const TypeInfo ich9_lpc_info = { @@ -666,6 +682,10 @@ static const TypeInfo ich9_lpc_info = { .instance_size = sizeof(struct ICH9LPCState), .instance_init = ich9_lpc_initfn, .class_init = ich9_lpc_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { } + } }; static void ich9_lpc_register(void) -- cgit v1.1