From: Michael Neumann Date: Sat, 2 Oct 2010 14:13:50 +0000 (+0200) Subject: Reorder MP probing X-Git-Tag: v2.9.0~104 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/f592025a912f90fe25f379cb34ee4ca4b52b57b4 Reorder MP probing Apply commit 0f85efa20adbc0f9062a269bc2a7653b7b646683 for x86_64. --- diff --git a/sys/platform/pc64/x86_64/machdep.c b/sys/platform/pc64/x86_64/machdep.c index 4bc469ac5e..b969681c9b 100644 --- a/sys/platform/pc64/x86_64/machdep.c +++ b/sys/platform/pc64/x86_64/machdep.c @@ -1414,9 +1414,6 @@ getmemsize(caddr_t kmdp, u_int64_t first) /* Save EBDA address, if any */ ebda_addr = (u_long)(*(u_short *)(KERNBASE + 0x40e)); ebda_addr <<= 4; - - /* look for the MP hardware - needed for apic addresses */ - mp_probe(); #endif /* diff --git a/sys/platform/pc64/x86_64/mp_machdep.c b/sys/platform/pc64/x86_64/mp_machdep.c index 58243ec87d..ba23ac5497 100644 --- a/sys/platform/pc64/x86_64/mp_machdep.c +++ b/sys/platform/pc64/x86_64/mp_machdep.c @@ -538,6 +538,9 @@ mp_enable(u_int boot_addr) POSTCODE(MP_ENABLE_POST); + if (!mp_probe()) + panic("mp_enable: mp_probe failed\n"); + #if 0 /* JGXXX */ /* turn on 4MB of V == P addressing so we can get to MP table */ *(int *)PTD = PG_V | PG_RW | ((uintptr_t)(void *)KPTphys & PG_FRAME); @@ -551,7 +554,7 @@ mp_enable(u_int boot_addr) mptable_pass1(); if (cpu_apic_address == 0) - panic("mp_enable: no local apic!"); + panic("mp_enable: no local apic!\n"); /* examine the MP table for needed info, uses physical addresses */ x = mptable_pass2(); @@ -625,15 +628,23 @@ mp_enable(u_int boot_addr) static long search_for_sig(u_int32_t target, int count) { - int x; - u_int32_t *addr = (u_int32_t *) (KERNBASE + target); + vm_size_t map_size; + u_int32_t *addr; + int x, ret; - for (x = 0; x < count; NEXT(x)) - if (addr[x] == MP_SIG) - /* make array index a byte index */ - return (long)(&addr[x]); + map_size = count * sizeof(u_int32_t); + addr = pmap_mapdev((vm_paddr_t)target, map_size); - return -1; + ret = -1; + for (x = 0; x < count; NEXT(x)) { + if (addr[x] == MP_SIG) { + /* make array index a byte index */ + ret = target + (x * sizeof(u_int32_t)); + break; + } + } + pmap_unmapdev((vm_offset_t)addr, map_size); + return ret; }