mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
pci/pcie: convert PCIE hotplug to use hotplug-handler API
Split pcie_cap_slot_hotplug() into hotplug/unplug callbacks and register them as "hotplug-handler" interface implementation of PCIE_SLOT device. Replace pci_bus_hotplug() wiring with setting link on PCI BUS "hotplug-handler" property to PCI_BRIDGE_DEV device. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
5d268704d7
commit
a66e657e18
3 changed files with 53 additions and 25 deletions
|
@ -19,6 +19,7 @@
|
|||
*/
|
||||
|
||||
#include "hw/pci/pcie_port.h"
|
||||
#include "hw/hotplug.h"
|
||||
|
||||
void pcie_port_init_reg(PCIDevice *d)
|
||||
{
|
||||
|
@ -149,8 +150,11 @@ static Property pcie_slot_props[] = {
|
|||
static void pcie_slot_class_init(ObjectClass *oc, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(oc);
|
||||
HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
|
||||
|
||||
dc->props = pcie_slot_props;
|
||||
hc->plug = pcie_cap_slot_hotplug_cb;
|
||||
hc->unplug = pcie_cap_slot_hot_unplug_cb;
|
||||
}
|
||||
|
||||
static const TypeInfo pcie_slot_type_info = {
|
||||
|
@ -159,6 +163,10 @@ static const TypeInfo pcie_slot_type_info = {
|
|||
.instance_size = sizeof(PCIESlot),
|
||||
.abstract = true,
|
||||
.class_init = pcie_slot_class_init,
|
||||
.interfaces = (InterfaceInfo[]) {
|
||||
{ TYPE_HOTPLUG_HANDLER },
|
||||
{ }
|
||||
}
|
||||
};
|
||||
|
||||
static void pcie_port_register_types(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue