Lines Matching +full:build +full:- +full:without +full:- +full:default +full:- +full:devices

2  * QEMU<->ACPI BIOS PCI hotplug interface
6 * Interface specification - see docs/specs/acpi_pci_hotplug.txt
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * Contributions after 2012-01-13 are licensed under the terms of the
30 #include "hw/pci-host/i440fx.h"
35 #include "hw/pci-bridge/xio3130_downstream.h"
36 #include "hw/i386/acpi-build.h"
41 #include "qom/qom-qobject.h"
67 return -1; in acpi_pcihp_get_bsel()
83 DeviceState *br = bus->qbus.parent; in acpi_set_bsel()
88 if (!is_bridge || (!br->hotplugged && info->has_bridge_hotplug)) { in acpi_set_bsel()
91 *bus_bsel = info->bsel_alloc++; in acpi_set_bsel()
117 bus = PCI_HOST_BRIDGE(host)->bus; in acpi_set_pci_info()
127 if (find->bsel == acpi_pcihp_get_bsel(bus)) { in acpi_pcihp_test_hotplug_bus()
128 find->bus = bus; in acpi_pcihp_test_hotplug_bus()
140 pci_for_each_bus(s->root, acpi_pcihp_test_hotplug_bus, &find); in acpi_pcihp_find_hotplug_bus()
147 find.bus = s->root; in acpi_pcihp_find_hotplug_bus()
153 * non-hotpluggable, find.bus will match the root bus when bsel in acpi_pcihp_find_hotplug_bus()
171 * ACPI doesn't allow hotplug of bridge devices. Don't allow in acpi_pcihp_pc_no_hotplug()
172 * hot-unplug of bridge devices unless they were added by hotplug in acpi_pcihp_pc_no_hotplug()
175 * Don't allow hot-unplug of SR-IOV Virtual Functions, as they in acpi_pcihp_pc_no_hotplug()
178 return (IS_PCI_BRIDGE(dev) && !dev->qdev.hotplugged) || !dc->hotpluggable || in acpi_pcihp_pc_no_hotplug()
196 s->acpi_pcihp_pci_status[bsel].down &= ~(1U << slot); in acpi_pcihp_eject_slot()
197 s->acpi_pcihp_pci_status[bsel].up &= ~(1U << slot); in acpi_pcihp_eject_slot()
199 QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) { in acpi_pcihp_eject_slot()
200 DeviceState *qdev = kid->child; in acpi_pcihp_eject_slot()
202 if (PCI_SLOT(dev->devfn) == slot) { in acpi_pcihp_eject_slot()
205 * partially_hotplugged is used by virtio-net failover: in acpi_pcihp_eject_slot()
211 if (dev->partially_hotplugged) { in acpi_pcihp_eject_slot()
214 * virtio-net failover asks to unplug the device, in acpi_pcihp_eject_slot()
219 qdev->pending_deleted_event = false; in acpi_pcihp_eject_slot()
236 while (s->acpi_pcihp_pci_status[bsel].down) { in acpi_pcihp_update_hotplug_bus()
237 acpi_pcihp_eject_slot(s, bsel, s->acpi_pcihp_pci_status[bsel].down); in acpi_pcihp_update_hotplug_bus()
240 s->acpi_pcihp_pci_status[bsel].hotplug_enable = ~0; in acpi_pcihp_update_hotplug_bus()
245 QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) { in acpi_pcihp_update_hotplug_bus()
246 DeviceState *qdev = kid->child; in acpi_pcihp_update_hotplug_bus()
248 int slot = PCI_SLOT(pdev->devfn); in acpi_pcihp_update_hotplug_bus()
251 s->acpi_pcihp_pci_status[bsel].hotplug_enable &= ~(1U << slot); in acpi_pcihp_update_hotplug_bus()
267 acpi_set_pci_info(s->use_acpi_hotplug_bridge); in acpi_pcihp_reset()
276 /* Only hotplugged devices need the hotplug capability. */ in acpi_pcihp_device_pre_plug_cb()
277 if (dev->hotplugged && in acpi_pcihp_device_pre_plug_cb()
289 int slot = PCI_SLOT(pdev->devfn); in acpi_pcihp_device_plug_cb()
297 if (!dev->hotplugged) { in acpi_pcihp_device_plug_cb()
299 * Overwrite the default hotplug handler with the ACPI PCI one in acpi_pcihp_device_plug_cb()
302 if (s->use_acpi_hotplug_bridge && in acpi_pcihp_device_plug_cb()
308 assert(QLIST_EMPTY(&sec->child)); in acpi_pcihp_device_plug_cb()
323 s->acpi_pcihp_pci_status[bsel].up |= (1U << slot); in acpi_pcihp_device_plug_cb()
332 trace_acpi_pci_unplug(PCI_SLOT(pdev->devfn), in acpi_pcihp_device_unplug_cb()
343 int slot = PCI_SLOT(pdev->devfn); in acpi_pcihp_device_unplug_request_cb()
355 * pending_deleted_event is used by virtio-net failover to detect the in acpi_pcihp_device_unplug_request_cb()
359 pdev->qdev.pending_deleted_event = true; in acpi_pcihp_device_unplug_request_cb()
367 pdev->qdev.pending_deleted_expires_ms = in acpi_pcihp_device_unplug_request_cb()
370 s->acpi_pcihp_pci_status[bsel].down |= (1U << slot); in acpi_pcihp_device_unplug_request_cb()
376 Object *o = OBJECT(bus->parent); in acpi_pcihp_is_hotpluggable_bus()
378 if (s->use_acpi_hotplug_bridge && in acpi_pcihp_is_hotpluggable_bus()
380 if (object_dynamic_cast(o, TYPE_PCIE_SLOT) && !PCIE_SLOT(o)->hotplug) { in acpi_pcihp_is_hotpluggable_bus()
386 if (s->use_acpi_root_pci_hotplug) { in acpi_pcihp_is_hotpluggable_bus()
396 int bsel = s->hotplug_select; in pci_read()
404 val = s->acpi_pcihp_pci_status[bsel].up; in pci_read()
405 if (s->use_acpi_hotplug_bridge) { in pci_read()
406 s->acpi_pcihp_pci_status[bsel].up = 0; in pci_read()
411 val = s->acpi_pcihp_pci_status[bsel].down; in pci_read()
418 val = s->acpi_pcihp_pci_status[bsel].hotplug_enable; in pci_read()
422 val = s->hotplug_select; in pci_read()
426 val = s->acpi_index; in pci_read()
427 s->acpi_index = 0; in pci_read()
430 default: in pci_read()
445 s->acpi_index = 0; in pci_write()
449 * fetch acpi-index for specified slot so that follow up read from in pci_write()
454 if (s->hotplug_select >= ACPI_PCIHP_MAX_HOTPLUG_BUS) { in pci_write()
458 bus = acpi_pcihp_find_hotplug_bus(s, s->hotplug_select); in pci_write()
462 QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) { in pci_write()
463 Object *o = OBJECT(kid->child); in pci_write()
465 if (PCI_SLOT(dev->devfn) == slot) { in pci_write()
466 s->acpi_index = object_property_get_uint(o, "acpi-index", NULL); in pci_write()
470 trace_acpi_pci_acpi_index_write(s->hotplug_select, slot, s->acpi_index); in pci_write()
473 if (s->hotplug_select >= ACPI_PCIHP_MAX_HOTPLUG_BUS) { in pci_write()
476 acpi_pcihp_eject_slot(s, s->hotplug_select, data); in pci_write()
480 s->hotplug_select = s->use_acpi_hotplug_bridge ? data : in pci_write()
483 default: in pci_write()
501 s->io_len = ACPI_PCIHP_SIZE; in acpi_pcihp_init()
502 s->io_base = io_base; in acpi_pcihp_init()
504 s->root = root_bus; in acpi_pcihp_init()
506 memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s, in acpi_pcihp_init()
507 "acpi-pci-hotplug", s->io_len); in acpi_pcihp_init()
508 memory_region_add_subregion(io, s->io_base, &s->io); in acpi_pcihp_init()
510 object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_base, in acpi_pcihp_init()
512 object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_len, in acpi_pcihp_init()