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