From 334c609c6c38a3bd30275bfb4bb563b6c160860a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=B8=96=E4=BA=89?= Date: Thu, 16 Mar 2023 10:27:16 +0800 Subject: [PATCH] [components][mm] add ioremap for normal memory api (#7050) --- components/mm/ioremap.c | 9 +++++++++ components/mm/ioremap.h | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/mm/ioremap.c b/components/mm/ioremap.c index a3b8a9e1f2..f72a8b9354 100644 --- a/components/mm/ioremap.c +++ b/components/mm/ioremap.c @@ -27,6 +27,7 @@ size_t rt_ioremap_size; enum ioremap_type { MM_AREA_TYPE_PHY, + MM_AREA_TYPE_PHY_WT, MM_AREA_TYPE_PHY_CACHED }; @@ -52,6 +53,9 @@ static void *_ioremap_type(void *paddr, size_t size, enum ioremap_type type) case MM_AREA_TYPE_PHY: attr = MMU_MAP_K_DEVICE; break; + case MM_AREA_TYPE_PHY_WT: + attr = MMU_MAP_K_RW; + break; case MM_AREA_TYPE_PHY_CACHED: attr = MMU_MAP_K_RWCB; break; @@ -82,6 +86,11 @@ void *rt_ioremap_nocache(void *paddr, size_t size) return _ioremap_type(paddr, size, MM_AREA_TYPE_PHY); } +void *rt_ioremap_wt(void *paddr, size_t size) +{ + return _ioremap_type(paddr, size, MM_AREA_TYPE_PHY_WT); +} + void *rt_ioremap_cached(void *paddr, size_t size) { return _ioremap_type(paddr, size, MM_AREA_TYPE_PHY_CACHED); diff --git a/components/mm/ioremap.h b/components/mm/ioremap.h index dc219630a3..7ac9d196a9 100644 --- a/components/mm/ioremap.h +++ b/components/mm/ioremap.h @@ -32,7 +32,8 @@ extern "C" { void *rt_ioremap(void *paddr, size_t size); void *rt_ioremap_nocache(void *paddr, size_t size); -void *rt_ioremap_cached (void *paddr, size_t size); +void *rt_ioremap_cached(void *paddr, size_t size); +void *rt_ioremap_wt(void *paddr, size_t size); void rt_iounmap(volatile void *addr); extern void *rt_ioremap_start;