
24 Nov
2008
24 Nov
'08
6:08 p.m.
On Mon, Nov 24, 2008 at 10:47:38AM -0600, Kumar Gala wrote:
+static struct {
- phys_addr_t paddr;
- unsigned int vaddr;
- unsigned int size;
vaddr/size should be unsigned long (or uintptr_t/size_t).
+phys_addr_t addrmap_virt_to_phys(unsigned int vaddr) +{
- int i;
- for (i = 0; i < CONFIG_SYS_NUM_ADDR_MAP; i++) {
u64 base, upper, addr;
if (address_map[i].size == 0)
continue;
addr = (u64)vaddr;
base = (u64)(address_map[i].vaddr);
upper = (u64)(address_map[i].size) + base;
if (addr >= base && addr < upper) {
return vaddr - address_map[i].vaddr + address_map[i].paddr;
}
upper should be base + size - 1, and addr <= upper. Otherwise, this will fail for a mapping at the end of a 64-bit address space.
+void addrmap_set_entry(unsigned int vaddr, phys_addr_t paddr,
unsigned int size, int idx)
+{
- if (idx > CONFIG_SYS_NUM_ADDR_MAP)
return ;
No space before ;
-Scott