Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /****************************************************************************** |
2 | * | |
3 | * Module Name: tbxfroot - Find the root ACPI table (RSDT) | |
4 | * | |
5 | *****************************************************************************/ | |
6 | ||
7 | /* | |
8 | * Copyright (C) 2000 - 2005, R. Byron Moore | |
9 | * All rights reserved. | |
10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | |
15 | * notice, this list of conditions, and the following disclaimer, | |
16 | * without modification. | |
17 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | |
18 | * substantially similar to the "NO WARRANTY" disclaimer below | |
19 | * ("Disclaimer") and any redistribution must be conditioned upon | |
20 | * including a substantially similar Disclaimer requirement for further | |
21 | * binary redistribution. | |
22 | * 3. Neither the names of the above-listed copyright holders nor the names | |
23 | * of any contributors may be used to endorse or promote products derived | |
24 | * from this software without specific prior written permission. | |
25 | * | |
26 | * Alternatively, this software may be distributed under the terms of the | |
27 | * GNU General Public License ("GPL") version 2 as published by the Free | |
28 | * Software Foundation. | |
29 | * | |
30 | * NO WARRANTY | |
31 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | |
32 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | |
33 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR | |
34 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | |
35 | * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
36 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
37 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
38 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
39 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
40 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
41 | * POSSIBILITY OF SUCH DAMAGES. | |
42 | */ | |
43 | ||
44 | #include <linux/module.h> | |
45 | ||
46 | #include <acpi/acpi.h> | |
47 | #include <acpi/actables.h> | |
48 | ||
49 | ||
50 | #define _COMPONENT ACPI_TABLES | |
51 | ACPI_MODULE_NAME ("tbxfroot") | |
52 | ||
44f6c012 RM |
53 | /* Local prototypes */ |
54 | ||
55 | static acpi_status | |
56 | acpi_tb_find_rsdp ( | |
57 | struct acpi_table_desc *table_info, | |
58 | u32 flags); | |
59 | ||
60 | static u8 * | |
61 | acpi_tb_scan_memory_for_rsdp ( | |
62 | u8 *start_address, | |
63 | u32 length); | |
64 | ||
1da177e4 LT |
65 | |
66 | /******************************************************************************* | |
67 | * | |
68 | * FUNCTION: acpi_tb_find_table | |
69 | * | |
70 | * PARAMETERS: Signature - String with ACPI table signature | |
71 | * oem_id - String with the table OEM ID | |
44f6c012 RM |
72 | * oem_table_id - String with the OEM Table ID |
73 | * table_ptr - Where the table pointer is returned | |
1da177e4 LT |
74 | * |
75 | * RETURN: Status | |
76 | * | |
77 | * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the | |
78 | * Signature, OEM ID and OEM Table ID. | |
79 | * | |
80 | ******************************************************************************/ | |
81 | ||
82 | acpi_status | |
83 | acpi_tb_find_table ( | |
84 | char *signature, | |
85 | char *oem_id, | |
86 | char *oem_table_id, | |
87 | struct acpi_table_header **table_ptr) | |
88 | { | |
89 | acpi_status status; | |
90 | struct acpi_table_header *table; | |
91 | ||
92 | ||
93 | ACPI_FUNCTION_TRACE ("tb_find_table"); | |
94 | ||
95 | ||
96 | /* Validate string lengths */ | |
97 | ||
98 | if ((ACPI_STRLEN (signature) > ACPI_NAME_SIZE) || | |
99 | (ACPI_STRLEN (oem_id) > sizeof (table->oem_id)) || | |
100 | (ACPI_STRLEN (oem_table_id) > sizeof (table->oem_table_id))) { | |
101 | return_ACPI_STATUS (AE_AML_STRING_LIMIT); | |
102 | } | |
103 | ||
104 | if (!ACPI_STRNCMP (signature, DSDT_SIG, ACPI_NAME_SIZE)) { | |
105 | /* | |
106 | * The DSDT pointer is contained in the FADT, not the RSDT. | |
107 | * This code should suffice, because the only code that would perform | |
108 | * a "find" on the DSDT is the data_table_region() AML opcode -- in | |
109 | * which case, the DSDT is guaranteed to be already loaded. | |
110 | * If this becomes insufficient, the FADT will have to be found first. | |
111 | */ | |
112 | if (!acpi_gbl_DSDT) { | |
113 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | |
114 | } | |
1da177e4 LT |
115 | table = acpi_gbl_DSDT; |
116 | } | |
117 | else { | |
118 | /* Find the table */ | |
119 | ||
120 | status = acpi_get_firmware_table (signature, 1, | |
44f6c012 | 121 | ACPI_LOGICAL_ADDRESSING, &table); |
1da177e4 LT |
122 | if (ACPI_FAILURE (status)) { |
123 | return_ACPI_STATUS (status); | |
124 | } | |
125 | } | |
126 | ||
127 | /* Check oem_id and oem_table_id */ | |
128 | ||
44f6c012 RM |
129 | if ((oem_id[0] && ACPI_STRNCMP ( |
130 | oem_id, table->oem_id, | |
131 | sizeof (table->oem_id))) || | |
132 | ||
1da177e4 | 133 | (oem_table_id[0] && ACPI_STRNCMP ( |
44f6c012 RM |
134 | oem_table_id, table->oem_table_id, |
135 | sizeof (table->oem_table_id)))) { | |
1da177e4 LT |
136 | return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND); |
137 | } | |
138 | ||
44f6c012 RM |
139 | ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", |
140 | table->signature)); | |
141 | ||
1da177e4 LT |
142 | *table_ptr = table; |
143 | return_ACPI_STATUS (AE_OK); | |
144 | } | |
145 | ||
146 | ||
147 | /******************************************************************************* | |
148 | * | |
149 | * FUNCTION: acpi_get_firmware_table | |
150 | * | |
151 | * PARAMETERS: Signature - Any ACPI table signature | |
152 | * Instance - the non zero instance of the table, allows | |
153 | * support for multiple tables of the same type | |
154 | * Flags - Physical/Virtual support | |
155 | * table_pointer - Where a buffer containing the table is | |
156 | * returned | |
157 | * | |
158 | * RETURN: Status | |
159 | * | |
160 | * DESCRIPTION: This function is called to get an ACPI table. A buffer is | |
161 | * allocated for the table and returned in table_pointer. | |
162 | * This table will be a complete table including the header. | |
163 | * | |
164 | ******************************************************************************/ | |
165 | ||
166 | acpi_status | |
167 | acpi_get_firmware_table ( | |
168 | acpi_string signature, | |
169 | u32 instance, | |
170 | u32 flags, | |
171 | struct acpi_table_header **table_pointer) | |
172 | { | |
173 | acpi_status status; | |
174 | struct acpi_pointer address; | |
175 | struct acpi_table_header *header = NULL; | |
176 | struct acpi_table_desc *table_info = NULL; | |
177 | struct acpi_table_desc *rsdt_info; | |
178 | u32 table_count; | |
179 | u32 i; | |
180 | u32 j; | |
181 | ||
182 | ||
183 | ACPI_FUNCTION_TRACE ("acpi_get_firmware_table"); | |
184 | ||
185 | ||
186 | /* | |
187 | * Ensure that at least the table manager is initialized. We don't | |
188 | * require that the entire ACPI subsystem is up for this interface. | |
189 | * If we have a buffer, we must have a length too | |
190 | */ | |
191 | if ((instance == 0) || | |
192 | (!signature) || | |
193 | (!table_pointer)) { | |
194 | return_ACPI_STATUS (AE_BAD_PARAMETER); | |
195 | } | |
196 | ||
197 | /* Ensure that we have a RSDP */ | |
198 | ||
199 | if (!acpi_gbl_RSDP) { | |
200 | /* Get the RSDP */ | |
201 | ||
202 | status = acpi_os_get_root_pointer (flags, &address); | |
203 | if (ACPI_FAILURE (status)) { | |
204 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n")); | |
205 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); | |
206 | } | |
207 | ||
208 | /* Map and validate the RSDP */ | |
209 | ||
210 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | |
44f6c012 RM |
211 | status = acpi_os_map_memory (address.pointer.physical, |
212 | sizeof (struct rsdp_descriptor), (void *) &acpi_gbl_RSDP); | |
1da177e4 LT |
213 | if (ACPI_FAILURE (status)) { |
214 | return_ACPI_STATUS (status); | |
215 | } | |
216 | } | |
217 | else { | |
218 | acpi_gbl_RSDP = address.pointer.logical; | |
219 | } | |
220 | ||
221 | /* The signature and checksum must both be correct */ | |
222 | ||
44f6c012 RM |
223 | if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG, |
224 | sizeof (RSDP_SIG)-1) != 0) { | |
1da177e4 LT |
225 | /* Nope, BAD Signature */ |
226 | ||
227 | return_ACPI_STATUS (AE_BAD_SIGNATURE); | |
228 | } | |
229 | ||
230 | if (acpi_tb_checksum (acpi_gbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0) { | |
231 | /* Nope, BAD Checksum */ | |
232 | ||
233 | return_ACPI_STATUS (AE_BAD_CHECKSUM); | |
234 | } | |
235 | } | |
236 | ||
237 | /* Get the RSDT address via the RSDP */ | |
238 | ||
239 | acpi_tb_get_rsdt_address (&address); | |
240 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | |
241 | "RSDP located at %p, RSDT physical=%8.8X%8.8X \n", | |
242 | acpi_gbl_RSDP, | |
243 | ACPI_FORMAT_UINT64 (address.pointer.value))); | |
244 | ||
245 | /* Insert processor_mode flags */ | |
246 | ||
247 | address.pointer_type |= flags; | |
248 | ||
249 | /* Get and validate the RSDT */ | |
250 | ||
251 | rsdt_info = ACPI_MEM_CALLOCATE (sizeof (struct acpi_table_desc)); | |
252 | if (!rsdt_info) { | |
253 | return_ACPI_STATUS (AE_NO_MEMORY); | |
254 | } | |
255 | ||
256 | status = acpi_tb_get_table (&address, rsdt_info); | |
257 | if (ACPI_FAILURE (status)) { | |
258 | goto cleanup; | |
259 | } | |
260 | ||
261 | status = acpi_tb_validate_rsdt (rsdt_info->pointer); | |
262 | if (ACPI_FAILURE (status)) { | |
263 | goto cleanup; | |
264 | } | |
265 | ||
266 | /* Allocate a scratch table header and table descriptor */ | |
267 | ||
268 | header = ACPI_MEM_ALLOCATE (sizeof (struct acpi_table_header)); | |
269 | if (!header) { | |
270 | status = AE_NO_MEMORY; | |
271 | goto cleanup; | |
272 | } | |
273 | ||
274 | table_info = ACPI_MEM_ALLOCATE (sizeof (struct acpi_table_desc)); | |
275 | if (!table_info) { | |
276 | status = AE_NO_MEMORY; | |
277 | goto cleanup; | |
278 | } | |
279 | ||
280 | /* Get the number of table pointers within the RSDT */ | |
281 | ||
282 | table_count = acpi_tb_get_table_count (acpi_gbl_RSDP, rsdt_info->pointer); | |
283 | address.pointer_type = acpi_gbl_table_flags | flags; | |
284 | ||
285 | /* | |
286 | * Search the RSDT/XSDT for the correct instance of the | |
287 | * requested table | |
288 | */ | |
289 | for (i = 0, j = 0; i < table_count; i++) { | |
73459f73 RM |
290 | /* |
291 | * Get the next table pointer, handle RSDT vs. XSDT | |
292 | * RSDT pointers are 32 bits, XSDT pointers are 64 bits | |
293 | */ | |
294 | if (acpi_gbl_root_table_type == ACPI_TABLE_TYPE_RSDT) { | |
1da177e4 LT |
295 | address.pointer.value = (ACPI_CAST_PTR ( |
296 | RSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i]; | |
297 | } | |
298 | else { | |
299 | address.pointer.value = (ACPI_CAST_PTR ( | |
300 | XSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i]; | |
301 | } | |
302 | ||
303 | /* Get the table header */ | |
304 | ||
305 | status = acpi_tb_get_table_header (&address, header); | |
306 | if (ACPI_FAILURE (status)) { | |
307 | goto cleanup; | |
308 | } | |
309 | ||
310 | /* Compare table signatures and table instance */ | |
311 | ||
312 | if (!ACPI_STRNCMP (header->signature, signature, ACPI_NAME_SIZE)) { | |
313 | /* An instance of the table was found */ | |
314 | ||
315 | j++; | |
316 | if (j >= instance) { | |
317 | /* Found the correct instance, get the entire table */ | |
318 | ||
319 | status = acpi_tb_get_table_body (&address, header, table_info); | |
320 | if (ACPI_FAILURE (status)) { | |
321 | goto cleanup; | |
322 | } | |
323 | ||
324 | *table_pointer = table_info->pointer; | |
325 | goto cleanup; | |
326 | } | |
327 | } | |
328 | } | |
329 | ||
330 | /* Did not find the table */ | |
331 | ||
332 | status = AE_NOT_EXIST; | |
333 | ||
334 | ||
335 | cleanup: | |
88ac00f5 RM |
336 | if (rsdt_info->pointer) { |
337 | acpi_os_unmap_memory (rsdt_info->pointer, | |
338 | (acpi_size) rsdt_info->pointer->length); | |
339 | } | |
1da177e4 LT |
340 | ACPI_MEM_FREE (rsdt_info); |
341 | ||
342 | if (header) { | |
343 | ACPI_MEM_FREE (header); | |
344 | } | |
345 | if (table_info) { | |
346 | ACPI_MEM_FREE (table_info); | |
347 | } | |
348 | return_ACPI_STATUS (status); | |
349 | } | |
350 | EXPORT_SYMBOL(acpi_get_firmware_table); | |
351 | ||
352 | ||
353 | /* TBD: Move to a new file */ | |
354 | ||
355 | #if ACPI_MACHINE_WIDTH != 16 | |
356 | ||
357 | /******************************************************************************* | |
358 | * | |
359 | * FUNCTION: acpi_find_root_pointer | |
360 | * | |
44f6c012 RM |
361 | * PARAMETERS: Flags - Logical/Physical addressing |
362 | * rsdp_address - Where to place the RSDP address | |
1da177e4 LT |
363 | * |
364 | * RETURN: Status, Physical address of the RSDP | |
365 | * | |
366 | * DESCRIPTION: Find the RSDP | |
367 | * | |
368 | ******************************************************************************/ | |
369 | ||
370 | acpi_status | |
371 | acpi_find_root_pointer ( | |
372 | u32 flags, | |
373 | struct acpi_pointer *rsdp_address) | |
374 | { | |
375 | struct acpi_table_desc table_info; | |
376 | acpi_status status; | |
377 | ||
378 | ||
379 | ACPI_FUNCTION_TRACE ("acpi_find_root_pointer"); | |
380 | ||
381 | ||
382 | /* Get the RSDP */ | |
383 | ||
384 | status = acpi_tb_find_rsdp (&table_info, flags); | |
385 | if (ACPI_FAILURE (status)) { | |
386 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | |
387 | "RSDP structure not found, %s Flags=%X\n", | |
388 | acpi_format_exception (status), flags)); | |
44f6c012 | 389 | |
1da177e4 LT |
390 | return_ACPI_STATUS (AE_NO_ACPI_TABLES); |
391 | } | |
392 | ||
393 | rsdp_address->pointer_type = ACPI_PHYSICAL_POINTER; | |
394 | rsdp_address->pointer.physical = table_info.physical_address; | |
395 | return_ACPI_STATUS (AE_OK); | |
396 | } | |
397 | ||
398 | ||
399 | /******************************************************************************* | |
400 | * | |
401 | * FUNCTION: acpi_tb_scan_memory_for_rsdp | |
402 | * | |
403 | * PARAMETERS: start_address - Starting pointer for search | |
404 | * Length - Maximum length to search | |
405 | * | |
406 | * RETURN: Pointer to the RSDP if found, otherwise NULL. | |
407 | * | |
408 | * DESCRIPTION: Search a block of memory for the RSDP signature | |
409 | * | |
410 | ******************************************************************************/ | |
411 | ||
44f6c012 | 412 | static u8 * |
1da177e4 LT |
413 | acpi_tb_scan_memory_for_rsdp ( |
414 | u8 *start_address, | |
415 | u32 length) | |
416 | { | |
417 | u8 *mem_rover; | |
418 | u8 *end_address; | |
419 | u8 checksum; | |
420 | ||
421 | ||
422 | ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp"); | |
423 | ||
424 | ||
425 | end_address = start_address + length; | |
426 | ||
427 | /* Search from given start address for the requested length */ | |
428 | ||
429 | for (mem_rover = start_address; mem_rover < end_address; | |
430 | mem_rover += ACPI_RSDP_SCAN_STEP) { | |
431 | /* The signature and checksum must both be correct */ | |
432 | ||
44f6c012 RM |
433 | if (ACPI_STRNCMP ((char *) mem_rover, |
434 | RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) { | |
1da177e4 LT |
435 | /* No signature match, keep looking */ |
436 | ||
437 | continue; | |
438 | } | |
439 | ||
440 | /* Signature matches, check the appropriate checksum */ | |
441 | ||
442 | if ((ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover))->revision < 2) { | |
443 | /* ACPI version 1.0 */ | |
444 | ||
445 | checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH); | |
446 | } | |
447 | else { | |
448 | /* Post ACPI 1.0, use extended_checksum */ | |
449 | ||
450 | checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_XCHECKSUM_LENGTH); | |
451 | } | |
452 | ||
453 | if (checksum == 0) { | |
454 | /* Checksum valid, we have found a valid RSDP */ | |
455 | ||
456 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | |
457 | "RSDP located at physical address %p\n", mem_rover)); | |
458 | return_PTR (mem_rover); | |
459 | } | |
460 | ||
461 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | |
462 | "Found an RSDP at physical address %p, but it has a bad checksum\n", | |
463 | mem_rover)); | |
464 | } | |
465 | ||
466 | /* Searched entire block, no RSDP was found */ | |
467 | ||
468 | ACPI_DEBUG_PRINT ((ACPI_DB_INFO, | |
469 | "Searched entire block, no valid RSDP was found.\n")); | |
470 | return_PTR (NULL); | |
471 | } | |
472 | ||
473 | ||
474 | /******************************************************************************* | |
475 | * | |
476 | * FUNCTION: acpi_tb_find_rsdp | |
477 | * | |
44f6c012 | 478 | * PARAMETERS: table_info - Where the table info is returned |
1da177e4 LT |
479 | * Flags - Current memory mode (logical vs. |
480 | * physical addressing) | |
481 | * | |
482 | * RETURN: Status, RSDP physical address | |
483 | * | |
484 | * DESCRIPTION: search lower 1_mbyte of memory for the root system descriptor | |
485 | * pointer structure. If it is found, set *RSDP to point to it. | |
486 | * | |
487 | * NOTE1: The RSDp must be either in the first 1_k of the Extended | |
488 | * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.) | |
489 | * Only a 32-bit physical address is necessary. | |
490 | * | |
491 | * NOTE2: This function is always available, regardless of the | |
492 | * initialization state of the rest of ACPI. | |
493 | * | |
494 | ******************************************************************************/ | |
495 | ||
44f6c012 | 496 | static acpi_status |
1da177e4 LT |
497 | acpi_tb_find_rsdp ( |
498 | struct acpi_table_desc *table_info, | |
499 | u32 flags) | |
500 | { | |
501 | u8 *table_ptr; | |
502 | u8 *mem_rover; | |
503 | u32 physical_address; | |
504 | acpi_status status; | |
505 | ||
506 | ||
507 | ACPI_FUNCTION_TRACE ("tb_find_rsdp"); | |
508 | ||
509 | ||
510 | /* | |
44f6c012 | 511 | * Scan supports either logical addressing or physical addressing |
1da177e4 LT |
512 | */ |
513 | if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) { | |
44f6c012 RM |
514 | /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */ |
515 | ||
516 | status = acpi_os_map_memory ( | |
517 | (acpi_physical_address) ACPI_EBDA_PTR_LOCATION, | |
518 | ACPI_EBDA_PTR_LENGTH, (void *) &table_ptr); | |
1da177e4 LT |
519 | if (ACPI_FAILURE (status)) { |
520 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | |
521 | "Could not map memory at %8.8X for length %X\n", | |
522 | ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH)); | |
44f6c012 | 523 | |
1da177e4 LT |
524 | return_ACPI_STATUS (status); |
525 | } | |
526 | ||
527 | ACPI_MOVE_16_TO_32 (&physical_address, table_ptr); | |
44f6c012 RM |
528 | |
529 | /* Convert segment part to physical address */ | |
530 | ||
531 | physical_address <<= 4; | |
1da177e4 LT |
532 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH); |
533 | ||
534 | /* EBDA present? */ | |
535 | ||
536 | if (physical_address > 0x400) { | |
537 | /* | |
44f6c012 RM |
538 | * 1b) Search EBDA paragraphs (EBDa is required to be a |
539 | * minimum of 1_k length) | |
1da177e4 | 540 | */ |
44f6c012 RM |
541 | status = acpi_os_map_memory ( |
542 | (acpi_physical_address) physical_address, | |
543 | ACPI_EBDA_WINDOW_SIZE, (void *) &table_ptr); | |
1da177e4 LT |
544 | if (ACPI_FAILURE (status)) { |
545 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | |
546 | "Could not map memory at %8.8X for length %X\n", | |
547 | physical_address, ACPI_EBDA_WINDOW_SIZE)); | |
44f6c012 | 548 | |
1da177e4 LT |
549 | return_ACPI_STATUS (status); |
550 | } | |
551 | ||
44f6c012 RM |
552 | mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, |
553 | ACPI_EBDA_WINDOW_SIZE); | |
1da177e4 LT |
554 | acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE); |
555 | ||
556 | if (mem_rover) { | |
557 | /* Found it, return the physical address */ | |
558 | ||
559 | physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr); | |
560 | ||
44f6c012 RM |
561 | table_info->physical_address = |
562 | (acpi_physical_address) physical_address; | |
1da177e4 LT |
563 | return_ACPI_STATUS (AE_OK); |
564 | } | |
565 | } | |
566 | ||
567 | /* | |
568 | * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh | |
569 | */ | |
44f6c012 RM |
570 | status = acpi_os_map_memory ( |
571 | (acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE, | |
572 | ACPI_HI_RSDP_WINDOW_SIZE, (void *) &table_ptr); | |
573 | ||
1da177e4 LT |
574 | if (ACPI_FAILURE (status)) { |
575 | ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, | |
576 | "Could not map memory at %8.8X for length %X\n", | |
577 | ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE)); | |
44f6c012 | 578 | |
1da177e4 LT |
579 | return_ACPI_STATUS (status); |
580 | } | |
581 | ||
582 | mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); | |
583 | acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE); | |
584 | ||
585 | if (mem_rover) { | |
586 | /* Found it, return the physical address */ | |
587 | ||
44f6c012 RM |
588 | physical_address = |
589 | ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr); | |
1da177e4 | 590 | |
44f6c012 RM |
591 | table_info->physical_address = |
592 | (acpi_physical_address) physical_address; | |
1da177e4 LT |
593 | return_ACPI_STATUS (AE_OK); |
594 | } | |
595 | } | |
596 | ||
597 | /* | |
598 | * Physical addressing | |
599 | */ | |
600 | else { | |
44f6c012 RM |
601 | /* 1a) Get the location of the EBDA */ |
602 | ||
1da177e4 LT |
603 | ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION); |
604 | physical_address <<= 4; /* Convert segment to physical address */ | |
605 | ||
606 | /* EBDA present? */ | |
607 | ||
608 | if (physical_address > 0x400) { | |
609 | /* | |
44f6c012 RM |
610 | * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of |
611 | * 1_k length) | |
1da177e4 | 612 | */ |
44f6c012 RM |
613 | mem_rover = acpi_tb_scan_memory_for_rsdp ( |
614 | ACPI_PHYSADDR_TO_PTR (physical_address), | |
1da177e4 LT |
615 | ACPI_EBDA_WINDOW_SIZE); |
616 | if (mem_rover) { | |
617 | /* Found it, return the physical address */ | |
618 | ||
619 | table_info->physical_address = ACPI_TO_INTEGER (mem_rover); | |
620 | return_ACPI_STATUS (AE_OK); | |
621 | } | |
622 | } | |
623 | ||
44f6c012 RM |
624 | /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */ |
625 | ||
626 | mem_rover = acpi_tb_scan_memory_for_rsdp ( | |
627 | ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE), | |
1da177e4 LT |
628 | ACPI_HI_RSDP_WINDOW_SIZE); |
629 | if (mem_rover) { | |
630 | /* Found it, return the physical address */ | |
631 | ||
632 | table_info->physical_address = ACPI_TO_INTEGER (mem_rover); | |
633 | return_ACPI_STATUS (AE_OK); | |
634 | } | |
635 | } | |
636 | ||
637 | /* RSDP signature was not found */ | |
638 | ||
639 | return_ACPI_STATUS (AE_NOT_FOUND); | |
640 | } | |
641 | ||
642 | #endif | |
643 |