18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* sun3_pgalloc.h -- 38c2ecf20Sopenharmony_ci * reorganization around 2.3.39, routines moved from sun3_pgtable.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * 02/27/2002 -- Modified to support "highpte" implementation in 2.5.5 (Sam) 78c2ecf20Sopenharmony_ci * 88c2ecf20Sopenharmony_ci * moved 1/26/2000 Sam Creasey 98c2ecf20Sopenharmony_ci */ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#ifndef _SUN3_PGALLOC_H 128c2ecf20Sopenharmony_ci#define _SUN3_PGALLOC_H 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ci#include <asm/tlb.h> 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci#include <asm-generic/pgalloc.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciextern const char bad_pmd_string[]; 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define __pte_free_tlb(tlb,pte,addr) \ 218c2ecf20Sopenharmony_cido { \ 228c2ecf20Sopenharmony_ci pgtable_pte_page_dtor(pte); \ 238c2ecf20Sopenharmony_ci tlb_remove_page((tlb), pte); \ 248c2ecf20Sopenharmony_ci} while (0) 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_cistatic inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte) 278c2ecf20Sopenharmony_ci{ 288c2ecf20Sopenharmony_ci pmd_val(*pmd) = __pa((unsigned long)pte); 298c2ecf20Sopenharmony_ci} 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_cistatic inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, pgtable_t page) 328c2ecf20Sopenharmony_ci{ 338c2ecf20Sopenharmony_ci pmd_val(*pmd) = __pa((unsigned long)page_address(page)); 348c2ecf20Sopenharmony_ci} 358c2ecf20Sopenharmony_ci#define pmd_pgtable(pmd) pmd_page(pmd) 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* 388c2ecf20Sopenharmony_ci * allocating and freeing a pmd is trivial: the 1-entry pmd is 398c2ecf20Sopenharmony_ci * inside the pgd, so has no extra memory associated with it. 408c2ecf20Sopenharmony_ci */ 418c2ecf20Sopenharmony_ci#define pmd_free(mm, x) do { } while (0) 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_cistatic inline pgd_t * pgd_alloc(struct mm_struct *mm) 448c2ecf20Sopenharmony_ci{ 458c2ecf20Sopenharmony_ci pgd_t *new_pgd; 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci new_pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL); 488c2ecf20Sopenharmony_ci memcpy(new_pgd, swapper_pg_dir, PAGE_SIZE); 498c2ecf20Sopenharmony_ci memset(new_pgd, 0, (PAGE_OFFSET >> PGDIR_SHIFT)); 508c2ecf20Sopenharmony_ci return new_pgd; 518c2ecf20Sopenharmony_ci} 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci#endif /* SUN3_PGALLOC_H */ 54