diff options
author | Becky Bruce <becky.bruce@freescale.com> | 2008-06-13 19:41:43 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-06-30 08:31:05 -0400 |
commit | 316a405841cc03723d401b098d188aa4e3daa69b (patch) | |
tree | 476be4fad16c690d1650890757aacc3095e85129 /arch | |
parent | 7c5c4325d2d911fe54db3bc14149bfa558ae0acb (diff) |
powerpc: Get rid of bitfields in ppc_bat struct
While working on the 36-bit physical support, I noticed that there
was exactly one line of code that actually referenced the bitfields.
So I got rid of them and redefined ppc_bat as a struct of 2 u32's:
batu and batl. I also got rid of the previous union that held the
bitfield structs and a word representation of the batu/l values.
This seems like a nicer solution than adding in a bunch of
new bitfields to support extended bat addressing that would never
get used, and just leaving the struct as-is would have been
incomplete in the face of large physical addressing.
Signed-off-by: Becky Bruce <becky.bruce@freescale.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/mm/ppc_mmu_32.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c index 55ec17ed8d7c..c53145f61942 100644 --- a/arch/powerpc/mm/ppc_mmu_32.c +++ b/arch/powerpc/mm/ppc_mmu_32.c | |||
@@ -38,10 +38,7 @@ struct hash_pte *Hash, *Hash_end; | |||
38 | unsigned long Hash_size, Hash_mask; | 38 | unsigned long Hash_size, Hash_mask; |
39 | unsigned long _SDR1; | 39 | unsigned long _SDR1; |
40 | 40 | ||
41 | union ubat { /* BAT register values to be loaded */ | 41 | struct ppc_bat BATS[8][2]; /* 8 pairs of IBAT, DBAT */ |
42 | struct ppc_bat bat; | ||
43 | u32 word[2]; | ||
44 | } BATS[8][2]; /* 8 pairs of IBAT, DBAT */ | ||
45 | 42 | ||
46 | struct batrange { /* stores address ranges mapped by BATs */ | 43 | struct batrange { /* stores address ranges mapped by BATs */ |
47 | unsigned long start; | 44 | unsigned long start; |
@@ -124,7 +121,7 @@ void __init setbat(int index, unsigned long virt, phys_addr_t phys, | |||
124 | { | 121 | { |
125 | unsigned int bl; | 122 | unsigned int bl; |
126 | int wimgxpp; | 123 | int wimgxpp; |
127 | union ubat *bat = BATS[index]; | 124 | struct ppc_bat *bat = BATS[index]; |
128 | 125 | ||
129 | if (((flags & _PAGE_NO_CACHE) == 0) && | 126 | if (((flags & _PAGE_NO_CACHE) == 0) && |
130 | cpu_has_feature(CPU_FTR_NEED_COHERENT)) | 127 | cpu_has_feature(CPU_FTR_NEED_COHERENT)) |
@@ -137,15 +134,15 @@ void __init setbat(int index, unsigned long virt, phys_addr_t phys, | |||
137 | wimgxpp = flags & (_PAGE_WRITETHRU | _PAGE_NO_CACHE | 134 | wimgxpp = flags & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
138 | | _PAGE_COHERENT | _PAGE_GUARDED); | 135 | | _PAGE_COHERENT | _PAGE_GUARDED); |
139 | wimgxpp |= (flags & _PAGE_RW)? BPP_RW: BPP_RX; | 136 | wimgxpp |= (flags & _PAGE_RW)? BPP_RW: BPP_RX; |
140 | bat[1].word[0] = virt | (bl << 2) | 2; /* Vs=1, Vp=0 */ | 137 | bat[1].batu = virt | (bl << 2) | 2; /* Vs=1, Vp=0 */ |
141 | bat[1].word[1] = BAT_PHYS_ADDR(phys) | wimgxpp; | 138 | bat[1].batl = BAT_PHYS_ADDR(phys) | wimgxpp; |
142 | #ifndef CONFIG_KGDB /* want user access for breakpoints */ | 139 | #ifndef CONFIG_KGDB /* want user access for breakpoints */ |
143 | if (flags & _PAGE_USER) | 140 | if (flags & _PAGE_USER) |
144 | #endif | 141 | #endif |
145 | bat[1].bat.batu.vp = 1; | 142 | bat[1].batu |= 1; /* Vp = 1 */ |
146 | if (flags & _PAGE_GUARDED) { | 143 | if (flags & _PAGE_GUARDED) { |
147 | /* G bit must be zero in IBATs */ | 144 | /* G bit must be zero in IBATs */ |
148 | bat[0].word[0] = bat[0].word[1] = 0; | 145 | bat[0].batu = bat[0].batl = 0; |
149 | } else { | 146 | } else { |
150 | /* make IBAT same as DBAT */ | 147 | /* make IBAT same as DBAT */ |
151 | bat[0] = bat[1]; | 148 | bat[0] = bat[1]; |
@@ -158,8 +155,8 @@ void __init setbat(int index, unsigned long virt, phys_addr_t phys, | |||
158 | | _PAGE_COHERENT); | 155 | | _PAGE_COHERENT); |
159 | wimgxpp |= (flags & _PAGE_RW)? | 156 | wimgxpp |= (flags & _PAGE_RW)? |
160 | ((flags & _PAGE_USER)? PP_RWRW: PP_RWXX): PP_RXRX; | 157 | ((flags & _PAGE_USER)? PP_RWRW: PP_RWXX): PP_RXRX; |
161 | bat->word[0] = virt | wimgxpp | 4; /* Ks=0, Ku=1 */ | 158 | bat->batu = virt | wimgxpp | 4; /* Ks=0, Ku=1 */ |
162 | bat->word[1] = phys | bl | 0x40; /* V=1 */ | 159 | bat->batl = phys | bl | 0x40; /* V=1 */ |
163 | } | 160 | } |
164 | 161 | ||
165 | bat_addrs[index].start = virt; | 162 | bat_addrs[index].start = virt; |