Commit 22cbb4bd authored by Alexey Starikovskiy's avatar Alexey Starikovskiy Committed by Ingo Molnar

x86: unify uniq_io_apic_id

Signed-off-by: default avatarAlexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 92fd4b7a
...@@ -814,17 +814,29 @@ static int mp_find_ioapic(int gsi) ...@@ -814,17 +814,29 @@ static int mp_find_ioapic(int gsi)
} }
printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi); printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi);
return -1; return -1;
} }
static u8 uniq_ioapic_id(u8 id) static u8 uniq_ioapic_id(u8 id)
{ {
#ifdef CONFIG_X86_32
if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
!APIC_XAPIC(apic_version[boot_cpu_physical_apicid])) !APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
return io_apic_get_unique_id(nr_ioapics, id); return io_apic_get_unique_id(nr_ioapics, id);
else else
return id; return id;
#else
int i;
DECLARE_BITMAP(used, 256);
bitmap_zero(used, 256);
for (i = 0; i < nr_ioapics; i++) {
struct mpc_config_ioapic *ia = &mp_ioapics[i];
__set_bit(ia->mpc_apicid, used);
}
if (!test_bit(id, used))
return id;
return find_first_zero_bit(used, 256);
#endif
} }
void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
......
...@@ -707,6 +707,13 @@ static int mp_find_ioapic(int gsi) ...@@ -707,6 +707,13 @@ static int mp_find_ioapic(int gsi)
static u8 uniq_ioapic_id(u8 id) static u8 uniq_ioapic_id(u8 id)
{ {
#ifdef CONFIG_X86_32
if ((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) &&
!APIC_XAPIC(apic_version[boot_cpu_physical_apicid]))
return io_apic_get_unique_id(nr_ioapics, id);
else
return id;
#else
int i; int i;
DECLARE_BITMAP(used, 256); DECLARE_BITMAP(used, 256);
bitmap_zero(used, 256); bitmap_zero(used, 256);
...@@ -717,6 +724,7 @@ static u8 uniq_ioapic_id(u8 id) ...@@ -717,6 +724,7 @@ static u8 uniq_ioapic_id(u8 id)
if (!test_bit(id, used)) if (!test_bit(id, used))
return id; return id;
return find_first_zero_bit(used, 256); return find_first_zero_bit(used, 256);
#endif
} }
void __init mp_register_ioapic(int id, u32 address, u32 gsi_base) void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
......
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