1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef HW_ACPI_PCIHP_H
28#define HW_ACPI_PCIHP_H
29
30#include "hw/acpi/acpi.h"
31#include "migration/vmstate.h"
32
33#define ACPI_PCIHP_IO_BASE_PROP "acpi-pcihp-io-base"
34#define ACPI_PCIHP_IO_LEN_PROP "acpi-pcihp-io-len"
35
36typedef struct AcpiPciHpPciStatus {
37 uint32_t up;
38 uint32_t down;
39 uint32_t hotplug_enable;
40} AcpiPciHpPciStatus;
41
42#define ACPI_PCIHP_PROP_BSEL "acpi-pcihp-bsel"
43#define ACPI_PCIHP_MAX_HOTPLUG_BUS 256
44#define ACPI_PCIHP_BSEL_DEFAULT 0x0
45
46typedef struct AcpiPciHpState {
47 AcpiPciHpPciStatus acpi_pcihp_pci_status[ACPI_PCIHP_MAX_HOTPLUG_BUS];
48 uint32_t hotplug_select;
49 PCIBus *root;
50 MemoryRegion io;
51 bool legacy_piix;
52 uint16_t io_base;
53 uint16_t io_len;
54} AcpiPciHpState;
55
56void acpi_pcihp_init(Object *owner, AcpiPciHpState *, PCIBus *root,
57 MemoryRegion *address_space_io, bool bridges_enabled);
58
59void acpi_pcihp_device_plug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
60 DeviceState *dev, Error **errp);
61void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s,
62 DeviceState *dev, Error **errp);
63
64
65void acpi_pcihp_reset(AcpiPciHpState *s);
66
67extern const VMStateDescription vmstate_acpi_pcihp_pci_status;
68
69#define VMSTATE_PCI_HOTPLUG(pcihp, state, test_pcihp) \
70 VMSTATE_UINT32_TEST(pcihp.hotplug_select, state, \
71 test_pcihp), \
72 VMSTATE_STRUCT_ARRAY_TEST(pcihp.acpi_pcihp_pci_status, state, \
73 ACPI_PCIHP_MAX_HOTPLUG_BUS, \
74 test_pcihp, 1, \
75 vmstate_acpi_pcihp_pci_status, \
76 AcpiPciHpPciStatus)
77
78#endif
79