parent
ab79b0d5e0
commit
7920b57d34
|
@ -203,8 +203,7 @@ void *_ioremap(resource_size_t phys_addr, unsigned long size, int wc)
|
||||||
try {
|
try {
|
||||||
Genode::Attached_io_mem_dataspace *ds = new(Genode::env()->heap())
|
Genode::Attached_io_mem_dataspace *ds = new(Genode::env()->heap())
|
||||||
Genode::Attached_io_mem_dataspace(phys_addr, size, !!wc);
|
Genode::Attached_io_mem_dataspace(phys_addr, size, !!wc);
|
||||||
/* map base + page offset */
|
return ds->local_addr<void>();
|
||||||
return ds->local_addr<char>() + (phys_addr & (PAGE_SIZE - 1));
|
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
panic("Failed to request I/O memory: [%zx,%lx)", phys_addr, phys_addr + size);
|
panic("Failed to request I/O memory: [%zx,%lx)", phys_addr, phys_addr + size);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -55,7 +55,10 @@ class Genode::Attached_io_mem_dataspace
|
||||||
_mmio(base, size, write_combined),
|
_mmio(base, size, write_combined),
|
||||||
_ds(_mmio.dataspace()),
|
_ds(_mmio.dataspace()),
|
||||||
_local_addr(env()->rm_session()->attach(_ds))
|
_local_addr(env()->rm_session()->attach(_ds))
|
||||||
{ }
|
{
|
||||||
|
/* apply sub-page offset to virtual address */
|
||||||
|
_local_addr = (void *)((addr_t)_local_addr | (base & (addr_t)0xfff));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
|
|
|
@ -50,7 +50,7 @@ class Genode::Attached_mmio : public Attached_io_mem_dataspace,
|
||||||
Attached_mmio(addr_t base, size_t size,
|
Attached_mmio(addr_t base, size_t size,
|
||||||
bool write_combined = false)
|
bool write_combined = false)
|
||||||
: Attached_io_mem_dataspace(base, size, write_combined),
|
: Attached_io_mem_dataspace(base, size, write_combined),
|
||||||
Mmio((addr_t)local_addr<void>() | (base & 0xfff)) { }
|
Mmio((addr_t)local_addr<void>()) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _INCLUDE__OS__ATTACHED_MMIO_H_ */
|
#endif /* _INCLUDE__OS__ATTACHED_MMIO_H_ */
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
* The dataspace base address will correspond to 0x2000b000.
|
* The dataspace base address will correspond to 0x2000b000.
|
||||||
*/
|
*/
|
||||||
enum { TIMER_MMIO_BASE = 0x2000b400,
|
enum { TIMER_MMIO_BASE = 0x2000b400,
|
||||||
TIMER_MMIO_OFFSET = 0x400,
|
|
||||||
TIMER_MMIO_SIZE = 0x100,
|
TIMER_MMIO_SIZE = 0x100,
|
||||||
TIMER_CLOCK = 1984*1000 };
|
TIMER_CLOCK = 1984*1000 };
|
||||||
|
|
||||||
|
@ -42,7 +41,7 @@ struct Platform_timer_base
|
||||||
|
|
||||||
Platform_timer_base() :
|
Platform_timer_base() :
|
||||||
Attached_io_mem_dataspace(TIMER_MMIO_BASE, TIMER_MMIO_SIZE),
|
Attached_io_mem_dataspace(TIMER_MMIO_BASE, TIMER_MMIO_SIZE),
|
||||||
Sp804_base((Genode::addr_t)local_addr<void>() + TIMER_MMIO_OFFSET)
|
Sp804_base((Genode::addr_t)local_addr<void>())
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue