9 #include <linux/kernel.h>
11 #include <linux/string.h>
12 #include <linux/module.h>
20 #include <asm/types.h>
21 #include <asm/mmzone.h>
32 static __init int find_northbridge(
void)
36 for (num = 0; num < 32; num++) {
56 static __init void early_get_boot_cpu_id(
void)
62 #ifdef CONFIG_X86_MPPARSE
67 early_get_smp_config();
79 unsigned int bits, cores, apicid_base;
84 nb = find_northbridge();
88 pr_info(
"Scanning NUMA topology in Northbridge %d\n", nb);
91 numnodes = ((reg >> 4) & 0xF) + 1;
95 pr_info(
"Number of physical nodes %d\n", numnodes);
98 for (i = 0; i < 8; i++) {
104 nodeids[
i] = nodeid = limit & 7;
105 if ((base & 3) == 0) {
107 pr_info(
"Skipping disabled node %d\n", i);
110 if (nodeid >= numnodes) {
111 pr_info(
"Ignoring excess node %d (%Lx:%Lx)\n", nodeid,
117 pr_info(
"Skipping node entry %d (base %Lx)\n",
121 if ((base >> 8) & 3 || (limit >> 8) & 3) {
122 pr_err(
"Node %d using interleaving mode %Lx/%Lx\n",
123 nodeid, (base >> 8) & 3, (limit >> 8) & 3);
127 pr_info(
"Node %d already present, skipping\n",
150 pr_err(
"Empty node %d\n", nodeid);
154 pr_err(
"Node %d bogus settings %Lx-%Lx.\n",
155 nodeid, base, limit);
160 if (prevbase > base) {
161 pr_err(
"Node map not sorted %Lx,%Lx\n",
166 pr_info(
"Node %d MemBase %016Lx Limit %016Lx\n",
167 nodeid, base, limit);
171 node_set(nodeid, numa_nodes_parsed);
186 early_get_boot_cpu_id();
193 for (j = apicid_base; j < cores + apicid_base; j++)
194 set_apicid_to_node((i << bits) + j, i);