18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _M68K_PAGE_H
38c2ecf20Sopenharmony_ci#define _M68K_PAGE_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/const.h>
68c2ecf20Sopenharmony_ci#include <asm/setup.h>
78c2ecf20Sopenharmony_ci#include <asm/page_offset.h>
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci/* PAGE_SHIFT determines the page size */
108c2ecf20Sopenharmony_ci#if defined(CONFIG_SUN3) || defined(CONFIG_COLDFIRE)
118c2ecf20Sopenharmony_ci#define PAGE_SHIFT	13
128c2ecf20Sopenharmony_ci#else
138c2ecf20Sopenharmony_ci#define PAGE_SHIFT	12
148c2ecf20Sopenharmony_ci#endif
158c2ecf20Sopenharmony_ci#define PAGE_SIZE	(_AC(1, UL) << PAGE_SHIFT)
168c2ecf20Sopenharmony_ci#define PAGE_MASK	(~(PAGE_SIZE-1))
178c2ecf20Sopenharmony_ci#define PAGE_OFFSET	(PAGE_OFFSET_RAW)
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/*
228c2ecf20Sopenharmony_ci * These are used to make use of C type-checking..
238c2ecf20Sopenharmony_ci */
248c2ecf20Sopenharmony_ci#if !defined(CONFIG_MMU) || CONFIG_PGTABLE_LEVELS == 3
258c2ecf20Sopenharmony_citypedef struct { unsigned long pmd; } pmd_t;
268c2ecf20Sopenharmony_ci#define pmd_val(x)	((&x)->pmd)
278c2ecf20Sopenharmony_ci#define __pmd(x)	((pmd_t) { (x) } )
288c2ecf20Sopenharmony_ci#endif
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_citypedef struct { unsigned long pte; } pte_t;
318c2ecf20Sopenharmony_citypedef struct { unsigned long pgd; } pgd_t;
328c2ecf20Sopenharmony_citypedef struct { unsigned long pgprot; } pgprot_t;
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#if defined(CONFIG_SUN3)
358c2ecf20Sopenharmony_ci/*
368c2ecf20Sopenharmony_ci * Sun3 still uses the asm-generic/pgalloc.h code and thus needs this
378c2ecf20Sopenharmony_ci * definition. It would be possible to unify Sun3 and ColdFire pgalloc and have
388c2ecf20Sopenharmony_ci * all of m68k use the same type.
398c2ecf20Sopenharmony_ci */
408c2ecf20Sopenharmony_citypedef struct page *pgtable_t;
418c2ecf20Sopenharmony_ci#else
428c2ecf20Sopenharmony_citypedef pte_t *pgtable_t;
438c2ecf20Sopenharmony_ci#endif
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define pte_val(x)	((x).pte)
468c2ecf20Sopenharmony_ci#define pgd_val(x)	((x).pgd)
478c2ecf20Sopenharmony_ci#define pgprot_val(x)	((x).pgprot)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define __pte(x)	((pte_t) { (x) } )
508c2ecf20Sopenharmony_ci#define __pgd(x)	((pgd_t) { (x) } )
518c2ecf20Sopenharmony_ci#define __pgprot(x)	((pgprot_t) { (x) } )
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ciextern unsigned long _rambase;
548c2ecf20Sopenharmony_ciextern unsigned long _ramstart;
558c2ecf20Sopenharmony_ciextern unsigned long _ramend;
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#ifdef CONFIG_MMU
608c2ecf20Sopenharmony_ci#include <asm/page_mm.h>
618c2ecf20Sopenharmony_ci#else
628c2ecf20Sopenharmony_ci#include <asm/page_no.h>
638c2ecf20Sopenharmony_ci#endif
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci#define __phys_to_pfn(paddr)	((unsigned long)((paddr) >> PAGE_SHIFT))
668c2ecf20Sopenharmony_ci#define __pfn_to_phys(pfn)	PFN_PHYS(pfn)
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#include <asm-generic/getorder.h>
698c2ecf20Sopenharmony_ci
708c2ecf20Sopenharmony_ci#endif /* _M68K_PAGE_H */
71