Commit 8da3ff180974732fc4272cb4433fef85c1822961

Authored by pbrook
1 parent 6ad1d22b

Change MMIO callbacks to use offsets, not absolute addresses.

Signed-off-by: Paul Brook <paul@codesourcery.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5849 c046a42c-6fe2-441c-8c8c-71466251a162

Too many changes to show.

To preserve performance only 63 of 82 files are displayed.

cpu-all.h
... ... @@ -877,9 +877,17 @@ extern ram_addr_t ram_size;
877 877 typedef void CPUWriteMemoryFunc(void *opaque, target_phys_addr_t addr, uint32_t value);
878 878 typedef uint32_t CPUReadMemoryFunc(void *opaque, target_phys_addr_t addr);
879 879  
880   -void cpu_register_physical_memory(target_phys_addr_t start_addr,
881   - ram_addr_t size,
882   - ram_addr_t phys_offset);
  880 +void cpu_register_physical_memory_offset(target_phys_addr_t start_addr,
  881 + ram_addr_t size,
  882 + ram_addr_t phys_offset,
  883 + ram_addr_t region_offset);
  884 +static inline void cpu_register_physical_memory(target_phys_addr_t start_addr,
  885 + ram_addr_t size,
  886 + ram_addr_t phys_offset)
  887 +{
  888 + cpu_register_physical_memory_offset(start_addr, size, phys_offset, 0);
  889 +}
  890 +
883 891 ram_addr_t cpu_get_physical_page_desc(target_phys_addr_t addr);
884 892 ram_addr_t qemu_ram_alloc(ram_addr_t);
885 893 void qemu_ram_free(ram_addr_t addr);
... ...
... ... @@ -146,6 +146,7 @@ typedef struct PageDesc {
146 146 typedef struct PhysPageDesc {
147 147 /* offset in host memory of the page + io_index in the low bits */
148 148 ram_addr_t phys_offset;
  149 + ram_addr_t region_offset;
149 150 } PhysPageDesc;
150 151  
151 152 #define L2_BITS 10
... ... @@ -199,6 +200,7 @@ typedef struct subpage_t {
199 200 CPUReadMemoryFunc **mem_read[TARGET_PAGE_SIZE][4];
200 201 CPUWriteMemoryFunc **mem_write[TARGET_PAGE_SIZE][4];
201 202 void *opaque[TARGET_PAGE_SIZE][2][4];
  203 + ram_addr_t region_offset[TARGET_PAGE_SIZE][2][4];
202 204 } subpage_t;
203 205  
204 206 #ifdef _WIN32
... ... @@ -1969,7 +1971,13 @@ int tlb_set_page_exec(CPUState *env, target_ulong vaddr,
1969 1971 and avoid full address decoding in every device.
1970 1972 We can't use the high bits of pd for this because
1971 1973 IO_MEM_ROMD uses these as a ram address. */
1972   - iotlb = (pd & ~TARGET_PAGE_MASK) + paddr;
  1974 + iotlb = (pd & ~TARGET_PAGE_MASK);
  1975 + if (p) {
  1976 + /* FIXME: What if this isn't page aligned? */
  1977 + iotlb += p->region_offset;
  1978 + } else {
  1979 + iotlb += paddr;
  1980 + }
1973 1981 }
1974 1982  
1975 1983 code_address = address;
... ... @@ -2209,10 +2217,11 @@ static inline void tlb_set_dirty(CPUState *env,
2209 2217 #endif /* defined(CONFIG_USER_ONLY) */
2210 2218  
2211 2219 #if !defined(CONFIG_USER_ONLY)
  2220 +
2212 2221 static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
2213   - ram_addr_t memory);
  2222 + ram_addr_t memory, ram_addr_t region_offset);
2214 2223 static void *subpage_init (target_phys_addr_t base, ram_addr_t *phys,
2215   - ram_addr_t orig_memory);
  2224 + ram_addr_t orig_memory, ram_addr_t region_offset);
2216 2225 #define CHECK_SUBPAGE(addr, start_addr, start_addr2, end_addr, end_addr2, \
2217 2226 need_subpage) \
2218 2227 do { \
... ... @@ -2235,10 +2244,15 @@ static void *subpage_init (target_phys_addr_t base, ram_addr_t *phys,
2235 2244  
2236 2245 /* register physical memory. 'size' must be a multiple of the target
2237 2246 page size. If (phys_offset & ~TARGET_PAGE_MASK) != 0, then it is an
2238   - io memory page */
2239   -void cpu_register_physical_memory(target_phys_addr_t start_addr,
2240   - ram_addr_t size,
2241   - ram_addr_t phys_offset)
  2247 + io memory page. The address used when calling the IO function is
  2248 + the offset from the start of the region, plus region_offset. Both
  2249 + start_region and regon_offset are rounded down to a page boundary
  2250 + before calculating this offset. This should not be a problem unless
  2251 + the low bits of start_addr and region_offset differ. */
  2252 +void cpu_register_physical_memory_offset(target_phys_addr_t start_addr,
  2253 + ram_addr_t size,
  2254 + ram_addr_t phys_offset,
  2255 + ram_addr_t region_offset)
2242 2256 {
2243 2257 target_phys_addr_t addr, end_addr;
2244 2258 PhysPageDesc *p;
... ... @@ -2256,6 +2270,7 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr,
2256 2270 if (kvm_enabled())
2257 2271 kvm_set_phys_mem(start_addr, size, phys_offset);
2258 2272  
  2273 + region_offset &= TARGET_PAGE_MASK;
2259 2274 size = (size + TARGET_PAGE_SIZE - 1) & TARGET_PAGE_MASK;
2260 2275 end_addr = start_addr + (target_phys_addr_t)size;
2261 2276 for(addr = start_addr; addr != end_addr; addr += TARGET_PAGE_SIZE) {
... ... @@ -2270,12 +2285,15 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr,
2270 2285 if (need_subpage || phys_offset & IO_MEM_SUBWIDTH) {
2271 2286 if (!(orig_memory & IO_MEM_SUBPAGE)) {
2272 2287 subpage = subpage_init((addr & TARGET_PAGE_MASK),
2273   - &p->phys_offset, orig_memory);
  2288 + &p->phys_offset, orig_memory,
  2289 + p->region_offset);
2274 2290 } else {
2275 2291 subpage = io_mem_opaque[(orig_memory & ~TARGET_PAGE_MASK)
2276 2292 >> IO_MEM_SHIFT];
2277 2293 }
2278   - subpage_register(subpage, start_addr2, end_addr2, phys_offset);
  2294 + subpage_register(subpage, start_addr2, end_addr2, phys_offset,
  2295 + region_offset);
  2296 + p->region_offset = 0;
2279 2297 } else {
2280 2298 p->phys_offset = phys_offset;
2281 2299 if ((phys_offset & ~TARGET_PAGE_MASK) <= IO_MEM_ROM ||
... ... @@ -2285,10 +2303,11 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr,
2285 2303 } else {
2286 2304 p = phys_page_find_alloc(addr >> TARGET_PAGE_BITS, 1);
2287 2305 p->phys_offset = phys_offset;
  2306 + p->region_offset = region_offset;
2288 2307 if ((phys_offset & ~TARGET_PAGE_MASK) <= IO_MEM_ROM ||
2289   - (phys_offset & IO_MEM_ROMD))
  2308 + (phys_offset & IO_MEM_ROMD)) {
2290 2309 phys_offset += TARGET_PAGE_SIZE;
2291   - else {
  2310 + }else {
2292 2311 target_phys_addr_t start_addr2, end_addr2;
2293 2312 int need_subpage = 0;
2294 2313  
... ... @@ -2297,12 +2316,15 @@ void cpu_register_physical_memory(target_phys_addr_t start_addr,
2297 2316  
2298 2317 if (need_subpage || phys_offset & IO_MEM_SUBWIDTH) {
2299 2318 subpage = subpage_init((addr & TARGET_PAGE_MASK),
2300   - &p->phys_offset, IO_MEM_UNASSIGNED);
  2319 + &p->phys_offset, IO_MEM_UNASSIGNED,
  2320 + 0);
2301 2321 subpage_register(subpage, start_addr2, end_addr2,
2302   - phys_offset);
  2322 + phys_offset, region_offset);
  2323 + p->region_offset = 0;
2303 2324 }
2304 2325 }
2305 2326 }
  2327 + region_offset += TARGET_PAGE_SIZE;
2306 2328 }
2307 2329  
2308 2330 /* since each CPU stores ram addresses in its TLB cache, we must
... ... @@ -2609,12 +2631,13 @@ static inline uint32_t subpage_readlen (subpage_t *mmio, target_phys_addr_t addr
2609 2631 uint32_t ret;
2610 2632 unsigned int idx;
2611 2633  
2612   - idx = SUBPAGE_IDX(addr - mmio->base);
  2634 + idx = SUBPAGE_IDX(addr);
2613 2635 #if defined(DEBUG_SUBPAGE)
2614 2636 printf("%s: subpage %p len %d addr " TARGET_FMT_plx " idx %d\n", __func__,
2615 2637 mmio, len, addr, idx);
2616 2638 #endif
2617   - ret = (**mmio->mem_read[idx][len])(mmio->opaque[idx][0][len], addr);
  2639 + ret = (**mmio->mem_read[idx][len])(mmio->opaque[idx][0][len],
  2640 + addr + mmio->region_offset[idx][0][len]);
2618 2641  
2619 2642 return ret;
2620 2643 }
... ... @@ -2624,12 +2647,14 @@ static inline void subpage_writelen (subpage_t *mmio, target_phys_addr_t addr,
2624 2647 {
2625 2648 unsigned int idx;
2626 2649  
2627   - idx = SUBPAGE_IDX(addr - mmio->base);
  2650 + idx = SUBPAGE_IDX(addr);
2628 2651 #if defined(DEBUG_SUBPAGE)
2629 2652 printf("%s: subpage %p len %d addr " TARGET_FMT_plx " idx %d value %08x\n", __func__,
2630 2653 mmio, len, addr, idx, value);
2631 2654 #endif
2632   - (**mmio->mem_write[idx][len])(mmio->opaque[idx][1][len], addr, value);
  2655 + (**mmio->mem_write[idx][len])(mmio->opaque[idx][1][len],
  2656 + addr + mmio->region_offset[idx][1][len],
  2657 + value);
2633 2658 }
2634 2659  
2635 2660 static uint32_t subpage_readb (void *opaque, target_phys_addr_t addr)
... ... @@ -2699,7 +2724,7 @@ static CPUWriteMemoryFunc *subpage_write[] = {
2699 2724 };
2700 2725  
2701 2726 static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
2702   - ram_addr_t memory)
  2727 + ram_addr_t memory, ram_addr_t region_offset)
2703 2728 {
2704 2729 int idx, eidx;
2705 2730 unsigned int i;
... ... @@ -2718,10 +2743,12 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
2718 2743 if (io_mem_read[memory][i]) {
2719 2744 mmio->mem_read[idx][i] = &io_mem_read[memory][i];
2720 2745 mmio->opaque[idx][0][i] = io_mem_opaque[memory];
  2746 + mmio->region_offset[idx][0][i] = region_offset;
2721 2747 }
2722 2748 if (io_mem_write[memory][i]) {
2723 2749 mmio->mem_write[idx][i] = &io_mem_write[memory][i];
2724 2750 mmio->opaque[idx][1][i] = io_mem_opaque[memory];
  2751 + mmio->region_offset[idx][1][i] = region_offset;
2725 2752 }
2726 2753 }
2727 2754 }
... ... @@ -2730,7 +2757,7 @@ static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end,
2730 2757 }
2731 2758  
2732 2759 static void *subpage_init (target_phys_addr_t base, ram_addr_t *phys,
2733   - ram_addr_t orig_memory)
  2760 + ram_addr_t orig_memory, ram_addr_t region_offset)
2734 2761 {
2735 2762 subpage_t *mmio;
2736 2763 int subpage_memory;
... ... @@ -2744,7 +2771,8 @@ static void *subpage_init (target_phys_addr_t base, ram_addr_t *phys,
2744 2771 mmio, base, TARGET_PAGE_SIZE, subpage_memory);
2745 2772 #endif
2746 2773 *phys = subpage_memory | IO_MEM_SUBPAGE;
2747   - subpage_register(mmio, 0, TARGET_PAGE_SIZE - 1, orig_memory);
  2774 + subpage_register(mmio, 0, TARGET_PAGE_SIZE - 1, orig_memory,
  2775 + region_offset);
2748 2776 }
2749 2777  
2750 2778 return mmio;
... ... @@ -2878,6 +2906,8 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
2878 2906 if (is_write) {
2879 2907 if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
2880 2908 io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
  2909 + if (p)
  2910 + addr = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
2881 2911 /* XXX: could force cpu_single_env to NULL to avoid
2882 2912 potential bugs */
2883 2913 if (l >= 4 && ((addr & 3) == 0)) {
... ... @@ -2915,6 +2945,8 @@ void cpu_physical_memory_rw(target_phys_addr_t addr, uint8_t *buf,
2915 2945 !(pd & IO_MEM_ROMD)) {
2916 2946 /* I/O case */
2917 2947 io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
  2948 + if (p)
  2949 + addr = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
2918 2950 if (l >= 4 && ((addr & 3) == 0)) {
2919 2951 /* 32 bit read access */
2920 2952 val = io_mem_read[io_index][2](io_mem_opaque[io_index], addr);
... ... @@ -3004,6 +3036,8 @@ uint32_t ldl_phys(target_phys_addr_t addr)
3004 3036 !(pd & IO_MEM_ROMD)) {
3005 3037 /* I/O case */
3006 3038 io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
  3039 + if (p)
  3040 + addr = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
3007 3041 val = io_mem_read[io_index][2](io_mem_opaque[io_index], addr);
3008 3042 } else {
3009 3043 /* RAM case */
... ... @@ -3034,6 +3068,8 @@ uint64_t ldq_phys(target_phys_addr_t addr)
3034 3068 !(pd & IO_MEM_ROMD)) {
3035 3069 /* I/O case */
3036 3070 io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
  3071 + if (p)
  3072 + addr = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
3037 3073 #ifdef TARGET_WORDS_BIGENDIAN
3038 3074 val = (uint64_t)io_mem_read[io_index][2](io_mem_opaque[io_index], addr) << 32;
3039 3075 val |= io_mem_read[io_index][2](io_mem_opaque[io_index], addr + 4);
... ... @@ -3085,6 +3121,8 @@ void stl_phys_notdirty(target_phys_addr_t addr, uint32_t val)
3085 3121  
3086 3122 if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
3087 3123 io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
  3124 + if (p)
  3125 + addr = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
3088 3126 io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val);
3089 3127 } else {
3090 3128 unsigned long addr1 = (pd & TARGET_PAGE_MASK) + (addr & ~TARGET_PAGE_MASK);
... ... @@ -3119,6 +3157,8 @@ void stq_phys_notdirty(target_phys_addr_t addr, uint64_t val)
3119 3157  
3120 3158 if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
3121 3159 io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
  3160 + if (p)
  3161 + addr = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
3122 3162 #ifdef TARGET_WORDS_BIGENDIAN
3123 3163 io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val >> 32);
3124 3164 io_mem_write[io_index][2](io_mem_opaque[io_index], addr + 4, val);
... ... @@ -3150,6 +3190,8 @@ void stl_phys(target_phys_addr_t addr, uint32_t val)
3150 3190  
3151 3191 if ((pd & ~TARGET_PAGE_MASK) != IO_MEM_RAM) {
3152 3192 io_index = (pd >> IO_MEM_SHIFT) & (IO_MEM_NB_ENTRIES - 1);
  3193 + if (p)
  3194 + addr = (addr & ~TARGET_PAGE_MASK) + p->region_offset;
3153 3195 io_mem_write[io_index][2](io_mem_opaque[io_index], addr, val);
3154 3196 } else {
3155 3197 unsigned long addr1;
... ...
hw/arm_gic.c
... ... @@ -23,14 +23,12 @@ do { printf(&quot;arm_gic: &quot; fmt , ##args); } while (0)
23 23 #ifdef NVIC
24 24 static const uint8_t gic_id[] =
25 25 { 0x00, 0xb0, 0x1b, 0x00, 0x0d, 0xe0, 0x05, 0xb1 };
26   -#define GIC_DIST_OFFSET 0
27 26 /* The NVIC has 16 internal vectors. However these are not exposed
28 27 through the normal GIC interface. */
29 28 #define GIC_BASE_IRQ 32
30 29 #else
31 30 static const uint8_t gic_id[] =
32 31 { 0x90, 0x13, 0x04, 0x00, 0x0d, 0xf0, 0x05, 0xb1 };
33   -#define GIC_DIST_OFFSET 0x1000
34 32 #define GIC_BASE_IRQ 0
35 33 #endif
36 34  
... ... @@ -76,7 +74,6 @@ typedef struct gic_irq_state
76 74  
77 75 typedef struct gic_state
78 76 {
79   - uint32_t base;
80 77 qemu_irq parent_irq[NCPU];
81 78 int enabled;
82 79 int cpu_enabled[NCPU];
... ... @@ -252,7 +249,6 @@ static uint32_t gic_dist_readb(void *opaque, target_phys_addr_t offset)
252 249  
253 250 cpu = gic_get_current_cpu();
254 251 cm = 1 << cpu;
255   - offset -= s->base + GIC_DIST_OFFSET;
256 252 if (offset < 0x100) {
257 253 #ifndef NVIC
258 254 if (offset == 0)
... ... @@ -365,7 +361,7 @@ static uint32_t gic_dist_readl(void *opaque, target_phys_addr_t offset)
365 361 #ifdef NVIC
366 362 gic_state *s = (gic_state *)opaque;
367 363 uint32_t addr;
368   - addr = offset - s->base;
  364 + addr = offset;
369 365 if (addr < 0x100 || addr > 0xd00)
370 366 return nvic_readl(s->nvic, addr);
371 367 #endif
... ... @@ -383,7 +379,6 @@ static void gic_dist_writeb(void *opaque, target_phys_addr_t offset,
383 379 int cpu;
384 380  
385 381 cpu = gic_get_current_cpu();
386   - offset -= s->base + GIC_DIST_OFFSET;
387 382 if (offset < 0x100) {
388 383 #ifdef NVIC
389 384 goto bad_reg;
... ... @@ -526,13 +521,13 @@ static void gic_dist_writel(void *opaque, target_phys_addr_t offset,
526 521 gic_state *s = (gic_state *)opaque;
527 522 #ifdef NVIC
528 523 uint32_t addr;
529   - addr = offset - s->base;
  524 + addr = offset;
530 525 if (addr < 0x100 || (addr > 0xd00 && addr != 0xf00)) {
531 526 nvic_writel(s->nvic, addr, value);
532 527 return;
533 528 }
534 529 #endif
535   - if (offset - s->base == GIC_DIST_OFFSET + 0xf00) {
  530 + if (offset == 0xf00) {
536 531 int cpu;
537 532 int irq;
538 533 int mask;
... ... @@ -723,7 +718,7 @@ static int gic_load(QEMUFile *f, void *opaque, int version_id)
723 718 return 0;
724 719 }
725 720  
726   -static gic_state *gic_init(uint32_t base, qemu_irq *parent_irq)
  721 +static gic_state *gic_init(uint32_t dist_base, qemu_irq *parent_irq)
727 722 {
728 723 gic_state *s;
729 724 int iomemtype;
... ... @@ -738,9 +733,8 @@ static gic_state *gic_init(uint32_t base, qemu_irq *parent_irq)
738 733 }
739 734 iomemtype = cpu_register_io_memory(0, gic_dist_readfn,
740 735 gic_dist_writefn, s);
741   - cpu_register_physical_memory(base + GIC_DIST_OFFSET, 0x00001000,
  736 + cpu_register_physical_memory(dist_base, 0x00001000,
742 737 iomemtype);
743   - s->base = base;
744 738 gic_reset(s);
745 739 register_savevm("arm_gic", -1, 1, gic_save, gic_load, s);
746 740 return s;
... ...
hw/arm_sysctl.c
... ... @@ -14,7 +14,6 @@
14 14 #define LOCK_VALUE 0xa05f
15 15  
16 16 typedef struct {
17   - uint32_t base;
18 17 uint32_t sys_id;
19 18 uint32_t leds;
20 19 uint16_t lockval;
... ... @@ -29,7 +28,6 @@ static uint32_t arm_sysctl_read(void *opaque, target_phys_addr_t offset)
29 28 {
30 29 arm_sysctl_state *s = (arm_sysctl_state *)opaque;
31 30  
32   - offset -= s->base;
33 31 switch (offset) {
34 32 case 0x00: /* ID */
35 33 return s->sys_id;
... ... @@ -108,7 +106,6 @@ static void arm_sysctl_write(void *opaque, target_phys_addr_t offset,
108 106 uint32_t val)
109 107 {
110 108 arm_sysctl_state *s = (arm_sysctl_state *)opaque;
111   - offset -= s->base;
112 109  
113 110 switch (offset) {
114 111 case 0x08: /* LED */
... ... @@ -199,7 +196,6 @@ void arm_sysctl_init(uint32_t base, uint32_t sys_id)
199 196 s = (arm_sysctl_state *)qemu_mallocz(sizeof(arm_sysctl_state));
200 197 if (!s)
201 198 return;
202   - s->base = base;
203 199 s->sys_id = sys_id;
204 200 /* The MPcore bootloader uses these flags to start secondary CPUs.
205 201 We don't use a bootloader, so do this here. */
... ...
hw/arm_timer.c
... ... @@ -190,7 +190,6 @@ static void *arm_timer_init(uint32_t freq, qemu_irq irq)
190 190 typedef struct {
191 191 void *timer[2];
192 192 int level[2];
193   - uint32_t base;
194 193 qemu_irq irq;
195 194 } sp804_state;
196 195  
... ... @@ -208,7 +207,6 @@ static uint32_t sp804_read(void *opaque, target_phys_addr_t offset)
208 207 sp804_state *s = (sp804_state *)opaque;
209 208  
210 209 /* ??? Don't know the PrimeCell ID for this device. */
211   - offset -= s->base;
212 210 if (offset < 0x20) {
213 211 return arm_timer_read(s->timer[0], offset);
214 212 } else {
... ... @@ -221,7 +219,6 @@ static void sp804_write(void *opaque, target_phys_addr_t offset,
221 219 {
222 220 sp804_state *s = (sp804_state *)opaque;
223 221  
224   - offset -= s->base;
225 222 if (offset < 0x20) {
226 223 arm_timer_write(s->timer[0], offset, value);
227 224 } else {
... ... @@ -268,7 +265,6 @@ void sp804_init(uint32_t base, qemu_irq irq)
268 265  
269 266 s = (sp804_state *)qemu_mallocz(sizeof(sp804_state));
270 267 qi = qemu_allocate_irqs(sp804_set_irq, s, 2);
271   - s->base = base;
272 268 s->irq = irq;
273 269 /* ??? The timers are actually configurable between 32kHz and 1MHz, but
274 270 we don't implement that. */
... ... @@ -285,7 +281,6 @@ void sp804_init(uint32_t base, qemu_irq irq)
285 281  
286 282 typedef struct {
287 283 void *timer[3];
288   - uint32_t base;
289 284 } icp_pit_state;
290 285  
291 286 static uint32_t icp_pit_read(void *opaque, target_phys_addr_t offset)
... ... @@ -294,7 +289,6 @@ static uint32_t icp_pit_read(void *opaque, target_phys_addr_t offset)
294 289 int n;
295 290  
296 291 /* ??? Don't know the PrimeCell ID for this device. */
297   - offset -= s->base;
298 292 n = offset >> 8;
299 293 if (n > 3)
300 294 cpu_abort(cpu_single_env, "sp804_read: Bad timer %d\n", n);
... ... @@ -308,7 +302,6 @@ static void icp_pit_write(void *opaque, target_phys_addr_t offset,
308 302 icp_pit_state *s = (icp_pit_state *)opaque;
309 303 int n;
310 304  
311   - offset -= s->base;
312 305 n = offset >> 8;
313 306 if (n > 3)
314 307 cpu_abort(cpu_single_env, "sp804_write: Bad timer %d\n", n);
... ... @@ -335,7 +328,6 @@ void icp_pit_init(uint32_t base, qemu_irq *pic, int irq)
335 328 icp_pit_state *s;
336 329  
337 330 s = (icp_pit_state *)qemu_mallocz(sizeof(icp_pit_state));
338   - s->base = base;
339 331 /* Timer 0 runs at the system clock speed (40MHz). */
340 332 s->timer[0] = arm_timer_init(40000000, pic[irq]);
341 333 /* The other two timers run at 1MHz. */
... ...
hw/armv7m.c
... ... @@ -14,11 +14,11 @@
14 14 /* Bitbanded IO. Each word corresponds to a single bit. */
15 15  
16 16 /* Get the byte address of the real memory for a bitband acess. */
17   -static inline uint32_t bitband_addr(uint32_t addr)
  17 +static inline uint32_t bitband_addr(void * opaque, uint32_t addr)
18 18 {
19 19 uint32_t res;
20 20  
21   - res = addr & 0xe0000000;
  21 + res = *(uint32_t *)opaque;
22 22 res |= (addr & 0x1ffffff) >> 5;
23 23 return res;
24 24  
... ... @@ -27,7 +27,7 @@ static inline uint32_t bitband_addr(uint32_t addr)
27 27 static uint32_t bitband_readb(void *opaque, target_phys_addr_t offset)
28 28 {
29 29 uint8_t v;
30   - cpu_physical_memory_read(bitband_addr(offset), &v, 1);
  30 + cpu_physical_memory_read(bitband_addr(opaque, offset), &v, 1);
31 31 return (v & (1 << ((offset >> 2) & 7))) != 0;
32 32 }
33 33  
... ... @@ -37,7 +37,7 @@ static void bitband_writeb(void *opaque, target_phys_addr_t offset,
37 37 uint32_t addr;
38 38 uint8_t mask;
39 39 uint8_t v;
40   - addr = bitband_addr(offset);
  40 + addr = bitband_addr(opaque, offset);
41 41 mask = (1 << ((offset >> 2) & 7));
42 42 cpu_physical_memory_read(addr, &v, 1);
43 43 if (value & 1)
... ... @@ -52,7 +52,7 @@ static uint32_t bitband_readw(void *opaque, target_phys_addr_t offset)
52 52 uint32_t addr;
53 53 uint16_t mask;
54 54 uint16_t v;
55   - addr = bitband_addr(offset) & ~1;
  55 + addr = bitband_addr(opaque, offset) & ~1;
56 56 mask = (1 << ((offset >> 2) & 15));
57 57 mask = tswap16(mask);
58 58 cpu_physical_memory_read(addr, (uint8_t *)&v, 2);
... ... @@ -65,7 +65,7 @@ static void bitband_writew(void *opaque, target_phys_addr_t offset,
65 65 uint32_t addr;
66 66 uint16_t mask;
67 67 uint16_t v;
68   - addr = bitband_addr(offset) & ~1;
  68 + addr = bitband_addr(opaque, offset) & ~1;
69 69 mask = (1 << ((offset >> 2) & 15));
70 70 mask = tswap16(mask);
71 71 cpu_physical_memory_read(addr, (uint8_t *)&v, 2);
... ... @@ -81,7 +81,7 @@ static uint32_t bitband_readl(void *opaque, target_phys_addr_t offset)
81 81 uint32_t addr;
82 82 uint32_t mask;
83 83 uint32_t v;
84   - addr = bitband_addr(offset) & ~3;
  84 + addr = bitband_addr(opaque, offset) & ~3;
85 85 mask = (1 << ((offset >> 2) & 31));
86 86 mask = tswap32(mask);
87 87 cpu_physical_memory_read(addr, (uint8_t *)&v, 4);
... ... @@ -94,7 +94,7 @@ static void bitband_writel(void *opaque, target_phys_addr_t offset,
94 94 uint32_t addr;
95 95 uint32_t mask;
96 96 uint32_t v;
97   - addr = bitband_addr(offset) & ~3;
  97 + addr = bitband_addr(opaque, offset) & ~3;
98 98 mask = (1 << ((offset >> 2) & 31));
99 99 mask = tswap32(mask);
100 100 cpu_physical_memory_read(addr, (uint8_t *)&v, 4);
... ... @@ -120,10 +120,14 @@ static CPUWriteMemoryFunc *bitband_writefn[] = {
120 120 static void armv7m_bitband_init(void)
121 121 {
122 122 int iomemtype;
  123 + static uint32_t bitband1_offset = 0x20000000;
  124 + static uint32_t bitband2_offset = 0x40000000;
123 125  
124 126 iomemtype = cpu_register_io_memory(0, bitband_readfn, bitband_writefn,
125   - NULL);
  127 + &bitband1_offset);
126 128 cpu_register_physical_memory(0x22000000, 0x02000000, iomemtype);
  129 + iomemtype = cpu_register_io_memory(0, bitband_readfn, bitband_writefn,
  130 + &bitband2_offset);
127 131 cpu_register_physical_memory(0x42000000, 0x02000000, iomemtype);
128 132 }
129 133  
... ...
hw/ds1225y.c
... ... @@ -30,7 +30,6 @@
30 30  
31 31 typedef struct ds1225y_t
32 32 {
33   - target_phys_addr_t mem_base;
34 33 uint32_t chip_size;
35 34 QEMUFile *file;
36 35 uint8_t *contents;
... ... @@ -41,14 +40,9 @@ typedef struct ds1225y_t
41 40 static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr)
42 41 {
43 42 ds1225y_t *s = opaque;
44   - int64_t pos;
45 43 uint32_t val;
46 44  
47   - pos = addr - s->mem_base;
48   - if (pos >= s->chip_size)
49   - pos -= s->chip_size;
50   -
51   - val = s->contents[pos];
  45 + val = s->contents[addr];
52 46  
53 47 #ifdef DEBUG_NVRAM
54 48 printf("nvram: read 0x%x at " TARGET_FMT_lx "\n", val, addr);
... ... @@ -77,16 +71,14 @@ static uint32_t nvram_readl (void *opaque, target_phys_addr_t addr)
77 71 static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t val)
78 72 {
79 73 ds1225y_t *s = opaque;
80   - int64_t pos;
81 74  
82 75 #ifdef DEBUG_NVRAM
83 76 printf("nvram: write 0x%x at " TARGET_FMT_lx "\n", val, addr);
84 77 #endif
85 78  
86   - pos = addr - s->mem_base;
87   - s->contents[pos] = val & 0xff;
  79 + s->contents[addr] = val & 0xff;
88 80 if (s->file) {
89   - qemu_fseek(s->file, pos, SEEK_SET);
  81 + qemu_fseek(s->file, addr, SEEK_SET);
90 82 qemu_put_byte(s->file, (int)val);
91 83 qemu_fflush(s->file);
92 84 }
... ... @@ -117,7 +109,7 @@ static void nvram_writeb_protected (void *opaque, target_phys_addr_t addr, uint3
117 109 return;
118 110 }
119 111  
120   - nvram_writeb(opaque, addr - s->chip_size, val);
  112 + nvram_writeb(opaque, addr, val);
121 113 }
122 114  
123 115 static void nvram_writew_protected (void *opaque, target_phys_addr_t addr, uint32_t val)
... ... @@ -167,7 +159,6 @@ void *ds1225y_init(target_phys_addr_t mem_base, const char *filename)
167 159 if (!s->contents) {
168 160 return NULL;
169 161 }
170   - s->mem_base = mem_base;
171 162 s->protection = 7;
172 163  
173 164 /* Read current file */
... ...
hw/e1000.c
... ... @@ -76,7 +76,6 @@ typedef struct E1000State_st {
76 76 PCIDevice dev;
77 77 VLANClientState *vc;
78 78 NICInfo *nd;
79   - uint32_t mmio_base;
80 79 int mmio_index;
81 80  
82 81 uint32_t mac_reg[0x8000];
... ... @@ -786,7 +785,7 @@ static void
786 785 e1000_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
787 786 {
788 787 E1000State *s = opaque;
789   - unsigned int index = ((addr - s->mmio_base) & 0x1ffff) >> 2;
  788 + unsigned int index = (addr & 0x1ffff) >> 2;
790 789  
791 790 #ifdef TARGET_WORDS_BIGENDIAN
792 791 val = bswap32(val);
... ... @@ -820,7 +819,7 @@ static uint32_t
820 819 e1000_mmio_readl(void *opaque, target_phys_addr_t addr)
821 820 {
822 821 E1000State *s = opaque;
823   - unsigned int index = ((addr - s->mmio_base) & 0x1ffff) >> 2;
  822 + unsigned int index = (addr & 0x1ffff) >> 2;
824 823  
825 824 if (index < NREADOPS && macreg_readops[index])
826 825 {
... ... @@ -870,7 +869,7 @@ nic_save(QEMUFile *f, void *opaque)
870 869 int i, j;
871 870  
872 871 pci_device_save(&s->dev, f);
873   - qemu_put_be32s(f, &s->mmio_base);
  872 + qemu_put_be32(f, 0);
874 873 qemu_put_be32s(f, &s->rxbuf_size);
875 874 qemu_put_be32s(f, &s->rxbuf_min_shift);
876 875 qemu_put_be32s(f, &s->eecd_state.val_in);
... ... @@ -916,7 +915,7 @@ nic_load(QEMUFile *f, void *opaque, int version_id)
916 915 return ret;
917 916 if (version_id == 1)
918 917 qemu_get_sbe32s(f, &i); /* once some unused instance id */
919   - qemu_get_be32s(f, &s->mmio_base);
  918 + qemu_get_be32(f); /* Ignored. Was mmio_base. */
920 919 qemu_get_be32s(f, &s->rxbuf_size);
921 920 qemu_get_be32s(f, &s->rxbuf_min_shift);
922 921 qemu_get_be32s(f, &s->eecd_state.val_in);
... ... @@ -1005,7 +1004,6 @@ e1000_mmio_map(PCIDevice *pci_dev, int region_num,
1005 1004  
1006 1005 DBGOUT(MMIO, "e1000_mmio_map addr=0x%08x 0x%08x\n", addr, size);
1007 1006  
1008   - d->mmio_base = addr;
1009 1007 cpu_register_physical_memory(addr, PNPMMIO_SIZE, d->mmio_index);
1010 1008 }
1011 1009  
... ...
hw/eepro100.c
... ... @@ -1392,7 +1392,6 @@ static void pci_map(PCIDevice * pci_dev, int region_num,
1392 1392 static void pci_mmio_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
1393 1393 {
1394 1394 EEPRO100State *s = opaque;
1395   - addr -= s->region[0];
1396 1395 //~ logout("addr=%s val=0x%02x\n", regname(addr), val);
1397 1396 eepro100_write1(s, addr, val);
1398 1397 }
... ... @@ -1400,7 +1399,6 @@ static void pci_mmio_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
1400 1399 static void pci_mmio_writew(void *opaque, target_phys_addr_t addr, uint32_t val)
1401 1400 {
1402 1401 EEPRO100State *s = opaque;
1403   - addr -= s->region[0];
1404 1402 //~ logout("addr=%s val=0x%02x\n", regname(addr), val);
1405 1403 eepro100_write2(s, addr, val);
1406 1404 }
... ... @@ -1408,7 +1406,6 @@ static void pci_mmio_writew(void *opaque, target_phys_addr_t addr, uint32_t val)
1408 1406 static void pci_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
1409 1407 {
1410 1408 EEPRO100State *s = opaque;
1411   - addr -= s->region[0];
1412 1409 //~ logout("addr=%s val=0x%02x\n", regname(addr), val);
1413 1410 eepro100_write4(s, addr, val);
1414 1411 }
... ... @@ -1416,7 +1413,6 @@ static void pci_mmio_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
1416 1413 static uint32_t pci_mmio_readb(void *opaque, target_phys_addr_t addr)
1417 1414 {
1418 1415 EEPRO100State *s = opaque;
1419   - addr -= s->region[0];
1420 1416 //~ logout("addr=%s\n", regname(addr));
1421 1417 return eepro100_read1(s, addr);
1422 1418 }
... ... @@ -1424,7 +1420,6 @@ static uint32_t pci_mmio_readb(void *opaque, target_phys_addr_t addr)
1424 1420 static uint32_t pci_mmio_readw(void *opaque, target_phys_addr_t addr)
1425 1421 {
1426 1422 EEPRO100State *s = opaque;
1427   - addr -= s->region[0];
1428 1423 //~ logout("addr=%s\n", regname(addr));
1429 1424 return eepro100_read2(s, addr);
1430 1425 }
... ... @@ -1432,7 +1427,6 @@ static uint32_t pci_mmio_readw(void *opaque, target_phys_addr_t addr)
1432 1427 static uint32_t pci_mmio_readl(void *opaque, target_phys_addr_t addr)
1433 1428 {
1434 1429 EEPRO100State *s = opaque;
1435   - addr -= s->region[0];
1436 1430 //~ logout("addr=%s\n", regname(addr));
1437 1431 return eepro100_read4(s, addr);
1438 1432 }
... ...
hw/etraxfs_dma.c
... ... @@ -188,7 +188,6 @@ struct fs_dma_channel
188 188 struct fs_dma_ctrl
189 189 {
190 190 CPUState *env;
191   - target_phys_addr_t base;
192 191  
193 192 int nr_channels;
194 193 struct fs_dma_channel *channels;
... ... @@ -212,10 +211,10 @@ static inline int channel_en(struct fs_dma_ctrl *ctrl, int c)
212 211 && ctrl->channels[c].client;
213 212 }
214 213  
215   -static inline int fs_channel(target_phys_addr_t base, target_phys_addr_t addr)
  214 +static inline int fs_channel(target_phys_addr_t addr)
216 215 {
217 216 /* Every channel has a 0x2000 ctrl register map. */
218   - return (addr - base) >> 13;
  217 + return addr >> 13;
219 218 }
220 219  
221 220 #ifdef USE_THIS_DEAD_CODE
... ... @@ -572,7 +571,7 @@ dma_readl (void *opaque, target_phys_addr_t addr)
572 571 uint32_t r = 0;
573 572  
574 573 /* Make addr relative to this instances base. */
575   - c = fs_channel(ctrl->base, addr);
  574 + c = fs_channel(addr);
576 575 addr &= 0x1fff;
577 576 switch (addr)
578 577 {
... ... @@ -618,7 +617,7 @@ dma_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
618 617 int c;
619 618  
620 619 /* Make addr relative to this instances base. */
621   - c = fs_channel(ctrl->base, addr);
  620 + c = fs_channel(addr);
622 621 addr &= 0x1fff;
623 622 switch (addr)
624 623 {
... ... @@ -753,7 +752,6 @@ void *etraxfs_dmac_init(CPUState *env,
753 752  
754 753 ctrl->bh = qemu_bh_new(DMA_run, ctrl);
755 754  
756   - ctrl->base = base;
757 755 ctrl->env = env;
758 756 ctrl->nr_channels = nr_channels;
759 757 ctrl->channels = qemu_mallocz(sizeof ctrl->channels[0] * nr_channels);
... ... @@ -766,9 +764,9 @@ void *etraxfs_dmac_init(CPUState *env,
766 764 dma_read,
767 765 dma_write,
768 766 ctrl);
769   - cpu_register_physical_memory (base + i * 0x2000,
770   - sizeof ctrl->channels[i].regs,
771   - ctrl->channels[i].regmap);
  767 + cpu_register_physical_memory_offset (base + i * 0x2000,
  768 + sizeof ctrl->channels[i].regs, ctrl->channels[i].regmap,
  769 + i * 0x2000);
772 770 }
773 771  
774 772 return ctrl;
... ...
hw/etraxfs_eth.c
... ... @@ -314,7 +314,6 @@ struct fs_eth
314 314 {
315 315 CPUState *env;
316 316 qemu_irq *irq;
317   - target_phys_addr_t base;
318 317 VLANClientState *vc;
319 318 int ethregs;
320 319  
... ... @@ -375,8 +374,6 @@ static uint32_t eth_readl (void *opaque, target_phys_addr_t addr)
375 374 struct fs_eth *eth = opaque;
376 375 uint32_t r = 0;
377 376  
378   - /* Make addr relative to this instances base. */
379   - addr -= eth->base;
380 377 switch (addr) {
381 378 case R_STAT:
382 379 /* Attach an MDIO/PHY abstraction. */
... ... @@ -428,8 +425,6 @@ eth_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
428 425 {
429 426 struct fs_eth *eth = opaque;
430 427  
431   - /* Make addr relative to this instances base. */
432   - addr -= eth->base;
433 428 switch (addr)
434 429 {
435 430 case RW_MA0_LO:
... ... @@ -589,7 +584,6 @@ void *etraxfs_eth_init(NICInfo *nd, CPUState *env,
589 584 dma[1].client.pull = NULL;
590 585  
591 586 eth->env = env;
592   - eth->base = base;
593 587 eth->irq = irq;
594 588 eth->dma_out = dma;
595 589 eth->dma_in = dma + 1;
... ...
hw/etraxfs_pic.c
... ... @@ -31,7 +31,6 @@
31 31 struct fs_pic_state_t
32 32 {
33 33 CPUState *env;
34   - target_phys_addr_t base;
35 34  
36 35 uint32_t rw_mask;
37 36 /* Active interrupt lines. */
... ... @@ -56,8 +55,6 @@ static uint32_t pic_readl (void *opaque, target_phys_addr_t addr)
56 55 struct fs_pic_state_t *fs = opaque;
57 56 uint32_t rval;
58 57  
59   - /* Transform this to a relative addr. */
60   - addr -= fs->base;
61 58 switch (addr)
62 59 {
63 60 case 0x0:
... ... @@ -99,8 +96,6 @@ pic_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
99 96 {
100 97 struct fs_pic_state_t *fs = opaque;
101 98 D(printf("%s addr=%x val=%x\n", __func__, addr, value));
102   - /* Transform this to a relative addr. */
103   - addr -= fs->base;
104 99 switch (addr)
105 100 {
106 101 case 0x0:
... ... @@ -233,7 +228,6 @@ struct etraxfs_pic *etraxfs_pic_init(CPUState *env, target_phys_addr_t base)
233 228  
234 229 intr_vect_regs = cpu_register_io_memory(0, pic_read, pic_write, fs);
235 230 cpu_register_physical_memory(base, 0x14, intr_vect_regs);
236   - fs->base = base;
237 231  
238 232 return pic;
239 233 err:
... ...
hw/etraxfs_ser.c
... ... @@ -50,8 +50,6 @@ struct etrax_serial_t
50 50 CharDriverState *chr;
51 51 qemu_irq *irq;
52 52  
53   - target_phys_addr_t base;
54   -
55 53 int pending_tx;
56 54  
57 55 /* Control registers. */
... ... @@ -240,8 +238,6 @@ void etraxfs_ser_init(CPUState *env, qemu_irq *irq, CharDriverState *chr,
240 238  
241 239 s->env = env;
242 240 s->irq = irq;
243   - s->base = base;
244   -
245 241 s->chr = chr;
246 242  
247 243 /* transmitter begins ready and idle. */
... ...
hw/etraxfs_timer.c
... ... @@ -47,7 +47,6 @@ struct fs_timer_t {
47 47 CPUState *env;
48 48 qemu_irq *irq;
49 49 qemu_irq *nmi;
50   - target_phys_addr_t base;
51 50  
52 51 QEMUBH *bh_t0;
53 52 QEMUBH *bh_t1;
... ... @@ -90,8 +89,6 @@ static uint32_t timer_readl (void *opaque, target_phys_addr_t addr)
90 89 struct fs_timer_t *t = opaque;
91 90 uint32_t r = 0;
92 91  
93   - /* Make addr relative to this instances base. */
94   - addr -= t->base;
95 92 switch (addr) {
96 93 case R_TMR0_DATA:
97 94 break;
... ... @@ -273,8 +270,6 @@ timer_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
273 270 {
274 271 struct fs_timer_t *t = opaque;
275 272  
276   - /* Make addr relative to this instances base. */
277   - addr -= t->base;
278 273 switch (addr)
279 274 {
280 275 case RW_TMR0_DIV:
... ... @@ -357,7 +352,6 @@ void etraxfs_timer_init(CPUState *env, qemu_irq *irqs, qemu_irq *nmi,
357 352 t->irq = irqs;
358 353 t->nmi = nmi;
359 354 t->env = env;
360   - t->base = base;
361 355  
362 356 timer_regs = cpu_register_io_memory(0, timer_read, timer_write, t);
363 357 cpu_register_physical_memory (base, 0x5c, timer_regs);
... ...
hw/g364fb.c
... ... @@ -26,7 +26,6 @@
26 26 //#define DEBUG_G364
27 27  
28 28 typedef struct G364State {
29   - target_phys_addr_t vram_base;
30 29 unsigned int vram_size;
31 30 uint8_t *vram_buffer;
32 31 uint32_t ctla;
... ... @@ -300,9 +299,8 @@ static CPUWriteMemoryFunc *g364fb_ctrl_write[3] = {
300 299 static uint32_t g364fb_mem_readb(void *opaque, target_phys_addr_t addr)
301 300 {
302 301 G364State *s = opaque;
303   - target_phys_addr_t relative_addr = addr - s->vram_base;
304 302  
305   - return s->vram_buffer[relative_addr];
  303 + return s->vram_buffer[addr];
306 304 }
307 305  
308 306 static uint32_t g364fb_mem_readw(void *opaque, target_phys_addr_t addr)
... ... @@ -326,9 +324,8 @@ static uint32_t g364fb_mem_readl(void *opaque, target_phys_addr_t addr)
326 324 static void g364fb_mem_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
327 325 {
328 326 G364State *s = opaque;
329   - target_phys_addr_t relative_addr = addr - s->vram_base;
330 327  
331   - s->vram_buffer[relative_addr] = val;
  328 + s->vram_buffer[addr] = val;
332 329 }
333 330  
334 331 static void g364fb_mem_writew(void *opaque, target_phys_addr_t addr, uint32_t val)
... ... @@ -375,14 +372,13 @@ int g364fb_mm_init(DisplayState *ds,
375 372 g364fb_reset(s);
376 373  
377 374 s->ds = ds;
378   - s->vram_base = vram_base;
379 375  
380 376 s->console = graphic_console_init(ds, g364fb_update_display,
381 377 g364fb_invalidate_display,
382 378 g364fb_screen_dump, NULL, s);
383 379  
384 380 io_vram = cpu_register_io_memory(0, g364fb_mem_read, g364fb_mem_write, s);
385   - cpu_register_physical_memory(s->vram_base, vram_size, io_vram);
  381 + cpu_register_physical_memory(vram_base, vram_size, io_vram);
386 382  
387 383 io_ctrl = cpu_register_io_memory(0, g364fb_ctrl_read, g364fb_ctrl_write, s);
388 384 cpu_register_physical_memory(ctrl_base, 0x10000, io_ctrl);
... ...
hw/integratorcp.c
... ... @@ -38,7 +38,6 @@ static uint8_t integrator_spd[128] = {
38 38 static uint32_t integratorcm_read(void *opaque, target_phys_addr_t offset)
39 39 {
40 40 integratorcm_state *s = (integratorcm_state *)opaque;
41   - offset -= 0x10000000;
42 41 if (offset >= 0x100 && offset < 0x200) {
43 42 /* CM_SPD */
44 43 if (offset >= 0x180)
... ... @@ -141,7 +140,6 @@ static void integratorcm_write(void *opaque, target_phys_addr_t offset,
141 140 uint32_t value)
142 141 {
143 142 integratorcm_state *s = (integratorcm_state *)opaque;
144   - offset -= 0x10000000;
145 143 switch (offset >> 2) {
146 144 case 2: /* CM_OSC */
147 145 if (s->cm_lock == 0xa05f)
... ... @@ -268,7 +266,6 @@ static void integratorcm_init(int memsz)
268 266  
269 267 typedef struct icp_pic_state
270 268 {
271   - uint32_t base;
272 269 uint32_t level;
273 270 uint32_t irq_enabled;
274 271 uint32_t fiq_enabled;
... ... @@ -300,7 +297,6 @@ static uint32_t icp_pic_read(void *opaque, target_phys_addr_t offset)
300 297 {
301 298 icp_pic_state *s = (icp_pic_state *)opaque;
302 299  
303   - offset -= s->base;
304 300 switch (offset >> 2) {
305 301 case 0: /* IRQ_STATUS */
306 302 return s->level & s->irq_enabled;
... ... @@ -329,7 +325,6 @@ static void icp_pic_write(void *opaque, target_phys_addr_t offset,
329 325 uint32_t value)
330 326 {
331 327 icp_pic_state *s = (icp_pic_state *)opaque;
332   - offset -= s->base;
333 328  
334 329 switch (offset >> 2) {
335 330 case 2: /* IRQ_ENABLESET */
... ... @@ -386,7 +381,6 @@ static qemu_irq *icp_pic_init(uint32_t base,
386 381 if (!s)
387 382 return NULL;
388 383 qi = qemu_allocate_irqs(icp_pic_set_irq, s, 32);
389   - s->base = base;
390 384 s->parent_irq = parent_irq;
391 385 s->parent_fiq = parent_fiq;
392 386 iomemtype = cpu_register_io_memory(0, icp_pic_readfn,
... ... @@ -397,14 +391,8 @@ static qemu_irq *icp_pic_init(uint32_t base,
397 391 }
398 392  
399 393 /* CP control registers. */
400   -typedef struct {
401   - uint32_t base;
402   -} icp_control_state;
403   -
404 394 static uint32_t icp_control_read(void *opaque, target_phys_addr_t offset)
405 395 {
406   - icp_control_state *s = (icp_control_state *)opaque;
407   - offset -= s->base;
408 396 switch (offset >> 2) {
409 397 case 0: /* CP_IDFIELD */
410 398 return 0x41034003;
... ... @@ -424,8 +412,6 @@ static uint32_t icp_control_read(void *opaque, target_phys_addr_t offset)
424 412 static void icp_control_write(void *opaque, target_phys_addr_t offset,
425 413 uint32_t value)
426 414 {
427   - icp_control_state *s = (icp_control_state *)opaque;
428   - offset -= s->base;
429 415 switch (offset >> 2) {
430 416 case 1: /* CP_FLASHPROG */
431 417 case 2: /* CP_INTREG */
... ... @@ -452,13 +438,10 @@ static CPUWriteMemoryFunc *icp_control_writefn[] = {
452 438 static void icp_control_init(uint32_t base)
453 439 {
454 440 int iomemtype;
455   - icp_control_state *s;
456 441  
457   - s = (icp_control_state *)qemu_mallocz(sizeof(icp_control_state));
458 442 iomemtype = cpu_register_io_memory(0, icp_control_readfn,
459   - icp_control_writefn, s);
  443 + icp_control_writefn, NULL);
460 444 cpu_register_physical_memory(base, 0x00800000, iomemtype);
461   - s->base = base;
462 445 /* ??? Save/restore. */
463 446 }
464 447  
... ...
hw/iommu.c
... ... @@ -114,7 +114,6 @@ do { printf(&quot;IOMMU: &quot; fmt , ##args); } while (0)
114 114 #define PAGE_MASK (PAGE_SIZE - 1)
115 115  
116 116 typedef struct IOMMUState {
117   - target_phys_addr_t addr;
118 117 uint32_t regs[IOMMU_NREGS];
119 118 target_phys_addr_t iostart;
120 119 uint32_t version;
... ... @@ -127,7 +126,7 @@ static uint32_t iommu_mem_readl(void *opaque, target_phys_addr_t addr)
127 126 target_phys_addr_t saddr;
128 127 uint32_t ret;
129 128  
130   - saddr = (addr - s->addr) >> 2;
  129 + saddr = addr >> 2;
131 130 switch (saddr) {
132 131 default:
133 132 ret = s->regs[saddr];
... ... @@ -148,7 +147,7 @@ static void iommu_mem_writel(void *opaque, target_phys_addr_t addr,
148 147 IOMMUState *s = opaque;
149 148 target_phys_addr_t saddr;
150 149  
151   - saddr = (addr - s->addr) >> 2;
  150 + saddr = addr >> 2;
152 151 DPRINTF("write reg[%d] = %x\n", (int)saddr, val);
153 152 switch (saddr) {
154 153 case IOMMU_CTRL:
... ... @@ -358,7 +357,6 @@ void *iommu_init(target_phys_addr_t addr, uint32_t version, qemu_irq irq)
358 357 if (!s)
359 358 return NULL;
360 359  
361   - s->addr = addr;
362 360 s->version = version;
363 361 s->irq = irq;
364 362  
... ...
hw/jazz_led.c
... ... @@ -34,7 +34,6 @@ typedef enum {
34 34 } screen_state_t;
35 35  
36 36 typedef struct LedState {
37   - target_phys_addr_t base;
38 37 uint8_t segments;
39 38 DisplayState *ds;
40 39 QEMUConsole *console;
... ... @@ -44,10 +43,9 @@ typedef struct LedState {
44 43 static uint32_t led_readb(void *opaque, target_phys_addr_t addr)
45 44 {
46 45 LedState *s = opaque;
47   - int relative_addr = addr - s->base;
48 46 uint32_t val;
49 47  
50   - switch (relative_addr) {
  48 + switch (addr) {
51 49 case 0:
52 50 val = s->segments;
53 51 break;
... ... @@ -94,9 +92,8 @@ static uint32_t led_readl(void *opaque, target_phys_addr_t addr)
94 92 static void led_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
95 93 {
96 94 LedState *s = opaque;
97   - int relative_addr = addr - s->base;
98 95  
99   - switch (relative_addr) {
  96 + switch (addr) {
100 97 case 0:
101 98 s->segments = val;
102 99 s->state |= REDRAW_SEGMENTS;
... ... @@ -311,12 +308,11 @@ void jazz_led_init(DisplayState *ds, target_phys_addr_t base)
311 308 if (!s)
312 309 return;
313 310  
314   - s->base = base;
315 311 s->ds = ds;
316 312 s->state = REDRAW_SEGMENTS | REDRAW_BACKGROUND;
317 313  
318 314 io = cpu_register_io_memory(0, led_read, led_write, s);
319   - cpu_register_physical_memory(s->base, 1, io);
  315 + cpu_register_physical_memory(base, 1, io);
320 316  
321 317 s->console = graphic_console_init(ds, jazz_led_update_display,
322 318 jazz_led_invalidate_display,
... ...
hw/m48t59.c
... ... @@ -46,7 +46,6 @@ struct m48t59_t {
46 46 /* Hardware parameters */
47 47 qemu_irq IRQ;
48 48 int mem_index;
49   - target_phys_addr_t mem_base;
50 49 uint32_t io_base;
51 50 uint16_t size;
52 51 /* RTC management */
... ... @@ -514,7 +513,6 @@ static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)
514 513 {
515 514 m48t59_t *NVRAM = opaque;
516 515  
517   - addr -= NVRAM->mem_base;
518 516 m48t59_write(NVRAM, addr, value & 0xff);
519 517 }
520 518  
... ... @@ -522,7 +520,6 @@ static void nvram_writew (void *opaque, target_phys_addr_t addr, uint32_t value)
522 520 {
523 521 m48t59_t *NVRAM = opaque;
524 522  
525   - addr -= NVRAM->mem_base;
526 523 m48t59_write(NVRAM, addr, (value >> 8) & 0xff);
527 524 m48t59_write(NVRAM, addr + 1, value & 0xff);
528 525 }
... ... @@ -531,7 +528,6 @@ static void nvram_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
531 528 {
532 529 m48t59_t *NVRAM = opaque;
533 530  
534   - addr -= NVRAM->mem_base;
535 531 m48t59_write(NVRAM, addr, (value >> 24) & 0xff);
536 532 m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff);
537 533 m48t59_write(NVRAM, addr + 2, (value >> 8) & 0xff);
... ... @@ -543,7 +539,6 @@ static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr)
543 539 m48t59_t *NVRAM = opaque;
544 540 uint32_t retval;
545 541  
546   - addr -= NVRAM->mem_base;
547 542 retval = m48t59_read(NVRAM, addr);
548 543 return retval;
549 544 }
... ... @@ -553,7 +548,6 @@ static uint32_t nvram_readw (void *opaque, target_phys_addr_t addr)
553 548 m48t59_t *NVRAM = opaque;
554 549 uint32_t retval;
555 550  
556   - addr -= NVRAM->mem_base;
557 551 retval = m48t59_read(NVRAM, addr) << 8;
558 552 retval |= m48t59_read(NVRAM, addr + 1);
559 553 return retval;
... ... @@ -564,7 +558,6 @@ static uint32_t nvram_readl (void *opaque, target_phys_addr_t addr)
564 558 m48t59_t *NVRAM = opaque;
565 559 uint32_t retval;
566 560  
567   - addr -= NVRAM->mem_base;
568 561 retval = m48t59_read(NVRAM, addr) << 24;
569 562 retval |= m48t59_read(NVRAM, addr + 1) << 16;
570 563 retval |= m48t59_read(NVRAM, addr + 2) << 8;
... ... @@ -636,7 +629,6 @@ m48t59_t *m48t59_init (qemu_irq IRQ, target_phys_addr_t mem_base,
636 629 }
637 630 s->IRQ = IRQ;
638 631 s->size = size;
639   - s->mem_base = mem_base;
640 632 s->io_base = io_base;
641 633 s->addr = 0;
642 634 s->type = type;
... ...
hw/mac_nvram.c
... ... @@ -26,7 +26,6 @@
26 26 #include "ppc_mac.h"
27 27  
28 28 struct MacIONVRAMState {
29   - target_phys_addr_t mem_base;
30 29 target_phys_addr_t size;
31 30 int mem_index;
32 31 uint8_t data[0x2000];
... ... @@ -62,7 +61,6 @@ static void macio_nvram_writeb (void *opaque,
62 61 {
63 62 MacIONVRAMState *s = opaque;
64 63  
65   - addr -= s->mem_base;
66 64 addr = (addr >> 4) & 0x1fff;
67 65 s->data[addr] = value;
68 66 // printf("macio_nvram_writeb %04x = %02x\n", addr, value);
... ... @@ -73,7 +71,6 @@ static uint32_t macio_nvram_readb (void *opaque, target_phys_addr_t addr)
73 71 MacIONVRAMState *s = opaque;
74 72 uint32_t value;
75 73  
76   - addr -= s->mem_base;
77 74 addr = (addr >> 4) & 0x1fff;
78 75 value = s->data[addr];
79 76 // printf("macio_nvram_readb %04x = %02x\n", addr, value);
... ... @@ -112,7 +109,6 @@ void macio_nvram_map (void *opaque, target_phys_addr_t mem_base)
112 109 MacIONVRAMState *s;
113 110  
114 111 s = opaque;
115   - s->mem_base = mem_base;
116 112 cpu_register_physical_memory(mem_base, s->size, s->mem_index);
117 113 }
118 114  
... ...
hw/mc146818rtc.c
... ... @@ -59,7 +59,6 @@ struct RTCState {
59 59 uint8_t cmos_index;
60 60 struct tm current_tm;
61 61 qemu_irq irq;
62   - target_phys_addr_t base;
63 62 int it_shift;
64 63 /* periodic timer */
65 64 QEMUTimer *periodic_timer;
... ... @@ -492,7 +491,7 @@ static uint32_t cmos_mm_readb (void *opaque, target_phys_addr_t addr)
492 491 {
493 492 RTCState *s = opaque;
494 493  
495   - return cmos_ioport_read(s, (addr - s->base) >> s->it_shift) & 0xFF;
  494 + return cmos_ioport_read(s, addr >> s->it_shift) & 0xFF;
496 495 }
497 496  
498 497 static void cmos_mm_writeb (void *opaque,
... ... @@ -500,7 +499,7 @@ static void cmos_mm_writeb (void *opaque,
500 499 {
501 500 RTCState *s = opaque;
502 501  
503   - cmos_ioport_write(s, (addr - s->base) >> s->it_shift, value & 0xFF);
  502 + cmos_ioport_write(s, addr >> s->it_shift, value & 0xFF);
504 503 }
505 504  
506 505 static uint32_t cmos_mm_readw (void *opaque, target_phys_addr_t addr)
... ... @@ -508,7 +507,7 @@ static uint32_t cmos_mm_readw (void *opaque, target_phys_addr_t addr)
508 507 RTCState *s = opaque;
509 508 uint32_t val;
510 509  
511   - val = cmos_ioport_read(s, (addr - s->base) >> s->it_shift) & 0xFFFF;
  510 + val = cmos_ioport_read(s, addr >> s->it_shift) & 0xFFFF;
512 511 #ifdef TARGET_WORDS_BIGENDIAN
513 512 val = bswap16(val);
514 513 #endif
... ... @@ -522,7 +521,7 @@ static void cmos_mm_writew (void *opaque,
522 521 #ifdef TARGET_WORDS_BIGENDIAN
523 522 value = bswap16(value);
524 523 #endif
525   - cmos_ioport_write(s, (addr - s->base) >> s->it_shift, value & 0xFFFF);
  524 + cmos_ioport_write(s, addr >> s->it_shift, value & 0xFFFF);
526 525 }
527 526  
528 527 static uint32_t cmos_mm_readl (void *opaque, target_phys_addr_t addr)
... ... @@ -530,7 +529,7 @@ static uint32_t cmos_mm_readl (void *opaque, target_phys_addr_t addr)
530 529 RTCState *s = opaque;
531 530 uint32_t val;
532 531  
533   - val = cmos_ioport_read(s, (addr - s->base) >> s->it_shift);
  532 + val = cmos_ioport_read(s, addr >> s->it_shift);
534 533 #ifdef TARGET_WORDS_BIGENDIAN
535 534 val = bswap32(val);
536 535 #endif
... ... @@ -544,7 +543,7 @@ static void cmos_mm_writel (void *opaque,
544 543 #ifdef TARGET_WORDS_BIGENDIAN
545 544 value = bswap32(value);
546 545 #endif
547   - cmos_ioport_write(s, (addr - s->base) >> s->it_shift, value);
  546 + cmos_ioport_write(s, addr >> s->it_shift, value);
548 547 }
549 548  
550 549 static CPUReadMemoryFunc *rtc_mm_read[] = {
... ... @@ -573,7 +572,6 @@ RTCState *rtc_mm_init(target_phys_addr_t base, int it_shift, qemu_irq irq)
573 572 s->cmos_data[RTC_REG_B] = 0x02;
574 573 s->cmos_data[RTC_REG_C] = 0x00;
575 574 s->cmos_data[RTC_REG_D] = 0x80;
576   - s->base = base;
577 575  
578 576 rtc_set_date_from_host(s);
579 577  
... ...
hw/mcf5208.c
... ... @@ -40,9 +40,10 @@ static void m5208_timer_update(m5208_timer_state *s)
40 40 qemu_irq_lower(s->irq);
41 41 }
42 42  
43   -static void m5208_timer_write(m5208_timer_state *s, int offset,
  43 +static void m5208_timer_write(void *opaque, target_phys_addr_t offset,
44 44 uint32_t value)
45 45 {
  46 + m5208_timer_state *s = (m5208_timer_state *)opaque;
46 47 int prescale;
47 48 int limit;
48 49 switch (offset) {
... ... @@ -88,8 +89,9 @@ static void m5208_timer_write(m5208_timer_state *s, int offset,
88 89 case 4:
89 90 break;
90 91 default:
91   - /* Should never happen. */
92   - abort();
  92 + cpu_abort(cpu_single_env, "m5208_timer_write: Bad offset 0x%x\n",
  93 + (int)offset);
  94 + break;
93 95 }
94 96 m5208_timer_update(s);
95 97 }
... ... @@ -101,31 +103,39 @@ static void m5208_timer_trigger(void *opaque)
101 103 m5208_timer_update(s);
102 104 }
103 105  
104   -typedef struct {
105   - m5208_timer_state timer[2];
106   -} m5208_sys_state;
  106 +static uint32_t m5208_timer_read(void *opaque, target_phys_addr_t addr)
  107 +{
  108 + m5208_timer_state *s = (m5208_timer_state *)opaque;
  109 + switch (addr) {
  110 + case 0:
  111 + return s->pcsr;
  112 + case 2:
  113 + return s->pmr;
  114 + case 4:
  115 + return ptimer_get_count(s->timer);
  116 + default:
  117 + cpu_abort(cpu_single_env, "m5208_timer_read: Bad offset 0x%x\n",
  118 + (int)addr);
  119 + return 0;
  120 + }
  121 +}
  122 +
  123 +static CPUReadMemoryFunc *m5208_timer_readfn[] = {
  124 + m5208_timer_read,
  125 + m5208_timer_read,
  126 + m5208_timer_read
  127 +};
  128 +
  129 +static CPUWriteMemoryFunc *m5208_timer_writefn[] = {
  130 + m5208_timer_write,
  131 + m5208_timer_write,
  132 + m5208_timer_write
  133 +};
107 134  
108 135 static uint32_t m5208_sys_read(void *opaque, target_phys_addr_t addr)
109 136 {
110   - m5208_sys_state *s = (m5208_sys_state *)opaque;
111 137 switch (addr) {
112   - /* PIT0 */
113   - case 0xfc080000:
114   - return s->timer[0].pcsr;
115   - case 0xfc080002:
116   - return s->timer[0].pmr;
117   - case 0xfc080004:
118   - return ptimer_get_count(s->timer[0].timer);
119   - /* PIT1 */
120   - case 0xfc084000:
121   - return s->timer[1].pcsr;
122   - case 0xfc084002:
123   - return s->timer[1].pmr;
124   - case 0xfc084004:
125   - return ptimer_get_count(s->timer[1].timer);
126   -
127   - /* SDRAM Controller. */
128   - case 0xfc0a8110: /* SDCS0 */
  138 + case 0x110: /* SDCS0 */
129 139 {
130 140 int n;
131 141 for (n = 0; n < 32; n++) {
... ... @@ -134,7 +144,7 @@ static uint32_t m5208_sys_read(void *opaque, target_phys_addr_t addr)
134 144 }
135 145 return (n - 1) | 0x40000000;
136 146 }
137   - case 0xfc0a8114: /* SDCS1 */
  147 + case 0x114: /* SDCS1 */
138 148 return 0;
139 149  
140 150 default:
... ... @@ -147,25 +157,8 @@ static uint32_t m5208_sys_read(void *opaque, target_phys_addr_t addr)
147 157 static void m5208_sys_write(void *opaque, target_phys_addr_t addr,
148 158 uint32_t value)
149 159 {
150   - m5208_sys_state *s = (m5208_sys_state *)opaque;
151   - switch (addr) {
152   - /* PIT0 */
153   - case 0xfc080000:
154   - case 0xfc080002:
155   - case 0xfc080004:
156   - m5208_timer_write(&s->timer[0], addr & 0xf, value);
157   - return;
158   - /* PIT1 */
159   - case 0xfc084000:
160   - case 0xfc084002:
161   - case 0xfc084004:
162   - m5208_timer_write(&s->timer[1], addr & 0xf, value);
163   - return;
164   - default:
165   - cpu_abort(cpu_single_env, "m5208_sys_write: Bad offset 0x%x\n",
166   - (int)addr);
167   - break;
168   - }
  160 + cpu_abort(cpu_single_env, "m5208_sys_write: Bad offset 0x%x\n",
  161 + (int)addr);
169 162 }
170 163  
171 164 static CPUReadMemoryFunc *m5208_sys_readfn[] = {
... ... @@ -183,22 +176,24 @@ static CPUWriteMemoryFunc *m5208_sys_writefn[] = {
183 176 static void mcf5208_sys_init(qemu_irq *pic)
184 177 {
185 178 int iomemtype;
186   - m5208_sys_state *s;
  179 + m5208_timer_state *s;
187 180 QEMUBH *bh;
188 181 int i;
189 182  
190   - s = (m5208_sys_state *)qemu_mallocz(sizeof(m5208_sys_state));
191 183 iomemtype = cpu_register_io_memory(0, m5208_sys_readfn,
192   - m5208_sys_writefn, s);
  184 + m5208_sys_writefn, NULL);
193 185 /* SDRAMC. */
194 186 cpu_register_physical_memory(0xfc0a8000, 0x00004000, iomemtype);
195 187 /* Timers. */
196 188 for (i = 0; i < 2; i++) {
197   - bh = qemu_bh_new(m5208_timer_trigger, &s->timer[i]);
198   - s->timer[i].timer = ptimer_init(bh);
  189 + s = (m5208_timer_state *)qemu_mallocz(sizeof(m5208_timer_state));
  190 + bh = qemu_bh_new(m5208_timer_trigger, s);
  191 + s->timer = ptimer_init(bh);
  192 + iomemtype = cpu_register_io_memory(0, m5208_timer_readfn,
  193 + m5208_timer_writefn, s);
199 194 cpu_register_physical_memory(0xfc080000 + 0x4000 * i, 0x00004000,
200 195 iomemtype);
201   - s->timer[i].irq = pic[4 + i];
  196 + s->irq = pic[4 + i];
202 197 }
203 198 }
204 199  
... ...
hw/mips_malta.c
... ... @@ -433,6 +433,7 @@ static MaltaFPGAState *malta_fpga_init(target_phys_addr_t base, CPUState *env)
433 433 malta_fpga_write, s);
434 434  
435 435 cpu_register_physical_memory(base, 0x900, malta);
  436 + /* 0xa00 is less than a page, so will still get the right offsets. */
436 437 cpu_register_physical_memory(base + 0xa00, 0x100000 - 0xa00, malta);
437 438  
438 439 s->display = qemu_chr_open("fpga", "vc:320x200");
... ...
hw/mpcore.c
... ... @@ -265,7 +265,7 @@ static qemu_irq *mpcore_priv_init(uint32_t base, qemu_irq *pic_irq)
265 265 s = (mpcore_priv_state *)qemu_mallocz(sizeof(mpcore_priv_state));
266 266 if (!s)
267 267 return NULL;
268   - s->gic = gic_init(base, pic_irq);
  268 + s->gic = gic_init(base + 0x1000, pic_irq);
269 269 if (!s->gic)
270 270 return NULL;
271 271 iomemtype = cpu_register_io_memory(0, mpcore_priv_readfn,
... ...
hw/mst_fpga.c
... ... @@ -14,7 +14,6 @@
14 14 /* Mainstone FPGA for extern irqs */
15 15 #define FPGA_GPIO_PIN 0
16 16 #define MST_NUM_IRQS 16
17   -#define MST_BASE MST_FPGA_PHYS
18 17 #define MST_LEDDAT1 0x10
19 18 #define MST_LEDDAT2 0x14
20 19 #define MST_LEDCTRL 0x40
... ... @@ -29,7 +28,6 @@
29 28 #define MST_PCMCIA1 0xe4
30 29  
31 30 typedef struct mst_irq_state{
32   - target_phys_addr_t target_base;
33 31 qemu_irq *parent;
34 32 qemu_irq *pins;
35 33  
... ... @@ -83,7 +81,6 @@ static uint32_t
83 81 mst_fpga_readb(void *opaque, target_phys_addr_t addr)
84 82 {
85 83 mst_irq_state *s = (mst_irq_state *) opaque;
86   - addr -= s->target_base;
87 84  
88 85 switch (addr) {
89 86 case MST_LEDDAT1:
... ... @@ -121,7 +118,6 @@ static void
121 118 mst_fpga_writeb(void *opaque, target_phys_addr_t addr, uint32_t value)
122 119 {
123 120 mst_irq_state *s = (mst_irq_state *) opaque;
124   - addr -= s->target_base;
125 121 value &= 0xffffffff;
126 122  
127 123 switch (addr) {
... ... @@ -231,7 +227,6 @@ qemu_irq *mst_irq_init(struct pxa2xx_state_s *cpu, uint32_t base, int irq)
231 227  
232 228 if (!s)
233 229 return NULL;
234   - s->target_base = base;
235 230 s->parent = &cpu->pic[irq];
236 231  
237 232 /* alloc the external 16 irqs */
... ... @@ -240,7 +235,7 @@ qemu_irq *mst_irq_init(struct pxa2xx_state_s *cpu, uint32_t base, int irq)
240 235  
241 236 iomemtype = cpu_register_io_memory(0, mst_fpga_readfn,
242 237 mst_fpga_writefn, s);
243   - cpu_register_physical_memory(MST_BASE, 0x00100000, iomemtype);
  238 + cpu_register_physical_memory(base, 0x00100000, iomemtype);
244 239 register_savevm("mainstone_fpga", 0, 0, mst_fpga_save, mst_fpga_load, s);
245 240 return qi;
246 241 }
... ...
hw/musicpal.c
... ... @@ -239,7 +239,6 @@ static i2c_interface *mixer_i2c;
239 239 static const char audio_name[] = "mv88w8618";
240 240  
241 241 typedef struct musicpal_audio_state {
242   - uint32_t base;
243 242 qemu_irq irq;
244 243 uint32_t playback_mode;
245 244 uint32_t status;
... ... @@ -334,7 +333,6 @@ static uint32_t musicpal_audio_read(void *opaque, target_phys_addr_t offset)
334 333 {
335 334 musicpal_audio_state *s = opaque;
336 335  
337   - offset -= s->base;
338 336 switch (offset) {
339 337 case MP_AUDIO_PLAYBACK_MODE:
340 338 return s->playback_mode;
... ... @@ -361,7 +359,6 @@ static void musicpal_audio_write(void *opaque, target_phys_addr_t offset,
361 359 {
362 360 musicpal_audio_state *s = opaque;
363 361  
364   - offset -= s->base;
365 362 switch (offset) {
366 363 case MP_AUDIO_PLAYBACK_MODE:
367 364 if (value & MP_AUDIO_PLAYBACK_EN &&
... ... @@ -448,7 +445,6 @@ static i2c_interface *musicpal_audio_init(uint32_t base, qemu_irq irq)
448 445 s = qemu_mallocz(sizeof(musicpal_audio_state));
449 446 if (!s)
450 447 return NULL;
451   - s->base = base;
452 448 s->irq = irq;
453 449  
454 450 i2c = qemu_mallocz(sizeof(i2c_interface));
... ... @@ -549,7 +545,6 @@ typedef struct mv88w8618_rx_desc {
549 545 } mv88w8618_rx_desc;
550 546  
551 547 typedef struct mv88w8618_eth_state {
552   - uint32_t base;
553 548 qemu_irq irq;
554 549 uint32_t smir;
555 550 uint32_t icr;
... ... @@ -617,7 +612,6 @@ static uint32_t mv88w8618_eth_read(void *opaque, target_phys_addr_t offset)
617 612 {
618 613 mv88w8618_eth_state *s = opaque;
619 614  
620   - offset -= s->base;
621 615 switch (offset) {
622 616 case MP_ETH_SMIR:
623 617 if (s->smir & MP_ETH_SMIR_OPCODE) {
... ... @@ -660,7 +654,6 @@ static void mv88w8618_eth_write(void *opaque, target_phys_addr_t offset,
660 654 {
661 655 mv88w8618_eth_state *s = opaque;
662 656  
663   - offset -= s->base;
664 657 switch (offset) {
665 658 case MP_ETH_SMIR:
666 659 s->smir = value;
... ... @@ -724,7 +717,6 @@ static void mv88w8618_eth_init(NICInfo *nd, uint32_t base, qemu_irq irq)
724 717 s = qemu_mallocz(sizeof(mv88w8618_eth_state));
725 718 if (!s)
726 719 return;
727   - s->base = base;
728 720 s->irq = irq;
729 721 s->vc = qemu_new_vlan_client(nd->vlan, eth_receive, eth_can_receive, s);
730 722 iomemtype = cpu_register_io_memory(0, mv88w8618_eth_readfn,
... ... @@ -752,7 +744,6 @@ static void mv88w8618_eth_init(NICInfo *nd, uint32_t base, qemu_irq irq)
752 744 #define MP_LCD_TEXTCOLOR 0xe0e0ff /* RRGGBB */
753 745  
754 746 typedef struct musicpal_lcd_state {
755   - uint32_t base;
756 747 uint32_t mode;
757 748 uint32_t irqctrl;
758 749 int page;
... ... @@ -852,7 +843,6 @@ static uint32_t musicpal_lcd_read(void *opaque, target_phys_addr_t offset)
852 843 {
853 844 musicpal_lcd_state *s = opaque;
854 845  
855   - offset -= s->base;
856 846 switch (offset) {
857 847 case MP_LCD_IRQCTRL:
858 848 return s->irqctrl;
... ... @@ -867,7 +857,6 @@ static void musicpal_lcd_write(void *opaque, target_phys_addr_t offset,
867 857 {
868 858 musicpal_lcd_state *s = opaque;
869 859  
870   - offset -= s->base;
871 860 switch (offset) {
872 861 case MP_LCD_IRQCTRL:
873 862 s->irqctrl = value;
... ... @@ -922,7 +911,6 @@ static void musicpal_lcd_init(DisplayState *ds, uint32_t base)
922 911 s = qemu_mallocz(sizeof(musicpal_lcd_state));
923 912 if (!s)
924 913 return;
925   - s->base = base;
926 914 s->ds = ds;
927 915 iomemtype = cpu_register_io_memory(0, musicpal_lcd_readfn,
928 916 musicpal_lcd_writefn, s);
... ... @@ -940,7 +928,6 @@ static void musicpal_lcd_init(DisplayState *ds, uint32_t base)
940 928  
941 929 typedef struct mv88w8618_pic_state
942 930 {
943   - uint32_t base;
944 931 uint32_t level;
945 932 uint32_t enabled;
946 933 qemu_irq parent_irq;
... ... @@ -966,7 +953,6 @@ static uint32_t mv88w8618_pic_read(void *opaque, target_phys_addr_t offset)
966 953 {
967 954 mv88w8618_pic_state *s = opaque;
968 955  
969   - offset -= s->base;
970 956 switch (offset) {
971 957 case MP_PIC_STATUS:
972 958 return s->level & s->enabled;
... ... @@ -981,7 +967,6 @@ static void mv88w8618_pic_write(void *opaque, target_phys_addr_t offset,
981 967 {
982 968 mv88w8618_pic_state *s = opaque;
983 969  
984   - offset -= s->base;
985 970 switch (offset) {
986 971 case MP_PIC_ENABLE_SET:
987 972 s->enabled |= value;
... ... @@ -1025,7 +1010,6 @@ static qemu_irq *mv88w8618_pic_init(uint32_t base, qemu_irq parent_irq)
1025 1010 if (!s)
1026 1011 return NULL;
1027 1012 qi = qemu_allocate_irqs(mv88w8618_pic_set_irq, s, 32);
1028   - s->base = base;
1029 1013 s->parent_irq = parent_irq;
1030 1014 iomemtype = cpu_register_io_memory(0, mv88w8618_pic_readfn,
1031 1015 mv88w8618_pic_writefn, s);
... ... @@ -1059,7 +1043,6 @@ typedef struct mv88w8618_timer_state {
1059 1043 typedef struct mv88w8618_pit_state {
1060 1044 void *timer[4];
1061 1045 uint32_t control;
1062   - uint32_t base;
1063 1046 } mv88w8618_pit_state;
1064 1047  
1065 1048 static void mv88w8618_timer_tick(void *opaque)
... ... @@ -1089,7 +1072,6 @@ static uint32_t mv88w8618_pit_read(void *opaque, target_phys_addr_t offset)
1089 1072 mv88w8618_pit_state *s = opaque;
1090 1073 mv88w8618_timer_state *t;
1091 1074  
1092   - offset -= s->base;
1093 1075 switch (offset) {
1094 1076 case MP_PIT_TIMER1_VALUE ... MP_PIT_TIMER4_VALUE:
1095 1077 t = s->timer[(offset-MP_PIT_TIMER1_VALUE) >> 2];
... ... @@ -1107,7 +1089,6 @@ static void mv88w8618_pit_write(void *opaque, target_phys_addr_t offset,
1107 1089 mv88w8618_timer_state *t;
1108 1090 int i;
1109 1091  
1110   - offset -= s->base;
1111 1092 switch (offset) {
1112 1093 case MP_PIT_TIMER1_LENGTH ... MP_PIT_TIMER4_LENGTH:
1113 1094 t = s->timer[offset >> 2];
... ... @@ -1155,7 +1136,6 @@ static void mv88w8618_pit_init(uint32_t base, qemu_irq *pic, int irq)
1155 1136 if (!s)
1156 1137 return;
1157 1138  
1158   - s->base = base;
1159 1139 /* Letting them all run at 1 MHz is likely just a pragmatic
1160 1140 * simplification. */
1161 1141 s->timer[0] = mv88w8618_timer_init(1000000, pic[irq]);
... ... @@ -1172,7 +1152,6 @@ static void mv88w8618_pit_init(uint32_t base, qemu_irq *pic, int irq)
1172 1152 #define MP_FLASHCFG_CFGR0 0x04
1173 1153  
1174 1154 typedef struct mv88w8618_flashcfg_state {
1175   - uint32_t base;
1176 1155 uint32_t cfgr0;
1177 1156 } mv88w8618_flashcfg_state;
1178 1157  
... ... @@ -1181,7 +1160,6 @@ static uint32_t mv88w8618_flashcfg_read(void *opaque,
1181 1160 {
1182 1161 mv88w8618_flashcfg_state *s = opaque;
1183 1162  
1184   - offset -= s->base;
1185 1163 switch (offset) {
1186 1164 case MP_FLASHCFG_CFGR0:
1187 1165 return s->cfgr0;
... ... @@ -1196,7 +1174,6 @@ static void mv88w8618_flashcfg_write(void *opaque, target_phys_addr_t offset,
1196 1174 {
1197 1175 mv88w8618_flashcfg_state *s = opaque;
1198 1176  
1199   - offset -= s->base;
1200 1177 switch (offset) {
1201 1178 case MP_FLASHCFG_CFGR0:
1202 1179 s->cfgr0 = value;
... ... @@ -1225,7 +1202,6 @@ static void mv88w8618_flashcfg_init(uint32_t base)
1225 1202 if (!s)
1226 1203 return;
1227 1204  
1228   - s->base = base;
1229 1205 s->cfgr0 = 0xfffe4285; /* Default as set by U-Boot for 8 MB flash */
1230 1206 iomemtype = cpu_register_io_memory(0, mv88w8618_flashcfg_readfn,
1231 1207 mv88w8618_flashcfg_writefn, s);
... ... @@ -1266,7 +1242,6 @@ static void mv88w8618_flashcfg_init(uint32_t base)
1266 1242  
1267 1243 static uint32_t musicpal_read(void *opaque, target_phys_addr_t offset)
1268 1244 {
1269   - offset -= 0x80000000;
1270 1245 switch (offset) {
1271 1246 case MP_BOARD_REVISION:
1272 1247 return 0x0031;
... ... @@ -1307,7 +1282,6 @@ static uint32_t musicpal_read(void *opaque, target_phys_addr_t offset)
1307 1282 static void musicpal_write(void *opaque, target_phys_addr_t offset,
1308 1283 uint32_t value)
1309 1284 {
1310   - offset -= 0x80000000;
1311 1285 switch (offset) {
1312 1286 case MP_GPIO_OE_HI: /* used for LCD brightness control */
1313 1287 lcd_brightness = (lcd_brightness & MP_GPIO_LCD_BRIGHTNESS) |
... ...
hw/omap.h
... ... @@ -890,11 +890,9 @@ struct omap_mpu_state_s {
890 890  
891 891 struct omap_lcd_panel_s *lcd;
892 892  
893   - target_phys_addr_t ulpd_pm_base;
894 893 uint32_t ulpd_pm_regs[21];
895 894 int64_t ulpd_gauge_start;
896 895  
897   - target_phys_addr_t pin_cfg_base;
898 896 uint32_t func_mux_ctrl[14];
899 897 uint32_t comp_mode_ctrl[1];
900 898 uint32_t pull_dwn_ctrl[4];
... ... @@ -905,25 +903,19 @@ struct omap_mpu_state_s {
905 903 int compat1509;
906 904  
907 905 uint32_t mpui_ctrl;
908   - target_phys_addr_t mpui_base;
909 906  
910 907 struct omap_tipb_bridge_s *private_tipb;
911 908 struct omap_tipb_bridge_s *public_tipb;
912 909  
913   - target_phys_addr_t tcmi_base;
914 910 uint32_t tcmi_regs[17];
915 911  
916 912 struct dpll_ctl_s {
917   - target_phys_addr_t base;
918 913 uint16_t mode;
919 914 omap_clk dpll;
920 915 } dpll[3];
921 916  
922 917 omap_clk clks;
923 918 struct {
924   - target_phys_addr_t mpu_base;
925   - target_phys_addr_t dsp_base;
926   -
927 919 int cold_start;
928 920 int clocking_scheme;
929 921 uint16_t arm_ckctl;
... ... @@ -944,10 +936,7 @@ struct omap_mpu_state_s {
944 936  
945 937 struct omap_gp_timer_s *gptimer[12];
946 938  
947   - target_phys_addr_t tap_base;
948   -
949 939 struct omap_synctimer_s {
950   - target_phys_addr_t base;
951 940 uint32_t val;
952 941 uint16_t readh;
953 942 } synctimer;
... ...
hw/omap1.c
... ... @@ -95,7 +95,6 @@ struct omap_intr_handler_bank_s {
95 95 struct omap_intr_handler_s {
96 96 qemu_irq *pins;
97 97 qemu_irq parent_intr[2];
98   - target_phys_addr_t base;
99 98 unsigned char nbanks;
100 99 int level_only;
101 100  
... ... @@ -202,7 +201,7 @@ static void omap_set_intr_noedge(void *opaque, int irq, int req)
202 201 static uint32_t omap_inth_read(void *opaque, target_phys_addr_t addr)
203 202 {
204 203 struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
205   - int i, offset = addr - s->base;
  204 + int i, offset = addr;
206 205 int bank_no = offset >> 8;
207 206 int line_no;
208 207 struct omap_intr_handler_bank_s *bank = &s->bank[bank_no];
... ... @@ -280,7 +279,7 @@ static void omap_inth_write(void *opaque, target_phys_addr_t addr,
280 279 uint32_t value)
281 280 {
282 281 struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
283   - int i, offset = addr - s->base;
  282 + int i, offset = addr;
284 283 int bank_no = offset >> 8;
285 284 struct omap_intr_handler_bank_s *bank = &s->bank[bank_no];
286 285 offset &= 0xff;
... ... @@ -420,7 +419,6 @@ struct omap_intr_handler_s *omap_inth_init(target_phys_addr_t base,
420 419  
421 420 s->parent_intr[0] = parent_irq;
422 421 s->parent_intr[1] = parent_fiq;
423   - s->base = base;
424 422 s->nbanks = nbanks;
425 423 s->pins = qemu_allocate_irqs(omap_set_intr, s, nbanks * 32);
426 424 if (pins)
... ... @@ -430,7 +428,7 @@ struct omap_intr_handler_s *omap_inth_init(target_phys_addr_t base,
430 428  
431 429 iomemtype = cpu_register_io_memory(0, omap_inth_readfn,
432 430 omap_inth_writefn, s);
433   - cpu_register_physical_memory(s->base, size, iomemtype);
  431 + cpu_register_physical_memory(base, size, iomemtype);
434 432  
435 433 return s;
436 434 }
... ... @@ -438,7 +436,7 @@ struct omap_intr_handler_s *omap_inth_init(target_phys_addr_t base,
438 436 static uint32_t omap2_inth_read(void *opaque, target_phys_addr_t addr)
439 437 {
440 438 struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
441   - int offset = addr - s->base;
  439 + int offset = addr;
442 440 int bank_no, line_no;
443 441 struct omap_intr_handler_bank_s *bank = 0;
444 442  
... ... @@ -516,7 +514,7 @@ static void omap2_inth_write(void *opaque, target_phys_addr_t addr,
516 514 uint32_t value)
517 515 {
518 516 struct omap_intr_handler_s *s = (struct omap_intr_handler_s *) opaque;
519   - int offset = addr - s->base;
  517 + int offset = addr;
520 518 int bank_no, line_no;
521 519 struct omap_intr_handler_bank_s *bank = 0;
522 520  
... ... @@ -640,7 +638,6 @@ struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,
640 638  
641 639 s->parent_intr[0] = parent_irq;
642 640 s->parent_intr[1] = parent_fiq;
643   - s->base = base;
644 641 s->nbanks = nbanks;
645 642 s->level_only = 1;
646 643 s->pins = qemu_allocate_irqs(omap_set_intr_noedge, s, nbanks * 32);
... ... @@ -651,7 +648,7 @@ struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,
651 648  
652 649 iomemtype = cpu_register_io_memory(0, omap2_inth_readfn,
653 650 omap2_inth_writefn, s);
654   - cpu_register_physical_memory(s->base, size, iomemtype);
  651 + cpu_register_physical_memory(base, size, iomemtype);
655 652  
656 653 return s;
657 654 }
... ... @@ -660,7 +657,6 @@ struct omap_intr_handler_s *omap2_inth_init(target_phys_addr_t base,
660 657 struct omap_mpu_timer_s {
661 658 qemu_irq irq;
662 659 omap_clk clk;
663   - target_phys_addr_t base;
664 660 uint32_t val;
665 661 int64_t time;
666 662 QEMUTimer *timer;
... ... @@ -757,9 +753,8 @@ static void omap_timer_clk_setup(struct omap_mpu_timer_s *timer)
757 753 static uint32_t omap_mpu_timer_read(void *opaque, target_phys_addr_t addr)
758 754 {
759 755 struct omap_mpu_timer_s *s = (struct omap_mpu_timer_s *) opaque;
760   - int offset = addr - s->base;
761 756  
762   - switch (offset) {
  757 + switch (addr) {
763 758 case 0x00: /* CNTL_TIMER */
764 759 return (s->enable << 5) | (s->ptv << 2) | (s->ar << 1) | s->st;
765 760  
... ... @@ -778,9 +773,8 @@ static void omap_mpu_timer_write(void *opaque, target_phys_addr_t addr,
778 773 uint32_t value)
779 774 {
780 775 struct omap_mpu_timer_s *s = (struct omap_mpu_timer_s *) opaque;
781   - int offset = addr - s->base;
782 776  
783   - switch (offset) {
  777 + switch (addr) {
784 778 case 0x00: /* CNTL_TIMER */
785 779 omap_timer_sync(s);
786 780 s->enable = (value >> 5) & 1;
... ... @@ -836,7 +830,6 @@ struct omap_mpu_timer_s *omap_mpu_timer_init(target_phys_addr_t base,
836 830  
837 831 s->irq = irq;
838 832 s->clk = clk;
839   - s->base = base;
840 833 s->timer = qemu_new_timer(vm_clock, omap_timer_tick, s);
841 834 s->tick = qemu_bh_new(omap_timer_fire, s);
842 835 omap_mpu_timer_reset(s);
... ... @@ -844,7 +837,7 @@ struct omap_mpu_timer_s *omap_mpu_timer_init(target_phys_addr_t base,
844 837  
845 838 iomemtype = cpu_register_io_memory(0, omap_mpu_timer_readfn,
846 839 omap_mpu_timer_writefn, s);
847   - cpu_register_physical_memory(s->base, 0x100, iomemtype);
  840 + cpu_register_physical_memory(base, 0x100, iomemtype);
848 841  
849 842 return s;
850 843 }
... ... @@ -861,9 +854,8 @@ struct omap_watchdog_timer_s {
861 854 static uint32_t omap_wd_timer_read(void *opaque, target_phys_addr_t addr)
862 855 {
863 856 struct omap_watchdog_timer_s *s = (struct omap_watchdog_timer_s *) opaque;
864   - int offset = addr - s->timer.base;
865 857  
866   - switch (offset) {
  858 + switch (addr) {
867 859 case 0x00: /* CNTL_TIMER */
868 860 return (s->timer.ptv << 9) | (s->timer.ar << 8) |
869 861 (s->timer.st << 7) | (s->free << 1);
... ... @@ -883,9 +875,8 @@ static void omap_wd_timer_write(void *opaque, target_phys_addr_t addr,
883 875 uint32_t value)
884 876 {
885 877 struct omap_watchdog_timer_s *s = (struct omap_watchdog_timer_s *) opaque;
886   - int offset = addr - s->timer.base;
887 878  
888   - switch (offset) {
  879 + switch (addr) {
889 880 case 0x00: /* CNTL_TIMER */
890 881 omap_timer_sync(&s->timer);
891 882 s->timer.ptv = (value >> 9) & 7;
... ... @@ -963,14 +954,13 @@ struct omap_watchdog_timer_s *omap_wd_timer_init(target_phys_addr_t base,
963 954  
964 955 s->timer.irq = irq;
965 956 s->timer.clk = clk;
966   - s->timer.base = base;
967 957 s->timer.timer = qemu_new_timer(vm_clock, omap_timer_tick, &s->timer);
968 958 omap_wd_timer_reset(s);
969 959 omap_timer_clk_setup(&s->timer);
970 960  
971 961 iomemtype = cpu_register_io_memory(0, omap_wd_timer_readfn,
972 962 omap_wd_timer_writefn, s);
973   - cpu_register_physical_memory(s->timer.base, 0x100, iomemtype);
  963 + cpu_register_physical_memory(base, 0x100, iomemtype);
974 964  
975 965 return s;
976 966 }
... ... @@ -1066,14 +1056,13 @@ struct omap_32khz_timer_s *omap_os_timer_init(target_phys_addr_t base,
1066 1056  
1067 1057 s->timer.irq = irq;
1068 1058 s->timer.clk = clk;
1069   - s->timer.base = base;
1070 1059 s->timer.timer = qemu_new_timer(vm_clock, omap_timer_tick, &s->timer);
1071 1060 omap_os_timer_reset(s);
1072 1061 omap_timer_clk_setup(&s->timer);
1073 1062  
1074 1063 iomemtype = cpu_register_io_memory(0, omap_os_timer_readfn,
1075 1064 omap_os_timer_writefn, s);
1076   - cpu_register_physical_memory(s->timer.base, 0x800, iomemtype);
  1065 + cpu_register_physical_memory(base, 0x800, iomemtype);
1077 1066  
1078 1067 return s;
1079 1068 }
... ... @@ -1082,13 +1071,12 @@ struct omap_32khz_timer_s *omap_os_timer_init(target_phys_addr_t base,
1082 1071 static uint32_t omap_ulpd_pm_read(void *opaque, target_phys_addr_t addr)
1083 1072 {
1084 1073 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
1085   - int offset = addr - s->ulpd_pm_base;
1086 1074 uint16_t ret;
1087 1075  
1088   - switch (offset) {
  1076 + switch (addr) {
1089 1077 case 0x14: /* IT_STATUS */
1090   - ret = s->ulpd_pm_regs[offset >> 2];
1091   - s->ulpd_pm_regs[offset >> 2] = 0;
  1078 + ret = s->ulpd_pm_regs[addr >> 2];
  1079 + s->ulpd_pm_regs[addr >> 2] = 0;
1092 1080 qemu_irq_lower(s->irq[1][OMAP_INT_GAUGE_32K]);
1093 1081 return ret;
1094 1082  
... ... @@ -1113,7 +1101,7 @@ static uint32_t omap_ulpd_pm_read(void *opaque, target_phys_addr_t addr)
1113 1101 case 0x48: /* LOCL_TIME */
1114 1102 case 0x4c: /* APLL_CTRL */
1115 1103 case 0x50: /* POWER_CTRL */
1116   - return s->ulpd_pm_regs[offset >> 2];
  1104 + return s->ulpd_pm_regs[addr >> 2];
1117 1105 }
1118 1106  
1119 1107 OMAP_BAD_REG(addr);
... ... @@ -1146,13 +1134,12 @@ static void omap_ulpd_pm_write(void *opaque, target_phys_addr_t addr,
1146 1134 uint32_t value)
1147 1135 {
1148 1136 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
1149   - int offset = addr - s->ulpd_pm_base;
1150 1137 int64_t now, ticks;
1151 1138 int div, mult;
1152 1139 static const int bypass_div[4] = { 1, 2, 4, 4 };
1153 1140 uint16_t diff;
1154 1141  
1155   - switch (offset) {
  1142 + switch (addr) {
1156 1143 case 0x00: /* COUNTER_32_LSB */
1157 1144 case 0x04: /* COUNTER_32_MSB */
1158 1145 case 0x08: /* COUNTER_HIGH_FREQ_LSB */
... ... @@ -1164,7 +1151,7 @@ static void omap_ulpd_pm_write(void *opaque, target_phys_addr_t addr,
1164 1151  
1165 1152 case 0x10: /* GAUGING_CTRL */
1166 1153 /* Bits 0 and 1 seem to be confused in the OMAP 310 TRM */
1167   - if ((s->ulpd_pm_regs[offset >> 2] ^ value) & 1) {
  1154 + if ((s->ulpd_pm_regs[addr >> 2] ^ value) & 1) {
1168 1155 now = qemu_get_clock(vm_clock);
1169 1156  
1170 1157 if (value & 1)
... ... @@ -1190,7 +1177,7 @@ static void omap_ulpd_pm_write(void *opaque, target_phys_addr_t addr,
1190 1177 qemu_irq_raise(s->irq[1][OMAP_INT_GAUGE_32K]);
1191 1178 }
1192 1179 }
1193   - s->ulpd_pm_regs[offset >> 2] = value;
  1180 + s->ulpd_pm_regs[addr >> 2] = value;
1194 1181 break;
1195 1182  
1196 1183 case 0x18: /* Reserved */
... ... @@ -1203,18 +1190,18 @@ static void omap_ulpd_pm_write(void *opaque, target_phys_addr_t addr,
1203 1190 case 0x38: /* COUNTER_32_FIQ */
1204 1191 case 0x48: /* LOCL_TIME */
1205 1192 case 0x50: /* POWER_CTRL */
1206   - s->ulpd_pm_regs[offset >> 2] = value;
  1193 + s->ulpd_pm_regs[addr >> 2] = value;
1207 1194 break;
1208 1195  
1209 1196 case 0x30: /* CLOCK_CTRL */
1210   - diff = s->ulpd_pm_regs[offset >> 2] ^ value;
1211   - s->ulpd_pm_regs[offset >> 2] = value & 0x3f;
  1197 + diff = s->ulpd_pm_regs[addr >> 2] ^ value;
  1198 + s->ulpd_pm_regs[addr >> 2] = value & 0x3f;
1212 1199 omap_ulpd_clk_update(s, diff, value);
1213 1200 break;
1214 1201  
1215 1202 case 0x34: /* SOFT_REQ */
1216   - diff = s->ulpd_pm_regs[offset >> 2] ^ value;
1217   - s->ulpd_pm_regs[offset >> 2] = value & 0x1f;
  1203 + diff = s->ulpd_pm_regs[addr >> 2] ^ value;
  1204 + s->ulpd_pm_regs[addr >> 2] = value & 0x1f;
1218 1205 omap_ulpd_req_update(s, diff, value);
1219 1206 break;
1220 1207  
... ... @@ -1223,8 +1210,8 @@ static void omap_ulpd_pm_write(void *opaque, target_phys_addr_t addr,
1223 1210 * omitted altogether, probably a typo. */
1224 1211 /* This register has identical semantics with DPLL(1:3) control
1225 1212 * registers, see omap_dpll_write() */
1226   - diff = s->ulpd_pm_regs[offset >> 2] & value;
1227   - s->ulpd_pm_regs[offset >> 2] = value & 0x2fff;
  1213 + diff = s->ulpd_pm_regs[addr >> 2] & value;
  1214 + s->ulpd_pm_regs[addr >> 2] = value & 0x2fff;
1228 1215 if (diff & (0x3ff << 2)) {
1229 1216 if (value & (1 << 4)) { /* PLL_ENABLE */
1230 1217 div = ((value >> 5) & 3) + 1; /* PLL_DIV */
... ... @@ -1237,17 +1224,17 @@ static void omap_ulpd_pm_write(void *opaque, target_phys_addr_t addr,
1237 1224 }
1238 1225  
1239 1226 /* Enter the desired mode. */
1240   - s->ulpd_pm_regs[offset >> 2] =
1241   - (s->ulpd_pm_regs[offset >> 2] & 0xfffe) |
1242   - ((s->ulpd_pm_regs[offset >> 2] >> 4) & 1);
  1227 + s->ulpd_pm_regs[addr >> 2] =
  1228 + (s->ulpd_pm_regs[addr >> 2] & 0xfffe) |
  1229 + ((s->ulpd_pm_regs[addr >> 2] >> 4) & 1);
1243 1230  
1244 1231 /* Act as if the lock is restored. */
1245   - s->ulpd_pm_regs[offset >> 2] |= 2;
  1232 + s->ulpd_pm_regs[addr >> 2] |= 2;
1246 1233 break;
1247 1234  
1248 1235 case 0x4c: /* APLL_CTRL */
1249   - diff = s->ulpd_pm_regs[offset >> 2] & value;
1250   - s->ulpd_pm_regs[offset >> 2] = value & 0xf;
  1236 + diff = s->ulpd_pm_regs[addr >> 2] & value;
  1237 + s->ulpd_pm_regs[addr >> 2] = value & 0xf;
1251 1238 if (diff & (1 << 0)) /* APLL_NDPLL_SWITCH */
1252 1239 omap_clk_reparent(omap_findclk(s, "ck_48m"), omap_findclk(s,
1253 1240 (value & (1 << 0)) ? "apll" : "dpll4"));
... ... @@ -1303,8 +1290,7 @@ static void omap_ulpd_pm_init(target_phys_addr_t base,
1303 1290 int iomemtype = cpu_register_io_memory(0, omap_ulpd_pm_readfn,
1304 1291 omap_ulpd_pm_writefn, mpu);
1305 1292  
1306   - mpu->ulpd_pm_base = base;
1307   - cpu_register_physical_memory(mpu->ulpd_pm_base, 0x800, iomemtype);
  1293 + cpu_register_physical_memory(base, 0x800, iomemtype);
1308 1294 omap_ulpd_pm_reset(mpu);
1309 1295 }
1310 1296  
... ... @@ -1312,13 +1298,12 @@ static void omap_ulpd_pm_init(target_phys_addr_t base,
1312 1298 static uint32_t omap_pin_cfg_read(void *opaque, target_phys_addr_t addr)
1313 1299 {
1314 1300 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
1315   - int offset = addr - s->pin_cfg_base;
1316 1301  
1317   - switch (offset) {
  1302 + switch (addr) {
1318 1303 case 0x00: /* FUNC_MUX_CTRL_0 */
1319 1304 case 0x04: /* FUNC_MUX_CTRL_1 */
1320 1305 case 0x08: /* FUNC_MUX_CTRL_2 */
1321   - return s->func_mux_ctrl[offset >> 2];
  1306 + return s->func_mux_ctrl[addr >> 2];
1322 1307  
1323 1308 case 0x0c: /* COMP_MODE_CTRL_0 */
1324 1309 return s->comp_mode_ctrl[0];
... ... @@ -1334,13 +1319,13 @@ static uint32_t omap_pin_cfg_read(void *opaque, target_phys_addr_t addr)
1334 1319 case 0x30: /* FUNC_MUX_CTRL_B */
1335 1320 case 0x34: /* FUNC_MUX_CTRL_C */
1336 1321 case 0x38: /* FUNC_MUX_CTRL_D */
1337   - return s->func_mux_ctrl[(offset >> 2) - 1];
  1322 + return s->func_mux_ctrl[(addr >> 2) - 1];
1338 1323  
1339 1324 case 0x40: /* PULL_DWN_CTRL_0 */
1340 1325 case 0x44: /* PULL_DWN_CTRL_1 */
1341 1326 case 0x48: /* PULL_DWN_CTRL_2 */
1342 1327 case 0x4c: /* PULL_DWN_CTRL_3 */
1343   - return s->pull_dwn_ctrl[(offset & 0xf) >> 2];
  1328 + return s->pull_dwn_ctrl[(addr & 0xf) >> 2];
1344 1329  
1345 1330 case 0x50: /* GATE_INH_CTRL_0 */
1346 1331 return s->gate_inh_ctrl[0];
... ... @@ -1416,24 +1401,23 @@ static void omap_pin_cfg_write(void *opaque, target_phys_addr_t addr,
1416 1401 uint32_t value)
1417 1402 {
1418 1403 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
1419   - int offset = addr - s->pin_cfg_base;
1420 1404 uint32_t diff;
1421 1405  
1422   - switch (offset) {
  1406 + switch (addr) {
1423 1407 case 0x00: /* FUNC_MUX_CTRL_0 */
1424   - diff = s->func_mux_ctrl[offset >> 2] ^ value;
1425   - s->func_mux_ctrl[offset >> 2] = value;
  1408 + diff = s->func_mux_ctrl[addr >> 2] ^ value;
  1409 + s->func_mux_ctrl[addr >> 2] = value;
1426 1410 omap_pin_funcmux0_update(s, diff, value);
1427 1411 return;
1428 1412  
1429 1413 case 0x04: /* FUNC_MUX_CTRL_1 */
1430   - diff = s->func_mux_ctrl[offset >> 2] ^ value;
1431   - s->func_mux_ctrl[offset >> 2] = value;
  1414 + diff = s->func_mux_ctrl[addr >> 2] ^ value;
  1415 + s->func_mux_ctrl[addr >> 2] = value;
1432 1416 omap_pin_funcmux1_update(s, diff, value);
1433 1417 return;
1434 1418  
1435 1419 case 0x08: /* FUNC_MUX_CTRL_2 */
1436   - s->func_mux_ctrl[offset >> 2] = value;
  1420 + s->func_mux_ctrl[addr >> 2] = value;
1437 1421 return;
1438 1422  
1439 1423 case 0x0c: /* COMP_MODE_CTRL_0 */
... ... @@ -1454,14 +1438,14 @@ static void omap_pin_cfg_write(void *opaque, target_phys_addr_t addr,
1454 1438 case 0x30: /* FUNC_MUX_CTRL_B */
1455 1439 case 0x34: /* FUNC_MUX_CTRL_C */
1456 1440 case 0x38: /* FUNC_MUX_CTRL_D */
1457   - s->func_mux_ctrl[(offset >> 2) - 1] = value;
  1441 + s->func_mux_ctrl[(addr >> 2) - 1] = value;
1458 1442 return;
1459 1443  
1460 1444 case 0x40: /* PULL_DWN_CTRL_0 */
1461 1445 case 0x44: /* PULL_DWN_CTRL_1 */
1462 1446 case 0x48: /* PULL_DWN_CTRL_2 */
1463 1447 case 0x4c: /* PULL_DWN_CTRL_3 */
1464   - s->pull_dwn_ctrl[(offset & 0xf) >> 2] = value;
  1448 + s->pull_dwn_ctrl[(addr & 0xf) >> 2] = value;
1465 1449 return;
1466 1450  
1467 1451 case 0x50: /* GATE_INH_CTRL_0 */
... ... @@ -1521,8 +1505,7 @@ static void omap_pin_cfg_init(target_phys_addr_t base,
1521 1505 int iomemtype = cpu_register_io_memory(0, omap_pin_cfg_readfn,
1522 1506 omap_pin_cfg_writefn, mpu);
1523 1507  
1524   - mpu->pin_cfg_base = base;
1525   - cpu_register_physical_memory(mpu->pin_cfg_base, 0x800, iomemtype);
  1508 + cpu_register_physical_memory(base, 0x800, iomemtype);
1526 1509 omap_pin_cfg_reset(mpu);
1527 1510 }
1528 1511  
... ... @@ -1591,19 +1574,18 @@ static void omap_id_init(struct omap_mpu_state_s *mpu)
1591 1574 {
1592 1575 int iomemtype = cpu_register_io_memory(0, omap_id_readfn,
1593 1576 omap_id_writefn, mpu);
1594   - cpu_register_physical_memory(0xfffe1800, 0x800, iomemtype);
1595   - cpu_register_physical_memory(0xfffed400, 0x100, iomemtype);
  1577 + cpu_register_physical_memory_offset(0xfffe1800, 0x800, iomemtype, 0xfffe1800);
  1578 + cpu_register_physical_memory_offset(0xfffed400, 0x100, iomemtype, 0xfffed400);
1596 1579 if (!cpu_is_omap15xx(mpu))
1597   - cpu_register_physical_memory(0xfffe2000, 0x800, iomemtype);
  1580 + cpu_register_physical_memory_offset(0xfffe2000, 0x800, iomemtype, 0xfffe2000);
1598 1581 }
1599 1582  
1600 1583 /* MPUI Control (Dummy) */
1601 1584 static uint32_t omap_mpui_read(void *opaque, target_phys_addr_t addr)
1602 1585 {
1603 1586 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
1604   - int offset = addr - s->mpui_base;
1605 1587  
1606   - switch (offset) {
  1588 + switch (addr) {
1607 1589 case 0x00: /* CTRL */
1608 1590 return s->mpui_ctrl;
1609 1591 case 0x04: /* DEBUG_ADDR */
... ... @@ -1631,9 +1613,8 @@ static void omap_mpui_write(void *opaque, target_phys_addr_t addr,
1631 1613 uint32_t value)
1632 1614 {
1633 1615 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
1634   - int offset = addr - s->mpui_base;
1635 1616  
1636   - switch (offset) {
  1617 + switch (addr) {
1637 1618 case 0x00: /* CTRL */
1638 1619 s->mpui_ctrl = value & 0x007fffff;
1639 1620 break;
... ... @@ -1677,15 +1658,13 @@ static void omap_mpui_init(target_phys_addr_t base,
1677 1658 int iomemtype = cpu_register_io_memory(0, omap_mpui_readfn,
1678 1659 omap_mpui_writefn, mpu);
1679 1660  
1680   - mpu->mpui_base = base;
1681   - cpu_register_physical_memory(mpu->mpui_base, 0x100, iomemtype);
  1661 + cpu_register_physical_memory(base, 0x100, iomemtype);
1682 1662  
1683 1663 omap_mpui_reset(mpu);
1684 1664 }
1685 1665  
1686 1666 /* TIPB Bridges */
1687 1667 struct omap_tipb_bridge_s {
1688   - target_phys_addr_t base;
1689 1668 qemu_irq abort;
1690 1669  
1691 1670 int width_intr;
... ... @@ -1698,9 +1677,8 @@ struct omap_tipb_bridge_s {
1698 1677 static uint32_t omap_tipb_bridge_read(void *opaque, target_phys_addr_t addr)
1699 1678 {
1700 1679 struct omap_tipb_bridge_s *s = (struct omap_tipb_bridge_s *) opaque;
1701   - int offset = addr - s->base;
1702 1680  
1703   - switch (offset) {
  1681 + switch (addr) {
1704 1682 case 0x00: /* TIPB_CNTL */
1705 1683 return s->control;
1706 1684 case 0x04: /* TIPB_BUS_ALLOC */
... ... @@ -1725,9 +1703,8 @@ static void omap_tipb_bridge_write(void *opaque, target_phys_addr_t addr,
1725 1703 uint32_t value)
1726 1704 {
1727 1705 struct omap_tipb_bridge_s *s = (struct omap_tipb_bridge_s *) opaque;
1728   - int offset = addr - s->base;
1729 1706  
1730   - switch (offset) {
  1707 + switch (addr) {
1731 1708 case 0x00: /* TIPB_CNTL */
1732 1709 s->control = value & 0xffff;
1733 1710 break;
... ... @@ -1785,12 +1762,11 @@ struct omap_tipb_bridge_s *omap_tipb_bridge_init(target_phys_addr_t base,
1785 1762 qemu_mallocz(sizeof(struct omap_tipb_bridge_s));
1786 1763  
1787 1764 s->abort = abort_irq;
1788   - s->base = base;
1789 1765 omap_tipb_bridge_reset(s);
1790 1766  
1791 1767 iomemtype = cpu_register_io_memory(0, omap_tipb_bridge_readfn,
1792 1768 omap_tipb_bridge_writefn, s);
1793   - cpu_register_physical_memory(s->base, 0x100, iomemtype);
  1769 + cpu_register_physical_memory(base, 0x100, iomemtype);
1794 1770  
1795 1771 return s;
1796 1772 }
... ... @@ -1799,10 +1775,9 @@ struct omap_tipb_bridge_s *omap_tipb_bridge_init(target_phys_addr_t base,
1799 1775 static uint32_t omap_tcmi_read(void *opaque, target_phys_addr_t addr)
1800 1776 {
1801 1777 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
1802   - int offset = addr - s->tcmi_base;
1803 1778 uint32_t ret;
1804 1779  
1805   - switch (offset) {
  1780 + switch (addr) {
1806 1781 case 0x00: /* IMIF_PRIO */
1807 1782 case 0x04: /* EMIFS_PRIO */
1808 1783 case 0x08: /* EMIFF_PRIO */
... ... @@ -1817,11 +1792,11 @@ static uint32_t omap_tcmi_read(void *opaque, target_phys_addr_t addr)
1817 1792 case 0x30: /* TIMEOUT3 */
1818 1793 case 0x3c: /* EMIFF_SDRAM_CONFIG_2 */
1819 1794 case 0x40: /* EMIFS_CFG_DYN_WAIT */
1820   - return s->tcmi_regs[offset >> 2];
  1795 + return s->tcmi_regs[addr >> 2];
1821 1796  
1822 1797 case 0x20: /* EMIFF_SDRAM_CONFIG */
1823   - ret = s->tcmi_regs[offset >> 2];
1824   - s->tcmi_regs[offset >> 2] &= ~1; /* XXX: Clear SLRF on SDRAM access */
  1798 + ret = s->tcmi_regs[addr >> 2];
  1799 + s->tcmi_regs[addr >> 2] &= ~1; /* XXX: Clear SLRF on SDRAM access */
1825 1800 /* XXX: We can try using the VGA_DIRTY flag for this */
1826 1801 return ret;
1827 1802 }
... ... @@ -1834,9 +1809,8 @@ static void omap_tcmi_write(void *opaque, target_phys_addr_t addr,
1834 1809 uint32_t value)
1835 1810 {
1836 1811 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
1837   - int offset = addr - s->tcmi_base;
1838 1812  
1839   - switch (offset) {
  1813 + switch (addr) {
1840 1814 case 0x00: /* IMIF_PRIO */
1841 1815 case 0x04: /* EMIFS_PRIO */
1842 1816 case 0x08: /* EMIFF_PRIO */
... ... @@ -1851,10 +1825,10 @@ static void omap_tcmi_write(void *opaque, target_phys_addr_t addr,
1851 1825 case 0x30: /* TIMEOUT3 */
1852 1826 case 0x3c: /* EMIFF_SDRAM_CONFIG_2 */
1853 1827 case 0x40: /* EMIFS_CFG_DYN_WAIT */
1854   - s->tcmi_regs[offset >> 2] = value;
  1828 + s->tcmi_regs[addr >> 2] = value;
1855 1829 break;
1856 1830 case 0x0c: /* EMIFS_CONFIG */
1857   - s->tcmi_regs[offset >> 2] = (value & 0xf) | (1 << 4);
  1831 + s->tcmi_regs[addr >> 2] = (value & 0xf) | (1 << 4);
1858 1832 break;
1859 1833  
1860 1834 default:
... ... @@ -1899,8 +1873,7 @@ static void omap_tcmi_init(target_phys_addr_t base,
1899 1873 int iomemtype = cpu_register_io_memory(0, omap_tcmi_readfn,
1900 1874 omap_tcmi_writefn, mpu);
1901 1875  
1902   - mpu->tcmi_base = base;
1903   - cpu_register_physical_memory(mpu->tcmi_base, 0x100, iomemtype);
  1876 + cpu_register_physical_memory(base, 0x100, iomemtype);
1904 1877 omap_tcmi_reset(mpu);
1905 1878 }
1906 1879  
... ... @@ -1908,9 +1881,8 @@ static void omap_tcmi_init(target_phys_addr_t base,
1908 1881 static uint32_t omap_dpll_read(void *opaque, target_phys_addr_t addr)
1909 1882 {
1910 1883 struct dpll_ctl_s *s = (struct dpll_ctl_s *) opaque;
1911   - int offset = addr - s->base;
1912 1884  
1913   - if (offset == 0x00) /* CTL_REG */
  1885 + if (addr == 0x00) /* CTL_REG */
1914 1886 return s->mode;
1915 1887  
1916 1888 OMAP_BAD_REG(addr);
... ... @@ -1922,11 +1894,10 @@ static void omap_dpll_write(void *opaque, target_phys_addr_t addr,
1922 1894 {
1923 1895 struct dpll_ctl_s *s = (struct dpll_ctl_s *) opaque;
1924 1896 uint16_t diff;
1925   - int offset = addr - s->base;
1926 1897 static const int bypass_div[4] = { 1, 2, 4, 4 };
1927 1898 int div, mult;
1928 1899  
1929   - if (offset == 0x00) { /* CTL_REG */
  1900 + if (addr == 0x00) { /* CTL_REG */
1930 1901 /* See omap_ulpd_pm_write() too */
1931 1902 diff = s->mode & value;
1932 1903 s->mode = value & 0x2fff;
... ... @@ -1975,18 +1946,17 @@ static void omap_dpll_init(struct dpll_ctl_s *s, target_phys_addr_t base,
1975 1946 int iomemtype = cpu_register_io_memory(0, omap_dpll_readfn,
1976 1947 omap_dpll_writefn, s);
1977 1948  
1978   - s->base = base;
1979 1949 s->dpll = clk;
1980 1950 omap_dpll_reset(s);
1981 1951  
1982   - cpu_register_physical_memory(s->base, 0x100, iomemtype);
  1952 + cpu_register_physical_memory(base, 0x100, iomemtype);
1983 1953 }
1984 1954  
1985 1955 /* UARTs */
1986 1956 struct omap_uart_s {
  1957 + target_phys_addr_t base;
1987 1958 SerialState *serial; /* TODO */
1988 1959 struct omap_target_agent_s *ta;
1989   - target_phys_addr_t base;
1990 1960 omap_clk fclk;
1991 1961 qemu_irq irq;
1992 1962  
... ... @@ -2025,9 +1995,9 @@ struct omap_uart_s *omap_uart_init(target_phys_addr_t base,
2025 1995 static uint32_t omap_uart_read(void *opaque, target_phys_addr_t addr)
2026 1996 {
2027 1997 struct omap_uart_s *s = (struct omap_uart_s *) opaque;
2028   - int offset = addr - s->base;
2029 1998  
2030   - switch (offset) {
  1999 + addr &= 0xff;
  2000 + switch (addr) {
2031 2001 case 0x20: /* MDR1 */
2032 2002 return s->mdr[0];
2033 2003 case 0x24: /* MDR2 */
... ... @@ -2058,9 +2028,9 @@ static void omap_uart_write(void *opaque, target_phys_addr_t addr,
2058 2028 uint32_t value)
2059 2029 {
2060 2030 struct omap_uart_s *s = (struct omap_uart_s *) opaque;
2061   - int offset = addr - s->base;
2062 2031  
2063   - switch (offset) {
  2032 + addr &= 0xff;
  2033 + switch (addr) {
2064 2034 case 0x20: /* MDR1 */
2065 2035 s->mdr[0] = value & 0x7f;
2066 2036 break;
... ... @@ -2118,7 +2088,7 @@ struct omap_uart_s *omap2_uart_init(struct omap_target_agent_s *ta,
2118 2088  
2119 2089 s->ta = ta;
2120 2090  
2121   - cpu_register_physical_memory(s->base + 0x20, 0x100, iomemtype);
  2091 + cpu_register_physical_memory(base + 0x20, 0x100, iomemtype);
2122 2092  
2123 2093 return s;
2124 2094 }
... ... @@ -2135,9 +2105,8 @@ void omap_uart_attach(struct omap_uart_s *s, CharDriverState *chr)
2135 2105 static uint32_t omap_clkm_read(void *opaque, target_phys_addr_t addr)
2136 2106 {
2137 2107 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
2138   - int offset = addr - s->clkm.mpu_base;
2139 2108  
2140   - switch (offset) {
  2109 + switch (addr) {
2141 2110 case 0x00: /* ARM_CKCTL */
2142 2111 return s->clkm.arm_ckctl;
2143 2112  
... ... @@ -2333,7 +2302,6 @@ static void omap_clkm_write(void *opaque, target_phys_addr_t addr,
2333 2302 uint32_t value)
2334 2303 {
2335 2304 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
2336   - int offset = addr - s->clkm.mpu_base;
2337 2305 uint16_t diff;
2338 2306 omap_clk clk;
2339 2307 static const char *clkschemename[8] = {
... ... @@ -2341,7 +2309,7 @@ static void omap_clkm_write(void *opaque, target_phys_addr_t addr,
2341 2309 "mix mode 1", "mix mode 2", "bypass mode", "mix mode 3", "mix mode 4",
2342 2310 };
2343 2311  
2344   - switch (offset) {
  2312 + switch (addr) {
2345 2313 case 0x00: /* ARM_CKCTL */
2346 2314 diff = s->clkm.arm_ckctl ^ value;
2347 2315 s->clkm.arm_ckctl = value & 0x7fff;
... ... @@ -2423,9 +2391,8 @@ static CPUWriteMemoryFunc *omap_clkm_writefn[] = {
2423 2391 static uint32_t omap_clkdsp_read(void *opaque, target_phys_addr_t addr)
2424 2392 {
2425 2393 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
2426   - int offset = addr - s->clkm.dsp_base;
2427 2394  
2428   - switch (offset) {
  2395 + switch (addr) {
2429 2396 case 0x04: /* DSP_IDLECT1 */
2430 2397 return s->clkm.dsp_idlect1;
2431 2398  
... ... @@ -2464,10 +2431,9 @@ static void omap_clkdsp_write(void *opaque, target_phys_addr_t addr,
2464 2431 uint32_t value)
2465 2432 {
2466 2433 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
2467   - int offset = addr - s->clkm.dsp_base;
2468 2434 uint16_t diff;
2469 2435  
2470   - switch (offset) {
  2436 + switch (addr) {
2471 2437 case 0x04: /* DSP_IDLECT1 */
2472 2438 diff = s->clkm.dsp_idlect1 ^ value;
2473 2439 s->clkm.dsp_idlect1 = value & 0x01f7;
... ... @@ -2536,21 +2502,18 @@ static void omap_clkm_init(target_phys_addr_t mpu_base,
2536 2502 cpu_register_io_memory(0, omap_clkdsp_readfn, omap_clkdsp_writefn, s),
2537 2503 };
2538 2504  
2539   - s->clkm.mpu_base = mpu_base;
2540   - s->clkm.dsp_base = dsp_base;
2541 2505 s->clkm.arm_idlect1 = 0x03ff;
2542 2506 s->clkm.arm_idlect2 = 0x0100;
2543 2507 s->clkm.dsp_idlect1 = 0x0002;
2544 2508 omap_clkm_reset(s);
2545 2509 s->clkm.cold_start = 0x3a;
2546 2510  
2547   - cpu_register_physical_memory(s->clkm.mpu_base, 0x100, iomemtype[0]);
2548   - cpu_register_physical_memory(s->clkm.dsp_base, 0x1000, iomemtype[1]);
  2511 + cpu_register_physical_memory(mpu_base, 0x100, iomemtype[0]);
  2512 + cpu_register_physical_memory(dsp_base, 0x1000, iomemtype[1]);
2549 2513 }
2550 2514  
2551 2515 /* MPU I/O */
2552 2516 struct omap_mpuio_s {
2553   - target_phys_addr_t base;
2554 2517 qemu_irq irq;
2555 2518 qemu_irq kbd_irq;
2556 2519 qemu_irq *in;
... ... @@ -2783,7 +2746,6 @@ struct omap_mpuio_s *omap_mpuio_init(target_phys_addr_t base,
2783 2746 struct omap_mpuio_s *s = (struct omap_mpuio_s *)
2784 2747 qemu_mallocz(sizeof(struct omap_mpuio_s));
2785 2748  
2786   - s->base = base;
2787 2749 s->irq = gpio_int;
2788 2750 s->kbd_irq = kbd_int;
2789 2751 s->wakeup = wakeup;
... ... @@ -2792,7 +2754,7 @@ struct omap_mpuio_s *omap_mpuio_init(target_phys_addr_t base,
2792 2754  
2793 2755 iomemtype = cpu_register_io_memory(0, omap_mpuio_readfn,
2794 2756 omap_mpuio_writefn, s);
2795   - cpu_register_physical_memory(s->base, 0x800, iomemtype);
  2757 + cpu_register_physical_memory(base, 0x800, iomemtype);
2796 2758  
2797 2759 omap_clk_adduser(clk, qemu_allocate_irqs(omap_mpuio_onoff, s, 1)[0]);
2798 2760  
... ... @@ -2827,7 +2789,6 @@ void omap_mpuio_key(struct omap_mpuio_s *s, int row, int col, int down)
2827 2789  
2828 2790 /* General-Purpose I/O */
2829 2791 struct omap_gpio_s {
2830   - target_phys_addr_t base;
2831 2792 qemu_irq irq;
2832 2793 qemu_irq *in;
2833 2794 qemu_irq handler[16];
... ... @@ -2984,14 +2945,13 @@ struct omap_gpio_s *omap_gpio_init(target_phys_addr_t base,
2984 2945 struct omap_gpio_s *s = (struct omap_gpio_s *)
2985 2946 qemu_mallocz(sizeof(struct omap_gpio_s));
2986 2947  
2987   - s->base = base;
2988 2948 s->irq = irq;
2989 2949 s->in = qemu_allocate_irqs(omap_gpio_set, s, 16);
2990 2950 omap_gpio_reset(s);
2991 2951  
2992 2952 iomemtype = cpu_register_io_memory(0, omap_gpio_readfn,
2993 2953 omap_gpio_writefn, s);
2994   - cpu_register_physical_memory(s->base, 0x1000, iomemtype);
  2954 + cpu_register_physical_memory(base, 0x1000, iomemtype);
2995 2955  
2996 2956 return s;
2997 2957 }
... ... @@ -3010,7 +2970,6 @@ void omap_gpio_out_set(struct omap_gpio_s *s, int line, qemu_irq handler)
3010 2970  
3011 2971 /* MicroWire Interface */
3012 2972 struct omap_uwire_s {
3013   - target_phys_addr_t base;
3014 2973 qemu_irq txirq;
3015 2974 qemu_irq rxirq;
3016 2975 qemu_irq txdrq;
... ... @@ -3155,7 +3114,6 @@ struct omap_uwire_s *omap_uwire_init(target_phys_addr_t base,
3155 3114 struct omap_uwire_s *s = (struct omap_uwire_s *)
3156 3115 qemu_mallocz(sizeof(struct omap_uwire_s));
3157 3116  
3158   - s->base = base;
3159 3117 s->txirq = irq[0];
3160 3118 s->rxirq = irq[1];
3161 3119 s->txdrq = dma;
... ... @@ -3163,7 +3121,7 @@ struct omap_uwire_s *omap_uwire_init(target_phys_addr_t base,
3163 3121  
3164 3122 iomemtype = cpu_register_io_memory(0, omap_uwire_readfn,
3165 3123 omap_uwire_writefn, s);
3166   - cpu_register_physical_memory(s->base, 0x800, iomemtype);
  3124 + cpu_register_physical_memory(base, 0x800, iomemtype);
3167 3125  
3168 3126 return s;
3169 3127 }
... ... @@ -3364,7 +3322,6 @@ static void omap_pwt_init(target_phys_addr_t base, struct omap_mpu_state_s *s,
3364 3322  
3365 3323 /* Real-time Clock module */
3366 3324 struct omap_rtc_s {
3367   - target_phys_addr_t base;
3368 3325 qemu_irq irq;
3369 3326 qemu_irq alarm;
3370 3327 QEMUTimer *clk;
... ... @@ -3775,7 +3732,6 @@ struct omap_rtc_s *omap_rtc_init(target_phys_addr_t base,
3775 3732 struct omap_rtc_s *s = (struct omap_rtc_s *)
3776 3733 qemu_mallocz(sizeof(struct omap_rtc_s));
3777 3734  
3778   - s->base = base;
3779 3735 s->irq = irq[0];
3780 3736 s->alarm = irq[1];
3781 3737 s->clk = qemu_new_timer(rt_clock, omap_rtc_tick, s);
... ... @@ -3784,14 +3740,13 @@ struct omap_rtc_s *omap_rtc_init(target_phys_addr_t base,
3784 3740  
3785 3741 iomemtype = cpu_register_io_memory(0, omap_rtc_readfn,
3786 3742 omap_rtc_writefn, s);
3787   - cpu_register_physical_memory(s->base, 0x800, iomemtype);
  3743 + cpu_register_physical_memory(base, 0x800, iomemtype);
3788 3744  
3789 3745 return s;
3790 3746 }
3791 3747  
3792 3748 /* Multi-channel Buffered Serial Port interfaces */
3793 3749 struct omap_mcbsp_s {
3794   - target_phys_addr_t base;
3795 3750 qemu_irq txirq;
3796 3751 qemu_irq rxirq;
3797 3752 qemu_irq txdrq;
... ... @@ -4295,7 +4250,6 @@ struct omap_mcbsp_s *omap_mcbsp_init(target_phys_addr_t base,
4295 4250 struct omap_mcbsp_s *s = (struct omap_mcbsp_s *)
4296 4251 qemu_mallocz(sizeof(struct omap_mcbsp_s));
4297 4252  
4298   - s->base = base;
4299 4253 s->txirq = irq[0];
4300 4254 s->rxirq = irq[1];
4301 4255 s->txdrq = dma[0];
... ... @@ -4306,7 +4260,7 @@ struct omap_mcbsp_s *omap_mcbsp_init(target_phys_addr_t base,
4306 4260  
4307 4261 iomemtype = cpu_register_io_memory(0, omap_mcbsp_readfn,
4308 4262 omap_mcbsp_writefn, s);
4309   - cpu_register_physical_memory(s->base, 0x800, iomemtype);
  4263 + cpu_register_physical_memory(base, 0x800, iomemtype);
4310 4264  
4311 4265 return s;
4312 4266 }
... ... @@ -4340,7 +4294,6 @@ void omap_mcbsp_i2s_attach(struct omap_mcbsp_s *s, struct i2s_codec_s *slave)
4340 4294  
4341 4295 /* LED Pulse Generators */
4342 4296 struct omap_lpg_s {
4343   - target_phys_addr_t base;
4344 4297 QEMUTimer *tm;
4345 4298  
4346 4299 uint8_t control;
... ... @@ -4473,14 +4426,13 @@ struct omap_lpg_s *omap_lpg_init(target_phys_addr_t base, omap_clk clk)
4473 4426 struct omap_lpg_s *s = (struct omap_lpg_s *)
4474 4427 qemu_mallocz(sizeof(struct omap_lpg_s));
4475 4428  
4476   - s->base = base;
4477 4429 s->tm = qemu_new_timer(rt_clock, omap_lpg_tick, s);
4478 4430  
4479 4431 omap_lpg_reset(s);
4480 4432  
4481 4433 iomemtype = cpu_register_io_memory(0, omap_lpg_readfn,
4482 4434 omap_lpg_writefn, s);
4483   - cpu_register_physical_memory(s->base, 0x800, iomemtype);
  4435 + cpu_register_physical_memory(base, 0x800, iomemtype);
4484 4436  
4485 4437 omap_clk_adduser(clk, qemu_allocate_irqs(omap_lpg_clk_update, s, 1)[0]);
4486 4438  
... ...
hw/omap2.c
... ... @@ -36,7 +36,6 @@ struct omap_gp_timer_s {
36 36 qemu_irq in;
37 37 qemu_irq out;
38 38 omap_clk clk;
39   - target_phys_addr_t base;
40 39 QEMUTimer *timer;
41 40 QEMUTimer *match;
42 41 struct omap_target_agent_s *ta;
... ... @@ -269,9 +268,8 @@ static void omap_gp_timer_reset(struct omap_gp_timer_s *s)
269 268 static uint32_t omap_gp_timer_readw(void *opaque, target_phys_addr_t addr)
270 269 {
271 270 struct omap_gp_timer_s *s = (struct omap_gp_timer_s *) opaque;
272   - int offset = addr - s->base;
273 271  
274   - switch (offset) {
  272 + switch (addr) {
275 273 case 0x00: /* TIDR */
276 274 return 0x21;
277 275  
... ... @@ -357,9 +355,8 @@ static void omap_gp_timer_write(void *opaque, target_phys_addr_t addr,
357 355 uint32_t value)
358 356 {
359 357 struct omap_gp_timer_s *s = (struct omap_gp_timer_s *) opaque;
360   - int offset = addr - s->base;
361 358  
362   - switch (offset) {
  359 + switch (addr) {
363 360 case 0x00: /* TIDR */
364 361 case 0x14: /* TISTAT */
365 362 case 0x34: /* TWPS */
... ... @@ -489,7 +486,7 @@ struct omap_gp_timer_s *omap_gp_timer_init(struct omap_target_agent_s *ta,
489 486  
490 487 iomemtype = l4_register_io_memory(0, omap_gp_timer_readfn,
491 488 omap_gp_timer_writefn, s);
492   - s->base = omap_l4_attach(ta, 0, iomemtype);
  489 + omap_l4_attach(ta, 0, iomemtype);
493 490  
494 491 return s;
495 492 }
... ... @@ -507,9 +504,8 @@ static void omap_synctimer_reset(struct omap_synctimer_s *s)
507 504 static uint32_t omap_synctimer_readw(void *opaque, target_phys_addr_t addr)
508 505 {
509 506 struct omap_synctimer_s *s = (struct omap_synctimer_s *) opaque;
510   - int offset = addr - s->base;
511 507  
512   - switch (offset) {
  508 + switch (addr) {
513 509 case 0x00: /* 32KSYNCNT_REV */
514 510 return 0x21;
515 511  
... ... @@ -559,13 +555,12 @@ void omap_synctimer_init(struct omap_target_agent_s *ta,
559 555 struct omap_synctimer_s *s = &mpu->synctimer;
560 556  
561 557 omap_synctimer_reset(s);
562   - s->base = omap_l4_attach(ta, 0, l4_register_io_memory(0,
563   - omap_synctimer_readfn, omap_synctimer_writefn, s));
  558 + omap_l4_attach(ta, 0, l4_register_io_memory(0,
  559 + omap_synctimer_readfn, omap_synctimer_writefn, s));
564 560 }
565 561  
566 562 /* General-Purpose Interface of OMAP2 */
567 563 struct omap2_gpio_s {
568   - target_phys_addr_t base;
569 564 qemu_irq irq[2];
570 565 qemu_irq wkup;
571 566 qemu_irq *in;
... ... @@ -668,9 +663,8 @@ static void omap_gpio_module_reset(struct omap2_gpio_s *s)
668 663 static uint32_t omap_gpio_module_read(void *opaque, target_phys_addr_t addr)
669 664 {
670 665 struct omap2_gpio_s *s = (struct omap2_gpio_s *) opaque;
671   - int offset = addr - s->base;
672 666  
673   - switch (offset) {
  667 + switch (addr) {
674 668 case 0x00: /* GPIO_REVISION */
675 669 return 0x18;
676 670  
... ... @@ -742,11 +736,10 @@ static void omap_gpio_module_write(void *opaque, target_phys_addr_t addr,
742 736 uint32_t value)
743 737 {
744 738 struct omap2_gpio_s *s = (struct omap2_gpio_s *) opaque;
745   - int offset = addr - s->base;
746 739 uint32_t diff;
747 740 int ln;
748 741  
749   - switch (offset) {
  742 + switch (addr) {
750 743 case 0x00: /* GPIO_REVISION */
751 744 case 0x14: /* GPIO_SYSSTATUS */
752 745 case 0x38: /* GPIO_DATAIN */
... ... @@ -889,12 +882,10 @@ static uint32_t omap_gpio_module_readp(void *opaque, target_phys_addr_t addr)
889 882 static void omap_gpio_module_writep(void *opaque, target_phys_addr_t addr,
890 883 uint32_t value)
891 884 {
892   - struct omap2_gpio_s *s = (struct omap2_gpio_s *) opaque;
893   - int offset = addr - s->base;
894 885 uint32_t cur = 0;
895 886 uint32_t mask = 0xffff;
896 887  
897   - switch (offset & ~3) {
  888 + switch (addr & ~3) {
898 889 case 0x00: /* GPIO_REVISION */
899 890 case 0x14: /* GPIO_SYSSTATUS */
900 891 case 0x38: /* GPIO_DATAIN */
... ... @@ -964,14 +955,13 @@ static void omap_gpio_module_init(struct omap2_gpio_s *s,
964 955  
965 956 iomemtype = l4_register_io_memory(0, omap_gpio_module_readfn,
966 957 omap_gpio_module_writefn, s);
967   - s->base = omap_l4_attach(ta, region, iomemtype);
  958 + omap_l4_attach(ta, region, iomemtype);
968 959 }
969 960  
970 961 struct omap_gpif_s {
971 962 struct omap2_gpio_s module[5];
972 963 int modules;
973 964  
974   - target_phys_addr_t topbase;
975 965 int autoidle;
976 966 int gpo;
977 967 };
... ... @@ -990,9 +980,8 @@ static void omap_gpif_reset(struct omap_gpif_s *s)
990 980 static uint32_t omap_gpif_top_read(void *opaque, target_phys_addr_t addr)
991 981 {
992 982 struct omap_gpif_s *s = (struct omap_gpif_s *) opaque;
993   - int offset = addr - s->topbase;
994 983  
995   - switch (offset) {
  984 + switch (addr) {
996 985 case 0x00: /* IPGENERICOCPSPL_REVISION */
997 986 return 0x18;
998 987  
... ... @@ -1020,9 +1009,8 @@ static void omap_gpif_top_write(void *opaque, target_phys_addr_t addr,
1020 1009 uint32_t value)
1021 1010 {
1022 1011 struct omap_gpif_s *s = (struct omap_gpif_s *) opaque;
1023   - int offset = addr - s->topbase;
1024 1012  
1025   - switch (offset) {
  1013 + switch (addr) {
1026 1014 case 0x00: /* IPGENERICOCPSPL_REVISION */
1027 1015 case 0x14: /* IPGENERICOCPSPL_SYSSTATUS */
1028 1016 case 0x18: /* IPGENERICOCPSPL_IRQSTATUS */
... ... @@ -1075,7 +1063,7 @@ struct omap_gpif_s *omap2_gpio_init(struct omap_target_agent_s *ta,
1075 1063  
1076 1064 iomemtype = l4_register_io_memory(0, omap_gpif_top_readfn,
1077 1065 omap_gpif_top_writefn, s);
1078   - s->topbase = omap_l4_attach(ta, 1, iomemtype);
  1066 + omap_l4_attach(ta, 1, iomemtype);
1079 1067  
1080 1068 return s;
1081 1069 }
... ... @@ -1097,7 +1085,6 @@ void omap2_gpio_out_set(struct omap_gpif_s *s, int line, qemu_irq handler)
1097 1085  
1098 1086 /* Multichannel SPI */
1099 1087 struct omap_mcspi_s {
1100   - target_phys_addr_t base;
1101 1088 qemu_irq irq;
1102 1089 int chnum;
1103 1090  
... ... @@ -1206,11 +1193,10 @@ static void omap_mcspi_reset(struct omap_mcspi_s *s)
1206 1193 static uint32_t omap_mcspi_read(void *opaque, target_phys_addr_t addr)
1207 1194 {
1208 1195 struct omap_mcspi_s *s = (struct omap_mcspi_s *) opaque;
1209   - int offset = addr - s->base;
1210 1196 int ch = 0;
1211 1197 uint32_t ret;
1212 1198  
1213   - switch (offset) {
  1199 + switch (addr) {
1214 1200 case 0x00: /* MCSPI_REVISION */
1215 1201 return 0x91;
1216 1202  
... ... @@ -1277,10 +1263,9 @@ static void omap_mcspi_write(void *opaque, target_phys_addr_t addr,
1277 1263 uint32_t value)
1278 1264 {
1279 1265 struct omap_mcspi_s *s = (struct omap_mcspi_s *) opaque;
1280   - int offset = addr - s->base;
1281 1266 int ch = 0;
1282 1267  
1283   - switch (offset) {
  1268 + switch (addr) {
1284 1269 case 0x00: /* MCSPI_REVISION */
1285 1270 case 0x14: /* MCSPI_SYSSTATUS */
1286 1271 case 0x30: /* MCSPI_CHSTAT0 */
... ... @@ -1405,7 +1390,7 @@ struct omap_mcspi_s *omap_mcspi_init(struct omap_target_agent_s *ta, int chnum,
1405 1390  
1406 1391 iomemtype = l4_register_io_memory(0, omap_mcspi_readfn,
1407 1392 omap_mcspi_writefn, s);
1408   - s->base = omap_l4_attach(ta, 0, iomemtype);
  1393 + omap_l4_attach(ta, 0, iomemtype);
1409 1394  
1410 1395 return s;
1411 1396 }
... ... @@ -1424,7 +1409,6 @@ void omap_mcspi_attach(struct omap_mcspi_s *s,
1424 1409  
1425 1410 /* Enhanced Audio Controller (CODEC only) */
1426 1411 struct omap_eac_s {
1427   - target_phys_addr_t base;
1428 1412 qemu_irq irq;
1429 1413  
1430 1414 uint16_t sysconfig;
... ... @@ -1719,10 +1703,9 @@ static void omap_eac_reset(struct omap_eac_s *s)
1719 1703 static uint32_t omap_eac_read(void *opaque, target_phys_addr_t addr)
1720 1704 {
1721 1705 struct omap_eac_s *s = (struct omap_eac_s *) opaque;
1722   - int offset = addr - s->base;
1723 1706 uint32_t ret;
1724 1707  
1725   - switch (offset) {
  1708 + switch (addr) {
1726 1709 case 0x000: /* CPCFR1 */
1727 1710 return s->config[0];
1728 1711 case 0x004: /* CPCFR2 */
... ... @@ -1832,9 +1815,8 @@ static void omap_eac_write(void *opaque, target_phys_addr_t addr,
1832 1815 uint32_t value)
1833 1816 {
1834 1817 struct omap_eac_s *s = (struct omap_eac_s *) opaque;
1835   - int offset = addr - s->base;
1836 1818  
1837   - switch (offset) {
  1819 + switch (addr) {
1838 1820 case 0x098: /* APD1LCR */
1839 1821 case 0x09c: /* APD1RCR */
1840 1822 case 0x0a0: /* APD2LCR */
... ... @@ -1999,7 +1981,7 @@ struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta,
1999 1981  
2000 1982 iomemtype = cpu_register_io_memory(0, omap_eac_readfn,
2001 1983 omap_eac_writefn, s);
2002   - s->base = omap_l4_attach(ta, 0, iomemtype);
  1984 + omap_l4_attach(ta, 0, iomemtype);
2003 1985 #endif
2004 1986  
2005 1987 return s;
... ... @@ -2007,8 +1989,6 @@ struct omap_eac_s *omap_eac_init(struct omap_target_agent_s *ta,
2007 1989  
2008 1990 /* STI/XTI (emulation interface) console - reverse engineered only */
2009 1991 struct omap_sti_s {
2010   - target_phys_addr_t base;
2011   - target_phys_addr_t channel_base;
2012 1992 qemu_irq irq;
2013 1993 CharDriverState *chr;
2014 1994  
... ... @@ -2042,9 +2022,8 @@ static void omap_sti_reset(struct omap_sti_s *s)
2042 2022 static uint32_t omap_sti_read(void *opaque, target_phys_addr_t addr)
2043 2023 {
2044 2024 struct omap_sti_s *s = (struct omap_sti_s *) opaque;
2045   - int offset = addr - s->base;
2046 2025  
2047   - switch (offset) {
  2026 + switch (addr) {
2048 2027 case 0x00: /* STI_REVISION */
2049 2028 return 0x10;
2050 2029  
... ... @@ -2080,9 +2059,8 @@ static void omap_sti_write(void *opaque, target_phys_addr_t addr,
2080 2059 uint32_t value)
2081 2060 {
2082 2061 struct omap_sti_s *s = (struct omap_sti_s *) opaque;
2083   - int offset = addr - s->base;
2084 2062  
2085   - switch (offset) {
  2063 + switch (addr) {
2086 2064 case 0x00: /* STI_REVISION */
2087 2065 case 0x14: /* STI_SYSSTATUS / STI_RX_STATUS / XTI_SYSSTATUS */
2088 2066 OMAP_RO_REG(addr);
... ... @@ -2145,8 +2123,7 @@ static void omap_sti_fifo_write(void *opaque, target_phys_addr_t addr,
2145 2123 uint32_t value)
2146 2124 {
2147 2125 struct omap_sti_s *s = (struct omap_sti_s *) opaque;
2148   - int offset = addr - s->channel_base;
2149   - int ch = offset >> 6;
  2126 + int ch = addr >> 6;
2150 2127 uint8_t byte = value;
2151 2128  
2152 2129 if (ch == STI_TRACE_CONTROL_CHANNEL) {
... ... @@ -2189,12 +2166,11 @@ static struct omap_sti_s *omap_sti_init(struct omap_target_agent_s *ta,
2189 2166  
2190 2167 iomemtype = l4_register_io_memory(0, omap_sti_readfn,
2191 2168 omap_sti_writefn, s);
2192   - s->base = omap_l4_attach(ta, 0, iomemtype);
  2169 + omap_l4_attach(ta, 0, iomemtype);
2193 2170  
2194 2171 iomemtype = cpu_register_io_memory(0, omap_sti_fifo_readfn,
2195 2172 omap_sti_fifo_writefn, s);
2196   - s->channel_base = channel_base;
2197   - cpu_register_physical_memory(s->channel_base, 0x10000, iomemtype);
  2173 + cpu_register_physical_memory(channel_base, 0x10000, iomemtype);
2198 2174  
2199 2175 return s;
2200 2176 }
... ... @@ -2331,9 +2307,8 @@ struct omap_l4_s *omap_l4_init(target_phys_addr_t base, int ta_num)
2331 2307 static uint32_t omap_l4ta_read(void *opaque, target_phys_addr_t addr)
2332 2308 {
2333 2309 struct omap_target_agent_s *s = (struct omap_target_agent_s *) opaque;
2334   - target_phys_addr_t reg = addr - s->base;
2335 2310  
2336   - switch (reg) {
  2311 + switch (addr) {
2337 2312 case 0x00: /* COMPONENT */
2338 2313 return s->component;
2339 2314  
... ... @@ -2352,9 +2327,8 @@ static void omap_l4ta_write(void *opaque, target_phys_addr_t addr,
2352 2327 uint32_t value)
2353 2328 {
2354 2329 struct omap_target_agent_s *s = (struct omap_target_agent_s *) opaque;
2355   - target_phys_addr_t reg = addr - s->base;
2356 2330  
2357   - switch (reg) {
  2331 + switch (addr) {
2358 2332 case 0x00: /* COMPONENT */
2359 2333 case 0x28: /* AGENT_STATUS */
2360 2334 OMAP_RO_REG(addr);
... ... @@ -2656,9 +2630,8 @@ target_phys_addr_t omap_l4_attach(struct omap_target_agent_s *ta, int region,
2656 2630 static uint32_t omap_tap_read(void *opaque, target_phys_addr_t addr)
2657 2631 {
2658 2632 struct omap_mpu_state_s *s = (struct omap_mpu_state_s *) opaque;
2659   - target_phys_addr_t reg = addr - s->tap_base;
2660 2633  
2661   - switch (reg) {
  2634 + switch (addr) {
2662 2635 case 0x204: /* IDCODE_reg */
2663 2636 switch (s->mpu_model) {
2664 2637 case omap2420:
... ... @@ -2739,13 +2712,12 @@ static CPUWriteMemoryFunc *omap_tap_writefn[] = {
2739 2712 void omap_tap_init(struct omap_target_agent_s *ta,
2740 2713 struct omap_mpu_state_s *mpu)
2741 2714 {
2742   - mpu->tap_base = omap_l4_attach(ta, 0, l4_register_io_memory(0,
  2715 + omap_l4_attach(ta, 0, l4_register_io_memory(0,
2743 2716 omap_tap_readfn, omap_tap_writefn, mpu));
2744 2717 }
2745 2718  
2746 2719 /* Power, Reset, and Clock Management */
2747 2720 struct omap_prcm_s {
2748   - target_phys_addr_t base;
2749 2721 qemu_irq irq[3];
2750 2722 struct omap_mpu_state_s *mpu;
2751 2723  
... ... @@ -2789,10 +2761,9 @@ static void omap_prcm_int_update(struct omap_prcm_s *s, int dom)
2789 2761 static uint32_t omap_prcm_read(void *opaque, target_phys_addr_t addr)
2790 2762 {
2791 2763 struct omap_prcm_s *s = (struct omap_prcm_s *) opaque;
2792   - int offset = addr - s->base;
2793 2764 uint32_t ret;
2794 2765  
2795   - switch (offset) {
  2766 + switch (addr) {
2796 2767 case 0x000: /* PRCM_REVISION */
2797 2768 return 0x10;
2798 2769  
... ... @@ -2849,7 +2820,7 @@ static uint32_t omap_prcm_read(void *opaque, target_phys_addr_t addr)
2849 2820 case 0x0f4: /* GENERAL_PURPOSE18 */
2850 2821 case 0x0f8: /* GENERAL_PURPOSE19 */
2851 2822 case 0x0fc: /* GENERAL_PURPOSE20 */
2852   - return s->scratch[(offset - 0xb0) >> 2];
  2823 + return s->scratch[(addr - 0xb0) >> 2];
2853 2824  
2854 2825 case 0x140: /* CM_CLKSEL_MPU */
2855 2826 return s->clksel[0];
... ... @@ -3098,9 +3069,8 @@ static void omap_prcm_write(void *opaque, target_phys_addr_t addr,
3098 3069 uint32_t value)
3099 3070 {
3100 3071 struct omap_prcm_s *s = (struct omap_prcm_s *) opaque;
3101   - int offset = addr - s->base;
3102 3072  
3103   - switch (offset) {
  3073 + switch (addr) {
3104 3074 case 0x000: /* PRCM_REVISION */
3105 3075 case 0x054: /* PRCM_VOLTST */
3106 3076 case 0x084: /* PRCM_CLKCFG_STATUS */
... ... @@ -3185,7 +3155,7 @@ static void omap_prcm_write(void *opaque, target_phys_addr_t addr,
3185 3155 case 0x0f4: /* GENERAL_PURPOSE18 */
3186 3156 case 0x0f8: /* GENERAL_PURPOSE19 */
3187 3157 case 0x0fc: /* GENERAL_PURPOSE20 */
3188   - s->scratch[(offset - 0xb0) >> 2] = value;
  3158 + s->scratch[(addr - 0xb0) >> 2] = value;
3189 3159 break;
3190 3160  
3191 3161 case 0x140: /* CM_CLKSEL_MPU */
... ... @@ -3557,7 +3527,7 @@ struct omap_prcm_s *omap_prcm_init(struct omap_target_agent_s *ta,
3557 3527  
3558 3528 iomemtype = l4_register_io_memory(0, omap_prcm_readfn,
3559 3529 omap_prcm_writefn, s);
3560   - s->base = omap_l4_attach(ta, 0, iomemtype);
  3530 + omap_l4_attach(ta, 0, iomemtype);
3561 3531 omap_l4_attach(ta, 1, iomemtype);
3562 3532  
3563 3533 return s;
... ... @@ -3565,7 +3535,6 @@ struct omap_prcm_s *omap_prcm_init(struct omap_target_agent_s *ta,
3565 3535  
3566 3536 /* System and Pinout control */
3567 3537 struct omap_sysctl_s {
3568   - target_phys_addr_t base;
3569 3538 struct omap_mpu_state_s *mpu;
3570 3539  
3571 3540 uint32_t sysconfig;
... ... @@ -3580,14 +3549,13 @@ static uint32_t omap_sysctl_read8(void *opaque, target_phys_addr_t addr)
3580 3549 {
3581 3550  
3582 3551 struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque;
3583   - int offset = addr - s->base;
3584 3552 int pad_offset, byte_offset;
3585 3553 int value;
3586 3554  
3587   - switch (offset) {
  3555 + switch (addr) {
3588 3556 case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */
3589   - pad_offset = (offset - 0x30) >> 2;
3590   - byte_offset = (offset - 0x30) & (4 - 1);
  3557 + pad_offset = (addr - 0x30) >> 2;
  3558 + byte_offset = (addr - 0x30) & (4 - 1);
3591 3559  
3592 3560 value = s->padconf[pad_offset];
3593 3561 value = (value >> (byte_offset * 8)) & 0xff;
... ... @@ -3605,9 +3573,8 @@ static uint32_t omap_sysctl_read8(void *opaque, target_phys_addr_t addr)
3605 3573 static uint32_t omap_sysctl_read(void *opaque, target_phys_addr_t addr)
3606 3574 {
3607 3575 struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque;
3608   - int offset = addr - s->base;
3609 3576  
3610   - switch (offset) {
  3577 + switch (addr) {
3611 3578 case 0x000: /* CONTROL_REVISION */
3612 3579 return 0x20;
3613 3580  
... ... @@ -3615,7 +3582,7 @@ static uint32_t omap_sysctl_read(void *opaque, target_phys_addr_t addr)
3615 3582 return s->sysconfig;
3616 3583  
3617 3584 case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */
3618   - return s->padconf[(offset - 0x30) >> 2];
  3585 + return s->padconf[(addr - 0x30) >> 2];
3619 3586  
3620 3587 case 0x270: /* CONTROL_DEBOBS */
3621 3588 return s->obs;
... ... @@ -3707,14 +3674,13 @@ static void omap_sysctl_write8(void *opaque, target_phys_addr_t addr,
3707 3674 uint32_t value)
3708 3675 {
3709 3676 struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque;
3710   - int offset = addr - s->base;
3711 3677 int pad_offset, byte_offset;
3712 3678 int prev_value;
3713 3679  
3714   - switch (offset) {
  3680 + switch (addr) {
3715 3681 case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */
3716   - pad_offset = (offset - 0x30) >> 2;
3717   - byte_offset = (offset - 0x30) & (4 - 1);
  3682 + pad_offset = (addr - 0x30) >> 2;
  3683 + byte_offset = (addr - 0x30) & (4 - 1);
3718 3684  
3719 3685 prev_value = s->padconf[pad_offset];
3720 3686 prev_value &= ~(0xff << (byte_offset * 8));
... ... @@ -3732,9 +3698,8 @@ static void omap_sysctl_write(void *opaque, target_phys_addr_t addr,
3732 3698 uint32_t value)
3733 3699 {
3734 3700 struct omap_sysctl_s *s = (struct omap_sysctl_s *) opaque;
3735   - int offset = addr - s->base;
3736 3701  
3737   - switch (offset) {
  3702 + switch (addr) {
3738 3703 case 0x000: /* CONTROL_REVISION */
3739 3704 case 0x2a4: /* CONTROL_MSUSPENDMUX_5 */
3740 3705 case 0x2c0: /* CONTROL_PSA_VALUE */
... ... @@ -3769,7 +3734,7 @@ static void omap_sysctl_write(void *opaque, target_phys_addr_t addr,
3769 3734  
3770 3735 case 0x030 ... 0x140: /* CONTROL_PADCONF - only used in the POP */
3771 3736 /* XXX: should check constant bits */
3772   - s->padconf[(offset - 0x30) >> 2] = value & 0x1f1f1f1f;
  3737 + s->padconf[(addr - 0x30) >> 2] = value & 0x1f1f1f1f;
3773 3738 break;
3774 3739  
3775 3740 case 0x270: /* CONTROL_DEBOBS */
... ... @@ -3932,7 +3897,7 @@ struct omap_sysctl_s *omap_sysctl_init(struct omap_target_agent_s *ta,
3932 3897  
3933 3898 iomemtype = l4_register_io_memory(0, omap_sysctl_readfn,
3934 3899 omap_sysctl_writefn, s);
3935   - s->base = omap_l4_attach(ta, 0, iomemtype);
  3900 + omap_l4_attach(ta, 0, iomemtype);
3936 3901 omap_l4_attach(ta, 0, iomemtype);
3937 3902  
3938 3903 return s;
... ... @@ -3940,8 +3905,6 @@ struct omap_sysctl_s *omap_sysctl_init(struct omap_target_agent_s *ta,
3940 3905  
3941 3906 /* SDRAM Controller Subsystem */
3942 3907 struct omap_sdrc_s {
3943   - target_phys_addr_t base;
3944   -
3945 3908 uint8_t config;
3946 3909 };
3947 3910  
... ... @@ -3953,9 +3916,8 @@ static void omap_sdrc_reset(struct omap_sdrc_s *s)
3953 3916 static uint32_t omap_sdrc_read(void *opaque, target_phys_addr_t addr)
3954 3917 {
3955 3918 struct omap_sdrc_s *s = (struct omap_sdrc_s *) opaque;
3956   - int offset = addr - s->base;
3957 3919  
3958   - switch (offset) {
  3920 + switch (addr) {
3959 3921 case 0x00: /* SDRC_REVISION */
3960 3922 return 0x20;
3961 3923  
... ... @@ -4005,9 +3967,8 @@ static void omap_sdrc_write(void *opaque, target_phys_addr_t addr,
4005 3967 uint32_t value)
4006 3968 {
4007 3969 struct omap_sdrc_s *s = (struct omap_sdrc_s *) opaque;
4008   - int offset = addr - s->base;
4009 3970  
4010   - switch (offset) {
  3971 + switch (addr) {
4011 3972 case 0x00: /* SDRC_REVISION */
4012 3973 case 0x14: /* SDRC_SYSSTATUS */
4013 3974 case 0x48: /* SDRC_ERR_ADDR */
... ... @@ -4077,19 +4038,17 @@ struct omap_sdrc_s *omap_sdrc_init(target_phys_addr_t base)
4077 4038 struct omap_sdrc_s *s = (struct omap_sdrc_s *)
4078 4039 qemu_mallocz(sizeof(struct omap_sdrc_s));
4079 4040  
4080   - s->base = base;
4081 4041 omap_sdrc_reset(s);
4082 4042  
4083 4043 iomemtype = cpu_register_io_memory(0, omap_sdrc_readfn,
4084 4044 omap_sdrc_writefn, s);
4085   - cpu_register_physical_memory(s->base, 0x1000, iomemtype);
  4045 + cpu_register_physical_memory(base, 0x1000, iomemtype);
4086 4046  
4087 4047 return s;
4088 4048 }
4089 4049  
4090 4050 /* General-Purpose Memory Controller */
4091 4051 struct omap_gpmc_s {
4092   - target_phys_addr_t base;
4093 4052 qemu_irq irq;
4094 4053  
4095 4054 uint8_t sysconfig;
... ... @@ -4201,11 +4160,10 @@ static void omap_gpmc_reset(struct omap_gpmc_s *s)
4201 4160 static uint32_t omap_gpmc_read(void *opaque, target_phys_addr_t addr)
4202 4161 {
4203 4162 struct omap_gpmc_s *s = (struct omap_gpmc_s *) opaque;
4204   - int offset = addr - s->base;
4205 4163 int cs;
4206 4164 struct omap_gpmc_cs_file_s *f;
4207 4165  
4208   - switch (offset) {
  4166 + switch (addr) {
4209 4167 case 0x000: /* GPMC_REVISION */
4210 4168 return 0x20;
4211 4169  
... ... @@ -4235,10 +4193,10 @@ static uint32_t omap_gpmc_read(void *opaque, target_phys_addr_t addr)
4235 4193 return 0x001;
4236 4194  
4237 4195 case 0x060 ... 0x1d4:
4238   - cs = (offset - 0x060) / 0x30;
4239   - offset -= cs * 0x30;
  4196 + cs = (addr - 0x060) / 0x30;
  4197 + addr -= cs * 0x30;
4240 4198 f = s->cs_file + cs;
4241   - switch (offset) {
  4199 + switch (addr) {
4242 4200 case 0x60: /* GPMC_CONFIG1 */
4243 4201 return f->config[0];
4244 4202 case 0x64: /* GPMC_CONFIG2 */
... ... @@ -4277,7 +4235,7 @@ static uint32_t omap_gpmc_read(void *opaque, target_phys_addr_t addr)
4277 4235 case 0x1fc: /* GPMC_ECC_SIZE_CONFIG */
4278 4236 return s->ecc_cfg;
4279 4237 case 0x200 ... 0x220: /* GPMC_ECC_RESULT */
4280   - cs = (offset & 0x1f) >> 2;
  4238 + cs = (addr & 0x1f) >> 2;
4281 4239 /* TODO: check correctness */
4282 4240 return
4283 4241 ((s->ecc[cs].cp & 0x07) << 0) |
... ... @@ -4300,11 +4258,10 @@ static void omap_gpmc_write(void *opaque, target_phys_addr_t addr,
4300 4258 uint32_t value)
4301 4259 {
4302 4260 struct omap_gpmc_s *s = (struct omap_gpmc_s *) opaque;
4303   - int offset = addr - s->base;
4304 4261 int cs;
4305 4262 struct omap_gpmc_cs_file_s *f;
4306 4263  
4307   - switch (offset) {
  4264 + switch (addr) {
4308 4265 case 0x000: /* GPMC_REVISION */
4309 4266 case 0x014: /* GPMC_SYSSTATUS */
4310 4267 case 0x054: /* GPMC_STATUS */
... ... @@ -4347,10 +4304,10 @@ static void omap_gpmc_write(void *opaque, target_phys_addr_t addr,
4347 4304 break;
4348 4305  
4349 4306 case 0x060 ... 0x1d4:
4350   - cs = (offset - 0x060) / 0x30;
4351   - offset -= cs * 0x30;
  4307 + cs = (addr - 0x060) / 0x30;
  4308 + addr -= cs * 0x30;
4352 4309 f = s->cs_file + cs;
4353   - switch (offset) {
  4310 + switch (addr) {
4354 4311 case 0x60: /* GPMC_CONFIG1 */
4355 4312 f->config[0] = value & 0xffef3e13;
4356 4313 break;
... ... @@ -4455,12 +4412,11 @@ struct omap_gpmc_s *omap_gpmc_init(target_phys_addr_t base, qemu_irq irq)
4455 4412 struct omap_gpmc_s *s = (struct omap_gpmc_s *)
4456 4413 qemu_mallocz(sizeof(struct omap_gpmc_s));
4457 4414  
4458   - s->base = base;
4459 4415 omap_gpmc_reset(s);
4460 4416  
4461 4417 iomemtype = cpu_register_io_memory(0, omap_gpmc_readfn,
4462 4418 omap_gpmc_writefn, s);
4463   - cpu_register_physical_memory(s->base, 0x1000, iomemtype);
  4419 + cpu_register_physical_memory(base, 0x1000, iomemtype);
4464 4420  
4465 4421 return s;
4466 4422 }
... ...
hw/omap_dma.c
... ... @@ -106,7 +106,6 @@ struct omap_dma_s {
106 106 struct soc_dma_s *dma;
107 107  
108 108 struct omap_mpu_state_s *mpu;
109   - target_phys_addr_t base;
110 109 omap_clk clk;
111 110 qemu_irq irq[4];
112 111 void (*intr_update)(struct omap_dma_s *s);
... ... @@ -1447,20 +1446,20 @@ static int omap_dma_sys_read(struct omap_dma_s *s, int offset,
1447 1446 static uint32_t omap_dma_read(void *opaque, target_phys_addr_t addr)
1448 1447 {
1449 1448 struct omap_dma_s *s = (struct omap_dma_s *) opaque;
1450   - int reg, ch, offset = addr - s->base;
  1449 + int reg, ch;
1451 1450 uint16_t ret;
1452 1451  
1453   - switch (offset) {
  1452 + switch (addr) {
1454 1453 case 0x300 ... 0x3fe:
1455 1454 if (s->model <= omap_dma_3_1 || !s->omap_3_1_mapping_disabled) {
1456   - if (omap_dma_3_1_lcd_read(&s->lcd_ch, offset, &ret))
  1455 + if (omap_dma_3_1_lcd_read(&s->lcd_ch, addr, &ret))
1457 1456 break;
1458 1457 return ret;
1459 1458 }
1460 1459 /* Fall through. */
1461 1460 case 0x000 ... 0x2fe:
1462   - reg = offset & 0x3f;
1463   - ch = (offset >> 6) & 0x0f;
  1461 + reg = addr & 0x3f;
  1462 + ch = (addr >> 6) & 0x0f;
1464 1463 if (omap_dma_ch_reg_read(s, &s->ch[ch], reg, &ret))
1465 1464 break;
1466 1465 return ret;
... ... @@ -1470,13 +1469,13 @@ static uint32_t omap_dma_read(void *opaque, target_phys_addr_t addr)
1470 1469 break;
1471 1470 /* Fall through. */
1472 1471 case 0x400:
1473   - if (omap_dma_sys_read(s, offset, &ret))
  1472 + if (omap_dma_sys_read(s, addr, &ret))
1474 1473 break;
1475 1474 return ret;
1476 1475  
1477 1476 case 0xb00 ... 0xbfe:
1478 1477 if (s->model == omap_dma_3_2 && s->omap_3_1_mapping_disabled) {
1479   - if (omap_dma_3_2_lcd_read(&s->lcd_ch, offset, &ret))
  1478 + if (omap_dma_3_2_lcd_read(&s->lcd_ch, addr, &ret))
1480 1479 break;
1481 1480 return ret;
1482 1481 }
... ... @@ -1491,19 +1490,19 @@ static void omap_dma_write(void *opaque, target_phys_addr_t addr,
1491 1490 uint32_t value)
1492 1491 {
1493 1492 struct omap_dma_s *s = (struct omap_dma_s *) opaque;
1494   - int reg, ch, offset = addr - s->base;
  1493 + int reg, ch;
1495 1494  
1496   - switch (offset) {
  1495 + switch (addr) {
1497 1496 case 0x300 ... 0x3fe:
1498 1497 if (s->model <= omap_dma_3_1 || !s->omap_3_1_mapping_disabled) {
1499   - if (omap_dma_3_1_lcd_write(&s->lcd_ch, offset, value))
  1498 + if (omap_dma_3_1_lcd_write(&s->lcd_ch, addr, value))
1500 1499 break;
1501 1500 return;
1502 1501 }
1503 1502 /* Fall through. */
1504 1503 case 0x000 ... 0x2fe:
1505   - reg = offset & 0x3f;
1506   - ch = (offset >> 6) & 0x0f;
  1504 + reg = addr & 0x3f;
  1505 + ch = (addr >> 6) & 0x0f;
1507 1506 if (omap_dma_ch_reg_write(s, &s->ch[ch], reg, value))
1508 1507 break;
1509 1508 return;
... ... @@ -1513,13 +1512,13 @@ static void omap_dma_write(void *opaque, target_phys_addr_t addr,
1513 1512 break;
1514 1513 case 0x400:
1515 1514 /* Fall through. */
1516   - if (omap_dma_sys_write(s, offset, value))
  1515 + if (omap_dma_sys_write(s, addr, value))
1517 1516 break;
1518 1517 return;
1519 1518  
1520 1519 case 0xb00 ... 0xbfe:
1521 1520 if (s->model == omap_dma_3_2 && s->omap_3_1_mapping_disabled) {
1522   - if (omap_dma_3_2_lcd_write(&s->lcd_ch, offset, value))
  1521 + if (omap_dma_3_2_lcd_write(&s->lcd_ch, addr, value))
1523 1522 break;
1524 1523 return;
1525 1524 }
... ... @@ -1628,7 +1627,6 @@ struct soc_dma_s *omap_dma_init(target_phys_addr_t base, qemu_irq *irqs,
1628 1627 num_irqs = 16;
1629 1628 memsize = 0xc00;
1630 1629 }
1631   - s->base = base;
1632 1630 s->model = model;
1633 1631 s->mpu = mpu;
1634 1632 s->clk = clk;
... ... @@ -1660,7 +1658,7 @@ struct soc_dma_s *omap_dma_init(target_phys_addr_t base, qemu_irq *irqs,
1660 1658  
1661 1659 iomemtype = cpu_register_io_memory(0, omap_dma_readfn,
1662 1660 omap_dma_writefn, s);
1663   - cpu_register_physical_memory(s->base, memsize, iomemtype);
  1661 + cpu_register_physical_memory(base, memsize, iomemtype);
1664 1662  
1665 1663 mpu->drq = s->dma->drq;
1666 1664  
... ... @@ -1691,10 +1689,10 @@ static void omap_dma_interrupts_4_update(struct omap_dma_s *s)
1691 1689 static uint32_t omap_dma4_read(void *opaque, target_phys_addr_t addr)
1692 1690 {
1693 1691 struct omap_dma_s *s = (struct omap_dma_s *) opaque;
1694   - int irqn = 0, chnum, offset = addr - s->base;
  1692 + int irqn = 0, chnum;
1695 1693 struct omap_dma_channel_s *ch;
1696 1694  
1697   - switch (offset) {
  1695 + switch (addr) {
1698 1696 case 0x00: /* DMA4_REVISION */
1699 1697 return 0x40;
1700 1698  
... ... @@ -1735,10 +1733,10 @@ static uint32_t omap_dma4_read(void *opaque, target_phys_addr_t addr)
1735 1733 return s->gcr;
1736 1734  
1737 1735 case 0x80 ... 0xfff:
1738   - offset -= 0x80;
1739   - chnum = offset / 0x60;
  1736 + addr -= 0x80;
  1737 + chnum = addr / 0x60;
1740 1738 ch = s->ch + chnum;
1741   - offset -= chnum * 0x60;
  1739 + addr -= chnum * 0x60;
1742 1740 break;
1743 1741  
1744 1742 default:
... ... @@ -1747,7 +1745,7 @@ static uint32_t omap_dma4_read(void *opaque, target_phys_addr_t addr)
1747 1745 }
1748 1746  
1749 1747 /* Per-channel registers */
1750   - switch (offset) {
  1748 + switch (addr) {
1751 1749 case 0x00: /* DMA4_CCR */
1752 1750 return (ch->buf_disable << 25) |
1753 1751 (ch->src_sync << 24) |
... ... @@ -1837,10 +1835,10 @@ static void omap_dma4_write(void *opaque, target_phys_addr_t addr,
1837 1835 uint32_t value)
1838 1836 {
1839 1837 struct omap_dma_s *s = (struct omap_dma_s *) opaque;
1840   - int chnum, irqn = 0, offset = addr - s->base;
  1838 + int chnum, irqn = 0;
1841 1839 struct omap_dma_channel_s *ch;
1842 1840  
1843   - switch (offset) {
  1841 + switch (addr) {
1844 1842 case 0x14: /* DMA4_IRQSTATUS_L3 */
1845 1843 irqn ++;
1846 1844 case 0x10: /* DMA4_IRQSTATUS_L2 */
... ... @@ -1878,10 +1876,10 @@ static void omap_dma4_write(void *opaque, target_phys_addr_t addr,
1878 1876 return;
1879 1877  
1880 1878 case 0x80 ... 0xfff:
1881   - offset -= 0x80;
1882   - chnum = offset / 0x60;
  1879 + addr -= 0x80;
  1880 + chnum = addr / 0x60;
1883 1881 ch = s->ch + chnum;
1884   - offset -= chnum * 0x60;
  1882 + addr -= chnum * 0x60;
1885 1883 break;
1886 1884  
1887 1885 case 0x00: /* DMA4_REVISION */
... ... @@ -1899,7 +1897,7 @@ static void omap_dma4_write(void *opaque, target_phys_addr_t addr,
1899 1897 }
1900 1898  
1901 1899 /* Per-channel registers */
1902   - switch (offset) {
  1900 + switch (addr) {
1903 1901 case 0x00: /* DMA4_CCR */
1904 1902 ch->buf_disable = (value >> 25) & 1;
1905 1903 ch->src_sync = (value >> 24) & 1; /* XXX For CamDMA must be 1 */
... ... @@ -2041,7 +2039,6 @@ struct soc_dma_s *omap_dma4_init(target_phys_addr_t base, qemu_irq *irqs,
2041 2039 struct omap_dma_s *s = (struct omap_dma_s *)
2042 2040 qemu_mallocz(sizeof(struct omap_dma_s));
2043 2041  
2044   - s->base = base;
2045 2042 s->model = omap_dma_4;
2046 2043 s->chans = chans;
2047 2044 s->mpu = mpu;
... ... @@ -2068,7 +2065,7 @@ struct soc_dma_s *omap_dma4_init(target_phys_addr_t base, qemu_irq *irqs,
2068 2065  
2069 2066 iomemtype = cpu_register_io_memory(0, omap_dma4_readfn,
2070 2067 omap_dma4_writefn, s);
2071   - cpu_register_physical_memory(s->base, 0x1000, iomemtype);
  2068 + cpu_register_physical_memory(base, 0x1000, iomemtype);
2072 2069  
2073 2070 mpu->drq = s->dma->drq;
2074 2071  
... ...
hw/omap_dss.c
... ... @@ -24,11 +24,6 @@
24 24 #include "omap.h"
25 25  
26 26 struct omap_dss_s {
27   - target_phys_addr_t diss_base;
28   - target_phys_addr_t disc_base;
29   - target_phys_addr_t rfbi_base;
30   - target_phys_addr_t venc_base;
31   - target_phys_addr_t im3_base;
32 27 qemu_irq irq;
33 28 qemu_irq drq;
34 29 DisplayState *state;
... ... @@ -177,9 +172,8 @@ void omap_dss_reset(struct omap_dss_s *s)
177 172 static uint32_t omap_diss_read(void *opaque, target_phys_addr_t addr)
178 173 {
179 174 struct omap_dss_s *s = (struct omap_dss_s *) opaque;
180   - int offset = addr - s->diss_base;
181 175  
182   - switch (offset) {
  176 + switch (addr) {
183 177 case 0x00: /* DSS_REVISIONNUMBER */
184 178 return 0x20;
185 179  
... ... @@ -212,9 +206,8 @@ static void omap_diss_write(void *opaque, target_phys_addr_t addr,
212 206 uint32_t value)
213 207 {
214 208 struct omap_dss_s *s = (struct omap_dss_s *) opaque;
215   - int offset = addr - s->diss_base;
216 209  
217   - switch (offset) {
  210 + switch (addr) {
218 211 case 0x00: /* DSS_REVISIONNUMBER */
219 212 case 0x14: /* DSS_SYSSTATUS */
220 213 case 0x50: /* DSS_PSA_LCD_REG_1 */
... ... @@ -254,9 +247,8 @@ static CPUWriteMemoryFunc *omap_diss1_writefn[] = {
254 247 static uint32_t omap_disc_read(void *opaque, target_phys_addr_t addr)
255 248 {
256 249 struct omap_dss_s *s = (struct omap_dss_s *) opaque;
257   - int offset = addr - s->disc_base;
258 250  
259   - switch (offset) {
  251 + switch (addr) {
260 252 case 0x000: /* DISPC_REVISION */
261 253 return 0x20;
262 254  
... ... @@ -376,9 +368,8 @@ static void omap_disc_write(void *opaque, target_phys_addr_t addr,
376 368 uint32_t value)
377 369 {
378 370 struct omap_dss_s *s = (struct omap_dss_s *) opaque;
379   - int offset = addr - s->disc_base;
380 371  
381   - switch (offset) {
  372 + switch (addr) {
382 373 case 0x010: /* DISPC_SYSCONFIG */
383 374 if (value & 2) /* SOFTRESET */
384 375 omap_dss_reset(s);
... ... @@ -667,9 +658,8 @@ static void omap_rfbi_transfer_start(struct omap_dss_s *s)
667 658 static uint32_t omap_rfbi_read(void *opaque, target_phys_addr_t addr)
668 659 {
669 660 struct omap_dss_s *s = (struct omap_dss_s *) opaque;
670   - int offset = addr - s->rfbi_base;
671 661  
672   - switch (offset) {
  662 + switch (addr) {
673 663 case 0x00: /* RFBI_REVISION */
674 664 return 0x10;
675 665  
... ... @@ -731,9 +721,8 @@ static void omap_rfbi_write(void *opaque, target_phys_addr_t addr,
731 721 uint32_t value)
732 722 {
733 723 struct omap_dss_s *s = (struct omap_dss_s *) opaque;
734   - int offset = addr - s->rfbi_base;
735 724  
736   - switch (offset) {
  725 + switch (addr) {
737 726 case 0x10: /* RFBI_SYSCONFIG */
738 727 if (value & 2) /* SOFTRESET */
739 728 omap_rfbi_reset(s);
... ... @@ -866,10 +855,7 @@ static CPUWriteMemoryFunc *omap_rfbi1_writefn[] = {
866 855  
867 856 static uint32_t omap_venc_read(void *opaque, target_phys_addr_t addr)
868 857 {
869   - struct omap_dss_s *s = (struct omap_dss_s *) opaque;
870   - int offset = addr - s->venc_base;
871   -
872   - switch (offset) {
  858 + switch (addr) {
873 859 case 0x00: /* REV_ID */
874 860 case 0x04: /* STATUS */
875 861 case 0x08: /* F_CONTROL */
... ... @@ -925,10 +911,7 @@ static uint32_t omap_venc_read(void *opaque, target_phys_addr_t addr)
925 911 static void omap_venc_write(void *opaque, target_phys_addr_t addr,
926 912 uint32_t value)
927 913 {
928   - struct omap_dss_s *s = (struct omap_dss_s *) opaque;
929   - int offset = addr - s->venc_base;
930   -
931   - switch (offset) {
  914 + switch (addr) {
932 915 case 0x08: /* F_CONTROL */
933 916 case 0x10: /* VIDOUT_CTRL */
934 917 case 0x14: /* SYNC_CTRL */
... ... @@ -991,10 +974,7 @@ static CPUWriteMemoryFunc *omap_venc1_writefn[] = {
991 974  
992 975 static uint32_t omap_im3_read(void *opaque, target_phys_addr_t addr)
993 976 {
994   - struct omap_dss_s *s = (struct omap_dss_s *) opaque;
995   - int offset = addr - s->im3_base;
996   -
997   - switch (offset) {
  977 + switch (addr) {
998 978 case 0x0a8: /* SBIMERRLOGA */
999 979 case 0x0b0: /* SBIMERRLOG */
1000 980 case 0x190: /* SBIMSTATE */
... ... @@ -1016,10 +996,7 @@ static uint32_t omap_im3_read(void *opaque, target_phys_addr_t addr)
1016 996 static void omap_im3_write(void *opaque, target_phys_addr_t addr,
1017 997 uint32_t value)
1018 998 {
1019   - struct omap_dss_s *s = (struct omap_dss_s *) opaque;
1020   - int offset = addr - s->im3_base;
1021   -
1022   - switch (offset) {
  999 + switch (addr) {
1023 1000 case 0x0b0: /* SBIMERRLOG */
1024 1001 case 0x190: /* SBIMSTATE */
1025 1002 case 0x198: /* SBTMSTATE_L */
... ... @@ -1070,12 +1047,10 @@ struct omap_dss_s *omap_dss_init(struct omap_target_agent_s *ta,
1070 1047 omap_venc1_writefn, s);
1071 1048 iomemtype[4] = cpu_register_io_memory(0, omap_im3_readfn,
1072 1049 omap_im3_writefn, s);
1073   - s->diss_base = omap_l4_attach(ta, 0, iomemtype[0]);
1074   - s->disc_base = omap_l4_attach(ta, 1, iomemtype[1]);
1075   - s->rfbi_base = omap_l4_attach(ta, 2, iomemtype[2]);
1076   - s->venc_base = omap_l4_attach(ta, 3, iomemtype[3]);
1077   - s->im3_base = l3_base;
1078   - cpu_register_physical_memory(s->im3_base, 0x1000, iomemtype[4]);
  1050 + omap_l4_attach(ta, 0, iomemtype[0]);
  1051 + omap_l4_attach(ta, 1, iomemtype[1]);
  1052 + omap_l4_attach(ta, 3, iomemtype[3]);
  1053 + cpu_register_physical_memory(l3_base, 0x1000, iomemtype[4]);
1079 1054  
1080 1055 #if 0
1081 1056 if (ds)
... ...
hw/omap_i2c.c
... ... @@ -23,7 +23,6 @@
23 23 #include "omap.h"
24 24  
25 25 struct omap_i2c_s {
26   - target_phys_addr_t base;
27 26 qemu_irq irq;
28 27 qemu_irq drq[2];
29 28 i2c_slave slave;
... ... @@ -493,7 +492,6 @@ struct omap_i2c_s *omap_i2c_init(target_phys_addr_t base,
493 492  
494 493 /* TODO: set a value greater or equal to real hardware */
495 494 s->revision = 0x11;
496   - s->base = base;
497 495 s->irq = irq;
498 496 s->drq[0] = dma[0];
499 497 s->drq[1] = dma[1];
... ... @@ -505,7 +503,7 @@ struct omap_i2c_s *omap_i2c_init(target_phys_addr_t base,
505 503  
506 504 iomemtype = cpu_register_io_memory(0, omap_i2c_readfn,
507 505 omap_i2c_writefn, s);
508   - cpu_register_physical_memory(s->base, 0x800, iomemtype);
  506 + cpu_register_physical_memory(base, 0x800, iomemtype);
509 507  
510 508 return s;
511 509 }
... ... @@ -529,7 +527,7 @@ struct omap_i2c_s *omap2_i2c_init(struct omap_target_agent_s *ta,
529 527  
530 528 iomemtype = l4_register_io_memory(0, omap_i2c_readfn,
531 529 omap_i2c_writefn, s);
532   - s->base = omap_l4_attach(ta, 0, iomemtype);
  530 + omap_l4_attach(ta, 0, iomemtype);
533 531  
534 532 return s;
535 533 }
... ...
hw/omap_lcdc.c
... ... @@ -23,7 +23,6 @@
23 23 #include "omap.h"
24 24  
25 25 struct omap_lcd_panel_s {
26   - target_phys_addr_t base;
27 26 qemu_irq irq;
28 27 DisplayState *state;
29 28 QEMUConsole *console;
... ... @@ -366,9 +365,8 @@ static void omap_lcd_update(struct omap_lcd_panel_s *s) {
366 365 static uint32_t omap_lcdc_read(void *opaque, target_phys_addr_t addr)
367 366 {
368 367 struct omap_lcd_panel_s *s = (struct omap_lcd_panel_s *) opaque;
369   - int offset = addr - s->base;
370 368  
371   - switch (offset) {
  369 + switch (addr) {
372 370 case 0x00: /* LCD_CONTROL */
373 371 return (s->tft << 23) | (s->plm << 20) |
374 372 (s->tft << 7) | (s->interrupts << 3) |
... ... @@ -400,9 +398,8 @@ static void omap_lcdc_write(void *opaque, target_phys_addr_t addr,
400 398 uint32_t value)
401 399 {
402 400 struct omap_lcd_panel_s *s = (struct omap_lcd_panel_s *) opaque;
403   - int offset = addr - s->base;
404 401  
405   - switch (offset) {
  402 + switch (addr) {
406 403 case 0x00: /* LCD_CONTROL */
407 404 s->plm = (value >> 20) & 3;
408 405 s->tft = (value >> 7) & 1;
... ... @@ -485,7 +482,6 @@ struct omap_lcd_panel_s *omap_lcdc_init(target_phys_addr_t base, qemu_irq irq,
485 482  
486 483 s->irq = irq;
487 484 s->dma = dma;
488   - s->base = base;
489 485 s->state = ds;
490 486 s->imif_base = imif_base;
491 487 s->emiff_base = emiff_base;
... ... @@ -493,7 +489,7 @@ struct omap_lcd_panel_s *omap_lcdc_init(target_phys_addr_t base, qemu_irq irq,
493 489  
494 490 iomemtype = cpu_register_io_memory(0, omap_lcdc_readfn,
495 491 omap_lcdc_writefn, s);
496   - cpu_register_physical_memory(s->base, 0x100, iomemtype);
  492 + cpu_register_physical_memory(base, 0x100, iomemtype);
497 493  
498 494 s->console = graphic_console_init(ds, omap_update_display,
499 495 omap_invalidate_display,
... ...
hw/omap_mmc.c
... ... @@ -23,7 +23,6 @@
23 23 #include "sd.h"
24 24  
25 25 struct omap_mmc_s {
26   - target_phys_addr_t base;
27 26 qemu_irq irq;
28 27 qemu_irq *dma;
29 28 qemu_irq coverswitch;
... ... @@ -581,7 +580,6 @@ struct omap_mmc_s *omap_mmc_init(target_phys_addr_t base,
581 580 qemu_mallocz(sizeof(struct omap_mmc_s));
582 581  
583 582 s->irq = irq;
584   - s->base = base;
585 583 s->dma = dma;
586 584 s->clk = clk;
587 585 s->lines = 1; /* TODO: needs to be settable per-board */
... ... @@ -591,7 +589,7 @@ struct omap_mmc_s *omap_mmc_init(target_phys_addr_t base,
591 589  
592 590 iomemtype = cpu_register_io_memory(0, omap_mmc_readfn,
593 591 omap_mmc_writefn, s);
594   - cpu_register_physical_memory(s->base, 0x800, iomemtype);
  592 + cpu_register_physical_memory(base, 0x800, iomemtype);
595 593  
596 594 /* Instantiate the storage */
597 595 s->card = sd_init(bd, 0);
... ... @@ -617,7 +615,7 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
617 615  
618 616 iomemtype = l4_register_io_memory(0, omap_mmc_readfn,
619 617 omap_mmc_writefn, s);
620   - s->base = omap_l4_attach(ta, 0, iomemtype);
  618 + omap_l4_attach(ta, 0, iomemtype);
621 619  
622 620 /* Instantiate the storage */
623 621 s->card = sd_init(bd, 0);
... ...
hw/onenand.c
... ... @@ -113,8 +113,8 @@ void onenand_base_update(void *opaque, target_phys_addr_t new)
113 113 0xbe00 << s->shift,
114 114 (s->ram +(0x0200 << s->shift)) | IO_MEM_RAM);
115 115 if (s->iomemtype)
116   - cpu_register_physical_memory(s->base + (0xc000 << s->shift),
117   - 0x4000 << s->shift, s->iomemtype);
  116 + cpu_register_physical_memory_offset(s->base + (0xc000 << s->shift),
  117 + 0x4000 << s->shift, s->iomemtype, (0xc000 << s->shift));
118 118 }
119 119  
120 120 void onenand_base_unmap(void *opaque)
... ... @@ -449,11 +449,11 @@ static void onenand_command(struct onenand_s *s, int cmd)
449 449 static uint32_t onenand_read(void *opaque, target_phys_addr_t addr)
450 450 {
451 451 struct onenand_s *s = (struct onenand_s *) opaque;
452   - int offset = (addr - s->base) >> s->shift;
  452 + int offset = addr >> s->shift;
453 453  
454 454 switch (offset) {
455 455 case 0x0000 ... 0xc000:
456   - return lduw_le_p(s->boot[0] + (addr - s->base));
  456 + return lduw_le_p(s->boot[0] + addr);
457 457  
458 458 case 0xf000: /* Manufacturer ID */
459 459 return (s->id >> 16) & 0xff;
... ... @@ -514,7 +514,7 @@ static void onenand_write(void *opaque, target_phys_addr_t addr,
514 514 uint32_t value)
515 515 {
516 516 struct onenand_s *s = (struct onenand_s *) opaque;
517   - int offset = (addr - s->base) >> s->shift;
  517 + int offset = addr >> s->shift;
518 518 int sec;
519 519  
520 520 switch (offset) {
... ...
hw/parallel.c
... ... @@ -75,7 +75,6 @@ struct ParallelState {
75 75 int epp_timeout;
76 76 uint32_t last_read_offset; /* For debugging */
77 77 /* Memory-mapped interface */
78   - target_phys_addr_t base;
79 78 int it_shift;
80 79 };
81 80  
... ... @@ -477,7 +476,7 @@ static uint32_t parallel_mm_readb (void *opaque, target_phys_addr_t addr)
477 476 {
478 477 ParallelState *s = opaque;
479 478  
480   - return parallel_ioport_read_sw(s, (addr - s->base) >> s->it_shift) & 0xFF;
  479 + return parallel_ioport_read_sw(s, addr >> s->it_shift) & 0xFF;
481 480 }
482 481  
483 482 static void parallel_mm_writeb (void *opaque,
... ... @@ -485,14 +484,14 @@ static void parallel_mm_writeb (void *opaque,
485 484 {
486 485 ParallelState *s = opaque;
487 486  
488   - parallel_ioport_write_sw(s, (addr - s->base) >> s->it_shift, value & 0xFF);
  487 + parallel_ioport_write_sw(s, addr >> s->it_shift, value & 0xFF);
489 488 }
490 489  
491 490 static uint32_t parallel_mm_readw (void *opaque, target_phys_addr_t addr)
492 491 {
493 492 ParallelState *s = opaque;
494 493  
495   - return parallel_ioport_read_sw(s, (addr - s->base) >> s->it_shift) & 0xFFFF;
  494 + return parallel_ioport_read_sw(s, addr >> s->it_shift) & 0xFFFF;
496 495 }
497 496  
498 497 static void parallel_mm_writew (void *opaque,
... ... @@ -500,14 +499,14 @@ static void parallel_mm_writew (void *opaque,
500 499 {
501 500 ParallelState *s = opaque;
502 501  
503   - parallel_ioport_write_sw(s, (addr - s->base) >> s->it_shift, value & 0xFFFF);
  502 + parallel_ioport_write_sw(s, addr >> s->it_shift, value & 0xFFFF);
504 503 }
505 504  
506 505 static uint32_t parallel_mm_readl (void *opaque, target_phys_addr_t addr)
507 506 {
508 507 ParallelState *s = opaque;
509 508  
510   - return parallel_ioport_read_sw(s, (addr - s->base) >> s->it_shift);
  509 + return parallel_ioport_read_sw(s, addr >> s->it_shift);
511 510 }
512 511  
513 512 static void parallel_mm_writel (void *opaque,
... ... @@ -515,7 +514,7 @@ static void parallel_mm_writel (void *opaque,
515 514 {
516 515 ParallelState *s = opaque;
517 516  
518   - parallel_ioport_write_sw(s, (addr - s->base) >> s->it_shift, value);
  517 + parallel_ioport_write_sw(s, addr >> s->it_shift, value);
519 518 }
520 519  
521 520 static CPUReadMemoryFunc *parallel_mm_read_sw[] = {
... ... @@ -540,7 +539,6 @@ ParallelState *parallel_mm_init(target_phys_addr_t base, int it_shift, qemu_irq
540 539 if (!s)
541 540 return NULL;
542 541 parallel_reset(s, irq, chr);
543   - s->base = base;
544 542 s->it_shift = it_shift;
545 543  
546 544 io_sw = cpu_register_io_memory(0, parallel_mm_read_sw, parallel_mm_write_sw, s);
... ...
hw/pckbd.c
... ... @@ -125,7 +125,6 @@ typedef struct KBDState {
125 125  
126 126 qemu_irq irq_kbd;
127 127 qemu_irq irq_mouse;
128   - target_phys_addr_t base;
129 128 int it_shift;
130 129 } KBDState;
131 130  
... ... @@ -392,7 +391,7 @@ static uint32_t kbd_mm_readb (void *opaque, target_phys_addr_t addr)
392 391 {
393 392 KBDState *s = opaque;
394 393  
395   - switch ((addr - s->base) >> s->it_shift) {
  394 + switch (addr >> s->it_shift) {
396 395 case 0:
397 396 return kbd_read_data(s, 0) & 0xff;
398 397 case 1:
... ... @@ -406,7 +405,7 @@ static void kbd_mm_writeb (void *opaque, target_phys_addr_t addr, uint32_t value
406 405 {
407 406 KBDState *s = opaque;
408 407  
409   - switch ((addr - s->base) >> s->it_shift) {
  408 + switch (addr >> s->it_shift) {
410 409 case 0:
411 410 kbd_write_data(s, 0, value & 0xff);
412 411 break;
... ... @@ -436,7 +435,6 @@ void i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
436 435  
437 436 s->irq_kbd = kbd_irq;
438 437 s->irq_mouse = mouse_irq;
439   - s->base = base;
440 438 s->it_shift = it_shift;
441 439  
442 440 kbd_reset(s);
... ...
hw/pflash_cfi01.c
... ... @@ -103,7 +103,6 @@ static uint32_t pflash_read (pflash_t *pfl, target_ulong offset, int width)
103 103 uint8_t *p;
104 104  
105 105 ret = -1;
106   - offset -= pfl->base;
107 106 boff = offset & 0xFF; /* why this here ?? */
108 107  
109 108 if (pfl->width == 2)
... ... @@ -203,7 +202,6 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value,
203 202 uint8_t cmd;
204 203  
205 204 cmd = value;
206   - offset -= pfl->base;
207 205  
208 206 DPRINTF("%s: writing offset " TARGET_FMT_lx " value %08x width %d wcycle 0x%x\n",
209 207 __func__, offset, value, width, pfl->wcycle);
... ...
hw/pflash_cfi02.c
... ... @@ -112,7 +112,6 @@ static uint32_t pflash_read (pflash_t *pfl, uint32_t offset, int width)
112 112  
113 113 DPRINTF("%s: offset " TARGET_FMT_lx "\n", __func__, offset);
114 114 ret = -1;
115   - offset -= pfl->base;
116 115 if (pfl->rom_mode) {
117 116 /* Lazy reset of to ROMD mode */
118 117 if (pfl->wcycle == 0)
... ... @@ -241,7 +240,6 @@ static void pflash_write (pflash_t *pfl, uint32_t offset, uint32_t value,
241 240 }
242 241 DPRINTF("%s: offset " TARGET_FMT_lx " %08x %d %d\n", __func__,
243 242 offset, value, width, pfl->wcycle);
244   - offset -= pfl->base;
245 243 offset &= pfl->chip_len - 1;
246 244  
247 245 DPRINTF("%s: offset " TARGET_FMT_lx " %08x %d\n", __func__,
... ...
hw/pl011.c
... ... @@ -12,7 +12,6 @@
12 12 #include "primecell.h"
13 13  
14 14 typedef struct {
15   - uint32_t base;
16 15 uint32_t readbuff;
17 16 uint32_t flags;
18 17 uint32_t lcr;
... ... @@ -59,7 +58,6 @@ static uint32_t pl011_read(void *opaque, target_phys_addr_t offset)
59 58 pl011_state *s = (pl011_state *)opaque;
60 59 uint32_t c;
61 60  
62   - offset -= s->base;
63 61 if (offset >= 0xfe0 && offset < 0x1000) {
64 62 return pl011_id[s->type][(offset - 0xfe0) >> 2];
65 63 }
... ... @@ -130,7 +128,6 @@ static void pl011_write(void *opaque, target_phys_addr_t offset,
130 128 pl011_state *s = (pl011_state *)opaque;
131 129 unsigned char ch;
132 130  
133   - offset -= s->base;
134 131 switch (offset >> 2) {
135 132 case 0: /* UARTDR */
136 133 /* ??? Check if transmitter is enabled. */
... ... @@ -299,7 +296,6 @@ void pl011_init(uint32_t base, qemu_irq irq,
299 296 iomemtype = cpu_register_io_memory(0, pl011_readfn,
300 297 pl011_writefn, s);
301 298 cpu_register_physical_memory(base, 0x00001000, iomemtype);
302   - s->base = base;
303 299 s->irq = irq;
304 300 s->type = type;
305 301 s->chr = chr;
... ...
hw/pl022.c
... ... @@ -40,7 +40,6 @@ do { fprintf(stderr, &quot;pl022: error: &quot; fmt , ##args);} while (0)
40 40 #define PL022_INT_TX 0x08
41 41  
42 42 typedef struct {
43   - uint32_t base;
44 43 uint32_t cr0;
45 44 uint32_t cr1;
46 45 uint32_t bitmask;
... ... @@ -137,7 +136,6 @@ static uint32_t pl022_read(void *opaque, target_phys_addr_t offset)
137 136 pl022_state *s = (pl022_state *)opaque;
138 137 int val;
139 138  
140   - offset -= s->base;
141 139 if (offset >= 0xfe0 && offset < 0x1000) {
142 140 return pl022_id[(offset - 0xfe0) >> 2];
143 141 }
... ... @@ -181,7 +179,6 @@ static void pl022_write(void *opaque, target_phys_addr_t offset,
181 179 {
182 180 pl022_state *s = (pl022_state *)opaque;
183 181  
184   - offset -= s->base;
185 182 switch (offset) {
186 183 case 0x00: /* CR0 */
187 184 s->cr0 = value;
... ... @@ -303,7 +300,6 @@ void pl022_init(uint32_t base, qemu_irq irq, int (*xfer_cb)(void *, int),
303 300 iomemtype = cpu_register_io_memory(0, pl022_readfn,
304 301 pl022_writefn, s);
305 302 cpu_register_physical_memory(base, 0x00001000, iomemtype);
306   - s->base = base;
307 303 s->irq = irq;
308 304 s->xfer_cb = xfer_cb;
309 305 s->opaque = opaque;
... ...
hw/pl031.c
... ... @@ -35,7 +35,6 @@ do { printf(&quot;pl031: &quot; fmt , ##args); } while (0)
35 35 typedef struct {
36 36 QEMUTimer *timer;
37 37 qemu_irq irq;
38   - uint32_t base;
39 38  
40 39 uint64_t start_time;
41 40 uint32_t tick_offset;
... ... @@ -97,8 +96,6 @@ static uint32_t pl031_read(void *opaque, target_phys_addr_t offset)
97 96 {
98 97 pl031_state *s = (pl031_state *)opaque;
99 98  
100   - offset -= s->base;
101   -
102 99 if (offset >= 0xfe0 && offset < 0x1000)
103 100 return pl031_id[(offset - 0xfe0) >> 2];
104 101  
... ... @@ -136,7 +133,6 @@ static void pl031_write(void * opaque, target_phys_addr_t offset,
136 133 {
137 134 pl031_state *s = (pl031_state *)opaque;
138 135  
139   - offset -= s->base;
140 136  
141 137 switch (offset) {
142 138 case RTC_LR:
... ... @@ -207,7 +203,6 @@ void pl031_init(uint32_t base, qemu_irq irq)
207 203  
208 204 cpu_register_physical_memory(base, 0x00001000, iomemtype);
209 205  
210   - s->base = base;
211 206 s->irq = irq;
212 207 /* ??? We assume vm_clock is zero at this point. */
213 208 qemu_get_timedate(&tm, 0);
... ...
hw/pl050.c
... ... @@ -13,7 +13,6 @@
13 13  
14 14 typedef struct {
15 15 void *dev;
16   - uint32_t base;
17 16 uint32_t cr;
18 17 uint32_t clk;
19 18 uint32_t last;
... ... @@ -47,7 +46,6 @@ static void pl050_update(void *opaque, int level)
47 46 static uint32_t pl050_read(void *opaque, target_phys_addr_t offset)
48 47 {
49 48 pl050_state *s = (pl050_state *)opaque;
50   - offset -= s->base;
51 49 if (offset >= 0xfe0 && offset < 0x1000)
52 50 return pl050_id[(offset - 0xfe0) >> 2];
53 51  
... ... @@ -90,7 +88,6 @@ static void pl050_write(void *opaque, target_phys_addr_t offset,
90 88 uint32_t value)
91 89 {
92 90 pl050_state *s = (pl050_state *)opaque;
93   - offset -= s->base;
94 91 switch (offset >> 2) {
95 92 case 0: /* KMICR */
96 93 s->cr = value;
... ... @@ -134,7 +131,6 @@ void pl050_init(uint32_t base, qemu_irq irq, int is_mouse)
134 131 iomemtype = cpu_register_io_memory(0, pl050_readfn,
135 132 pl050_writefn, s);
136 133 cpu_register_physical_memory(base, 0x00001000, iomemtype);
137   - s->base = base;
138 134 s->irq = irq;
139 135 s->is_mouse = is_mouse;
140 136 if (is_mouse)
... ...
hw/pl061.c
... ... @@ -28,7 +28,6 @@ static const uint8_t pl061_id[12] =
28 28 { 0x00, 0x00, 0x00, 0x00, 0x61, 0x00, 0x18, 0x01, 0x0d, 0xf0, 0x05, 0xb1 };
29 29  
30 30 typedef struct {
31   - uint32_t base;
32 31 int locked;
33 32 uint8_t data;
34 33 uint8_t old_data;
... ... @@ -83,7 +82,6 @@ static uint32_t pl061_read(void *opaque, target_phys_addr_t offset)
83 82 {
84 83 pl061_state *s = (pl061_state *)opaque;
85 84  
86   - offset -= s->base;
87 85 if (offset >= 0xfd0 && offset < 0x1000) {
88 86 return pl061_id[(offset - 0xfd0) >> 2];
89 87 }
... ... @@ -140,7 +138,6 @@ static void pl061_write(void *opaque, target_phys_addr_t offset,
140 138 pl061_state *s = (pl061_state *)opaque;
141 139 uint8_t mask;
142 140  
143   - offset -= s->base;
144 141 if (offset < 0x400) {
145 142 mask = (offset >> 2) & s->dir;
146 143 s->data = (s->data & ~mask) | (value & mask);
... ... @@ -306,7 +303,6 @@ qemu_irq *pl061_init(uint32_t base, qemu_irq irq, qemu_irq **out)
306 303 iomemtype = cpu_register_io_memory(0, pl061_readfn,
307 304 pl061_writefn, s);
308 305 cpu_register_physical_memory(base, 0x00001000, iomemtype);
309   - s->base = base;
310 306 s->irq = irq;
311 307 pl061_reset(s);
312 308 if (out)
... ...
hw/pl080.c
... ... @@ -37,7 +37,6 @@ typedef struct {
37 37 } pl080_channel;
38 38  
39 39 typedef struct {
40   - uint32_t base;
41 40 uint8_t tc_int;
42 41 uint8_t tc_mask;
43 42 uint8_t err_int;
... ... @@ -187,7 +186,6 @@ static uint32_t pl080_read(void *opaque, target_phys_addr_t offset)
187 186 uint32_t i;
188 187 uint32_t mask;
189 188  
190   - offset -= s->base;
191 189 if (offset >= 0xfe0 && offset < 0x1000) {
192 190 if (s->nchannels == 8) {
193 191 return pl080_id[(offset - 0xfe0) >> 2];
... ... @@ -255,7 +253,6 @@ static void pl080_write(void *opaque, target_phys_addr_t offset,
255 253 pl080_state *s = (pl080_state *)opaque;
256 254 int i;
257 255  
258   - offset -= s->base;
259 256 if (offset >= 0x100 && offset < 0x200) {
260 257 i = (offset & 0xe0) >> 5;
261 258 if (i >= s->nchannels)
... ... @@ -334,7 +331,6 @@ void *pl080_init(uint32_t base, qemu_irq irq, int nchannels)
334 331 iomemtype = cpu_register_io_memory(0, pl080_readfn,
335 332 pl080_writefn, s);
336 333 cpu_register_physical_memory(base, 0x00001000, iomemtype);
337   - s->base = base;
338 334 s->irq = irq;
339 335 s->nchannels = nchannels;
340 336 /* ??? Save/restore. */
... ...
hw/pl110.c
... ... @@ -28,7 +28,6 @@ enum pl110_bppmode
28 28 };
29 29  
30 30 typedef struct {
31   - uint32_t base;
32 31 DisplayState *ds;
33 32 QEMUConsole *console;
34 33  
... ... @@ -289,7 +288,6 @@ static uint32_t pl110_read(void *opaque, target_phys_addr_t offset)
289 288 {
290 289 pl110_state *s = (pl110_state *)opaque;
291 290  
292   - offset -= s->base;
293 291 if (offset >= 0xfe0 && offset < 0x1000) {
294 292 if (s->versatile)
295 293 return pl110_versatile_id[(offset - 0xfe0) >> 2];
... ... @@ -344,7 +342,6 @@ static void pl110_write(void *opaque, target_phys_addr_t offset,
344 342 /* For simplicity invalidate the display whenever a control register
345 343 is writen to. */
346 344 s->invalidate = 1;
347   - offset -= s->base;
348 345 if (offset >= 0x200 && offset < 0x400) {
349 346 /* Pallette. */
350 347 n = (offset - 0x200) >> 2;
... ... @@ -423,7 +420,6 @@ void *pl110_init(DisplayState *ds, uint32_t base, qemu_irq irq,
423 420 iomemtype = cpu_register_io_memory(0, pl110_readfn,
424 421 pl110_writefn, s);
425 422 cpu_register_physical_memory(base, 0x00001000, iomemtype);
426   - s->base = base;
427 423 s->ds = ds;
428 424 s->versatile = versatile;
429 425 s->irq = irq;
... ...
hw/pl181.c
... ... @@ -24,7 +24,6 @@ do { printf(&quot;pl181: &quot; fmt , ##args); } while (0)
24 24  
25 25 typedef struct {
26 26 SDState *card;
27   - uint32_t base;
28 27 uint32_t clock;
29 28 uint32_t power;
30 29 uint32_t cmdarg;
... ... @@ -261,7 +260,6 @@ static uint32_t pl181_read(void *opaque, target_phys_addr_t offset)
261 260 pl181_state *s = (pl181_state *)opaque;
262 261 uint32_t tmp;
263 262  
264   - offset -= s->base;
265 263 if (offset >= 0xfe0 && offset < 0x1000) {
266 264 return pl181_id[(offset - 0xfe0) >> 2];
267 265 }
... ... @@ -344,7 +342,6 @@ static void pl181_write(void *opaque, target_phys_addr_t offset,
344 342 {
345 343 pl181_state *s = (pl181_state *)opaque;
346 344  
347   - offset -= s->base;
348 345 switch (offset) {
349 346 case 0x00: /* Power */
350 347 s->power = value & 0xff;
... ... @@ -457,7 +454,6 @@ void pl181_init(uint32_t base, BlockDriverState *bd,
457 454 iomemtype = cpu_register_io_memory(0, pl181_readfn,
458 455 pl181_writefn, s);
459 456 cpu_register_physical_memory(base, 0x00001000, iomemtype);
460   - s->base = base;
461 457 s->card = sd_init(bd, 0);
462 458 s->irq[0] = irq0;
463 459 s->irq[1] = irq1;
... ...
hw/pl190.c
... ... @@ -18,7 +18,6 @@
18 18 #define PL190_NUM_PRIO 17
19 19  
20 20 typedef struct {
21   - uint32_t base;
22 21 uint32_t level;
23 22 uint32_t soft_level;
24 23 uint32_t irq_enable;
... ... @@ -92,7 +91,6 @@ static uint32_t pl190_read(void *opaque, target_phys_addr_t offset)
92 91 pl190_state *s = (pl190_state *)opaque;
93 92 int i;
94 93  
95   - offset -= s->base;
96 94 if (offset >= 0xfe0 && offset < 0x1000) {
97 95 return pl190_id[(offset - 0xfe0) >> 2];
98 96 }
... ... @@ -148,7 +146,6 @@ static void pl190_write(void *opaque, target_phys_addr_t offset, uint32_t val)
148 146 {
149 147 pl190_state *s = (pl190_state *)opaque;
150 148  
151   - offset -= s->base;
152 149 if (offset >= 0x100 && offset < 0x140) {
153 150 s->vect_addr[(offset - 0x100) >> 2] = val;
154 151 pl190_update_vectors(s);
... ... @@ -241,7 +238,6 @@ qemu_irq *pl190_init(uint32_t base, qemu_irq irq, qemu_irq fiq)
241 238 pl190_writefn, s);
242 239 cpu_register_physical_memory(base, 0x00001000, iomemtype);
243 240 qi = qemu_allocate_irqs(pl190_set_irq, s, 32);
244   - s->base = base;
245 241 s->irq = irq;
246 242 s->fiq = fiq;
247 243 pl190_reset(s);
... ...
hw/ppc405_boards.c
... ... @@ -54,7 +54,6 @@
54 54 */
55 55 typedef struct ref405ep_fpga_t ref405ep_fpga_t;
56 56 struct ref405ep_fpga_t {
57   - uint32_t base;
58 57 uint8_t reg0;
59 58 uint8_t reg1;
60 59 };
... ... @@ -65,7 +64,6 @@ static uint32_t ref405ep_fpga_readb (void *opaque, target_phys_addr_t addr)
65 64 uint32_t ret;
66 65  
67 66 fpga = opaque;
68   - addr -= fpga->base;
69 67 switch (addr) {
70 68 case 0x0:
71 69 ret = fpga->reg0;
... ... @@ -87,7 +85,6 @@ static void ref405ep_fpga_writeb (void *opaque,
87 85 ref405ep_fpga_t *fpga;
88 86  
89 87 fpga = opaque;
90   - addr -= fpga->base;
91 88 switch (addr) {
92 89 case 0x0:
93 90 /* Read only */
... ... @@ -166,7 +163,6 @@ static void ref405ep_fpga_init (uint32_t base)
166 163  
167 164 fpga = qemu_mallocz(sizeof(ref405ep_fpga_t));
168 165 if (fpga != NULL) {
169   - fpga->base = base;
170 166 fpga_memory = cpu_register_io_memory(0, ref405ep_fpga_read,
171 167 ref405ep_fpga_write, fpga);
172 168 cpu_register_physical_memory(base, 0x00000100, fpga_memory);
... ... @@ -382,7 +378,6 @@ QEMUMachine ref405ep_machine = {
382 378 */
383 379 typedef struct taihu_cpld_t taihu_cpld_t;
384 380 struct taihu_cpld_t {
385   - uint32_t base;
386 381 uint8_t reg0;
387 382 uint8_t reg1;
388 383 };
... ... @@ -393,7 +388,6 @@ static uint32_t taihu_cpld_readb (void *opaque, target_phys_addr_t addr)
393 388 uint32_t ret;
394 389  
395 390 cpld = opaque;
396   - addr -= cpld->base;
397 391 switch (addr) {
398 392 case 0x0:
399 393 ret = cpld->reg0;
... ... @@ -415,7 +409,6 @@ static void taihu_cpld_writeb (void *opaque,
415 409 taihu_cpld_t *cpld;
416 410  
417 411 cpld = opaque;
418   - addr -= cpld->base;
419 412 switch (addr) {
420 413 case 0x0:
421 414 /* Read only */
... ... @@ -494,7 +487,6 @@ static void taihu_cpld_init (uint32_t base)
494 487  
495 488 cpld = qemu_mallocz(sizeof(taihu_cpld_t));
496 489 if (cpld != NULL) {
497   - cpld->base = base;
498 490 cpld_memory = cpu_register_io_memory(0, taihu_cpld_read,
499 491 taihu_cpld_write, cpld);
500 492 cpu_register_physical_memory(base, 0x00000100, cpld_memory);
... ...
hw/ppc4xx_devs.c
... ... @@ -115,13 +115,13 @@ static uint32_t mmio_readlen (ppc4xx_mmio_t *mmio,
115 115 uint32_t ret;
116 116 int idx;
117 117  
118   - idx = MMIO_IDX(addr - mmio->base);
  118 + idx = MMIO_IDX(addr);
119 119 #if defined(DEBUG_MMIO)
120 120 printf("%s: mmio %p len %d addr " PADDRX " idx %d\n", __func__,
121 121 mmio, len, addr, idx);
122 122 #endif
123 123 mem_read = mmio->mem_read[idx];
124   - ret = (*mem_read[len])(mmio->opaque[idx], addr - mmio->base);
  124 + ret = (*mem_read[len])(mmio->opaque[idx], addr);
125 125  
126 126 return ret;
127 127 }
... ... @@ -132,13 +132,13 @@ static void mmio_writelen (ppc4xx_mmio_t *mmio,
132 132 CPUWriteMemoryFunc **mem_write;
133 133 int idx;
134 134  
135   - idx = MMIO_IDX(addr - mmio->base);
  135 + idx = MMIO_IDX(addr);
136 136 #if defined(DEBUG_MMIO)
137 137 printf("%s: mmio %p len %d addr " PADDRX " idx %d value %08" PRIx32 "\n",
138 138 __func__, mmio, len, addr, idx, value);
139 139 #endif
140 140 mem_write = mmio->mem_write[idx];
141   - (*mem_write[len])(mmio->opaque[idx], addr - mmio->base, value);
  141 + (*mem_write[len])(mmio->opaque[idx], addr, value);
142 142 }
143 143  
144 144 static uint32_t mmio_readb (void *opaque, target_phys_addr_t addr)
... ...
hw/ppc_prep.c
... ... @@ -122,7 +122,7 @@ static always_inline uint32_t _PPC_intack_read (target_phys_addr_t addr)
122 122 {
123 123 uint32_t retval = 0;
124 124  
125   - if (addr == 0xBFFFFFF0)
  125 + if (addr & 0xf == 0)
126 126 retval = pic_intack_read(isa_pic);
127 127 // printf("%s: 0x" PADDRX " <= %08" PRIx32 "\n", __func__, addr, retval);
128 128  
... ...
hw/pxa.h
... ... @@ -192,7 +192,6 @@ struct pxa2xx_state_s {
192 192 };
193 193  
194 194 struct pxa2xx_i2s_s {
195   - target_phys_addr_t base;
196 195 qemu_irq irq;
197 196 struct pxa2xx_dma_state_s *dma;
198 197 void (*data_req)(void *, int, int);
... ...
hw/pxa2xx.c
... ... @@ -90,7 +90,6 @@ static PXASSPDef pxa27x_ssp[] = {
90 90 static uint32_t pxa2xx_pm_read(void *opaque, target_phys_addr_t addr)
91 91 {
92 92 struct pxa2xx_state_s *s = (struct pxa2xx_state_s *) opaque;
93   - addr -= s->pm_base;
94 93  
95 94 switch (addr) {
96 95 case PMCR ... PCMD31:
... ... @@ -110,7 +109,6 @@ static void pxa2xx_pm_write(void *opaque, target_phys_addr_t addr,
110 109 uint32_t value)
111 110 {
112 111 struct pxa2xx_state_s *s = (struct pxa2xx_state_s *) opaque;
113   - addr -= s->pm_base;
114 112  
115 113 switch (addr) {
116 114 case PMCR:
... ... @@ -175,7 +173,6 @@ static int pxa2xx_pm_load(QEMUFile *f, void *opaque, int version_id)
175 173 static uint32_t pxa2xx_cm_read(void *opaque, target_phys_addr_t addr)
176 174 {
177 175 struct pxa2xx_state_s *s = (struct pxa2xx_state_s *) opaque;
178   - addr -= s->cm_base;
179 176  
180 177 switch (addr) {
181 178 case CCCR:
... ... @@ -197,7 +194,6 @@ static void pxa2xx_cm_write(void *opaque, target_phys_addr_t addr,
197 194 uint32_t value)
198 195 {
199 196 struct pxa2xx_state_s *s = (struct pxa2xx_state_s *) opaque;
200   - addr -= s->cm_base;
201 197  
202 198 switch (addr) {
203 199 case CCCR:
... ... @@ -487,7 +483,6 @@ static void pxa2xx_cp14_write(void *opaque, int op2, int reg, int crm,
487 483 static uint32_t pxa2xx_mm_read(void *opaque, target_phys_addr_t addr)
488 484 {
489 485 struct pxa2xx_state_s *s = (struct pxa2xx_state_s *) opaque;
490   - addr -= s->mm_base;
491 486  
492 487 switch (addr) {
493 488 case MDCNFG ... SA1110:
... ... @@ -505,7 +500,6 @@ static void pxa2xx_mm_write(void *opaque, target_phys_addr_t addr,
505 500 uint32_t value)
506 501 {
507 502 struct pxa2xx_state_s *s = (struct pxa2xx_state_s *) opaque;
508   - addr -= s->mm_base;
509 503  
510 504 switch (addr) {
511 505 case MDCNFG ... SA1110:
... ... @@ -554,7 +548,6 @@ static int pxa2xx_mm_load(QEMUFile *f, void *opaque, int version_id)
554 548  
555 549 /* Synchronous Serial Ports */
556 550 struct pxa2xx_ssp_s {
557   - target_phys_addr_t base;
558 551 qemu_irq irq;
559 552 int enable;
560 553  
... ... @@ -668,7 +661,6 @@ static uint32_t pxa2xx_ssp_read(void *opaque, target_phys_addr_t addr)
668 661 {
669 662 struct pxa2xx_ssp_s *s = (struct pxa2xx_ssp_s *) opaque;
670 663 uint32_t retval;
671   - addr -= s->base;
672 664  
673 665 switch (addr) {
674 666 case SSCR0:
... ... @@ -714,7 +706,6 @@ static void pxa2xx_ssp_write(void *opaque, target_phys_addr_t addr,
714 706 uint32_t value)
715 707 {
716 708 struct pxa2xx_ssp_s *s = (struct pxa2xx_ssp_s *) opaque;
717   - addr -= s->base;
718 709  
719 710 switch (addr) {
720 711 case SSCR0:
... ... @@ -1022,7 +1013,6 @@ static inline void pxa2xx_rtc_pi_tick(void *opaque)
1022 1013 static uint32_t pxa2xx_rtc_read(void *opaque, target_phys_addr_t addr)
1023 1014 {
1024 1015 struct pxa2xx_state_s *s = (struct pxa2xx_state_s *) opaque;
1025   - addr -= s->rtc_base;
1026 1016  
1027 1017 switch (addr) {
1028 1018 case RTTR:
... ... @@ -1069,7 +1059,6 @@ static void pxa2xx_rtc_write(void *opaque, target_phys_addr_t addr,
1069 1059 uint32_t value)
1070 1060 {
1071 1061 struct pxa2xx_state_s *s = (struct pxa2xx_state_s *) opaque;
1072   - addr -= s->rtc_base;
1073 1062  
1074 1063 switch (addr) {
1075 1064 case RTTR:
... ... @@ -1270,7 +1259,6 @@ static int pxa2xx_rtc_load(QEMUFile *f, void *opaque, int version_id)
1270 1259 struct pxa2xx_i2c_s {
1271 1260 i2c_slave slave;
1272 1261 i2c_bus *bus;
1273   - target_phys_addr_t base;
1274 1262 qemu_irq irq;
1275 1263  
1276 1264 uint16_t control;
... ... @@ -1351,8 +1339,8 @@ static int pxa2xx_i2c_tx(i2c_slave *i2c, uint8_t data)
1351 1339 static uint32_t pxa2xx_i2c_read(void *opaque, target_phys_addr_t addr)
1352 1340 {
1353 1341 struct pxa2xx_i2c_s *s = (struct pxa2xx_i2c_s *) opaque;
1354   - addr -= s->base;
1355 1342  
  1343 + addr &= 0xff;
1356 1344 switch (addr) {
1357 1345 case ICR:
1358 1346 return s->control;
... ... @@ -1380,8 +1368,8 @@ static void pxa2xx_i2c_write(void *opaque, target_phys_addr_t addr,
1380 1368 {
1381 1369 struct pxa2xx_i2c_s *s = (struct pxa2xx_i2c_s *) opaque;
1382 1370 int ack;
1383   - addr -= s->base;
1384 1371  
  1372 + addr &= 0xff;
1385 1373 switch (addr) {
1386 1374 case ICR:
1387 1375 s->control = value & 0xfff7;
... ... @@ -1493,7 +1481,6 @@ struct pxa2xx_i2c_s *pxa2xx_i2c_init(target_phys_addr_t base,
1493 1481 struct pxa2xx_i2c_s *s = (struct pxa2xx_i2c_s *)
1494 1482 i2c_slave_init(i2c_init_bus(), 0, sizeof(struct pxa2xx_i2c_s));
1495 1483  
1496   - s->base = base;
1497 1484 s->irq = irq;
1498 1485 s->slave.event = pxa2xx_i2c_event;
1499 1486 s->slave.recv = pxa2xx_i2c_rx;
... ... @@ -1502,7 +1489,7 @@ struct pxa2xx_i2c_s *pxa2xx_i2c_init(target_phys_addr_t base,
1502 1489  
1503 1490 iomemtype = cpu_register_io_memory(0, pxa2xx_i2c_readfn,
1504 1491 pxa2xx_i2c_writefn, s);
1505   - cpu_register_physical_memory(s->base & ~page_size, page_size, iomemtype);
  1492 + cpu_register_physical_memory(base & ~page_size, page_size + 1, iomemtype);
1506 1493  
1507 1494 register_savevm("pxa2xx_i2c", base, 1,
1508 1495 pxa2xx_i2c_save, pxa2xx_i2c_load, s);
... ... @@ -1573,7 +1560,6 @@ static inline void pxa2xx_i2s_update(struct pxa2xx_i2s_s *i2s)
1573 1560 static uint32_t pxa2xx_i2s_read(void *opaque, target_phys_addr_t addr)
1574 1561 {
1575 1562 struct pxa2xx_i2s_s *s = (struct pxa2xx_i2s_s *) opaque;
1576   - addr -= s->base;
1577 1563  
1578 1564 switch (addr) {
1579 1565 case SACR0:
... ... @@ -1607,7 +1593,6 @@ static void pxa2xx_i2s_write(void *opaque, target_phys_addr_t addr,
1607 1593 {
1608 1594 struct pxa2xx_i2s_s *s = (struct pxa2xx_i2s_s *) opaque;
1609 1595 uint32_t *sample;
1610   - addr -= s->base;
1611 1596  
1612 1597 switch (addr) {
1613 1598 case SACR0:
... ... @@ -1733,7 +1718,6 @@ static struct pxa2xx_i2s_s *pxa2xx_i2s_init(target_phys_addr_t base,
1733 1718 struct pxa2xx_i2s_s *s = (struct pxa2xx_i2s_s *)
1734 1719 qemu_mallocz(sizeof(struct pxa2xx_i2s_s));
1735 1720  
1736   - s->base = base;
1737 1721 s->irq = irq;
1738 1722 s->dma = dma;
1739 1723 s->data_req = pxa2xx_i2s_data_req;
... ... @@ -1742,7 +1726,7 @@ static struct pxa2xx_i2s_s *pxa2xx_i2s_init(target_phys_addr_t base,
1742 1726  
1743 1727 iomemtype = cpu_register_io_memory(0, pxa2xx_i2s_readfn,
1744 1728 pxa2xx_i2s_writefn, s);
1745   - cpu_register_physical_memory(s->base & 0xfff00000, 0x100000, iomemtype);
  1729 + cpu_register_physical_memory(base, 0x100000, iomemtype);
1746 1730  
1747 1731 register_savevm("pxa2xx_i2s", base, 0,
1748 1732 pxa2xx_i2s_save, pxa2xx_i2s_load, s);
... ... @@ -1752,7 +1736,6 @@ static struct pxa2xx_i2s_s *pxa2xx_i2s_init(target_phys_addr_t base,
1752 1736  
1753 1737 /* PXA Fast Infra-red Communications Port */
1754 1738 struct pxa2xx_fir_s {
1755   - target_phys_addr_t base;
1756 1739 qemu_irq irq;
1757 1740 struct pxa2xx_dma_state_s *dma;
1758 1741 int enable;
... ... @@ -1826,7 +1809,6 @@ static uint32_t pxa2xx_fir_read(void *opaque, target_phys_addr_t addr)
1826 1809 {
1827 1810 struct pxa2xx_fir_s *s = (struct pxa2xx_fir_s *) opaque;
1828 1811 uint8_t ret;
1829   - addr -= s->base;
1830 1812  
1831 1813 switch (addr) {
1832 1814 case ICCR0:
... ... @@ -1865,7 +1847,6 @@ static void pxa2xx_fir_write(void *opaque, target_phys_addr_t addr,
1865 1847 {
1866 1848 struct pxa2xx_fir_s *s = (struct pxa2xx_fir_s *) opaque;
1867 1849 uint8_t ch;
1868   - addr -= s->base;
1869 1850  
1870 1851 switch (addr) {
1871 1852 case ICCR0:
... ... @@ -1996,7 +1977,6 @@ static struct pxa2xx_fir_s *pxa2xx_fir_init(target_phys_addr_t base,
1996 1977 struct pxa2xx_fir_s *s = (struct pxa2xx_fir_s *)
1997 1978 qemu_mallocz(sizeof(struct pxa2xx_fir_s));
1998 1979  
1999   - s->base = base;
2000 1980 s->irq = irq;
2001 1981 s->dma = dma;
2002 1982 s->chr = chr;
... ... @@ -2005,7 +1985,7 @@ static struct pxa2xx_fir_s *pxa2xx_fir_init(target_phys_addr_t base,
2005 1985  
2006 1986 iomemtype = cpu_register_io_memory(0, pxa2xx_fir_readfn,
2007 1987 pxa2xx_fir_writefn, s);
2008   - cpu_register_physical_memory(s->base, 0x1000, iomemtype);
  1988 + cpu_register_physical_memory(base, 0x1000, iomemtype);
2009 1989  
2010 1990 if (chr)
2011 1991 qemu_chr_add_handlers(chr, pxa2xx_fir_is_empty,
... ... @@ -2118,13 +2098,14 @@ struct pxa2xx_state_s *pxa270_init(unsigned int sdram_size,
2118 2098 ssp = (struct pxa2xx_ssp_s *)
2119 2099 qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * i);
2120 2100 for (i = 0; pxa27x_ssp[i].io_base; i ++) {
  2101 + target_phys_addr_t ssp_base;
2121 2102 s->ssp[i] = &ssp[i];
2122   - ssp[i].base = pxa27x_ssp[i].io_base;
  2103 + ssp_base = pxa27x_ssp[i].io_base;
2123 2104 ssp[i].irq = s->pic[pxa27x_ssp[i].irqn];
2124 2105  
2125 2106 iomemtype = cpu_register_io_memory(0, pxa2xx_ssp_readfn,
2126 2107 pxa2xx_ssp_writefn, &ssp[i]);
2127   - cpu_register_physical_memory(ssp[i].base, 0x1000, iomemtype);
  2108 + cpu_register_physical_memory(ssp_base, 0x1000, iomemtype);
2128 2109 register_savevm("pxa2xx_ssp", i, 0,
2129 2110 pxa2xx_ssp_save, pxa2xx_ssp_load, s);
2130 2111 }
... ... @@ -2241,13 +2222,14 @@ struct pxa2xx_state_s *pxa255_init(unsigned int sdram_size,
2241 2222 ssp = (struct pxa2xx_ssp_s *)
2242 2223 qemu_mallocz(sizeof(struct pxa2xx_ssp_s) * i);
2243 2224 for (i = 0; pxa255_ssp[i].io_base; i ++) {
  2225 + target_phys_addr_t ssp_base;
2244 2226 s->ssp[i] = &ssp[i];
2245   - ssp[i].base = pxa255_ssp[i].io_base;
  2227 + ssp_base = pxa255_ssp[i].io_base;
2246 2228 ssp[i].irq = s->pic[pxa255_ssp[i].irqn];
2247 2229  
2248 2230 iomemtype = cpu_register_io_memory(0, pxa2xx_ssp_readfn,
2249 2231 pxa2xx_ssp_writefn, &ssp[i]);
2250   - cpu_register_physical_memory(ssp[i].base, 0x1000, iomemtype);
  2232 + cpu_register_physical_memory(ssp_base, 0x1000, iomemtype);
2251 2233 register_savevm("pxa2xx_ssp", i, 0,
2252 2234 pxa2xx_ssp_save, pxa2xx_ssp_load, s);
2253 2235 }
... ...
hw/pxa2xx_dma.c
... ... @@ -25,7 +25,6 @@ typedef void (*pxa2xx_dma_handler_t)(void *opaque, int irq, int level);
25 25  
26 26 struct pxa2xx_dma_state_s {
27 27 pxa2xx_dma_handler_t handler;
28   - target_phys_addr_t base;
29 28 qemu_irq irq;
30 29  
31 30 uint32_t stopintr;
... ... @@ -257,7 +256,6 @@ static uint32_t pxa2xx_dma_read(void *opaque, target_phys_addr_t offset)
257 256 {
258 257 struct pxa2xx_dma_state_s *s = (struct pxa2xx_dma_state_s *) opaque;
259 258 unsigned int channel;
260   - offset -= s->base;
261 259  
262 260 switch (offset) {
263 261 case DRCMR64 ... DRCMR74:
... ... @@ -313,7 +311,6 @@ static void pxa2xx_dma_write(void *opaque,
313 311 {
314 312 struct pxa2xx_dma_state_s *s = (struct pxa2xx_dma_state_s *) opaque;
315 313 unsigned int channel;
316   - offset -= s->base;
317 314  
318 315 switch (offset) {
319 316 case DRCMR64 ... DRCMR74:
... ... @@ -498,7 +495,6 @@ static struct pxa2xx_dma_state_s *pxa2xx_dma_init(target_phys_addr_t base,
498 495  
499 496 s->channels = channels;
500 497 s->chan = qemu_mallocz(sizeof(struct pxa2xx_dma_channel_s) * s->channels);
501   - s->base = base;
502 498 s->irq = irq;
503 499 s->handler = (pxa2xx_dma_handler_t) pxa2xx_dma_request;
504 500 s->req = qemu_mallocz(sizeof(uint8_t) * PXA2XX_DMA_NUM_REQUESTS);
... ...
hw/pxa2xx_gpio.c
... ... @@ -13,7 +13,6 @@
13 13 #define PXA2XX_GPIO_BANKS 4
14 14  
15 15 struct pxa2xx_gpio_info_s {
16   - target_phys_addr_t base;
17 16 qemu_irq *pic;
18 17 int lines;
19 18 CPUState *cpu_env;
... ... @@ -140,7 +139,6 @@ static uint32_t pxa2xx_gpio_read(void *opaque, target_phys_addr_t offset)
140 139 struct pxa2xx_gpio_info_s *s = (struct pxa2xx_gpio_info_s *) opaque;
141 140 uint32_t ret;
142 141 int bank;
143   - offset -= s->base;
144 142 if (offset >= 0x200)
145 143 return 0;
146 144  
... ... @@ -193,7 +191,6 @@ static void pxa2xx_gpio_write(void *opaque,
193 191 {
194 192 struct pxa2xx_gpio_info_s *s = (struct pxa2xx_gpio_info_s *) opaque;
195 193 int bank;
196   - offset -= s->base;
197 194 if (offset >= 0x200)
198 195 return;
199 196  
... ... @@ -308,7 +305,6 @@ struct pxa2xx_gpio_info_s *pxa2xx_gpio_init(target_phys_addr_t base,
308 305 s = (struct pxa2xx_gpio_info_s *)
309 306 qemu_mallocz(sizeof(struct pxa2xx_gpio_info_s));
310 307 memset(s, 0, sizeof(struct pxa2xx_gpio_info_s));
311   - s->base = base;
312 308 s->pic = pic;
313 309 s->lines = lines;
314 310 s->cpu_env = env;
... ...
hw/pxa2xx_keypad.c
... ... @@ -80,7 +80,6 @@
80 80 #define PXAKBD_MAXCOL 8
81 81  
82 82 struct pxa2xx_keypad_s{
83   - target_phys_addr_t base;
84 83 qemu_irq irq;
85 84 struct keymap *map;
86 85  
... ... @@ -159,7 +158,6 @@ static uint32_t pxa2xx_keypad_read(void *opaque, target_phys_addr_t offset)
159 158 {
160 159 struct pxa2xx_keypad_s *s = (struct pxa2xx_keypad_s *) opaque;
161 160 uint32_t tmp;
162   - offset -= s->base;
163 161  
164 162 switch (offset) {
165 163 case KPC:
... ... @@ -222,7 +220,6 @@ static void pxa2xx_keypad_write(void *opaque,
222 220 target_phys_addr_t offset, uint32_t value)
223 221 {
224 222 struct pxa2xx_keypad_s *s = (struct pxa2xx_keypad_s *) opaque;
225   - offset -= s->base;
226 223  
227 224 switch (offset) {
228 225 case KPC:
... ... @@ -316,7 +313,6 @@ struct pxa2xx_keypad_s *pxa27x_keypad_init(target_phys_addr_t base,
316 313 struct pxa2xx_keypad_s *s;
317 314  
318 315 s = (struct pxa2xx_keypad_s *) qemu_mallocz(sizeof(struct pxa2xx_keypad_s));
319   - s->base = base;
320 316 s->irq = irq;
321 317  
322 318 iomemtype = cpu_register_io_memory(0, pxa2xx_keypad_readfn,
... ...
hw/pxa2xx_lcd.c
... ... @@ -17,7 +17,6 @@
17 17 typedef void (*drawfn)(uint32_t *, uint8_t *, const uint8_t *, int, int);
18 18  
19 19 struct pxa2xx_lcdc_s {
20   - target_phys_addr_t base;
21 20 qemu_irq irq;
22 21 int irqlevel;
23 22  
... ... @@ -322,7 +321,6 @@ static uint32_t pxa2xx_lcdc_read(void *opaque, target_phys_addr_t offset)
322 321 {
323 322 struct pxa2xx_lcdc_s *s = (struct pxa2xx_lcdc_s *) opaque;
324 323 int ch;
325   - offset -= s->base;
326 324  
327 325 switch (offset) {
328 326 case LCCR0:
... ... @@ -418,7 +416,6 @@ static void pxa2xx_lcdc_write(void *opaque,
418 416 {
419 417 struct pxa2xx_lcdc_s *s = (struct pxa2xx_lcdc_s *) opaque;
420 418 int ch;
421   - offset -= s->base;
422 419  
423 420 switch (offset) {
424 421 case LCCR0:
... ... @@ -991,7 +988,6 @@ struct pxa2xx_lcdc_s *pxa2xx_lcdc_init(target_phys_addr_t base, qemu_irq irq,
991 988 struct pxa2xx_lcdc_s *s;
992 989  
993 990 s = (struct pxa2xx_lcdc_s *) qemu_mallocz(sizeof(struct pxa2xx_lcdc_s));
994   - s->base = base;
995 991 s->invalidated = 1;
996 992 s->irq = irq;
997 993 s->ds = ds;
... ...
hw/pxa2xx_mmci.c
... ... @@ -12,7 +12,6 @@
12 12 #include "sd.h"
13 13  
14 14 struct pxa2xx_mmci_s {
15   - target_phys_addr_t base;
16 15 qemu_irq irq;
17 16 void *dma;
18 17  
... ... @@ -216,7 +215,6 @@ static uint32_t pxa2xx_mmci_read(void *opaque, target_phys_addr_t offset)
216 215 {
217 216 struct pxa2xx_mmci_s *s = (struct pxa2xx_mmci_s *) opaque;
218 217 uint32_t ret;
219   - offset -= s->base;
220 218  
221 219 switch (offset) {
222 220 case MMC_STRPCL:
... ... @@ -279,7 +277,6 @@ static void pxa2xx_mmci_write(void *opaque,
279 277 target_phys_addr_t offset, uint32_t value)
280 278 {
281 279 struct pxa2xx_mmci_s *s = (struct pxa2xx_mmci_s *) opaque;
282   - offset -= s->base;
283 280  
284 281 switch (offset) {
285 282 case MMC_STRPCL:
... ... @@ -529,7 +526,6 @@ struct pxa2xx_mmci_s *pxa2xx_mmci_init(target_phys_addr_t base,
529 526 struct pxa2xx_mmci_s *s;
530 527  
531 528 s = (struct pxa2xx_mmci_s *) qemu_mallocz(sizeof(struct pxa2xx_mmci_s));
532   - s->base = base;
533 529 s->irq = irq;
534 530 s->dma = dma;
535 531  
... ...
hw/pxa2xx_pcmcia.c
... ... @@ -14,9 +14,6 @@
14 14 struct pxa2xx_pcmcia_s {
15 15 struct pcmcia_socket_s slot;
16 16 struct pcmcia_card_s *card;
17   - target_phys_addr_t common_base;
18   - target_phys_addr_t attr_base;
19   - target_phys_addr_t io_base;
20 17  
21 18 qemu_irq irq;
22 19 qemu_irq cd_irq;
... ... @@ -28,7 +25,6 @@ static uint32_t pxa2xx_pcmcia_common_read(void *opaque,
28 25 struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
29 26  
30 27 if (s->slot.attached) {
31   - offset -= s->common_base;
32 28 return s->card->common_read(s->card->state, offset);
33 29 }
34 30  
... ... @@ -41,7 +37,6 @@ static void pxa2xx_pcmcia_common_write(void *opaque,
41 37 struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
42 38  
43 39 if (s->slot.attached) {
44   - offset -= s->common_base;
45 40 s->card->common_write(s->card->state, offset, value);
46 41 }
47 42 }
... ... @@ -52,7 +47,6 @@ static uint32_t pxa2xx_pcmcia_attr_read(void *opaque,
52 47 struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
53 48  
54 49 if (s->slot.attached) {
55   - offset -= s->attr_base;
56 50 return s->card->attr_read(s->card->state, offset);
57 51 }
58 52  
... ... @@ -65,7 +59,6 @@ static void pxa2xx_pcmcia_attr_write(void *opaque,
65 59 struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
66 60  
67 61 if (s->slot.attached) {
68   - offset -= s->attr_base;
69 62 s->card->attr_write(s->card->state, offset, value);
70 63 }
71 64 }
... ... @@ -76,7 +69,6 @@ static uint32_t pxa2xx_pcmcia_io_read(void *opaque,
76 69 struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
77 70  
78 71 if (s->slot.attached) {
79   - offset -= s->io_base;
80 72 return s->card->io_read(s->card->state, offset);
81 73 }
82 74  
... ... @@ -89,7 +81,6 @@ static void pxa2xx_pcmcia_io_write(void *opaque,
89 81 struct pxa2xx_pcmcia_s *s = (struct pxa2xx_pcmcia_s *) opaque;
90 82  
91 83 if (s->slot.attached) {
92   - offset -= s->io_base;
93 84 s->card->io_write(s->card->state, offset, value);
94 85 }
95 86 }
... ... @@ -148,24 +139,21 @@ struct pxa2xx_pcmcia_s *pxa2xx_pcmcia_init(target_phys_addr_t base)
148 139 qemu_mallocz(sizeof(struct pxa2xx_pcmcia_s));
149 140  
150 141 /* Socket I/O Memory Space */
151   - s->io_base = base | 0x00000000;
152 142 iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_io_readfn,
153 143 pxa2xx_pcmcia_io_writefn, s);
154   - cpu_register_physical_memory(s->io_base, 0x04000000, iomemtype);
  144 + cpu_register_physical_memory(base | 0x00000000, 0x04000000, iomemtype);
155 145  
156 146 /* Then next 64 MB is reserved */
157 147  
158 148 /* Socket Attribute Memory Space */
159   - s->attr_base = base | 0x08000000;
160 149 iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_attr_readfn,
161 150 pxa2xx_pcmcia_attr_writefn, s);
162   - cpu_register_physical_memory(s->attr_base, 0x04000000, iomemtype);
  151 + cpu_register_physical_memory(base | 0x08000000, 0x04000000, iomemtype);
163 152  
164 153 /* Socket Common Memory Space */
165   - s->common_base = base | 0x0c000000;
166 154 iomemtype = cpu_register_io_memory(0, pxa2xx_pcmcia_common_readfn,
167 155 pxa2xx_pcmcia_common_writefn, s);
168   - cpu_register_physical_memory(s->common_base, 0x04000000, iomemtype);
  156 + cpu_register_physical_memory(base | 0x0c000000, 0x04000000, iomemtype);
169 157  
170 158 if (base == 0x30000000)
171 159 s->slot.slot_string = "PXA PC Card Socket 1";
... ...
hw/pxa2xx_pic.c
... ... @@ -31,7 +31,6 @@
31 31 #define PXA2XX_PIC_SRCS 40
32 32  
33 33 struct pxa2xx_pic_state_s {
34   - target_phys_addr_t base;
35 34 CPUState *cpu_env;
36 35 uint32_t int_enabled[2];
37 36 uint32_t int_pending[2];
... ... @@ -117,7 +116,6 @@ static inline uint32_t pxa2xx_pic_highest(struct pxa2xx_pic_state_s *s) {
117 116 static uint32_t pxa2xx_pic_mem_read(void *opaque, target_phys_addr_t offset)
118 117 {
119 118 struct pxa2xx_pic_state_s *s = (struct pxa2xx_pic_state_s *) opaque;
120   - offset -= s->base;
121 119  
122 120 switch (offset) {
123 121 case ICIP: /* IRQ Pending register */
... ... @@ -158,7 +156,6 @@ static void pxa2xx_pic_mem_write(void *opaque, target_phys_addr_t offset,
158 156 uint32_t value)
159 157 {
160 158 struct pxa2xx_pic_state_s *s = (struct pxa2xx_pic_state_s *) opaque;
161   - offset -= s->base;
162 159  
163 160 switch (offset) {
164 161 case ICMR: /* Mask register */
... ... @@ -207,7 +204,6 @@ static const int pxa2xx_cp_reg_map[0x10] = {
207 204  
208 205 static uint32_t pxa2xx_pic_cp_read(void *opaque, int op2, int reg, int crm)
209 206 {
210   - struct pxa2xx_pic_state_s *s = (struct pxa2xx_pic_state_s *) opaque;
211 207 target_phys_addr_t offset;
212 208  
213 209 if (pxa2xx_cp_reg_map[reg] == -1) {
... ... @@ -215,14 +211,13 @@ static uint32_t pxa2xx_pic_cp_read(void *opaque, int op2, int reg, int crm)
215 211 return 0;
216 212 }
217 213  
218   - offset = s->base + pxa2xx_cp_reg_map[reg];
  214 + offset = pxa2xx_cp_reg_map[reg];
219 215 return pxa2xx_pic_mem_read(opaque, offset);
220 216 }
221 217  
222 218 static void pxa2xx_pic_cp_write(void *opaque, int op2, int reg, int crm,
223 219 uint32_t value)
224 220 {
225   - struct pxa2xx_pic_state_s *s = (struct pxa2xx_pic_state_s *) opaque;
226 221 target_phys_addr_t offset;
227 222  
228 223 if (pxa2xx_cp_reg_map[reg] == -1) {
... ... @@ -230,7 +225,7 @@ static void pxa2xx_pic_cp_write(void *opaque, int op2, int reg, int crm,
230 225 return;
231 226 }
232 227  
233   - offset = s->base + pxa2xx_cp_reg_map[reg];
  228 + offset = pxa2xx_cp_reg_map[reg];
234 229 pxa2xx_pic_mem_write(opaque, offset, value);
235 230 }
236 231  
... ... @@ -293,7 +288,6 @@ qemu_irq *pxa2xx_pic_init(target_phys_addr_t base, CPUState *env)
293 288 return NULL;
294 289  
295 290 s->cpu_env = env;
296   - s->base = base;
297 291  
298 292 s->int_pending[0] = 0;
299 293 s->int_pending[1] = 0;
... ...
hw/pxa2xx_timer.c
... ... @@ -78,7 +78,6 @@ struct pxa2xx_timer4_s {
78 78 };
79 79  
80 80 typedef struct {
81   - target_phys_addr_t base;
82 81 int32_t clock;
83 82 int32_t oldclock;
84 83 uint64_t lastload;
... ... @@ -140,8 +139,6 @@ static uint32_t pxa2xx_timer_read(void *opaque, target_phys_addr_t offset)
140 139 pxa2xx_timer_info *s = (pxa2xx_timer_info *) opaque;
141 140 int tm = 0;
142 141  
143   - offset -= s->base;
144   -
145 142 switch (offset) {
146 143 case OSMR3: tm ++;
147 144 case OSMR2: tm ++;
... ... @@ -221,8 +218,6 @@ static void pxa2xx_timer_write(void *opaque, target_phys_addr_t offset,
221 218 int i, tm = 0;
222 219 pxa2xx_timer_info *s = (pxa2xx_timer_info *) opaque;
223 220  
224   - offset -= s->base;
225   -
226 221 switch (offset) {
227 222 case OSMR3: tm ++;
228 223 case OSMR2: tm ++;
... ... @@ -442,7 +437,6 @@ static pxa2xx_timer_info *pxa2xx_timer_init(target_phys_addr_t base,
442 437 pxa2xx_timer_info *s;
443 438  
444 439 s = (pxa2xx_timer_info *) qemu_mallocz(sizeof(pxa2xx_timer_info));
445   - s->base = base;
446 440 s->irq_enabled = 0;
447 441 s->oldclock = 0;
448 442 s->clock = 0;
... ...
hw/r2d.c
... ... @@ -39,8 +39,6 @@
39 39 #define PA_OUTPORT 0x36
40 40  
41 41 typedef struct {
42   - target_phys_addr_t base;
43   -
44 42 uint16_t bcr;
45 43 uint16_t irlmon;
46 44 uint16_t cfctl;
... ... @@ -68,8 +66,6 @@ static uint32_t r2d_fpga_read(void *opaque, target_phys_addr_t addr)
68 66 {
69 67 r2d_fpga_t *s = opaque;
70 68  
71   - addr -= s->base;
72   -
73 69 switch (addr) {
74 70 case PA_OUTPORT:
75 71 return s->outport;
... ... @@ -87,8 +83,6 @@ r2d_fpga_write(void *opaque, target_phys_addr_t addr, uint32_t value)
87 83 {
88 84 r2d_fpga_t *s = opaque;
89 85  
90   - addr -= s->base;
91   -
92 86 switch (addr) {
93 87 case PA_OUTPORT:
94 88 s->outport = value;
... ... @@ -123,7 +117,6 @@ static void r2d_fpga_init(target_phys_addr_t base)
123 117 if (!s)
124 118 return;
125 119  
126   - s->base = base;
127 120 iomemtype = cpu_register_io_memory(0, r2d_fpga_readfn,
128 121 r2d_fpga_writefn, s);
129 122 cpu_register_physical_memory(base, 0x40, iomemtype);
... ...
hw/realview_gic.c
... ... @@ -25,7 +25,6 @@ gic_get_current_cpu(void)
25 25 static uint32_t realview_gic_cpu_read(void *opaque, target_phys_addr_t offset)
26 26 {
27 27 gic_state *s = (gic_state *)opaque;
28   - offset -= s->base;
29 28 return gic_cpu_read(s, gic_get_current_cpu(), offset);
30 29 }
31 30  
... ... @@ -33,7 +32,6 @@ static void realview_gic_cpu_write(void *opaque, target_phys_addr_t offset,
33 32 uint32_t value)
34 33 {
35 34 gic_state *s = (gic_state *)opaque;
36   - offset -= s->base;
37 35 gic_cpu_write(s, gic_get_current_cpu(), offset, value);
38 36 }
39 37  
... ... @@ -54,7 +52,7 @@ qemu_irq *realview_gic_init(uint32_t base, qemu_irq parent_irq)
54 52 gic_state *s;
55 53 int iomemtype;
56 54  
57   - s = gic_init(base, &parent_irq);
  55 + s = gic_init(base + 0x1000, &parent_irq);
58 56 if (!s)
59 57 return NULL;
60 58 iomemtype = cpu_register_io_memory(0, realview_gic_cpu_readfn,
... ...