2002-04-10 04:45:43 +04:00
|
|
|
/* $NetBSD: pmap.h,v 1.51 2002/04/10 00:45:43 thorpej Exp $ */
|
2002-04-10 01:00:42 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c 2002 Wasabi Systems, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed for the NetBSD Project by
|
|
|
|
* Wasabi Systems, Inc.
|
|
|
|
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
|
|
|
* or promote products derived from this software without specific prior
|
|
|
|
* written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND
|
|
|
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
2001-02-24 00:23:45 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 1994,1995 Mark Brinicombe.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by Mark Brinicombe
|
|
|
|
* 4. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ARM32_PMAP_H_
|
|
|
|
#define _ARM32_PMAP_H_
|
|
|
|
|
2001-11-23 20:39:03 +03:00
|
|
|
#ifdef _KERNEL
|
|
|
|
|
2001-11-23 22:21:47 +03:00
|
|
|
#include <arm/cpufunc.h>
|
2001-11-23 20:39:03 +03:00
|
|
|
#include <arm/arm32/pte.h>
|
2001-07-29 16:45:27 +04:00
|
|
|
#include <uvm/uvm_object.h>
|
2001-02-24 00:23:45 +03:00
|
|
|
|
2001-07-28 22:12:43 +04:00
|
|
|
/*
|
|
|
|
* a pmap describes a processes' 4GB virtual address space. this
|
|
|
|
* virtual address space can be broken up into 4096 1MB regions which
|
2002-03-25 05:44:07 +03:00
|
|
|
* are described by L1 PTEs in the L1 table.
|
2001-07-28 22:12:43 +04:00
|
|
|
*
|
2002-03-25 05:44:07 +03:00
|
|
|
* There is a line drawn at KERNEL_BASE. Everything below that line
|
|
|
|
* changes when the VM context is switched. Everything above that line
|
|
|
|
* is the same no matter which VM context is running. This is achieved
|
|
|
|
* by making the L1 PTEs for those slots above KERNEL_BASE reference
|
|
|
|
* kernel L2 tables.
|
2001-07-28 22:12:43 +04:00
|
|
|
*
|
2002-03-25 05:44:07 +03:00
|
|
|
* The L2 tables are mapped linearly starting at PTE_BASE. PTE_BASE
|
|
|
|
* is below KERNEL_BASE, which means that the current process's PTEs
|
|
|
|
* are always available starting at PTE_BASE. Another region of KVA
|
|
|
|
* above KERNEL_BASE, APTE_BASE, is reserved for mapping in the PTEs
|
|
|
|
* of another process, should we need to manipulate them.
|
2001-07-28 22:12:43 +04:00
|
|
|
*
|
2002-03-25 05:44:07 +03:00
|
|
|
* The basic layout of the virtual address space thus looks like this:
|
|
|
|
*
|
|
|
|
* 0xffffffff
|
|
|
|
* .
|
|
|
|
* .
|
|
|
|
* .
|
|
|
|
* KERNEL_BASE
|
|
|
|
* --------------------
|
|
|
|
* PTE_BASE
|
|
|
|
* .
|
|
|
|
* .
|
|
|
|
* .
|
|
|
|
* 0x00000000
|
2001-07-28 22:12:43 +04:00
|
|
|
*/
|
|
|
|
|
2001-02-24 00:23:45 +03:00
|
|
|
/*
|
|
|
|
* The pmap structure itself.
|
|
|
|
*/
|
|
|
|
struct pmap {
|
2001-07-29 16:45:27 +04:00
|
|
|
struct uvm_object pm_obj; /* uvm_object */
|
|
|
|
#define pm_lock pm_obj.vmobjlock
|
2002-03-03 14:22:58 +03:00
|
|
|
LIST_ENTRY(pmap) pm_list; /* list (lck by pm_list lock) */
|
2001-02-24 00:23:45 +03:00
|
|
|
pd_entry_t *pm_pdir; /* KVA of page directory */
|
2002-03-25 06:00:28 +03:00
|
|
|
struct l1pt *pm_l1pt; /* L1 table metadata */
|
2001-07-29 16:45:27 +04:00
|
|
|
paddr_t pm_pptpt; /* PA of pt's page table */
|
|
|
|
vaddr_t pm_vptpt; /* VA of pt's page table */
|
2001-02-24 00:23:45 +03:00
|
|
|
struct pmap_statistics pm_stats; /* pmap statistics */
|
2002-03-25 06:00:28 +03:00
|
|
|
struct vm_page *pm_ptphint; /* recently used PT */
|
2001-02-24 00:23:45 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct pmap *pmap_t;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Physical / virtual address structure. In a number of places (particularly
|
|
|
|
* during bootstrapping) we need to keep track of the physical and virtual
|
|
|
|
* addresses of various pages
|
|
|
|
*/
|
2002-02-22 00:58:00 +03:00
|
|
|
typedef struct pv_addr {
|
|
|
|
SLIST_ENTRY(pv_addr) pv_list;
|
2001-03-04 10:30:19 +03:00
|
|
|
paddr_t pv_pa;
|
2001-03-04 06:40:58 +03:00
|
|
|
vaddr_t pv_va;
|
2001-02-24 00:23:45 +03:00
|
|
|
} pv_addr_t;
|
|
|
|
|
2002-02-20 03:10:15 +03:00
|
|
|
/*
|
|
|
|
* Determine various modes for PTEs (user vs. kernel, cacheable
|
|
|
|
* vs. non-cacheable).
|
|
|
|
*/
|
|
|
|
#define PTE_KERNEL 0
|
|
|
|
#define PTE_USER 1
|
|
|
|
#define PTE_NOCACHE 0
|
|
|
|
#define PTE_CACHE 1
|
|
|
|
|
2002-04-04 08:25:44 +04:00
|
|
|
/*
|
|
|
|
* Flags that indicate attributes of pages or mappings of pages.
|
|
|
|
*
|
|
|
|
* The PVF_MOD and PVF_REF flags are stored in the mdpage for each
|
|
|
|
* page. PVF_WIRED, PVF_WRITE, and PVF_NC are kept in individual
|
|
|
|
* pv_entry's for each page. They live in the same "namespace" so
|
|
|
|
* that we can clear multiple attributes at a time.
|
|
|
|
*
|
|
|
|
* Note the "non-cacheable" flag generally means the page has
|
|
|
|
* multiple mappings in a given address space.
|
|
|
|
*/
|
|
|
|
#define PVF_MOD 0x01 /* page is modified */
|
|
|
|
#define PVF_REF 0x02 /* page is referenced */
|
|
|
|
#define PVF_WIRED 0x04 /* mapping is wired */
|
|
|
|
#define PVF_WRITE 0x08 /* mapping is writable */
|
|
|
|
#define PVF_NC 0x10 /* mapping is non-cacheable */
|
|
|
|
|
2001-02-24 00:23:45 +03:00
|
|
|
/*
|
|
|
|
* Commonly referenced structures
|
|
|
|
*/
|
2001-07-28 22:12:43 +04:00
|
|
|
extern struct pmap kernel_pmap_store;
|
2001-03-04 22:05:55 +03:00
|
|
|
extern int pmap_debug_level; /* Only exists if PMAP_DEBUG */
|
2001-02-24 00:23:45 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Macros that we need to export
|
|
|
|
*/
|
|
|
|
#define pmap_kernel() (&kernel_pmap_store)
|
|
|
|
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
|
|
|
|
#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count)
|
|
|
|
|
2002-04-04 08:25:44 +04:00
|
|
|
#define pmap_is_modified(pg) \
|
|
|
|
(((pg)->mdpage.pvh_attrs & PVF_MOD) != 0)
|
|
|
|
#define pmap_is_referenced(pg) \
|
|
|
|
(((pg)->mdpage.pvh_attrs & PVF_REF) != 0)
|
2002-03-05 07:48:03 +03:00
|
|
|
|
2002-03-25 22:53:38 +03:00
|
|
|
#define pmap_copy(dp, sp, da, l, sa) /* nothing */
|
|
|
|
|
2002-03-24 06:37:18 +03:00
|
|
|
#define pmap_phys_address(ppn) (arm_ptob((ppn)))
|
2001-02-24 00:23:45 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Functions that we need to export
|
|
|
|
*/
|
2002-03-25 05:51:32 +03:00
|
|
|
vaddr_t pmap_map(vaddr_t, vaddr_t, vaddr_t, int);
|
|
|
|
void pmap_procwr(struct proc *, vaddr_t, int);
|
|
|
|
|
2001-02-24 00:23:45 +03:00
|
|
|
#define PMAP_NEED_PROCWR
|
2002-03-03 14:22:58 +03:00
|
|
|
#define PMAP_GROWKERNEL /* turn on pmap_growkernel interface */
|
2001-02-24 00:23:45 +03:00
|
|
|
|
2002-03-25 05:51:32 +03:00
|
|
|
/* Functions we use internally. */
|
|
|
|
void pmap_bootstrap(pd_entry_t *, pv_addr_t);
|
|
|
|
void pmap_debug(int);
|
|
|
|
int pmap_handled_emulation(struct pmap *, vaddr_t);
|
|
|
|
int pmap_modified_emulation(struct pmap *, vaddr_t);
|
|
|
|
void pmap_postinit(void);
|
2001-08-11 17:20:19 +04:00
|
|
|
|
2002-04-04 03:33:26 +04:00
|
|
|
void vector_page_setprot(int);
|
|
|
|
|
2002-02-20 03:10:15 +03:00
|
|
|
/* Bootstrapping routines. */
|
|
|
|
void pmap_map_section(vaddr_t, vaddr_t, paddr_t, int, int);
|
2002-02-20 05:32:56 +03:00
|
|
|
void pmap_map_entry(vaddr_t, vaddr_t, paddr_t, int, int);
|
2002-02-22 00:58:00 +03:00
|
|
|
vsize_t pmap_map_chunk(vaddr_t, vaddr_t, paddr_t, vsize_t, int, int);
|
|
|
|
void pmap_link_l2pt(vaddr_t, vaddr_t, pv_addr_t *);
|
2002-02-20 03:10:15 +03:00
|
|
|
|
2001-08-11 17:20:19 +04:00
|
|
|
/*
|
|
|
|
* Special page zero routine for use by the idle loop (no cache cleans).
|
|
|
|
*/
|
|
|
|
boolean_t pmap_pageidlezero __P((paddr_t));
|
|
|
|
#define PMAP_PAGEIDLEZERO(pa) pmap_pageidlezero((pa))
|
2001-03-04 22:05:55 +03:00
|
|
|
|
2002-03-03 14:22:58 +03:00
|
|
|
/*
|
|
|
|
* The current top of kernel VM
|
|
|
|
*/
|
|
|
|
extern vaddr_t pmap_curmaxkvaddr;
|
|
|
|
|
2001-02-24 00:23:45 +03:00
|
|
|
/*
|
|
|
|
* Useful macros and constants
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Virtual address to page table entry */
|
|
|
|
#define vtopte(va) \
|
2002-03-25 05:51:32 +03:00
|
|
|
(((pt_entry_t *)PTE_BASE) + arm_btop((vaddr_t) (va)))
|
2001-02-24 00:23:45 +03:00
|
|
|
|
|
|
|
/* Virtual address to physical address */
|
|
|
|
#define vtophys(va) \
|
2002-04-05 20:58:01 +04:00
|
|
|
((*vtopte(va) & L2_S_FRAME) | ((vaddr_t) (va) & L2_S_OFFSET))
|
2001-02-24 00:23:45 +03:00
|
|
|
|
2002-03-24 07:38:33 +03:00
|
|
|
#define l1pte_valid(pde) ((pde) != 0)
|
2002-04-05 20:58:01 +04:00
|
|
|
#define l1pte_section_p(pde) (((pde) & L1_TYPE_MASK) == L1_TYPE_S)
|
|
|
|
#define l1pte_page_p(pde) (((pde) & L1_TYPE_MASK) == L1_TYPE_C)
|
|
|
|
#define l1pte_fpage_p(pde) (((pde) & L1_TYPE_MASK) == L1_TYPE_F)
|
2002-03-24 07:38:33 +03:00
|
|
|
|
|
|
|
#define l2pte_valid(pte) ((pte) != 0)
|
2002-04-05 20:58:01 +04:00
|
|
|
#define l2pte_pa(pte) ((pte) & L2_S_FRAME)
|
2002-03-24 06:37:18 +03:00
|
|
|
|
2001-02-24 00:23:45 +03:00
|
|
|
/* L1 and L2 page table macros */
|
2002-04-05 20:58:01 +04:00
|
|
|
#define pmap_pdei(v) ((v & L1_S_FRAME) >> L1_S_SHIFT)
|
2002-03-24 07:38:33 +03:00
|
|
|
#define pmap_pde(m, v) (&((m)->pm_pdir[pmap_pdei(v)]))
|
|
|
|
|
|
|
|
#define pmap_pde_v(pde) l1pte_valid(*(pde))
|
|
|
|
#define pmap_pde_section(pde) l1pte_section_p(*(pde))
|
|
|
|
#define pmap_pde_page(pde) l1pte_page_p(*(pde))
|
|
|
|
#define pmap_pde_fpage(pde) l1pte_fpage_p(*(pde))
|
|
|
|
|
|
|
|
#define pmap_pte_v(pte) l2pte_valid(*(pte))
|
|
|
|
#define pmap_pte_pa(pte) l2pte_pa(*(pte))
|
2001-02-24 00:23:45 +03:00
|
|
|
|
2002-03-24 06:37:18 +03:00
|
|
|
|
2001-02-24 00:23:45 +03:00
|
|
|
/* Size of the kernel part of the L1 page table */
|
|
|
|
#define KERNEL_PD_SIZE \
|
2002-04-05 20:58:01 +04:00
|
|
|
(L1_TABLE_SIZE - (KERNEL_BASE >> L1_S_SHIFT) * sizeof(pd_entry_t))
|
2001-02-24 00:23:45 +03:00
|
|
|
|
2002-04-10 01:00:42 +04:00
|
|
|
/************************* ARM MMU configuration *****************************/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We define several classes of ARM MMU, here:
|
|
|
|
*
|
|
|
|
* ARM_MMU_GENERIC Generic ARM MMU, compatible with ARM6.
|
|
|
|
*
|
|
|
|
* ARM_MMU_XSCALE XScale MMU. Compatible with generic ARM
|
|
|
|
* MMU, but also has several extensions which
|
|
|
|
* require different PTE layout to use.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if defined(_LKM) || defined(CPU_ARM6) || defined(CPU_ARM7) || \
|
|
|
|
defined(CPU_ARM7TDMI) || defined(CPU_ARM8) || defined(CPU_ARM9) || \
|
|
|
|
defined(CPU_SA110) || defined(CPU_SA1100) || defined(CPU_SA1110)
|
|
|
|
#define ARM_MMU_GENERIC 1
|
|
|
|
|
2002-04-10 04:45:43 +04:00
|
|
|
void pmap_copy_page_generic(paddr_t, paddr_t);
|
|
|
|
void pmap_zero_page_generic(paddr_t);
|
|
|
|
|
2002-04-10 01:00:42 +04:00
|
|
|
void pmap_pte_init_generic(void);
|
|
|
|
#if defined(CPU_ARM9)
|
|
|
|
void pmap_pte_init_arm9(void);
|
|
|
|
#endif /* CPU_ARM9 */
|
|
|
|
#else
|
|
|
|
#define ARM_MMU_GENERIC 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(_LKM) || defined(CPU_XSCALE_80200) || defined(CPU_XSCALE_80321)
|
|
|
|
#define ARM_MMU_XSCALE 1
|
|
|
|
|
2002-04-10 04:45:43 +04:00
|
|
|
void pmap_copy_page_xscale(paddr_t, paddr_t);
|
|
|
|
void pmap_zero_page_xscale(paddr_t);
|
|
|
|
|
2002-04-10 01:00:42 +04:00
|
|
|
void pmap_pte_init_xscale(void);
|
|
|
|
#if defined(CPU_XSCALE_80200)
|
|
|
|
void pmap_pte_init_i80200(void);
|
|
|
|
#endif /* CPU_XSCALE_80200 */
|
2002-04-10 03:44:00 +04:00
|
|
|
|
|
|
|
void xscale_setup_minidata(vaddr_t, vaddr_t, paddr_t);
|
2002-04-10 01:00:42 +04:00
|
|
|
#else
|
|
|
|
#define ARM_MMU_XSCALE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define ARM_NMMUS (ARM_MMU_GENERIC + ARM_MMU_XSCALE)
|
|
|
|
#if ARM_NMMUS == 0
|
|
|
|
#error ARM_NMMUS is 0
|
|
|
|
#endif
|
|
|
|
|
2002-04-10 02:37:00 +04:00
|
|
|
extern pt_entry_t pte_l1_s_cache_mode;
|
|
|
|
extern pt_entry_t pte_l1_s_cache_mask;
|
|
|
|
|
|
|
|
extern pt_entry_t pte_l2_l_cache_mode;
|
|
|
|
extern pt_entry_t pte_l2_l_cache_mask;
|
|
|
|
|
|
|
|
extern pt_entry_t pte_l2_s_cache_mode;
|
|
|
|
extern pt_entry_t pte_l2_s_cache_mask;
|
2002-04-10 01:00:42 +04:00
|
|
|
|
|
|
|
extern pt_entry_t pte_l2_s_prot_u;
|
|
|
|
extern pt_entry_t pte_l2_s_prot_w;
|
|
|
|
extern pt_entry_t pte_l2_s_prot_mask;
|
|
|
|
|
|
|
|
extern pt_entry_t pte_l1_s_proto;
|
|
|
|
extern pt_entry_t pte_l1_c_proto;
|
|
|
|
extern pt_entry_t pte_l2_s_proto;
|
|
|
|
|
2002-04-10 04:45:43 +04:00
|
|
|
extern void (*pmap_copy_page_func)(paddr_t, paddr_t);
|
|
|
|
extern void (*pmap_zero_page_func)(paddr_t);
|
|
|
|
|
2002-04-10 01:00:42 +04:00
|
|
|
/*****************************************************************************/
|
|
|
|
|
2002-01-19 19:55:20 +03:00
|
|
|
/*
|
|
|
|
* tell MI code that the cache is virtually-indexed *and* virtually-tagged.
|
|
|
|
*/
|
|
|
|
#define PMAP_CACHE_VIVT
|
|
|
|
|
2002-04-09 23:37:14 +04:00
|
|
|
/*
|
|
|
|
* These macros define the various bit masks in the PTE.
|
|
|
|
*
|
|
|
|
* We use these macros since we use different bits on different processor
|
|
|
|
* models.
|
|
|
|
*/
|
|
|
|
#define L1_S_PROT_U (L1_S_AP(AP_U))
|
|
|
|
#define L1_S_PROT_W (L1_S_AP(AP_W))
|
|
|
|
#define L1_S_PROT_MASK (L1_S_PROT_U|L1_S_PROT_W)
|
|
|
|
|
2002-04-10 02:37:00 +04:00
|
|
|
#define L1_S_CACHE_MASK_generic (L1_S_B|L1_S_C)
|
|
|
|
#define L1_S_CACHE_MASK_xscale (L1_S_B|L1_S_C|L1_S_XSCALE_TEX(TEX_XSCALE_X))
|
2002-04-09 23:37:14 +04:00
|
|
|
|
|
|
|
#define L2_L_PROT_U (L2_AP(AP_U))
|
|
|
|
#define L2_L_PROT_W (L2_AP(AP_W))
|
|
|
|
#define L2_L_PROT_MASK (L2_L_PROT_U|L2_L_PROT_W)
|
|
|
|
|
2002-04-10 02:37:00 +04:00
|
|
|
#define L2_L_CACHE_MASK_generic (L2_B|L2_C)
|
|
|
|
#define L2_L_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_L_TEX(TEX_XSCALE_X))
|
|
|
|
|
2002-04-10 01:00:42 +04:00
|
|
|
#define L2_S_PROT_U_generic (L2_AP(AP_U))
|
|
|
|
#define L2_S_PROT_W_generic (L2_AP(AP_W))
|
|
|
|
#define L2_S_PROT_MASK_generic (L2_S_PROT_U|L2_S_PROT_W)
|
|
|
|
|
2002-04-10 01:23:16 +04:00
|
|
|
#define L2_S_PROT_U_xscale (L2_AP0(AP_U))
|
|
|
|
#define L2_S_PROT_W_xscale (L2_AP0(AP_W))
|
2002-04-10 01:00:42 +04:00
|
|
|
#define L2_S_PROT_MASK_xscale (L2_S_PROT_U|L2_S_PROT_W)
|
|
|
|
|
2002-04-10 02:37:00 +04:00
|
|
|
#define L2_S_CACHE_MASK_generic (L2_B|L2_C)
|
|
|
|
#define L2_S_CACHE_MASK_xscale (L2_B|L2_C|L2_XSCALE_T_TEX(TEX_XSCALE_X))
|
2002-04-10 01:00:42 +04:00
|
|
|
|
|
|
|
#define L1_S_PROTO_generic (L1_TYPE_S | L1_S_IMP)
|
2002-04-10 01:11:31 +04:00
|
|
|
#define L1_S_PROTO_xscale (L1_TYPE_S)
|
2002-04-10 01:00:42 +04:00
|
|
|
|
|
|
|
#define L1_C_PROTO_generic (L1_TYPE_C | L1_C_IMP2)
|
2002-04-10 01:11:31 +04:00
|
|
|
#define L1_C_PROTO_xscale (L1_TYPE_C)
|
2002-04-10 01:00:42 +04:00
|
|
|
|
|
|
|
#define L2_L_PROTO (L2_TYPE_L)
|
|
|
|
|
|
|
|
#define L2_S_PROTO_generic (L2_TYPE_S)
|
2002-04-10 01:23:16 +04:00
|
|
|
#define L2_S_PROTO_xscale (L2_TYPE_XSCALE_XS)
|
2002-04-10 01:00:42 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* User-visible names for the ones that vary with MMU class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#if ARM_NMMUS > 1
|
|
|
|
/* More than one MMU class configured; use variables. */
|
|
|
|
#define L2_S_PROT_U pte_l2_s_prot_u
|
|
|
|
#define L2_S_PROT_W pte_l2_s_prot_w
|
|
|
|
#define L2_S_PROT_MASK pte_l2_s_prot_mask
|
|
|
|
|
2002-04-10 02:37:00 +04:00
|
|
|
#define L1_S_CACHE_MASK pte_l1_s_cache_mask
|
|
|
|
#define L2_L_CACHE_MASK pte_l2_l_cache_mask
|
|
|
|
#define L2_S_CACHE_MASK pte_l2_s_cache_mask
|
|
|
|
|
2002-04-10 01:00:42 +04:00
|
|
|
#define L1_S_PROTO pte_l1_s_proto
|
|
|
|
#define L1_C_PROTO pte_l1_c_proto
|
|
|
|
#define L2_S_PROTO pte_l2_s_proto
|
2002-04-10 04:45:43 +04:00
|
|
|
|
|
|
|
#define pmap_copy_page(s, d) (*pmap_copy_page_func)((s), (d))
|
|
|
|
#define pmap_zero_page(d) (*pmap_zero_page_func)((d))
|
2002-04-10 01:00:42 +04:00
|
|
|
#elif ARM_MMU_GENERIC == 1
|
|
|
|
#define L2_S_PROT_U L2_S_PROT_U_generic
|
|
|
|
#define L2_S_PROT_W L2_S_PROT_W_generic
|
|
|
|
#define L2_S_PROT_MASK L2_S_PROT_MASK_generic
|
|
|
|
|
2002-04-10 02:37:00 +04:00
|
|
|
#define L1_S_CACHE_MASK L1_S_CACHE_MASK_generic
|
|
|
|
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_generic
|
|
|
|
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_generic
|
|
|
|
|
2002-04-10 01:00:42 +04:00
|
|
|
#define L1_S_PROTO L1_S_PROTO_generic
|
|
|
|
#define L1_C_PROTO L1_C_PROTO_generic
|
|
|
|
#define L2_S_PROTO L2_S_PROTO_generic
|
2002-04-10 04:45:43 +04:00
|
|
|
|
|
|
|
#define pmap_copy_page(s, d) pmap_copy_page_generic((s), (d))
|
|
|
|
#define pmap_zero_page(d) pmap_zero_page_generic((d))
|
2002-04-10 01:00:42 +04:00
|
|
|
#elif ARM_MMU_XSCALE == 1
|
|
|
|
#define L2_S_PROT_U L2_S_PROT_U_xscale
|
|
|
|
#define L2_S_PROT_W L2_S_PROT_W_xscale
|
|
|
|
#define L2_S_PROT_MASK L2_S_PROT_MASK_xscale
|
|
|
|
|
2002-04-10 02:37:00 +04:00
|
|
|
#define L1_S_CACHE_MASK L1_S_CACHE_MASK_xscale
|
|
|
|
#define L2_L_CACHE_MASK L2_L_CACHE_MASK_xscale
|
|
|
|
#define L2_S_CACHE_MASK L2_S_CACHE_MASK_xscale
|
|
|
|
|
2002-04-10 01:00:42 +04:00
|
|
|
#define L1_S_PROTO L1_S_PROTO_xscale
|
|
|
|
#define L1_C_PROTO L1_C_PROTO_xscale
|
|
|
|
#define L2_S_PROTO L2_S_PROTO_xscale
|
2002-04-10 04:45:43 +04:00
|
|
|
|
|
|
|
#define pmap_copy_page(s, d) pmap_copy_page_xscale((s), (d))
|
|
|
|
#define pmap_zero_page(d) pmap_zero_page_xscale((d))
|
2002-04-10 01:00:42 +04:00
|
|
|
#endif /* ARM_NMMUS > 1 */
|
2002-04-09 23:37:14 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* These macros return various bits based on kernel/user and protection.
|
|
|
|
* Note that the compiler will usually fold these at compile time.
|
|
|
|
*/
|
|
|
|
#define L1_S_PROT(ku, pr) ((((ku) == PTE_USER) ? L1_S_PROT_U : 0) | \
|
|
|
|
(((pr) & VM_PROT_WRITE) ? L1_S_PROT_W : 0))
|
|
|
|
|
|
|
|
#define L2_L_PROT(ku, pr) ((((ku) == PTE_USER) ? L2_L_PROT_U : 0) | \
|
|
|
|
(((pr) & VM_PROT_WRITE) ? L2_L_PROT_W : 0))
|
|
|
|
|
|
|
|
#define L2_S_PROT(ku, pr) ((((ku) == PTE_USER) ? L2_S_PROT_U : 0) | \
|
|
|
|
(((pr) & VM_PROT_WRITE) ? L2_S_PROT_W : 0))
|
|
|
|
|
2001-11-23 20:39:03 +03:00
|
|
|
#endif /* _KERNEL */
|
|
|
|
|
2001-02-24 00:23:45 +03:00
|
|
|
#endif /* _ARM32_PMAP_H_ */
|