topology.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #ifndef _ASM_POWERPC_TOPOLOGY_H
  2. #define _ASM_POWERPC_TOPOLOGY_H
  3. #ifdef __KERNEL__
  4. struct device;
  5. struct device_node;
  6. #ifdef CONFIG_NUMA
  7. /*
  8. * If zone_reclaim_mode is enabled, a RECLAIM_DISTANCE of 10 will mean that
  9. * all zones on all nodes will be eligible for zone_reclaim().
  10. */
  11. #define RECLAIM_DISTANCE 10
  12. #include <asm/mmzone.h>
  13. #define parent_node(node) (node)
  14. #define cpumask_of_node(node) ((node) == -1 ? \
  15. cpu_all_mask : \
  16. node_to_cpumask_map[node])
  17. struct pci_bus;
  18. #ifdef CONFIG_PCI
  19. extern int pcibus_to_node(struct pci_bus *bus);
  20. #else
  21. static inline int pcibus_to_node(struct pci_bus *bus)
  22. {
  23. return -1;
  24. }
  25. #endif
  26. #define cpumask_of_pcibus(bus) (pcibus_to_node(bus) == -1 ? \
  27. cpu_all_mask : \
  28. cpumask_of_node(pcibus_to_node(bus)))
  29. extern int __node_distance(int, int);
  30. #define node_distance(a, b) __node_distance(a, b)
  31. extern void __init dump_numa_cpu_topology(void);
  32. extern int sysfs_add_device_to_node(struct device *dev, int nid);
  33. extern void sysfs_remove_device_from_node(struct device *dev, int nid);
  34. #else
  35. static inline void dump_numa_cpu_topology(void) {}
  36. static inline int sysfs_add_device_to_node(struct device *dev, int nid)
  37. {
  38. return 0;
  39. }
  40. static inline void sysfs_remove_device_from_node(struct device *dev,
  41. int nid)
  42. {
  43. }
  44. #endif /* CONFIG_NUMA */
  45. #if defined(CONFIG_NUMA) && defined(CONFIG_PPC_SPLPAR)
  46. extern int start_topology_update(void);
  47. extern int stop_topology_update(void);
  48. extern int prrn_is_enabled(void);
  49. #else
  50. static inline int start_topology_update(void)
  51. {
  52. return 0;
  53. }
  54. static inline int stop_topology_update(void)
  55. {
  56. return 0;
  57. }
  58. static inline int prrn_is_enabled(void)
  59. {
  60. return 0;
  61. }
  62. #endif /* CONFIG_NUMA && CONFIG_PPC_SPLPAR */
  63. #include <asm-generic/topology.h>
  64. #ifdef CONFIG_SMP
  65. #include <asm/cputable.h>
  66. #ifdef CONFIG_PPC64
  67. #include <asm/smp.h>
  68. #define topology_physical_package_id(cpu) (cpu_to_chip_id(cpu))
  69. #define topology_sibling_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
  70. #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
  71. #define topology_core_id(cpu) (cpu_to_core_id(cpu))
  72. #endif
  73. #endif
  74. #endif /* __KERNEL__ */
  75. #endif /* _ASM_POWERPC_TOPOLOGY_H */