diff options
author | Jaswinder Singh Rajput <jaswinderrajput@gmail.com> | 2009-03-21 04:13:20 -0400 |
---|---|---|
committer | Jaswinder Singh Rajput <jaswinderrajput@gmail.com> | 2009-03-21 04:45:43 -0400 |
commit | 0b3ba0c3ccc7ced2a06fed405e80c8e1c77a3ee7 (patch) | |
tree | 932428565e8aa3520bb2cf157d3a003bbfc37735 /arch/x86/kernel/mpparse.c | |
parent | 5a5737eac224f01e264477954d92ed6e69047b7a (diff) |
x86: mpparse.c introduce check_physptr helper function
To reduce the size of the oversized function __get_smp_config()
There should be no impact to functionality.
Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Diffstat (limited to 'arch/x86/kernel/mpparse.c')
-rw-r--r-- | arch/x86/kernel/mpparse.c | 94 |
1 files changed, 50 insertions, 44 deletions
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c index 4216d2653662..dce99dca6cf8 100644 --- a/arch/x86/kernel/mpparse.c +++ b/arch/x86/kernel/mpparse.c | |||
@@ -555,6 +555,55 @@ static unsigned long __init get_mpc_size(unsigned long physptr) | |||
555 | return size; | 555 | return size; |
556 | } | 556 | } |
557 | 557 | ||
558 | static int __init check_physptr(struct mpf_intel *mpf, unsigned int early) | ||
559 | { | ||
560 | struct mpc_table *mpc; | ||
561 | unsigned long size; | ||
562 | |||
563 | size = get_mpc_size(mpf->physptr); | ||
564 | mpc = early_ioremap(mpf->physptr, size); | ||
565 | /* | ||
566 | * Read the physical hardware table. Anything here will | ||
567 | * override the defaults. | ||
568 | */ | ||
569 | if (!smp_read_mpc(mpc, early)) { | ||
570 | #ifdef CONFIG_X86_LOCAL_APIC | ||
571 | smp_found_config = 0; | ||
572 | #endif | ||
573 | printk(KERN_ERR "BIOS bug, MP table errors detected!...\n" | ||
574 | "... disabling SMP support. (tell your hw vendor)\n"); | ||
575 | early_iounmap(mpc, size); | ||
576 | return -1; | ||
577 | } | ||
578 | early_iounmap(mpc, size); | ||
579 | |||
580 | if (early) | ||
581 | return -1; | ||
582 | |||
583 | #ifdef CONFIG_X86_IO_APIC | ||
584 | /* | ||
585 | * If there are no explicit MP IRQ entries, then we are | ||
586 | * broken. We set up most of the low 16 IO-APIC pins to | ||
587 | * ISA defaults and hope it will work. | ||
588 | */ | ||
589 | if (!mp_irq_entries) { | ||
590 | struct mpc_bus bus; | ||
591 | |||
592 | printk(KERN_ERR "BIOS bug, no explicit IRQ entries, " | ||
593 | "using default mptable. (tell your hw vendor)\n"); | ||
594 | |||
595 | bus.type = MP_BUS; | ||
596 | bus.busid = 0; | ||
597 | memcpy(bus.bustype, "ISA ", 6); | ||
598 | MP_bus_info(&bus); | ||
599 | |||
600 | construct_default_ioirq_mptable(0); | ||
601 | } | ||
602 | #endif | ||
603 | |||
604 | return 0; | ||
605 | } | ||
606 | |||
558 | /* | 607 | /* |
559 | * Scan the memory blocks for an SMP configuration block. | 608 | * Scan the memory blocks for an SMP configuration block. |
560 | */ | 609 | */ |
@@ -608,51 +657,8 @@ static void __init __get_smp_config(unsigned int early) | |||
608 | construct_default_ISA_mptable(mpf->feature1); | 657 | construct_default_ISA_mptable(mpf->feature1); |
609 | 658 | ||
610 | } else if (mpf->physptr) { | 659 | } else if (mpf->physptr) { |
611 | struct mpc_table *mpc; | 660 | if (check_physptr(mpf, early)) |
612 | unsigned long size; | ||
613 | |||
614 | size = get_mpc_size(mpf->physptr); | ||
615 | mpc = early_ioremap(mpf->physptr, size); | ||
616 | /* | ||
617 | * Read the physical hardware table. Anything here will | ||
618 | * override the defaults. | ||
619 | */ | ||
620 | if (!smp_read_mpc(mpc, early)) { | ||
621 | #ifdef CONFIG_X86_LOCAL_APIC | ||
622 | smp_found_config = 0; | ||
623 | #endif | ||
624 | printk(KERN_ERR | ||
625 | "BIOS bug, MP table errors detected!...\n"); | ||
626 | printk(KERN_ERR "... disabling SMP support. " | ||
627 | "(tell your hw vendor)\n"); | ||
628 | early_iounmap(mpc, size); | ||
629 | return; | ||
630 | } | ||
631 | early_iounmap(mpc, size); | ||
632 | |||
633 | if (early) | ||
634 | return; | 661 | return; |
635 | #ifdef CONFIG_X86_IO_APIC | ||
636 | /* | ||
637 | * If there are no explicit MP IRQ entries, then we are | ||
638 | * broken. We set up most of the low 16 IO-APIC pins to | ||
639 | * ISA defaults and hope it will work. | ||
640 | */ | ||
641 | if (!mp_irq_entries) { | ||
642 | struct mpc_bus bus; | ||
643 | |||
644 | printk(KERN_ERR "BIOS bug, no explicit IRQ entries, " | ||
645 | "using default mptable. " | ||
646 | "(tell your hw vendor)\n"); | ||
647 | |||
648 | bus.type = MP_BUS; | ||
649 | bus.busid = 0; | ||
650 | memcpy(bus.bustype, "ISA ", 6); | ||
651 | MP_bus_info(&bus); | ||
652 | |||
653 | construct_default_ioirq_mptable(0); | ||
654 | } | ||
655 | #endif | ||
656 | } else | 662 | } else |
657 | BUG(); | 663 | BUG(); |
658 | 664 | ||