mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-19 18:53:52 +08:00
sh: Assembly friendly __pa and __va definitions
This patch defines ___pa and ___va which return the physical and virtual address of an address, respectively. These macros are suitable for calling from assembly because they don't include the C casts required by __pa and __va. Signed-off-by: Matt Fleming <matt@console-pimps.org>
This commit is contained in:
parent
4a6feab0ee
commit
7c4584d39a
@ -128,13 +128,18 @@ typedef struct page *pgtable_t;
|
||||
* added or subtracted as required.
|
||||
*/
|
||||
#ifdef CONFIG_PMB
|
||||
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET+__MEMORY_START)
|
||||
#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET-__MEMORY_START))
|
||||
#define ___pa(x) ((x)-PAGE_OFFSET+__MEMORY_START)
|
||||
#define ___va(x) ((x)+PAGE_OFFSET-__MEMORY_START)
|
||||
#else
|
||||
#define __pa(x) ((unsigned long)(x)-PAGE_OFFSET)
|
||||
#define __va(x) ((void *)((unsigned long)(x)+PAGE_OFFSET))
|
||||
#define ___pa(x) ((x)-PAGE_OFFSET)
|
||||
#define ___va(x) ((x)+PAGE_OFFSET)
|
||||
#endif
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
#define __pa(x) ___pa((unsigned long)x)
|
||||
#define __va(x) (void *)___va((unsigned long)x)
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#ifdef CONFIG_UNCACHED_MAPPING
|
||||
#define UNCAC_ADDR(addr) ((addr) - PAGE_OFFSET + uncached_start)
|
||||
#define CAC_ADDR(addr) ((addr) - uncached_start + PAGE_OFFSET)
|
||||
|
Loading…
Reference in New Issue
Block a user