Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


added host_pci passthrough PCI support
[palacios.git] / palacios / src / devices / rtl8139.c
index 0a1a335..18e966a 100644 (file)
@@ -582,7 +582,7 @@ static inline void rtl8139_update_irq(struct rtl8139_state * nic_state) {
     int isr = ((nic_state->regs.isr & nic_state->regs.imr) & 0xffff);
 
     if(isr & 0xffff){
-       v3_pci_raise_irq(nic_state->pci_bus, 0, nic_state->pci_dev);
+       v3_pci_raise_irq(nic_state->pci_bus, nic_state->pci_dev, 0);
        nic_state->statistic.tx_interrupts ++;
     }
 }
@@ -1713,7 +1713,7 @@ static int register_dev(struct rtl8139_state * nic_state)  {
     }
 
     bars[0].type = PCI_BAR_IO;
-    bars[0].default_base_port = 0xc100;
+    bars[0].default_base_port = -1;
     bars[0].num_ports = 0x100;
 
     bars[0].io_read = rtl8139_ioport_read;
@@ -1732,7 +1732,7 @@ static int register_dev(struct rtl8139_state * nic_state)  {
 
     pci_dev = v3_pci_register_device(nic_state->pci_bus, PCI_STD_DEVICE, 0, -1, 0, 
                                         "RTL8139", bars,
-                                        NULL, NULL, NULL, nic_state);
+                                    NULL, NULL, NULL, NULL, nic_state);
 
 
     if (pci_dev == NULL) {
@@ -1774,7 +1774,8 @@ static int connect_fn(struct v3_vm_info * info,
 
     ops->recv = rtl8139_rx;
     ops->poll = NULL;
-    memcpy(ops->config.fnt_mac, nic_state->mac, ETH_ALEN);
+    ops->config.frontend_data = nic_state;
+    ops->config.fnt_mac = nic_state->mac;
 
     return 0;
 }
@@ -1805,6 +1806,12 @@ static int rtl8139_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     char * macstr = v3_cfg_val(cfg, "mac");
 
     nic_state  = (struct rtl8139_state *)V3_Malloc(sizeof(struct rtl8139_state));
+
+    if (!nic_state) {
+       PrintError("Cannot allocate in init\n");
+       return -1;
+    }
+
     memset(nic_state, 0, sizeof(struct rtl8139_state));
 
     nic_state->pci_bus = pci_bus;