Commit 92fd4b7a authored by Alexey Starikovskiy's avatar Alexey Starikovskiy Committed by Ingo Molnar

x86: unify smp_scan_config

Signed-off-by: default avatarAlexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 4421b1c8
...@@ -683,12 +683,13 @@ void __init get_smp_config(void) ...@@ -683,12 +683,13 @@ void __init get_smp_config(void)
static int __init smp_scan_config(unsigned long base, unsigned long length, static int __init smp_scan_config(unsigned long base, unsigned long length,
unsigned reserve) unsigned reserve)
{ {
unsigned long *bp = phys_to_virt(base); extern void __bad_mpf_size(void);
unsigned int *bp = phys_to_virt(base);
struct intel_mp_floating *mpf; struct intel_mp_floating *mpf;
printk(KERN_INFO "Scan SMP from %p for %ld bytes.\n", bp, length); Dprintk("Scan SMP from %p for %ld bytes.\n", bp, length);
if (sizeof(*mpf) != 16) if (sizeof(*mpf) != 16)
printk("Error: MPF size\n"); __bad_mpf_size();
while (length > 0) { while (length > 0) {
mpf = (struct intel_mp_floating *)bp; mpf = (struct intel_mp_floating *)bp;
...@@ -699,6 +700,8 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, ...@@ -699,6 +700,8 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
|| (mpf->mpf_specification == 4))) { || (mpf->mpf_specification == 4))) {
smp_found_config = 1; smp_found_config = 1;
mpf_found = mpf;
#ifdef CONFIG_X86_32
printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n", printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
mpf, virt_to_phys(mpf)); mpf, virt_to_phys(mpf));
reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE, reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
...@@ -721,8 +724,16 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, ...@@ -721,8 +724,16 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
BOOTMEM_DEFAULT); BOOTMEM_DEFAULT);
} }
mpf_found = mpf; #else
return 1; if (!reserve)
return 1;
reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE);
if (mpf->mpf_physptr)
reserve_bootmem_generic(mpf->mpf_physptr,
PAGE_SIZE);
#endif
return 1;
} }
bp += 4; bp += 4;
length -= 16; length -= 16;
......
...@@ -593,7 +593,30 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, ...@@ -593,7 +593,30 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
smp_found_config = 1; smp_found_config = 1;
mpf_found = mpf; mpf_found = mpf;
#ifdef CONFIG_X86_32
printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
mpf, virt_to_phys(mpf));
reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
BOOTMEM_DEFAULT);
if (mpf->mpf_physptr) {
/*
* We cannot access to MPC table to compute
* table size yet, as only few megabytes from
* the bottom is mapped now.
* PC-9800's MPC table places on the very last
* of physical memory; so that simply reserving
* PAGE_SIZE from mpg->mpf_physptr yields BUG()
* in reserve_bootmem.
*/
unsigned long size = PAGE_SIZE;
unsigned long end = max_low_pfn * PAGE_SIZE;
if (mpf->mpf_physptr + size > end)
size = end - mpf->mpf_physptr;
reserve_bootmem(mpf->mpf_physptr, size,
BOOTMEM_DEFAULT);
}
#else
if (!reserve) if (!reserve)
return 1; return 1;
...@@ -601,7 +624,8 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, ...@@ -601,7 +624,8 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
if (mpf->mpf_physptr) if (mpf->mpf_physptr)
reserve_bootmem_generic(mpf->mpf_physptr, reserve_bootmem_generic(mpf->mpf_physptr,
PAGE_SIZE); PAGE_SIZE);
return 1; #endif
return 1;
} }
bp += 4; bp += 4;
length -= 16; length -= 16;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment