Revision 981a2e99
b/hw/iommu.c | ||
---|---|---|
100 | 100 |
saddr = (addr - s->addr) >> 2; |
101 | 101 |
switch (saddr) { |
102 | 102 |
default: |
103 |
DPRINTF("read reg[%d] = %x\n", saddr, s->regs[saddr]); |
|
103 |
DPRINTF("read reg[%d] = %x\n", (int)saddr, s->regs[saddr]);
|
|
104 | 104 |
return s->regs[saddr]; |
105 | 105 |
break; |
106 | 106 |
} |
... | ... | |
113 | 113 |
target_phys_addr_t saddr; |
114 | 114 |
|
115 | 115 |
saddr = (addr - s->addr) >> 2; |
116 |
DPRINTF("write reg[%d] = %x\n", saddr, val); |
|
116 |
DPRINTF("write reg[%d] = %x\n", (int)saddr, val);
|
|
117 | 117 |
switch (saddr) { |
118 | 118 |
case IOMMU_CTRL: |
119 | 119 |
switch (val & IOMMU_CTRL_RNGE) { |
... | ... | |
143 | 143 |
s->iostart = 0xffffffff80000000ULL; |
144 | 144 |
break; |
145 | 145 |
} |
146 |
DPRINTF("iostart = %llx\n", s->iostart);
|
|
146 |
DPRINTF("iostart = " TARGET_FMT_plx "\n", s->iostart);
|
|
147 | 147 |
s->regs[saddr] = ((val & IOMMU_CTRL_MASK) | IOMMU_VERSION); |
148 | 148 |
break; |
149 | 149 |
case IOMMU_BASE: |
... | ... | |
188 | 188 |
|
189 | 189 |
static uint32_t iommu_page_get_flags(IOMMUState *s, target_phys_addr_t addr) |
190 | 190 |
{ |
191 |
uint32_t iopte; |
|
191 |
uint32_t iopte, ret; |
|
192 |
#ifdef DEBUG_IOMMU |
|
193 |
target_phys_addr_t pa = addr; |
|
194 |
#endif |
|
192 | 195 |
|
193 |
iopte = s->regs[1] << 4;
|
|
196 |
iopte = s->regs[IOMMU_BASE] << 4;
|
|
194 | 197 |
addr &= ~s->iostart; |
195 | 198 |
iopte += (addr >> (PAGE_SHIFT - 2)) & ~3; |
196 |
return ldl_phys(iopte); |
|
199 |
ret = ldl_phys(iopte); |
|
200 |
DPRINTF("get flags addr " TARGET_FMT_plx " => pte %x, *ptes = %x\n", pa, |
|
201 |
iopte, ret); |
|
202 |
|
|
203 |
return ret; |
|
197 | 204 |
} |
198 | 205 |
|
199 | 206 |
static target_phys_addr_t iommu_translate_pa(IOMMUState *s, |
... | ... | |
271 | 278 |
|
272 | 279 |
memset(s->regs, 0, IOMMU_NREGS * 4); |
273 | 280 |
s->iostart = 0; |
274 |
s->regs[0] = IOMMU_VERSION;
|
|
281 |
s->regs[IOMMU_CTRL] = IOMMU_VERSION;
|
|
275 | 282 |
} |
276 | 283 |
|
277 | 284 |
void *iommu_init(target_phys_addr_t addr) |
Also available in: Unified diff