diff options
author | Alexey Starikovskiy <astarikovskiy@suse.de> | 2008-04-04 15:42:53 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-17 11:41:36 -0400 |
commit | 22cbb4bd12a86b80125accb77515482894ee670f (patch) | |
tree | 0a12dbb766272c5b0fc27f915e07c5c96887b75f /arch/x86 | |
parent | 92fd4b7abdb2b5b85d73ca0adbb6ad3f8b79f805 (diff) |
x86: unify uniq_io_apic_id
Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86')
-rw-r--r-- | arch/x86/kernel/mpparse_32.c | 14 | ||||
-rw-r--r-- | arch/x86/kernel/mpparse_64.c | 8 |
2 files changed, 21 insertions, 1 deletions
diff --git a/arch/x86/kernel/mpparse_32.c b/arch/x86/kernel/mpparse_32.c index 7feafa5040d8..a50a31331f97 100644 --- a/arch/x86/kernel/mpparse_32.c +++ b/arch/x86/kernel/mpparse_32.c | |||
@@ -814,17 +814,29 @@ static int mp_find_ioapic(int gsi) | |||
814 | } | 814 | } |
815 | 815 | ||
816 | printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi); | 816 | printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi); |
817 | |||
818 | return -1; | 817 | return -1; |
819 | } | 818 | } |
820 | 819 | ||
821 | static u8 uniq_ioapic_id(u8 id) | 820 | static u8 uniq_ioapic_id(u8 id) |
822 | { | 821 | { |
822 | #ifdef CONFIG_X86_32 | ||
823 | if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && | 823 | if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && |
824 | !APIC_XAPIC(apic_version[boot_cpu_physical_apicid])) | 824 | !APIC_XAPIC(apic_version[boot_cpu_physical_apicid])) |
825 | return io_apic_get_unique_id(nr_ioapics, id); | 825 | return io_apic_get_unique_id(nr_ioapics, id); |
826 | else | 826 | else |
827 | return id; | 827 | return id; |
828 | #else | ||
829 | int i; | ||
830 | DECLARE_BITMAP(used, 256); | ||
831 | bitmap_zero(used, 256); | ||
832 | for (i = 0; i < nr_ioapics; i++) { | ||
833 | struct mpc_config_ioapic *ia = &mp_ioapics[i]; | ||
834 | __set_bit(ia->mpc_apicid, used); | ||
835 | } | ||
836 | if (!test_bit(id, used)) | ||
837 | return id; | ||
838 | return find_first_zero_bit(used, 256); | ||
839 | #endif | ||
828 | } | 840 | } |
829 | 841 | ||
830 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | 842 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) |
diff --git a/arch/x86/kernel/mpparse_64.c b/arch/x86/kernel/mpparse_64.c index 9a9610089910..de64a89434c6 100644 --- a/arch/x86/kernel/mpparse_64.c +++ b/arch/x86/kernel/mpparse_64.c | |||
@@ -707,6 +707,13 @@ static int mp_find_ioapic(int gsi) | |||
707 | 707 | ||
708 | static u8 uniq_ioapic_id(u8 id) | 708 | static u8 uniq_ioapic_id(u8 id) |
709 | { | 709 | { |
710 | #ifdef CONFIG_X86_32 | ||
711 | if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && | ||
712 | !APIC_XAPIC(apic_version[boot_cpu_physical_apicid])) | ||
713 | return io_apic_get_unique_id(nr_ioapics, id); | ||
714 | else | ||
715 | return id; | ||
716 | #else | ||
710 | int i; | 717 | int i; |
711 | DECLARE_BITMAP(used, 256); | 718 | DECLARE_BITMAP(used, 256); |
712 | bitmap_zero(used, 256); | 719 | bitmap_zero(used, 256); |
@@ -717,6 +724,7 @@ static u8 uniq_ioapic_id(u8 id) | |||
717 | if (!test_bit(id, used)) | 724 | if (!test_bit(id, used)) |
718 | return id; | 725 | return id; |
719 | return find_first_zero_bit(used, 256); | 726 | return find_first_zero_bit(used, 256); |
727 | #endif | ||
720 | } | 728 | } |
721 | 729 | ||
722 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) | 730 | void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) |