qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/3] map regions as registered


From: Glauber de Oliveira Costa
Subject: [Qemu-devel] [PATCH 2/3] map regions as registered
Date: Thu, 17 Apr 2008 01:42:54 -0700

From: Glauber Costa <address@hidden>

map which io registers where already sucessfuly registered

Signed-off-by: Glauber Costa <address@hidden>
---
 qemu/hw/pci.c |    5 +++--
 qemu/hw/pci.h |    3 +++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/qemu/hw/pci.c b/qemu/hw/pci.c
index 1937408..7e4ce2d 100644
--- a/qemu/hw/pci.c
+++ b/qemu/hw/pci.c
@@ -199,7 +199,7 @@ static void pci_unregister_io_regions(PCIDevice *pci_dev)
 
     for(i = 0; i < PCI_NUM_REGIONS; i++) {
         r = &pci_dev->io_regions[i];
-        if (!r->size)
+        if ((!r->size) || (r->status != PCI_STATUS_REGISTERED))
             continue;
         if (r->type == PCI_ADDRESS_SPACE_IO) {
             isa_unassign_ioport(r->addr, r->size);
@@ -321,7 +321,7 @@ static void pci_update_mappings(PCIDevice *d)
                         } else {
                             isa_unassign_ioport(r->addr, r->size);
                         }
-                    } else {
+                    } else if (r->status == PCI_STATUS_REGISTERED) {
                         cpu_register_physical_memory(pci_to_cpu_addr(r->addr),
                                                      r->size,
                                                      IO_MEM_UNASSIGNED);
@@ -330,6 +330,7 @@ static void pci_update_mappings(PCIDevice *d)
                 r->addr = new_addr;
                 if (r->addr != -1) {
                     r->map_func(d, i, r->addr, r->size, r->type);
+                    r->status = PCI_STATUS_REGISTERED;
                 }
             }
         }
diff --git a/qemu/hw/pci.h b/qemu/hw/pci.h
index e11fbbf..6350ad2 100644
--- a/qemu/hw/pci.h
+++ b/qemu/hw/pci.h
@@ -27,9 +27,12 @@ typedef struct PCIIORegion {
     uint32_t addr; /* current PCI mapping address. -1 means not mapped */
     uint32_t size;
     uint8_t type;
+    uint8_t status;
     PCIMapIORegionFunc *map_func;
 } PCIIORegion;
 
+#define PCI_STATUS_REGISTERED  1
+
 #define PCI_ROM_SLOT 6
 #define PCI_NUM_REGIONS 7
 
-- 
1.5.5





reply via email to

[Prev in Thread] Current Thread [Next in Thread]