MTRR code has no use for software pagesizes, so use hardware page sizes at all times in it. amd.c | 6 +++--- centaur.c | 12 ++++++------ cyrix.c | 4 ++-- if.c | 28 ++++++++++++++-------------- main.c | 10 +++++----- 5 files changed, 30 insertions(+), 30 deletions(-) diff -urpN pgcl-2.5.64-4/arch/i386/kernel/cpu/mtrr/amd.c pgcl-2.5.64-5/arch/i386/kernel/cpu/mtrr/amd.c --- pgcl-2.5.64-4/arch/i386/kernel/cpu/mtrr/amd.c 2003-03-10 15:46:02.000000000 -0800 +++ pgcl-2.5.64-5/arch/i386/kernel/cpu/mtrr/amd.c 2003-03-10 15:53:16.000000000 -0800 @@ -16,7 +16,7 @@ amd_get_mtrr(unsigned int reg, unsigned if (reg == 1) low = high; /* The base masks off on the right alignment */ - *base = (low & 0xFFFE0000) >> PAGE_SHIFT; + *base = (low & 0xFFFE0000) >> MMUPAGE_SHIFT; *type = 0; if (low & 1) *type = MTRR_TYPE_UNCACHABLE; @@ -78,7 +78,7 @@ static void amd_set_mtrr(unsigned int re But ~(x - 1) == ~x + 1 == -x. Two's complement rocks! */ regs[reg] = (-size >> (15 - MMUPAGE_SHIFT) & 0x0001FFFC) - | (base << PAGE_SHIFT) | (type + 1); + | (base << MMUPAGE_SHIFT) | (type + 1); /* * The writeback rule is quite specific. See the manual. Its @@ -97,7 +97,7 @@ static int amd_validate_add_page(unsigne o Power of 2 block o base suitably aligned to the power */ - if (type > MTRR_TYPE_WRCOMB || size < (1 << (17 - PAGE_SHIFT)) + if (type > MTRR_TYPE_WRCOMB || size < (1 << (17 - MMUPAGE_SHIFT)) || (size & ~(size - 1)) - size || (base & (size - 1))) return -EINVAL; return 0; diff -urpN pgcl-2.5.64-4/arch/i386/kernel/cpu/mtrr/centaur.c pgcl-2.5.64-5/arch/i386/kernel/cpu/mtrr/centaur.c --- pgcl-2.5.64-4/arch/i386/kernel/cpu/mtrr/centaur.c 2003-03-04 19:29:04.000000000 -0800 +++ pgcl-2.5.64-5/arch/i386/kernel/cpu/mtrr/centaur.c 2003-03-10 15:52:55.000000000 -0800 @@ -51,8 +51,8 @@ static void centaur_get_mcr(unsigned int reg, unsigned long *base, unsigned int *size, mtrr_type * type) { - *base = centaur_mcr[reg].high >> PAGE_SHIFT; - *size = -(centaur_mcr[reg].low & 0xfffff000) >> PAGE_SHIFT; + *base = centaur_mcr[reg].high >> MMUPAGE_SHIFT; + *size = -(centaur_mcr[reg].low & 0xfffff000) >> MMUPAGE_SHIFT; *type = MTRR_TYPE_WRCOMB; /* If it is there, it is write-combining */ if (centaur_mcr_type == 1 && ((centaur_mcr[reg].low & 31) & 2)) *type = MTRR_TYPE_UNCACHABLE; @@ -72,14 +72,14 @@ static void centaur_set_mcr(unsigned int /* Disable */ high = low = 0; } else { - high = base << PAGE_SHIFT; + high = base << MMUPAGE_SHIFT; if (centaur_mcr_type == 0) - low = -size << PAGE_SHIFT | 0x1f; /* only support write-combining... */ + low = -size << MMUPAGE_SHIFT | 0x1f; /* only support write-combining... */ else { if (type == MTRR_TYPE_UNCACHABLE) - low = -size << PAGE_SHIFT | 0x02; /* NC */ + low = -size << MMUPAGE_SHIFT | 0x02; /* NC */ else - low = -size << PAGE_SHIFT | 0x09; /* WWO,WC */ + low = -size << MMUPAGE_SHIFT | 0x09; /* WWO,WC */ } } centaur_mcr[reg].high = high; diff -urpN pgcl-2.5.64-4/arch/i386/kernel/cpu/mtrr/cyrix.c pgcl-2.5.64-5/arch/i386/kernel/cpu/mtrr/cyrix.c --- pgcl-2.5.64-4/arch/i386/kernel/cpu/mtrr/cyrix.c 2003-03-04 19:29:21.000000000 -0800 +++ pgcl-2.5.64-5/arch/i386/kernel/cpu/mtrr/cyrix.c 2003-03-10 15:53:32.000000000 -0800 @@ -30,7 +30,7 @@ cyrix_get_arr(unsigned int reg, unsigned /* Enable interrupts if it was enabled previously */ local_irq_restore(flags); shift = ((unsigned char *) base)[1] & 0x0f; - *base >>= PAGE_SHIFT; + *base >>= MMUPAGE_SHIFT; /* Power of two, at least 4K on ARR0-ARR6, 256K on ARR7 * Note: shift==0xf means 4G, this is unsupported. @@ -203,7 +203,7 @@ static void cyrix_set_arr(unsigned int r prepare_set(); - base <<= PAGE_SHIFT; + base <<= MMUPAGE_SHIFT; setCx86(arr, ((unsigned char *) &base)[3]); setCx86(arr + 1, ((unsigned char *) &base)[2]); setCx86(arr + 2, (((unsigned char *) &base)[1]) | arr_size); diff -urpN pgcl-2.5.64-4/arch/i386/kernel/cpu/mtrr/if.c pgcl-2.5.64-5/arch/i386/kernel/cpu/mtrr/if.c --- pgcl-2.5.64-4/arch/i386/kernel/cpu/mtrr/if.c 2003-03-04 19:29:03.000000000 -0800 +++ pgcl-2.5.64-5/arch/i386/kernel/cpu/mtrr/if.c 2003-03-10 15:52:19.000000000 -0800 @@ -33,10 +33,10 @@ mtrr_file_add(unsigned long base, unsign FILE_FCOUNT(file) = fcount; } if (!page) { - if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) + if ((base & (MMUPAGE_SIZE - 1)) || (size & (MMUPAGE_SIZE - 1))) return -EINVAL; - base >>= PAGE_SHIFT; - size >>= PAGE_SHIFT; + base >>= MMUPAGE_SHIFT; + size >>= MMUPAGE_SHIFT; } reg = mtrr_add_page(base, size, type, 1); if (reg >= 0) @@ -52,10 +52,10 @@ mtrr_file_del(unsigned long base, unsign unsigned int *fcount = file->private_data; if (!page) { - if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) + if ((base & (MMUPAGE_SIZE - 1)) || (size & (MMUPAGE_SIZE - 1))) return -EINVAL; - base >>= PAGE_SHIFT; - size >>= PAGE_SHIFT; + base >>= MMUPAGE_SHIFT; + size >>= MMUPAGE_SHIFT; } reg = mtrr_del_page(-1, base, size); if (reg < 0) @@ -119,8 +119,8 @@ mtrr_write(struct file *file, const char for (i = 0; i < MTRR_NUM_TYPES; ++i) { if (strcmp(ptr, mtrr_strings[i])) continue; - base >>= PAGE_SHIFT; - size >>= PAGE_SHIFT; + base >>= MMUPAGE_SHIFT; + size >>= MMUPAGE_SHIFT; err = mtrr_add_page((unsigned long) base, (unsigned long) size, i, 1); @@ -193,8 +193,8 @@ mtrr_ioctl(struct inode *inode, struct f || gentry.size == 0x100000) gentry.base = gentry.size = gentry.type = 0; else { - gentry.base <<= PAGE_SHIFT; - gentry.size <<= PAGE_SHIFT; + gentry.base <<= MMUPAGE_SHIFT; + gentry.size <<= MMUPAGE_SHIFT; gentry.type = type; } @@ -319,18 +319,18 @@ static int mtrr_seq_show(struct seq_file if (size == 0) usage_table[i] = 0; else { - if (size < (0x100000 >> PAGE_SHIFT)) { + if (size < (0x100000 >> MMUPAGE_SHIFT)) { /* less than 1MB */ factor = 'K'; - size <<= PAGE_SHIFT - 10; + size <<= MMUPAGE_SHIFT - 10; } else { factor = 'M'; - size >>= 20 - PAGE_SHIFT; + size >>= 20 - MMUPAGE_SHIFT; } /* RED-PEN: base can be > 32bit */ len += seq_printf(seq, "reg%02i: base=0x%05lx000 (%4liMB), size=%4i%cB: %s, count=%d\n", - i, base, base >> (20 - PAGE_SHIFT), size, factor, + i, base, base >> (20 - MMUPAGE_SHIFT), size, factor, attrib_to_str(type), usage_table[i]); } } diff -urpN pgcl-2.5.64-4/arch/i386/kernel/cpu/mtrr/main.c pgcl-2.5.64-5/arch/i386/kernel/cpu/mtrr/main.c --- pgcl-2.5.64-4/arch/i386/kernel/cpu/mtrr/main.c 2003-03-04 19:28:56.000000000 -0800 +++ pgcl-2.5.64-5/arch/i386/kernel/cpu/mtrr/main.c 2003-03-10 15:51:33.000000000 -0800 @@ -410,12 +410,12 @@ int mtrr_add(unsigned long base, unsigned long size, unsigned int type, char increment) { - if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) { + if ((base & (MMUPAGE_SIZE - 1)) || (size & (MMUPAGE_SIZE - 1))) { printk("mtrr: size and base must be multiples of 4 kiB\n"); printk("mtrr: size: 0x%lx base: 0x%lx\n", size, base); return -EINVAL; } - return mtrr_add_page(base >> PAGE_SHIFT, size >> PAGE_SHIFT, type, + return mtrr_add_page(base >> MMUPAGE_SHIFT, size >> MMUPAGE_SHIFT, type, increment); } @@ -506,12 +506,12 @@ int mtrr_del_page(int reg, unsigned long int mtrr_del(int reg, unsigned long base, unsigned long size) { - if ((base & (PAGE_SIZE - 1)) || (size & (PAGE_SIZE - 1))) { + if ((base & (MMUPAGE_SIZE - 1)) || (size & (MMUPAGE_SIZE - 1))) { printk("mtrr: size and base must be multiples of 4 kiB\n"); printk("mtrr: size: 0x%lx base: 0x%lx\n", size, base); return -EINVAL; } - return mtrr_del_page(reg, base >> PAGE_SHIFT, size >> PAGE_SHIFT); + return mtrr_del_page(reg, base >> MMUPAGE_SHIFT, size >> MMUPAGE_SHIFT); } EXPORT_SYMBOL(mtrr_add); @@ -579,7 +579,7 @@ static int __init mtrr_init(void) u32 phys_addr; phys_addr = cpuid_eax(0x80000008) & 0xff; size_or_mask = - ~((1 << (phys_addr - PAGE_SHIFT)) - 1); + ~((1 << (phys_addr - MMUPAGE_SHIFT)) - 1); size_and_mask = ~size_or_mask & 0xfff00000; } /* Athlon MTRRs use an Intel-compatible interface for