aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/sparc/mm/srmmu.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index 146742bee39a..ab62595cf366 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -677,44 +677,48 @@ static inline unsigned long srmmu_probe(unsigned long vaddr)
677static void __init srmmu_inherit_prom_mappings(unsigned long start, 677static void __init srmmu_inherit_prom_mappings(unsigned long start,
678 unsigned long end) 678 unsigned long end)
679{ 679{
680 unsigned long probed;
681 unsigned long addr;
680 pgd_t *pgdp; 682 pgd_t *pgdp;
681 pmd_t *pmdp; 683 pmd_t *pmdp;
682 pte_t *ptep; 684 pte_t *ptep;
683 int what = 0; /* 0 = normal-pte, 1 = pmd-level pte, 2 = pgd-level pte */ 685 int what; /* 0 = normal-pte, 1 = pmd-level pte, 2 = pgd-level pte */
684 unsigned long prompte;
685 686
686 while (start <= end) { 687 while (start <= end) {
687 if (start == 0) 688 if (start == 0)
688 break; /* probably wrap around */ 689 break; /* probably wrap around */
689 if (start == 0xfef00000) 690 if (start == 0xfef00000)
690 start = KADB_DEBUGGER_BEGVM; 691 start = KADB_DEBUGGER_BEGVM;
691 if (!(prompte = srmmu_probe(start))) { 692 probed = srmmu_probe(start);
693 if (!probed) {
694 /* continue probing until we find an entry */
692 start += PAGE_SIZE; 695 start += PAGE_SIZE;
693 continue; 696 continue;
694 } 697 }
695 698
696 /* A red snapper, see what it really is. */ 699 /* A red snapper, see what it really is. */
697 what = 0; 700 what = 0;
701 addr = start - PAGE_SIZE;
698 702
699 if (!(start & ~(SRMMU_REAL_PMD_MASK))) { 703 if (!(start & ~(SRMMU_REAL_PMD_MASK))) {
700 if (srmmu_probe((start - PAGE_SIZE) + SRMMU_REAL_PMD_SIZE) == prompte) 704 if (srmmu_probe(addr + SRMMU_REAL_PMD_SIZE) == probed)
701 what = 1; 705 what = 1;
702 } 706 }
703 707
704 if (!(start & ~(SRMMU_PGDIR_MASK))) { 708 if (!(start & ~(SRMMU_PGDIR_MASK))) {
705 if (srmmu_probe((start-PAGE_SIZE) + SRMMU_PGDIR_SIZE) == 709 if (srmmu_probe(addr + SRMMU_PGDIR_SIZE) == probed)
706 prompte)
707 what = 2; 710 what = 2;
708 } 711 }
709 712
710 pgdp = pgd_offset_k(start); 713 pgdp = pgd_offset_k(start);
711 if (what == 2) { 714 if (what == 2) {
712 *(pgd_t *)__nocache_fix(pgdp) = __pgd(prompte); 715 *(pgd_t *)__nocache_fix(pgdp) = __pgd(probed);
713 start += SRMMU_PGDIR_SIZE; 716 start += SRMMU_PGDIR_SIZE;
714 continue; 717 continue;
715 } 718 }
716 if (pgd_none(*(pgd_t *)__nocache_fix(pgdp))) { 719 if (pgd_none(*(pgd_t *)__nocache_fix(pgdp))) {
717 pmdp = __srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE, SRMMU_PMD_TABLE_SIZE); 720 pmdp = __srmmu_get_nocache(SRMMU_PMD_TABLE_SIZE,
721 SRMMU_PMD_TABLE_SIZE);
718 if (pmdp == NULL) 722 if (pmdp == NULL)
719 early_pgtable_allocfail("pmd"); 723 early_pgtable_allocfail("pmd");
720 memset(__nocache_fix(pmdp), 0, SRMMU_PMD_TABLE_SIZE); 724 memset(__nocache_fix(pmdp), 0, SRMMU_PMD_TABLE_SIZE);
@@ -734,13 +738,15 @@ static void __init srmmu_inherit_prom_mappings(unsigned long start,
734 * good hardware PTE piece. Alternatives seem worse. 738 * good hardware PTE piece. Alternatives seem worse.
735 */ 739 */
736 unsigned int x; /* Index of HW PMD in soft cluster */ 740 unsigned int x; /* Index of HW PMD in soft cluster */
741 unsigned long *val;
737 x = (start >> PMD_SHIFT) & 15; 742 x = (start >> PMD_SHIFT) & 15;
738 *(unsigned long *)__nocache_fix(&pmdp->pmdv[x]) = prompte; 743 val = &pmdp->pmdv[x];
744 *(unsigned long *)__nocache_fix(val) = probed;
739 start += SRMMU_REAL_PMD_SIZE; 745 start += SRMMU_REAL_PMD_SIZE;
740 continue; 746 continue;
741 } 747 }
742 ptep = pte_offset_kernel(__nocache_fix(pmdp), start); 748 ptep = pte_offset_kernel(__nocache_fix(pmdp), start);
743 *(pte_t *)__nocache_fix(ptep) = __pte(prompte); 749 *(pte_t *)__nocache_fix(ptep) = __pte(probed);
744 start += PAGE_SIZE; 750 start += PAGE_SIZE;
745 } 751 }
746} 752}