diff options
author | Becky Bruce <becky.bruce@freescale.com> | 2008-06-13 19:41:42 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-06-30 08:31:03 -0400 |
commit | 7c5c4325d2d911fe54db3bc14149bfa558ae0acb (patch) | |
tree | 97c02e9d03bbbb1fff89e9e44eef1e53762e823e /arch/powerpc/mm | |
parent | bf2737f74ffd36f43c6ed11cd2c0826e1d59ad48 (diff) |
powerpc: Change BAT code to use phys_addr_t
Currently, the physical address is an unsigned long, but it should
be phys_addr_t in set_bat, [v/p]_mapped_by_bat. Also, create a
macro that can convert a large physical address into the correct
format for programming the BAT registers.
Signed-off-by: Becky Bruce <becky.bruce@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r-- | arch/powerpc/mm/mmu_decl.h | 2 | ||||
-rw-r--r-- | arch/powerpc/mm/pgtable_32.c | 6 | ||||
-rw-r--r-- | arch/powerpc/mm/ppc_mmu_32.c | 10 |
3 files changed, 9 insertions, 9 deletions
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h index 04802252a64f..46585b7bb194 100644 --- a/arch/powerpc/mm/mmu_decl.h +++ b/arch/powerpc/mm/mmu_decl.h | |||
@@ -29,7 +29,7 @@ extern void hash_preload(struct mm_struct *mm, unsigned long ea, | |||
29 | #ifdef CONFIG_PPC32 | 29 | #ifdef CONFIG_PPC32 |
30 | extern void mapin_ram(void); | 30 | extern void mapin_ram(void); |
31 | extern int map_page(unsigned long va, phys_addr_t pa, int flags); | 31 | extern int map_page(unsigned long va, phys_addr_t pa, int flags); |
32 | extern void setbat(int index, unsigned long virt, unsigned long phys, | 32 | extern void setbat(int index, unsigned long virt, phys_addr_t phys, |
33 | unsigned int size, int flags); | 33 | unsigned int size, int flags); |
34 | extern void settlbcam(int index, unsigned long virt, phys_addr_t phys, | 34 | extern void settlbcam(int index, unsigned long virt, phys_addr_t phys, |
35 | unsigned int size, int flags, unsigned int pid); | 35 | unsigned int size, int flags, unsigned int pid); |
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index e0ff59f21135..c7584072dfcc 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c | |||
@@ -53,9 +53,9 @@ extern void hash_page_sync(void); | |||
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | #ifdef HAVE_BATS | 55 | #ifdef HAVE_BATS |
56 | extern unsigned long v_mapped_by_bats(unsigned long va); | 56 | extern phys_addr_t v_mapped_by_bats(unsigned long va); |
57 | extern unsigned long p_mapped_by_bats(unsigned long pa); | 57 | extern unsigned long p_mapped_by_bats(phys_addr_t pa); |
58 | void setbat(int index, unsigned long virt, unsigned long phys, | 58 | void setbat(int index, unsigned long virt, phys_addr_t phys, |
59 | unsigned int size, int flags); | 59 | unsigned int size, int flags); |
60 | 60 | ||
61 | #else /* !HAVE_BATS */ | 61 | #else /* !HAVE_BATS */ |
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c index cef9f156874b..55ec17ed8d7c 100644 --- a/arch/powerpc/mm/ppc_mmu_32.c +++ b/arch/powerpc/mm/ppc_mmu_32.c | |||
@@ -46,13 +46,13 @@ union ubat { /* BAT register values to be loaded */ | |||
46 | struct batrange { /* stores address ranges mapped by BATs */ | 46 | struct batrange { /* stores address ranges mapped by BATs */ |
47 | unsigned long start; | 47 | unsigned long start; |
48 | unsigned long limit; | 48 | unsigned long limit; |
49 | unsigned long phys; | 49 | phys_addr_t phys; |
50 | } bat_addrs[8]; | 50 | } bat_addrs[8]; |
51 | 51 | ||
52 | /* | 52 | /* |
53 | * Return PA for this VA if it is mapped by a BAT, or 0 | 53 | * Return PA for this VA if it is mapped by a BAT, or 0 |
54 | */ | 54 | */ |
55 | unsigned long v_mapped_by_bats(unsigned long va) | 55 | phys_addr_t v_mapped_by_bats(unsigned long va) |
56 | { | 56 | { |
57 | int b; | 57 | int b; |
58 | for (b = 0; b < 4; ++b) | 58 | for (b = 0; b < 4; ++b) |
@@ -64,7 +64,7 @@ unsigned long v_mapped_by_bats(unsigned long va) | |||
64 | /* | 64 | /* |
65 | * Return VA for a given PA or 0 if not mapped | 65 | * Return VA for a given PA or 0 if not mapped |
66 | */ | 66 | */ |
67 | unsigned long p_mapped_by_bats(unsigned long pa) | 67 | unsigned long p_mapped_by_bats(phys_addr_t pa) |
68 | { | 68 | { |
69 | int b; | 69 | int b; |
70 | for (b = 0; b < 4; ++b) | 70 | for (b = 0; b < 4; ++b) |
@@ -119,7 +119,7 @@ unsigned long __init mmu_mapin_ram(void) | |||
119 | * The parameters are not checked; in particular size must be a power | 119 | * The parameters are not checked; in particular size must be a power |
120 | * of 2 between 128k and 256M. | 120 | * of 2 between 128k and 256M. |
121 | */ | 121 | */ |
122 | void __init setbat(int index, unsigned long virt, unsigned long phys, | 122 | void __init setbat(int index, unsigned long virt, phys_addr_t phys, |
123 | unsigned int size, int flags) | 123 | unsigned int size, int flags) |
124 | { | 124 | { |
125 | unsigned int bl; | 125 | unsigned int bl; |
@@ -138,7 +138,7 @@ void __init setbat(int index, unsigned long virt, unsigned long phys, | |||
138 | | _PAGE_COHERENT | _PAGE_GUARDED); | 138 | | _PAGE_COHERENT | _PAGE_GUARDED); |
139 | wimgxpp |= (flags & _PAGE_RW)? BPP_RW: BPP_RX; | 139 | wimgxpp |= (flags & _PAGE_RW)? BPP_RW: BPP_RX; |
140 | bat[1].word[0] = virt | (bl << 2) | 2; /* Vs=1, Vp=0 */ | 140 | bat[1].word[0] = virt | (bl << 2) | 2; /* Vs=1, Vp=0 */ |
141 | bat[1].word[1] = phys | wimgxpp; | 141 | bat[1].word[1] = BAT_PHYS_ADDR(phys) | wimgxpp; |
142 | #ifndef CONFIG_KGDB /* want user access for breakpoints */ | 142 | #ifndef CONFIG_KGDB /* want user access for breakpoints */ |
143 | if (flags & _PAGE_USER) | 143 | if (flags & _PAGE_USER) |
144 | #endif | 144 | #endif |