Skip to content

Commit

Permalink
x86, apic: Unify identical register_lapic_address() functions
Browse files Browse the repository at this point in the history
They are the same, move the common function to apic.c to allow
further cleanups.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Len Brown <lenb@kernel.org>
LKML-Reference: <4CFDF675.4060305@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Yinghai Lu authored and Thomas Gleixner committed Dec 9, 2010
1 parent 51ddafc commit c0104d3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 27 deletions.
1 change: 1 addition & 0 deletions arch/x86/include/asm/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ extern void init_bsp_APIC(void);
extern void setup_local_APIC(void);
extern void end_local_APIC_setup(void);
extern void init_apic_mappings(void);
void register_lapic_address(unsigned long address);
extern void setup_boot_APIC_clock(void);
extern void setup_secondary_APIC_clock(void);
extern int APIC_init_uniprocessor(void);
Expand Down
16 changes: 2 additions & 14 deletions arch/x86/kernel/acpi/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -847,18 +847,6 @@ static int __init acpi_parse_fadt(struct acpi_table_header *table)
* returns 0 on success, < 0 on error
*/

static void __init acpi_register_lapic_address(unsigned long address)
{
mp_lapic_addr = address;

set_fixmap_nocache(FIX_APIC_BASE, address);
if (boot_cpu_physical_apicid == -1U) {
boot_cpu_physical_apicid = read_apic_id();
apic_version[boot_cpu_physical_apicid] =
GET_APIC_VERSION(apic_read(APIC_LVR));
}
}

static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
{
int count;
Expand All @@ -880,7 +868,7 @@ static int __init early_acpi_parse_madt_lapic_addr_ovr(void)
return count;
}

acpi_register_lapic_address(acpi_lapic_addr);
register_lapic_address(acpi_lapic_addr);

return count;
}
Expand All @@ -907,7 +895,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
return count;
}

acpi_register_lapic_address(acpi_lapic_addr);
register_lapic_address(acpi_lapic_addr);

count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC,
acpi_parse_sapic, MAX_APICS);
Expand Down
12 changes: 12 additions & 0 deletions arch/x86/kernel/apic/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1702,6 +1702,18 @@ void __init init_apic_mappings(void)
}
}

void __init register_lapic_address(unsigned long address)
{
mp_lapic_addr = address;

set_fixmap_nocache(FIX_APIC_BASE, address);
if (boot_cpu_physical_apicid == -1U) {
boot_cpu_physical_apicid = read_apic_id();
apic_version[boot_cpu_physical_apicid] =
GET_APIC_VERSION(apic_read(APIC_LVR));
}
}

/*
* This initializes the IO-APIC and APIC hardware if this is
* a UP kernel.
Expand Down
14 changes: 1 addition & 13 deletions arch/x86/kernel/mpparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,18 +275,6 @@ static void __init smp_dump_mptable(struct mpc_table *mpc, unsigned char *mpt)

void __init default_smp_read_mpc_oem(struct mpc_table *mpc) { }

static void __init smp_register_lapic_address(unsigned long address)
{
mp_lapic_addr = address;

set_fixmap_nocache(FIX_APIC_BASE, address);
if (boot_cpu_physical_apicid == -1U) {
boot_cpu_physical_apicid = read_apic_id();
apic_version[boot_cpu_physical_apicid] =
GET_APIC_VERSION(apic_read(APIC_LVR));
}
}

static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
{
char str[16];
Expand All @@ -310,7 +298,7 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)

/* Initialize the lapic mapping */
if (!acpi_lapic)
smp_register_lapic_address(mpc->lapic);
register_lapic_address(mpc->lapic);

if (mpc->oemptr)
x86_init.mpparse.smp_read_mpc_oem(mpc);
Expand Down

0 comments on commit c0104d3

Please sign in to comment.