aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/numa.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/numa.c')
-rw-r--r--drivers/acpi/numa.c125
1 files changed, 61 insertions, 64 deletions
diff --git a/drivers/acpi/numa.c b/drivers/acpi/numa.c
index a82834b32752..64b98e82feb7 100644
--- a/drivers/acpi/numa.c
+++ b/drivers/acpi/numa.c
@@ -34,16 +34,18 @@
34 34
35#define ACPI_NUMA 0x80000000 35#define ACPI_NUMA 0x80000000
36#define _COMPONENT ACPI_NUMA 36#define _COMPONENT ACPI_NUMA
37 ACPI_MODULE_NAME ("numa") 37ACPI_MODULE_NAME("numa")
38 38
39extern 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); 39extern int __init acpi_table_parse_madt_family(enum acpi_table_id id,
40 unsigned long madt_size,
41 int entry_id,
42 acpi_madt_entry_handler handler,
43 unsigned int max_entries);
40 44
41void __init 45void __init acpi_table_print_srat_entry(acpi_table_entry_header * header)
42acpi_table_print_srat_entry (
43 acpi_table_entry_header *header)
44{ 46{
45 47
46 ACPI_FUNCTION_NAME ("acpi_table_print_srat_entry"); 48 ACPI_FUNCTION_NAME("acpi_table_print_srat_entry");
47 49
48 if (!header) 50 if (!header)
49 return; 51 return;
@@ -52,48 +54,55 @@ acpi_table_print_srat_entry (
52 54
53 case ACPI_SRAT_PROCESSOR_AFFINITY: 55 case ACPI_SRAT_PROCESSOR_AFFINITY:
54#ifdef ACPI_DEBUG_OUTPUT 56#ifdef ACPI_DEBUG_OUTPUT
55 { 57 {
56 struct acpi_table_processor_affinity *p = 58 struct acpi_table_processor_affinity *p =
57 (struct acpi_table_processor_affinity*) header; 59 (struct acpi_table_processor_affinity *)header;
58 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n", 60 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
59 p->apic_id, p->lsapic_eid, p->proximity_domain, 61 "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n",
60 p->flags.enabled?"enabled":"disabled")); 62 p->apic_id, p->lsapic_eid,
61 } 63 p->proximity_domain,
62#endif /* ACPI_DEBUG_OUTPUT */ 64 p->flags.
65 enabled ? "enabled" : "disabled"));
66 }
67#endif /* ACPI_DEBUG_OUTPUT */
63 break; 68 break;
64 69
65 case ACPI_SRAT_MEMORY_AFFINITY: 70 case ACPI_SRAT_MEMORY_AFFINITY:
66#ifdef ACPI_DEBUG_OUTPUT 71#ifdef ACPI_DEBUG_OUTPUT
67 { 72 {
68 struct acpi_table_memory_affinity *p = 73 struct acpi_table_memory_affinity *p =
69 (struct acpi_table_memory_affinity*) header; 74 (struct acpi_table_memory_affinity *)header;
70 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", 75 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
71 p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo, 76 "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n",
72 p->memory_type, p->proximity_domain, 77 p->base_addr_hi, p->base_addr_lo,
73 p->flags.enabled ? "enabled" : "disabled", 78 p->length_hi, p->length_lo,
74 p->flags.hot_pluggable ? " hot-pluggable" : "")); 79 p->memory_type, p->proximity_domain,
75 } 80 p->flags.
76#endif /* ACPI_DEBUG_OUTPUT */ 81 enabled ? "enabled" : "disabled",
82 p->flags.
83 hot_pluggable ? " hot-pluggable" :
84 ""));
85 }
86#endif /* ACPI_DEBUG_OUTPUT */
77 break; 87 break;
78 88
79 default: 89 default:
80 printk(KERN_WARNING PREFIX "Found unsupported SRAT entry (type = 0x%x)\n", 90 printk(KERN_WARNING PREFIX
81 header->type); 91 "Found unsupported SRAT entry (type = 0x%x)\n",
92 header->type);
82 break; 93 break;
83 } 94 }
84} 95}
85 96
86 97static int __init acpi_parse_slit(unsigned long phys_addr, unsigned long size)
87static int __init
88acpi_parse_slit (unsigned long phys_addr, unsigned long size)
89{ 98{
90 struct acpi_table_slit *slit; 99 struct acpi_table_slit *slit;
91 u32 localities; 100 u32 localities;
92 101
93 if (!phys_addr || !size) 102 if (!phys_addr || !size)
94 return -EINVAL; 103 return -EINVAL;
95 104
96 slit = (struct acpi_table_slit *) __va(phys_addr); 105 slit = (struct acpi_table_slit *)__va(phys_addr);
97 106
98 /* downcast just for %llu vs %lu for i386/ia64 */ 107 /* downcast just for %llu vs %lu for i386/ia64 */
99 localities = (u32) slit->localities; 108 localities = (u32) slit->localities;
@@ -103,15 +112,13 @@ acpi_parse_slit (unsigned long phys_addr, unsigned long size)
103 return 0; 112 return 0;
104} 113}
105 114
106
107static int __init 115static int __init
108acpi_parse_processor_affinity ( 116acpi_parse_processor_affinity(acpi_table_entry_header * header,
109 acpi_table_entry_header *header, 117 const unsigned long end)
110 const unsigned long end)
111{ 118{
112 struct acpi_table_processor_affinity *processor_affinity; 119 struct acpi_table_processor_affinity *processor_affinity;
113 120
114 processor_affinity = (struct acpi_table_processor_affinity*) header; 121 processor_affinity = (struct acpi_table_processor_affinity *)header;
115 if (!processor_affinity) 122 if (!processor_affinity)
116 return -EINVAL; 123 return -EINVAL;
117 124
@@ -123,15 +130,13 @@ acpi_parse_processor_affinity (
123 return 0; 130 return 0;
124} 131}
125 132
126
127static int __init 133static int __init
128acpi_parse_memory_affinity ( 134acpi_parse_memory_affinity(acpi_table_entry_header * header,
129 acpi_table_entry_header *header, 135 const unsigned long end)
130 const unsigned long end)
131{ 136{
132 struct acpi_table_memory_affinity *memory_affinity; 137 struct acpi_table_memory_affinity *memory_affinity;
133 138
134 memory_affinity = (struct acpi_table_memory_affinity*) header; 139 memory_affinity = (struct acpi_table_memory_affinity *)header;
135 if (!memory_affinity) 140 if (!memory_affinity)
136 return -EINVAL; 141 return -EINVAL;
137 142
@@ -143,36 +148,30 @@ acpi_parse_memory_affinity (
143 return 0; 148 return 0;
144} 149}
145 150
146 151static int __init acpi_parse_srat(unsigned long phys_addr, unsigned long size)
147static int __init
148acpi_parse_srat (unsigned long phys_addr, unsigned long size)
149{ 152{
150 struct acpi_table_srat *srat; 153 struct acpi_table_srat *srat;
151 154
152 if (!phys_addr || !size) 155 if (!phys_addr || !size)
153 return -EINVAL; 156 return -EINVAL;
154 157
155 srat = (struct acpi_table_srat *) __va(phys_addr); 158 srat = (struct acpi_table_srat *)__va(phys_addr);
156 159
157 return 0; 160 return 0;
158} 161}
159 162
160
161int __init 163int __init
162acpi_table_parse_srat ( 164acpi_table_parse_srat(enum acpi_srat_entry_id id,
163 enum acpi_srat_entry_id id, 165 acpi_madt_entry_handler handler, unsigned int max_entries)
164 acpi_madt_entry_handler handler,
165 unsigned int max_entries)
166{ 166{
167 return acpi_table_parse_madt_family(ACPI_SRAT, sizeof(struct acpi_table_srat), 167 return acpi_table_parse_madt_family(ACPI_SRAT,
168 id, handler, max_entries); 168 sizeof(struct acpi_table_srat), id,
169 handler, max_entries);
169} 170}
170 171
171 172int __init acpi_numa_init(void)
172int __init
173acpi_numa_init(void)
174{ 173{
175 int result; 174 int result;
176 175
177 /* SRAT: Static Resource Affinity Table */ 176 /* SRAT: Static Resource Affinity Table */
178 result = acpi_table_parse(ACPI_SRAT, acpi_parse_srat); 177 result = acpi_table_parse(ACPI_SRAT, acpi_parse_srat);
@@ -181,9 +180,7 @@ acpi_numa_init(void)
181 result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY, 180 result = acpi_table_parse_srat(ACPI_SRAT_PROCESSOR_AFFINITY,
182 acpi_parse_processor_affinity, 181 acpi_parse_processor_affinity,
183 NR_CPUS); 182 NR_CPUS);
184 result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, 183 result = acpi_table_parse_srat(ACPI_SRAT_MEMORY_AFFINITY, acpi_parse_memory_affinity, NR_NODE_MEMBLKS); // IA64 specific
185 acpi_parse_memory_affinity,
186 NR_NODE_MEMBLKS); // IA64 specific
187 } 184 }
188 185
189 /* SLIT: System Locality Information Table */ 186 /* SLIT: System Locality Information Table */
@@ -193,8 +190,7 @@ acpi_numa_init(void)
193 return 0; 190 return 0;
194} 191}
195 192
196int 193int acpi_get_pxm(acpi_handle h)
197acpi_get_pxm(acpi_handle h)
198{ 194{
199 unsigned long pxm; 195 unsigned long pxm;
200 acpi_status status; 196 acpi_status status;
@@ -207,7 +203,8 @@ acpi_get_pxm(acpi_handle h)
207 if (ACPI_SUCCESS(status)) 203 if (ACPI_SUCCESS(status))
208 return (int)pxm; 204 return (int)pxm;
209 status = acpi_get_parent(handle, &phandle); 205 status = acpi_get_parent(handle, &phandle);
210 } while(ACPI_SUCCESS(status)); 206 } while (ACPI_SUCCESS(status));
211 return -1; 207 return -1;
212} 208}
209
213EXPORT_SYMBOL(acpi_get_pxm); 210EXPORT_SYMBOL(acpi_get_pxm);