ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-i386 / mach-default / mach_apic.h
1 #ifndef __ASM_MACH_APIC_H
2 #define __ASM_MACH_APIC_H
3
4 #include <mach_apicdef.h>
5
6 #define APIC_DFR_VALUE  (APIC_DFR_FLAT)
7
8 static inline cpumask_const_t target_cpus(void)
9
10 #ifdef CONFIG_SMP
11         return mk_cpumask_const(cpu_online_map);
12 #else
13         return mk_cpumask_const(cpumask_of_cpu(0));
14 #endif
15
16 #define TARGET_CPUS (target_cpus())
17
18 #define NO_BALANCE_IRQ (0)
19 #define esr_disable (0)
20
21 #define NO_IOAPIC_CHECK (0)
22
23 #define INT_DELIVERY_MODE dest_LowestPrio
24 #define INT_DEST_MODE 1     /* logical delivery broadcast to all procs */
25
26 /*
27  * this isn't really broadcast, just a (potentially inaccurate) upper
28  * bound for valid physical APIC id's
29  */
30 #define APIC_BROADCAST_ID      0x0F
31
32 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
33 {
34         return physid_isset(apicid, bitmap);
35 }
36
37 static inline unsigned long check_apicid_present(int bit)
38 {
39         return physid_isset(bit, phys_cpu_present_map);
40 }
41
42 /*
43  * Set up the logical destination ID.
44  *
45  * Intel recommends to set DFR, LDR and TPR before enabling
46  * an APIC.  See e.g. "AP-388 82489DX User's Manual" (Intel
47  * document number 292116).  So here it goes...
48  */
49 static inline void init_apic_ldr(void)
50 {
51         unsigned long val;
52
53         apic_write_around(APIC_DFR, APIC_DFR_VALUE);
54         val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
55         val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id());
56         apic_write_around(APIC_LDR, val);
57 }
58
59 static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
60 {
61         return phys_map;
62 }
63
64 static inline void clustered_apic_check(void)
65 {
66         printk("Enabling APIC mode:  %s.  Using %d I/O APICs\n",
67                                         "Flat", nr_ioapics);
68 }
69
70 static inline int multi_timer_check(int apic, int irq)
71 {
72         return 0;
73 }
74
75 static inline int apicid_to_node(int logical_apicid)
76 {
77         return 0;
78 }
79
80 /* Mapping from cpu number to logical apicid */
81 static inline int cpu_to_logical_apicid(int cpu)
82 {
83         return 1 << cpu;
84 }
85
86 static inline int cpu_present_to_apicid(int mps_cpu)
87 {
88         return  mps_cpu;
89 }
90
91 static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
92 {
93         return physid_mask_of_physid(phys_apicid);
94 }
95
96 static inline int mpc_apic_id(struct mpc_config_processor *m, 
97                         struct mpc_config_translation *translation_record)
98 {
99         printk("Processor #%d %ld:%ld APIC version %d\n",
100                         m->mpc_apicid,
101                         (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
102                         (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
103                         m->mpc_apicver);
104         return (m->mpc_apicid);
105 }
106
107 static inline void setup_portio_remap(void)
108 {
109 }
110
111 static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
112 {
113         return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
114 }
115
116 static inline int apic_id_registered(void)
117 {
118         return physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map);
119 }
120
121 static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
122 {
123         return cpus_coerce_const(cpumask);
124 }
125
126 static inline void enable_apic_mode(void)
127 {
128 }
129
130 static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
131 {
132         return cpuid_apic >> index_msb;
133 }
134
135 #endif /* __ASM_MACH_APIC_H */