25 #include <linux/kernel.h>
33 #include <asm/machdep.h>
55 for (b = 0; b < 4; ++
b)
67 for (b = 0; b < 4; ++
b)
77 unsigned long tot,
bl,
done;
90 for (bl = 128<<10; bl <
max_size; bl <<= 1) {
97 if ((done < tot) && !
bat_addrs[3].limit) {
100 for (bl = 128<<10; bl <
max_size; bl <<= 1)
126 bl = (size >> 17) - 1;
133 bat[1].
batu = virt | (bl << 2) | 2;
137 if (flags & _PAGE_GUARDED) {
152 bat->
batu = virt | wimgxpp | 4;
153 bat->
batl = phys | bl | 0x40;
181 unsigned int hmask,
mb, mb2;
182 unsigned int n_hpteg, lg_n_hpteg;
184 extern unsigned int hash_page_patch_A[];
185 extern unsigned int hash_page_patch_B[], hash_page_patch_C[];
187 extern unsigned int flush_hash_patch_A[], flush_hash_patch_B[];
189 if (!mmu_has_feature(MMU_FTR_HPTE_TABLE)) {
195 hash_page[0] = 0x4e800020;
197 (
unsigned long) &hash_page[1]);
201 if (
ppc_md.progress )
ppc_md.progress(
"hash:enter", 0x105);
203 #define LG_HPTEG_SIZE 6
204 #define SDR1_LOW_BITS ((n_hpteg - 1) >> 10)
205 #define MIN_N_HPTEG 1024
215 lg_n_hpteg = __ilog2(n_hpteg);
216 if (n_hpteg & (n_hpteg - 1)) {
218 n_hpteg = 1 << lg_n_hpteg;
225 if (
ppc_md.progress )
ppc_md.progress(
"hash:find piece", 0x322);
232 printk(
"Total memory = %lldMB; using %ldkB for hash table (at %p)\n",
239 if (
ppc_md.progress )
ppc_md.progress(
"hash:patch", 0x345);
241 hmask =
Hash_mask >> (16 - LG_HPTEG_SIZE);
242 mb2 = mb = 32 - LG_HPTEG_SIZE - lg_n_hpteg;
244 mb2 = 16 - LG_HPTEG_SIZE;
246 hash_page_patch_A[0] = (hash_page_patch_A[0] & ~0xffff)
247 | ((
unsigned int)(
Hash) >> 16);
248 hash_page_patch_A[1] = (hash_page_patch_A[1] & ~0x7c0) | (mb << 6);
249 hash_page_patch_A[2] = (hash_page_patch_A[2] & ~0x7c0) | (mb2 << 6);
250 hash_page_patch_B[0] = (hash_page_patch_B[0] & ~0xffff) | hmask;
251 hash_page_patch_C[0] = (hash_page_patch_C[0] & ~0xffff) | hmask;
259 (
unsigned long) &hash_page_patch_C[1]);
264 flush_hash_patch_A[0] = (flush_hash_patch_A[0] & ~0xffff)
265 | ((
unsigned int)(
Hash) >> 16);
266 flush_hash_patch_A[1] = (flush_hash_patch_A[1] & ~0x7c0) | (mb << 6);
267 flush_hash_patch_A[2] = (flush_hash_patch_A[2] & ~0x7c0) | (mb2 << 6);
268 flush_hash_patch_B[0] = (flush_hash_patch_B[0] & ~0xffff) | hmask;
270 (
unsigned long) &flush_hash_patch_B[1]);
272 if (
ppc_md.progress )
ppc_md.progress(
"hash:done", 0x205);
281 BUG_ON(first_memblock_base != 0);