x86: fix MTRR initialization if EARLY_AP_STARTUP is used
MTRR handlers are set in {amd64/i686}_mem_drvinit, which is called at SI_SUB_DRIVERS, and that's too late when EARLY_AP_STARTUP is set because APs have already started at this point. {amd64/i686}_mrinit is also called too late for the BSP, since that happens when the memory device is attached, also after APs have already started. Move the position to SI_SUB_CPU, and also initialize the state for the BSP, so that the APs can correctly get to the same state as the BSP. Sponsored by: Citrix Systems R&D MFC after: 1 week Reviewed by: jhb, kib Differential Revision: https://reviews.freebsd.org/D9630
This commit is contained in:
parent
02db5d1d66
commit
43b00aeb88
@ -609,6 +609,10 @@ amd64_mrinit(struct mem_range_softc *sc)
|
||||
u_int regs[4];
|
||||
int i, nmdesc = 0, pabits;
|
||||
|
||||
if (sc->mr_desc != NULL)
|
||||
/* Already initialized. */
|
||||
return;
|
||||
|
||||
mtrrcap = rdmsr(MSR_MTRRcap);
|
||||
mtrrdef = rdmsr(MSR_MTRRdefType);
|
||||
|
||||
@ -750,5 +754,6 @@ amd64_mem_drvinit(void *unused)
|
||||
return;
|
||||
}
|
||||
mem_range_softc.mr_op = &amd64_mrops;
|
||||
amd64_mrinit(&mem_range_softc);
|
||||
}
|
||||
SYSINIT(amd64memdev, SI_SUB_DRIVERS, SI_ORDER_FIRST, amd64_mem_drvinit, NULL);
|
||||
SYSINIT(amd64memdev, SI_SUB_CPU, SI_ORDER_ANY, amd64_mem_drvinit, NULL);
|
||||
|
@ -588,6 +588,10 @@ i686_mrinit(struct mem_range_softc *sc)
|
||||
u_int regs[4];
|
||||
int i, nmdesc = 0, pabits;
|
||||
|
||||
if (sc->mr_desc != NULL)
|
||||
/* Already initialized. */
|
||||
return;
|
||||
|
||||
mtrrcap = rdmsr(MSR_MTRRcap);
|
||||
mtrrdef = rdmsr(MSR_MTRRdefType);
|
||||
|
||||
@ -716,5 +720,6 @@ i686_mem_drvinit(void *unused)
|
||||
return;
|
||||
}
|
||||
mem_range_softc.mr_op = &i686_mrops;
|
||||
i686_mrinit(&mem_range_softc);
|
||||
}
|
||||
SYSINIT(i686memdev, SI_SUB_DRIVERS, SI_ORDER_FIRST, i686_mem_drvinit, NULL);
|
||||
SYSINIT(i686memdev, SI_SUB_CPU, SI_ORDER_ANY, i686_mem_drvinit, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user