[components][mm] add ioremap for normal memory api (#7050)

This commit is contained in:
张世争 2023-03-16 10:27:16 +08:00 committed by GitHub
parent 2394e75265
commit 334c609c6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -27,6 +27,7 @@ size_t rt_ioremap_size;
enum ioremap_type enum ioremap_type
{ {
MM_AREA_TYPE_PHY, MM_AREA_TYPE_PHY,
MM_AREA_TYPE_PHY_WT,
MM_AREA_TYPE_PHY_CACHED 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: case MM_AREA_TYPE_PHY:
attr = MMU_MAP_K_DEVICE; attr = MMU_MAP_K_DEVICE;
break; break;
case MM_AREA_TYPE_PHY_WT:
attr = MMU_MAP_K_RW;
break;
case MM_AREA_TYPE_PHY_CACHED: case MM_AREA_TYPE_PHY_CACHED:
attr = MMU_MAP_K_RWCB; attr = MMU_MAP_K_RWCB;
break; break;
@ -82,6 +86,11 @@ void *rt_ioremap_nocache(void *paddr, size_t size)
return _ioremap_type(paddr, size, MM_AREA_TYPE_PHY); 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) void *rt_ioremap_cached(void *paddr, size_t size)
{ {
return _ioremap_type(paddr, size, MM_AREA_TYPE_PHY_CACHED); return _ioremap_type(paddr, size, MM_AREA_TYPE_PHY_CACHED);

View File

@ -32,7 +32,8 @@ extern "C" {
void *rt_ioremap(void *paddr, size_t size); void *rt_ioremap(void *paddr, size_t size);
void *rt_ioremap_nocache(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); void rt_iounmap(volatile void *addr);
extern void *rt_ioremap_start; extern void *rt_ioremap_start;