18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu> 48c2ecf20Sopenharmony_ci * Copyright (C) 2008-2009 PetaLogix 58c2ecf20Sopenharmony_ci * Copyright (C) 2006 Atmark Techno, Inc. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _ASM_MICROBLAZE_PGALLOC_H 98c2ecf20Sopenharmony_ci#define _ASM_MICROBLAZE_PGALLOC_H 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifdef CONFIG_MMU 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <linux/kernel.h> /* For min/max macros */ 148c2ecf20Sopenharmony_ci#include <linux/highmem.h> 158c2ecf20Sopenharmony_ci#include <linux/pgtable.h> 168c2ecf20Sopenharmony_ci#include <asm/setup.h> 178c2ecf20Sopenharmony_ci#include <asm/io.h> 188c2ecf20Sopenharmony_ci#include <asm/page.h> 198c2ecf20Sopenharmony_ci#include <asm/cache.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL 228c2ecf20Sopenharmony_ci#include <asm-generic/pgalloc.h> 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ciextern void __bad_pte(pmd_t *pmd); 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cistatic inline pgd_t *get_pgd(void) 278c2ecf20Sopenharmony_ci{ 288c2ecf20Sopenharmony_ci return (pgd_t *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, 0); 298c2ecf20Sopenharmony_ci} 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define pgd_alloc(mm) get_pgd() 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci#define pmd_pgtable(pmd) pmd_page(pmd) 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciextern pte_t *pte_alloc_one_kernel(struct mm_struct *mm); 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci#define __pte_free_tlb(tlb, pte, addr) pte_free((tlb)->mm, (pte)) 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define pmd_populate(mm, pmd, pte) \ 408c2ecf20Sopenharmony_ci (pmd_val(*(pmd)) = (unsigned long)page_address(pte)) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define pmd_populate_kernel(mm, pmd, pte) \ 438c2ecf20Sopenharmony_ci (pmd_val(*(pmd)) = (unsigned long) (pte)) 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci#endif /* CONFIG_MMU */ 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#endif /* _ASM_MICROBLAZE_PGALLOC_H */ 48