aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/tables.c
diff options
context:
space:
mode:
authorLen Brown <len.brown@intel.com>2005-08-05 00:44:28 -0400
committerLen Brown <len.brown@intel.com>2005-08-05 00:45:14 -0400
commit4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch)
tree5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/tables.c
parentc65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff)
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/tables.c')
-rw-r--r--drivers/acpi/tables.c434
1 files changed, 223 insertions, 211 deletions
diff --git a/drivers/acpi/tables.c b/drivers/acpi/tables.c
index fb64bd5d2e18..a2bf25b05e1c 100644
--- a/drivers/acpi/tables.c
+++ b/drivers/acpi/tables.c
@@ -40,25 +40,25 @@
40#define ACPI_MAX_TABLES 256 40#define ACPI_MAX_TABLES 256
41 41
42static char *acpi_table_signatures[ACPI_TABLE_COUNT] = { 42static char *acpi_table_signatures[ACPI_TABLE_COUNT] = {
43 [ACPI_TABLE_UNKNOWN] = "????", 43 [ACPI_TABLE_UNKNOWN] = "????",
44 [ACPI_APIC] = "APIC", 44 [ACPI_APIC] = "APIC",
45 [ACPI_BOOT] = "BOOT", 45 [ACPI_BOOT] = "BOOT",
46 [ACPI_DBGP] = "DBGP", 46 [ACPI_DBGP] = "DBGP",
47 [ACPI_DSDT] = "DSDT", 47 [ACPI_DSDT] = "DSDT",
48 [ACPI_ECDT] = "ECDT", 48 [ACPI_ECDT] = "ECDT",
49 [ACPI_ETDT] = "ETDT", 49 [ACPI_ETDT] = "ETDT",
50 [ACPI_FADT] = "FACP", 50 [ACPI_FADT] = "FACP",
51 [ACPI_FACS] = "FACS", 51 [ACPI_FACS] = "FACS",
52 [ACPI_OEMX] = "OEM", 52 [ACPI_OEMX] = "OEM",
53 [ACPI_PSDT] = "PSDT", 53 [ACPI_PSDT] = "PSDT",
54 [ACPI_SBST] = "SBST", 54 [ACPI_SBST] = "SBST",
55 [ACPI_SLIT] = "SLIT", 55 [ACPI_SLIT] = "SLIT",
56 [ACPI_SPCR] = "SPCR", 56 [ACPI_SPCR] = "SPCR",
57 [ACPI_SRAT] = "SRAT", 57 [ACPI_SRAT] = "SRAT",
58 [ACPI_SSDT] = "SSDT", 58 [ACPI_SSDT] = "SSDT",
59 [ACPI_SPMI] = "SPMI", 59 [ACPI_SPMI] = "SPMI",
60 [ACPI_HPET] = "HPET", 60 [ACPI_HPET] = "HPET",
61 [ACPI_MCFG] = "MCFG", 61 [ACPI_MCFG] = "MCFG",
62}; 62};
63 63
64static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" }; 64static char *mps_inti_flags_polarity[] = { "dfl", "high", "res", "low" };
@@ -66,52 +66,44 @@ static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
66 66
67/* System Description Table (RSDT/XSDT) */ 67/* System Description Table (RSDT/XSDT) */
68struct acpi_table_sdt { 68struct acpi_table_sdt {
69 unsigned long pa; 69 unsigned long pa;
70 enum acpi_table_id id; 70 enum acpi_table_id id;
71 unsigned long size; 71 unsigned long size;
72} __attribute__ ((packed)); 72} __attribute__ ((packed));
73 73
74static unsigned long sdt_pa; /* Physical Address */ 74static unsigned long sdt_pa; /* Physical Address */
75static unsigned long sdt_count; /* Table count */ 75static unsigned long sdt_count; /* Table count */
76 76
77static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES]; 77static struct acpi_table_sdt sdt_entry[ACPI_MAX_TABLES];
78 78
79void 79void acpi_table_print(struct acpi_table_header *header, unsigned long phys_addr)
80acpi_table_print (
81 struct acpi_table_header *header,
82 unsigned long phys_addr)
83{ 80{
84 char *name = NULL; 81 char *name = NULL;
85 82
86 if (!header) 83 if (!header)
87 return; 84 return;
88 85
89 /* Some table signatures aren't good table names */ 86 /* Some table signatures aren't good table names */
90 87
91 if (!strncmp((char *) &header->signature, 88 if (!strncmp((char *)&header->signature,
92 acpi_table_signatures[ACPI_APIC], 89 acpi_table_signatures[ACPI_APIC],
93 sizeof(header->signature))) { 90 sizeof(header->signature))) {
94 name = "MADT"; 91 name = "MADT";
95 } 92 } else if (!strncmp((char *)&header->signature,
96 else if (!strncmp((char *) &header->signature, 93 acpi_table_signatures[ACPI_FADT],
97 acpi_table_signatures[ACPI_FADT], 94 sizeof(header->signature))) {
98 sizeof(header->signature))) {
99 name = "FADT"; 95 name = "FADT";
100 } 96 } else
101 else
102 name = header->signature; 97 name = header->signature;
103 98
104 printk(KERN_DEBUG PREFIX "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n", 99 printk(KERN_DEBUG PREFIX
105 name, header->revision, header->oem_id, 100 "%.4s (v%3.3d %6.6s %8.8s 0x%08x %.4s 0x%08x) @ 0x%p\n", name,
106 header->oem_table_id, header->oem_revision, 101 header->revision, header->oem_id, header->oem_table_id,
107 header->asl_compiler_id, header->asl_compiler_revision, 102 header->oem_revision, header->asl_compiler_id,
108 (void *) phys_addr); 103 header->asl_compiler_revision, (void *)phys_addr);
109} 104}
110 105
111 106void acpi_table_print_madt_entry(acpi_table_entry_header * header)
112void
113acpi_table_print_madt_entry (
114 acpi_table_entry_header *header)
115{ 107{
116 if (!header) 108 if (!header)
117 return; 109 return;
@@ -119,113 +111,127 @@ acpi_table_print_madt_entry (
119 switch (header->type) { 111 switch (header->type) {
120 112
121 case ACPI_MADT_LAPIC: 113 case ACPI_MADT_LAPIC:
122 { 114 {
123 struct acpi_table_lapic *p = 115 struct acpi_table_lapic *p =
124 (struct acpi_table_lapic*) header; 116 (struct acpi_table_lapic *)header;
125 printk(KERN_INFO PREFIX "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n", 117 printk(KERN_INFO PREFIX
126 p->acpi_id, p->id, p->flags.enabled?"enabled":"disabled"); 118 "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
127 } 119 p->acpi_id, p->id,
120 p->flags.enabled ? "enabled" : "disabled");
121 }
128 break; 122 break;
129 123
130 case ACPI_MADT_IOAPIC: 124 case ACPI_MADT_IOAPIC:
131 { 125 {
132 struct acpi_table_ioapic *p = 126 struct acpi_table_ioapic *p =
133 (struct acpi_table_ioapic*) header; 127 (struct acpi_table_ioapic *)header;
134 printk(KERN_INFO PREFIX "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n", 128 printk(KERN_INFO PREFIX
135 p->id, p->address, p->global_irq_base); 129 "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
136 } 130 p->id, p->address, p->global_irq_base);
131 }
137 break; 132 break;
138 133
139 case ACPI_MADT_INT_SRC_OVR: 134 case ACPI_MADT_INT_SRC_OVR:
140 { 135 {
141 struct acpi_table_int_src_ovr *p = 136 struct acpi_table_int_src_ovr *p =
142 (struct acpi_table_int_src_ovr*) header; 137 (struct acpi_table_int_src_ovr *)header;
143 printk(KERN_INFO PREFIX "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n", 138 printk(KERN_INFO PREFIX
144 p->bus, p->bus_irq, p->global_irq, 139 "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
145 mps_inti_flags_polarity[p->flags.polarity], 140 p->bus, p->bus_irq, p->global_irq,
146 mps_inti_flags_trigger[p->flags.trigger]); 141 mps_inti_flags_polarity[p->flags.polarity],
147 if(p->flags.reserved) 142 mps_inti_flags_trigger[p->flags.trigger]);
148 printk(KERN_INFO PREFIX "INT_SRC_OVR unexpected reserved flags: 0x%x\n", 143 if (p->flags.reserved)
149 p->flags.reserved); 144 printk(KERN_INFO PREFIX
145 "INT_SRC_OVR unexpected reserved flags: 0x%x\n",
146 p->flags.reserved);
150 147
151 } 148 }
152 break; 149 break;
153 150
154 case ACPI_MADT_NMI_SRC: 151 case ACPI_MADT_NMI_SRC:
155 { 152 {
156 struct acpi_table_nmi_src *p = 153 struct acpi_table_nmi_src *p =
157 (struct acpi_table_nmi_src*) header; 154 (struct acpi_table_nmi_src *)header;
158 printk(KERN_INFO PREFIX "NMI_SRC (%s %s global_irq %d)\n", 155 printk(KERN_INFO PREFIX
159 mps_inti_flags_polarity[p->flags.polarity], 156 "NMI_SRC (%s %s global_irq %d)\n",
160 mps_inti_flags_trigger[p->flags.trigger], p->global_irq); 157 mps_inti_flags_polarity[p->flags.polarity],
161 } 158 mps_inti_flags_trigger[p->flags.trigger],
159 p->global_irq);
160 }
162 break; 161 break;
163 162
164 case ACPI_MADT_LAPIC_NMI: 163 case ACPI_MADT_LAPIC_NMI:
165 { 164 {
166 struct acpi_table_lapic_nmi *p = 165 struct acpi_table_lapic_nmi *p =
167 (struct acpi_table_lapic_nmi*) header; 166 (struct acpi_table_lapic_nmi *)header;
168 printk(KERN_INFO PREFIX "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n", 167 printk(KERN_INFO PREFIX
169 p->acpi_id, 168 "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
170 mps_inti_flags_polarity[p->flags.polarity], 169 p->acpi_id,
171 mps_inti_flags_trigger[p->flags.trigger], p->lint); 170 mps_inti_flags_polarity[p->flags.polarity],
172 } 171 mps_inti_flags_trigger[p->flags.trigger],
172 p->lint);
173 }
173 break; 174 break;
174 175
175 case ACPI_MADT_LAPIC_ADDR_OVR: 176 case ACPI_MADT_LAPIC_ADDR_OVR:
176 { 177 {
177 struct acpi_table_lapic_addr_ovr *p = 178 struct acpi_table_lapic_addr_ovr *p =
178 (struct acpi_table_lapic_addr_ovr*) header; 179 (struct acpi_table_lapic_addr_ovr *)header;
179 printk(KERN_INFO PREFIX "LAPIC_ADDR_OVR (address[%p])\n", 180 printk(KERN_INFO PREFIX
180 (void *) (unsigned long) p->address); 181 "LAPIC_ADDR_OVR (address[%p])\n",
181 } 182 (void *)(unsigned long)p->address);
183 }
182 break; 184 break;
183 185
184 case ACPI_MADT_IOSAPIC: 186 case ACPI_MADT_IOSAPIC:
185 { 187 {
186 struct acpi_table_iosapic *p = 188 struct acpi_table_iosapic *p =
187 (struct acpi_table_iosapic*) header; 189 (struct acpi_table_iosapic *)header;
188 printk(KERN_INFO PREFIX "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n", 190 printk(KERN_INFO PREFIX
189 p->id, (void *) (unsigned long) p->address, p->global_irq_base); 191 "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
190 } 192 p->id, (void *)(unsigned long)p->address,
193 p->global_irq_base);
194 }
191 break; 195 break;
192 196
193 case ACPI_MADT_LSAPIC: 197 case ACPI_MADT_LSAPIC:
194 { 198 {
195 struct acpi_table_lsapic *p = 199 struct acpi_table_lsapic *p =
196 (struct acpi_table_lsapic*) header; 200 (struct acpi_table_lsapic *)header;
197 printk(KERN_INFO PREFIX "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n", 201 printk(KERN_INFO PREFIX
198 p->acpi_id, p->id, p->eid, p->flags.enabled?"enabled":"disabled"); 202 "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
199 } 203 p->acpi_id, p->id, p->eid,
204 p->flags.enabled ? "enabled" : "disabled");
205 }
200 break; 206 break;
201 207
202 case ACPI_MADT_PLAT_INT_SRC: 208 case ACPI_MADT_PLAT_INT_SRC:
203 { 209 {
204 struct acpi_table_plat_int_src *p = 210 struct acpi_table_plat_int_src *p =
205 (struct acpi_table_plat_int_src*) header; 211 (struct acpi_table_plat_int_src *)header;
206 printk(KERN_INFO PREFIX "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n", 212 printk(KERN_INFO PREFIX
207 mps_inti_flags_polarity[p->flags.polarity], 213 "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
208 mps_inti_flags_trigger[p->flags.trigger], 214 mps_inti_flags_polarity[p->flags.polarity],
209 p->type, p->id, p->eid, p->iosapic_vector, p->global_irq); 215 mps_inti_flags_trigger[p->flags.trigger],
210 } 216 p->type, p->id, p->eid, p->iosapic_vector,
217 p->global_irq);
218 }
211 break; 219 break;
212 220
213 default: 221 default:
214 printk(KERN_WARNING PREFIX "Found unsupported MADT entry (type = 0x%x)\n", 222 printk(KERN_WARNING PREFIX
215 header->type); 223 "Found unsupported MADT entry (type = 0x%x)\n",
224 header->type);
216 break; 225 break;
217 } 226 }
218} 227}
219 228
220
221static int 229static int
222acpi_table_compute_checksum ( 230acpi_table_compute_checksum(void *table_pointer, unsigned long length)
223 void *table_pointer,
224 unsigned long length)
225{ 231{
226 u8 *p = (u8 *) table_pointer; 232 u8 *p = (u8 *) table_pointer;
227 unsigned long remains = length; 233 unsigned long remains = length;
228 unsigned long sum = 0; 234 unsigned long sum = 0;
229 235
230 if (!p || !length) 236 if (!p || !length)
231 return -EINVAL; 237 return -EINVAL;
@@ -241,9 +247,8 @@ acpi_table_compute_checksum (
241 * for acpi_blacklisted(), acpi_table_get_sdt() 247 * for acpi_blacklisted(), acpi_table_get_sdt()
242 */ 248 */
243int __init 249int __init
244acpi_get_table_header_early ( 250acpi_get_table_header_early(enum acpi_table_id id,
245 enum acpi_table_id id, 251 struct acpi_table_header **header)
246 struct acpi_table_header **header)
247{ 252{
248 unsigned int i; 253 unsigned int i;
249 enum acpi_table_id temp_id; 254 enum acpi_table_id temp_id;
@@ -260,7 +265,7 @@ acpi_get_table_header_early (
260 if (sdt_entry[i].id != temp_id) 265 if (sdt_entry[i].id != temp_id)
261 continue; 266 continue;
262 *header = (void *) 267 *header = (void *)
263 __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size); 268 __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
264 if (!*header) { 269 if (!*header) {
265 printk(KERN_WARNING PREFIX "Unable to map %s\n", 270 printk(KERN_WARNING PREFIX "Unable to map %s\n",
266 acpi_table_signatures[temp_id]); 271 acpi_table_signatures[temp_id]);
@@ -277,14 +282,17 @@ acpi_get_table_header_early (
277 282
278 /* Map the DSDT header via the pointer in the FADT */ 283 /* Map the DSDT header via the pointer in the FADT */
279 if (id == ACPI_DSDT) { 284 if (id == ACPI_DSDT) {
280 struct fadt_descriptor_rev2 *fadt = (struct fadt_descriptor_rev2 *) *header; 285 struct fadt_descriptor_rev2 *fadt =
286 (struct fadt_descriptor_rev2 *)*header;
281 287
282 if (fadt->revision == 3 && fadt->Xdsdt) { 288 if (fadt->revision == 3 && fadt->Xdsdt) {
283 *header = (void *) __acpi_map_table(fadt->Xdsdt, 289 *header = (void *)__acpi_map_table(fadt->Xdsdt,
284 sizeof(struct acpi_table_header)); 290 sizeof(struct
291 acpi_table_header));
285 } else if (fadt->V1_dsdt) { 292 } else if (fadt->V1_dsdt) {
286 *header = (void *) __acpi_map_table(fadt->V1_dsdt, 293 *header = (void *)__acpi_map_table(fadt->V1_dsdt,
287 sizeof(struct acpi_table_header)); 294 sizeof(struct
295 acpi_table_header));
288 } else 296 } else
289 *header = NULL; 297 *header = NULL;
290 298
@@ -296,21 +304,19 @@ acpi_get_table_header_early (
296 304
297 return 0; 305 return 0;
298} 306}
299
300 307
301int __init 308int __init
302acpi_table_parse_madt_family ( 309acpi_table_parse_madt_family(enum acpi_table_id id,
303 enum acpi_table_id id, 310 unsigned long madt_size,
304 unsigned long madt_size, 311 int entry_id,
305 int entry_id, 312 acpi_madt_entry_handler handler,
306 acpi_madt_entry_handler handler, 313 unsigned int max_entries)
307 unsigned int max_entries)
308{ 314{
309 void *madt = NULL; 315 void *madt = NULL;
310 acpi_table_entry_header *entry; 316 acpi_table_entry_header *entry;
311 unsigned int count = 0; 317 unsigned int count = 0;
312 unsigned long madt_end; 318 unsigned long madt_end;
313 unsigned int i; 319 unsigned int i;
314 320
315 if (!handler) 321 if (!handler)
316 return -EINVAL; 322 return -EINVAL;
@@ -321,7 +327,7 @@ acpi_table_parse_madt_family (
321 if (sdt_entry[i].id != id) 327 if (sdt_entry[i].id != id)
322 continue; 328 continue;
323 madt = (void *) 329 madt = (void *)
324 __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size); 330 __acpi_map_table(sdt_entry[i].pa, sdt_entry[i].size);
325 if (!madt) { 331 if (!madt) {
326 printk(KERN_WARNING PREFIX "Unable to map %s\n", 332 printk(KERN_WARNING PREFIX "Unable to map %s\n",
327 acpi_table_signatures[id]); 333 acpi_table_signatures[id]);
@@ -336,21 +342,22 @@ acpi_table_parse_madt_family (
336 return -ENODEV; 342 return -ENODEV;
337 } 343 }
338 344
339 madt_end = (unsigned long) madt + sdt_entry[i].size; 345 madt_end = (unsigned long)madt + sdt_entry[i].size;
340 346
341 /* Parse all entries looking for a match. */ 347 /* Parse all entries looking for a match. */
342 348
343 entry = (acpi_table_entry_header *) 349 entry = (acpi_table_entry_header *)
344 ((unsigned long) madt + madt_size); 350 ((unsigned long)madt + madt_size);
345 351
346 while (((unsigned long) entry) + sizeof(acpi_table_entry_header) < madt_end) { 352 while (((unsigned long)entry) + sizeof(acpi_table_entry_header) <
347 if (entry->type == entry_id && 353 madt_end) {
348 (!max_entries || count++ < max_entries)) 354 if (entry->type == entry_id
355 && (!max_entries || count++ < max_entries))
349 if (handler(entry, madt_end)) 356 if (handler(entry, madt_end))
350 return -EINVAL; 357 return -EINVAL;
351 358
352 entry = (acpi_table_entry_header *) 359 entry = (acpi_table_entry_header *)
353 ((unsigned long) entry + entry->length); 360 ((unsigned long)entry + entry->length);
354 } 361 }
355 if (max_entries && count > max_entries) { 362 if (max_entries && count > max_entries) {
356 printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i entries of " 363 printk(KERN_WARNING PREFIX "[%s:0x%02x] ignored %i entries of "
@@ -361,25 +368,19 @@ acpi_table_parse_madt_family (
361 return count; 368 return count;
362} 369}
363 370
364
365int __init 371int __init
366acpi_table_parse_madt ( 372acpi_table_parse_madt(enum acpi_madt_entry_id id,
367 enum acpi_madt_entry_id id, 373 acpi_madt_entry_handler handler, unsigned int max_entries)
368 acpi_madt_entry_handler handler,
369 unsigned int max_entries)
370{ 374{
371 return acpi_table_parse_madt_family(ACPI_APIC, sizeof(struct acpi_table_madt), 375 return acpi_table_parse_madt_family(ACPI_APIC,
372 id, handler, max_entries); 376 sizeof(struct acpi_table_madt), id,
377 handler, max_entries);
373} 378}
374 379
375 380int __init acpi_table_parse(enum acpi_table_id id, acpi_table_handler handler)
376int __init
377acpi_table_parse (
378 enum acpi_table_id id,
379 acpi_table_handler handler)
380{ 381{
381 int count = 0; 382 int count = 0;
382 unsigned int i = 0; 383 unsigned int i = 0;
383 384
384 if (!handler) 385 if (!handler)
385 return -EINVAL; 386 return -EINVAL;
@@ -392,20 +393,18 @@ acpi_table_parse (
392 handler(sdt_entry[i].pa, sdt_entry[i].size); 393 handler(sdt_entry[i].pa, sdt_entry[i].size);
393 394
394 else 395 else
395 printk(KERN_WARNING PREFIX "%d duplicate %s table ignored.\n", 396 printk(KERN_WARNING PREFIX
396 count, acpi_table_signatures[id]); 397 "%d duplicate %s table ignored.\n", count,
398 acpi_table_signatures[id]);
397 } 399 }
398 400
399 return count; 401 return count;
400} 402}
401 403
402 404static int __init acpi_table_get_sdt(struct acpi_table_rsdp *rsdp)
403static int __init
404acpi_table_get_sdt (
405 struct acpi_table_rsdp *rsdp)
406{ 405{
407 struct acpi_table_header *header = NULL; 406 struct acpi_table_header *header = NULL;
408 unsigned int i, id = 0; 407 unsigned int i, id = 0;
409 408
410 if (!rsdp) 409 if (!rsdp)
411 return -EINVAL; 410 return -EINVAL;
@@ -413,24 +412,25 @@ acpi_table_get_sdt (
413 /* First check XSDT (but only on ACPI 2.0-compatible systems) */ 412 /* First check XSDT (but only on ACPI 2.0-compatible systems) */
414 413
415 if ((rsdp->revision >= 2) && 414 if ((rsdp->revision >= 2) &&
416 (((struct acpi20_table_rsdp*)rsdp)->xsdt_address)) { 415 (((struct acpi20_table_rsdp *)rsdp)->xsdt_address)) {
417 416
418 struct acpi_table_xsdt *mapped_xsdt = NULL; 417 struct acpi_table_xsdt *mapped_xsdt = NULL;
419 418
420 sdt_pa = ((struct acpi20_table_rsdp*)rsdp)->xsdt_address; 419 sdt_pa = ((struct acpi20_table_rsdp *)rsdp)->xsdt_address;
421 420
422 /* map in just the header */ 421 /* map in just the header */
423 header = (struct acpi_table_header *) 422 header = (struct acpi_table_header *)
424 __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header)); 423 __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
425 424
426 if (!header) { 425 if (!header) {
427 printk(KERN_WARNING PREFIX "Unable to map XSDT header\n"); 426 printk(KERN_WARNING PREFIX
427 "Unable to map XSDT header\n");
428 return -ENODEV; 428 return -ENODEV;
429 } 429 }
430 430
431 /* remap in the entire table before processing */ 431 /* remap in the entire table before processing */
432 mapped_xsdt = (struct acpi_table_xsdt *) 432 mapped_xsdt = (struct acpi_table_xsdt *)
433 __acpi_map_table(sdt_pa, header->length); 433 __acpi_map_table(sdt_pa, header->length);
434 if (!mapped_xsdt) { 434 if (!mapped_xsdt) {
435 printk(KERN_WARNING PREFIX "Unable to map XSDT\n"); 435 printk(KERN_WARNING PREFIX "Unable to map XSDT\n");
436 return -ENODEV; 436 return -ENODEV;
@@ -438,7 +438,8 @@ acpi_table_get_sdt (
438 header = &mapped_xsdt->header; 438 header = &mapped_xsdt->header;
439 439
440 if (strncmp(header->signature, "XSDT", 4)) { 440 if (strncmp(header->signature, "XSDT", 4)) {
441 printk(KERN_WARNING PREFIX "XSDT signature incorrect\n"); 441 printk(KERN_WARNING PREFIX
442 "XSDT signature incorrect\n");
442 return -ENODEV; 443 return -ENODEV;
443 } 444 }
444 445
@@ -447,36 +448,39 @@ acpi_table_get_sdt (
447 return -ENODEV; 448 return -ENODEV;
448 } 449 }
449 450
450 sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 3; 451 sdt_count =
452 (header->length - sizeof(struct acpi_table_header)) >> 3;
451 if (sdt_count > ACPI_MAX_TABLES) { 453 if (sdt_count > ACPI_MAX_TABLES) {
452 printk(KERN_WARNING PREFIX "Truncated %lu XSDT entries\n", 454 printk(KERN_WARNING PREFIX
453 (sdt_count - ACPI_MAX_TABLES)); 455 "Truncated %lu XSDT entries\n",
456 (sdt_count - ACPI_MAX_TABLES));
454 sdt_count = ACPI_MAX_TABLES; 457 sdt_count = ACPI_MAX_TABLES;
455 } 458 }
456 459
457 for (i = 0; i < sdt_count; i++) 460 for (i = 0; i < sdt_count; i++)
458 sdt_entry[i].pa = (unsigned long) mapped_xsdt->entry[i]; 461 sdt_entry[i].pa = (unsigned long)mapped_xsdt->entry[i];
459 } 462 }
460 463
461 /* Then check RSDT */ 464 /* Then check RSDT */
462 465
463 else if (rsdp->rsdt_address) { 466 else if (rsdp->rsdt_address) {
464 467
465 struct acpi_table_rsdt *mapped_rsdt = NULL; 468 struct acpi_table_rsdt *mapped_rsdt = NULL;
466 469
467 sdt_pa = rsdp->rsdt_address; 470 sdt_pa = rsdp->rsdt_address;
468 471
469 /* map in just the header */ 472 /* map in just the header */
470 header = (struct acpi_table_header *) 473 header = (struct acpi_table_header *)
471 __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header)); 474 __acpi_map_table(sdt_pa, sizeof(struct acpi_table_header));
472 if (!header) { 475 if (!header) {
473 printk(KERN_WARNING PREFIX "Unable to map RSDT header\n"); 476 printk(KERN_WARNING PREFIX
477 "Unable to map RSDT header\n");
474 return -ENODEV; 478 return -ENODEV;
475 } 479 }
476 480
477 /* remap in the entire table before processing */ 481 /* remap in the entire table before processing */
478 mapped_rsdt = (struct acpi_table_rsdt *) 482 mapped_rsdt = (struct acpi_table_rsdt *)
479 __acpi_map_table(sdt_pa, header->length); 483 __acpi_map_table(sdt_pa, header->length);
480 if (!mapped_rsdt) { 484 if (!mapped_rsdt) {
481 printk(KERN_WARNING PREFIX "Unable to map RSDT\n"); 485 printk(KERN_WARNING PREFIX "Unable to map RSDT\n");
482 return -ENODEV; 486 return -ENODEV;
@@ -484,7 +488,8 @@ acpi_table_get_sdt (
484 header = &mapped_rsdt->header; 488 header = &mapped_rsdt->header;
485 489
486 if (strncmp(header->signature, "RSDT", 4)) { 490 if (strncmp(header->signature, "RSDT", 4)) {
487 printk(KERN_WARNING PREFIX "RSDT signature incorrect\n"); 491 printk(KERN_WARNING PREFIX
492 "RSDT signature incorrect\n");
488 return -ENODEV; 493 return -ENODEV;
489 } 494 }
490 495
@@ -493,19 +498,22 @@ acpi_table_get_sdt (
493 return -ENODEV; 498 return -ENODEV;
494 } 499 }
495 500
496 sdt_count = (header->length - sizeof(struct acpi_table_header)) >> 2; 501 sdt_count =
502 (header->length - sizeof(struct acpi_table_header)) >> 2;
497 if (sdt_count > ACPI_MAX_TABLES) { 503 if (sdt_count > ACPI_MAX_TABLES) {
498 printk(KERN_WARNING PREFIX "Truncated %lu RSDT entries\n", 504 printk(KERN_WARNING PREFIX
499 (sdt_count - ACPI_MAX_TABLES)); 505 "Truncated %lu RSDT entries\n",
506 (sdt_count - ACPI_MAX_TABLES));
500 sdt_count = ACPI_MAX_TABLES; 507 sdt_count = ACPI_MAX_TABLES;
501 } 508 }
502 509
503 for (i = 0; i < sdt_count; i++) 510 for (i = 0; i < sdt_count; i++)
504 sdt_entry[i].pa = (unsigned long) mapped_rsdt->entry[i]; 511 sdt_entry[i].pa = (unsigned long)mapped_rsdt->entry[i];
505 } 512 }
506 513
507 else { 514 else {
508 printk(KERN_WARNING PREFIX "No System Description Table (RSDT/XSDT) specified in RSDP\n"); 515 printk(KERN_WARNING PREFIX
516 "No System Description Table (RSDT/XSDT) specified in RSDP\n");
509 return -ENODEV; 517 return -ENODEV;
510 } 518 }
511 519
@@ -515,18 +523,17 @@ acpi_table_get_sdt (
515 523
516 /* map in just the header */ 524 /* map in just the header */
517 header = (struct acpi_table_header *) 525 header = (struct acpi_table_header *)
518 __acpi_map_table(sdt_entry[i].pa, 526 __acpi_map_table(sdt_entry[i].pa,
519 sizeof(struct acpi_table_header)); 527 sizeof(struct acpi_table_header));
520 if (!header) 528 if (!header)
521 continue; 529 continue;
522 530
523 /* remap in the entire table before processing */ 531 /* remap in the entire table before processing */
524 header = (struct acpi_table_header *) 532 header = (struct acpi_table_header *)
525 __acpi_map_table(sdt_entry[i].pa, 533 __acpi_map_table(sdt_entry[i].pa, header->length);
526 header->length);
527 if (!header) 534 if (!header)
528 continue; 535 continue;
529 536
530 acpi_table_print(header, sdt_entry[i].pa); 537 acpi_table_print(header, sdt_entry[i].pa);
531 538
532 if (acpi_table_compute_checksum(header, header->length)) { 539 if (acpi_table_compute_checksum(header, header->length)) {
@@ -537,9 +544,9 @@ acpi_table_get_sdt (
537 sdt_entry[i].size = header->length; 544 sdt_entry[i].size = header->length;
538 545
539 for (id = 0; id < ACPI_TABLE_COUNT; id++) { 546 for (id = 0; id < ACPI_TABLE_COUNT; id++) {
540 if (!strncmp((char *) &header->signature, 547 if (!strncmp((char *)&header->signature,
541 acpi_table_signatures[id], 548 acpi_table_signatures[id],
542 sizeof(header->signature))) { 549 sizeof(header->signature))) {
543 sdt_entry[i].id = id; 550 sdt_entry[i].id = id;
544 } 551 }
545 } 552 }
@@ -551,7 +558,7 @@ acpi_table_get_sdt (
551 * against. Unfortunately, we don't know the phys_addr, so just 558 * against. Unfortunately, we don't know the phys_addr, so just
552 * print 0. Maybe no one will notice. 559 * print 0. Maybe no one will notice.
553 */ 560 */
554 if(!acpi_get_table_header_early(ACPI_DSDT, &header)) 561 if (!acpi_get_table_header_early(ACPI_DSDT, &header))
555 acpi_table_print(header, 0); 562 acpi_table_print(header, 0);
556 563
557 return 0; 564 return 0;
@@ -566,12 +573,11 @@ acpi_table_get_sdt (
566 * result: sdt_entry[] is initialized 573 * result: sdt_entry[] is initialized
567 */ 574 */
568 575
569int __init 576int __init acpi_table_init(void)
570acpi_table_init (void)
571{ 577{
572 struct acpi_table_rsdp *rsdp = NULL; 578 struct acpi_table_rsdp *rsdp = NULL;
573 unsigned long rsdp_phys = 0; 579 unsigned long rsdp_phys = 0;
574 int result = 0; 580 int result = 0;
575 581
576 /* Locate and map the Root System Description Table (RSDP) */ 582 /* Locate and map the Root System Description Table (RSDP) */
577 583
@@ -581,19 +587,25 @@ acpi_table_init (void)
581 return -ENODEV; 587 return -ENODEV;
582 } 588 }
583 589
584 rsdp = (struct acpi_table_rsdp *) __va(rsdp_phys); 590 rsdp = (struct acpi_table_rsdp *)__va(rsdp_phys);
585 if (!rsdp) { 591 if (!rsdp) {
586 printk(KERN_WARNING PREFIX "Unable to map RSDP\n"); 592 printk(KERN_WARNING PREFIX "Unable to map RSDP\n");
587 return -ENODEV; 593 return -ENODEV;
588 } 594 }
589 595
590 printk(KERN_DEBUG PREFIX "RSDP (v%3.3d %6.6s ) @ 0x%p\n", 596 printk(KERN_DEBUG PREFIX
591 rsdp->revision, rsdp->oem_id, (void *) rsdp_phys); 597 "RSDP (v%3.3d %6.6s ) @ 0x%p\n",
598 rsdp->revision, rsdp->oem_id, (void *)rsdp_phys);
592 599
593 if (rsdp->revision < 2) 600 if (rsdp->revision < 2)
594 result = acpi_table_compute_checksum(rsdp, sizeof(struct acpi_table_rsdp)); 601 result =
602 acpi_table_compute_checksum(rsdp,
603 sizeof(struct acpi_table_rsdp));
595 else 604 else
596 result = acpi_table_compute_checksum(rsdp, ((struct acpi20_table_rsdp *)rsdp)->length); 605 result =
606 acpi_table_compute_checksum(rsdp,
607 ((struct acpi20_table_rsdp *)
608 rsdp)->length);
597 609
598 if (result) { 610 if (result) {
599 printk(KERN_WARNING " >>> ERROR: Invalid checksum\n"); 611 printk(KERN_WARNING " >>> ERROR: Invalid checksum\n");