1 #ifndef __ASM_MACH_APIC_H
2 #define __ASM_MACH_APIC_H
4 #include <mach_apicdef.h>
7 #define APIC_DFR_VALUE (APIC_DFR_FLAT)
9 static inline cpumask_t target_cpus(void)
12 return cpu_online_map;
14 return cpumask_of_cpu(0);
17 #define TARGET_CPUS (target_cpus())
19 #define NO_BALANCE_IRQ (0)
20 #define esr_disable (0)
22 #define INT_DELIVERY_MODE dest_LowestPrio
23 #define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */
25 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
27 return physid_isset(apicid, bitmap);
30 static inline unsigned long check_apicid_present(int bit)
32 return physid_isset(bit, phys_cpu_present_map);
36 * Set up the logical destination ID.
38 * Intel recommends to set DFR, LDR and TPR before enabling
39 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
40 * document number 292116). So here it goes...
42 static inline void init_apic_ldr(void)
46 apic_write_around(APIC_DFR, APIC_DFR_VALUE);
47 val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
48 val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id());
49 apic_write_around(APIC_LDR, val);
52 static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
57 static inline void setup_apic_routing(void)
59 printk("Enabling APIC mode: %s. Using %d I/O APICs\n",
63 static inline int multi_timer_check(int apic, int irq)
68 static inline int apicid_to_node(int logical_apicid)
73 /* Mapping from cpu number to logical apicid */
74 static inline int cpu_to_logical_apicid(int cpu)
79 static inline int cpu_present_to_apicid(int mps_cpu)
81 if (mps_cpu < get_physical_broadcast())
87 static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
89 return physid_mask_of_physid(phys_apicid);
92 static inline int mpc_apic_id(struct mpc_config_processor *m,
93 struct mpc_config_translation *translation_record)
95 printk("Processor #%d %u:%u APIC version %d\n",
97 (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
98 (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
100 return m->mpc_apicid;
103 static inline void setup_portio_remap(void)
107 static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
109 return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
112 static inline int apic_id_registered(void)
114 return physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map);
117 static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
119 return cpus_addr(cpumask)[0];
122 static inline void enable_apic_mode(void)
126 static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
128 return cpuid_apic >> index_msb;
131 #endif /* __ASM_MACH_APIC_H */