topology.h 2.1 KB
Newer Older
1 2
#ifndef _ASM_POWERPC_TOPOLOGY_H
#define _ASM_POWERPC_TOPOLOGY_H
3
#ifdef __KERNEL__
L
Linus Torvalds 已提交
4 5


6
struct device;
7 8
struct device_node;

L
Linus Torvalds 已提交
9 10
#ifdef CONFIG_NUMA

11
/*
12 13
 * If zone_reclaim_mode is enabled, a RECLAIM_DISTANCE of 10 will mean that
 * all zones on all nodes will be eligible for zone_reclaim().
14 15 16
 */
#define RECLAIM_DISTANCE 10

17 18
#include <asm/mmzone.h>

L
Linus Torvalds 已提交
19 20
#define parent_node(node)	(node)

21 22
#define cpumask_of_node(node) ((node) == -1 ?				\
			       cpu_all_mask :				\
23
			       node_to_cpumask_map[node])
24

A
Anton Blanchard 已提交
25
struct pci_bus;
A
Arnd Bergmann 已提交
26
#ifdef CONFIG_PCI
A
Anton Blanchard 已提交
27
extern int pcibus_to_node(struct pci_bus *bus);
A
Arnd Bergmann 已提交
28 29 30 31 32 33
#else
static inline int pcibus_to_node(struct pci_bus *bus)
{
	return -1;
}
#endif
A
Anton Blanchard 已提交
34

35 36 37 38
#define cpumask_of_pcibus(bus)	(pcibus_to_node(bus) == -1 ?		\
				 cpu_all_mask :				\
				 cpumask_of_node(pcibus_to_node(bus)))

39 40 41
extern int __node_distance(int, int);
#define node_distance(a, b) __node_distance(a, b)

42 43
extern void __init dump_numa_cpu_topology(void);

44 45
extern int sysfs_add_device_to_node(struct device *dev, int nid);
extern void sysfs_remove_device_from_node(struct device *dev, int nid);
46

47
#else
L
Linus Torvalds 已提交
48

49 50
static inline void dump_numa_cpu_topology(void) {}

51
static inline int sysfs_add_device_to_node(struct device *dev, int nid)
52 53 54 55
{
	return 0;
}

56
static inline void sysfs_remove_device_from_node(struct device *dev,
57 58 59
						int nid)
{
}
60
#endif /* CONFIG_NUMA */
61

62 63 64
#if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
extern int start_topology_update(void);
extern int stop_topology_update(void);
65
extern int prrn_is_enabled(void);
66 67 68 69 70 71 72 73 74
#else
static inline int start_topology_update(void)
{
	return 0;
}
static inline int stop_topology_update(void)
{
	return 0;
}
75 76 77 78
static inline int prrn_is_enabled(void)
{
	return 0;
}
79 80
#endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */

L
Linus Torvalds 已提交
81 82
#include <asm-generic/topology.h>

83 84
#ifdef CONFIG_SMP
#include <asm/cputable.h>
85 86 87 88

#ifdef CONFIG_PPC64
#include <asm/smp.h>

89
#define topology_physical_package_id(cpu)	(cpu_to_chip_id(cpu))
90
#define topology_sibling_cpumask(cpu)	(per_cpu(cpu_sibling_map, cpu))
91
#define topology_core_cpumask(cpu)	(per_cpu(cpu_core_map, cpu))
92
#define topology_core_id(cpu)		(cpu_to_core_id(cpu))
93
#endif
94 95
#endif

96
#endif /* __KERNEL__ */
97
#endif	/* _ASM_POWERPC_TOPOLOGY_H */