1 #ifndef __ASM_MPSPEC_H
2 #define __ASM_MPSPEC_H
3 
4 #include <xen/cpumask.h>
5 #include <asm/mpspec_def.h>
6 #include <mach_mpspec.h>
7 
8 extern unsigned char mp_bus_id_to_type[MAX_MP_BUSSES];
9 
10 extern bool def_to_bigsmp;
11 extern unsigned int boot_cpu_physical_apicid;
12 extern bool smp_found_config;
13 extern void find_smp_config (void);
14 extern void get_smp_config (void);
15 extern unsigned char apic_version [MAX_APICS];
16 extern int mp_irq_entries;
17 extern struct mpc_config_intsrc mp_irqs [MAX_IRQ_SOURCES];
18 extern int mpc_default_type;
19 extern unsigned long mp_lapic_addr;
20 extern bool pic_mode;
21 
22 #ifdef CONFIG_ACPI
23 extern int mp_register_lapic(u32 id, bool enabled, bool hotplug);
24 extern void mp_unregister_lapic(uint32_t apic_id, uint32_t cpu);
25 extern void mp_register_lapic_address (u64 address);
26 extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base);
27 extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi);
28 extern void mp_config_acpi_legacy_irqs (void);
29 extern int mp_register_gsi (u32 gsi, int edge_level, int active_high_low);
30 #endif /* CONFIG_ACPI */
31 
32 #define PHYSID_ARRAY_SIZE	BITS_TO_LONGS(MAX_APICS)
33 
34 struct physid_mask
35 {
36 	unsigned long mask[PHYSID_ARRAY_SIZE];
37 };
38 
39 typedef struct physid_mask physid_mask_t;
40 
41 #define physid_set(physid, map)			set_bit(physid, (map).mask)
42 #define physid_clear(physid, map)		clear_bit(physid, (map).mask)
43 #define physid_isset(physid, map)		test_bit(physid, (map).mask)
44 #define physid_test_and_set(physid, map)	test_and_set_bit(physid, (map).mask)
45 
46 #define first_physid(map)			find_first_bit((map).mask, \
47 							       MAX_APICS)
48 #define next_physid(id, map)			find_next_bit((map).mask, \
49 							      MAX_APICS, (id) + 1)
50 #define last_physid(map) ({ \
51 	const unsigned long *mask = (map).mask; \
52 	unsigned int id, last = MAX_APICS; \
53 	for (id = find_first_bit(mask, MAX_APICS); id < MAX_APICS; \
54 	     id = find_next_bit(mask, MAX_APICS, (id) + 1)) \
55 		last = id; \
56 	last; \
57 })
58 
59 #define physids_and(dst, src1, src2)		bitmap_and((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
60 #define physids_or(dst, src1, src2)		bitmap_or((dst).mask, (src1).mask, (src2).mask, MAX_APICS)
61 #define physids_clear(map)			bitmap_zero((map).mask, MAX_APICS)
62 #define physids_complement(dst, src)		bitmap_complement((dst).mask,(src).mask, MAX_APICS)
63 #define physids_empty(map)			bitmap_empty((map).mask, MAX_APICS)
64 #define physids_equal(map1, map2)		bitmap_equal((map1).mask, (map2).mask, MAX_APICS)
65 #define physids_weight(map)			bitmap_weight((map).mask, MAX_APICS)
66 
67 #define PHYSID_MASK_ALL		{ {[0 ... PHYSID_ARRAY_SIZE-1] = ~0UL} }
68 #define PHYSID_MASK_NONE	{ {[0 ... PHYSID_ARRAY_SIZE-1] = 0UL} }
69 
70 extern physid_mask_t phys_cpu_present_map;
71 
72 #endif
73 
74