[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Minios-devel] [PATCH 31/40] arm: add a new helper ioremap
Hi Shijie,
On 03/11/17 03:12, Huang Shijie wrote:
This patch adds a new helper : ioremap.
This helper is used by the GIC mapping.
For arm64, we used the 4K page granule for the ioremap.
Change-Id: I67c64b3ec9020ae20bcc1e575ced3ed3537010b8
Jira: ENTOS-247
Signed-off-by: Huang Shijie <shijie.huang@xxxxxxx>
---
arch/arm/gic.c | 6 ++++--
arch/arm/mm.c | 12 ++++++++++++
include/arm/arch_mm.h | 1 +
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/arch/arm/gic.c b/arch/arm/gic.c
index 1855293..1e37cdc 100644
--- a/arch/arm/gic.c
+++ b/arch/arm/gic.c
@@ -207,8 +207,10 @@ void gic_init(void) {
continue;
}
- gic.gicd_base = to_virt((long) fdt64_to_cpu(reg[0]));
- gic.gicc_base = to_virt((long) fdt64_to_cpu(reg[2]));
+ gic.gicd_base = ioremap((unsigned long) fdt64_to_cpu(reg[0]),
+ (unsigned long) fdt64_to_cpu(reg[1]));
+ gic.gicc_base = ioremap((unsigned long) fdt64_to_cpu(reg[2]),
+ (unsigned long) fdt64_to_cpu(reg[3]));
printk("Found GIC: gicd_base = %p, gicc_base = %p\n",
gic.gicd_base, gic.gicc_base);
break;
}
diff --git a/arch/arm/mm.c b/arch/arm/mm.c
index f85e5a0..4f213e4 100644
--- a/arch/arm/mm.c
+++ b/arch/arm/mm.c
@@ -162,6 +162,13 @@ unsigned long map_frame_virt(unsigned long mfn)
return vaddr;
}
+void *ioremap(paddr_t addr, unsigned long size)
+{
+ build_pagetable((unsigned long)to_virt(addr), PHYS_PFN(addr), PFN_UP(size),
+ BLOCK_DEV_ATTR, alloc_new_page, 3);
See my comment on the previous patch regarding to_virt.
+ return to_virt(addr);
+}
+
#else
void init_pagetable(unsigned long *start_pfn, unsigned long base_pfn,
unsigned long max_pfn)
@@ -172,6 +179,11 @@ unsigned long map_frame_virt(unsigned long mfn)
{
return mfn_to_virt(mfn);
}
+
+void *ioremap(paddr_t addr, unsigned long size)
+{
+ return to_virt(addr);
+}
#endif
void arch_init_mm(unsigned long *start_pfn_p, unsigned long *max_pfn_p)
diff --git a/include/arm/arch_mm.h b/include/arm/arch_mm.h
index 235e914..791223e 100644
--- a/include/arm/arch_mm.h
+++ b/include/arm/arch_mm.h
@@ -41,4 +41,5 @@ extern paddr_t physical_address_offset;
// FIXME
#define map_frames(f, n) (NULL)
+void *ioremap(paddr_t addr, unsigned long size);
#endif
Cheers,
--
Julien Grall
_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel
|