Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 3 | * Module Name: tbutils - table utilities |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | #include <acpi/acpi.h> |
| 45 | #include <acpi/actables.h> |
| 46 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 47 | #define _COMPONENT ACPI_TABLES |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 48 | ACPI_MODULE_NAME("tbutils") |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 50 | /* Local prototypes */ |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 51 | static void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags); |
| 52 | |
| 53 | static void acpi_tb_convert_fadt(void); |
| 54 | |
| 55 | static void |
| 56 | acpi_tb_install_table(acpi_physical_address address, |
| 57 | u8 flags, char *signature, acpi_native_uint table_index); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 58 | |
| 59 | static void inline |
| 60 | acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 61 | u8 bit_width, u64 address); |
| 62 | |
Bob Moore | a4bbb810 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 63 | static acpi_physical_address |
| 64 | acpi_tb_get_root_table_entry(u8 * table_entry, |
| 65 | acpi_native_uint table_entry_size); |
| 66 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 67 | /* Table used for conversion of FADT to common format */ |
| 68 | |
| 69 | typedef struct acpi_fadt_conversion { |
| 70 | u8 target; |
| 71 | u8 source; |
| 72 | u8 length; |
| 73 | |
| 74 | } acpi_fadt_conversion; |
| 75 | |
| 76 | static struct acpi_fadt_conversion fadt_conversion_table[] = { |
| 77 | {ACPI_FADT_OFFSET(xpm1a_event_block), |
| 78 | ACPI_FADT_OFFSET(pm1a_event_block), |
| 79 | ACPI_FADT_OFFSET(pm1_event_length)}, |
| 80 | {ACPI_FADT_OFFSET(xpm1b_event_block), |
| 81 | ACPI_FADT_OFFSET(pm1b_event_block), |
| 82 | ACPI_FADT_OFFSET(pm1_event_length)}, |
| 83 | {ACPI_FADT_OFFSET(xpm1a_control_block), |
| 84 | ACPI_FADT_OFFSET(pm1a_control_block), |
| 85 | ACPI_FADT_OFFSET(pm1_control_length)}, |
| 86 | {ACPI_FADT_OFFSET(xpm1b_control_block), |
| 87 | ACPI_FADT_OFFSET(pm1b_control_block), |
| 88 | ACPI_FADT_OFFSET(pm1_control_length)}, |
| 89 | {ACPI_FADT_OFFSET(xpm2_control_block), |
| 90 | ACPI_FADT_OFFSET(pm2_control_block), |
| 91 | ACPI_FADT_OFFSET(pm2_control_length)}, |
| 92 | {ACPI_FADT_OFFSET(xpm_timer_block), ACPI_FADT_OFFSET(pm_timer_block), |
| 93 | ACPI_FADT_OFFSET(pm_timer_length)}, |
| 94 | {ACPI_FADT_OFFSET(xgpe0_block), ACPI_FADT_OFFSET(gpe0_block), |
| 95 | ACPI_FADT_OFFSET(gpe0_block_length)}, |
| 96 | {ACPI_FADT_OFFSET(xgpe1_block), ACPI_FADT_OFFSET(gpe1_block), |
| 97 | ACPI_FADT_OFFSET(gpe1_block_length)} |
| 98 | }; |
| 99 | |
| 100 | #define ACPI_FADT_CONVERSION_ENTRIES (sizeof (fadt_conversion_table) / sizeof (struct acpi_fadt_conversion)) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 101 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 102 | /******************************************************************************* |
| 103 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 104 | * FUNCTION: acpi_tb_print_table_header |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 105 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 106 | * PARAMETERS: Address - Table physical address |
| 107 | * Header - Table header |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 108 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 109 | * RETURN: None |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 110 | * |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 111 | * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP. |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 112 | * |
| 113 | ******************************************************************************/ |
| 114 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 115 | void |
| 116 | acpi_tb_print_table_header(acpi_physical_address address, |
| 117 | struct acpi_table_header *header) |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 118 | { |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 119 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 120 | if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_FACS)) { |
| 121 | |
| 122 | /* FACS only has signature and length fields of common table header */ |
| 123 | |
| 124 | ACPI_INFO((AE_INFO, "%4.4s @ 0x%p/0x%04X", |
| 125 | header->signature, ACPI_CAST_PTR(void, address), |
| 126 | header->length)); |
| 127 | } else if (ACPI_COMPARE_NAME(header->signature, ACPI_SIG_RSDP)) { |
| 128 | |
| 129 | /* RSDP has no common fields */ |
| 130 | |
| 131 | ACPI_INFO((AE_INFO, "RSDP @ 0x%p/0x%04X (v%3.3d %6.6s)", |
| 132 | ACPI_CAST_PTR(void, address), |
Bob Moore | a4bbb810 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 133 | (ACPI_CAST_PTR(struct acpi_table_rsdp, header)-> |
| 134 | revision > |
| 135 | 0) ? ACPI_CAST_PTR(struct acpi_table_rsdp, |
| 136 | header)->length : 20, |
| 137 | ACPI_CAST_PTR(struct acpi_table_rsdp, |
| 138 | header)->revision, |
| 139 | ACPI_CAST_PTR(struct acpi_table_rsdp, |
| 140 | header)->oem_id)); |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 141 | } else { |
Bob Moore | 4bf2739 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 142 | /* Standard ACPI table with full common header */ |
| 143 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 144 | ACPI_INFO((AE_INFO, |
| 145 | "%4.4s @ 0x%p/0x%04X (v%3.3d %6.6s %8.8s 0x%08X %4.4s 0x%08X)", |
| 146 | header->signature, ACPI_CAST_PTR(void, address), |
| 147 | header->length, header->revision, header->oem_id, |
| 148 | header->oem_table_id, header->oem_revision, |
| 149 | header->asl_compiler_id, |
| 150 | header->asl_compiler_revision)); |
| 151 | } |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 152 | } |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 153 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 154 | /******************************************************************************* |
| 155 | * |
| 156 | * FUNCTION: acpi_tb_init_generic_address |
| 157 | * |
| 158 | * PARAMETERS: new_gas_struct - GAS struct to be initialized |
| 159 | * bit_width - Width of this register |
| 160 | * Address - Address of the register |
| 161 | * |
| 162 | * RETURN: None |
| 163 | * |
| 164 | * DESCRIPTION: Initialize a GAS structure. |
| 165 | * |
| 166 | ******************************************************************************/ |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 167 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 168 | static void inline |
| 169 | acpi_tb_init_generic_address(struct acpi_generic_address *new_gas_struct, |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 170 | u8 bit_width, u64 address) |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 171 | { |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 172 | |
Bob Moore | 4bf2739 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 173 | ACPI_MOVE_64_TO_64(&new_gas_struct->address, &address); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 174 | new_gas_struct->space_id = ACPI_ADR_SPACE_SYSTEM_IO; |
| 175 | new_gas_struct->bit_width = bit_width; |
| 176 | new_gas_struct->bit_offset = 0; |
| 177 | new_gas_struct->access_width = 0; |
| 178 | } |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 179 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 180 | /******************************************************************************* |
| 181 | * |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 182 | * FUNCTION: acpi_tb_validate_checksum |
| 183 | * |
| 184 | * PARAMETERS: Table - ACPI table to verify |
| 185 | * Length - Length of entire table |
| 186 | * |
| 187 | * RETURN: Status |
| 188 | * |
| 189 | * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns |
| 190 | * exception on bad checksum. |
| 191 | * |
| 192 | ******************************************************************************/ |
| 193 | |
| 194 | acpi_status acpi_tb_verify_checksum(struct acpi_table_header *table, u32 length) |
| 195 | { |
| 196 | u8 checksum; |
| 197 | |
| 198 | /* Compute the checksum on the table */ |
| 199 | |
| 200 | checksum = acpi_tb_checksum(ACPI_CAST_PTR(u8, table), length); |
| 201 | |
| 202 | /* Checksum ok? (should be zero) */ |
| 203 | |
| 204 | if (checksum) { |
| 205 | ACPI_WARNING((AE_INFO, |
| 206 | "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X", |
| 207 | table->signature, table->checksum, |
| 208 | (u8) (table->checksum - checksum))); |
| 209 | |
| 210 | #if (ACPI_CHECKSUM_ABORT) |
| 211 | |
| 212 | return (AE_BAD_CHECKSUM); |
| 213 | #endif |
| 214 | } |
| 215 | |
| 216 | return (AE_OK); |
| 217 | } |
| 218 | |
| 219 | /******************************************************************************* |
| 220 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 221 | * FUNCTION: acpi_tb_checksum |
| 222 | * |
| 223 | * PARAMETERS: Buffer - Pointer to memory region to be checked |
| 224 | * Length - Length of this memory region |
| 225 | * |
| 226 | * RETURN: Checksum (u8) |
| 227 | * |
| 228 | * DESCRIPTION: Calculates circular checksum of memory region. |
| 229 | * |
| 230 | ******************************************************************************/ |
| 231 | |
| 232 | u8 acpi_tb_checksum(u8 * buffer, acpi_native_uint length) |
| 233 | { |
| 234 | u8 sum = 0; |
| 235 | u8 *end = buffer + length; |
| 236 | |
| 237 | while (buffer < end) { |
| 238 | sum = (u8) (sum + *(buffer++)); |
| 239 | } |
| 240 | |
| 241 | return sum; |
| 242 | } |
| 243 | |
| 244 | /******************************************************************************* |
| 245 | * |
| 246 | * FUNCTION: acpi_tb_convert_fadt |
| 247 | * |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 248 | * PARAMETERS: None, uses acpi_gbl_FADT |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 249 | * |
| 250 | * RETURN: None |
| 251 | * |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 252 | * DESCRIPTION: Converts all versions of the FADT to a common internal format. |
| 253 | * |
| 254 | * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), and must contain |
| 255 | * a copy of the actual FADT. |
| 256 | * |
| 257 | * ACPICA will use the "X" fields of the FADT for all addresses. |
| 258 | * |
| 259 | * "X" fields are optional extensions to the original V1.0 fields. Even if |
| 260 | * they are present in the structure, they can be optionally not used by |
| 261 | * setting them to zero. Therefore, we must selectively expand V1.0 fields |
| 262 | * if the corresponding X field is zero. |
| 263 | * |
| 264 | * For ACPI 1.0 FADTs, all address fields are expanded to the corresponding |
| 265 | * "X" fields. |
| 266 | * |
| 267 | * For ACPI 2.0 FADTs, any "X" fields that are NULL are filled in by |
| 268 | * expanding the corresponding ACPI 1.0 field. |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 269 | * |
| 270 | ******************************************************************************/ |
| 271 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 272 | static void acpi_tb_convert_fadt(void) |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 273 | { |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 274 | u8 pm1_register_length; |
| 275 | struct acpi_generic_address *target; |
| 276 | acpi_native_uint i; |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 277 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 278 | /* Expand the FACS and DSDT addresses as necessary */ |
| 279 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 280 | if (!acpi_gbl_FADT.Xfacs) { |
| 281 | acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs; |
| 282 | } |
| 283 | |
| 284 | if (!acpi_gbl_FADT.Xdsdt) { |
| 285 | acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt; |
| 286 | } |
| 287 | |
| 288 | /* |
Bob Moore | a4bbb810 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 289 | * Expand the 32-bit V1.0 addresses to the 64-bit "X" generic address |
| 290 | * structures as necessary. |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 291 | */ |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 292 | for (i = 0; i < ACPI_FADT_CONVERSION_ENTRIES; i++) { |
| 293 | target = |
| 294 | ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, |
| 295 | fadt_conversion_table[i].target); |
| 296 | |
Bob Moore | 4bf2739 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 297 | /* Expand only if the X target is null */ |
| 298 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 299 | if (!target->address) { |
| 300 | acpi_tb_init_generic_address(target, |
| 301 | *ACPI_ADD_PTR(u8, |
| 302 | &acpi_gbl_FADT, |
| 303 | fadt_conversion_table |
| 304 | [i].length), |
Bob Moore | a4bbb810 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 305 | (u64) * ACPI_ADD_PTR(u32, |
| 306 | &acpi_gbl_FADT, |
| 307 | fadt_conversion_table |
| 308 | [i]. |
| 309 | source)); |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 310 | } |
| 311 | } |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 312 | |
| 313 | /* |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 314 | * Calculate separate GAS structs for the PM1 Enable registers. |
| 315 | * These addresses do not appear (directly) in the FADT, so it is |
| 316 | * useful to calculate them once, here. |
Bob Moore | 4bf2739 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 317 | * |
| 318 | * The PM event blocks are split into two register blocks, first is the |
| 319 | * PM Status Register block, followed immediately by the PM Enable Register |
| 320 | * block. Each is of length (pm1_event_length/2) |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 321 | */ |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 322 | pm1_register_length = (u8) ACPI_DIV_2(acpi_gbl_FADT.pm1_event_length); |
| 323 | |
| 324 | /* PM1A is required */ |
| 325 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 326 | acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 327 | pm1_register_length, |
Bob Moore | 4bf2739 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 328 | (acpi_gbl_FADT.xpm1a_event_block.address + |
| 329 | pm1_register_length)); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 330 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 331 | /* PM1B is optional; leave null if not present */ |
| 332 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 333 | if (acpi_gbl_FADT.xpm1b_event_block.address) { |
| 334 | acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 335 | pm1_register_length, |
Bob Moore | 4bf2739 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 336 | (acpi_gbl_FADT.xpm1b_event_block. |
| 337 | address + pm1_register_length)); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 338 | } |
| 339 | |
| 340 | /* Global FADT is the new common V2.0 FADT */ |
| 341 | |
| 342 | acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt); |
| 343 | } |
| 344 | |
| 345 | /******************************************************************************* |
| 346 | * |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 347 | * FUNCTION: acpi_tb_install_table |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 348 | * |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 349 | * PARAMETERS: Address - Physical address of DSDT or FACS |
| 350 | * Flags - Flags |
| 351 | * Signature - Table signature, NULL if no need to |
| 352 | * match |
| 353 | * table_index - Index into root table array |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 354 | * |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 355 | * RETURN: None |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 356 | * |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 357 | * DESCRIPTION: Install an ACPI table into the global data structure. |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 358 | * |
| 359 | ******************************************************************************/ |
| 360 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 361 | static void |
| 362 | acpi_tb_install_table(acpi_physical_address address, |
| 363 | u8 flags, char *signature, acpi_native_uint table_index) |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 364 | { |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 365 | struct acpi_table_header *table; |
| 366 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 367 | if (!address) { |
| 368 | ACPI_ERROR((AE_INFO, |
| 369 | "Null physical address for ACPI table [%s]", |
| 370 | signature)); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 371 | return; |
| 372 | } |
| 373 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 374 | /* Map just the table header */ |
| 375 | |
| 376 | table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 377 | if (!table) { |
| 378 | return; |
| 379 | } |
| 380 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 381 | /* If a particular signature is expected, signature must match */ |
| 382 | |
| 383 | if (signature && !ACPI_COMPARE_NAME(table->signature, signature)) { |
| 384 | ACPI_ERROR((AE_INFO, |
| 385 | "Invalid signature 0x%X for ACPI table [%s]", |
| 386 | *ACPI_CAST_PTR(u32, table->signature), signature)); |
| 387 | goto unmap_and_exit; |
| 388 | } |
| 389 | |
| 390 | /* Initialize the table entry */ |
| 391 | |
| 392 | acpi_gbl_root_table_list.tables[table_index].address = address; |
| 393 | acpi_gbl_root_table_list.tables[table_index].length = table->length; |
| 394 | acpi_gbl_root_table_list.tables[table_index].flags = flags; |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 395 | |
| 396 | ACPI_MOVE_32_TO_32(& |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 397 | (acpi_gbl_root_table_list.tables[table_index]. |
| 398 | signature), table->signature); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 399 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 400 | acpi_tb_print_table_header(address, table); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 401 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 402 | if (table_index == ACPI_TABLE_INDEX_DSDT) { |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 403 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 404 | /* Global integer width is based upon revision of the DSDT */ |
| 405 | |
| 406 | acpi_ut_set_integer_width(table->revision); |
| 407 | } |
| 408 | |
| 409 | unmap_and_exit: |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 410 | acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); |
| 411 | } |
| 412 | |
| 413 | /******************************************************************************* |
| 414 | * |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 415 | * FUNCTION: acpi_tb_parse_fadt |
| 416 | * |
| 417 | * PARAMETERS: table_index - Index for the FADT |
| 418 | * Flags - Flags |
| 419 | * |
| 420 | * RETURN: None |
| 421 | * |
| 422 | * DESCRIPTION: Initialize the FADT, DSDT and FACS tables |
| 423 | * (FADT contains the addresses of the DSDT and FACS) |
| 424 | * |
| 425 | ******************************************************************************/ |
| 426 | |
| 427 | static void acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags) |
| 428 | { |
| 429 | u32 length; |
| 430 | struct acpi_table_header *table; |
| 431 | |
| 432 | /* |
| 433 | * Special case for the FADT because of multiple versions and the fact |
| 434 | * that it contains pointers to both the DSDT and FACS tables. |
| 435 | * |
| 436 | * Get a local copy of the FADT and convert it to a common format |
| 437 | * Map entire FADT, assumed to be smaller than one page. |
| 438 | */ |
| 439 | length = acpi_gbl_root_table_list.tables[table_index].length; |
| 440 | |
| 441 | table = |
| 442 | acpi_os_map_memory(acpi_gbl_root_table_list.tables[table_index]. |
| 443 | address, length); |
| 444 | if (!table) { |
| 445 | return; |
| 446 | } |
| 447 | |
| 448 | /* |
| 449 | * Validate the FADT checksum before we copy the table. Ignore |
| 450 | * checksum error as we want to try to get the DSDT and FACS. |
| 451 | */ |
| 452 | (void)acpi_tb_verify_checksum(table, length); |
| 453 | |
| 454 | /* Copy the entire FADT locally */ |
| 455 | |
Bob Moore | a4bbb810 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 456 | ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt)); |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 457 | |
| 458 | ACPI_MEMCPY(&acpi_gbl_FADT, table, |
| 459 | ACPI_MIN(length, sizeof(struct acpi_table_fadt))); |
| 460 | acpi_os_unmap_memory(table, length); |
| 461 | |
| 462 | /* Convert local FADT to the common internal format */ |
| 463 | |
| 464 | acpi_tb_convert_fadt(); |
| 465 | |
| 466 | /* Extract the DSDT and FACS tables from the FADT */ |
| 467 | |
| 468 | acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt, |
| 469 | flags, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); |
| 470 | |
| 471 | acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xfacs, |
| 472 | flags, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); |
| 473 | } |
| 474 | |
| 475 | /******************************************************************************* |
| 476 | * |
Bob Moore | a4bbb810 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 477 | * FUNCTION: acpi_tb_get_root_table_entry |
| 478 | * |
| 479 | * PARAMETERS: table_entry - Pointer to the RSDT/XSDT table entry |
| 480 | * table_entry_size - sizeof 32 or 64 (RSDT or XSDT) |
| 481 | * |
| 482 | * RETURN: Physical address extracted from the root table |
| 483 | * |
| 484 | * DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on |
| 485 | * both 32-bit and 64-bit platforms |
| 486 | * |
| 487 | * NOTE: acpi_physical_address is 32-bit on 32-bit platforms, 64-bit on |
| 488 | * 64-bit platforms. |
| 489 | * |
| 490 | ******************************************************************************/ |
| 491 | |
| 492 | static acpi_physical_address |
| 493 | acpi_tb_get_root_table_entry(u8 * table_entry, |
| 494 | acpi_native_uint table_entry_size) |
| 495 | { |
| 496 | u64 address64; |
| 497 | |
| 498 | /* |
| 499 | * Get the table physical address (32-bit for RSDT, 64-bit for XSDT): |
| 500 | * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT |
| 501 | */ |
| 502 | if (table_entry_size == sizeof(u32)) { |
| 503 | /* |
| 504 | * 32-bit platform, RSDT: Return 32-bit table entry |
| 505 | * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return |
| 506 | */ |
| 507 | return ((acpi_physical_address) |
| 508 | (*ACPI_CAST_PTR(u32, table_entry))); |
| 509 | } else { |
| 510 | /* |
| 511 | * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return |
| 512 | * 64-bit platform, XSDT: Move (unaligned) 64-bit to local, return 64-bit |
| 513 | */ |
| 514 | ACPI_MOVE_64_TO_64(&address64, table_entry); |
| 515 | |
| 516 | #if ACPI_MACHINE_WIDTH == 32 |
| 517 | if (address64 > ACPI_UINT32_MAX) { |
| 518 | |
| 519 | /* Will truncate 64-bit address to 32 bits */ |
| 520 | |
| 521 | ACPI_WARNING((AE_INFO, |
| 522 | "64-bit Physical Address in XSDT is too large (%8.8X%8.8X), truncating", |
| 523 | ACPI_FORMAT_UINT64(address64))); |
| 524 | } |
| 525 | #endif |
| 526 | return ((acpi_physical_address) (address64)); |
| 527 | } |
| 528 | } |
| 529 | |
| 530 | /******************************************************************************* |
| 531 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 532 | * FUNCTION: acpi_tb_parse_root_table |
| 533 | * |
| 534 | * PARAMETERS: Rsdp - Pointer to the RSDP |
| 535 | * Flags - Flags |
| 536 | * |
| 537 | * RETURN: Status |
| 538 | * |
| 539 | * DESCRIPTION: This function is called to parse the Root System Description |
| 540 | * Table (RSDT or XSDT) |
| 541 | * |
| 542 | * NOTE: Tables are mapped (not copied) for efficiency. The FACS must |
| 543 | * be mapped and cannot be copied because it contains the actual |
| 544 | * memory location of the ACPI Global Lock. |
| 545 | * |
| 546 | ******************************************************************************/ |
| 547 | |
Alexey Starikovskiy | ad71860a | 2007-02-02 19:48:19 +0300 | [diff] [blame^] | 548 | acpi_status __init |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 549 | acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 550 | { |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 551 | struct acpi_table_rsdp *rsdp; |
| 552 | acpi_native_uint table_entry_size; |
| 553 | acpi_native_uint i; |
| 554 | u32 table_count; |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 555 | struct acpi_table_header *table; |
| 556 | acpi_physical_address address; |
| 557 | u32 length; |
| 558 | u8 *table_entry; |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 559 | acpi_status status; |
| 560 | |
| 561 | ACPI_FUNCTION_TRACE(tb_parse_root_table); |
| 562 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 563 | /* |
| 564 | * Map the entire RSDP and extract the address of the RSDT or XSDT |
| 565 | */ |
| 566 | rsdp = acpi_os_map_memory(rsdp_address, sizeof(struct acpi_table_rsdp)); |
| 567 | if (!rsdp) { |
| 568 | return_ACPI_STATUS(AE_NO_MEMORY); |
| 569 | } |
| 570 | |
| 571 | acpi_tb_print_table_header(rsdp_address, |
| 572 | ACPI_CAST_PTR(struct acpi_table_header, |
| 573 | rsdp)); |
| 574 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 575 | /* Differentiate between RSDT and XSDT root tables */ |
| 576 | |
| 577 | if (rsdp->revision > 1 && rsdp->xsdt_physical_address) { |
Bob Moore | a18ecf4 | 2005-08-15 03:42:00 -0800 | [diff] [blame] | 578 | /* |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 579 | * Root table is an XSDT (64-bit physical addresses). We must use the |
| 580 | * XSDT if the revision is > 1 and the XSDT pointer is present, as per |
| 581 | * the ACPI specification. |
Bob Moore | a18ecf4 | 2005-08-15 03:42:00 -0800 | [diff] [blame] | 582 | */ |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 583 | address = (acpi_physical_address) rsdp->xsdt_physical_address; |
| 584 | table_entry_size = sizeof(u64); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 585 | } else { |
| 586 | /* Root table is an RSDT (32-bit physical addresses) */ |
Bob Moore | 52fc0b0 | 2006-10-02 00:00:00 -0400 | [diff] [blame] | 587 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 588 | address = (acpi_physical_address) rsdp->rsdt_physical_address; |
| 589 | table_entry_size = sizeof(u32); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 590 | } |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 591 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 592 | /* |
| 593 | * It is not possible to map more than one entry in some environments, |
| 594 | * so unmap the RSDP here before mapping other tables |
| 595 | */ |
| 596 | acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp)); |
| 597 | |
| 598 | /* Map the RSDT/XSDT table header to get the full table length */ |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 599 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 600 | table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); |
| 601 | if (!table) { |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 602 | return_ACPI_STATUS(AE_NO_MEMORY); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 603 | } |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 604 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 605 | acpi_tb_print_table_header(address, table); |
| 606 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 607 | /* Get the length of the full table, verify length and map entire table */ |
| 608 | |
| 609 | length = table->length; |
| 610 | acpi_os_unmap_memory(table, sizeof(struct acpi_table_header)); |
| 611 | |
| 612 | if (length < sizeof(struct acpi_table_header)) { |
| 613 | ACPI_ERROR((AE_INFO, "Invalid length 0x%X in RSDT/XSDT", |
| 614 | length)); |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 615 | return_ACPI_STATUS(AE_INVALID_TABLE_LENGTH); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 616 | } |
| 617 | |
| 618 | table = acpi_os_map_memory(address, length); |
| 619 | if (!table) { |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 620 | return_ACPI_STATUS(AE_NO_MEMORY); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 621 | } |
| 622 | |
| 623 | /* Validate the root table checksum */ |
| 624 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 625 | status = acpi_tb_verify_checksum(table, length); |
| 626 | if (ACPI_FAILURE(status)) { |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 627 | acpi_os_unmap_memory(table, length); |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 628 | return_ACPI_STATUS(status); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 629 | } |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 630 | |
| 631 | /* Calculate the number of tables described in the root table */ |
| 632 | |
| 633 | table_count = |
Bob Moore | a4bbb810 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 634 | (u32) ((table->length - |
| 635 | sizeof(struct acpi_table_header)) / table_entry_size); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 636 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 637 | /* |
| 638 | * First two entries in the table array are reserved for the DSDT and FACS, |
| 639 | * which are not actually present in the RSDT/XSDT - they come from the FADT |
| 640 | */ |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 641 | table_entry = |
| 642 | ACPI_CAST_PTR(u8, table) + sizeof(struct acpi_table_header); |
| 643 | acpi_gbl_root_table_list.count = 2; |
| 644 | |
| 645 | /* |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 646 | * Initialize the root table array from the RSDT/XSDT |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 647 | */ |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 648 | for (i = 0; i < table_count; i++) { |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 649 | if (acpi_gbl_root_table_list.count >= |
| 650 | acpi_gbl_root_table_list.size) { |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 651 | |
| 652 | /* There is no more room in the root table array, attempt resize */ |
| 653 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 654 | status = acpi_tb_resize_root_table_list(); |
| 655 | if (ACPI_FAILURE(status)) { |
| 656 | ACPI_WARNING((AE_INFO, |
| 657 | "Truncating %u table entries!", |
| 658 | (unsigned) |
| 659 | (acpi_gbl_root_table_list.size - |
| 660 | acpi_gbl_root_table_list. |
| 661 | count))); |
| 662 | break; |
| 663 | } |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 664 | } |
| 665 | |
Bob Moore | a4bbb810 | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 666 | /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */ |
| 667 | |
| 668 | acpi_gbl_root_table_list.tables[acpi_gbl_root_table_list.count]. |
| 669 | address = |
| 670 | acpi_tb_get_root_table_entry(table_entry, table_entry_size); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 671 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 672 | table_entry += table_entry_size; |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 673 | acpi_gbl_root_table_list.count++; |
| 674 | } |
| 675 | |
| 676 | /* |
| 677 | * It is not possible to map more than one entry in some environments, |
| 678 | * so unmap the root table here before mapping other tables |
| 679 | */ |
| 680 | acpi_os_unmap_memory(table, length); |
| 681 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 682 | /* |
| 683 | * Complete the initialization of the root table array by examining |
| 684 | * the header of each table |
| 685 | */ |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 686 | for (i = 2; i < acpi_gbl_root_table_list.count; i++) { |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 687 | acpi_tb_install_table(acpi_gbl_root_table_list.tables[i]. |
| 688 | address, flags, NULL, i); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 689 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 690 | /* Special case for FADT - get the DSDT and FACS */ |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 691 | |
Bob Moore | c5fc42a | 2007-02-02 19:48:19 +0300 | [diff] [blame] | 692 | if (ACPI_COMPARE_NAME |
| 693 | (&acpi_gbl_root_table_list.tables[i].signature, |
| 694 | ACPI_SIG_FADT)) { |
| 695 | acpi_tb_parse_fadt(i, flags); |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 696 | } |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 697 | } |
| 698 | |
Len Brown | 4be44fc | 2005-08-05 00:44:28 -0400 | [diff] [blame] | 699 | return_ACPI_STATUS(AE_OK); |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 700 | } |
| 701 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 702 | /****************************************************************************** |
Robert Moore | 0c9938c | 2005-07-29 15:15:00 -0700 | [diff] [blame] | 703 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 704 | * FUNCTION: acpi_tb_map |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 705 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 706 | * PARAMETERS: Address - Address to be mapped |
| 707 | * Length - Length to be mapped |
| 708 | * Flags - Logical or physical addressing mode |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 709 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 710 | * RETURN: Pointer to mapped region |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 711 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 712 | * DESCRIPTION: Maps memory according to flag |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 713 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 714 | *****************************************************************************/ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 715 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 716 | void *acpi_tb_map(acpi_physical_address address, u32 length, u32 flags) |
Bob Moore | 793c238 | 2006-03-31 00:00:00 -0500 | [diff] [blame] | 717 | { |
| 718 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 719 | if (flags == ACPI_TABLE_ORIGIN_MAPPED) { |
| 720 | return (acpi_os_map_memory(address, length)); |
| 721 | } else { |
| 722 | return (ACPI_CAST_PTR(void, address)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 723 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 724 | } |
| 725 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 726 | /****************************************************************************** |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 727 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 728 | * FUNCTION: acpi_tb_unmap |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 729 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 730 | * PARAMETERS: Pointer - To mapped region |
| 731 | * Length - Length to be unmapped |
| 732 | * Flags - Logical or physical addressing mode |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 733 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 734 | * RETURN: None |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 735 | * |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 736 | * DESCRIPTION: Unmaps memory according to flag |
| 737 | * |
| 738 | *****************************************************************************/ |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 739 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 740 | void acpi_tb_unmap(void *pointer, u32 length, u32 flags) |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 741 | { |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 742 | |
Bob Moore | f3d2e78 | 2007-02-02 19:48:18 +0300 | [diff] [blame] | 743 | if (flags == ACPI_TABLE_ORIGIN_MAPPED) { |
| 744 | acpi_os_unmap_memory(pointer, length); |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 745 | } |
Robert Moore | 44f6c01 | 2005-04-18 22:49:35 -0400 | [diff] [blame] | 746 | } |