blob: dc3c3f6a9f621d5c93cf39bfa39ae6c4ee101399 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/******************************************************************************
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
Robert Moore44f6c012005-04-18 22:49:35 -040053/* Local prototypes */
54
55static acpi_status
56acpi_tb_find_rsdp (
57 struct acpi_table_desc *table_info,
58 u32 flags);
59
60static u8 *
61acpi_tb_scan_memory_for_rsdp (
62 u8 *start_address,
63 u32 length);
64
Linus Torvalds1da177e2005-04-16 15:20:36 -070065
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
Robert Moore44f6c012005-04-18 22:49:35 -040072 * oem_table_id - String with the OEM Table ID
73 * table_ptr - Where the table pointer is returned
Linus Torvalds1da177e2005-04-16 15:20:36 -070074 *
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
82acpi_status
83acpi_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 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700115 table = acpi_gbl_DSDT;
116 }
117 else {
118 /* Find the table */
119
120 status = acpi_get_firmware_table (signature, 1,
Robert Moore44f6c012005-04-18 22:49:35 -0400121 ACPI_LOGICAL_ADDRESSING, &table);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700122 if (ACPI_FAILURE (status)) {
123 return_ACPI_STATUS (status);
124 }
125 }
126
127 /* Check oem_id and oem_table_id */
128
Robert Moore44f6c012005-04-18 22:49:35 -0400129 if ((oem_id[0] && ACPI_STRNCMP (
130 oem_id, table->oem_id,
131 sizeof (table->oem_id))) ||
132
Linus Torvalds1da177e2005-04-16 15:20:36 -0700133 (oem_table_id[0] && ACPI_STRNCMP (
Robert Moore44f6c012005-04-18 22:49:35 -0400134 oem_table_id, table->oem_table_id,
135 sizeof (table->oem_table_id)))) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700136 return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
137 }
138
Robert Moore44f6c012005-04-18 22:49:35 -0400139 ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n",
140 table->signature));
141
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142 *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
166acpi_status
167acpi_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) {
Robert Moore44f6c012005-04-18 22:49:35 -0400211 status = acpi_os_map_memory (address.pointer.physical,
212 sizeof (struct rsdp_descriptor), (void *) &acpi_gbl_RSDP);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700213 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
Robert Moore44f6c012005-04-18 22:49:35 -0400223 if (ACPI_STRNCMP ((char *) acpi_gbl_RSDP, RSDP_SIG,
224 sizeof (RSDP_SIG)-1) != 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700225 /* 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++) {
290 /* Get the next table pointer, handle RSDT vs. XSDT */
291
292 if (acpi_gbl_RSDP->revision < 2) {
293 address.pointer.value = (ACPI_CAST_PTR (
294 RSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i];
295 }
296 else {
297 address.pointer.value = (ACPI_CAST_PTR (
298 XSDT_DESCRIPTOR, rsdt_info->pointer))->table_offset_entry[i];
299 }
300
301 /* Get the table header */
302
303 status = acpi_tb_get_table_header (&address, header);
304 if (ACPI_FAILURE (status)) {
305 goto cleanup;
306 }
307
308 /* Compare table signatures and table instance */
309
310 if (!ACPI_STRNCMP (header->signature, signature, ACPI_NAME_SIZE)) {
311 /* An instance of the table was found */
312
313 j++;
314 if (j >= instance) {
315 /* Found the correct instance, get the entire table */
316
317 status = acpi_tb_get_table_body (&address, header, table_info);
318 if (ACPI_FAILURE (status)) {
319 goto cleanup;
320 }
321
322 *table_pointer = table_info->pointer;
323 goto cleanup;
324 }
325 }
326 }
327
328 /* Did not find the table */
329
330 status = AE_NOT_EXIST;
331
332
333cleanup:
Robert Moore44f6c012005-04-18 22:49:35 -0400334 acpi_os_unmap_memory (rsdt_info->pointer,
335 (acpi_size) rsdt_info->pointer->length);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700336 ACPI_MEM_FREE (rsdt_info);
337
338 if (header) {
339 ACPI_MEM_FREE (header);
340 }
341 if (table_info) {
342 ACPI_MEM_FREE (table_info);
343 }
344 return_ACPI_STATUS (status);
345}
346EXPORT_SYMBOL(acpi_get_firmware_table);
347
348
349/* TBD: Move to a new file */
350
351#if ACPI_MACHINE_WIDTH != 16
352
353/*******************************************************************************
354 *
355 * FUNCTION: acpi_find_root_pointer
356 *
Robert Moore44f6c012005-04-18 22:49:35 -0400357 * PARAMETERS: Flags - Logical/Physical addressing
358 * rsdp_address - Where to place the RSDP address
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359 *
360 * RETURN: Status, Physical address of the RSDP
361 *
362 * DESCRIPTION: Find the RSDP
363 *
364 ******************************************************************************/
365
366acpi_status
367acpi_find_root_pointer (
368 u32 flags,
369 struct acpi_pointer *rsdp_address)
370{
371 struct acpi_table_desc table_info;
372 acpi_status status;
373
374
375 ACPI_FUNCTION_TRACE ("acpi_find_root_pointer");
376
377
378 /* Get the RSDP */
379
380 status = acpi_tb_find_rsdp (&table_info, flags);
381 if (ACPI_FAILURE (status)) {
382 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
383 "RSDP structure not found, %s Flags=%X\n",
384 acpi_format_exception (status), flags));
Robert Moore44f6c012005-04-18 22:49:35 -0400385
Linus Torvalds1da177e2005-04-16 15:20:36 -0700386 return_ACPI_STATUS (AE_NO_ACPI_TABLES);
387 }
388
389 rsdp_address->pointer_type = ACPI_PHYSICAL_POINTER;
390 rsdp_address->pointer.physical = table_info.physical_address;
391 return_ACPI_STATUS (AE_OK);
392}
393
394
395/*******************************************************************************
396 *
397 * FUNCTION: acpi_tb_scan_memory_for_rsdp
398 *
399 * PARAMETERS: start_address - Starting pointer for search
400 * Length - Maximum length to search
401 *
402 * RETURN: Pointer to the RSDP if found, otherwise NULL.
403 *
404 * DESCRIPTION: Search a block of memory for the RSDP signature
405 *
406 ******************************************************************************/
407
Robert Moore44f6c012005-04-18 22:49:35 -0400408static u8 *
Linus Torvalds1da177e2005-04-16 15:20:36 -0700409acpi_tb_scan_memory_for_rsdp (
410 u8 *start_address,
411 u32 length)
412{
413 u8 *mem_rover;
414 u8 *end_address;
415 u8 checksum;
416
417
418 ACPI_FUNCTION_TRACE ("tb_scan_memory_for_rsdp");
419
420
421 end_address = start_address + length;
422
423 /* Search from given start address for the requested length */
424
425 for (mem_rover = start_address; mem_rover < end_address;
426 mem_rover += ACPI_RSDP_SCAN_STEP) {
427 /* The signature and checksum must both be correct */
428
Robert Moore44f6c012005-04-18 22:49:35 -0400429 if (ACPI_STRNCMP ((char *) mem_rover,
430 RSDP_SIG, sizeof (RSDP_SIG) - 1) != 0) {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700431 /* No signature match, keep looking */
432
433 continue;
434 }
435
436 /* Signature matches, check the appropriate checksum */
437
438 if ((ACPI_CAST_PTR (struct rsdp_descriptor, mem_rover))->revision < 2) {
439 /* ACPI version 1.0 */
440
441 checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_CHECKSUM_LENGTH);
442 }
443 else {
444 /* Post ACPI 1.0, use extended_checksum */
445
446 checksum = acpi_tb_checksum (mem_rover, ACPI_RSDP_XCHECKSUM_LENGTH);
447 }
448
449 if (checksum == 0) {
450 /* Checksum valid, we have found a valid RSDP */
451
452 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
453 "RSDP located at physical address %p\n", mem_rover));
454 return_PTR (mem_rover);
455 }
456
457 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
458 "Found an RSDP at physical address %p, but it has a bad checksum\n",
459 mem_rover));
460 }
461
462 /* Searched entire block, no RSDP was found */
463
464 ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
465 "Searched entire block, no valid RSDP was found.\n"));
466 return_PTR (NULL);
467}
468
469
470/*******************************************************************************
471 *
472 * FUNCTION: acpi_tb_find_rsdp
473 *
Robert Moore44f6c012005-04-18 22:49:35 -0400474 * PARAMETERS: table_info - Where the table info is returned
Linus Torvalds1da177e2005-04-16 15:20:36 -0700475 * Flags - Current memory mode (logical vs.
476 * physical addressing)
477 *
478 * RETURN: Status, RSDP physical address
479 *
480 * DESCRIPTION: search lower 1_mbyte of memory for the root system descriptor
481 * pointer structure. If it is found, set *RSDP to point to it.
482 *
483 * NOTE1: The RSDp must be either in the first 1_k of the Extended
484 * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
485 * Only a 32-bit physical address is necessary.
486 *
487 * NOTE2: This function is always available, regardless of the
488 * initialization state of the rest of ACPI.
489 *
490 ******************************************************************************/
491
Robert Moore44f6c012005-04-18 22:49:35 -0400492static acpi_status
Linus Torvalds1da177e2005-04-16 15:20:36 -0700493acpi_tb_find_rsdp (
494 struct acpi_table_desc *table_info,
495 u32 flags)
496{
497 u8 *table_ptr;
498 u8 *mem_rover;
499 u32 physical_address;
500 acpi_status status;
501
502
503 ACPI_FUNCTION_TRACE ("tb_find_rsdp");
504
505
506 /*
Robert Moore44f6c012005-04-18 22:49:35 -0400507 * Scan supports either logical addressing or physical addressing
Linus Torvalds1da177e2005-04-16 15:20:36 -0700508 */
509 if ((flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING) {
Robert Moore44f6c012005-04-18 22:49:35 -0400510 /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
511
512 status = acpi_os_map_memory (
513 (acpi_physical_address) ACPI_EBDA_PTR_LOCATION,
514 ACPI_EBDA_PTR_LENGTH, (void *) &table_ptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700515 if (ACPI_FAILURE (status)) {
516 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
517 "Could not map memory at %8.8X for length %X\n",
518 ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
Robert Moore44f6c012005-04-18 22:49:35 -0400519
Linus Torvalds1da177e2005-04-16 15:20:36 -0700520 return_ACPI_STATUS (status);
521 }
522
523 ACPI_MOVE_16_TO_32 (&physical_address, table_ptr);
Robert Moore44f6c012005-04-18 22:49:35 -0400524
525 /* Convert segment part to physical address */
526
527 physical_address <<= 4;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700528 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_PTR_LENGTH);
529
530 /* EBDA present? */
531
532 if (physical_address > 0x400) {
533 /*
Robert Moore44f6c012005-04-18 22:49:35 -0400534 * 1b) Search EBDA paragraphs (EBDa is required to be a
535 * minimum of 1_k length)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700536 */
Robert Moore44f6c012005-04-18 22:49:35 -0400537 status = acpi_os_map_memory (
538 (acpi_physical_address) physical_address,
539 ACPI_EBDA_WINDOW_SIZE, (void *) &table_ptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700540 if (ACPI_FAILURE (status)) {
541 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
542 "Could not map memory at %8.8X for length %X\n",
543 physical_address, ACPI_EBDA_WINDOW_SIZE));
Robert Moore44f6c012005-04-18 22:49:35 -0400544
Linus Torvalds1da177e2005-04-16 15:20:36 -0700545 return_ACPI_STATUS (status);
546 }
547
Robert Moore44f6c012005-04-18 22:49:35 -0400548 mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr,
549 ACPI_EBDA_WINDOW_SIZE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700550 acpi_os_unmap_memory (table_ptr, ACPI_EBDA_WINDOW_SIZE);
551
552 if (mem_rover) {
553 /* Found it, return the physical address */
554
555 physical_address += ACPI_PTR_DIFF (mem_rover, table_ptr);
556
Robert Moore44f6c012005-04-18 22:49:35 -0400557 table_info->physical_address =
558 (acpi_physical_address) physical_address;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700559 return_ACPI_STATUS (AE_OK);
560 }
561 }
562
563 /*
564 * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
565 */
Robert Moore44f6c012005-04-18 22:49:35 -0400566 status = acpi_os_map_memory (
567 (acpi_physical_address) ACPI_HI_RSDP_WINDOW_BASE,
568 ACPI_HI_RSDP_WINDOW_SIZE, (void *) &table_ptr);
569
Linus Torvalds1da177e2005-04-16 15:20:36 -0700570 if (ACPI_FAILURE (status)) {
571 ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
572 "Could not map memory at %8.8X for length %X\n",
573 ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
Robert Moore44f6c012005-04-18 22:49:35 -0400574
Linus Torvalds1da177e2005-04-16 15:20:36 -0700575 return_ACPI_STATUS (status);
576 }
577
578 mem_rover = acpi_tb_scan_memory_for_rsdp (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
579 acpi_os_unmap_memory (table_ptr, ACPI_HI_RSDP_WINDOW_SIZE);
580
581 if (mem_rover) {
582 /* Found it, return the physical address */
583
Robert Moore44f6c012005-04-18 22:49:35 -0400584 physical_address =
585 ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (mem_rover, table_ptr);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700586
Robert Moore44f6c012005-04-18 22:49:35 -0400587 table_info->physical_address =
588 (acpi_physical_address) physical_address;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700589 return_ACPI_STATUS (AE_OK);
590 }
591 }
592
593 /*
594 * Physical addressing
595 */
596 else {
Robert Moore44f6c012005-04-18 22:49:35 -0400597 /* 1a) Get the location of the EBDA */
598
Linus Torvalds1da177e2005-04-16 15:20:36 -0700599 ACPI_MOVE_16_TO_32 (&physical_address, ACPI_EBDA_PTR_LOCATION);
600 physical_address <<= 4; /* Convert segment to physical address */
601
602 /* EBDA present? */
603
604 if (physical_address > 0x400) {
605 /*
Robert Moore44f6c012005-04-18 22:49:35 -0400606 * 1b) Search EBDA paragraphs (EBDa is required to be a minimum of
607 * 1_k length)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700608 */
Robert Moore44f6c012005-04-18 22:49:35 -0400609 mem_rover = acpi_tb_scan_memory_for_rsdp (
610 ACPI_PHYSADDR_TO_PTR (physical_address),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700611 ACPI_EBDA_WINDOW_SIZE);
612 if (mem_rover) {
613 /* Found it, return the physical address */
614
615 table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
616 return_ACPI_STATUS (AE_OK);
617 }
618 }
619
Robert Moore44f6c012005-04-18 22:49:35 -0400620 /* 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh */
621
622 mem_rover = acpi_tb_scan_memory_for_rsdp (
623 ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
Linus Torvalds1da177e2005-04-16 15:20:36 -0700624 ACPI_HI_RSDP_WINDOW_SIZE);
625 if (mem_rover) {
626 /* Found it, return the physical address */
627
628 table_info->physical_address = ACPI_TO_INTEGER (mem_rover);
629 return_ACPI_STATUS (AE_OK);
630 }
631 }
632
633 /* RSDP signature was not found */
634
635 return_ACPI_STATUS (AE_NOT_FOUND);
636}
637
638#endif
639