|
||||
Warning, cross-references for /kernel/drivers/acpica/tbxface.c need to be fixed.
0001 /****************************************************************************** 0002 * 0003 * Module Name: tbxface - Public interfaces to the ACPI subsystem 0004 * ACPI table oriented interfaces 0005 * 0006 *****************************************************************************/ 0007 0008 /****************************************************************************** 0009 * 0010 * 1. Copyright Notice 0011 * 0012 * Some or all of this work - Copyright (c) 1999 - 2009, Intel Corp. 0013 * All rights reserved. 0014 * 0015 * 2. License 0016 * 0017 * 2.1. This is your license from Intel Corp. under its intellectual property 0018 * rights. You may have additional license terms from the party that provided 0019 * you this software, covering your right to use that party's intellectual 0020 * property rights. 0021 * 0022 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 0023 * copy of the source code appearing in this file ("Covered Code") an 0024 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 0025 * base code distributed originally by Intel ("Original Intel Code") to copy, 0026 * make derivatives, distribute, use and display any portion of the Covered 0027 * Code in any form, with the right to sublicense such rights; and 0028 * 0029 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 0030 * license (with the right to sublicense), under only those claims of Intel 0031 * patents that are infringed by the Original Intel Code, to make, use, sell, 0032 * offer to sell, and import the Covered Code and derivative works thereof 0033 * solely to the minimum extent necessary to exercise the above copyright 0034 * license, and in no event shall the patent license extend to any additions 0035 * to or modifications of the Original Intel Code. No other license or right 0036 * is granted directly or by implication, estoppel or otherwise; 0037 * 0038 * The above copyright and patent license is granted only if the following 0039 * conditions are met: 0040 * 0041 * 3. Conditions 0042 * 0043 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 0044 * Redistribution of source code of any substantial portion of the Covered 0045 * Code or modification with rights to further distribute source must include 0046 * the above Copyright Notice, the above License, this list of Conditions, 0047 * and the following Disclaimer and Export Compliance provision. In addition, 0048 * Licensee must cause all Covered Code to which Licensee contributes to 0049 * contain a file documenting the changes Licensee made to create that Covered 0050 * Code and the date of any change. Licensee must include in that file the 0051 * documentation of any changes made by any predecessor Licensee. Licensee 0052 * must include a prominent statement that the modification is derived, 0053 * directly or indirectly, from Original Intel Code. 0054 * 0055 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 0056 * Redistribution of source code of any substantial portion of the Covered 0057 * Code or modification without rights to further distribute source must 0058 * include the following Disclaimer and Export Compliance provision in the 0059 * documentation and/or other materials provided with distribution. In 0060 * addition, Licensee may not authorize further sublicense of source of any 0061 * portion of the Covered Code, and must include terms to the effect that the 0062 * license from Licensee to its licensee is limited to the intellectual 0063 * property embodied in the software Licensee provides to its licensee, and 0064 * not to intellectual property embodied in modifications its licensee may 0065 * make. 0066 * 0067 * 3.3. Redistribution of Executable. Redistribution in executable form of any 0068 * substantial portion of the Covered Code or modification must reproduce the 0069 * above Copyright Notice, and the following Disclaimer and Export Compliance 0070 * provision in the documentation and/or other materials provided with the 0071 * distribution. 0072 * 0073 * 3.4. Intel retains all right, title, and interest in and to the Original 0074 * Intel Code. 0075 * 0076 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 0077 * Intel shall be used in advertising or otherwise to promote the sale, use or 0078 * other dealings in products derived from or relating to the Covered Code 0079 * without prior written authorization from Intel. 0080 * 0081 * 4. Disclaimer and Export Compliance 0082 * 0083 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 0084 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 0085 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 0086 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 0087 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 0088 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 0089 * PARTICULAR PURPOSE. 0090 * 0091 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 0092 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 0093 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 0094 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 0095 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 0096 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 0097 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 0098 * LIMITED REMEDY. 0099 * 0100 * 4.3. Licensee shall not export, either directly or indirectly, any of this 0101 * software or system incorporating such software without first obtaining any 0102 * required license or other approval from the U. S. Department of Commerce or 0103 * any other agency or department of the United States Government. In the 0104 * event Licensee exports any such software from the United States or 0105 * re-exports any such software from a foreign destination, Licensee shall 0106 * ensure that the distribution and export/re-export of the software is in 0107 * compliance with all laws, regulations, orders, or other restrictions of the 0108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 0109 * any of its subsidiaries will export/re-export any technical data, process, 0110 * software, or service, directly or indirectly, to any country for which the 0111 * United States government or any agency thereof requires an export license, 0112 * other governmental approval, or letter of assurance, without first obtaining 0113 * such license, approval or letter. 0114 * 0115 *****************************************************************************/ 0116 0117 #define __TBXFACE_C__ 0118 0119 #include "acpi.h" 0120 #include "accommon.h" 0121 #include "acnamesp.h" 0122 #include "actables.h" 0123 0124 #define _COMPONENT ACPI_TABLES 0125 ACPI_MODULE_NAME ("tbxface") 0126 0127 /* Local prototypes */ 0128 0129 static ACPI_STATUS 0130 AcpiTbLoadNamespace ( 0131 void); 0132 0133 0134 /******************************************************************************* 0135 * 0136 * FUNCTION: AcpiAllocateRootTable 0137 * 0138 * PARAMETERS: InitialTableCount - Size of InitialTableArray, in number of 0139 * ACPI_TABLE_DESC structures 0140 * 0141 * RETURN: Status 0142 * 0143 * DESCRIPTION: Allocate a root table array. Used by iASL compiler and 0144 * AcpiInitializeTables. 0145 * 0146 ******************************************************************************/ 0147 0148 ACPI_STATUS 0149 AcpiAllocateRootTable ( 0150 UINT32 InitialTableCount) 0151 { 0152 0153 AcpiGbl_RootTableList.Size = InitialTableCount; 0154 AcpiGbl_RootTableList.Flags = ACPI_ROOT_ALLOW_RESIZE; 0155 0156 return (AcpiTbResizeRootTableList ()); 0157 } 0158 0159 0160 /******************************************************************************* 0161 * 0162 * FUNCTION: AcpiInitializeTables 0163 * 0164 * PARAMETERS: InitialTableArray - Pointer to an array of pre-allocated 0165 * ACPI_TABLE_DESC structures. If NULL, the 0166 * array is dynamically allocated. 0167 * InitialTableCount - Size of InitialTableArray, in number of 0168 * ACPI_TABLE_DESC structures 0169 * AllowRealloc - Flag to tell Table Manager if resize of 0170 * pre-allocated array is allowed. Ignored 0171 * if InitialTableArray is NULL. 0172 * 0173 * RETURN: Status 0174 * 0175 * DESCRIPTION: Initialize the table manager, get the RSDP and RSDT/XSDT. 0176 * 0177 * NOTE: Allows static allocation of the initial table array in order 0178 * to avoid the use of dynamic memory in confined environments 0179 * such as the kernel boot sequence where it may not be available. 0180 * 0181 * If the host OS memory managers are initialized, use NULL for 0182 * InitialTableArray, and the table will be dynamically allocated. 0183 * 0184 ******************************************************************************/ 0185 0186 ACPI_STATUS 0187 AcpiInitializeTables ( 0188 ACPI_TABLE_DESC *InitialTableArray, 0189 UINT32 InitialTableCount, 0190 BOOLEAN AllowResize) 0191 { 0192 ACPI_PHYSICAL_ADDRESS RsdpAddress; 0193 ACPI_STATUS Status; 0194 0195 0196 ACPI_FUNCTION_TRACE (AcpiInitializeTables); 0197 0198 0199 /* 0200 * Set up the Root Table Array 0201 * Allocate the table array if requested 0202 */ 0203 if (!InitialTableArray) 0204 { 0205 Status = AcpiAllocateRootTable (InitialTableCount); 0206 if (ACPI_FAILURE (Status)) 0207 { 0208 return_ACPI_STATUS (Status); 0209 } 0210 } 0211 else 0212 { 0213 /* Root Table Array has been statically allocated by the host */ 0214 0215 ACPI_MEMSET (InitialTableArray, 0, 0216 (ACPI_SIZE) InitialTableCount * sizeof (ACPI_TABLE_DESC)); 0217 0218 AcpiGbl_RootTableList.Tables = InitialTableArray; 0219 AcpiGbl_RootTableList.Size = InitialTableCount; 0220 AcpiGbl_RootTableList.Flags = ACPI_ROOT_ORIGIN_UNKNOWN; 0221 if (AllowResize) 0222 { 0223 AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE; 0224 } 0225 } 0226 0227 /* Get the address of the RSDP */ 0228 0229 RsdpAddress = AcpiOsGetRootPointer (); 0230 if (!RsdpAddress) 0231 { 0232 return_ACPI_STATUS (AE_NOT_FOUND); 0233 } 0234 0235 /* 0236 * Get the root table (RSDT or XSDT) and extract all entries to the local 0237 * Root Table Array. This array contains the information of the RSDT/XSDT 0238 * in a common, more useable format. 0239 */ 0240 Status = AcpiTbParseRootTable (RsdpAddress); 0241 return_ACPI_STATUS (Status); 0242 } 0243 0244 ACPI_EXPORT_SYMBOL (AcpiInitializeTables) 0245 0246 0247 /******************************************************************************* 0248 * 0249 * FUNCTION: AcpiReallocateRootTable 0250 * 0251 * PARAMETERS: None 0252 * 0253 * RETURN: Status 0254 * 0255 * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the 0256 * root list from the previously provided scratch area. Should 0257 * be called once dynamic memory allocation is available in the 0258 * kernel 0259 * 0260 ******************************************************************************/ 0261 0262 ACPI_STATUS 0263 AcpiReallocateRootTable ( 0264 void) 0265 { 0266 ACPI_TABLE_DESC *Tables; 0267 ACPI_SIZE NewSize; 0268 0269 0270 ACPI_FUNCTION_TRACE (AcpiReallocateRootTable); 0271 0272 0273 /* 0274 * Only reallocate the root table if the host provided a static buffer 0275 * for the table array in the call to AcpiInitializeTables. 0276 */ 0277 if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) 0278 { 0279 return_ACPI_STATUS (AE_SUPPORT); 0280 } 0281 0282 NewSize = ((ACPI_SIZE) AcpiGbl_RootTableList.Count + 0283 ACPI_ROOT_TABLE_SIZE_INCREMENT) * 0284 sizeof (ACPI_TABLE_DESC); 0285 0286 /* Create new array and copy the old array */ 0287 0288 Tables = ACPI_ALLOCATE_ZEROED (NewSize); 0289 if (!Tables) 0290 { 0291 return_ACPI_STATUS (AE_NO_MEMORY); 0292 } 0293 0294 ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, NewSize); 0295 0296 AcpiGbl_RootTableList.Size = AcpiGbl_RootTableList.Count; 0297 AcpiGbl_RootTableList.Tables = Tables; 0298 AcpiGbl_RootTableList.Flags = 0299 ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE; 0300 0301 return_ACPI_STATUS (AE_OK); 0302 } 0303 0304 ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable) 0305 0306 0307 /******************************************************************************* 0308 * 0309 * FUNCTION: AcpiGetTableHeader 0310 * 0311 * PARAMETERS: Signature - ACPI signature of needed table 0312 * Instance - Which instance (for SSDTs) 0313 * OutTableHeader - The pointer to the table header to fill 0314 * 0315 * RETURN: Status and pointer to mapped table header 0316 * 0317 * DESCRIPTION: Finds an ACPI table header. 0318 * 0319 * NOTE: Caller is responsible in unmapping the header with 0320 * AcpiOsUnmapMemory 0321 * 0322 ******************************************************************************/ 0323 0324 ACPI_STATUS 0325 AcpiGetTableHeader ( 0326 char *Signature, 0327 UINT32 Instance, 0328 ACPI_TABLE_HEADER *OutTableHeader) 0329 { 0330 UINT32 i; 0331 UINT32 j; 0332 ACPI_TABLE_HEADER *Header; 0333 0334 0335 /* Parameter validation */ 0336 0337 if (!Signature || !OutTableHeader) 0338 { 0339 return (AE_BAD_PARAMETER); 0340 } 0341 0342 /* Walk the root table list */ 0343 0344 for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++) 0345 { 0346 if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), 0347 Signature)) 0348 { 0349 continue; 0350 } 0351 0352 if (++j < Instance) 0353 { 0354 continue; 0355 } 0356 0357 if (!AcpiGbl_RootTableList.Tables[i].Pointer) 0358 { 0359 if ((AcpiGbl_RootTableList.Tables[i].Flags & 0360 ACPI_TABLE_ORIGIN_MASK) == 0361 ACPI_TABLE_ORIGIN_MAPPED) 0362 { 0363 Header = AcpiOsMapMemory ( 0364 AcpiGbl_RootTableList.Tables[i].Address, 0365 sizeof (ACPI_TABLE_HEADER)); 0366 if (!Header) 0367 { 0368 return AE_NO_MEMORY; 0369 } 0370 0371 ACPI_MEMCPY (OutTableHeader, Header, sizeof(ACPI_TABLE_HEADER)); 0372 AcpiOsUnmapMemory (Header, sizeof(ACPI_TABLE_HEADER)); 0373 } 0374 else 0375 { 0376 return AE_NOT_FOUND; 0377 } 0378 } 0379 else 0380 { 0381 ACPI_MEMCPY (OutTableHeader, 0382 AcpiGbl_RootTableList.Tables[i].Pointer, 0383 sizeof(ACPI_TABLE_HEADER)); 0384 } 0385 0386 return (AE_OK); 0387 } 0388 0389 return (AE_NOT_FOUND); 0390 } 0391 0392 ACPI_EXPORT_SYMBOL (AcpiGetTableHeader) 0393 0394 0395 /******************************************************************************* 0396 * 0397 * FUNCTION: AcpiGetTable 0398 * 0399 * PARAMETERS: Signature - ACPI signature of needed table 0400 * Instance - Which instance (for SSDTs) 0401 * OutTable - Where the pointer to the table is returned 0402 * 0403 * RETURN: Status and pointer to table 0404 * 0405 * DESCRIPTION: Finds and verifies an ACPI table. 0406 * 0407 ******************************************************************************/ 0408 0409 ACPI_STATUS 0410 AcpiGetTable ( 0411 char *Signature, 0412 UINT32 Instance, 0413 ACPI_TABLE_HEADER **OutTable) 0414 { 0415 UINT32 i; 0416 UINT32 j; 0417 ACPI_STATUS Status; 0418 0419 0420 /* Parameter validation */ 0421 0422 if (!Signature || !OutTable) 0423 { 0424 return (AE_BAD_PARAMETER); 0425 } 0426 0427 /* Walk the root table list */ 0428 0429 for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++) 0430 { 0431 if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), 0432 Signature)) 0433 { 0434 continue; 0435 } 0436 0437 if (++j < Instance) 0438 { 0439 continue; 0440 } 0441 0442 Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]); 0443 if (ACPI_SUCCESS (Status)) 0444 { 0445 *OutTable = AcpiGbl_RootTableList.Tables[i].Pointer; 0446 } 0447 0448 return (Status); 0449 } 0450 0451 return (AE_NOT_FOUND); 0452 } 0453 0454 ACPI_EXPORT_SYMBOL (AcpiGetTable) 0455 0456 0457 /******************************************************************************* 0458 * 0459 * FUNCTION: AcpiGetTableByIndex 0460 * 0461 * PARAMETERS: TableIndex - Table index 0462 * Table - Where the pointer to the table is returned 0463 * 0464 * RETURN: Status and pointer to the table 0465 * 0466 * DESCRIPTION: Obtain a table by an index into the global table list. 0467 * 0468 ******************************************************************************/ 0469 0470 ACPI_STATUS 0471 AcpiGetTableByIndex ( 0472 UINT32 TableIndex, 0473 ACPI_TABLE_HEADER **Table) 0474 { 0475 ACPI_STATUS Status; 0476 0477 0478 ACPI_FUNCTION_TRACE (AcpiGetTableByIndex); 0479 0480 0481 /* Parameter validation */ 0482 0483 if (!Table) 0484 { 0485 return_ACPI_STATUS (AE_BAD_PARAMETER); 0486 } 0487 0488 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); 0489 0490 /* Validate index */ 0491 0492 if (TableIndex >= AcpiGbl_RootTableList.Count) 0493 { 0494 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); 0495 return_ACPI_STATUS (AE_BAD_PARAMETER); 0496 } 0497 0498 if (!AcpiGbl_RootTableList.Tables[TableIndex].Pointer) 0499 { 0500 /* Table is not mapped, map it */ 0501 0502 Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[TableIndex]); 0503 if (ACPI_FAILURE (Status)) 0504 { 0505 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); 0506 return_ACPI_STATUS (Status); 0507 } 0508 } 0509 0510 *Table = AcpiGbl_RootTableList.Tables[TableIndex].Pointer; 0511 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); 0512 return_ACPI_STATUS (AE_OK); 0513 } 0514 0515 ACPI_EXPORT_SYMBOL (AcpiGetTableByIndex) 0516 0517 0518 /******************************************************************************* 0519 * 0520 * FUNCTION: AcpiTbLoadNamespace 0521 * 0522 * PARAMETERS: None 0523 * 0524 * RETURN: Status 0525 * 0526 * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in 0527 * the RSDT/XSDT. 0528 * 0529 ******************************************************************************/ 0530 0531 static ACPI_STATUS 0532 AcpiTbLoadNamespace ( 0533 void) 0534 { 0535 ACPI_STATUS Status; 0536 UINT32 i; 0537 0538 0539 ACPI_FUNCTION_TRACE (TbLoadNamespace); 0540 0541 0542 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); 0543 0544 /* 0545 * Load the namespace. The DSDT is required, but any SSDT and PSDT tables 0546 * are optional. 0547 */ 0548 if (!AcpiGbl_RootTableList.Count || 0549 !ACPI_COMPARE_NAME ( 0550 &(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature), 0551 ACPI_SIG_DSDT) || 0552 ACPI_FAILURE (AcpiTbVerifyTable ( 0553 &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]))) 0554 { 0555 Status = AE_NO_ACPI_TABLES; 0556 goto UnlockAndExit; 0557 } 0558 0559 /* A valid DSDT is required */ 0560 0561 Status = AcpiTbVerifyTable ( 0562 &AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]); 0563 if (ACPI_FAILURE (Status)) 0564 { 0565 Status = AE_NO_ACPI_TABLES; 0566 goto UnlockAndExit; 0567 } 0568 0569 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); 0570 0571 /* Load and parse tables */ 0572 0573 Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode); 0574 if (ACPI_FAILURE (Status)) 0575 { 0576 return_ACPI_STATUS (Status); 0577 } 0578 0579 /* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */ 0580 0581 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); 0582 for (i = 0; i < AcpiGbl_RootTableList.Count; ++i) 0583 { 0584 if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), 0585 ACPI_SIG_SSDT) && 0586 !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature), 0587 ACPI_SIG_PSDT)) || 0588 ACPI_FAILURE (AcpiTbVerifyTable ( 0589 &AcpiGbl_RootTableList.Tables[i]))) 0590 { 0591 continue; 0592 } 0593 0594 /* Ignore errors while loading tables, get as many as possible */ 0595 0596 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); 0597 (void) AcpiNsLoadTable (i, AcpiGbl_RootNode); 0598 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); 0599 } 0600 0601 ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); 0602 0603 UnlockAndExit: 0604 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); 0605 return_ACPI_STATUS (Status); 0606 } 0607 0608 0609 /******************************************************************************* 0610 * 0611 * FUNCTION: AcpiLoadTables 0612 * 0613 * PARAMETERS: None 0614 * 0615 * RETURN: Status 0616 * 0617 * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT 0618 * 0619 ******************************************************************************/ 0620 0621 ACPI_STATUS 0622 AcpiLoadTables ( 0623 void) 0624 { 0625 ACPI_STATUS Status; 0626 0627 0628 ACPI_FUNCTION_TRACE (AcpiLoadTables); 0629 0630 0631 /* Load the namespace from the tables */ 0632 0633 Status = AcpiTbLoadNamespace (); 0634 if (ACPI_FAILURE (Status)) 0635 { 0636 ACPI_EXCEPTION ((AE_INFO, Status, 0637 "While loading namespace from ACPI tables")); 0638 } 0639 0640 return_ACPI_STATUS (Status); 0641 } 0642 0643 ACPI_EXPORT_SYMBOL (AcpiLoadTables) 0644 0645 0646 /******************************************************************************* 0647 * 0648 * FUNCTION: AcpiInstallTableHandler 0649 * 0650 * PARAMETERS: Handler - Table event handler 0651 * Context - Value passed to the handler on each event 0652 * 0653 * RETURN: Status 0654 * 0655 * DESCRIPTION: Install table event handler 0656 * 0657 ******************************************************************************/ 0658 0659 ACPI_STATUS 0660 AcpiInstallTableHandler ( 0661 ACPI_TABLE_HANDLER Handler, 0662 void *Context) 0663 { 0664 ACPI_STATUS Status; 0665 0666 0667 ACPI_FUNCTION_TRACE (AcpiInstallTableHandler); 0668 0669 0670 if (!Handler) 0671 { 0672 return_ACPI_STATUS (AE_BAD_PARAMETER); 0673 } 0674 0675 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); 0676 if (ACPI_FAILURE (Status)) 0677 { 0678 return_ACPI_STATUS (Status); 0679 } 0680 0681 /* Don't allow more than one handler */ 0682 0683 if (AcpiGbl_TableHandler) 0684 { 0685 Status = AE_ALREADY_EXISTS; 0686 goto Cleanup; 0687 } 0688 0689 /* Install the handler */ 0690 0691 AcpiGbl_TableHandler = Handler; 0692 AcpiGbl_TableHandlerContext = Context; 0693 0694 Cleanup: 0695 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); 0696 return_ACPI_STATUS (Status); 0697 } 0698 0699 ACPI_EXPORT_SYMBOL (AcpiInstallTableHandler) 0700 0701 0702 /******************************************************************************* 0703 * 0704 * FUNCTION: AcpiRemoveTableHandler 0705 * 0706 * PARAMETERS: Handler - Table event handler that was installed 0707 * previously. 0708 * 0709 * RETURN: Status 0710 * 0711 * DESCRIPTION: Remove table event handler 0712 * 0713 ******************************************************************************/ 0714 0715 ACPI_STATUS 0716 AcpiRemoveTableHandler ( 0717 ACPI_TABLE_HANDLER Handler) 0718 { 0719 ACPI_STATUS Status; 0720 0721 0722 ACPI_FUNCTION_TRACE (AcpiRemoveTableHandler); 0723 0724 0725 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); 0726 if (ACPI_FAILURE (Status)) 0727 { 0728 return_ACPI_STATUS (Status); 0729 } 0730 0731 /* Make sure that the installed handler is the same */ 0732 0733 if (!Handler || 0734 Handler != AcpiGbl_TableHandler) 0735 { 0736 Status = AE_BAD_PARAMETER; 0737 goto Cleanup; 0738 } 0739 0740 /* Remove the handler */ 0741 0742 AcpiGbl_TableHandler = NULL; 0743 0744 Cleanup: 0745 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); 0746 return_ACPI_STATUS (Status); 0747 } 0748 0749 ACPI_EXPORT_SYMBOL (AcpiRemoveTableHandler) 0750
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 1.2.0 LXR engine. |