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
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/pci/pci.h" /* for PCIHotplugState */
34 typedef struct AcpiPciHpPciStatus {
35 uint32_t up; /* deprecated, maintained for migration compatibility */
37 uint32_t hotplug_enable;
38 uint32_t device_present;
41 #define ACPI_PCIHP_PROP_BSEL "acpi-pcihp-bsel"
42 #define ACPI_PCIHP_MAX_HOTPLUG_BUS 256
44 typedef struct AcpiPciHpState {
45 AcpiPciHpPciStatus acpi_pcihp_pci_status[ACPI_PCIHP_MAX_HOTPLUG_BUS];
46 uint32_t hotplug_select;
51 void acpi_pcihp_init(AcpiPciHpState *, PCIBus *root,
52 MemoryRegion *address_space_io);
54 /* Invoke on device hotplug */
55 int acpi_pcihp_device_hotplug(AcpiPciHpState *, PCIDevice *,
56 PCIHotplugState state);
59 void acpi_pcihp_reset(AcpiPciHpState *s);
61 extern const VMStateDescription vmstate_acpi_pcihp_pci_status;
63 #define VMSTATE_PCI_HOTPLUG(pcihp, state, test_pcihp) \
64 VMSTATE_UINT32_TEST(pcihp.hotplug_select, state, \
66 VMSTATE_STRUCT_ARRAY_TEST(pcihp.acpi_pcihp_pci_status, state, \
67 ACPI_PCIHP_MAX_HOTPLUG_BUS, \
69 vmstate_acpi_pcihp_pci_status, \