aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Starikovskiy <astarikovskiy@suse.de>2008-04-04 15:42:46 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:41:36 -0400
commit92fd4b7abdb2b5b85d73ca0adbb6ad3f8b79f805 (patch)
tree31ae3c816b14db6c1b305e074657eb732e719107
parent4421b1c8b9f5da24f8c737ede2c05d399dea2015 (diff)
x86: unify smp_scan_config
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/mpparse_32.c21
-rw-r--r--arch/x86/kernel/mpparse_64.c26
2 files changed, 41 insertions, 6 deletions
diff --git a/arch/x86/kernel/mpparse_32.c b/arch/x86/kernel/mpparse_32.c
index bc2000ee0391..7feafa5040d8 100644
--- a/arch/x86/kernel/mpparse_32.c
+++ b/arch/x86/kernel/mpparse_32.c
@@ -683,12 +683,13 @@ void __init get_smp_config(void)
683static int __init smp_scan_config(unsigned long base, unsigned long length, 683static int __init smp_scan_config(unsigned long base, unsigned long length,
684 unsigned reserve) 684 unsigned reserve)
685{ 685{
686 unsigned long *bp = phys_to_virt(base); 686 extern void __bad_mpf_size(void);
687 unsigned int *bp = phys_to_virt(base);
687 struct intel_mp_floating *mpf; 688 struct intel_mp_floating *mpf;
688 689
689 printk(KERN_INFO "Scan SMP from %p for %ld bytes.\n", bp, length); 690 Dprintk("Scan SMP from %p for %ld bytes.\n", bp, length);
690 if (sizeof(*mpf) != 16) 691 if (sizeof(*mpf) != 16)
691 printk("Error: MPF size\n"); 692 __bad_mpf_size();
692 693
693 while (length > 0) { 694 while (length > 0) {
694 mpf = (struct intel_mp_floating *)bp; 695 mpf = (struct intel_mp_floating *)bp;
@@ -699,6 +700,8 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
699 || (mpf->mpf_specification == 4))) { 700 || (mpf->mpf_specification == 4))) {
700 701
701 smp_found_config = 1; 702 smp_found_config = 1;
703 mpf_found = mpf;
704#ifdef CONFIG_X86_32
702 printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n", 705 printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
703 mpf, virt_to_phys(mpf)); 706 mpf, virt_to_phys(mpf));
704 reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE, 707 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 BOOTMEM_DEFAULT); 724 BOOTMEM_DEFAULT);
722 } 725 }
723 726
724 mpf_found = mpf; 727#else
725 return 1; 728 if (!reserve)
729 return 1;
730
731 reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE);
732 if (mpf->mpf_physptr)
733 reserve_bootmem_generic(mpf->mpf_physptr,
734 PAGE_SIZE);
735#endif
736 return 1;
726 } 737 }
727 bp += 4; 738 bp += 4;
728 length -= 16; 739 length -= 16;
diff --git a/arch/x86/kernel/mpparse_64.c b/arch/x86/kernel/mpparse_64.c
index 8c7af5b7ddd4..9a9610089910 100644
--- a/arch/x86/kernel/mpparse_64.c
+++ b/arch/x86/kernel/mpparse_64.c
@@ -593,7 +593,30 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
593 593
594 smp_found_config = 1; 594 smp_found_config = 1;
595 mpf_found = mpf; 595 mpf_found = mpf;
596#ifdef CONFIG_X86_32
597 printk(KERN_INFO "found SMP MP-table at [%p] %08lx\n",
598 mpf, virt_to_phys(mpf));
599 reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
600 BOOTMEM_DEFAULT);
601 if (mpf->mpf_physptr) {
602 /*
603 * We cannot access to MPC table to compute
604 * table size yet, as only few megabytes from
605 * the bottom is mapped now.
606 * PC-9800's MPC table places on the very last
607 * of physical memory; so that simply reserving
608 * PAGE_SIZE from mpg->mpf_physptr yields BUG()
609 * in reserve_bootmem.
610 */
611 unsigned long size = PAGE_SIZE;
612 unsigned long end = max_low_pfn * PAGE_SIZE;
613 if (mpf->mpf_physptr + size > end)
614 size = end - mpf->mpf_physptr;
615 reserve_bootmem(mpf->mpf_physptr, size,
616 BOOTMEM_DEFAULT);
617 }
596 618
619#else
597 if (!reserve) 620 if (!reserve)
598 return 1; 621 return 1;
599 622
@@ -601,7 +624,8 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
601 if (mpf->mpf_physptr) 624 if (mpf->mpf_physptr)
602 reserve_bootmem_generic(mpf->mpf_physptr, 625 reserve_bootmem_generic(mpf->mpf_physptr,
603 PAGE_SIZE); 626 PAGE_SIZE);
604 return 1; 627#endif
628 return 1;
605 } 629 }
606 bp += 4; 630 bp += 4;
607 length -= 16; 631 length -= 16;