2 * QEMU<->ACPI BIOS PCI hotplug interface
4 * QEMU supports PCI hotplug via ACPI. This module
5 * implements the interface between QEMU and the ACPI BIOS.
6 * Interface specification - see docs/specs/acpi_pci_hotplug.txt
8 * Copyright (c) 2013, Red Hat Inc, Michael S. Tsirkin (mst@redhat.com)
9 * Copyright (c) 2006 Fabrice Bellard
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License version 2 as published by the Free Software Foundation.
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, see <http://www.gnu.org/licenses/>
23 * Contributions after 2012-01-13 are licensed under the terms of the
24 * GNU GPL, version 2 or (at your option) any later version.
27 #ifndef HW_ACPI_PCIHP_H
28 #define HW_ACPI_PCIHP_H
31 #include <qemu/typedefs.h>
32 #include "hw/acpi/acpi.h"
33 #include "migration/vmstate.h"
35 #define ACPI_PCIHP_IO_BASE_PROP "acpi-pcihp-io-base"
36 #define ACPI_PCIHP_IO_LEN_PROP "acpi-pcihp-io-len"
38 typedef struct AcpiPciHpPciStatus {
41 uint32_t hotplug_enable;
44 #define ACPI_PCIHP_PROP_BSEL "acpi-pcihp-bsel"
45 #define ACPI_PCIHP_MAX_HOTPLUG_BUS 256
46 #define ACPI_PCIHP_BSEL_DEFAULT 0x0
48 typedef struct AcpiPciHpState {
49 AcpiPciHpPciStatus acpi_pcihp_pci_status[ACPI_PCIHP_MAX_HOTPLUG_BUS];
50 uint32_t hotplug_select;
58 void acpi_pcihp_init(Object *owner, AcpiPciHpState *, PCIBus *root,
59 MemoryRegion *address_space_io, bool bridges_enabled);
61 void acpi_pcihp_device_plug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
62 DeviceState *dev, Error **errp);
63 void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
64 DeviceState *dev, Error **errp);
67 void acpi_pcihp_reset(AcpiPciHpState *s);
69 extern const VMStateDescription vmstate_acpi_pcihp_pci_status;
71 #define VMSTATE_PCI_HOTPLUG(pcihp, state, test_pcihp) \
72 VMSTATE_UINT32_TEST(pcihp.hotplug_select, state, \
74 VMSTATE_STRUCT_ARRAY_TEST(pcihp.acpi_pcihp_pci_status, state, \
75 ACPI_PCIHP_MAX_HOTPLUG_BUS, \
77 vmstate_acpi_pcihp_pci_status, \