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