X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fpci.c;h=b65aefc73bc52e8145bc6cbef809a02d77232504;hb=8a441df14ef65bb559ce090249343ec1dac1a7fc;hp=7cd114745e219c3abaf3637628171fe1a5fb8e21;hpb=f7bc654c609c9780d52f6fa980de987ddd337416;p=palacios.git diff --git a/palacios/src/devices/pci.c b/palacios/src/devices/pci.c index 7cd1147..b65aefc 100644 --- a/palacios/src/devices/pci.c +++ b/palacios/src/devices/pci.c @@ -32,7 +32,7 @@ #include #include -#ifndef DEBUG_PCI +#ifndef CONFIG_DEBUG_PCI #undef PrintDebug #define PrintDebug(fmt, args...) #endif @@ -99,7 +99,7 @@ struct pci_internal { -#ifdef DEBUG_PCI +#ifdef CONFIG_DEBUG_PCI static void pci_dump_state(struct pci_internal * pci_state) { struct rb_node * node = v3_rb_first(&(pci_state->bus_list[0].devices)); @@ -385,14 +385,14 @@ static inline int is_cfg_reg_writable(uchar_t header_type, int reg_num) { static int bar_update(struct pci_device * pci, int bar_num, uint32_t new_val) { struct v3_pci_bar * bar = &(pci->bar[bar_num]); - PrintError("Updating BAR Register (Dev=%s) (bar=%d) (old_val=0x%x) (new_val=0x%x)\n", + PrintDebug("Updating BAR Register (Dev=%s) (bar=%d) (old_val=0x%x) (new_val=0x%x)\n", pci->name, bar_num, bar->val, new_val); switch (bar->type) { case PCI_BAR_IO: { int i = 0; - PrintError("\tRehooking %d IO ports from base 0x%x to 0x%x for %d ports\n", + PrintDebug("\tRehooking %d IO ports from base 0x%x to 0x%x for %d ports\n", bar->num_ports, PCI_IO_BASE(bar->val), PCI_IO_BASE(new_val), bar->num_ports); @@ -403,13 +403,14 @@ static int bar_update(struct pci_device * pci, int bar_num, uint32_t new_val) { for (i = 0; i < bar->num_ports; i++) { - PrintError("Rehooking PCI IO port (old port=%u) (new port=%u)\n", + PrintDebug("Rehooking PCI IO port (old port=%u) (new port=%u)\n", PCI_IO_BASE(bar->val) + i, PCI_IO_BASE(new_val) + i); - v3_dev_unhook_io(pci->vm_dev, PCI_IO_BASE(bar->val) + i); + v3_unhook_io_port(pci->vm_dev->vm, PCI_IO_BASE(bar->val) + i); - if (v3_dev_hook_io(pci->vm_dev, PCI_IO_BASE(new_val) + i, - bar->io_read, bar->io_write) == -1) { + if (v3_hook_io_port(pci->vm_dev->vm, PCI_IO_BASE(new_val) + i, + bar->io_read, bar->io_write, + bar->private_data) == -1) { PrintError("Could not hook PCI IO port (old port=%u) (new port=%u)\n", PCI_IO_BASE(bar->val) + i, PCI_IO_BASE(new_val) + i); @@ -673,8 +674,9 @@ static inline int init_bars(struct pci_device * pci_dev) { for (j = 0; j < pci_dev->bar[i].num_ports; j++) { // hook IO if (pci_dev->bar[i].default_base_port != 0xffff) { - if (v3_dev_hook_io(pci_dev->vm_dev, pci_dev->bar[i].default_base_port + j, - pci_dev->bar[i].io_read, pci_dev->bar[i].io_write) == -1) { + if (v3_hook_io_port(pci_dev->vm_dev->vm, pci_dev->bar[i].default_base_port + j, + pci_dev->bar[i].io_read, pci_dev->bar[i].io_write, + pci_dev->bar[i].private_data) == -1) { PrintError("Could not hook default io port %x\n", pci_dev->bar[i].default_base_port + j); return -1; } @@ -839,6 +841,7 @@ struct pci_device * v3_pci_register_device(struct vm_device * pci, //copy bars for (i = 0; i < 6; i ++) { pci_dev->bar[i].type = bars[i].type; + pci_dev->bar[i].private_data = bars[i].private_data; if (pci_dev->bar[i].type == PCI_BAR_IO) { pci_dev->bar[i].num_ports = bars[i].num_ports; @@ -875,7 +878,7 @@ struct pci_device * v3_pci_register_device(struct vm_device * pci, // add the device add_device_to_bus(bus, pci_dev); -#ifdef DEBUG_PCI +#ifdef CONFIG_DEBUG_PCI pci_dump_state(pci_state); #endif