Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Module Name: tbfadt - FADT table utilities |
| 4 | * |
| 5 | *****************************************************************************/ |
| 6 | |
| 7 | /* |
Len Brown | 75a44ce | 2008-04-23 23:00:13 -0400 | [diff] [blame] | 8 | * Copyright (C) 2000 - 2008, Intel Corp. |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [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 <acpi/acpi.h> |
Len Brown | e2f7a77 | 2009-01-09 00:30:03 -0500 | [diff] [blame] | 45 | #include "accommon.h" |
| 46 | #include "actables.h" |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 47 | |
| 48 | #define _COMPONENT ACPI_TABLES |
| 49 | ACPI_MODULE_NAME("tbfadt") |
| 50 | |
| 51 | /* Local prototypes */ |
Bob Moore | 6de4048 | 2008-11-12 14:16:21 +0800 | [diff] [blame] | 52 | static inline void |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 53 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 54 | u8 space_id, u8 byte_width, u64 address); |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 55 | |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 56 | static void acpi_tb_convert_fadt(void); |
| 57 | |
| 58 | static void acpi_tb_validate_fadt(void); |
| 59 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 60 | /* Table for conversion of FADT to common internal format and FADT validation */ |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 61 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 62 | typedef struct acpi_fadt_info { |
| 63 | char *name; |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 64 | u8 address64; |
| 65 | u8 address32; |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 66 | u8 length; |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 67 | u8 default_length; |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 68 | u8 type; |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 69 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 70 | } acpi_fadt_info; |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 71 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 72 | #define ACPI_FADT_REQUIRED 1 |
| 73 | #define ACPI_FADT_SEPARATE_LENGTH 2 |
| 74 | |
| 75 | static struct acpi_fadt_info fadt_info_table[] = { |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 76 | {"Pm1aEventBlock", |
| 77 | ACPI_FADT_OFFSET(xpm1a_event_block), |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 78 | ACPI_FADT_OFFSET(pm1a_event_block), |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 79 | ACPI_FADT_OFFSET(pm1_event_length), |
| 80 | ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ |
| 81 | ACPI_FADT_REQUIRED}, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 82 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 83 | {"Pm1bEventBlock", |
| 84 | ACPI_FADT_OFFSET(xpm1b_event_block), |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 85 | ACPI_FADT_OFFSET(pm1b_event_block), |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 86 | ACPI_FADT_OFFSET(pm1_event_length), |
| 87 | ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ |
| 88 | 0}, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 89 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 90 | {"Pm1aControlBlock", |
| 91 | ACPI_FADT_OFFSET(xpm1a_control_block), |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 92 | ACPI_FADT_OFFSET(pm1a_control_block), |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 93 | ACPI_FADT_OFFSET(pm1_control_length), |
| 94 | ACPI_PM1_REGISTER_WIDTH, |
| 95 | ACPI_FADT_REQUIRED}, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 96 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 97 | {"Pm1bControlBlock", |
| 98 | ACPI_FADT_OFFSET(xpm1b_control_block), |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 99 | ACPI_FADT_OFFSET(pm1b_control_block), |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 100 | ACPI_FADT_OFFSET(pm1_control_length), |
| 101 | ACPI_PM1_REGISTER_WIDTH, |
| 102 | 0}, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 103 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 104 | {"Pm2ControlBlock", |
| 105 | ACPI_FADT_OFFSET(xpm2_control_block), |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 106 | ACPI_FADT_OFFSET(pm2_control_block), |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 107 | ACPI_FADT_OFFSET(pm2_control_length), |
| 108 | ACPI_PM2_REGISTER_WIDTH, |
| 109 | ACPI_FADT_SEPARATE_LENGTH}, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 110 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 111 | {"PmTimerBlock", |
| 112 | ACPI_FADT_OFFSET(xpm_timer_block), |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 113 | ACPI_FADT_OFFSET(pm_timer_block), |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 114 | ACPI_FADT_OFFSET(pm_timer_length), |
| 115 | ACPI_PM_TIMER_WIDTH, |
| 116 | ACPI_FADT_REQUIRED}, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 117 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 118 | {"Gpe0Block", |
| 119 | ACPI_FADT_OFFSET(xgpe0_block), |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 120 | ACPI_FADT_OFFSET(gpe0_block), |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 121 | ACPI_FADT_OFFSET(gpe0_block_length), |
| 122 | 0, |
| 123 | ACPI_FADT_SEPARATE_LENGTH}, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 124 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 125 | {"Gpe1Block", |
| 126 | ACPI_FADT_OFFSET(xgpe1_block), |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 127 | ACPI_FADT_OFFSET(gpe1_block), |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 128 | ACPI_FADT_OFFSET(gpe1_block_length), |
| 129 | 0, |
| 130 | ACPI_FADT_SEPARATE_LENGTH} |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 131 | }; |
| 132 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 133 | #define ACPI_FADT_INFO_ENTRIES (sizeof (fadt_info_table) / sizeof (struct acpi_fadt_info)) |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 134 | |
| 135 | /******************************************************************************* |
| 136 | * |
| 137 | * FUNCTION: acpi_tb_init_generic_address |
| 138 | * |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 139 | * PARAMETERS: generic_address - GAS struct to be initialized |
Jan Beulich | fcea94b | 2008-09-19 15:50:32 -0700 | [diff] [blame] | 140 | * byte_width - Width of this register |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 141 | * Address - Address of the register |
| 142 | * |
| 143 | * RETURN: None |
| 144 | * |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 145 | * DESCRIPTION: Initialize a Generic Address Structure (GAS) |
| 146 | * See the ACPI specification for a full description and |
| 147 | * definition of this structure. |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 148 | * |
| 149 | ******************************************************************************/ |
| 150 | |
Bob Moore | 6de4048 | 2008-11-12 14:16:21 +0800 | [diff] [blame] | 151 | static inline void |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 152 | acpi_tb_init_generic_address(struct acpi_generic_address *generic_address, |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 153 | u8 space_id, u8 byte_width, u64 address) |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 154 | { |
| 155 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 156 | /* |
| 157 | * The 64-bit Address field is non-aligned in the byte packed |
| 158 | * GAS struct. |
| 159 | */ |
| 160 | ACPI_MOVE_64_TO_64(&generic_address->address, &address); |
| 161 | |
| 162 | /* All other fields are byte-wide */ |
| 163 | |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 164 | generic_address->space_id = space_id; |
| 165 | generic_address->bit_width = (u8)ACPI_MUL_8(byte_width); |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 166 | generic_address->bit_offset = 0; |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 167 | generic_address->access_width = 0; /* Access width ANY */ |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 168 | } |
| 169 | |
| 170 | /******************************************************************************* |
| 171 | * |
| 172 | * FUNCTION: acpi_tb_parse_fadt |
| 173 | * |
| 174 | * PARAMETERS: table_index - Index for the FADT |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 175 | * |
| 176 | * RETURN: None |
| 177 | * |
| 178 | * DESCRIPTION: Initialize the FADT, DSDT and FACS tables |
| 179 | * (FADT contains the addresses of the DSDT and FACS) |
| 180 | * |
| 181 | ******************************************************************************/ |
| 182 | |
Bob Moore | 97cbb7d | 2009-02-03 14:41:03 +0800 | [diff] [blame^] | 183 | void acpi_tb_parse_fadt(u32 table_index) |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 184 | { |
| 185 | u32 length; |
| 186 | struct acpi_table_header *table; |
| 187 | |
| 188 | /* |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 189 | * The FADT has multiple versions with different lengths, |
| 190 | * and it contains pointers to both the DSDT and FACS tables. |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 191 | * |
| 192 | * Get a local copy of the FADT and convert it to a common format |
| 193 | * Map entire FADT, assumed to be smaller than one page. |
| 194 | */ |
| 195 | length = acpi_gbl_root_table_list.tables[table_index].length; |
| 196 | |
| 197 | table = |
| 198 | acpi_os_map_memory(acpi_gbl_root_table_list.tables[table_index]. |
| 199 | address, length); |
| 200 | if (!table) { |
| 201 | return; |
| 202 | } |
| 203 | |
| 204 | /* |
| 205 | * Validate the FADT checksum before we copy the table. Ignore |
| 206 | * checksum error as we want to try to get the DSDT and FACS. |
| 207 | */ |
| 208 | (void)acpi_tb_verify_checksum(table, length); |
| 209 | |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 210 | /* Obtain a local copy of the FADT in common ACPI 2.0+ format */ |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 211 | |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 212 | acpi_tb_create_local_fadt(table, length); |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 213 | |
| 214 | /* All done with the real FADT, unmap it */ |
| 215 | |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 216 | acpi_os_unmap_memory(table, length); |
| 217 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 218 | /* Obtain the DSDT and FACS tables via their addresses within the FADT */ |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 219 | |
| 220 | acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt, |
Bob Moore | 97cbb7d | 2009-02-03 14:41:03 +0800 | [diff] [blame^] | 221 | ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 222 | |
| 223 | acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xfacs, |
Bob Moore | 97cbb7d | 2009-02-03 14:41:03 +0800 | [diff] [blame^] | 224 | ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 225 | } |
| 226 | |
| 227 | /******************************************************************************* |
| 228 | * |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 229 | * FUNCTION: acpi_tb_create_local_fadt |
| 230 | * |
| 231 | * PARAMETERS: Table - Pointer to BIOS FADT |
| 232 | * Length - Length of the table |
| 233 | * |
| 234 | * RETURN: None |
| 235 | * |
| 236 | * DESCRIPTION: Get a local copy of the FADT and convert it to a common format. |
| 237 | * Performs validation on some important FADT fields. |
| 238 | * |
Bob Moore | 55f8f3c | 2007-05-02 15:51:37 -0400 | [diff] [blame] | 239 | * NOTE: We create a local copy of the FADT regardless of the version. |
| 240 | * |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 241 | ******************************************************************************/ |
| 242 | |
| 243 | void acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 length) |
| 244 | { |
| 245 | |
| 246 | /* |
Bob Moore | 55f8f3c | 2007-05-02 15:51:37 -0400 | [diff] [blame] | 247 | * Check if the FADT is larger than the largest table that we expect |
| 248 | * (the ACPI 2.0/3.0 version). If so, truncate the table, and issue |
| 249 | * a warning. |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 250 | */ |
| 251 | if (length > sizeof(struct acpi_table_fadt)) { |
| 252 | ACPI_WARNING((AE_INFO, |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 253 | "FADT (revision %u) is longer than ACPI 2.0 version, " |
| 254 | "truncating length 0x%X to 0x%zX", |
Alexey Starikovskiy | b0b7eaa | 2007-01-25 22:39:44 -0500 | [diff] [blame] | 255 | table->revision, (unsigned)length, |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 256 | sizeof(struct acpi_table_fadt))); |
| 257 | } |
| 258 | |
Bob Moore | 55f8f3c | 2007-05-02 15:51:37 -0400 | [diff] [blame] | 259 | /* Clear the entire local FADT */ |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 260 | |
| 261 | ACPI_MEMSET(&acpi_gbl_FADT, 0, sizeof(struct acpi_table_fadt)); |
| 262 | |
Bob Moore | 55f8f3c | 2007-05-02 15:51:37 -0400 | [diff] [blame] | 263 | /* Copy the original FADT, up to sizeof (struct acpi_table_fadt) */ |
| 264 | |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 265 | ACPI_MEMCPY(&acpi_gbl_FADT, table, |
| 266 | ACPI_MIN(length, sizeof(struct acpi_table_fadt))); |
| 267 | |
| 268 | /* |
| 269 | * 1) Convert the local copy of the FADT to the common internal format |
| 270 | * 2) Validate some of the important values within the FADT |
| 271 | */ |
| 272 | acpi_tb_convert_fadt(); |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 273 | } |
| 274 | |
| 275 | /******************************************************************************* |
| 276 | * |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 277 | * FUNCTION: acpi_tb_convert_fadt |
| 278 | * |
| 279 | * PARAMETERS: None, uses acpi_gbl_FADT |
| 280 | * |
| 281 | * RETURN: None |
| 282 | * |
| 283 | * DESCRIPTION: Converts all versions of the FADT to a common internal format. |
Bob Moore | 55f8f3c | 2007-05-02 15:51:37 -0400 | [diff] [blame] | 284 | * Expand all 32-bit addresses to 64-bit. |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 285 | * |
Bob Moore | e56b638 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 286 | * NOTE: acpi_gbl_FADT must be of size (struct acpi_table_fadt), |
| 287 | * and must contain a copy of the actual FADT. |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 288 | * |
| 289 | * ACPICA will use the "X" fields of the FADT for all addresses. |
| 290 | * |
| 291 | * "X" fields are optional extensions to the original V1.0 fields. Even if |
| 292 | * they are present in the structure, they can be optionally not used by |
| 293 | * setting them to zero. Therefore, we must selectively expand V1.0 fields |
| 294 | * if the corresponding X field is zero. |
| 295 | * |
| 296 | * For ACPI 1.0 FADTs, all address fields are expanded to the corresponding |
| 297 | * "X" fields. |
| 298 | * |
| 299 | * For ACPI 2.0 FADTs, any "X" fields that are NULL are filled in by |
| 300 | * expanding the corresponding ACPI 1.0 field. |
| 301 | * |
| 302 | ******************************************************************************/ |
| 303 | |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 304 | static void acpi_tb_convert_fadt(void) |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 305 | { |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 306 | u8 pm1_register_bit_width; |
| 307 | u8 pm1_register_byte_width; |
| 308 | struct acpi_generic_address *target64; |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 309 | u32 i; |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 310 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 311 | /* Update the local FADT table header length */ |
| 312 | |
| 313 | acpi_gbl_FADT.header.length = sizeof(struct acpi_table_fadt); |
| 314 | |
Bob Moore | c87609f | 2008-11-12 15:23:20 +0800 | [diff] [blame] | 315 | /* |
| 316 | * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. |
| 317 | * Later code will always use the X 64-bit field. Also, check for an |
| 318 | * address mismatch between the 32-bit and 64-bit address fields |
| 319 | * (FIRMWARE_CTRL/X_FIRMWARE_CTRL, DSDT/X_DSDT) which would indicate |
| 320 | * the presence of two FACS or two DSDT tables. |
| 321 | */ |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 322 | if (!acpi_gbl_FADT.Xfacs) { |
| 323 | acpi_gbl_FADT.Xfacs = (u64) acpi_gbl_FADT.facs; |
Bob Moore | c87609f | 2008-11-12 15:23:20 +0800 | [diff] [blame] | 324 | } else if (acpi_gbl_FADT.facs && |
| 325 | (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) { |
| 326 | ACPI_WARNING((AE_INFO, |
| 327 | "32/64 FACS address mismatch in FADT - two FACS tables!")); |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 328 | } |
| 329 | |
| 330 | if (!acpi_gbl_FADT.Xdsdt) { |
| 331 | acpi_gbl_FADT.Xdsdt = (u64) acpi_gbl_FADT.dsdt; |
Bob Moore | c87609f | 2008-11-12 15:23:20 +0800 | [diff] [blame] | 332 | } else if (acpi_gbl_FADT.dsdt && |
| 333 | (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) { |
| 334 | ACPI_WARNING((AE_INFO, |
| 335 | "32/64 DSDT address mismatch in FADT - two DSDT tables!")); |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 336 | } |
| 337 | |
| 338 | /* |
Bob Moore | 55f8f3c | 2007-05-02 15:51:37 -0400 | [diff] [blame] | 339 | * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which |
| 340 | * should be zero are indeed zero. This will workaround BIOSs that |
| 341 | * inadvertently place values in these fields. |
| 342 | * |
| 343 | * The ACPI 1.0 reserved fields that will be zeroed are the bytes located at |
| 344 | * offset 45, 55, 95, and the word located at offset 109, 110. |
| 345 | */ |
Yinghai Lu | 14a63ba | 2008-10-29 14:13:22 -0700 | [diff] [blame] | 346 | if (acpi_gbl_FADT.header.revision < FADT2_REVISION_ID) { |
Bob Moore | 55f8f3c | 2007-05-02 15:51:37 -0400 | [diff] [blame] | 347 | acpi_gbl_FADT.preferred_profile = 0; |
| 348 | acpi_gbl_FADT.pstate_control = 0; |
| 349 | acpi_gbl_FADT.cst_control = 0; |
| 350 | acpi_gbl_FADT.boot_flags = 0; |
| 351 | } |
| 352 | |
| 353 | /* |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 354 | * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" |
| 355 | * generic address structures as necessary. Later code will always use |
| 356 | * the 64-bit address structures. |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 357 | */ |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 358 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 359 | target64 = |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 360 | ACPI_ADD_PTR(struct acpi_generic_address, &acpi_gbl_FADT, |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 361 | fadt_info_table[i].address64); |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 362 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 363 | /* Expand only if the 64-bit X target is null */ |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 364 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 365 | if (!target64->address) { |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 366 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 367 | /* The space_id is always I/O for the 32-bit legacy address fields */ |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 368 | |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 369 | acpi_tb_init_generic_address(target64, |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 370 | ACPI_ADR_SPACE_SYSTEM_IO, |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 371 | *ACPI_ADD_PTR(u8, |
| 372 | &acpi_gbl_FADT, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 373 | fadt_info_table |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 374 | [i].length), |
| 375 | (u64) * ACPI_ADD_PTR(u32, |
| 376 | &acpi_gbl_FADT, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 377 | fadt_info_table |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 378 | [i]. |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 379 | address32)); |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 380 | } |
| 381 | } |
| 382 | |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 383 | /* Validate FADT values now, before we make any changes */ |
| 384 | |
| 385 | acpi_tb_validate_fadt(); |
| 386 | |
| 387 | /* |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 388 | * Optionally check all register lengths against the default values and |
| 389 | * update them if they are incorrect. |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 390 | */ |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 391 | if (acpi_gbl_use_default_register_widths) { |
| 392 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { |
| 393 | target64 = |
| 394 | ACPI_ADD_PTR(struct acpi_generic_address, |
| 395 | &acpi_gbl_FADT, |
| 396 | fadt_info_table[i].address64); |
| 397 | |
| 398 | /* |
| 399 | * If a valid register (Address != 0) and the (default_length > 0) |
| 400 | * (Not a GPE register), then check the width against the default. |
| 401 | */ |
| 402 | if ((target64->address) && |
| 403 | (fadt_info_table[i].default_length > 0) && |
| 404 | (fadt_info_table[i].default_length != |
| 405 | target64->bit_width)) { |
| 406 | ACPI_WARNING((AE_INFO, |
| 407 | "Invalid length for %s: %d, using default %d", |
| 408 | fadt_info_table[i].name, |
| 409 | target64->bit_width, |
| 410 | fadt_info_table[i]. |
| 411 | default_length)); |
| 412 | |
| 413 | /* Incorrect size, set width to the default */ |
| 414 | |
| 415 | target64->bit_width = |
| 416 | fadt_info_table[i].default_length; |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | |
| 421 | /* |
| 422 | * Get the length of the individual PM1 registers (enable and status). |
| 423 | * Each register is defined to be (event block length / 2). |
| 424 | */ |
| 425 | pm1_register_bit_width = |
| 426 | (u8)ACPI_DIV_2(acpi_gbl_FADT.xpm1a_event_block.bit_width); |
| 427 | pm1_register_byte_width = (u8)ACPI_DIV_8(pm1_register_bit_width); |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 428 | |
| 429 | /* |
| 430 | * Adjust the lengths of the PM1 Event Blocks so that they can be used to |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 431 | * access the PM1 status register(s). Use (width / 2) |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 432 | */ |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 433 | acpi_gbl_FADT.xpm1a_event_block.bit_width = pm1_register_bit_width; |
| 434 | acpi_gbl_FADT.xpm1b_event_block.bit_width = pm1_register_bit_width; |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 435 | |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 436 | /* |
| 437 | * Calculate separate GAS structs for the PM1 Enable registers. |
| 438 | * These addresses do not appear (directly) in the FADT, so it is |
| 439 | * useful to calculate them once, here. |
| 440 | * |
| 441 | * The PM event blocks are split into two register blocks, first is the |
Jan Beulich | fcea94b | 2008-09-19 15:50:32 -0700 | [diff] [blame] | 442 | * PM Status Register block, followed immediately by the PM Enable |
| 443 | * Register block. Each is of length (xpm1x_event_block.bit_width/2). |
| 444 | * |
| 445 | * On various systems the v2 fields (and particularly the bit widths) |
| 446 | * cannot be relied upon, though. Hence resort to using the v1 length |
| 447 | * here (and warn about the inconsistency). |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 448 | */ |
Jan Beulich | fcea94b | 2008-09-19 15:50:32 -0700 | [diff] [blame] | 449 | if (acpi_gbl_FADT.xpm1a_event_block.bit_width |
| 450 | != acpi_gbl_FADT.pm1_event_length * 8) |
| 451 | printk(KERN_WARNING "FADT: " |
| 452 | "X_PM1a_EVT_BLK.bit_width (%u) does not match" |
| 453 | " PM1_EVT_LEN (%u)\n", |
| 454 | acpi_gbl_FADT.xpm1a_event_block.bit_width, |
| 455 | acpi_gbl_FADT.pm1_event_length); |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 456 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 457 | /* The PM1A register block is required */ |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 458 | |
| 459 | acpi_tb_init_generic_address(&acpi_gbl_xpm1a_enable, |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 460 | acpi_gbl_FADT.xpm1a_event_block.space_id, |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 461 | pm1_register_byte_width, |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 462 | (acpi_gbl_FADT.xpm1a_event_block.address + |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 463 | pm1_register_byte_width)); |
Alexey Starikovskiy | 45eded8 | 2007-02-02 21:48:40 -0500 | [diff] [blame] | 464 | /* Don't forget to copy space_id of the GAS */ |
Len Brown | fd35094 | 2007-05-09 23:34:35 -0400 | [diff] [blame] | 465 | acpi_gbl_xpm1a_enable.space_id = |
| 466 | acpi_gbl_FADT.xpm1a_event_block.space_id; |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 467 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 468 | /* The PM1B register block is optional, ignore if not present */ |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 469 | |
| 470 | if (acpi_gbl_FADT.xpm1b_event_block.address) { |
Jan Beulich | fcea94b | 2008-09-19 15:50:32 -0700 | [diff] [blame] | 471 | if (acpi_gbl_FADT.xpm1b_event_block.bit_width |
| 472 | != acpi_gbl_FADT.pm1_event_length * 8) |
| 473 | printk(KERN_WARNING "FADT: " |
| 474 | "X_PM1b_EVT_BLK.bit_width (%u) does not match" |
| 475 | " PM1_EVT_LEN (%u)\n", |
| 476 | acpi_gbl_FADT.xpm1b_event_block.bit_width, |
| 477 | acpi_gbl_FADT.pm1_event_length); |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 478 | acpi_tb_init_generic_address(&acpi_gbl_xpm1b_enable, |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 479 | acpi_gbl_FADT.xpm1b_event_block.space_id, |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 480 | pm1_register_byte_width, |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 481 | (acpi_gbl_FADT.xpm1b_event_block. |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 482 | address + pm1_register_byte_width)); |
Alexey Starikovskiy | 45eded8 | 2007-02-02 21:48:40 -0500 | [diff] [blame] | 483 | /* Don't forget to copy space_id of the GAS */ |
Len Brown | fd35094 | 2007-05-09 23:34:35 -0400 | [diff] [blame] | 484 | acpi_gbl_xpm1b_enable.space_id = |
Jan Beulich | fcea94b | 2008-09-19 15:50:32 -0700 | [diff] [blame] | 485 | acpi_gbl_FADT.xpm1b_event_block.space_id; |
Andi Kleen | b1d77fa | 2008-07-18 01:42:20 +0200 | [diff] [blame] | 486 | |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 487 | } |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 488 | } |
| 489 | |
| 490 | /****************************************************************************** |
| 491 | * |
| 492 | * FUNCTION: acpi_tb_validate_fadt |
| 493 | * |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 494 | * PARAMETERS: Table - Pointer to the FADT to be validated |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 495 | * |
Bob Moore | e56b638 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 496 | * RETURN: None |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 497 | * |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 498 | * DESCRIPTION: Validate various important fields within the FADT. If a problem |
| 499 | * is found, issue a message, but no status is returned. |
| 500 | * Used by both the table manager and the disassembler. |
| 501 | * |
| 502 | * Possible additional checks: |
| 503 | * (acpi_gbl_FADT.pm1_event_length >= 4) |
| 504 | * (acpi_gbl_FADT.pm1_control_length >= 2) |
| 505 | * (acpi_gbl_FADT.pm_timer_length >= 4) |
| 506 | * Gpe block lengths must be multiple of 2 |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 507 | * |
| 508 | ******************************************************************************/ |
| 509 | |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 510 | static void acpi_tb_validate_fadt(void) |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 511 | { |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 512 | char *name; |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 513 | u32 *address32; |
| 514 | struct acpi_generic_address *address64; |
| 515 | u8 length; |
Bob Moore | 67a119f | 2008-06-10 13:42:13 +0800 | [diff] [blame] | 516 | u32 i; |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 517 | |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 518 | /* |
| 519 | * Check for FACS and DSDT address mismatches. An address mismatch between |
| 520 | * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and |
| 521 | * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables. |
| 522 | */ |
| 523 | if (acpi_gbl_FADT.facs && |
| 524 | (acpi_gbl_FADT.Xfacs != (u64) acpi_gbl_FADT.facs)) { |
| 525 | ACPI_WARNING((AE_INFO, |
Bob Moore | 40774f7 | 2008-12-16 18:22:01 +0800 | [diff] [blame] | 526 | "32/64X FACS address mismatch in FADT - " |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 527 | "two FACS tables! %8.8X/%8.8X%8.8X", |
| 528 | acpi_gbl_FADT.facs, |
| 529 | ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xfacs))); |
| 530 | } |
| 531 | |
| 532 | if (acpi_gbl_FADT.dsdt && |
| 533 | (acpi_gbl_FADT.Xdsdt != (u64) acpi_gbl_FADT.dsdt)) { |
| 534 | ACPI_WARNING((AE_INFO, |
Bob Moore | 40774f7 | 2008-12-16 18:22:01 +0800 | [diff] [blame] | 535 | "32/64X DSDT address mismatch in FADT - " |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 536 | "two DSDT tables! %8.8X/%8.8X%8.8X", |
| 537 | acpi_gbl_FADT.dsdt, |
| 538 | ACPI_FORMAT_UINT64(acpi_gbl_FADT.Xdsdt))); |
| 539 | } |
| 540 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 541 | /* Examine all of the 64-bit extended address fields (X fields) */ |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 542 | |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 543 | for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 544 | /* |
| 545 | * Generate pointers to the 32-bit and 64-bit addresses, get the |
| 546 | * register length (width), and the register name |
| 547 | */ |
| 548 | address64 = ACPI_ADD_PTR(struct acpi_generic_address, |
| 549 | &acpi_gbl_FADT, |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 550 | fadt_info_table[i].address64); |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 551 | address32 = |
| 552 | ACPI_ADD_PTR(u32, &acpi_gbl_FADT, |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 553 | fadt_info_table[i].address32); |
Bob Moore | 7139284 | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 554 | length = |
| 555 | *ACPI_ADD_PTR(u8, &acpi_gbl_FADT, |
| 556 | fadt_info_table[i].length); |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 557 | name = fadt_info_table[i].name; |
| 558 | |
| 559 | /* |
| 560 | * For each extended field, check for length mismatch between the |
robert.moore@intel.com | 4b67a0e | 2008-12-31 13:07:26 +0800 | [diff] [blame] | 561 | * legacy length field and the corresponding 64-bit X length field. |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 562 | */ |
| 563 | if (address64 && (address64->bit_width != ACPI_MUL_8(length))) { |
| 564 | ACPI_WARNING((AE_INFO, |
Bob Moore | 40774f7 | 2008-12-16 18:22:01 +0800 | [diff] [blame] | 565 | "32/64X length mismatch in %s: %d/%d", |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 566 | name, ACPI_MUL_8(length), |
| 567 | address64->bit_width)); |
| 568 | } |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 569 | |
| 570 | if (fadt_info_table[i].type & ACPI_FADT_REQUIRED) { |
| 571 | /* |
| 572 | * Field is required (Pm1a_event, Pm1a_control, pm_timer). |
| 573 | * Both the address and length must be non-zero. |
| 574 | */ |
| 575 | if (!address64->address || !length) { |
| 576 | ACPI_ERROR((AE_INFO, |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 577 | "Required field %s has zero address and/or length: %8.8X%8.8X/%X", |
| 578 | name, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 579 | ACPI_FORMAT_UINT64(address64-> |
| 580 | address), |
| 581 | length)); |
| 582 | } |
| 583 | } else if (fadt_info_table[i].type & ACPI_FADT_SEPARATE_LENGTH) { |
| 584 | /* |
| 585 | * Field is optional (PM2Control, GPE0, GPE1) AND has its own |
| 586 | * length field. If present, both the address and length must be valid. |
| 587 | */ |
| 588 | if ((address64->address && !length) |
| 589 | || (!address64->address && length)) { |
| 590 | ACPI_WARNING((AE_INFO, |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 591 | "Optional field %s has zero address or length: %8.8X%8.8X/%X", |
| 592 | name, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 593 | ACPI_FORMAT_UINT64(address64-> |
| 594 | address), |
| 595 | length)); |
| 596 | } |
| 597 | } |
| 598 | |
| 599 | /* If both 32- and 64-bit addresses are valid (non-zero), they must match */ |
| 600 | |
| 601 | if (address64->address && *address32 && |
| 602 | (address64->address != (u64) * address32)) { |
| 603 | ACPI_ERROR((AE_INFO, |
Bob Moore | 40774f7 | 2008-12-16 18:22:01 +0800 | [diff] [blame] | 604 | "32/64X address mismatch in %s: %8.8X/%8.8X%8.8X, using 64X", |
Bob Moore | 06f5541 | 2008-12-31 03:06:06 +0800 | [diff] [blame] | 605 | name, *address32, |
Bob Moore | ea5d8eb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 606 | ACPI_FORMAT_UINT64(address64->address))); |
| 607 | } |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 608 | } |
Bob Moore | 95befdb | 2007-02-02 19:48:20 +0300 | [diff] [blame] | 609 | } |