aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/sparc/include/asm/pgtable_32.h19
-rw-r--r--arch/sparc/mm/srmmu.c19
2 files changed, 16 insertions, 22 deletions
diff --git a/arch/sparc/include/asm/pgtable_32.h b/arch/sparc/include/asm/pgtable_32.h
index c0e4d737afb2..9b4ff5abec91 100644
--- a/arch/sparc/include/asm/pgtable_32.h
+++ b/arch/sparc/include/asm/pgtable_32.h
@@ -171,13 +171,20 @@ static inline void pmd_clear(pmd_t *pmdp)
171 srmmu_set_pte((pte_t *)&pmdp->pmdv[i], __pte(0)); 171 srmmu_set_pte((pte_t *)&pmdp->pmdv[i], __pte(0));
172} 172}
173 173
174BTFIXUPDEF_CALL_CONST(int, pgd_none, pgd_t) 174static inline int pgd_none(pgd_t pgd)
175BTFIXUPDEF_CALL_CONST(int, pgd_bad, pgd_t) 175{
176BTFIXUPDEF_CALL_CONST(int, pgd_present, pgd_t) 176 return !(pgd_val(pgd) & 0xFFFFFFF);
177}
177 178
178#define pgd_none(pgd) BTFIXUP_CALL(pgd_none)(pgd) 179static inline int pgd_bad(pgd_t pgd)
179#define pgd_bad(pgd) BTFIXUP_CALL(pgd_bad)(pgd) 180{
180#define pgd_present(pgd) BTFIXUP_CALL(pgd_present)(pgd) 181 return (pgd_val(pgd) & SRMMU_ET_MASK) != SRMMU_ET_PTD;
182}
183
184static inline int pgd_present(pgd_t pgd)
185{
186 return ((pgd_val(pgd) & SRMMU_ET_MASK) == SRMMU_ET_PTD);
187}
181 188
182static inline void pgd_clear(pgd_t *pgdp) 189static inline void pgd_clear(pgd_t *pgdp)
183{ 190{
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index c6962715ef08..94dcd06632a2 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -124,15 +124,6 @@ static inline int srmmu_pmd_bad(pmd_t pmd)
124static inline int srmmu_pmd_present(pmd_t pmd) 124static inline int srmmu_pmd_present(pmd_t pmd)
125{ return ((pmd_val(pmd) & SRMMU_ET_MASK) == SRMMU_ET_PTD); } 125{ return ((pmd_val(pmd) & SRMMU_ET_MASK) == SRMMU_ET_PTD); }
126 126
127static inline int srmmu_pgd_none(pgd_t pgd)
128{ return !(pgd_val(pgd) & 0xFFFFFFF); }
129
130static inline int srmmu_pgd_bad(pgd_t pgd)
131{ return (pgd_val(pgd) & SRMMU_ET_MASK) != SRMMU_ET_PTD; }
132
133static inline int srmmu_pgd_present(pgd_t pgd)
134{ return ((pgd_val(pgd) & SRMMU_ET_MASK) == SRMMU_ET_PTD); }
135
136static inline pte_t srmmu_pte_wrprotect(pte_t pte) 127static inline pte_t srmmu_pte_wrprotect(pte_t pte)
137{ return __pte(pte_val(pte) & ~SRMMU_WRITE);} 128{ return __pte(pte_val(pte) & ~SRMMU_WRITE);}
138 129
@@ -1007,7 +998,7 @@ static void __init srmmu_early_allocate_ptable_skeleton(unsigned long start,
1007 998
1008 while(start < end) { 999 while(start < end) {
1009 pgdp = pgd_offset_k(start); 1000 pgdp = pgd_offset_k(start);
1010 if(srmmu_pgd_none(*(pgd_t *)__nocache_fix(pgdp))) { 1001 if (pgd_none(*(pgd_t *)__nocache_fix(pgdp))) {
1011 pmdp = (pmd_t *) __srmmu_get_nocache( 1002 pmdp = (pmd_t *) __srmmu_get_nocache(
1012 SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE); 1003 SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE);
1013 if (pmdp == NULL) 1004 if (pmdp == NULL)
@@ -1038,7 +1029,7 @@ static void __init srmmu_allocate_ptable_skeleton(unsigned long start,
1038 1029
1039 while(start < end) { 1030 while(start < end) {
1040 pgdp = pgd_offset_k(start); 1031 pgdp = pgd_offset_k(start);
1041 if(srmmu_pgd_none(*pgdp)) { 1032 if (pgd_none(*pgdp)) {
1042 pmdp = (pmd_t *)__srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE); 1033 pmdp = (pmd_t *)__srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE);
1043 if (pmdp == NULL) 1034 if (pmdp == NULL)
1044 early_pgtable_allocfail("pmd"); 1035 early_pgtable_allocfail("pmd");
@@ -1104,7 +1095,7 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start,
1104 start += SRMMU_PGDIR_SIZE; 1095 start += SRMMU_PGDIR_SIZE;
1105 continue; 1096 continue;
1106 } 1097 }
1107 if(srmmu_pgd_none(*(pgd_t *)__nocache_fix(pgdp))) { 1098 if (pgd_none(*(pgd_t *)__nocache_fix(pgdp))) {
1108 pmdp = (pmd_t *)__srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE); 1099 pmdp = (pmd_t *)__srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE);
1109 if (pmdp == NULL) 1100 if (pmdp == NULL)
1110 early_pgtable_allocfail("pmd"); 1101 early_pgtable_allocfail("pmd");
@@ -2090,10 +2081,6 @@ void __init ld_mmu_srmmu(void)
2090 BTFIXUPSET_CALL(pmd_bad, srmmu_pmd_bad, BTFIXUPCALL_NORM); 2081 BTFIXUPSET_CALL(pmd_bad, srmmu_pmd_bad, BTFIXUPCALL_NORM);
2091 BTFIXUPSET_CALL(pmd_present, srmmu_pmd_present, BTFIXUPCALL_NORM); 2082 BTFIXUPSET_CALL(pmd_present, srmmu_pmd_present, BTFIXUPCALL_NORM);
2092 2083
2093 BTFIXUPSET_CALL(pgd_none, srmmu_pgd_none, BTFIXUPCALL_NORM);
2094 BTFIXUPSET_CALL(pgd_bad, srmmu_pgd_bad, BTFIXUPCALL_NORM);
2095 BTFIXUPSET_CALL(pgd_present, srmmu_pgd_present, BTFIXUPCALL_NORM);
2096
2097 BTFIXUPSET_CALL(mk_pte, srmmu_mk_pte, BTFIXUPCALL_NORM); 2084 BTFIXUPSET_CALL(mk_pte, srmmu_mk_pte, BTFIXUPCALL_NORM);
2098 BTFIXUPSET_CALL(mk_pte_phys, srmmu_mk_pte_phys, BTFIXUPCALL_NORM); 2085 BTFIXUPSET_CALL(mk_pte_phys, srmmu_mk_pte_phys, BTFIXUPCALL_NORM);
2099 BTFIXUPSET_CALL(mk_pte_io, srmmu_mk_pte_io, BTFIXUPCALL_NORM); 2086 BTFIXUPSET_CALL(mk_pte_io, srmmu_mk_pte_io, BTFIXUPCALL_NORM);