s390/mm: add missing virt_to_pfn() etc. helper functions
Add all the missing little helper functions like virt_to_pfn(), phys_to_page(), etc. While we had a couple of these helper functions like e.g. page_to_phys() the other functions were missing, which is quite annoying if one is looking for exactly such a function. Therefore finally add all those little helper functions. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
Родитель
ac34bbc360
Коммит
16f4864171
|
@ -152,16 +152,26 @@ static inline int devmem_is_allowed(unsigned long pfn)
|
|||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#define __PAGE_OFFSET 0x0UL
|
||||
#define PAGE_OFFSET 0x0UL
|
||||
#define __pa(x) (unsigned long)(x)
|
||||
#define __va(x) (void *)(unsigned long)(x)
|
||||
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
|
||||
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
|
||||
#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
|
||||
#define __PAGE_OFFSET 0x0UL
|
||||
#define PAGE_OFFSET 0x0UL
|
||||
|
||||
#define __pa(x) ((unsigned long)(x))
|
||||
#define __va(x) ((void *)(unsigned long)(x))
|
||||
|
||||
#define virt_to_pfn(kaddr) (__pa(kaddr) >> PAGE_SHIFT)
|
||||
#define pfn_to_virt(pfn) __va((pfn) << PAGE_SHIFT)
|
||||
|
||||
#define virt_to_page(kaddr) pfn_to_page(virt_to_pfn(kaddr))
|
||||
#define page_to_virt(page) pfn_to_virt(page_to_pfn(page))
|
||||
|
||||
#define phys_to_pfn(kaddr) ((kaddr) >> PAGE_SHIFT)
|
||||
#define pfn_to_phys(pfn) ((pfn) << PAGE_SHIFT)
|
||||
|
||||
#define phys_to_page(kaddr) pfn_to_page(phys_to_pfn(kaddr))
|
||||
#define page_to_phys(page) (page_to_pfn(page) << PAGE_SHIFT)
|
||||
|
||||
#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
|
||||
|
||||
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | \
|
||||
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче