Patchwork memory: Eliminate region offset

login
register
mail settings
Submitter Jan Kiszka
Date Sept. 18, 2011, 1:09 p.m.
Message ID <4E75ED81.9050902@web.de>
Download mbox | patch
Permalink /patch/115239/
State New
Headers show

Comments

Jan Kiszka - Sept. 18, 2011, 1:09 p.m.
From: Jan Kiszka <jan.kiszka@siemens.com>

Before anything makes use of this legacy mechanism again, remove it.
This will enforce proper conversion of device models while they are
ported over the memory API.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 memory.c |   14 ++++----------
 memory.h |    9 ---------
 2 files changed, 4 insertions(+), 19 deletions(-)

Patch

diff --git a/memory.c b/memory.c
index 51f0297..4dd63cc 100644
--- a/memory.c
+++ b/memory.c
@@ -405,7 +405,7 @@  static void memory_region_iorange_read(IORange *iorange,
         return;
     }
     *data = 0;
-    access_with_adjusted_size(offset + mr->offset, data, width,
+    access_with_adjusted_size(offset, data, width,
                               mr->ops->impl.min_access_size,
                               mr->ops->impl.max_access_size,
                               memory_region_read_accessor, mr);
@@ -431,7 +431,7 @@  static void memory_region_iorange_write(IORange *iorange,
         }
         return;
     }
-    access_with_adjusted_size(offset + mr->offset, &data, width,
+    access_with_adjusted_size(offset, &data, width,
                               mr->ops->impl.min_access_size,
                               mr->ops->impl.max_access_size,
                               memory_region_write_accessor, mr);
@@ -778,7 +778,6 @@  void memory_region_init(MemoryRegion *mr,
     mr->parent = NULL;
     mr->size = size;
     mr->addr = 0;
-    mr->offset = 0;
     mr->terminates = false;
     mr->readable = true;
     mr->destructor = memory_region_destructor_none;
@@ -830,7 +829,7 @@  static uint32_t memory_region_read_thunk_n(void *_mr,
     }
 
     /* FIXME: support unaligned access */
-    access_with_adjusted_size(addr + mr->offset, &data, size,
+    access_with_adjusted_size(addr, &data, size,
                               mr->ops->impl.min_access_size,
                               mr->ops->impl.max_access_size,
                               memory_region_read_accessor, mr);
@@ -855,7 +854,7 @@  static void memory_region_write_thunk_n(void *_mr,
     }
 
     /* FIXME: support unaligned access */
-    access_with_adjusted_size(addr + mr->offset, &data, size,
+    access_with_adjusted_size(addr, &data, size,
                               mr->ops->impl.min_access_size,
                               mr->ops->impl.max_access_size,
                               memory_region_write_accessor, mr);
@@ -1004,11 +1003,6 @@  uint64_t memory_region_size(MemoryRegion *mr)
     return mr->size;
 }
 
-void memory_region_set_offset(MemoryRegion *mr, target_phys_addr_t offset)
-{
-    mr->offset = offset;
-}
-
 void memory_region_set_log(MemoryRegion *mr, bool log, unsigned client)
 {
     uint8_t mask = 1 << client;
diff --git a/memory.h b/memory.h
index 06b83ae..b07cd55 100644
--- a/memory.h
+++ b/memory.h
@@ -107,7 +107,6 @@  struct MemoryRegion {
     MemoryRegion *parent;
     uint64_t size;
     target_phys_addr_t addr;
-    target_phys_addr_t offset;
     bool backend_registered;
     void (*destructor)(MemoryRegion *mr);
     ram_addr_t ram_addr;
@@ -268,14 +267,6 @@  uint64_t memory_region_size(MemoryRegion *mr);
 void *memory_region_get_ram_ptr(MemoryRegion *mr);
 
 /**
- * memory_region_set_offset: Sets an offset to be added to MemoryRegionOps
- *                           callbacks.
- *
- * This function is deprecated and should not be used in new code.
- */
-void memory_region_set_offset(MemoryRegion *mr, target_phys_addr_t offset);
-
-/**
  * memory_region_set_log: Turn dirty logging on or off for a region.
  *
  * Turns dirty logging on or off for a specified client (display, migration).