2 * acpi_numa.c - ACPI NUMA support
4 * Copyright (C) 2002 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26 #include <linux/config.h>
27 #include <linux/init.h>
28 #include <linux/kernel.h>
29 #include <linux/types.h>
30 #include <linux/errno.h>
31 #include <linux/acpi.h>
32 #include <acpi/acpi_bus.h>
33 #include <acpi/acmacros.h>
35 #define ACPI_NUMA 0x80000000
36 #define _COMPONENT ACPI_NUMA
37 ACPI_MODULE_NAME ("numa")
39 extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, unsigned int max_entries);
42 acpi_table_print_srat_entry (
43 acpi_table_entry_header *header)
46 ACPI_FUNCTION_NAME ("acpi_table_print_srat_entry");
51 switch (header->type) {
53 case ACPI_SRAT_PROCESSOR_AFFINITY:
55 struct acpi_table_processor_affinity *p =
56 (struct acpi_table_processor_affinity*) header;
57 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
58 p->apic_id, p->lsapic_eid, p->proximity_domain,
59 p->flags.enabled?"enabled":"disabled"));
63 case ACPI_SRAT_MEMORY_AFFINITY:
65 struct acpi_table_memory_affinity *p =
66 (struct acpi_table_memory_affinity*) header;
67 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
68 p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo,
69 p->memory_type, p->proximity_domain,
70 p->flags.enabled ? "enabled" : "disabled",
71 p->flags.hot_pluggable ? " hot-pluggable" : ""));
76 printk(KERN_WARNING PREFIX "Found unsupported SRAT entry (type = 0x%x)\n",
84 acpi_parse_slit (unsigned long phys_addr, unsigned long size)
86 struct acpi_table_slit *slit;
89 if (!phys_addr || !size)
92 slit = (struct acpi_table_slit *) __va(phys_addr);
94 /* downcast just for %llu vs %lu for i386/ia64 */
95 localities = (u32) slit->localities;
97 printk(KERN_INFO PREFIX "SLIT localities %ux%u\n", localities, localities);
99 acpi_numa_slit_init(slit);
106 acpi_parse_processor_affinity (acpi_table_entry_header *header)
108 struct acpi_table_processor_affinity *processor_affinity;
110 processor_affinity = (struct acpi_table_processor_affinity*) header;
111 if (!processor_affinity)
114 acpi_table_print_srat_entry(header);
116 /* let architecture-dependent part to do it */
117 acpi_numa_processor_affinity_init(processor_affinity);
124 acpi_parse_memory_affinity (acpi_table_entry_header *header)
126 struct acpi_table_memory_affinity *memory_affinity;
128 memory_affinity = (struct acpi_table_memory_affinity*) header;
129 if (!memory_affinity)
132 acpi_table_print_srat_entry(header);
134 /* let architecture-dependent part to do it */
135 acpi_numa_memory_affinity_init(memory_affinity);
142 acpi_parse_srat (unsigned long phys_addr, unsigned long size)
144 struct acpi_table_srat *srat;
146 if (!phys_addr || !size)
149 srat = (struct acpi_table_srat *) __va(phys_addr);
151 printk(KERN_INFO PREFIX "SRAT revision %d\n", srat->table_revision);
158 acpi_table_parse_srat (
159 enum acpi_srat_entry_id id,
160 acpi_madt_entry_handler handler,
161 unsigned int max_entries)
163 return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat),
164 id, handler, max_entries);
173 /* SRAT: Static Resource Affinity Table */
174 result = acpi_table_parse(ACPI_SRAT, acpi_parse_srat);
177 result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
178 acpi_parse_processor_affinity,
180 result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY,
181 acpi_parse_memory_affinity,
182 NR_NODE_MEMBLKS); // IA64 specific
185 printk("Warning: acpi_table_parse(ACPI_SRAT) returned %d!\n",result);
188 /* SLIT: System Locality Information Table */
189 result = acpi_table_parse(ACPI_SLIT, acpi_parse_slit);
192 printk("Warning: acpi_table_parse(ACPI_SLIT) returned %d!\n",result);
195 acpi_numa_arch_fixup();