![]() |
|
|||
File indexing completed on 2025-05-11 08:24:02
0001 /****************************************************************************** 0002 * 0003 * Module Name: evgpeblk - GPE block creation and initialization. 0004 * 0005 *****************************************************************************/ 0006 0007 /****************************************************************************** 0008 * 0009 * 1. Copyright Notice 0010 * 0011 * Some or all of this work - Copyright (c) 1999 - 2024, 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 * Alternatively, you may choose to be licensed under the terms of the 0117 * following license: 0118 * 0119 * Redistribution and use in source and binary forms, with or without 0120 * modification, are permitted provided that the following conditions 0121 * are met: 0122 * 1. Redistributions of source code must retain the above copyright 0123 * notice, this list of conditions, and the following disclaimer, 0124 * without modification. 0125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 0126 * substantially similar to the "NO WARRANTY" disclaimer below 0127 * ("Disclaimer") and any redistribution must be conditioned upon 0128 * including a substantially similar Disclaimer requirement for further 0129 * binary redistribution. 0130 * 3. Neither the names of the above-listed copyright holders nor the names 0131 * of any contributors may be used to endorse or promote products derived 0132 * from this software without specific prior written permission. 0133 * 0134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 0135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 0136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 0137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 0138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 0139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 0140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 0141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 0142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 0143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 0144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 0145 * 0146 * Alternatively, you may choose to be licensed under the terms of the 0147 * GNU General Public License ("GPL") version 2 as published by the Free 0148 * Software Foundation. 0149 * 0150 *****************************************************************************/ 0151 0152 #include "acpi.h" 0153 #include "accommon.h" 0154 #include "acevents.h" 0155 #include "acnamesp.h" 0156 0157 #define _COMPONENT ACPI_EVENTS 0158 ACPI_MODULE_NAME ("evgpeblk") 0159 0160 #if (!ACPI_REDUCED_HARDWARE) /* Entire module */ 0161 0162 /* Local prototypes */ 0163 0164 static ACPI_STATUS 0165 AcpiEvInstallGpeBlock ( 0166 ACPI_GPE_BLOCK_INFO *GpeBlock, 0167 UINT32 InterruptNumber); 0168 0169 static ACPI_STATUS 0170 AcpiEvCreateGpeInfoBlocks ( 0171 ACPI_GPE_BLOCK_INFO *GpeBlock); 0172 0173 0174 /******************************************************************************* 0175 * 0176 * FUNCTION: AcpiEvInstallGpeBlock 0177 * 0178 * PARAMETERS: GpeBlock - New GPE block 0179 * InterruptNumber - Xrupt to be associated with this 0180 * GPE block 0181 * 0182 * RETURN: Status 0183 * 0184 * DESCRIPTION: Install new GPE block with mutex support 0185 * 0186 ******************************************************************************/ 0187 0188 static ACPI_STATUS 0189 AcpiEvInstallGpeBlock ( 0190 ACPI_GPE_BLOCK_INFO *GpeBlock, 0191 UINT32 InterruptNumber) 0192 { 0193 ACPI_GPE_BLOCK_INFO *NextGpeBlock; 0194 ACPI_GPE_XRUPT_INFO *GpeXruptBlock; 0195 ACPI_STATUS Status; 0196 ACPI_CPU_FLAGS Flags; 0197 0198 0199 ACPI_FUNCTION_TRACE (EvInstallGpeBlock); 0200 0201 0202 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); 0203 if (ACPI_FAILURE (Status)) 0204 { 0205 return_ACPI_STATUS (Status); 0206 } 0207 0208 Status = AcpiEvGetGpeXruptBlock (InterruptNumber, &GpeXruptBlock); 0209 if (ACPI_FAILURE (Status)) 0210 { 0211 goto UnlockAndExit; 0212 } 0213 0214 /* Install the new block at the end of the list with lock */ 0215 0216 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); 0217 if (GpeXruptBlock->GpeBlockListHead) 0218 { 0219 NextGpeBlock = GpeXruptBlock->GpeBlockListHead; 0220 while (NextGpeBlock->Next) 0221 { 0222 NextGpeBlock = NextGpeBlock->Next; 0223 } 0224 0225 NextGpeBlock->Next = GpeBlock; 0226 GpeBlock->Previous = NextGpeBlock; 0227 } 0228 else 0229 { 0230 GpeXruptBlock->GpeBlockListHead = GpeBlock; 0231 } 0232 0233 GpeBlock->XruptBlock = GpeXruptBlock; 0234 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); 0235 0236 0237 UnlockAndExit: 0238 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); 0239 return_ACPI_STATUS (Status); 0240 } 0241 0242 0243 /******************************************************************************* 0244 * 0245 * FUNCTION: AcpiEvDeleteGpeBlock 0246 * 0247 * PARAMETERS: GpeBlock - Existing GPE block 0248 * 0249 * RETURN: Status 0250 * 0251 * DESCRIPTION: Remove a GPE block 0252 * 0253 ******************************************************************************/ 0254 0255 ACPI_STATUS 0256 AcpiEvDeleteGpeBlock ( 0257 ACPI_GPE_BLOCK_INFO *GpeBlock) 0258 { 0259 ACPI_STATUS Status; 0260 ACPI_CPU_FLAGS Flags; 0261 0262 0263 ACPI_FUNCTION_TRACE (EvInstallGpeBlock); 0264 0265 0266 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); 0267 if (ACPI_FAILURE (Status)) 0268 { 0269 return_ACPI_STATUS (Status); 0270 } 0271 0272 /* Disable all GPEs in this block */ 0273 0274 Status = AcpiHwDisableGpeBlock (GpeBlock->XruptBlock, GpeBlock, NULL); 0275 if (ACPI_FAILURE (Status)) 0276 { 0277 return_ACPI_STATUS (Status); 0278 } 0279 0280 if (!GpeBlock->Previous && !GpeBlock->Next) 0281 { 0282 /* This is the last GpeBlock on this interrupt */ 0283 0284 Status = AcpiEvDeleteGpeXrupt (GpeBlock->XruptBlock); 0285 if (ACPI_FAILURE (Status)) 0286 { 0287 goto UnlockAndExit; 0288 } 0289 } 0290 else 0291 { 0292 /* Remove the block on this interrupt with lock */ 0293 0294 Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock); 0295 if (GpeBlock->Previous) 0296 { 0297 GpeBlock->Previous->Next = GpeBlock->Next; 0298 } 0299 else 0300 { 0301 GpeBlock->XruptBlock->GpeBlockListHead = GpeBlock->Next; 0302 } 0303 0304 if (GpeBlock->Next) 0305 { 0306 GpeBlock->Next->Previous = GpeBlock->Previous; 0307 } 0308 0309 AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags); 0310 } 0311 0312 AcpiCurrentGpeCount -= GpeBlock->GpeCount; 0313 0314 /* Free the GpeBlock */ 0315 0316 ACPI_FREE (GpeBlock->RegisterInfo); 0317 ACPI_FREE (GpeBlock->EventInfo); 0318 ACPI_FREE (GpeBlock); 0319 0320 UnlockAndExit: 0321 Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS); 0322 return_ACPI_STATUS (Status); 0323 } 0324 0325 0326 /******************************************************************************* 0327 * 0328 * FUNCTION: AcpiEvCreateGpeInfoBlocks 0329 * 0330 * PARAMETERS: GpeBlock - New GPE block 0331 * 0332 * RETURN: Status 0333 * 0334 * DESCRIPTION: Create the RegisterInfo and EventInfo blocks for this GPE block 0335 * 0336 ******************************************************************************/ 0337 0338 static ACPI_STATUS 0339 AcpiEvCreateGpeInfoBlocks ( 0340 ACPI_GPE_BLOCK_INFO *GpeBlock) 0341 { 0342 ACPI_GPE_REGISTER_INFO *GpeRegisterInfo = NULL; 0343 ACPI_GPE_EVENT_INFO *GpeEventInfo = NULL; 0344 ACPI_GPE_EVENT_INFO *ThisEvent; 0345 ACPI_GPE_REGISTER_INFO *ThisRegister; 0346 UINT32 i; 0347 UINT32 j; 0348 ACPI_STATUS Status; 0349 0350 0351 ACPI_FUNCTION_TRACE (EvCreateGpeInfoBlocks); 0352 0353 0354 /* Allocate the GPE register information block */ 0355 0356 GpeRegisterInfo = ACPI_ALLOCATE_ZEROED ( 0357 (ACPI_SIZE) GpeBlock->RegisterCount * 0358 sizeof (ACPI_GPE_REGISTER_INFO)); 0359 if (!GpeRegisterInfo) 0360 { 0361 ACPI_ERROR ((AE_INFO, 0362 "Could not allocate the GpeRegisterInfo table")); 0363 return_ACPI_STATUS (AE_NO_MEMORY); 0364 } 0365 0366 /* 0367 * Allocate the GPE EventInfo block. There are eight distinct GPEs 0368 * per register. Initialization to zeros is sufficient. 0369 */ 0370 GpeEventInfo = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) GpeBlock->GpeCount * 0371 sizeof (ACPI_GPE_EVENT_INFO)); 0372 if (!GpeEventInfo) 0373 { 0374 ACPI_ERROR ((AE_INFO, 0375 "Could not allocate the GpeEventInfo table")); 0376 Status = AE_NO_MEMORY; 0377 goto ErrorExit; 0378 } 0379 0380 /* Save the new Info arrays in the GPE block */ 0381 0382 GpeBlock->RegisterInfo = GpeRegisterInfo; 0383 GpeBlock->EventInfo = GpeEventInfo; 0384 0385 /* 0386 * Initialize the GPE Register and Event structures. A goal of these 0387 * tables is to hide the fact that there are two separate GPE register 0388 * sets in a given GPE hardware block, the status registers occupy the 0389 * first half, and the enable registers occupy the second half. 0390 */ 0391 ThisRegister = GpeRegisterInfo; 0392 ThisEvent = GpeEventInfo; 0393 0394 for (i = 0; i < GpeBlock->RegisterCount; i++) 0395 { 0396 /* Init the RegisterInfo for this GPE register (8 GPEs) */ 0397 0398 ThisRegister->BaseGpeNumber = (UINT16) 0399 (GpeBlock->BlockBaseNumber + (i * ACPI_GPE_REGISTER_WIDTH)); 0400 0401 ThisRegister->StatusAddress.Address = 0402 GpeBlock->Address + i; 0403 0404 ThisRegister->EnableAddress.Address = 0405 GpeBlock->Address + i + GpeBlock->RegisterCount; 0406 0407 ThisRegister->StatusAddress.SpaceId = GpeBlock->SpaceId; 0408 ThisRegister->EnableAddress.SpaceId = GpeBlock->SpaceId; 0409 ThisRegister->StatusAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; 0410 ThisRegister->EnableAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH; 0411 ThisRegister->StatusAddress.BitOffset = 0; 0412 ThisRegister->EnableAddress.BitOffset = 0; 0413 0414 /* Init the EventInfo for each GPE within this register */ 0415 0416 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) 0417 { 0418 ThisEvent->GpeNumber = (UINT8) (ThisRegister->BaseGpeNumber + j); 0419 ThisEvent->RegisterInfo = ThisRegister; 0420 ThisEvent++; 0421 } 0422 0423 /* Disable all GPEs within this register */ 0424 0425 Status = AcpiHwWrite (0x00, &ThisRegister->EnableAddress); 0426 if (ACPI_FAILURE (Status)) 0427 { 0428 goto ErrorExit; 0429 } 0430 0431 /* Clear any pending GPE events within this register */ 0432 0433 Status = AcpiHwWrite (0xFF, &ThisRegister->StatusAddress); 0434 if (ACPI_FAILURE (Status)) 0435 { 0436 goto ErrorExit; 0437 } 0438 0439 ThisRegister++; 0440 } 0441 0442 return_ACPI_STATUS (AE_OK); 0443 0444 0445 ErrorExit: 0446 if (GpeRegisterInfo) 0447 { 0448 ACPI_FREE (GpeRegisterInfo); 0449 } 0450 if (GpeEventInfo) 0451 { 0452 ACPI_FREE (GpeEventInfo); 0453 } 0454 0455 return_ACPI_STATUS (Status); 0456 } 0457 0458 0459 /******************************************************************************* 0460 * 0461 * FUNCTION: AcpiEvCreateGpeBlock 0462 * 0463 * PARAMETERS: GpeDevice - Handle to the parent GPE block 0464 * GpeBlockAddress - Address and SpaceID 0465 * RegisterCount - Number of GPE register pairs in the block 0466 * GpeBlockBaseNumber - Starting GPE number for the block 0467 * InterruptNumber - H/W interrupt for the block 0468 * ReturnGpeBlock - Where the new block descriptor is returned 0469 * 0470 * RETURN: Status 0471 * 0472 * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within 0473 * the block are disabled at exit. 0474 * Note: Assumes namespace is locked. 0475 * 0476 ******************************************************************************/ 0477 0478 ACPI_STATUS 0479 AcpiEvCreateGpeBlock ( 0480 ACPI_NAMESPACE_NODE *GpeDevice, 0481 UINT64 Address, 0482 UINT8 SpaceId, 0483 UINT32 RegisterCount, 0484 UINT16 GpeBlockBaseNumber, 0485 UINT32 InterruptNumber, 0486 ACPI_GPE_BLOCK_INFO **ReturnGpeBlock) 0487 { 0488 ACPI_STATUS Status; 0489 ACPI_GPE_BLOCK_INFO *GpeBlock; 0490 ACPI_GPE_WALK_INFO WalkInfo; 0491 0492 0493 ACPI_FUNCTION_TRACE (EvCreateGpeBlock); 0494 0495 0496 if (!RegisterCount) 0497 { 0498 return_ACPI_STATUS (AE_OK); 0499 } 0500 0501 /* Allocate a new GPE block */ 0502 0503 GpeBlock = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_BLOCK_INFO)); 0504 if (!GpeBlock) 0505 { 0506 return_ACPI_STATUS (AE_NO_MEMORY); 0507 } 0508 0509 /* Initialize the new GPE block */ 0510 0511 GpeBlock->Address = Address; 0512 GpeBlock->SpaceId = SpaceId; 0513 GpeBlock->Node = GpeDevice; 0514 GpeBlock->GpeCount = (UINT16) (RegisterCount * ACPI_GPE_REGISTER_WIDTH); 0515 GpeBlock->Initialized = FALSE; 0516 GpeBlock->RegisterCount = RegisterCount; 0517 GpeBlock->BlockBaseNumber = GpeBlockBaseNumber; 0518 0519 /* 0520 * Create the RegisterInfo and EventInfo sub-structures 0521 * Note: disables and clears all GPEs in the block 0522 */ 0523 Status = AcpiEvCreateGpeInfoBlocks (GpeBlock); 0524 if (ACPI_FAILURE (Status)) 0525 { 0526 ACPI_FREE (GpeBlock); 0527 return_ACPI_STATUS (Status); 0528 } 0529 0530 /* Install the new block in the global lists */ 0531 0532 Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptNumber); 0533 if (ACPI_FAILURE (Status)) 0534 { 0535 ACPI_FREE (GpeBlock->RegisterInfo); 0536 ACPI_FREE (GpeBlock->EventInfo); 0537 ACPI_FREE (GpeBlock); 0538 return_ACPI_STATUS (Status); 0539 } 0540 0541 AcpiGbl_AllGpesInitialized = FALSE; 0542 0543 /* Find all GPE methods (_Lxx or_Exx) for this block */ 0544 0545 WalkInfo.GpeBlock = GpeBlock; 0546 WalkInfo.GpeDevice = GpeDevice; 0547 WalkInfo.ExecuteByOwnerId = FALSE; 0548 0549 (void) AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice, 0550 ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, 0551 AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL); 0552 0553 /* Return the new block */ 0554 0555 if (ReturnGpeBlock) 0556 { 0557 (*ReturnGpeBlock) = GpeBlock; 0558 } 0559 0560 ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, 0561 " Initialized GPE %02X to %02X [%4.4s] %u regs on interrupt 0x%X%s\n", 0562 (UINT32) GpeBlock->BlockBaseNumber, 0563 (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)), 0564 GpeDevice->Name.Ascii, GpeBlock->RegisterCount, InterruptNumber, 0565 InterruptNumber == AcpiGbl_FADT.SciInterrupt ? " (SCI)" : "")); 0566 0567 /* Update global count of currently available GPEs */ 0568 0569 AcpiCurrentGpeCount += GpeBlock->GpeCount; 0570 return_ACPI_STATUS (AE_OK); 0571 } 0572 0573 0574 /******************************************************************************* 0575 * 0576 * FUNCTION: AcpiEvInitializeGpeBlock 0577 * 0578 * PARAMETERS: ACPI_GPE_CALLBACK 0579 * 0580 * RETURN: Status 0581 * 0582 * DESCRIPTION: Initialize and enable a GPE block. Enable GPEs that have 0583 * associated methods. 0584 * Note: Assumes namespace is locked. 0585 * 0586 ******************************************************************************/ 0587 0588 ACPI_STATUS 0589 AcpiEvInitializeGpeBlock ( 0590 ACPI_GPE_XRUPT_INFO *GpeXruptInfo, 0591 ACPI_GPE_BLOCK_INFO *GpeBlock, 0592 void *Context) 0593 { 0594 ACPI_STATUS Status; 0595 ACPI_GPE_EVENT_INFO *GpeEventInfo; 0596 UINT32 GpeEnabledCount; 0597 UINT32 GpeIndex; 0598 UINT32 i; 0599 UINT32 j; 0600 BOOLEAN *IsPollingNeeded = Context; 0601 ACPI_ERROR_ONLY (UINT32 GpeNumber); 0602 0603 0604 ACPI_FUNCTION_TRACE (EvInitializeGpeBlock); 0605 0606 0607 /* 0608 * Ignore a null GPE block (e.g., if no GPE block 1 exists), and 0609 * any GPE blocks that have been initialized already. 0610 */ 0611 if (!GpeBlock || GpeBlock->Initialized) 0612 { 0613 return_ACPI_STATUS (AE_OK); 0614 } 0615 0616 /* 0617 * Enable all GPEs that have a corresponding method and have the 0618 * ACPI_GPE_CAN_WAKE flag unset. Any other GPEs within this block 0619 * must be enabled via the acpi_enable_gpe() interface. 0620 */ 0621 GpeEnabledCount = 0; 0622 0623 for (i = 0; i < GpeBlock->RegisterCount; i++) 0624 { 0625 for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++) 0626 { 0627 /* Get the info block for this particular GPE */ 0628 0629 GpeIndex = (i * ACPI_GPE_REGISTER_WIDTH) + j; 0630 GpeEventInfo = &GpeBlock->EventInfo[GpeIndex]; 0631 ACPI_ERROR_ONLY(GpeNumber = GpeBlock->BlockBaseNumber + GpeIndex); 0632 GpeEventInfo->Flags |= ACPI_GPE_INITIALIZED; 0633 0634 /* 0635 * Ignore GPEs that have no corresponding _Lxx/_Exx method 0636 * and GPEs that are used to wake the system 0637 */ 0638 if ((ACPI_GPE_DISPATCH_TYPE (GpeEventInfo->Flags) != ACPI_GPE_DISPATCH_METHOD) || 0639 (GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE)) 0640 { 0641 continue; 0642 } 0643 0644 Status = AcpiEvAddGpeReference (GpeEventInfo, FALSE); 0645 if (ACPI_FAILURE (Status)) 0646 { 0647 ACPI_EXCEPTION ((AE_INFO, Status, 0648 "Could not enable GPE 0x%02X", 0649 GpeNumber)); 0650 continue; 0651 } 0652 0653 GpeEventInfo->Flags |= ACPI_GPE_AUTO_ENABLED; 0654 0655 if (IsPollingNeeded && 0656 ACPI_GPE_IS_POLLING_NEEDED (GpeEventInfo)) 0657 { 0658 *IsPollingNeeded = TRUE; 0659 } 0660 0661 GpeEnabledCount++; 0662 } 0663 } 0664 0665 if (GpeEnabledCount) 0666 { 0667 ACPI_INFO (( 0668 "Enabled %u GPEs in block %02X to %02X", GpeEnabledCount, 0669 (UINT32) GpeBlock->BlockBaseNumber, 0670 (UINT32) (GpeBlock->BlockBaseNumber + (GpeBlock->GpeCount - 1)))); 0671 } 0672 0673 GpeBlock->Initialized = TRUE; 0674 return_ACPI_STATUS (AE_OK); 0675 } 0676 0677 #endif /* !ACPI_REDUCED_HARDWARE */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |