ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / include / asm-i386 / mach-visws / 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 #define no_balance_irq (0)
9 #define esr_disable (0)
10
11 #define NO_IOAPIC_CHECK (0)
12
13 #define INT_DELIVERY_MODE dest_LowestPrio
14 #define INT_DEST_MODE 1     /* logical delivery broadcast to all procs */
15
16 #ifdef CONFIG_SMP
17  #define TARGET_CPUS cpu_online_map
18 #else
19  #define TARGET_CPUS cpumask_of_cpu(0)
20 #endif
21
22 #define APIC_BROADCAST_ID      0x0F
23 #define check_apicid_used(bitmap, apicid)       physid_isset(apicid, bitmap)
24 #define check_apicid_present(bit)               physid_isset(bit, phys_cpu_present_map)
25
26 static inline int apic_id_registered(void)
27 {
28         return physid_isset(GET_APIC_ID(apic_read(APIC_ID)), phys_cpu_present_map);
29 }
30
31 /*
32  * Set up the logical destination ID.
33  *
34  * Intel recommends to set DFR, LDR and TPR before enabling
35  * an APIC.  See e.g. "AP-388 82489DX User's Manual" (Intel
36  * document number 292116).  So here it goes...
37  */
38 static inline void init_apic_ldr(void)
39 {
40         unsigned long val;
41
42         apic_write_around(APIC_DFR, APIC_DFR_VALUE);
43         val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
44         val |= SET_APIC_LOGICAL_ID(1UL << smp_processor_id());
45         apic_write_around(APIC_LDR, val);
46 }
47
48 static inline void summit_check(char *oem, char *productid) 
49 {
50 }
51
52 static inline void clustered_apic_check(void)
53 {
54 }
55
56 /* Mapping from cpu number to logical apicid */
57 static inline int cpu_to_logical_apicid(int cpu)
58 {
59         return 1 << cpu;
60 }
61
62 static inline int cpu_present_to_apicid(int mps_cpu)
63 {
64         return mps_cpu;
65 }
66
67 static inline physid_mask_t apicid_to_cpu_present(int apicid)
68 {
69         return physid_mask_of_physid(apicid);
70 }
71
72 #define WAKE_SECONDARY_VIA_INIT
73
74 static inline void setup_portio_remap(void)
75 {
76 }
77
78 static inline void enable_apic_mode(void)
79 {
80 }
81
82 static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
83 {
84         return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
85 }
86
87 static inline unsigned int cpu_mask_to_apicid(cpumask_const_t cpumask)
88 {
89         return cpus_coerce_const(cpumask);
90 }
91
92 static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
93 {
94         return cpuid_apic >> index_msb;
95 }
96
97 #endif /* __ASM_MACH_APIC_H */