diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2008-01-30 07:30:19 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-30 07:30:19 -0500 |
commit | 3e35a0e525253837fc0ea4d0e060de3302bd9537 (patch) | |
tree | bb7afd99762bd691866a934b23ddcf8e92ce8f2f /arch/x86/kernel/apic_64.c | |
parent | 84c873ed2a00eab3e8ac49dc7889d7aad142ce22 (diff) |
x86: move ioapic code where it belongs
The commit 399287229c775a8962a852a761d65dc9475dec7c hacked the
ioapic resource mapping into apic.c for no good reason.
Move the code into io_apic_64.c where it belongs.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/apic_64.c')
-rw-r--r-- | arch/x86/kernel/apic_64.c | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c index 0cb14d4c2c5c..e0191cdd6f7a 100644 --- a/arch/x86/kernel/apic_64.c +++ b/arch/x86/kernel/apic_64.c | |||
@@ -49,7 +49,6 @@ static int apic_calibrate_pmtmr __initdata; | |||
49 | int local_apic_timer_c2_ok; | 49 | int local_apic_timer_c2_ok; |
50 | EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); | 50 | EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok); |
51 | 51 | ||
52 | static struct resource *ioapic_resources; | ||
53 | static struct resource lapic_resource = { | 52 | static struct resource lapic_resource = { |
54 | .name = "Local APIC", | 53 | .name = "Local APIC", |
55 | .flags = IORESOURCE_MEM | IORESOURCE_BUSY, | 54 | .flags = IORESOURCE_MEM | IORESOURCE_BUSY, |
@@ -714,64 +713,6 @@ static int __init detect_init_APIC (void) | |||
714 | return 0; | 713 | return 0; |
715 | } | 714 | } |
716 | 715 | ||
717 | #ifdef CONFIG_X86_IO_APIC | ||
718 | static struct resource * __init ioapic_setup_resources(void) | ||
719 | { | ||
720 | #define IOAPIC_RESOURCE_NAME_SIZE 11 | ||
721 | unsigned long n; | ||
722 | struct resource *res; | ||
723 | char *mem; | ||
724 | int i; | ||
725 | |||
726 | if (nr_ioapics <= 0) | ||
727 | return NULL; | ||
728 | |||
729 | n = IOAPIC_RESOURCE_NAME_SIZE + sizeof(struct resource); | ||
730 | n *= nr_ioapics; | ||
731 | |||
732 | mem = alloc_bootmem(n); | ||
733 | res = (void *)mem; | ||
734 | |||
735 | if (mem != NULL) { | ||
736 | memset(mem, 0, n); | ||
737 | mem += sizeof(struct resource) * nr_ioapics; | ||
738 | |||
739 | for (i = 0; i < nr_ioapics; i++) { | ||
740 | res[i].name = mem; | ||
741 | res[i].flags = IORESOURCE_MEM | IORESOURCE_BUSY; | ||
742 | sprintf(mem, "IOAPIC %u", i); | ||
743 | mem += IOAPIC_RESOURCE_NAME_SIZE; | ||
744 | } | ||
745 | } | ||
746 | |||
747 | ioapic_resources = res; | ||
748 | |||
749 | return res; | ||
750 | } | ||
751 | |||
752 | static int __init ioapic_insert_resources(void) | ||
753 | { | ||
754 | int i; | ||
755 | struct resource *r = ioapic_resources; | ||
756 | |||
757 | if (!r) { | ||
758 | printk("IO APIC resources could be not be allocated.\n"); | ||
759 | return -1; | ||
760 | } | ||
761 | |||
762 | for (i = 0; i < nr_ioapics; i++) { | ||
763 | insert_resource(&iomem_resource, r); | ||
764 | r++; | ||
765 | } | ||
766 | |||
767 | return 0; | ||
768 | } | ||
769 | |||
770 | /* Insert the IO APIC resources after PCI initialization has occured to handle | ||
771 | * IO APICS that are mapped in on a BAR in PCI space. */ | ||
772 | late_initcall(ioapic_insert_resources); | ||
773 | #endif | ||
774 | |||
775 | void __init init_apic_mappings(void) | 716 | void __init init_apic_mappings(void) |
776 | { | 717 | { |
777 | unsigned long apic_phys; | 718 | unsigned long apic_phys; |
@@ -801,34 +742,6 @@ void __init init_apic_mappings(void) | |||
801 | * default configuration (or the MP table is broken). | 742 | * default configuration (or the MP table is broken). |
802 | */ | 743 | */ |
803 | boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); | 744 | boot_cpu_id = GET_APIC_ID(apic_read(APIC_ID)); |
804 | |||
805 | { | ||
806 | unsigned long ioapic_phys, idx = FIX_IO_APIC_BASE_0; | ||
807 | int i; | ||
808 | struct resource *ioapic_res; | ||
809 | |||
810 | ioapic_res = ioapic_setup_resources(); | ||
811 | for (i = 0; i < nr_ioapics; i++) { | ||
812 | if (smp_found_config) { | ||
813 | ioapic_phys = mp_ioapics[i].mpc_apicaddr; | ||
814 | } else { | ||
815 | ioapic_phys = (unsigned long) | ||
816 | alloc_bootmem_pages(PAGE_SIZE); | ||
817 | ioapic_phys = __pa(ioapic_phys); | ||
818 | } | ||
819 | set_fixmap_nocache(idx, ioapic_phys); | ||
820 | apic_printk(APIC_VERBOSE, | ||
821 | "mapped IOAPIC to %016lx (%016lx)\n", | ||
822 | __fix_to_virt(idx), ioapic_phys); | ||
823 | idx++; | ||
824 | |||
825 | if (ioapic_res != NULL) { | ||
826 | ioapic_res->start = ioapic_phys; | ||
827 | ioapic_res->end = ioapic_phys + (4 * 1024) - 1; | ||
828 | ioapic_res++; | ||
829 | } | ||
830 | } | ||
831 | } | ||
832 | } | 745 | } |
833 | 746 | ||
834 | /* | 747 | /* |