aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/mach-es7000
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-i386/mach-es7000')
-rw-r--r--include/asm-i386/mach-es7000/mach_apic.h207
-rw-r--r--include/asm-i386/mach-es7000/mach_apicdef.h13
-rw-r--r--include/asm-i386/mach-es7000/mach_ipi.h24
-rw-r--r--include/asm-i386/mach-es7000/mach_mpparse.h41
-rw-r--r--include/asm-i386/mach-es7000/mach_mpspec.h8
-rw-r--r--include/asm-i386/mach-es7000/mach_wakecpu.h58
6 files changed, 351 insertions, 0 deletions
diff --git a/include/asm-i386/mach-es7000/mach_apic.h b/include/asm-i386/mach-es7000/mach_apic.h
new file mode 100644
index 000000000000..ceab2c464b13
--- /dev/null
+++ b/include/asm-i386/mach-es7000/mach_apic.h
@@ -0,0 +1,207 @@
1#ifndef __ASM_MACH_APIC_H
2#define __ASM_MACH_APIC_H
3
4extern u8 bios_cpu_apicid[];
5
6#define xapic_phys_to_log_apicid(cpu) (bios_cpu_apicid[cpu])
7#define esr_disable (1)
8
9static inline int apic_id_registered(void)
10{
11 return (1);
12}
13
14static inline cpumask_t target_cpus(void)
15{
16#if defined CONFIG_ES7000_CLUSTERED_APIC
17 return CPU_MASK_ALL;
18#else
19 return cpumask_of_cpu(smp_processor_id());
20#endif
21}
22#define TARGET_CPUS (target_cpus())
23
24#if defined CONFIG_ES7000_CLUSTERED_APIC
25#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
26#define INT_DELIVERY_MODE (dest_LowestPrio)
27#define INT_DEST_MODE (1) /* logical delivery broadcast to all procs */
28#define NO_BALANCE_IRQ (1)
29#undef WAKE_SECONDARY_VIA_INIT
30#define WAKE_SECONDARY_VIA_MIP
31#else
32#define APIC_DFR_VALUE (APIC_DFR_FLAT)
33#define INT_DELIVERY_MODE (dest_Fixed)
34#define INT_DEST_MODE (0) /* phys delivery to target procs */
35#define NO_BALANCE_IRQ (0)
36#undef APIC_DEST_LOGICAL
37#define APIC_DEST_LOGICAL 0x0
38#define WAKE_SECONDARY_VIA_INIT
39#endif
40
41#define NO_IOAPIC_CHECK (1)
42
43static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
44{
45 return 0;
46}
47static inline unsigned long check_apicid_present(int bit)
48{
49 return physid_isset(bit, phys_cpu_present_map);
50}
51
52#define apicid_cluster(apicid) (apicid & 0xF0)
53
54static inline unsigned long calculate_ldr(int cpu)
55{
56 unsigned long id;
57 id = xapic_phys_to_log_apicid(cpu);
58 return (SET_APIC_LOGICAL_ID(id));
59}
60
61/*
62 * Set up the logical destination ID.
63 *
64 * Intel recommends to set DFR, LdR and TPR before enabling
65 * an APIC. See e.g. "AP-388 82489DX User's Manual" (Intel
66 * document number 292116). So here it goes...
67 */
68static inline void init_apic_ldr(void)
69{
70 unsigned long val;
71 int cpu = smp_processor_id();
72
73 apic_write_around(APIC_DFR, APIC_DFR_VALUE);
74 val = calculate_ldr(cpu);
75 apic_write_around(APIC_LDR, val);
76}
77
78extern void es7000_sw_apic(void);
79static inline void enable_apic_mode(void)
80{
81 es7000_sw_apic();
82 return;
83}
84
85extern int apic_version [MAX_APICS];
86static inline void clustered_apic_check(void)
87{
88 int apic = bios_cpu_apicid[smp_processor_id()];
89 printk("Enabling APIC mode: %s. Using %d I/O APICs, target cpus %lx\n",
90 (apic_version[apic] == 0x14) ?
91 "Physical Cluster" : "Logical Cluster", nr_ioapics, cpus_addr(TARGET_CPUS)[0]);
92}
93
94static inline int multi_timer_check(int apic, int irq)
95{
96 return 0;
97}
98
99static inline int apicid_to_node(int logical_apicid)
100{
101 return 0;
102}
103
104
105static inline int cpu_present_to_apicid(int mps_cpu)
106{
107 if (!mps_cpu)
108 return boot_cpu_physical_apicid;
109 else if (mps_cpu < NR_CPUS)
110 return (int) bios_cpu_apicid[mps_cpu];
111 else
112 return BAD_APICID;
113}
114
115static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
116{
117 static int id = 0;
118 physid_mask_t mask;
119 mask = physid_mask_of_physid(id);
120 ++id;
121 return mask;
122}
123
124extern u8 cpu_2_logical_apicid[];
125/* Mapping from cpu number to logical apicid */
126static inline int cpu_to_logical_apicid(int cpu)
127{
128 if (cpu >= NR_CPUS)
129 return BAD_APICID;
130 return (int)cpu_2_logical_apicid[cpu];
131}
132
133static inline int mpc_apic_id(struct mpc_config_processor *m, struct mpc_config_translation *unused)
134{
135 printk("Processor #%d %ld:%ld APIC version %d\n",
136 m->mpc_apicid,
137 (m->mpc_cpufeature & CPU_FAMILY_MASK) >> 8,
138 (m->mpc_cpufeature & CPU_MODEL_MASK) >> 4,
139 m->mpc_apicver);
140 return (m->mpc_apicid);
141}
142
143static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
144{
145 /* For clustered we don't have a good way to do this yet - hack */
146 return physids_promote(0xff);
147}
148
149
150static inline void setup_portio_remap(void)
151{
152}
153
154extern unsigned int boot_cpu_physical_apicid;
155static inline int check_phys_apicid_present(int cpu_physical_apicid)
156{
157 boot_cpu_physical_apicid = GET_APIC_ID(apic_read(APIC_ID));
158 return (1);
159}
160
161static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
162{
163 int num_bits_set;
164 int cpus_found = 0;
165 int cpu;
166 int apicid;
167
168 num_bits_set = cpus_weight(cpumask);
169 /* Return id to all */
170 if (num_bits_set == NR_CPUS)
171#if defined CONFIG_ES7000_CLUSTERED_APIC
172 return 0xFF;
173#else
174 return cpu_to_logical_apicid(0);
175#endif
176 /*
177 * The cpus in the mask must all be on the apic cluster. If are not
178 * on the same apicid cluster return default value of TARGET_CPUS.
179 */
180 cpu = first_cpu(cpumask);
181 apicid = cpu_to_logical_apicid(cpu);
182 while (cpus_found < num_bits_set) {
183 if (cpu_isset(cpu, cpumask)) {
184 int new_apicid = cpu_to_logical_apicid(cpu);
185 if (apicid_cluster(apicid) !=
186 apicid_cluster(new_apicid)){
187 printk ("%s: Not a valid mask!\n",__FUNCTION__);
188#if defined CONFIG_ES7000_CLUSTERED_APIC
189 return 0xFF;
190#else
191 return cpu_to_logical_apicid(0);
192#endif
193 }
194 apicid = new_apicid;
195 cpus_found++;
196 }
197 cpu++;
198 }
199 return apicid;
200}
201
202static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
203{
204 return cpuid_apic >> index_msb;
205}
206
207#endif /* __ASM_MACH_APIC_H */
diff --git a/include/asm-i386/mach-es7000/mach_apicdef.h b/include/asm-i386/mach-es7000/mach_apicdef.h
new file mode 100644
index 000000000000..a58ab5a75c8c
--- /dev/null
+++ b/include/asm-i386/mach-es7000/mach_apicdef.h
@@ -0,0 +1,13 @@
1#ifndef __ASM_MACH_APICDEF_H
2#define __ASM_MACH_APICDEF_H
3
4#define APIC_ID_MASK (0xFF<<24)
5
6static inline unsigned get_apic_id(unsigned long x)
7{
8 return (((x)>>24)&0xFF);
9}
10
11#define GET_APIC_ID(x) get_apic_id(x)
12
13#endif
diff --git a/include/asm-i386/mach-es7000/mach_ipi.h b/include/asm-i386/mach-es7000/mach_ipi.h
new file mode 100644
index 000000000000..5e61bd220b06
--- /dev/null
+++ b/include/asm-i386/mach-es7000/mach_ipi.h
@@ -0,0 +1,24 @@
1#ifndef __ASM_MACH_IPI_H
2#define __ASM_MACH_IPI_H
3
4void send_IPI_mask_sequence(cpumask_t mask, int vector);
5
6static inline void send_IPI_mask(cpumask_t mask, int vector)
7{
8 send_IPI_mask_sequence(mask, vector);
9}
10
11static inline void send_IPI_allbutself(int vector)
12{
13 cpumask_t mask = cpu_online_map;
14 cpu_clear(smp_processor_id(), mask);
15 if (!cpus_empty(mask))
16 send_IPI_mask(mask, vector);
17}
18
19static inline void send_IPI_all(int vector)
20{
21 send_IPI_mask(cpu_online_map, vector);
22}
23
24#endif /* __ASM_MACH_IPI_H */
diff --git a/include/asm-i386/mach-es7000/mach_mpparse.h b/include/asm-i386/mach-es7000/mach_mpparse.h
new file mode 100644
index 000000000000..85809e0898d7
--- /dev/null
+++ b/include/asm-i386/mach-es7000/mach_mpparse.h
@@ -0,0 +1,41 @@
1#ifndef __ASM_MACH_MPPARSE_H
2#define __ASM_MACH_MPPARSE_H
3
4static inline void mpc_oem_bus_info(struct mpc_config_bus *m, char *name,
5 struct mpc_config_translation *translation)
6{
7 Dprintk("Bus #%d is %s\n", m->mpc_busid, name);
8}
9
10static inline void mpc_oem_pci_bus(struct mpc_config_bus *m,
11 struct mpc_config_translation *translation)
12{
13}
14
15extern int parse_unisys_oem (char *oemptr, int oem_entries);
16extern int find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length);
17
18static inline int mps_oem_check(struct mp_config_table *mpc, char *oem,
19 char *productid)
20{
21 if (mpc->mpc_oemptr) {
22 struct mp_config_oemtable *oem_table =
23 (struct mp_config_oemtable *)mpc->mpc_oemptr;
24 if (!strncmp(oem, "UNISYS", 6))
25 return parse_unisys_oem((char *)oem_table, oem_table->oem_length);
26 }
27 return 0;
28}
29
30/* Hook from generic ACPI tables.c */
31static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
32{
33 unsigned long oem_addr;
34 int oem_entries;
35 if (!find_unisys_acpi_oem_table(&oem_addr, &oem_entries))
36 return parse_unisys_oem((char *)oem_addr, oem_entries);
37 return 0;
38}
39
40
41#endif /* __ASM_MACH_MPPARSE_H */
diff --git a/include/asm-i386/mach-es7000/mach_mpspec.h b/include/asm-i386/mach-es7000/mach_mpspec.h
new file mode 100644
index 000000000000..b1f5039d4506
--- /dev/null
+++ b/include/asm-i386/mach-es7000/mach_mpspec.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_MACH_MPSPEC_H
2#define __ASM_MACH_MPSPEC_H
3
4#define MAX_IRQ_SOURCES 256
5
6#define MAX_MP_BUSSES 256
7
8#endif /* __ASM_MACH_MPSPEC_H */
diff --git a/include/asm-i386/mach-es7000/mach_wakecpu.h b/include/asm-i386/mach-es7000/mach_wakecpu.h
new file mode 100644
index 000000000000..efc903b73486
--- /dev/null
+++ b/include/asm-i386/mach-es7000/mach_wakecpu.h
@@ -0,0 +1,58 @@
1#ifndef __ASM_MACH_WAKECPU_H
2#define __ASM_MACH_WAKECPU_H
3
4/*
5 * This file copes with machines that wakeup secondary CPUs by the
6 * INIT, INIT, STARTUP sequence.
7 */
8
9#ifdef CONFIG_ES7000_CLUSTERED_APIC
10#define WAKE_SECONDARY_VIA_MIP
11#else
12#define WAKE_SECONDARY_VIA_INIT
13#endif
14
15#ifdef WAKE_SECONDARY_VIA_MIP
16extern int es7000_start_cpu(int cpu, unsigned long eip);
17static inline int
18wakeup_secondary_cpu(int phys_apicid, unsigned long start_eip)
19{
20 int boot_error = 0;
21 boot_error = es7000_start_cpu(phys_apicid, start_eip);
22 return boot_error;
23}
24#endif
25
26#define TRAMPOLINE_LOW phys_to_virt(0x467)
27#define TRAMPOLINE_HIGH phys_to_virt(0x469)
28
29#define boot_cpu_apicid boot_cpu_physical_apicid
30
31static inline void wait_for_init_deassert(atomic_t *deassert)
32{
33#ifdef WAKE_SECONDARY_VIA_INIT
34 while (!atomic_read(deassert));
35#endif
36 return;
37}
38
39/* Nothing to do for most platforms, since cleared by the INIT cycle */
40static inline void smp_callin_clear_local_apic(void)
41{
42}
43
44static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
45{
46}
47
48static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
49{
50}
51
52#if APIC_DEBUG
53 #define inquire_remote_apic(apicid) __inquire_remote_apic(apicid)
54#else
55 #define inquire_remote_apic(apicid) {}
56#endif
57
58#endif /* __ASM_MACH_WAKECPU_H */