#include <palacios/vmm.h>
+#include <palacios/vmm_dev_mgr.h>
+#include <palacios/vmm_intr.h>
+
#include <devices/pci.h>
#include <devices/southbridge.h>
+
struct iort_reg {
union {
uint8_t value;
int intr_pin = pci_dev->config_header.intr_pin - 1;
int irq_index = (intr_pin + pci_dev->dev_num - 1) & 0x3;
- PrintError("Raising PCI IRQ %d\n", piix3_cfg->pirq_rc[irq_index]);
+ // PrintError("Raising PCI IRQ %d\n", piix3_cfg->pirq_rc[irq_index]);
v3_raise_irq(dev->vm, piix3_cfg->pirq_rc[irq_index]);
pci_dev = v3_pci_register_device(piix3->pci_bus, PCI_MULTIFUNCTION,
bus_num, -1, 0,
"PIIX3", bars,
- NULL, NULL, NULL, dev, NULL);
+ NULL, NULL, NULL, dev);
if (pci_dev == NULL) {
PrintError("Could not register PCI Device for PIIX3\n");
return -1;
return 0;
}
-static int piix3_init(struct guest_info * vm, void * cfg_data) {
+static int piix3_init(struct guest_info * vm, v3_cfg_tree_t * cfg) {
struct v3_southbridge * piix3 = (struct v3_southbridge *)V3_Malloc(sizeof(struct v3_southbridge));
struct vm_device * dev = NULL;
- struct vm_device * pci = v3_find_dev(vm, (char *)cfg_data);
+ struct vm_device * pci = v3_find_dev(vm, v3_cfg_val(cfg, "bus"));
+ char * name = v3_cfg_val(cfg, "name");
if (!pci) {
PrintError("Could not find PCI device\n");
piix3->pci_bus = pci;
piix3->type = V3_SB_PIIX3;
- dev = v3_allocate_device("PIIX3", &dev_ops, piix3);
+ dev = v3_allocate_device(name, &dev_ops, piix3);
if (v3_attach_device(vm, dev) == -1) {
- PrintError("Could not attach device %s\n", "PIIX3");
+ PrintError("Could not attach device %s\n", name);
return -1;
}