{
uint32_t eax, ebx, ecx, edx;
uint64_t mtrr_cap, mtrr_def, addr_mask, base, mask, top;
- unsigned int i, phys_bits = 36;
+ unsigned int i;
/* By default we check only Intel systems. */
if ( e820_mtrr_clip == -1 )
if ( !test_bit(X86_FEATURE_MTRR & 31, &edx) )
return 0;
- /* Find the physical address size for this CPU. */
- eax = cpuid_eax(0x80000000);
- if ( (eax >> 16) == 0x8000 && eax >= 0x80000008 )
- {
- phys_bits = (uint8_t)cpuid_eax(0x80000008);
- if ( phys_bits > PADDR_BITS )
- phys_bits = PADDR_BITS;
- }
- addr_mask = ((1ull << phys_bits) - 1) & ~((1ull << 12) - 1);
+ /* paddr_bits must have been set at this point */
+ ASSERT(paddr_bits);
+ addr_mask = ((1ull << paddr_bits) - 1) & PAGE_MASK;
rdmsrl(MSR_MTRRcap, mtrr_cap);
rdmsrl(MSR_MTRRdefType, mtrr_def);
else
panic("Bootloader provided no memory information\n");
+ /* This must come before e820 code because it sets paddr_bits. */
+ early_cpu_init();
+
/* Sanitise the raw E820 map to produce a final clean version. */
max_page = raw_max_page = init_e820(memmap_type, &e820_raw);
softirq_init();
tasklet_subsys_init();
- early_cpu_init();
-
paging_init();
tboot_probe();