]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/asm-x86/topology.h
powerpc/pseries: Update the device tree correctly for drconf memory add/remove
[linux-2.6-omap-h63xx.git] / include / asm-x86 / topology.h
index 9c251604ecc4b9d90ebbd66b7ad8f66a5de516bf..dcf3f8131d6b4b728643b84cd9d395b0ea4dd963 100644 (file)
 #ifndef _ASM_X86_TOPOLOGY_H
 #define _ASM_X86_TOPOLOGY_H
 
+#ifdef CONFIG_X86_32
+# ifdef CONFIG_X86_HT
+#  define ENABLE_TOPO_DEFINES
+# endif
+#else
+# ifdef CONFIG_SMP
+#  define ENABLE_TOPO_DEFINES
+# endif
+#endif
+
 #ifdef CONFIG_NUMA
 #include <linux/cpumask.h>
 #include <asm/mpspec.h>
 
 /* Mappings between logical cpu number and node number */
+#ifdef CONFIG_X86_32
 extern int cpu_to_node_map[];
+#else
+/* Returns the number of the current Node. */
+#define numa_node_id()         (early_cpu_to_node(raw_smp_processor_id()))
+#endif
+
+DECLARE_PER_CPU(int, x86_cpu_to_node_map);
+
+#ifdef CONFIG_SMP
+extern int x86_cpu_to_node_map_init[];
+extern void *x86_cpu_to_node_map_early_ptr;
+#else
+#define x86_cpu_to_node_map_early_ptr NULL
+#endif
+
 extern cpumask_t node_to_cpumask_map[];
 
+#define NUMA_NO_NODE   (-1)
+
 /* Returns the number of the node containing CPU 'cpu' */
+#ifdef CONFIG_X86_32
+#define early_cpu_to_node(cpu) cpu_to_node(cpu)
 static inline int cpu_to_node(int cpu)
 {
        return cpu_to_node_map[cpu];
 }
 
+#else /* CONFIG_X86_64 */
+
+#ifdef CONFIG_SMP
+static inline int early_cpu_to_node(int cpu)
+{
+       int *cpu_to_node_map = x86_cpu_to_node_map_early_ptr;
+
+       if (cpu_to_node_map)
+               return cpu_to_node_map[cpu];
+       else if (per_cpu_offset(cpu))
+               return per_cpu(x86_cpu_to_node_map, cpu);
+       else
+               return NUMA_NO_NODE;
+}
+#else
+#define        early_cpu_to_node(cpu)  cpu_to_node(cpu)
+#endif
+
+static inline int cpu_to_node(int cpu)
+{
+#ifdef CONFIG_DEBUG_PER_CPU_MAPS
+       if (x86_cpu_to_node_map_early_ptr) {
+               printk("KERN_NOTICE cpu_to_node(%d): usage too early!\n",
+                      (int)cpu);
+               dump_stack();
+               return ((int *)x86_cpu_to_node_map_early_ptr)[cpu];
+       }
+#endif
+       return per_cpu(x86_cpu_to_node_map, cpu);
+}
+
+#ifdef CONFIG_NUMA
+
+/* Returns a pointer to the cpumask of CPUs on Node 'node'. */
+#define node_to_cpumask_ptr(v, node)           \
+               cpumask_t *v = &(node_to_cpumask_map[node])
+
+#define node_to_cpumask_ptr_next(v, node)      \
+                          v = &(node_to_cpumask_map[node])
+#endif
+
+#endif /* CONFIG_X86_64 */
+
 /*
  * Returns the number of the node containing Node 'node'. This
  * architecture is flat, so it is a pretty simple function!
@@ -68,10 +140,6 @@ extern unsigned long node_end_pfn[];
 extern unsigned long node_remap_size[];
 #define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid])
 
-# ifdef CONFIG_X86_HT
-#  define ENABLE_TOPO_DEFINES
-# endif
-
 # define SD_CACHE_NICE_TRIES   1
 # define SD_IDLE_IDX           1
 # define SD_NEWIDLE_IDX                2
@@ -79,23 +147,15 @@ extern unsigned long node_remap_size[];
 
 #else
 
-# ifdef CONFIG_SMP
-#  define ENABLE_TOPO_DEFINES
-# endif
-
 # define SD_CACHE_NICE_TRIES   2
 # define SD_IDLE_IDX           2
-# define SD_NEWIDLE_IDX                0
+# define SD_NEWIDLE_IDX                2
 # define SD_FORKEXEC_IDX       1
 
 #endif
 
 /* sched_domains SD_NODE_INIT for NUMAQ machines */
 #define SD_NODE_INIT (struct sched_domain) {           \
-       .span                   = CPU_MASK_NONE,        \
-       .parent                 = NULL,                 \
-       .child                  = NULL,                 \
-       .groups                 = NULL,                 \
        .min_interval           = 8,                    \
        .max_interval           = 32,                   \
        .busy_factor            = 32,                   \
@@ -113,7 +173,6 @@ extern unsigned long node_remap_size[];
                                | SD_WAKE_BALANCE,      \
        .last_balance           = jiffies,              \
        .balance_interval       = 1,                    \
-       .nr_balance_failed      = 0,                    \
 }
 
 #ifdef CONFIG_X86_64_ACPI_NUMA
@@ -123,10 +182,10 @@ extern int __node_distance(int, int);
 
 #else /* CONFIG_NUMA */
 
-#include <asm-generic/topology.h>
-
 #endif
 
+#include <asm-generic/topology.h>
+
 extern cpumask_t cpu_coregroup_map(int cpu);
 
 #ifdef ENABLE_TOPO_DEFINES
@@ -136,9 +195,29 @@ extern cpumask_t cpu_coregroup_map(int cpu);
 #define topology_thread_siblings(cpu)          (per_cpu(cpu_sibling_map, cpu))
 #endif
 
+static inline void arch_fix_phys_package_id(int num, u32 slot)
+{
+}
+
+struct pci_bus;
+void set_pci_bus_resources_arch_default(struct pci_bus *b);
+
 #ifdef CONFIG_SMP
 #define mc_capable()                   (boot_cpu_data.x86_max_cores > 1)
 #define smt_capable()                  (smp_num_siblings > 1)
 #endif
 
+#ifdef CONFIG_NUMA
+extern int get_mp_bus_to_node(int busnum);
+extern void set_mp_bus_to_node(int busnum, int node);
+#else
+static inline int get_mp_bus_to_node(int busnum)
+{
+       return 0;
+}
+static inline void set_mp_bus_to_node(int busnum, int node)
+{
+}
+#endif
+
 #endif