File Index
Files and directories
Sign in
FILE

page_32.h

File preview with syntax highlighting.

linux-6.19.14/arch/sparc/include/asm/page_32.h C
  1/* SPDX-License-Identifier: GPL-2.0 */
  2/*
  3 * page.h:  Various defines and such for MMU operations on the Sparc for
  4 *          the Linux kernel.
  5 *
  6 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
  7 */
  8
  9#ifndef _SPARC_PAGE_H
 10#define _SPARC_PAGE_H
 11
 12#include <linux/const.h>
 13
 14#include <vdso/page.h>
 15
 16#ifndef __ASSEMBLER__
 17
 18#define clear_page(page)	 memset((void *)(page), 0, PAGE_SIZE)
 19#define copy_page(to,from) 	memcpy((void *)(to), (void *)(from), PAGE_SIZE)
 20#define clear_user_page(addr, vaddr, page)	\
 21	do { 	clear_page(addr);		\
 22		sparc_flush_page_to_ram(page);	\
 23	} while (0)
 24#define copy_user_page(to, from, vaddr, page)	\
 25	do {	copy_page(to, from);		\
 26		sparc_flush_page_to_ram(page);	\
 27	} while (0)
 28
 29/* The following structure is used to hold the physical
 30 * memory configuration of the machine.  This is filled in
 31 * prom_meminit() and is later used by mem_init() to set up
 32 * mem_map[].  We statically allocate SPARC_PHYS_BANKS+1 of
 33 * these structs, this is arbitrary.  The entry after the
 34 * last valid one has num_bytes==0.
 35 */
 36struct sparc_phys_banks {
 37  unsigned long base_addr;
 38  unsigned long num_bytes;
 39};
 40
 41#define SPARC_PHYS_BANKS 32
 42
 43extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS+1];
 44
 45/* passing structs on the Sparc slow us down tremendously... */
 46
 47/* #define STRICT_MM_TYPECHECKS */
 48
 49#ifdef STRICT_MM_TYPECHECKS
 50/*
 51 * These are used to make use of C type-checking..
 52 */
 53typedef struct { unsigned long pte; } pte_t;
 54typedef struct { unsigned long iopte; } iopte_t;
 55typedef struct { unsigned long pmd; } pmd_t;
 56typedef struct { unsigned long pgd; } pgd_t;
 57typedef struct { unsigned long ctxd; } ctxd_t;
 58typedef struct { unsigned long pgprot; } pgprot_t;
 59typedef struct { unsigned long iopgprot; } iopgprot_t;
 60
 61#define pte_val(x)	((x).pte)
 62#define iopte_val(x)	((x).iopte)
 63#define pmd_val(x)      ((x).pmd)
 64#define pgd_val(x)	((x).pgd)
 65#define ctxd_val(x)	((x).ctxd)
 66#define pgprot_val(x)	((x).pgprot)
 67#define iopgprot_val(x)	((x).iopgprot)
 68
 69#define __pte(x)	((pte_t) { (x) } )
 70#define __pmd(x)	((pmd_t) { { (x) }, })
 71#define __iopte(x)	((iopte_t) { (x) } )
 72#define __pgd(x)	((pgd_t) { (x) } )
 73#define __ctxd(x)	((ctxd_t) { (x) } )
 74#define __pgprot(x)	((pgprot_t) { (x) } )
 75#define __iopgprot(x)	((iopgprot_t) { (x) } )
 76
 77#else
 78/*
 79 * .. while these make it easier on the compiler
 80 */
 81typedef unsigned long pte_t;
 82typedef unsigned long iopte_t;
 83typedef unsigned long pmd_t;
 84typedef unsigned long pgd_t;
 85typedef unsigned long ctxd_t;
 86typedef unsigned long pgprot_t;
 87typedef unsigned long iopgprot_t;
 88
 89#define pte_val(x)	(x)
 90#define iopte_val(x)	(x)
 91#define pmd_val(x)      (x)
 92#define pgd_val(x)	(x)
 93#define ctxd_val(x)	(x)
 94#define pgprot_val(x)	(x)
 95#define iopgprot_val(x)	(x)
 96
 97#define __pte(x)	(x)
 98#define __pmd(x)	(x)
 99#define __iopte(x)	(x)
100#define __pgd(x)	(x)
101#define __ctxd(x)	(x)
102#define __pgprot(x)	(x)
103#define __iopgprot(x)	(x)
104
105#endif
106
107typedef pte_t *pgtable_t;
108
109#define TASK_UNMAPPED_BASE	0x50000000
110
111#else /* !(__ASSEMBLER__) */
112
113#define __pgprot(x)	(x)
114
115#endif /* !(__ASSEMBLER__) */
116
117#define PAGE_OFFSET	0xf0000000
118#ifndef __ASSEMBLER__
119extern unsigned long phys_base;
120extern unsigned long pfn_base;
121#endif
122#define __pa(x)			((unsigned long)(x) - PAGE_OFFSET + phys_base)
123#define __va(x)			((void *)((unsigned long) (x) - phys_base + PAGE_OFFSET))
124
125#define virt_to_phys		__pa
126#define phys_to_virt		__va
127
128#define ARCH_PFN_OFFSET		(pfn_base)
129#define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
130
131#define virt_addr_valid(kaddr)	((((unsigned long)(kaddr)-PAGE_OFFSET)>>PAGE_SHIFT) < max_mapnr)
132
133#include <asm-generic/memory_model.h>
134#include <asm-generic/getorder.h>
135
136#endif /* _SPARC_PAGE_H */
~/ Read-only file preview.