]>
Commit | Line | Data |
---|---|---|
db4728e6 MT |
1 | /* |
2 | * QEMU<->ACPI BIOS PCI hotplug interface | |
3 | * | |
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 | |
7 | * | |
8 | * Copyright (c) 2013, Red Hat Inc, Michael S. Tsirkin ([email protected]) | |
9 | * Copyright (c) 2006 Fabrice Bellard | |
10 | * | |
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. | |
14 | * | |
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. | |
19 | * | |
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/> | |
22 | * | |
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. | |
25 | */ | |
26 | ||
27 | #ifndef HW_ACPI_PCIHP_H | |
28 | #define HW_ACPI_PCIHP_H | |
29 | ||
c24d5e0b | 30 | #include "hw/acpi/acpi.h" |
0058c082 | 31 | #include "hw/hotplug.h" |
db4728e6 | 32 | |
78c2d872 IM |
33 | #define ACPI_PCIHP_IO_BASE_PROP "acpi-pcihp-io-base" |
34 | #define ACPI_PCIHP_IO_LEN_PROP "acpi-pcihp-io-len" | |
35 | ||
db4728e6 | 36 | typedef struct AcpiPciHpPciStatus { |
5a2223ca | 37 | uint32_t up; |
db4728e6 MT |
38 | uint32_t down; |
39 | uint32_t hotplug_enable; | |
db4728e6 MT |
40 | } AcpiPciHpPciStatus; |
41 | ||
42 | #define ACPI_PCIHP_PROP_BSEL "acpi-pcihp-bsel" | |
43 | #define ACPI_PCIHP_MAX_HOTPLUG_BUS 256 | |
e358edc8 | 44 | #define ACPI_PCIHP_BSEL_DEFAULT 0x0 |
db4728e6 MT |
45 | |
46 | typedef struct AcpiPciHpState { | |
47 | AcpiPciHpPciStatus acpi_pcihp_pci_status[ACPI_PCIHP_MAX_HOTPLUG_BUS]; | |
48 | uint32_t hotplug_select; | |
49 | PCIBus *root; | |
50 | MemoryRegion io; | |
99d09dd3 | 51 | bool legacy_piix; |
78c2d872 IM |
52 | uint16_t io_base; |
53 | uint16_t io_len; | |
db4728e6 MT |
54 | } AcpiPciHpState; |
55 | ||
78c2d872 | 56 | void acpi_pcihp_init(Object *owner, AcpiPciHpState *, PCIBus *root, |
99d09dd3 | 57 | MemoryRegion *address_space_io, bool bridges_enabled); |
db4728e6 | 58 | |
ec266f40 DH |
59 | void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hotplug_dev, |
60 | DeviceState *dev, Error **errp); | |
0058c082 | 61 | void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, |
c24d5e0b | 62 | DeviceState *dev, Error **errp); |
0058c082 | 63 | void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s, |
c24d5e0b | 64 | DeviceState *dev, Error **errp); |
c97adf3c DH |
65 | void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev, |
66 | AcpiPciHpState *s, DeviceState *dev, | |
67 | Error **errp); | |
db4728e6 MT |
68 | |
69 | /* Called on reset */ | |
70 | void acpi_pcihp_reset(AcpiPciHpState *s); | |
71 | ||
72 | extern const VMStateDescription vmstate_acpi_pcihp_pci_status; | |
73 | ||
74 | #define VMSTATE_PCI_HOTPLUG(pcihp, state, test_pcihp) \ | |
75 | VMSTATE_UINT32_TEST(pcihp.hotplug_select, state, \ | |
76 | test_pcihp), \ | |
77 | VMSTATE_STRUCT_ARRAY_TEST(pcihp.acpi_pcihp_pci_status, state, \ | |
78 | ACPI_PCIHP_MAX_HOTPLUG_BUS, \ | |
79 | test_pcihp, 1, \ | |
80 | vmstate_acpi_pcihp_pci_status, \ | |
81 | AcpiPciHpPciStatus) | |
82 | ||
83 | #endif |