]> err.no Git - linux-2.6/blobdiff - arch/powerpc/mm/hash_utils_64.c
[PATCH] powerpc: Replace platform_is_lpar() with a firmware feature
[linux-2.6] / arch / powerpc / mm / hash_utils_64.c
index 95b4cd6b65e02a0a6886522da5aa8573c3c9a464..89b35c1813141c41172295325d8684c4d88c568b 100644 (file)
@@ -88,6 +88,7 @@ static unsigned long _SDR1;
 struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
 
 hpte_t *htab_address;
+unsigned long htab_size_bytes;
 unsigned long htab_hash_mask;
 int mmu_linear_psize = MMU_PAGE_4K;
 int mmu_virtual_psize = MMU_PAGE_4K;
@@ -168,7 +169,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
 #ifdef CONFIG_PPC_ISERIES
                if (_machine == PLATFORM_ISERIES_LPAR)
                        ret = iSeries_hpte_insert(hpteg, va,
-                                                 virt_to_abs(paddr),
+                                                 paddr,
                                                  tmp_mode,
                                                  HPTE_V_BOLTED,
                                                  psize);
@@ -177,7 +178,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
 #ifdef CONFIG_PPC_PSERIES
                if (_machine & PLATFORM_LPAR)
                        ret = pSeries_lpar_hpte_insert(hpteg, va,
-                                                      virt_to_abs(paddr),
+                                                      paddr,
                                                       tmp_mode,
                                                       HPTE_V_BOLTED,
                                                       psize);
@@ -185,7 +186,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
 #endif
 #ifdef CONFIG_PPC_MULTIPLATFORM
                        ret = native_hpte_insert(hpteg, va,
-                                                virt_to_abs(paddr),
+                                                paddr,
                                                 tmp_mode, HPTE_V_BOLTED,
                                                 psize);
 #endif
@@ -391,7 +392,7 @@ static unsigned long __init htab_get_table_size(void)
 #ifdef CONFIG_MEMORY_HOTPLUG
 void create_section_mapping(unsigned long start, unsigned long end)
 {
-               BUG_ON(htab_bolt_mapping(start, end, start,
+               BUG_ON(htab_bolt_mapping(start, end, __pa(start),
                        _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX,
                        mmu_linear_psize));
 }
@@ -399,7 +400,7 @@ void create_section_mapping(unsigned long start, unsigned long end)
 
 void __init htab_initialize(void)
 {
-       unsigned long table, htab_size_bytes;
+       unsigned long table;
        unsigned long pteg_count;
        unsigned long mode_rw;
        unsigned long base = 0, size = 0;
@@ -421,7 +422,7 @@ void __init htab_initialize(void)
 
        htab_hash_mask = pteg_count - 1;
 
-       if (platform_is_lpar()) {
+       if (firmware_has_feature(FW_FEATURE_LPAR)) {
                /* Using a hypervisor which owns the htab */
                htab_address = NULL;
                _SDR1 = 0; 
@@ -472,21 +473,22 @@ void __init htab_initialize(void)
 
                if (dart_tablebase != 0 && dart_tablebase >= base
                    && dart_tablebase < (base + size)) {
+                       unsigned long dart_table_end = dart_tablebase + 16 * MB;
                        if (base != dart_tablebase)
                                BUG_ON(htab_bolt_mapping(base, dart_tablebase,
-                                                        base, mode_rw,
-                                                        mmu_linear_psize));
-                       if ((base + size) > (dart_tablebase + 16*MB))
+                                                       __pa(base), mode_rw,
+                                                       mmu_linear_psize));
+                       if ((base + size) > dart_table_end)
                                BUG_ON(htab_bolt_mapping(dart_tablebase+16*MB,
-                                                        base + size,
-                                                        dart_tablebase+16*MB,
+                                                       base + size,
+                                                       __pa(dart_table_end),
                                                         mode_rw,
                                                         mmu_linear_psize));
                        continue;
                }
 #endif /* CONFIG_U3_DART */
-               BUG_ON(htab_bolt_mapping(base, base + size, base,
-                                        mode_rw, mmu_linear_psize));
+               BUG_ON(htab_bolt_mapping(base, base + size, __pa(base),
+                                       mode_rw, mmu_linear_psize));
        }
 
        /*
@@ -503,8 +505,8 @@ void __init htab_initialize(void)
                if (base + size >= tce_alloc_start)
                        tce_alloc_start = base + size + 1;
 
-               BUG_ON(htab_bolt_mapping(tce_alloc_start, tce_alloc_end,
-                                        tce_alloc_start, mode_rw,
+               BUG_ON(htab_bolt_mapping(tce_alloc_start, tce_alloc_end,
+                                        __pa(tce_alloc_start), mode_rw,
                                         mmu_linear_psize));
        }
 
@@ -515,7 +517,7 @@ void __init htab_initialize(void)
 
 void htab_initialize_secondary(void)
 {
-       if (!platform_is_lpar())
+       if (!firmware_has_feature(FW_FEATURE_LPAR))
                mtspr(SPRN_SDR1, _SDR1);
 }