9
0
Fork 0

remap_range: make function 'remap_range' global

Change function remap_range in arm architecture to make it
global accessable. For example command 'memtest' can change
pte flags to enable or disable cache.

Add dummy function for others architectures that doesn't
have mmu or pte support.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Alexander Aring 2013-01-15 14:48:43 +01:00 committed by Sascha Hauer
parent b26c1c30eb
commit 47326f80a9
9 changed files with 158 additions and 1 deletions

View File

@ -52,11 +52,25 @@ extern int arm_architecture;
#define PTE_FLAGS_CACHED_V4 (PTE_SMALL_AP_UNO_SRW | PTE_BUFFERABLE | PTE_CACHEABLE)
#define PTE_FLAGS_UNCACHED_V4 PTE_SMALL_AP_UNO_SRW
/*
* PTE flags to set cached and uncached areas.
* This will be determined at runtime.
*/
static uint32_t PTE_FLAGS_CACHED;
static uint32_t PTE_FLAGS_UNCACHED;
#define PTE_MASK ((1 << 12) - 1)
uint32_t mmu_get_pte_cached_flags()
{
return PTE_FLAGS_CACHED;
}
uint32_t mmu_get_pte_uncached_flags()
{
return PTE_FLAGS_UNCACHED;
}
/*
* Create a second level translation table for the given virtual address.
* We initially create a flat uncached mapping on it.
@ -93,7 +107,7 @@ static u32 *find_pte(unsigned long adr)
return &table[(adr >> PAGE_SHIFT) & 0xff];
}
static void remap_range(void *_start, size_t size, uint32_t flags)
void remap_range(void *_start, size_t size, uint32_t flags)
{
unsigned long start = (unsigned long)_start;
u32 *p;

View File

@ -41,7 +41,10 @@ void dma_flush_range(unsigned long, unsigned long);
void dma_inv_range(unsigned long, unsigned long);
unsigned long virt_to_phys(void *virt);
void *phys_to_virt(unsigned long phys);
void remap_range(void *_start, size_t size, uint32_t flags);
void *map_io_sections(unsigned long physaddr, void *start, size_t size);
uint32_t mmu_get_pte_cached_flags(void);
uint32_t mmu_get_pte_uncached_flags(void);
#else
static inline void *dma_alloc_coherent(size_t size)
@ -76,11 +79,25 @@ static inline void dma_inv_range(unsigned long s, unsigned long e)
{
}
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline void *map_io_sections(unsigned long phys, void *start, size_t size)
{
return (void *)phys;
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif
#ifdef CONFIG_CACHE_L2X0

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -540,4 +540,22 @@ extern int write_bat(ppc_bat_t bat, unsigned long upper, unsigned long lower);
(rt<<21)|(ra<<16)|(ws<<11)|(946<<1)
#endif
#ifndef __ASSEMBLY__
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif
#endif /* _PPC_MMU_H_ */

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */

View File

@ -0,0 +1,18 @@
#ifndef __ASM_MMU_H
#define __ASM_MMU_H
static inline void remap_range(void *_start, size_t size, uint32_t flags)
{
}
static inline uint32_t mmu_get_pte_cached_flags(void)
{
return 0;
}
static inline uint32_t mmu_get_pte_uncached_flags(void)
{
return 0;
}
#endif /* __ASM_MMU_H */