Skip to content

Commit

Permalink
x86: remove mach_apic.h
Browse files Browse the repository at this point in the history
Spread mach_apic.h definitions into genapic.h. (with some knock-on effects
on smp.h and apic.h.)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Ingo Molnar committed Jan 29, 2009
1 parent 7c20dcc commit 1dcdd3d
Show file tree
Hide file tree
Showing 22 changed files with 175 additions and 207 deletions.
2 changes: 1 addition & 1 deletion arch/x86/include/asm/apic.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static inline void disable_local_APIC(void) { }
#define SET_APIC_ID(x) (apic->set_apic_id(x))
#else

static inline unsigned default_get_apic_id(unsigned long x)
static inline unsigned default_get_apic_id(unsigned long x)
{
unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));

Expand Down
139 changes: 139 additions & 0 deletions arch/x86/include/asm/genapic.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,143 @@ static inline void default_wait_for_init_deassert(atomic_t *deassert)
return;
}

extern void generic_bigsmp_probe(void);


#ifdef CONFIG_X86_LOCAL_APIC

#include <asm/smp.h>

#define APIC_DFR_VALUE (APIC_DFR_FLAT)

static inline const struct cpumask *default_target_cpus(void)
{
#ifdef CONFIG_SMP
return cpu_online_mask;
#else
return cpumask_of(0);
#endif
}

DECLARE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid);


static inline unsigned int read_apic_id(void)
{
unsigned int reg;

reg = *(u32 *)(APIC_BASE + APIC_ID);

return apic->get_apic_id(reg);
}

#ifdef CONFIG_X86_64
extern void default_setup_apic_routing(void);
#else

/*
* Set up the logical destination ID.
*
* Intel recommends to set DFR, LDR and TPR before enabling
* an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
* document number 292116). So here it goes...
*/
extern void default_init_apic_ldr(void);

static inline int default_apic_id_registered(void)
{
return physid_isset(read_apic_id(), phys_cpu_present_map);
}

static inline unsigned int
default_cpu_mask_to_apicid(const struct cpumask *cpumask)
{
return cpumask_bits(cpumask)[0];
}

static inline unsigned int
default_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
const struct cpumask *andmask)
{
unsigned long mask1 = cpumask_bits(cpumask)[0];
unsigned long mask2 = cpumask_bits(andmask)[0];
unsigned long mask3 = cpumask_bits(cpu_online_mask)[0];

return (unsigned int)(mask1 & mask2 & mask3);
}

static inline int default_phys_pkg_id(int cpuid_apic, int index_msb)
{
return cpuid_apic >> index_msb;
}

static inline void default_setup_apic_routing(void)
{
#ifdef CONFIG_X86_IO_APIC
printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
"Flat", nr_ioapics);
#endif
}

extern int default_apicid_to_node(int logical_apicid);

#endif

static inline unsigned long default_check_apicid_used(physid_mask_t bitmap, int apicid)
{
return physid_isset(apicid, bitmap);
}

static inline unsigned long default_check_apicid_present(int bit)
{
return physid_isset(bit, phys_cpu_present_map);
}

static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map)
{
return phys_map;
}

/* Mapping from cpu number to logical apicid */
static inline int default_cpu_to_logical_apicid(int cpu)
{
return 1 << cpu;
}

static inline int __default_cpu_present_to_apicid(int mps_cpu)
{
if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu))
return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu);
else
return BAD_APICID;
}

static inline int
__default_check_phys_apicid_present(int boot_cpu_physical_apicid)
{
return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
}

#ifdef CONFIG_X86_32
static inline int default_cpu_present_to_apicid(int mps_cpu)
{
return __default_cpu_present_to_apicid(mps_cpu);
}

static inline int
default_check_phys_apicid_present(int boot_cpu_physical_apicid)
{
return __default_check_phys_apicid_present(boot_cpu_physical_apicid);
}
#else
extern int default_cpu_present_to_apicid(int mps_cpu);
extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid);
#endif

static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid)
{
return physid_mask_of_physid(phys_apicid);
}

#endif /* CONFIG_X86_LOCAL_APIC */
#endif /* _ASM_X86_GENAPIC_64_H */
144 changes: 0 additions & 144 deletions arch/x86/include/asm/mach-default/mach_apic.h

This file was deleted.

8 changes: 0 additions & 8 deletions arch/x86/include/asm/mach-generic/mach_apic.h

This file was deleted.

19 changes: 0 additions & 19 deletions arch/x86/include/asm/smp.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ extern int safe_smp_processor_id(void);

#endif

#include <asm/genapic.h>

#ifdef CONFIG_X86_LOCAL_APIC

#ifndef CONFIG_X86_64
Expand All @@ -184,26 +182,9 @@ static inline int logical_smp_processor_id(void)
return GET_APIC_LOGICAL_ID(*(u32 *)(APIC_BASE + APIC_LDR));
}

static inline unsigned int read_apic_id(void)
{
unsigned int reg;

reg = *(u32 *)(APIC_BASE + APIC_ID);

return apic->get_apic_id(reg);
}
#endif


# if defined(APIC_DEFINITION) || defined(CONFIG_X86_64)
extern int hard_smp_processor_id(void);
# else
static inline int hard_smp_processor_id(void)
{
/* we don't want to mark this access volatile - bad code generation */
return read_apic_id();
}
# endif /* APIC_DEFINITION */

#else /* CONFIG_X86_LOCAL_APIC */

Expand Down
14 changes: 1 addition & 13 deletions arch/x86/kernel/acpi/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
#include <asm/mpspec.h>
#include <asm/smp.h>

#ifdef CONFIG_X86_LOCAL_APIC
# include <mach_apic.h>
#endif

static int __initdata acpi_force = 0;
u32 acpi_rsdt_forced;
#ifdef CONFIG_ACPI
Expand All @@ -56,15 +52,7 @@ int acpi_disabled = 1;
EXPORT_SYMBOL(acpi_disabled);

#ifdef CONFIG_X86_64

#include <asm/proto.h>

#else /* X86 */

#ifdef CONFIG_X86_LOCAL_APIC
#include <mach_apic.h>
#endif /* CONFIG_X86_LOCAL_APIC */

# include <asm/proto.h>
#endif /* X86 */

#define BAD_MADT_ENTRY(entry, end) ( \
Expand Down
Loading

0 comments on commit 1dcdd3d

Please sign in to comment.