Revision 99a0949b hw/iommu.c
b/hw/iommu.c | ||
---|---|---|
130 | 130 |
typedef struct IOMMUState { |
131 | 131 |
SysBusDevice busdev; |
132 | 132 |
uint32_t regs[IOMMU_NREGS]; |
133 |
target_phys_addr_t iostart;
|
|
133 |
a_target_phys_addr iostart;
|
|
134 | 134 |
uint32_t version; |
135 | 135 |
qemu_irq irq; |
136 | 136 |
} IOMMUState; |
137 | 137 |
|
138 |
static uint32_t iommu_mem_readl(void *opaque, target_phys_addr_t addr)
|
|
138 |
static uint32_t iommu_mem_readl(void *opaque, a_target_phys_addr addr)
|
|
139 | 139 |
{ |
140 | 140 |
IOMMUState *s = opaque; |
141 |
target_phys_addr_t saddr;
|
|
141 |
a_target_phys_addr saddr;
|
|
142 | 142 |
uint32_t ret; |
143 | 143 |
|
144 | 144 |
saddr = addr >> 2; |
... | ... | |
156 | 156 |
return ret; |
157 | 157 |
} |
158 | 158 |
|
159 |
static void iommu_mem_writel(void *opaque, target_phys_addr_t addr,
|
|
159 |
static void iommu_mem_writel(void *opaque, a_target_phys_addr addr,
|
|
160 | 160 |
uint32_t val) |
161 | 161 |
{ |
162 | 162 |
IOMMUState *s = opaque; |
163 |
target_phys_addr_t saddr;
|
|
163 |
a_target_phys_addr saddr;
|
|
164 | 164 |
|
165 | 165 |
saddr = addr >> 2; |
166 | 166 |
DPRINTF("write reg[%d] = %x\n", (int)saddr, val); |
... | ... | |
250 | 250 |
iommu_mem_writel, |
251 | 251 |
}; |
252 | 252 |
|
253 |
static uint32_t iommu_page_get_flags(IOMMUState *s, target_phys_addr_t addr)
|
|
253 |
static uint32_t iommu_page_get_flags(IOMMUState *s, a_target_phys_addr addr)
|
|
254 | 254 |
{ |
255 | 255 |
uint32_t ret; |
256 |
target_phys_addr_t iopte;
|
|
256 |
a_target_phys_addr iopte;
|
|
257 | 257 |
#ifdef DEBUG_IOMMU |
258 |
target_phys_addr_t pa = addr;
|
|
258 |
a_target_phys_addr pa = addr;
|
|
259 | 259 |
#endif |
260 | 260 |
|
261 | 261 |
iopte = s->regs[IOMMU_BASE] << 4; |
... | ... | |
269 | 269 |
return ret; |
270 | 270 |
} |
271 | 271 |
|
272 |
static target_phys_addr_t iommu_translate_pa(target_phys_addr_t addr,
|
|
272 |
static a_target_phys_addr iommu_translate_pa(a_target_phys_addr addr,
|
|
273 | 273 |
uint32_t pte) |
274 | 274 |
{ |
275 | 275 |
uint32_t tmppte; |
276 |
target_phys_addr_t pa;
|
|
276 |
a_target_phys_addr pa;
|
|
277 | 277 |
|
278 | 278 |
tmppte = pte; |
279 | 279 |
pa = ((pte & IOPTE_PAGE) << 4) + (addr & ~IOMMU_PAGE_MASK); |
... | ... | |
283 | 283 |
return pa; |
284 | 284 |
} |
285 | 285 |
|
286 |
static void iommu_bad_addr(IOMMUState *s, target_phys_addr_t addr,
|
|
286 |
static void iommu_bad_addr(IOMMUState *s, a_target_phys_addr addr,
|
|
287 | 287 |
int is_write) |
288 | 288 |
{ |
289 | 289 |
DPRINTF("bad addr " TARGET_FMT_plx "\n", addr); |
... | ... | |
295 | 295 |
qemu_irq_raise(s->irq); |
296 | 296 |
} |
297 | 297 |
|
298 |
void sparc_iommu_memory_rw(void *opaque, target_phys_addr_t addr,
|
|
298 |
void sparc_iommu_memory_rw(void *opaque, a_target_phys_addr addr,
|
|
299 | 299 |
uint8_t *buf, int len, int is_write) |
300 | 300 |
{ |
301 | 301 |
int l; |
302 | 302 |
uint32_t flags; |
303 |
target_phys_addr_t page, phys_addr;
|
|
303 |
a_target_phys_addr page, phys_addr;
|
|
304 | 304 |
|
305 | 305 |
while (len > 0) { |
306 | 306 |
page = addr & IOMMU_PAGE_MASK; |
Also available in: Unified diff