|
||||
Warning, cross-references for /kernel/drivers/acpica/tbfadt.c need to be fixed.
0001 /****************************************************************************** 0002 * 0003 * Module Name: tbfadt - FADT table utilities 0004 * 0005 *****************************************************************************/ 0006 0007 /****************************************************************************** 0008 * 0009 * 1. Copyright Notice 0010 * 0011 * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. 0012 * All rights reserved. 0013 * 0014 * 2. License 0015 * 0016 * 2.1. This is your license from Intel Corp. under its intellectual property 0017 * rights. You may have additional license terms from the party that provided 0018 * you this software, covering your right to use that party's intellectual 0019 * property rights. 0020 * 0021 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 0022 * copy of the source code appearing in this file ("Covered Code") an 0023 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 0024 * base code distributed originally by Intel ("Original Intel Code") to copy, 0025 * make derivatives, distribute, use and display any portion of the Covered 0026 * Code in any form, with the right to sublicense such rights; and 0027 * 0028 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 0029 * license (with the right to sublicense), under only those claims of Intel 0030 * patents that are infringed by the Original Intel Code, to make, use, sell, 0031 * offer to sell, and import the Covered Code and derivative works thereof 0032 * solely to the minimum extent necessary to exercise the above copyright 0033 * license, and in no event shall the patent license extend to any additions 0034 * to or modifications of the Original Intel Code. No other license or right 0035 * is granted directly or by implication, estoppel or otherwise; 0036 * 0037 * The above copyright and patent license is granted only if the following 0038 * conditions are met: 0039 * 0040 * 3. Conditions 0041 * 0042 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 0043 * Redistribution of source code of any substantial portion of the Covered 0044 * Code or modification with rights to further distribute source must include 0045 * the above Copyright Notice, the above License, this list of Conditions, 0046 * and the following Disclaimer and Export Compliance provision. In addition, 0047 * Licensee must cause all Covered Code to which Licensee contributes to 0048 * contain a file documenting the changes Licensee made to create that Covered 0049 * Code and the date of any change. Licensee must include in that file the 0050 * documentation of any changes made by any predecessor Licensee. Licensee 0051 * must include a prominent statement that the modification is derived, 0052 * directly or indirectly, from Original Intel Code. 0053 * 0054 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 0055 * Redistribution of source code of any substantial portion of the Covered 0056 * Code or modification without rights to further distribute source must 0057 * include the following Disclaimer and Export Compliance provision in the 0058 * documentation and/or other materials provided with distribution. In 0059 * addition, Licensee may not authorize further sublicense of source of any 0060 * portion of the Covered Code, and must include terms to the effect that the 0061 * license from Licensee to its licensee is limited to the intellectual 0062 * property embodied in the software Licensee provides to its licensee, and 0063 * not to intellectual property embodied in modifications its licensee may 0064 * make. 0065 * 0066 * 3.3. Redistribution of Executable. Redistribution in executable form of any 0067 * substantial portion of the Covered Code or modification must reproduce the 0068 * above Copyright Notice, and the following Disclaimer and Export Compliance 0069 * provision in the documentation and/or other materials provided with the 0070 * distribution. 0071 * 0072 * 3.4. Intel retains all right, title, and interest in and to the Original 0073 * Intel Code. 0074 * 0075 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 0076 * Intel shall be used in advertising or otherwise to promote the sale, use or 0077 * other dealings in products derived from or relating to the Covered Code 0078 * without prior written authorization from Intel. 0079 * 0080 * 4. Disclaimer and Export Compliance 0081 * 0082 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 0083 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 0084 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 0085 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 0086 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 0087 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 0088 * PARTICULAR PURPOSE. 0089 * 0090 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 0091 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 0092 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 0093 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 0094 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 0095 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 0096 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 0097 * LIMITED REMEDY. 0098 * 0099 * 4.3. Licensee shall not export, either directly or indirectly, any of this 0100 * software or system incorporating such software without first obtaining any 0101 * required license or other approval from the U. S. Department of Commerce or 0102 * any other agency or department of the United States Government. In the 0103 * event Licensee exports any such software from the United States or 0104 * re-exports any such software from a foreign destination, Licensee shall 0105 * ensure that the distribution and export/re-export of the software is in 0106 * compliance with all laws, regulations, orders, or other restrictions of the 0107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 0108 * any of its subsidiaries will export/re-export any technical data, process, 0109 * software, or service, directly or indirectly, to any country for which the 0110 * United States government or any agency thereof requires an export license, 0111 * other governmental approval, or letter of assurance, without first obtaining 0112 * such license, approval or letter. 0113 * 0114 *****************************************************************************/ 0115 0116 #define __TBFADT_C__ 0117 0118 #include "acpi.h" 0119 #include "accommon.h" 0120 #include "actables.h" 0121 0122 #define _COMPONENT ACPI_TABLES 0123 ACPI_MODULE_NAME ("tbfadt") 0124 0125 /* Local prototypes */ 0126 0127 static inline void 0128 AcpiTbInitGenericAddress ( 0129 ACPI_GENERIC_ADDRESS *GenericAddress, 0130 UINT8 SpaceId, 0131 UINT8 ByteWidth, 0132 UINT64 Address); 0133 0134 static void 0135 AcpiTbConvertFadt ( 0136 void); 0137 0138 static void 0139 AcpiTbValidateFadt ( 0140 void); 0141 0142 static void 0143 AcpiTbSetupFadtRegisters ( 0144 void); 0145 0146 0147 /* Table for conversion of FADT to common internal format and FADT validation */ 0148 0149 typedef struct acpi_fadt_info 0150 { 0151 char *Name; 0152 UINT8 Address64; 0153 UINT8 Address32; 0154 UINT8 Length; 0155 UINT8 DefaultLength; 0156 UINT8 Type; 0157 0158 } ACPI_FADT_INFO; 0159 0160 #define ACPI_FADT_REQUIRED 1 0161 #define ACPI_FADT_SEPARATE_LENGTH 2 0162 0163 static ACPI_FADT_INFO FadtInfoTable[] = 0164 { 0165 {"Pm1aEventBlock", 0166 ACPI_FADT_OFFSET (XPm1aEventBlock), 0167 ACPI_FADT_OFFSET (Pm1aEventBlock), 0168 ACPI_FADT_OFFSET (Pm1EventLength), 0169 ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ 0170 ACPI_FADT_REQUIRED}, 0171 0172 {"Pm1bEventBlock", 0173 ACPI_FADT_OFFSET (XPm1bEventBlock), 0174 ACPI_FADT_OFFSET (Pm1bEventBlock), 0175 ACPI_FADT_OFFSET (Pm1EventLength), 0176 ACPI_PM1_REGISTER_WIDTH * 2, /* Enable + Status register */ 0177 0}, 0178 0179 {"Pm1aControlBlock", 0180 ACPI_FADT_OFFSET (XPm1aControlBlock), 0181 ACPI_FADT_OFFSET (Pm1aControlBlock), 0182 ACPI_FADT_OFFSET (Pm1ControlLength), 0183 ACPI_PM1_REGISTER_WIDTH, 0184 ACPI_FADT_REQUIRED}, 0185 0186 {"Pm1bControlBlock", 0187 ACPI_FADT_OFFSET (XPm1bControlBlock), 0188 ACPI_FADT_OFFSET (Pm1bControlBlock), 0189 ACPI_FADT_OFFSET (Pm1ControlLength), 0190 ACPI_PM1_REGISTER_WIDTH, 0191 0}, 0192 0193 {"Pm2ControlBlock", 0194 ACPI_FADT_OFFSET (XPm2ControlBlock), 0195 ACPI_FADT_OFFSET (Pm2ControlBlock), 0196 ACPI_FADT_OFFSET (Pm2ControlLength), 0197 ACPI_PM2_REGISTER_WIDTH, 0198 ACPI_FADT_SEPARATE_LENGTH}, 0199 0200 {"PmTimerBlock", 0201 ACPI_FADT_OFFSET (XPmTimerBlock), 0202 ACPI_FADT_OFFSET (PmTimerBlock), 0203 ACPI_FADT_OFFSET (PmTimerLength), 0204 ACPI_PM_TIMER_WIDTH, 0205 ACPI_FADT_REQUIRED}, 0206 0207 {"Gpe0Block", 0208 ACPI_FADT_OFFSET (XGpe0Block), 0209 ACPI_FADT_OFFSET (Gpe0Block), 0210 ACPI_FADT_OFFSET (Gpe0BlockLength), 0211 0, 0212 ACPI_FADT_SEPARATE_LENGTH}, 0213 0214 {"Gpe1Block", 0215 ACPI_FADT_OFFSET (XGpe1Block), 0216 ACPI_FADT_OFFSET (Gpe1Block), 0217 ACPI_FADT_OFFSET (Gpe1BlockLength), 0218 0, 0219 ACPI_FADT_SEPARATE_LENGTH} 0220 }; 0221 0222 #define ACPI_FADT_INFO_ENTRIES \ 0223 (sizeof (FadtInfoTable) / sizeof (ACPI_FADT_INFO)) 0224 0225 0226 /* Table used to split Event Blocks into separate status/enable registers */ 0227 0228 typedef struct acpi_fadt_pm_info 0229 { 0230 ACPI_GENERIC_ADDRESS *Target; 0231 UINT8 Source; 0232 UINT8 RegisterNum; 0233 0234 } ACPI_FADT_PM_INFO; 0235 0236 static ACPI_FADT_PM_INFO FadtPmInfoTable[] = 0237 { 0238 {&AcpiGbl_XPm1aStatus, 0239 ACPI_FADT_OFFSET (XPm1aEventBlock), 0240 0}, 0241 0242 {&AcpiGbl_XPm1aEnable, 0243 ACPI_FADT_OFFSET (XPm1aEventBlock), 0244 1}, 0245 0246 {&AcpiGbl_XPm1bStatus, 0247 ACPI_FADT_OFFSET (XPm1bEventBlock), 0248 0}, 0249 0250 {&AcpiGbl_XPm1bEnable, 0251 ACPI_FADT_OFFSET (XPm1bEventBlock), 0252 1} 0253 }; 0254 0255 #define ACPI_FADT_PM_INFO_ENTRIES \ 0256 (sizeof (FadtPmInfoTable) / sizeof (ACPI_FADT_PM_INFO)) 0257 0258 0259 /******************************************************************************* 0260 * 0261 * FUNCTION: AcpiTbInitGenericAddress 0262 * 0263 * PARAMETERS: GenericAddress - GAS struct to be initialized 0264 * SpaceId - ACPI Space ID for this register 0265 * ByteWidth - Width of this register, in bytes 0266 * Address - Address of the register 0267 * 0268 * RETURN: None 0269 * 0270 * DESCRIPTION: Initialize a Generic Address Structure (GAS) 0271 * See the ACPI specification for a full description and 0272 * definition of this structure. 0273 * 0274 ******************************************************************************/ 0275 0276 static inline void 0277 AcpiTbInitGenericAddress ( 0278 ACPI_GENERIC_ADDRESS *GenericAddress, 0279 UINT8 SpaceId, 0280 UINT8 ByteWidth, 0281 UINT64 Address) 0282 { 0283 0284 /* 0285 * The 64-bit Address field is non-aligned in the byte packed 0286 * GAS struct. 0287 */ 0288 ACPI_MOVE_64_TO_64 (&GenericAddress->Address, &Address); 0289 0290 /* All other fields are byte-wide */ 0291 0292 GenericAddress->SpaceId = SpaceId; 0293 GenericAddress->BitWidth = (UINT8) ACPI_MUL_8 (ByteWidth); 0294 GenericAddress->BitOffset = 0; 0295 GenericAddress->AccessWidth = 0; /* Access width ANY */ 0296 } 0297 0298 0299 /******************************************************************************* 0300 * 0301 * FUNCTION: AcpiTbParseFadt 0302 * 0303 * PARAMETERS: TableIndex - Index for the FADT 0304 * 0305 * RETURN: None 0306 * 0307 * DESCRIPTION: Initialize the FADT, DSDT and FACS tables 0308 * (FADT contains the addresses of the DSDT and FACS) 0309 * 0310 ******************************************************************************/ 0311 0312 void 0313 AcpiTbParseFadt ( 0314 UINT32 TableIndex) 0315 { 0316 UINT32 Length; 0317 ACPI_TABLE_HEADER *Table; 0318 0319 0320 /* 0321 * The FADT has multiple versions with different lengths, 0322 * and it contains pointers to both the DSDT and FACS tables. 0323 * 0324 * Get a local copy of the FADT and convert it to a common format 0325 * Map entire FADT, assumed to be smaller than one page. 0326 */ 0327 Length = AcpiGbl_RootTableList.Tables[TableIndex].Length; 0328 0329 Table = AcpiOsMapMemory ( 0330 AcpiGbl_RootTableList.Tables[TableIndex].Address, Length); 0331 if (!Table) 0332 { 0333 return; 0334 } 0335 0336 /* 0337 * Validate the FADT checksum before we copy the table. Ignore 0338 * checksum error as we want to try to get the DSDT and FACS. 0339 */ 0340 (void) AcpiTbVerifyChecksum (Table, Length); 0341 0342 /* Create a local copy of the FADT in common ACPI 2.0+ format */ 0343 0344 AcpiTbCreateLocalFadt (Table, Length); 0345 0346 /* All done with the real FADT, unmap it */ 0347 0348 AcpiOsUnmapMemory (Table, Length); 0349 0350 /* Obtain the DSDT and FACS tables via their addresses within the FADT */ 0351 0352 AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XDsdt, 0353 ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); 0354 0355 AcpiTbInstallTable ((ACPI_PHYSICAL_ADDRESS) AcpiGbl_FADT.XFacs, 0356 ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); 0357 } 0358 0359 0360 /******************************************************************************* 0361 * 0362 * FUNCTION: AcpiTbCreateLocalFadt 0363 * 0364 * PARAMETERS: Table - Pointer to BIOS FADT 0365 * Length - Length of the table 0366 * 0367 * RETURN: None 0368 * 0369 * DESCRIPTION: Get a local copy of the FADT and convert it to a common format. 0370 * Performs validation on some important FADT fields. 0371 * 0372 * NOTE: We create a local copy of the FADT regardless of the version. 0373 * 0374 ******************************************************************************/ 0375 0376 void 0377 AcpiTbCreateLocalFadt ( 0378 ACPI_TABLE_HEADER *Table, 0379 UINT32 Length) 0380 { 0381 0382 /* 0383 * Check if the FADT is larger than the largest table that we expect 0384 * (the ACPI 2.0/3.0 version). If so, truncate the table, and issue 0385 * a warning. 0386 */ 0387 if (Length > sizeof (ACPI_TABLE_FADT)) 0388 { 0389 ACPI_WARNING ((AE_INFO, 0390 "FADT (revision %u) is longer than ACPI 2.0 version, " 0391 "truncating length 0x%X to 0x%X", 0392 Table->Revision, Length, (UINT32) sizeof (ACPI_TABLE_FADT))); 0393 } 0394 0395 /* Clear the entire local FADT */ 0396 0397 ACPI_MEMSET (&AcpiGbl_FADT, 0, sizeof (ACPI_TABLE_FADT)); 0398 0399 /* Copy the original FADT, up to sizeof (ACPI_TABLE_FADT) */ 0400 0401 ACPI_MEMCPY (&AcpiGbl_FADT, Table, 0402 ACPI_MIN (Length, sizeof (ACPI_TABLE_FADT))); 0403 0404 /* Convert the local copy of the FADT to the common internal format */ 0405 0406 AcpiTbConvertFadt (); 0407 0408 /* Validate FADT values now, before we make any changes */ 0409 0410 AcpiTbValidateFadt (); 0411 0412 /* Initialize the global ACPI register structures */ 0413 0414 AcpiTbSetupFadtRegisters (); 0415 } 0416 0417 0418 /******************************************************************************* 0419 * 0420 * FUNCTION: AcpiTbConvertFadt 0421 * 0422 * PARAMETERS: None, uses AcpiGbl_FADT 0423 * 0424 * RETURN: None 0425 * 0426 * DESCRIPTION: Converts all versions of the FADT to a common internal format. 0427 * Expand 32-bit addresses to 64-bit as necessary. 0428 * 0429 * NOTE: AcpiGbl_FADT must be of size (ACPI_TABLE_FADT), 0430 * and must contain a copy of the actual FADT. 0431 * 0432 * Notes on 64-bit register addresses: 0433 * 0434 * After this FADT conversion, later ACPICA code will only use the 64-bit "X" 0435 * fields of the FADT for all ACPI register addresses. 0436 * 0437 * The 64-bit "X" fields are optional extensions to the original 32-bit FADT 0438 * V1.0 fields. Even if they are present in the FADT, they are optional and 0439 * are unused if the BIOS sets them to zero. Therefore, we must copy/expand 0440 * 32-bit V1.0 fields if the corresponding X field is zero. 0441 * 0442 * For ACPI 1.0 FADTs, all 32-bit address fields are expanded to the 0443 * corresponding "X" fields in the internal FADT. 0444 * 0445 * For ACPI 2.0+ FADTs, all valid (non-zero) 32-bit address fields are expanded 0446 * to the corresponding 64-bit X fields. For compatibility with other ACPI 0447 * implementations, we ignore the 64-bit field if the 32-bit field is valid, 0448 * regardless of whether the host OS is 32-bit or 64-bit. 0449 * 0450 ******************************************************************************/ 0451 0452 static void 0453 AcpiTbConvertFadt ( 0454 void) 0455 { 0456 ACPI_GENERIC_ADDRESS *Address64; 0457 UINT32 Address32; 0458 UINT32 i; 0459 0460 0461 /* Update the local FADT table header length */ 0462 0463 AcpiGbl_FADT.Header.Length = sizeof (ACPI_TABLE_FADT); 0464 0465 /* 0466 * Expand the 32-bit FACS and DSDT addresses to 64-bit as necessary. 0467 * Later code will always use the X 64-bit field. 0468 */ 0469 if (!AcpiGbl_FADT.XFacs) 0470 { 0471 AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs; 0472 } 0473 if (!AcpiGbl_FADT.XDsdt) 0474 { 0475 AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt; 0476 } 0477 0478 /* 0479 * For ACPI 1.0 FADTs (revision 1 or 2), ensure that reserved fields which 0480 * should be zero are indeed zero. This will workaround BIOSs that 0481 * inadvertently place values in these fields. 0482 * 0483 * The ACPI 1.0 reserved fields that will be zeroed are the bytes located 0484 * at offset 45, 55, 95, and the word located at offset 109, 110. 0485 */ 0486 if (AcpiGbl_FADT.Header.Revision < 3) 0487 { 0488 AcpiGbl_FADT.PreferredProfile = 0; 0489 AcpiGbl_FADT.PstateControl = 0; 0490 AcpiGbl_FADT.CstControl = 0; 0491 AcpiGbl_FADT.BootFlags = 0; 0492 } 0493 0494 /* 0495 * Expand the ACPI 1.0 32-bit addresses to the ACPI 2.0 64-bit "X" 0496 * generic address structures as necessary. Later code will always use 0497 * the 64-bit address structures. 0498 * 0499 * March 2009: 0500 * We now always use the 32-bit address if it is valid (non-null). This 0501 * is not in accordance with the ACPI specification which states that 0502 * the 64-bit address supersedes the 32-bit version, but we do this for 0503 * compatibility with other ACPI implementations. Most notably, in the 0504 * case where both the 32 and 64 versions are non-null, we use the 32-bit 0505 * version. This is the only address that is guaranteed to have been 0506 * tested by the BIOS manufacturer. 0507 */ 0508 for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) 0509 { 0510 Address32 = *ACPI_ADD_PTR (UINT32, 0511 &AcpiGbl_FADT, FadtInfoTable[i].Address32); 0512 0513 Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, 0514 &AcpiGbl_FADT, FadtInfoTable[i].Address64); 0515 0516 /* 0517 * If both 32- and 64-bit addresses are valid (non-zero), 0518 * they must match. 0519 */ 0520 if (Address64->Address && Address32 && 0521 (Address64->Address != (UINT64) Address32)) 0522 { 0523 ACPI_ERROR ((AE_INFO, 0524 "32/64X address mismatch in %s: %8.8X/%8.8X%8.8X, using 32", 0525 FadtInfoTable[i].Name, Address32, 0526 ACPI_FORMAT_UINT64 (Address64->Address))); 0527 } 0528 0529 /* Always use 32-bit address if it is valid (non-null) */ 0530 0531 if (Address32) 0532 { 0533 /* 0534 * Copy the 32-bit address to the 64-bit GAS structure. The 0535 * Space ID is always I/O for 32-bit legacy address fields 0536 */ 0537 AcpiTbInitGenericAddress (Address64, ACPI_ADR_SPACE_SYSTEM_IO, 0538 *ACPI_ADD_PTR (UINT8, &AcpiGbl_FADT, FadtInfoTable[i].Length), 0539 (UINT64) Address32); 0540 } 0541 } 0542 } 0543 0544 0545 /******************************************************************************* 0546 * 0547 * FUNCTION: AcpiTbValidateFadt 0548 * 0549 * PARAMETERS: Table - Pointer to the FADT to be validated 0550 * 0551 * RETURN: None 0552 * 0553 * DESCRIPTION: Validate various important fields within the FADT. If a problem 0554 * is found, issue a message, but no status is returned. 0555 * Used by both the table manager and the disassembler. 0556 * 0557 * Possible additional checks: 0558 * (AcpiGbl_FADT.Pm1EventLength >= 4) 0559 * (AcpiGbl_FADT.Pm1ControlLength >= 2) 0560 * (AcpiGbl_FADT.PmTimerLength >= 4) 0561 * Gpe block lengths must be multiple of 2 0562 * 0563 ******************************************************************************/ 0564 0565 static void 0566 AcpiTbValidateFadt ( 0567 void) 0568 { 0569 char *Name; 0570 ACPI_GENERIC_ADDRESS *Address64; 0571 UINT8 Length; 0572 UINT32 i; 0573 0574 0575 /* 0576 * Check for FACS and DSDT address mismatches. An address mismatch between 0577 * the 32-bit and 64-bit address fields (FIRMWARE_CTRL/X_FIRMWARE_CTRL and 0578 * DSDT/X_DSDT) would indicate the presence of two FACS or two DSDT tables. 0579 */ 0580 if (AcpiGbl_FADT.Facs && 0581 (AcpiGbl_FADT.XFacs != (UINT64) AcpiGbl_FADT.Facs)) 0582 { 0583 ACPI_WARNING ((AE_INFO, 0584 "32/64X FACS address mismatch in FADT - " 0585 "%8.8X/%8.8X%8.8X, using 32", 0586 AcpiGbl_FADT.Facs, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XFacs))); 0587 0588 AcpiGbl_FADT.XFacs = (UINT64) AcpiGbl_FADT.Facs; 0589 } 0590 0591 if (AcpiGbl_FADT.Dsdt && 0592 (AcpiGbl_FADT.XDsdt != (UINT64) AcpiGbl_FADT.Dsdt)) 0593 { 0594 ACPI_WARNING ((AE_INFO, 0595 "32/64X DSDT address mismatch in FADT - " 0596 "%8.8X/%8.8X%8.8X, using 32", 0597 AcpiGbl_FADT.Dsdt, ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XDsdt))); 0598 0599 AcpiGbl_FADT.XDsdt = (UINT64) AcpiGbl_FADT.Dsdt; 0600 } 0601 0602 /* Examine all of the 64-bit extended address fields (X fields) */ 0603 0604 for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) 0605 { 0606 /* 0607 * Generate pointer to the 64-bit address, get the register 0608 * length (width) and the register name 0609 */ 0610 Address64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, 0611 &AcpiGbl_FADT, FadtInfoTable[i].Address64); 0612 Length = *ACPI_ADD_PTR (UINT8, 0613 &AcpiGbl_FADT, FadtInfoTable[i].Length); 0614 Name = FadtInfoTable[i].Name; 0615 0616 /* 0617 * For each extended field, check for length mismatch between the 0618 * legacy length field and the corresponding 64-bit X length field. 0619 */ 0620 if (Address64->Address && 0621 (Address64->BitWidth != ACPI_MUL_8 (Length))) 0622 { 0623 ACPI_WARNING ((AE_INFO, 0624 "32/64X length mismatch in %s: %d/%d", 0625 Name, ACPI_MUL_8 (Length), Address64->BitWidth)); 0626 } 0627 0628 if (FadtInfoTable[i].Type & ACPI_FADT_REQUIRED) 0629 { 0630 /* 0631 * Field is required (PM1aEvent, PM1aControl, PmTimer). 0632 * Both the address and length must be non-zero. 0633 */ 0634 if (!Address64->Address || !Length) 0635 { 0636 ACPI_ERROR ((AE_INFO, 0637 "Required field %s has zero address and/or length:" 0638 " %8.8X%8.8X/%X", 0639 Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); 0640 } 0641 } 0642 else if (FadtInfoTable[i].Type & ACPI_FADT_SEPARATE_LENGTH) 0643 { 0644 /* 0645 * Field is optional (PM2Control, GPE0, GPE1) AND has its own 0646 * length field. If present, both the address and length must 0647 * be valid. 0648 */ 0649 if ((Address64->Address && !Length) || 0650 (!Address64->Address && Length)) 0651 { 0652 ACPI_WARNING ((AE_INFO, 0653 "Optional field %s has zero address or length: " 0654 "%8.8X%8.8X/%X", 0655 Name, ACPI_FORMAT_UINT64 (Address64->Address), Length)); 0656 } 0657 } 0658 } 0659 } 0660 0661 0662 /******************************************************************************* 0663 * 0664 * FUNCTION: AcpiTbSetupFadtRegisters 0665 * 0666 * PARAMETERS: None, uses AcpiGbl_FADT. 0667 * 0668 * RETURN: None 0669 * 0670 * DESCRIPTION: Initialize global ACPI PM1 register definitions. Optionally, 0671 * force FADT register definitions to their default lengths. 0672 * 0673 ******************************************************************************/ 0674 0675 static void 0676 AcpiTbSetupFadtRegisters ( 0677 void) 0678 { 0679 ACPI_GENERIC_ADDRESS *Target64; 0680 ACPI_GENERIC_ADDRESS *Source64; 0681 UINT8 Pm1RegisterByteWidth; 0682 UINT32 i; 0683 0684 0685 /* 0686 * Optionally check all register lengths against the default values and 0687 * update them if they are incorrect. 0688 */ 0689 if (AcpiGbl_UseDefaultRegisterWidths) 0690 { 0691 for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) 0692 { 0693 Target64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, 0694 FadtInfoTable[i].Address64); 0695 0696 /* 0697 * If a valid register (Address != 0) and the (DefaultLength > 0) 0698 * (Not a GPE register), then check the width against the default. 0699 */ 0700 if ((Target64->Address) && 0701 (FadtInfoTable[i].DefaultLength > 0) && 0702 (FadtInfoTable[i].DefaultLength != Target64->BitWidth)) 0703 { 0704 ACPI_WARNING ((AE_INFO, 0705 "Invalid length for %s: %d, using default %d", 0706 FadtInfoTable[i].Name, Target64->BitWidth, 0707 FadtInfoTable[i].DefaultLength)); 0708 0709 /* Incorrect size, set width to the default */ 0710 0711 Target64->BitWidth = FadtInfoTable[i].DefaultLength; 0712 } 0713 } 0714 } 0715 0716 /* 0717 * Get the length of the individual PM1 registers (enable and status). 0718 * Each register is defined to be (event block length / 2). Extra divide 0719 * by 8 converts bits to bytes. 0720 */ 0721 Pm1RegisterByteWidth = (UINT8) 0722 ACPI_DIV_16 (AcpiGbl_FADT.XPm1aEventBlock.BitWidth); 0723 0724 /* 0725 * Calculate separate GAS structs for the PM1x (A/B) Status and Enable 0726 * registers. These addresses do not appear (directly) in the FADT, so it 0727 * is useful to pre-calculate them from the PM1 Event Block definitions. 0728 * 0729 * The PM event blocks are split into two register blocks, first is the 0730 * PM Status Register block, followed immediately by the PM Enable 0731 * Register block. Each is of length (Pm1EventLength/2) 0732 * 0733 * Note: The PM1A event block is required by the ACPI specification. 0734 * However, the PM1B event block is optional and is rarely, if ever, 0735 * used. 0736 */ 0737 0738 for (i = 0; i < ACPI_FADT_PM_INFO_ENTRIES; i++) 0739 { 0740 Source64 = ACPI_ADD_PTR (ACPI_GENERIC_ADDRESS, &AcpiGbl_FADT, 0741 FadtPmInfoTable[i].Source); 0742 0743 if (Source64->Address) 0744 { 0745 AcpiTbInitGenericAddress (FadtPmInfoTable[i].Target, 0746 Source64->SpaceId, Pm1RegisterByteWidth, 0747 Source64->Address + 0748 (FadtPmInfoTable[i].RegisterNum * Pm1RegisterByteWidth)); 0749 } 0750 } 0751 } 0752
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 1.2.0 LXR engine. |