Loading...
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _M68K_PAGE_H
3#define _M68K_PAGE_H
4
5#include <linux/const.h>
6#include <asm/setup.h>
7#include <asm/page_offset.h>
8
9/* PAGE_SHIFT determines the page size */
10#if defined(CONFIG_SUN3) || defined(CONFIG_COLDFIRE)
11#define PAGE_SHIFT 13
12#else
13#define PAGE_SHIFT 12
14#endif
15#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
16#define PAGE_MASK (~(PAGE_SIZE-1))
17#define PAGE_OFFSET (PAGE_OFFSET_RAW)
18
19#ifndef __ASSEMBLY__
20
21/*
22 * These are used to make use of C type-checking..
23 */
24#if !defined(CONFIG_MMU) || CONFIG_PGTABLE_LEVELS == 3
25typedef struct { unsigned long pmd; } pmd_t;
26#define pmd_val(x) ((&x)->pmd)
27#define __pmd(x) ((pmd_t) { (x) } )
28#endif
29
30typedef struct { unsigned long pte; } pte_t;
31typedef struct { unsigned long pgd; } pgd_t;
32typedef struct { unsigned long pgprot; } pgprot_t;
33
34#if defined(CONFIG_SUN3)
35/*
36 * Sun3 still uses the asm-generic/pgalloc.h code and thus needs this
37 * definition. It would be possible to unify Sun3 and ColdFire pgalloc and have
38 * all of m68k use the same type.
39 */
40typedef struct page *pgtable_t;
41#else
42typedef pte_t *pgtable_t;
43#endif
44
45#define pte_val(x) ((x).pte)
46#define pgd_val(x) ((x).pgd)
47#define pgprot_val(x) ((x).pgprot)
48
49#define __pte(x) ((pte_t) { (x) } )
50#define __pgd(x) ((pgd_t) { (x) } )
51#define __pgprot(x) ((pgprot_t) { (x) } )
52
53extern unsigned long _rambase;
54extern unsigned long _ramstart;
55extern unsigned long _ramend;
56
57#endif /* !__ASSEMBLY__ */
58
59#ifdef CONFIG_MMU
60#include <asm/page_mm.h>
61#else
62#include <asm/page_no.h>
63#endif
64
65#include <asm-generic/getorder.h>
66#include <asm-generic/memory_model.h>
67
68#endif /* _M68K_PAGE_H */
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _M68K_PAGE_H
3#define _M68K_PAGE_H
4
5#include <linux/const.h>
6#include <asm/setup.h>
7#include <asm/page_offset.h>
8
9/* PAGE_SHIFT determines the page size */
10#if defined(CONFIG_SUN3) || defined(CONFIG_COLDFIRE)
11#define PAGE_SHIFT 13
12#else
13#define PAGE_SHIFT 12
14#endif
15#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT)
16#define PAGE_MASK (~(PAGE_SIZE-1))
17#define PAGE_OFFSET (PAGE_OFFSET_RAW)
18
19#ifndef __ASSEMBLY__
20
21/*
22 * These are used to make use of C type-checking..
23 */
24typedef struct { unsigned long pte; } pte_t;
25typedef struct { unsigned long pmd[16]; } pmd_t;
26typedef struct { unsigned long pgd; } pgd_t;
27typedef struct { unsigned long pgprot; } pgprot_t;
28typedef struct page *pgtable_t;
29
30#define pte_val(x) ((x).pte)
31#define pmd_val(x) ((&x)->pmd[0])
32#define pgd_val(x) ((x).pgd)
33#define pgprot_val(x) ((x).pgprot)
34
35#define __pte(x) ((pte_t) { (x) } )
36#define __pmd(x) ((pmd_t) { { (x) }, })
37#define __pgd(x) ((pgd_t) { (x) } )
38#define __pgprot(x) ((pgprot_t) { (x) } )
39
40extern unsigned long _rambase;
41extern unsigned long _ramstart;
42extern unsigned long _ramend;
43
44#endif /* !__ASSEMBLY__ */
45
46#ifdef CONFIG_MMU
47#include <asm/page_mm.h>
48#else
49#include <asm/page_no.h>
50#endif
51
52#define __phys_to_pfn(paddr) ((unsigned long)((paddr) >> PAGE_SHIFT))
53#define __pfn_to_phys(pfn) PFN_PHYS(pfn)
54
55#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
56 VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
57
58#include <asm-generic/getorder.h>
59
60#endif /* _M68K_PAGE_H */