diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2006-06-23 04:16:38 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-06-27 21:59:47 -0400 |
commit | 7d0daae4ae1a3e80d78b83cddf414a3b98a962f4 (patch) | |
tree | f8dcd24a598212b58652c771a5e81c8a167bb3d1 /arch/powerpc/mm | |
parent | 7a4571ae553e2972b7958306fd796a2fd24fd7d1 (diff) |
[POWERPC] powerpc: Initialise ppc_md htab pointers earlier
Initialise the ppc_md htab callbacks earlier, in the probe routines. This
allows us to call htab_finish_init() from htab_initialize(), and makes it
private to hash_utils_64.c. Move htab_finish_init() and make_bl() above
htab_initialize() to avoid forward declarations.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r-- | arch/powerpc/mm/hash_native_64.c | 3 | ||||
-rw-r--r-- | arch/powerpc/mm/hash_utils_64.c | 72 |
2 files changed, 38 insertions, 37 deletions
diff --git a/arch/powerpc/mm/hash_native_64.c b/arch/powerpc/mm/hash_native_64.c index a0f3cbd00d39..c90f124f3c71 100644 --- a/arch/powerpc/mm/hash_native_64.c +++ b/arch/powerpc/mm/hash_native_64.c | |||
@@ -520,7 +520,7 @@ static inline int tlb_batching_enabled(void) | |||
520 | } | 520 | } |
521 | #endif | 521 | #endif |
522 | 522 | ||
523 | void hpte_init_native(void) | 523 | void __init hpte_init_native(void) |
524 | { | 524 | { |
525 | ppc_md.hpte_invalidate = native_hpte_invalidate; | 525 | ppc_md.hpte_invalidate = native_hpte_invalidate; |
526 | ppc_md.hpte_updatepp = native_hpte_updatepp; | 526 | ppc_md.hpte_updatepp = native_hpte_updatepp; |
@@ -530,5 +530,4 @@ void hpte_init_native(void) | |||
530 | ppc_md.hpte_clear_all = native_hpte_clear; | 530 | ppc_md.hpte_clear_all = native_hpte_clear; |
531 | if (tlb_batching_enabled()) | 531 | if (tlb_batching_enabled()) |
532 | ppc_md.flush_hash_range = native_flush_hash_range; | 532 | ppc_md.flush_hash_range = native_flush_hash_range; |
533 | htab_finish_init(); | ||
534 | } | 533 | } |
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c index d03fd2b4445e..9cefe6a7aeb1 100644 --- a/arch/powerpc/mm/hash_utils_64.c +++ b/arch/powerpc/mm/hash_utils_64.c | |||
@@ -413,6 +413,41 @@ void create_section_mapping(unsigned long start, unsigned long end) | |||
413 | } | 413 | } |
414 | #endif /* CONFIG_MEMORY_HOTPLUG */ | 414 | #endif /* CONFIG_MEMORY_HOTPLUG */ |
415 | 415 | ||
416 | static inline void make_bl(unsigned int *insn_addr, void *func) | ||
417 | { | ||
418 | unsigned long funcp = *((unsigned long *)func); | ||
419 | int offset = funcp - (unsigned long)insn_addr; | ||
420 | |||
421 | *insn_addr = (unsigned int)(0x48000001 | (offset & 0x03fffffc)); | ||
422 | flush_icache_range((unsigned long)insn_addr, 4+ | ||
423 | (unsigned long)insn_addr); | ||
424 | } | ||
425 | |||
426 | static void __init htab_finish_init(void) | ||
427 | { | ||
428 | extern unsigned int *htab_call_hpte_insert1; | ||
429 | extern unsigned int *htab_call_hpte_insert2; | ||
430 | extern unsigned int *htab_call_hpte_remove; | ||
431 | extern unsigned int *htab_call_hpte_updatepp; | ||
432 | |||
433 | #ifdef CONFIG_PPC_64K_PAGES | ||
434 | extern unsigned int *ht64_call_hpte_insert1; | ||
435 | extern unsigned int *ht64_call_hpte_insert2; | ||
436 | extern unsigned int *ht64_call_hpte_remove; | ||
437 | extern unsigned int *ht64_call_hpte_updatepp; | ||
438 | |||
439 | make_bl(ht64_call_hpte_insert1, ppc_md.hpte_insert); | ||
440 | make_bl(ht64_call_hpte_insert2, ppc_md.hpte_insert); | ||
441 | make_bl(ht64_call_hpte_remove, ppc_md.hpte_remove); | ||
442 | make_bl(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp); | ||
443 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
444 | |||
445 | make_bl(htab_call_hpte_insert1, ppc_md.hpte_insert); | ||
446 | make_bl(htab_call_hpte_insert2, ppc_md.hpte_insert); | ||
447 | make_bl(htab_call_hpte_remove, ppc_md.hpte_remove); | ||
448 | make_bl(htab_call_hpte_updatepp, ppc_md.hpte_updatepp); | ||
449 | } | ||
450 | |||
416 | void __init htab_initialize(void) | 451 | void __init htab_initialize(void) |
417 | { | 452 | { |
418 | unsigned long table; | 453 | unsigned long table; |
@@ -525,6 +560,8 @@ void __init htab_initialize(void) | |||
525 | mmu_linear_psize)); | 560 | mmu_linear_psize)); |
526 | } | 561 | } |
527 | 562 | ||
563 | htab_finish_init(); | ||
564 | |||
528 | DBG(" <- htab_initialize()\n"); | 565 | DBG(" <- htab_initialize()\n"); |
529 | } | 566 | } |
530 | #undef KB | 567 | #undef KB |
@@ -787,16 +824,6 @@ void flush_hash_range(unsigned long number, int local) | |||
787 | } | 824 | } |
788 | } | 825 | } |
789 | 826 | ||
790 | static inline void make_bl(unsigned int *insn_addr, void *func) | ||
791 | { | ||
792 | unsigned long funcp = *((unsigned long *)func); | ||
793 | int offset = funcp - (unsigned long)insn_addr; | ||
794 | |||
795 | *insn_addr = (unsigned int)(0x48000001 | (offset & 0x03fffffc)); | ||
796 | flush_icache_range((unsigned long)insn_addr, 4+ | ||
797 | (unsigned long)insn_addr); | ||
798 | } | ||
799 | |||
800 | /* | 827 | /* |
801 | * low_hash_fault is called when we the low level hash code failed | 828 | * low_hash_fault is called when we the low level hash code failed |
802 | * to instert a PTE due to an hypervisor error | 829 | * to instert a PTE due to an hypervisor error |
@@ -815,28 +842,3 @@ void low_hash_fault(struct pt_regs *regs, unsigned long address) | |||
815 | } | 842 | } |
816 | bad_page_fault(regs, address, SIGBUS); | 843 | bad_page_fault(regs, address, SIGBUS); |
817 | } | 844 | } |
818 | |||
819 | void __init htab_finish_init(void) | ||
820 | { | ||
821 | extern unsigned int *htab_call_hpte_insert1; | ||
822 | extern unsigned int *htab_call_hpte_insert2; | ||
823 | extern unsigned int *htab_call_hpte_remove; | ||
824 | extern unsigned int *htab_call_hpte_updatepp; | ||
825 | |||
826 | #ifdef CONFIG_PPC_64K_PAGES | ||
827 | extern unsigned int *ht64_call_hpte_insert1; | ||
828 | extern unsigned int *ht64_call_hpte_insert2; | ||
829 | extern unsigned int *ht64_call_hpte_remove; | ||
830 | extern unsigned int *ht64_call_hpte_updatepp; | ||
831 | |||
832 | make_bl(ht64_call_hpte_insert1, ppc_md.hpte_insert); | ||
833 | make_bl(ht64_call_hpte_insert2, ppc_md.hpte_insert); | ||
834 | make_bl(ht64_call_hpte_remove, ppc_md.hpte_remove); | ||
835 | make_bl(ht64_call_hpte_updatepp, ppc_md.hpte_updatepp); | ||
836 | #endif /* CONFIG_PPC_64K_PAGES */ | ||
837 | |||
838 | make_bl(htab_call_hpte_insert1, ppc_md.hpte_insert); | ||
839 | make_bl(htab_call_hpte_insert2, ppc_md.hpte_insert); | ||
840 | make_bl(htab_call_hpte_remove, ppc_md.hpte_remove); | ||
841 | make_bl(htab_call_hpte_updatepp, ppc_md.hpte_updatepp); | ||
842 | } | ||