#include "boards.h"
#include "monitor.h"
#include "fw_cfg.h"
-#include "virtio-balloon.h"
#include "virtio-console.h"
#include "hpet_emul.h"
#include "watchdog.h"
}
/* Add virtio balloon device */
- if (pci_enabled)
- virtio_balloon_init(pci_bus);
+ if (pci_enabled) {
+ pci_create_simple(pci_bus, -1, "virtio-balloon");
+ }
/* Add virtio console devices */
if (pci_enabled) {
return 0;
}
-void *virtio_balloon_init(PCIBus *bus)
+static void virtio_balloon_init(PCIDevice *pci_dev)
{
VirtIOBalloon *s;
- PCIDevice *d;
- d = pci_register_device(bus, "virtio-balloon", sizeof(VirtIOBalloon),
- -1, NULL, NULL);
- if (!d)
- return NULL;
-
- s = (VirtIOBalloon *)virtio_init_pci(d, "virtio-balloon",
+ s = (VirtIOBalloon *)virtio_init_pci(pci_dev, "virtio-balloon",
PCI_VENDOR_ID_REDHAT_QUMRANET,
PCI_DEVICE_ID_VIRTIO_BALLOON,
PCI_VENDOR_ID_REDHAT_QUMRANET,
qemu_add_balloon_handler(virtio_balloon_to_target, s);
register_savevm("virtio-balloon", -1, 1, virtio_balloon_save, virtio_balloon_load, s);
+}
- return &s->vdev;
+static void virtio_balloon_register_devices(void)
+{
+ pci_qdev_register("virtio-balloon", sizeof(VirtIOBalloon),
+ virtio_balloon_init);
}
+
+device_init(virtio_balloon_register_devices)