1db4728e6SMichael S. Tsirkin /* 2db4728e6SMichael S. Tsirkin * QEMU<->ACPI BIOS PCI hotplug interface 3db4728e6SMichael S. Tsirkin * 4db4728e6SMichael S. Tsirkin * QEMU supports PCI hotplug via ACPI. This module 5db4728e6SMichael S. Tsirkin * implements the interface between QEMU and the ACPI BIOS. 6db4728e6SMichael S. Tsirkin * Interface specification - see docs/specs/acpi_pci_hotplug.txt 7db4728e6SMichael S. Tsirkin * 8db4728e6SMichael S. Tsirkin * Copyright (c) 2013, Red Hat Inc, Michael S. Tsirkin (mst@redhat.com) 9db4728e6SMichael S. Tsirkin * Copyright (c) 2006 Fabrice Bellard 10db4728e6SMichael S. Tsirkin * 11db4728e6SMichael S. Tsirkin * This library is free software; you can redistribute it and/or 12db4728e6SMichael S. Tsirkin * modify it under the terms of the GNU Lesser General Public 13db4728e6SMichael S. Tsirkin * License version 2 as published by the Free Software Foundation. 14db4728e6SMichael S. Tsirkin * 15db4728e6SMichael S. Tsirkin * This library is distributed in the hope that it will be useful, 16db4728e6SMichael S. Tsirkin * but WITHOUT ANY WARRANTY; without even the implied warranty of 17db4728e6SMichael S. Tsirkin * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18db4728e6SMichael S. Tsirkin * Lesser General Public License for more details. 19db4728e6SMichael S. Tsirkin * 20db4728e6SMichael S. Tsirkin * You should have received a copy of the GNU Lesser General Public 21db4728e6SMichael S. Tsirkin * License along with this library; if not, see <http://www.gnu.org/licenses/> 22db4728e6SMichael S. Tsirkin * 23db4728e6SMichael S. Tsirkin * Contributions after 2012-01-13 are licensed under the terms of the 24db4728e6SMichael S. Tsirkin * GNU GPL, version 2 or (at your option) any later version. 25db4728e6SMichael S. Tsirkin */ 26db4728e6SMichael S. Tsirkin 27*b6a0aa05SPeter Maydell #include "qemu/osdep.h" 28db4728e6SMichael S. Tsirkin #include "hw/acpi/pcihp.h" 29db4728e6SMichael S. Tsirkin 30db4728e6SMichael S. Tsirkin #include "hw/hw.h" 31db4728e6SMichael S. Tsirkin #include "hw/i386/pc.h" 32db4728e6SMichael S. Tsirkin #include "hw/pci/pci.h" 33db4728e6SMichael S. Tsirkin #include "hw/acpi/acpi.h" 34db4728e6SMichael S. Tsirkin #include "sysemu/sysemu.h" 35db4728e6SMichael S. Tsirkin #include "exec/ioport.h" 36db4728e6SMichael S. Tsirkin #include "exec/address-spaces.h" 37db4728e6SMichael S. Tsirkin #include "hw/pci/pci_bus.h" 38db4728e6SMichael S. Tsirkin #include "qom/qom-qobject.h" 39db4728e6SMichael S. Tsirkin #include "qapi/qmp/qint.h" 40db4728e6SMichael S. Tsirkin 41db4728e6SMichael S. Tsirkin //#define DEBUG 42db4728e6SMichael S. Tsirkin 43db4728e6SMichael S. Tsirkin #ifdef DEBUG 44db4728e6SMichael S. Tsirkin # define ACPI_PCIHP_DPRINTF(format, ...) printf(format, ## __VA_ARGS__) 45db4728e6SMichael S. Tsirkin #else 46db4728e6SMichael S. Tsirkin # define ACPI_PCIHP_DPRINTF(format, ...) do { } while (0) 47db4728e6SMichael S. Tsirkin #endif 48db4728e6SMichael S. Tsirkin 49e358edc8SIgor Mammedov #define ACPI_PCIHP_ADDR 0xae00 50e358edc8SIgor Mammedov #define ACPI_PCIHP_SIZE 0x0014 51e358edc8SIgor Mammedov #define ACPI_PCIHP_LEGACY_SIZE 0x000f 52a7b613cfSIgor Mammedov #define PCI_UP_BASE 0x0000 53a7b613cfSIgor Mammedov #define PCI_DOWN_BASE 0x0004 54a7b613cfSIgor Mammedov #define PCI_EJ_BASE 0x0008 55a7b613cfSIgor Mammedov #define PCI_RMV_BASE 0x000c 56a7b613cfSIgor Mammedov #define PCI_SEL_BASE 0x0010 57db4728e6SMichael S. Tsirkin 58db4728e6SMichael S. Tsirkin typedef struct AcpiPciHpFind { 59db4728e6SMichael S. Tsirkin int bsel; 60db4728e6SMichael S. Tsirkin PCIBus *bus; 61db4728e6SMichael S. Tsirkin } AcpiPciHpFind; 62db4728e6SMichael S. Tsirkin 63db4728e6SMichael S. Tsirkin static int acpi_pcihp_get_bsel(PCIBus *bus) 64db4728e6SMichael S. Tsirkin { 657c38ecd0SKirill Batuzov Error *local_err = NULL; 667c38ecd0SKirill Batuzov int64_t bsel = object_property_get_int(OBJECT(bus), ACPI_PCIHP_PROP_BSEL, 677c38ecd0SKirill Batuzov &local_err); 687c38ecd0SKirill Batuzov 697c38ecd0SKirill Batuzov if (local_err || bsel < 0 || bsel >= ACPI_PCIHP_MAX_HOTPLUG_BUS) { 707c38ecd0SKirill Batuzov if (local_err) { 717c38ecd0SKirill Batuzov error_free(local_err); 72db4728e6SMichael S. Tsirkin } 73db4728e6SMichael S. Tsirkin return -1; 747c38ecd0SKirill Batuzov } else { 75db4728e6SMichael S. Tsirkin return bsel; 76db4728e6SMichael S. Tsirkin } 777c38ecd0SKirill Batuzov } 78db4728e6SMichael S. Tsirkin 79db4728e6SMichael S. Tsirkin static void acpi_pcihp_test_hotplug_bus(PCIBus *bus, void *opaque) 80db4728e6SMichael S. Tsirkin { 81db4728e6SMichael S. Tsirkin AcpiPciHpFind *find = opaque; 82db4728e6SMichael S. Tsirkin if (find->bsel == acpi_pcihp_get_bsel(bus)) { 83db4728e6SMichael S. Tsirkin find->bus = bus; 84db4728e6SMichael S. Tsirkin } 85db4728e6SMichael S. Tsirkin } 86db4728e6SMichael S. Tsirkin 87db4728e6SMichael S. Tsirkin static PCIBus *acpi_pcihp_find_hotplug_bus(AcpiPciHpState *s, int bsel) 88db4728e6SMichael S. Tsirkin { 89db4728e6SMichael S. Tsirkin AcpiPciHpFind find = { .bsel = bsel, .bus = NULL }; 90db4728e6SMichael S. Tsirkin 91db4728e6SMichael S. Tsirkin if (bsel < 0) { 92db4728e6SMichael S. Tsirkin return NULL; 93db4728e6SMichael S. Tsirkin } 94db4728e6SMichael S. Tsirkin 95db4728e6SMichael S. Tsirkin pci_for_each_bus(s->root, acpi_pcihp_test_hotplug_bus, &find); 96db4728e6SMichael S. Tsirkin 97db4728e6SMichael S. Tsirkin /* Make bsel 0 eject root bus if bsel property is not set, 98db4728e6SMichael S. Tsirkin * for compatibility with non acpi setups. 99db4728e6SMichael S. Tsirkin * TODO: really needed? 100db4728e6SMichael S. Tsirkin */ 101db4728e6SMichael S. Tsirkin if (!bsel && !find.bus) { 102db4728e6SMichael S. Tsirkin find.bus = s->root; 103db4728e6SMichael S. Tsirkin } 104db4728e6SMichael S. Tsirkin return find.bus; 105db4728e6SMichael S. Tsirkin } 106db4728e6SMichael S. Tsirkin 107db4728e6SMichael S. Tsirkin static bool acpi_pcihp_pc_no_hotplug(AcpiPciHpState *s, PCIDevice *dev) 108db4728e6SMichael S. Tsirkin { 109db4728e6SMichael S. Tsirkin PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev); 1102897ae02SIgor Mammedov DeviceClass *dc = DEVICE_GET_CLASS(dev); 111db4728e6SMichael S. Tsirkin /* 112db4728e6SMichael S. Tsirkin * ACPI doesn't allow hotplug of bridge devices. Don't allow 113db4728e6SMichael S. Tsirkin * hot-unplug of bridge devices unless they were added by hotplug 114db4728e6SMichael S. Tsirkin * (and so, not described by acpi). 115db4728e6SMichael S. Tsirkin */ 1162897ae02SIgor Mammedov return (pc->is_bridge && !dev->qdev.hotplugged) || !dc->hotpluggable; 117db4728e6SMichael S. Tsirkin } 118db4728e6SMichael S. Tsirkin 119db4728e6SMichael S. Tsirkin static void acpi_pcihp_eject_slot(AcpiPciHpState *s, unsigned bsel, unsigned slots) 120db4728e6SMichael S. Tsirkin { 121db4728e6SMichael S. Tsirkin BusChild *kid, *next; 122786a4ea8SStefan Hajnoczi int slot = ctz32(slots); 123db4728e6SMichael S. Tsirkin PCIBus *bus = acpi_pcihp_find_hotplug_bus(s, bsel); 124db4728e6SMichael S. Tsirkin 125db4728e6SMichael S. Tsirkin if (!bus) { 126db4728e6SMichael S. Tsirkin return; 127db4728e6SMichael S. Tsirkin } 128db4728e6SMichael S. Tsirkin 129db4728e6SMichael S. Tsirkin /* Mark request as complete */ 130db4728e6SMichael S. Tsirkin s->acpi_pcihp_pci_status[bsel].down &= ~(1U << slot); 1315a2223caSMichael S. Tsirkin s->acpi_pcihp_pci_status[bsel].up &= ~(1U << slot); 132db4728e6SMichael S. Tsirkin 133db4728e6SMichael S. Tsirkin QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) { 134db4728e6SMichael S. Tsirkin DeviceState *qdev = kid->child; 135db4728e6SMichael S. Tsirkin PCIDevice *dev = PCI_DEVICE(qdev); 136db4728e6SMichael S. Tsirkin if (PCI_SLOT(dev->devfn) == slot) { 1375a2223caSMichael S. Tsirkin if (!acpi_pcihp_pc_no_hotplug(s, dev)) { 138db4728e6SMichael S. Tsirkin object_unparent(OBJECT(qdev)); 139db4728e6SMichael S. Tsirkin } 140db4728e6SMichael S. Tsirkin } 141db4728e6SMichael S. Tsirkin } 142db4728e6SMichael S. Tsirkin } 143db4728e6SMichael S. Tsirkin 144db4728e6SMichael S. Tsirkin static void acpi_pcihp_update_hotplug_bus(AcpiPciHpState *s, int bsel) 145db4728e6SMichael S. Tsirkin { 146db4728e6SMichael S. Tsirkin BusChild *kid, *next; 147db4728e6SMichael S. Tsirkin PCIBus *bus = acpi_pcihp_find_hotplug_bus(s, bsel); 148db4728e6SMichael S. Tsirkin 149db4728e6SMichael S. Tsirkin /* Execute any pending removes during reset */ 150db4728e6SMichael S. Tsirkin while (s->acpi_pcihp_pci_status[bsel].down) { 151db4728e6SMichael S. Tsirkin acpi_pcihp_eject_slot(s, bsel, s->acpi_pcihp_pci_status[bsel].down); 152db4728e6SMichael S. Tsirkin } 153db4728e6SMichael S. Tsirkin 154db4728e6SMichael S. Tsirkin s->acpi_pcihp_pci_status[bsel].hotplug_enable = ~0; 155db4728e6SMichael S. Tsirkin 156db4728e6SMichael S. Tsirkin if (!bus) { 157db4728e6SMichael S. Tsirkin return; 158db4728e6SMichael S. Tsirkin } 159db4728e6SMichael S. Tsirkin QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) { 160db4728e6SMichael S. Tsirkin DeviceState *qdev = kid->child; 161db4728e6SMichael S. Tsirkin PCIDevice *pdev = PCI_DEVICE(qdev); 162db4728e6SMichael S. Tsirkin int slot = PCI_SLOT(pdev->devfn); 163db4728e6SMichael S. Tsirkin 164db4728e6SMichael S. Tsirkin if (acpi_pcihp_pc_no_hotplug(s, pdev)) { 165db4728e6SMichael S. Tsirkin s->acpi_pcihp_pci_status[bsel].hotplug_enable &= ~(1U << slot); 166db4728e6SMichael S. Tsirkin } 167db4728e6SMichael S. Tsirkin } 168db4728e6SMichael S. Tsirkin } 169db4728e6SMichael S. Tsirkin 170db4728e6SMichael S. Tsirkin static void acpi_pcihp_update(AcpiPciHpState *s) 171db4728e6SMichael S. Tsirkin { 172db4728e6SMichael S. Tsirkin int i; 173db4728e6SMichael S. Tsirkin 174db4728e6SMichael S. Tsirkin for (i = 0; i < ACPI_PCIHP_MAX_HOTPLUG_BUS; ++i) { 175db4728e6SMichael S. Tsirkin acpi_pcihp_update_hotplug_bus(s, i); 176db4728e6SMichael S. Tsirkin } 177db4728e6SMichael S. Tsirkin } 178db4728e6SMichael S. Tsirkin 179db4728e6SMichael S. Tsirkin void acpi_pcihp_reset(AcpiPciHpState *s) 180db4728e6SMichael S. Tsirkin { 181db4728e6SMichael S. Tsirkin acpi_pcihp_update(s); 182db4728e6SMichael S. Tsirkin } 183db4728e6SMichael S. Tsirkin 184c24d5e0bSIgor Mammedov void acpi_pcihp_device_plug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s, 185c24d5e0bSIgor Mammedov DeviceState *dev, Error **errp) 186db4728e6SMichael S. Tsirkin { 187c24d5e0bSIgor Mammedov PCIDevice *pdev = PCI_DEVICE(dev); 188c24d5e0bSIgor Mammedov int slot = PCI_SLOT(pdev->devfn); 189c24d5e0bSIgor Mammedov int bsel = acpi_pcihp_get_bsel(pdev->bus); 190db4728e6SMichael S. Tsirkin if (bsel < 0) { 191c24d5e0bSIgor Mammedov error_setg(errp, "Unsupported bus. Bus doesn't have property '" 192c24d5e0bSIgor Mammedov ACPI_PCIHP_PROP_BSEL "' set"); 193c24d5e0bSIgor Mammedov return; 194db4728e6SMichael S. Tsirkin } 195db4728e6SMichael S. Tsirkin 196db4728e6SMichael S. Tsirkin /* Don't send event when device is enabled during qemu machine creation: 197db4728e6SMichael S. Tsirkin * it is present on boot, no hotplug event is necessary. We do send an 198db4728e6SMichael S. Tsirkin * event when the device is disabled later. */ 199c24d5e0bSIgor Mammedov if (!dev->hotplugged) { 200c24d5e0bSIgor Mammedov return; 201db4728e6SMichael S. Tsirkin } 202db4728e6SMichael S. Tsirkin 2038f5001f9SIgor Mammedov s->acpi_pcihp_pci_status[bsel].up |= (1U << slot); 204c24d5e0bSIgor Mammedov 205ca9b46bcSZhu Guihua acpi_send_gpe_event(ar, irq, ACPI_PCI_HOTPLUG_STATUS); 206db4728e6SMichael S. Tsirkin } 207db4728e6SMichael S. Tsirkin 208c24d5e0bSIgor Mammedov void acpi_pcihp_device_unplug_cb(ACPIREGS *ar, qemu_irq irq, AcpiPciHpState *s, 209c24d5e0bSIgor Mammedov DeviceState *dev, Error **errp) 210c24d5e0bSIgor Mammedov { 211c24d5e0bSIgor Mammedov PCIDevice *pdev = PCI_DEVICE(dev); 212c24d5e0bSIgor Mammedov int slot = PCI_SLOT(pdev->devfn); 213c24d5e0bSIgor Mammedov int bsel = acpi_pcihp_get_bsel(pdev->bus); 214c24d5e0bSIgor Mammedov if (bsel < 0) { 215c24d5e0bSIgor Mammedov error_setg(errp, "Unsupported bus. Bus doesn't have property '" 216c24d5e0bSIgor Mammedov ACPI_PCIHP_PROP_BSEL "' set"); 217c24d5e0bSIgor Mammedov return; 218c24d5e0bSIgor Mammedov } 219c24d5e0bSIgor Mammedov 220c24d5e0bSIgor Mammedov s->acpi_pcihp_pci_status[bsel].down |= (1U << slot); 221c24d5e0bSIgor Mammedov 222ca9b46bcSZhu Guihua acpi_send_gpe_event(ar, irq, ACPI_PCI_HOTPLUG_STATUS); 223db4728e6SMichael S. Tsirkin } 224db4728e6SMichael S. Tsirkin 225db4728e6SMichael S. Tsirkin static uint64_t pci_read(void *opaque, hwaddr addr, unsigned int size) 226db4728e6SMichael S. Tsirkin { 227db4728e6SMichael S. Tsirkin AcpiPciHpState *s = opaque; 228db4728e6SMichael S. Tsirkin uint32_t val = 0; 229db4728e6SMichael S. Tsirkin int bsel = s->hotplug_select; 230db4728e6SMichael S. Tsirkin 231fa365d7cSGonglei if (bsel < 0 || bsel >= ACPI_PCIHP_MAX_HOTPLUG_BUS) { 232db4728e6SMichael S. Tsirkin return 0; 233db4728e6SMichael S. Tsirkin } 234db4728e6SMichael S. Tsirkin 235db4728e6SMichael S. Tsirkin switch (addr) { 236a7b613cfSIgor Mammedov case PCI_UP_BASE: 2375a2223caSMichael S. Tsirkin val = s->acpi_pcihp_pci_status[bsel].up; 23899d09dd3SIgor Mammedov if (!s->legacy_piix) { 2395a2223caSMichael S. Tsirkin s->acpi_pcihp_pci_status[bsel].up = 0; 24099d09dd3SIgor Mammedov } 241db4728e6SMichael S. Tsirkin ACPI_PCIHP_DPRINTF("pci_up_read %" PRIu32 "\n", val); 242db4728e6SMichael S. Tsirkin break; 243a7b613cfSIgor Mammedov case PCI_DOWN_BASE: 244db4728e6SMichael S. Tsirkin val = s->acpi_pcihp_pci_status[bsel].down; 245db4728e6SMichael S. Tsirkin ACPI_PCIHP_DPRINTF("pci_down_read %" PRIu32 "\n", val); 246db4728e6SMichael S. Tsirkin break; 247a7b613cfSIgor Mammedov case PCI_EJ_BASE: 248db4728e6SMichael S. Tsirkin /* No feature defined yet */ 249db4728e6SMichael S. Tsirkin ACPI_PCIHP_DPRINTF("pci_features_read %" PRIu32 "\n", val); 250db4728e6SMichael S. Tsirkin break; 251a7b613cfSIgor Mammedov case PCI_RMV_BASE: 252db4728e6SMichael S. Tsirkin val = s->acpi_pcihp_pci_status[bsel].hotplug_enable; 253db4728e6SMichael S. Tsirkin ACPI_PCIHP_DPRINTF("pci_rmv_read %" PRIu32 "\n", val); 254db4728e6SMichael S. Tsirkin break; 255a7b613cfSIgor Mammedov case PCI_SEL_BASE: 256db4728e6SMichael S. Tsirkin val = s->hotplug_select; 257db4728e6SMichael S. Tsirkin ACPI_PCIHP_DPRINTF("pci_sel_read %" PRIu32 "\n", val); 258db4728e6SMichael S. Tsirkin default: 259db4728e6SMichael S. Tsirkin break; 260db4728e6SMichael S. Tsirkin } 261db4728e6SMichael S. Tsirkin 262db4728e6SMichael S. Tsirkin return val; 263db4728e6SMichael S. Tsirkin } 264db4728e6SMichael S. Tsirkin 265db4728e6SMichael S. Tsirkin static void pci_write(void *opaque, hwaddr addr, uint64_t data, 266db4728e6SMichael S. Tsirkin unsigned int size) 267db4728e6SMichael S. Tsirkin { 268db4728e6SMichael S. Tsirkin AcpiPciHpState *s = opaque; 269db4728e6SMichael S. Tsirkin switch (addr) { 270a7b613cfSIgor Mammedov case PCI_EJ_BASE: 271db4728e6SMichael S. Tsirkin if (s->hotplug_select >= ACPI_PCIHP_MAX_HOTPLUG_BUS) { 272db4728e6SMichael S. Tsirkin break; 273db4728e6SMichael S. Tsirkin } 274db4728e6SMichael S. Tsirkin acpi_pcihp_eject_slot(s, s->hotplug_select, data); 275db4728e6SMichael S. Tsirkin ACPI_PCIHP_DPRINTF("pciej write %" HWADDR_PRIx " <== %" PRIu64 "\n", 276db4728e6SMichael S. Tsirkin addr, data); 277db4728e6SMichael S. Tsirkin break; 278a7b613cfSIgor Mammedov case PCI_SEL_BASE: 279db4728e6SMichael S. Tsirkin s->hotplug_select = data; 280db4728e6SMichael S. Tsirkin ACPI_PCIHP_DPRINTF("pcisel write %" HWADDR_PRIx " <== %" PRIu64 "\n", 281db4728e6SMichael S. Tsirkin addr, data); 282db4728e6SMichael S. Tsirkin default: 283db4728e6SMichael S. Tsirkin break; 284db4728e6SMichael S. Tsirkin } 285db4728e6SMichael S. Tsirkin } 286db4728e6SMichael S. Tsirkin 287db4728e6SMichael S. Tsirkin static const MemoryRegionOps acpi_pcihp_io_ops = { 288db4728e6SMichael S. Tsirkin .read = pci_read, 289db4728e6SMichael S. Tsirkin .write = pci_write, 290db4728e6SMichael S. Tsirkin .endianness = DEVICE_LITTLE_ENDIAN, 291db4728e6SMichael S. Tsirkin .valid = { 292db4728e6SMichael S. Tsirkin .min_access_size = 4, 293db4728e6SMichael S. Tsirkin .max_access_size = 4, 294db4728e6SMichael S. Tsirkin }, 295db4728e6SMichael S. Tsirkin }; 296db4728e6SMichael S. Tsirkin 29778c2d872SIgor Mammedov void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus, 29899d09dd3SIgor Mammedov MemoryRegion *address_space_io, bool bridges_enabled) 299db4728e6SMichael S. Tsirkin { 30078c2d872SIgor Mammedov s->io_len = ACPI_PCIHP_SIZE; 30178c2d872SIgor Mammedov s->io_base = ACPI_PCIHP_ADDR; 302e358edc8SIgor Mammedov 303db4728e6SMichael S. Tsirkin s->root= root_bus; 30499d09dd3SIgor Mammedov s->legacy_piix = !bridges_enabled; 305e358edc8SIgor Mammedov 306e358edc8SIgor Mammedov if (s->legacy_piix) { 307e358edc8SIgor Mammedov unsigned *bus_bsel = g_malloc(sizeof *bus_bsel); 308e358edc8SIgor Mammedov 30978c2d872SIgor Mammedov s->io_len = ACPI_PCIHP_LEGACY_SIZE; 310e358edc8SIgor Mammedov 311e358edc8SIgor Mammedov *bus_bsel = ACPI_PCIHP_BSEL_DEFAULT; 312e358edc8SIgor Mammedov object_property_add_uint32_ptr(OBJECT(root_bus), ACPI_PCIHP_PROP_BSEL, 313e358edc8SIgor Mammedov bus_bsel, NULL); 314e358edc8SIgor Mammedov } 315e358edc8SIgor Mammedov 31678c2d872SIgor Mammedov memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s, 31778c2d872SIgor Mammedov "acpi-pci-hotplug", s->io_len); 31878c2d872SIgor Mammedov memory_region_add_subregion(address_space_io, s->io_base, &s->io); 31978c2d872SIgor Mammedov 32078c2d872SIgor Mammedov object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_base, 32178c2d872SIgor Mammedov &error_abort); 32278c2d872SIgor Mammedov object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_len, 32378c2d872SIgor Mammedov &error_abort); 324db4728e6SMichael S. Tsirkin } 325db4728e6SMichael S. Tsirkin 326db4728e6SMichael S. Tsirkin const VMStateDescription vmstate_acpi_pcihp_pci_status = { 327db4728e6SMichael S. Tsirkin .name = "acpi_pcihp_pci_status", 328db4728e6SMichael S. Tsirkin .version_id = 1, 329db4728e6SMichael S. Tsirkin .minimum_version_id = 1, 330db4728e6SMichael S. Tsirkin .fields = (VMStateField[]) { 331db4728e6SMichael S. Tsirkin VMSTATE_UINT32(up, AcpiPciHpPciStatus), 332db4728e6SMichael S. Tsirkin VMSTATE_UINT32(down, AcpiPciHpPciStatus), 333db4728e6SMichael S. Tsirkin VMSTATE_END_OF_LIST() 334db4728e6SMichael S. Tsirkin } 335db4728e6SMichael S. Tsirkin }; 336