Commit 8687fee6 authored by Pete Zaitcev's avatar Pete Zaitcev Committed by David S. Miller

[sparc]: pte_file & friends

parent 485d5a3f
......@@ -2162,6 +2162,16 @@ static void smp_flush_page_for_dma(unsigned long page)
#endif
static pte_t srmmu_pgoff_to_pte(unsigned long pgoff)
{
return __pte((pgoff << SRMMU_PTE_FILE_SHIFT) | SRMMU_FILE);
}
static unsigned long srmmu_pte_to_pgoff(pte_t pte)
{
return pte_val(pte) >> SRMMU_PTE_FILE_SHIFT;
}
/* Load up routines and constants for sun4m and sun4d mmu */
void __init ld_mmu_srmmu(void)
{
......@@ -2189,6 +2199,8 @@ void __init ld_mmu_srmmu(void)
page_kernel = pgprot_val(SRMMU_PAGE_KERNEL);
pg_iobits = SRMMU_VALID | SRMMU_WRITE | SRMMU_REF;
BTFIXUPSET_SIMM13(pte_file_max_bits, SRMMU_PTE_FILE_MAX_BITS);
/* Functions */
#ifndef CONFIG_SMP
BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4md, BTFIXUPCALL_SWAPG1G2);
......@@ -2239,6 +2251,7 @@ void __init ld_mmu_srmmu(void)
BTFIXUPSET_HALF(pte_writei, SRMMU_WRITE);
BTFIXUPSET_HALF(pte_dirtyi, SRMMU_DIRTY);
BTFIXUPSET_HALF(pte_youngi, SRMMU_REF);
BTFIXUPSET_HALF(pte_filei, SRMMU_FILE);
BTFIXUPSET_HALF(pte_wrprotecti, SRMMU_WRITE);
BTFIXUPSET_HALF(pte_mkcleani, SRMMU_DIRTY);
BTFIXUPSET_HALF(pte_mkoldi, SRMMU_REF);
......@@ -2253,6 +2266,9 @@ void __init ld_mmu_srmmu(void)
BTFIXUPSET_CALL(alloc_thread_info, srmmu_alloc_thread_info, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(free_thread_info, srmmu_free_thread_info, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pte_to_pgoff, srmmu_pte_to_pgoff, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pgoff_to_pte, srmmu_pgoff_to_pte, BTFIXUPCALL_NORM);
get_srmmu_type();
patch_window_trap_handlers();
......
......@@ -1798,9 +1798,20 @@ static pte_t sun4c_mk_pte_io(unsigned long page, pgprot_t pgprot, int space)
static unsigned long sun4c_pte_pfn(pte_t pte)
{
return (unsigned long)(pte_val(pte) & SUN4C_PFN_MASK);
return pte_val(pte) & SUN4C_PFN_MASK;
}
static pte_t sun4c_pgoff_to_pte(unsigned long pgoff)
{
return __pte(pgoff | _SUN4C_PAGE_FILE);
}
static unsigned long sun4c_pte_to_pgoff(pte_t pte)
{
return pte_val(pte) & ((1UL << SUN4C_PTE_FILE_MAX_BITS) - 1);
}
static __inline__ unsigned long sun4c_pmd_page_v(pmd_t pmd)
{
return (pmd_val(pmd) & PAGE_MASK);
......@@ -2116,6 +2127,8 @@ void __init ld_mmu_sun4c(void)
pg_iobits = _SUN4C_PAGE_PRESENT | _SUN4C_READABLE | _SUN4C_WRITEABLE |
_SUN4C_PAGE_IO | _SUN4C_PAGE_NOCACHE;
BTFIXUPSET_SIMM13(pte_file_max_bits, SUN4C_PTE_FILE_MAX_BITS);
/* Functions */
BTFIXUPSET_CALL(___xchg32, ___xchg32_sun4c, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(do_check_pgt_cache, sun4c_check_pgt_cache, BTFIXUPCALL_NORM);
......@@ -2190,6 +2203,7 @@ void __init ld_mmu_sun4c(void)
BTFIXUPSET_HALF(pte_writei, _SUN4C_PAGE_WRITE);
BTFIXUPSET_HALF(pte_dirtyi, _SUN4C_PAGE_MODIFIED);
BTFIXUPSET_HALF(pte_youngi, _SUN4C_PAGE_ACCESSED);
BTFIXUPSET_HALF(pte_filei, _SUN4C_PAGE_FILE);
BTFIXUPSET_HALF(pte_wrprotecti, _SUN4C_PAGE_WRITE|_SUN4C_PAGE_SILENT_WRITE);
BTFIXUPSET_HALF(pte_mkcleani, _SUN4C_PAGE_MODIFIED|_SUN4C_PAGE_SILENT_WRITE);
BTFIXUPSET_HALF(pte_mkoldi, _SUN4C_PAGE_ACCESSED|_SUN4C_PAGE_SILENT_READ);
......@@ -2198,6 +2212,9 @@ void __init ld_mmu_sun4c(void)
BTFIXUPSET_CALL(pte_mkyoung, sun4c_pte_mkyoung, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(update_mmu_cache, sun4c_update_mmu_cache, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pte_to_pgoff, sun4c_pte_to_pgoff, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(pgoff_to_pte, sun4c_pgoff_to_pte, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(mmu_lockarea, sun4c_lockarea, BTFIXUPCALL_NORM);
BTFIXUPSET_CALL(mmu_unlockarea, sun4c_unlockarea, BTFIXUPCALL_NORM);
......
......@@ -11,7 +11,7 @@
#include <linux/config.h>
#include <linux/spinlock.h>
/* #include <asm/asi.h> */ /* doesn't seem like being used XXX */
#include <asm/types.h>
#ifdef CONFIG_SUN4
#include <asm/pgtsun4.h>
#else
......@@ -252,6 +252,17 @@ extern __inline__ int pte_young(pte_t pte)
return pte_val(pte) & BTFIXUP_HALF(pte_youngi);
}
/*
* The following only work if pte_present() is not true.
*/
BTFIXUPDEF_HALF(pte_filei)
extern int pte_file(pte_t pte) __attribute__((const));
extern __inline__ int pte_file(pte_t pte)
{
return pte_val(pte) & BTFIXUP_HALF(pte_filei);
}
BTFIXUPDEF_HALF(pte_wrprotecti)
BTFIXUPDEF_HALF(pte_mkcleani)
BTFIXUPDEF_HALF(pte_mkoldi)
......@@ -373,6 +384,17 @@ extern int invalid_segment;
#define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) })
#define __swp_entry_to_pte(x) ((pte_t) { (x).val })
/* file-offset-in-pte helpers */
BTFIXUPDEF_CALL(unsigned long, pte_to_pgoff, pte_t pte);
BTFIXUPDEF_CALL(pte_t, pgoff_to_pte, unsigned long pgoff);
BTFIXUPDEF_SIMM13(pte_file_max_bits);
#define pte_to_pgoff(pte) BTFIXUP_CALL(pte_to_pgoff)(pte)
#define pgoff_to_pte(off) BTFIXUP_CALL(pgoff_to_pte)(off)
#define PTE_FILE_MAX_BITS BTFIXUP_SIMM13(pte_file_max_bits)
/*
*/
struct ctx_list {
struct ctx_list *next;
struct ctx_list *prev;
......
......@@ -62,6 +62,11 @@
#define SRMMU_PRIV 0x1c
#define SRMMU_PRIV_RDONLY 0x18
#define SRMMU_FILE 0x40 /* Implemented in software */
#define SRMMU_PTE_FILE_MAX_BITS 24
#define SRMMU_PTE_FILE_SHIFT 8
#define SRMMU_CHG_MASK (0xffffff00 | SRMMU_REF | SRMMU_DIRTY)
/* Some day I will implement true fine grained access bits for
......
......@@ -53,6 +53,7 @@
#define _SUN4C_PAGE_NOCACHE 0x10000000 /* non-cacheable page */
#define _SUN4C_PAGE_PRESENT 0x08000000 /* implemented in software */
#define _SUN4C_PAGE_IO 0x04000000 /* I/O page */
#define _SUN4C_PAGE_FILE 0x02000000 /* implemented in software */
#define _SUN4C_PAGE_READ 0x00800000 /* implemented in software */
#define _SUN4C_PAGE_WRITE 0x00400000 /* implemented in software */
#define _SUN4C_PAGE_ACCESSED 0x00200000 /* implemented in software */
......@@ -73,6 +74,12 @@
#define SUN4C_PAGE_KERNEL __pgprot(_SUN4C_READABLE|_SUN4C_WRITEABLE|\
_SUN4C_PAGE_DIRTY|_SUN4C_PAGE_PRIV)
/*
* We have a couple of free bits left, but it's probably not a big
* deal, considering sizes of RAM and swap on sun4c.
*/
#define SUN4C_PTE_FILE_MAX_BITS 20
#ifndef __ASSEMBLY__
extern __inline__ unsigned long sun4c_get_synchronous_error(void)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment