qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH 19/19] pci: simplify memory region registration


From: Avi Kivity
Subject: [Qemu-devel] [PATCH 19/19] pci: simplify memory region registration
Date: Thu, 25 Aug 2011 11:09:18 +0300

The two code paths (for ADDRESS_SPACE_IO and ADDRESS_SPACE_MEM) are almost
identical.  Unify them.

Signed-off-by: Avi Kivity <address@hidden>
---
 hw/pci.c |   15 ++++-----------
 1 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/hw/pci.c b/hw/pci.c
index 1a5d2b6..e9e37ef 100644
--- a/hw/pci.c
+++ b/hw/pci.c
@@ -1059,18 +1059,11 @@ static void pci_update_mappings(PCIDevice *d)
              * Teach them such cases, such that filtered_size < size and
              * addr & (size - 1) != 0.
              */
-            if (r->type & PCI_BASE_ADDRESS_SPACE_IO) {
-                memory_region_add_subregion_overlap(r->address_space,
-                                                    r->addr,
-                                                    r->memory,
-                                                    1);
-            } else {
-                memory_region_add_subregion_overlap(r->address_space,
-                                                    pci_to_cpu_addr(d->bus,
-                                                                    r->addr),
-                                                    r->memory,
-                                                    1);
+            if (!(r->type & PCI_BASE_ADDRESS_SPACE_IO)) {
+                new_addr = pci_to_cpu_addr(d->bus, new_addr);
             }
+            memory_region_add_subregion_overlap(r->address_space,
+                                                new_addr, r->memory, 1);
         }
     }
 }
-- 
1.7.5.3




reply via email to

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