topology.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef _ASM_POWERPC_TOPOLOGY_H
  2. #define _ASM_POWERPC_TOPOLOGY_H
  3. #ifdef __KERNEL__
  4. #include <linux/config.h>
  5. struct sys_device;
  6. struct device_node;
  7. #ifdef CONFIG_NUMA
  8. #include <asm/mmzone.h>
  9. static inline int cpu_to_node(int cpu)
  10. {
  11. return numa_cpu_lookup_table[cpu];
  12. }
  13. #define parent_node(node) (node)
  14. static inline cpumask_t node_to_cpumask(int node)
  15. {
  16. return numa_cpumask_lookup_table[node];
  17. }
  18. static inline int node_to_first_cpu(int node)
  19. {
  20. cpumask_t tmp;
  21. tmp = node_to_cpumask(node);
  22. return first_cpu(tmp);
  23. }
  24. int of_node_to_nid(struct device_node *device);
  25. #define pcibus_to_node(node) (-1)
  26. #define pcibus_to_cpumask(bus) (cpu_online_map)
  27. /* sched_domains SD_NODE_INIT for PPC64 machines */
  28. #define SD_NODE_INIT (struct sched_domain) { \
  29. .span = CPU_MASK_NONE, \
  30. .parent = NULL, \
  31. .groups = NULL, \
  32. .min_interval = 8, \
  33. .max_interval = 32, \
  34. .busy_factor = 32, \
  35. .imbalance_pct = 125, \
  36. .cache_nice_tries = 1, \
  37. .per_cpu_gain = 100, \
  38. .busy_idx = 3, \
  39. .idle_idx = 1, \
  40. .newidle_idx = 2, \
  41. .wake_idx = 1, \
  42. .flags = SD_LOAD_BALANCE \
  43. | SD_BALANCE_EXEC \
  44. | SD_BALANCE_NEWIDLE \
  45. | SD_WAKE_IDLE \
  46. | SD_WAKE_BALANCE, \
  47. .last_balance = jiffies, \
  48. .balance_interval = 1, \
  49. .nr_balance_failed = 0, \
  50. }
  51. extern void __init dump_numa_cpu_topology(void);
  52. extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
  53. extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid);
  54. #else
  55. static inline int of_node_to_nid(struct device_node *device)
  56. {
  57. return 0;
  58. }
  59. static inline void dump_numa_cpu_topology(void) {}
  60. static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid)
  61. {
  62. return 0;
  63. }
  64. static inline void sysfs_remove_device_from_node(struct sys_device *dev,
  65. int nid)
  66. {
  67. }
  68. #include <asm-generic/topology.h>
  69. #endif /* CONFIG_NUMA */
  70. #endif /* __KERNEL__ */
  71. #endif /* _ASM_POWERPC_TOPOLOGY_H */