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.


Implementation of stream device backend, interface to host os
[palacios.git] / palacios / src / devices / pci.c
index 042e9a8..267eca1 100644 (file)
@@ -437,10 +437,10 @@ static int bar_update(struct guest_info * info, struct pci_device * pci, int bar
            break;
        }
        case PCI_BAR_MEM32: {
-           v3_unhook_mem(info->vm_info, (addr_t)(bar->val));
+           v3_unhook_mem(info->vm_info, V3_MEM_CORE_ANY, (addr_t)(bar->val));
            
            if (bar->mem_read) {
-               v3_hook_full_mem(info->vm_info, PCI_MEM32_BASE(new_val), 
+               v3_hook_full_mem(info->vm_info, V3_MEM_CORE_ANY, PCI_MEM32_BASE(new_val), 
                                 PCI_MEM32_BASE(new_val) + (bar->num_pages * PAGE_SIZE_4KB),
                                 bar->mem_read, bar->mem_write, pci->priv_data);
            } else {
@@ -528,7 +528,7 @@ static int data_port_write(struct guest_info * core, ushort_t port, void * src,
            } else if ((cur_reg >= 0x30) && (cur_reg < 0x34)) {
                // Extension ROM update
 
-               pci_dev->ext_rom_update_flag = 1;
+               pci_dev->exp_rom_update_flag = 1;
            } else if (cur_reg == 0x04) {
                // COMMAND update            
                uint8_t command = *((uint8_t *)src + i);
@@ -586,9 +586,9 @@ static int data_port_write(struct guest_info * core, ushort_t port, void * src,
        pci_dev->bar_update_flag = 0;
     }
 
-    if ((pci_dev->ext_rom_update_flag) && (pci_dev->ext_rom_update)) {
-       pci_dev->ext_rom_update(pci_dev);
-       pci_dev->ext_rom_update_flag = 0;
+    if ((pci_dev->exp_rom_update_flag) && (pci_dev->exp_rom_update)) {
+       pci_dev->exp_rom_update(pci_dev, &(pci_dev->config_header.expansion_rom_address), pci_dev->priv_data);
+       pci_dev->exp_rom_update_flag = 0;
     }
 
 
@@ -655,14 +655,14 @@ static struct v3_device_ops dev_ops = {
 static int pci_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) {
     struct pci_internal * pci_state = V3_Malloc(sizeof(struct pci_internal));
     int i = 0;
-    char * name = v3_cfg_val(cfg, "name");
+    char * dev_id = v3_cfg_val(cfg, "ID");
     
     PrintDebug("PCI internal at %p\n",(void *)pci_state);
     
-    struct vm_device * dev = v3_allocate_device(name, &dev_ops, pci_state);
+    struct vm_device * dev = v3_allocate_device(dev_id, &dev_ops, pci_state);
     
     if (v3_attach_device(vm, dev) == -1) {
-       PrintError("Could not attach device %s\n", name);
+       PrintError("Could not attach device %s\n", dev_id);
        return -1;
     }
 
@@ -731,7 +731,7 @@ static inline int init_bars(struct v3_vm_info * vm, struct pci_device * pci_dev)
            // hook memory
            if (pci_dev->bar[i].mem_read) {
                // full hook
-               v3_hook_full_mem(vm, pci_dev->bar[i].default_base_addr,
+               v3_hook_full_mem(vm, V3_MEM_CORE_ANY, pci_dev->bar[i].default_base_addr,
                                 pci_dev->bar[i].default_base_addr + (pci_dev->bar[i].num_pages * PAGE_SIZE_4KB),
                                 pci_dev->bar[i].mem_read, pci_dev->bar[i].mem_write, pci_dev->priv_data);
            } else if (pci_dev->bar[i].mem_write) {
@@ -810,8 +810,8 @@ struct pci_device * v3_pci_register_device(struct vm_device * pci,
                                           const char * name,
                                           struct v3_pci_bar * bars,
                                           int (*config_update)(uint_t reg_num, void * src, uint_t length, void * priv_data),
-                                          int (*cmd_update)(struct pci_device *pci_dev, uchar_t io_enabled, uchar_t mem_enabled),
-                                          int (*ext_rom_update)(struct pci_device * pci_dev),
+                                          int (*cmd_update)(struct pci_device * pci_dev, uchar_t io_enabled, uchar_t mem_enabled),
+                                          int (*exp_rom_update)(struct pci_device * pci_dev, uint32_t * src, void * priv_data),
                                           void * priv_data) {
 
     struct pci_internal * pci_state = (struct pci_internal *)pci->private_data;
@@ -877,7 +877,7 @@ struct pci_device * v3_pci_register_device(struct vm_device * pci,
     // register update callbacks
     pci_dev->config_update = config_update;
     pci_dev->cmd_update = cmd_update;
-    pci_dev->ext_rom_update = ext_rom_update;
+    pci_dev->exp_rom_update = exp_rom_update;
 
 
     //copy bars