1 /****************************************************************************** 2 * 3 * Module Name: tbxface - ACPI table-oriented external interfaces 4 * 5 *****************************************************************************/ 6 7 /****************************************************************************** 8 * 9 * 1. Copyright Notice 10 * 11 * Some or all of this work - Copyright (c) 1999 - 2017, Intel Corp. 12 * All rights reserved. 13 * 14 * 2. License 15 * 16 * 2.1. This is your license from Intel Corp. under its intellectual property 17 * rights. You may have additional license terms from the party that provided 18 * you this software, covering your right to use that party's intellectual 19 * property rights. 20 * 21 * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a 22 * copy of the source code appearing in this file ("Covered Code") an 23 * irrevocable, perpetual, worldwide license under Intel's copyrights in the 24 * base code distributed originally by Intel ("Original Intel Code") to copy, 25 * make derivatives, distribute, use and display any portion of the Covered 26 * Code in any form, with the right to sublicense such rights; and 27 * 28 * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent 29 * license (with the right to sublicense), under only those claims of Intel 30 * patents that are infringed by the Original Intel Code, to make, use, sell, 31 * offer to sell, and import the Covered Code and derivative works thereof 32 * solely to the minimum extent necessary to exercise the above copyright 33 * license, and in no event shall the patent license extend to any additions 34 * to or modifications of the Original Intel Code. No other license or right 35 * is granted directly or by implication, estoppel or otherwise; 36 * 37 * The above copyright and patent license is granted only if the following 38 * conditions are met: 39 * 40 * 3. Conditions 41 * 42 * 3.1. Redistribution of Source with Rights to Further Distribute Source. 43 * Redistribution of source code of any substantial portion of the Covered 44 * Code or modification with rights to further distribute source must include 45 * the above Copyright Notice, the above License, this list of Conditions, 46 * and the following Disclaimer and Export Compliance provision. In addition, 47 * Licensee must cause all Covered Code to which Licensee contributes to 48 * contain a file documenting the changes Licensee made to create that Covered 49 * Code and the date of any change. Licensee must include in that file the 50 * documentation of any changes made by any predecessor Licensee. Licensee 51 * must include a prominent statement that the modification is derived, 52 * directly or indirectly, from Original Intel Code. 53 * 54 * 3.2. Redistribution of Source with no Rights to Further Distribute Source. 55 * Redistribution of source code of any substantial portion of the Covered 56 * Code or modification without rights to further distribute source must 57 * include the following Disclaimer and Export Compliance provision in the 58 * documentation and/or other materials provided with distribution. In 59 * addition, Licensee may not authorize further sublicense of source of any 60 * portion of the Covered Code, and must include terms to the effect that the 61 * license from Licensee to its licensee is limited to the intellectual 62 * property embodied in the software Licensee provides to its licensee, and 63 * not to intellectual property embodied in modifications its licensee may 64 * make. 65 * 66 * 3.3. Redistribution of Executable. Redistribution in executable form of any 67 * substantial portion of the Covered Code or modification must reproduce the 68 * above Copyright Notice, and the following Disclaimer and Export Compliance 69 * provision in the documentation and/or other materials provided with the 70 * distribution. 71 * 72 * 3.4. Intel retains all right, title, and interest in and to the Original 73 * Intel Code. 74 * 75 * 3.5. Neither the name Intel nor any other trademark owned or controlled by 76 * Intel shall be used in advertising or otherwise to promote the sale, use or 77 * other dealings in products derived from or relating to the Covered Code 78 * without prior written authorization from Intel. 79 * 80 * 4. Disclaimer and Export Compliance 81 * 82 * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED 83 * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE 84 * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, 85 * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY 86 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY 87 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A 88 * PARTICULAR PURPOSE. 89 * 90 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES 91 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR 92 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, 93 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY 94 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL 95 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS 96 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY 97 * LIMITED REMEDY. 98 * 99 * 4.3. Licensee shall not export, either directly or indirectly, any of this 100 * software or system incorporating such software without first obtaining any 101 * required license or other approval from the U. S. Department of Commerce or 102 * any other agency or department of the United States Government. In the 103 * event Licensee exports any such software from the United States or 104 * re-exports any such software from a foreign destination, Licensee shall 105 * ensure that the distribution and export/re-export of the software is in 106 * compliance with all laws, regulations, orders, or other restrictions of the 107 * U.S. Export Administration Regulations. Licensee agrees that neither it nor 108 * any of its subsidiaries will export/re-export any technical data, process, 109 * software, or service, directly or indirectly, to any country for which the 110 * United States government or any agency thereof requires an export license, 111 * other governmental approval, or letter of assurance, without first obtaining 112 * such license, approval or letter. 113 * 114 ***************************************************************************** 115 * 116 * Alternatively, you may choose to be licensed under the terms of the 117 * following license: 118 * 119 * Redistribution and use in source and binary forms, with or without 120 * modification, are permitted provided that the following conditions 121 * are met: 122 * 1. Redistributions of source code must retain the above copyright 123 * notice, this list of conditions, and the following disclaimer, 124 * without modification. 125 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 126 * substantially similar to the "NO WARRANTY" disclaimer below 127 * ("Disclaimer") and any redistribution must be conditioned upon 128 * including a substantially similar Disclaimer requirement for further 129 * binary redistribution. 130 * 3. Neither the names of the above-listed copyright holders nor the names 131 * of any contributors may be used to endorse or promote products derived 132 * from this software without specific prior written permission. 133 * 134 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 135 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 136 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 137 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 138 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 139 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 140 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 141 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 142 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 143 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 144 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 145 * 146 * Alternatively, you may choose to be licensed under the terms of the 147 * GNU General Public License ("GPL") version 2 as published by the Free 148 * Software Foundation. 149 * 150 *****************************************************************************/ 151 152 #define EXPORT_ACPI_INTERFACES 153 154 #include <contrib/dev/acpica/include/acpi.h> 155 #include <contrib/dev/acpica/include/accommon.h> 156 #include <contrib/dev/acpica/include/actables.h> 157 158 #define _COMPONENT ACPI_TABLES 159 ACPI_MODULE_NAME ("tbxface") 160 161 162 /******************************************************************************* 163 * 164 * FUNCTION: AcpiAllocateRootTable 165 * 166 * PARAMETERS: InitialTableCount - Size of InitialTableArray, in number of 167 * ACPI_TABLE_DESC structures 168 * 169 * RETURN: Status 170 * 171 * DESCRIPTION: Allocate a root table array. Used by iASL compiler and 172 * AcpiInitializeTables. 173 * 174 ******************************************************************************/ 175 176 ACPI_STATUS 177 AcpiAllocateRootTable ( 178 UINT32 InitialTableCount) 179 { 180 181 AcpiGbl_RootTableList.MaxTableCount = InitialTableCount; 182 AcpiGbl_RootTableList.Flags = ACPI_ROOT_ALLOW_RESIZE; 183 184 return (AcpiTbResizeRootTableList ()); 185 } 186 187 188 /******************************************************************************* 189 * 190 * FUNCTION: AcpiInitializeTables 191 * 192 * PARAMETERS: InitialTableArray - Pointer to an array of pre-allocated 193 * ACPI_TABLE_DESC structures. If NULL, the 194 * array is dynamically allocated. 195 * InitialTableCount - Size of InitialTableArray, in number of 196 * ACPI_TABLE_DESC structures 197 * AllowResize - Flag to tell Table Manager if resize of 198 * pre-allocated array is allowed. Ignored 199 * if InitialTableArray is NULL. 200 * 201 * RETURN: Status 202 * 203 * DESCRIPTION: Initialize the table manager, get the RSDP and RSDT/XSDT. 204 * 205 * NOTE: Allows static allocation of the initial table array in order 206 * to avoid the use of dynamic memory in confined environments 207 * such as the kernel boot sequence where it may not be available. 208 * 209 * If the host OS memory managers are initialized, use NULL for 210 * InitialTableArray, and the table will be dynamically allocated. 211 * 212 ******************************************************************************/ 213 214 ACPI_STATUS ACPI_INIT_FUNCTION 215 AcpiInitializeTables ( 216 ACPI_TABLE_DESC *InitialTableArray, 217 UINT32 InitialTableCount, 218 BOOLEAN AllowResize) 219 { 220 ACPI_PHYSICAL_ADDRESS RsdpAddress; 221 ACPI_STATUS Status; 222 223 224 ACPI_FUNCTION_TRACE (AcpiInitializeTables); 225 226 227 /* 228 * Setup the Root Table Array and allocate the table array 229 * if requested 230 */ 231 if (!InitialTableArray) 232 { 233 Status = AcpiAllocateRootTable (InitialTableCount); 234 if (ACPI_FAILURE (Status)) 235 { 236 return_ACPI_STATUS (Status); 237 } 238 } 239 else 240 { 241 /* Root Table Array has been statically allocated by the host */ 242 243 memset (InitialTableArray, 0, 244 (ACPI_SIZE) InitialTableCount * sizeof (ACPI_TABLE_DESC)); 245 246 AcpiGbl_RootTableList.Tables = InitialTableArray; 247 AcpiGbl_RootTableList.MaxTableCount = InitialTableCount; 248 AcpiGbl_RootTableList.Flags = ACPI_ROOT_ORIGIN_UNKNOWN; 249 if (AllowResize) 250 { 251 AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE; 252 } 253 } 254 255 /* Get the address of the RSDP */ 256 257 RsdpAddress = AcpiOsGetRootPointer (); 258 if (!RsdpAddress) 259 { 260 return_ACPI_STATUS (AE_NOT_FOUND); 261 } 262 263 /* 264 * Get the root table (RSDT or XSDT) and extract all entries to the local 265 * Root Table Array. This array contains the information of the RSDT/XSDT 266 * in a common, more useable format. 267 */ 268 Status = AcpiTbParseRootTable (RsdpAddress); 269 return_ACPI_STATUS (Status); 270 } 271 272 ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeTables) 273 274 275 /******************************************************************************* 276 * 277 * FUNCTION: AcpiReallocateRootTable 278 * 279 * PARAMETERS: None 280 * 281 * RETURN: Status 282 * 283 * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the 284 * root list from the previously provided scratch area. Should 285 * be called once dynamic memory allocation is available in the 286 * kernel. 287 * 288 ******************************************************************************/ 289 290 ACPI_STATUS ACPI_INIT_FUNCTION 291 AcpiReallocateRootTable ( 292 void) 293 { 294 ACPI_STATUS Status; 295 UINT32 i; 296 297 298 ACPI_FUNCTION_TRACE (AcpiReallocateRootTable); 299 300 301 /* 302 * Only reallocate the root table if the host provided a static buffer 303 * for the table array in the call to AcpiInitializeTables. 304 */ 305 if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED) 306 { 307 return_ACPI_STATUS (AE_SUPPORT); 308 } 309 310 /* 311 * Ensure OS early boot logic, which is required by some hosts. If the 312 * table state is reported to be wrong, developers should fix the 313 * issue by invoking AcpiPutTable() for the reported table during the 314 * early stage. 315 */ 316 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) 317 { 318 if (AcpiGbl_RootTableList.Tables[i].Pointer) 319 { 320 ACPI_ERROR ((AE_INFO, 321 "Table [%4.4s] is not invalidated during early boot stage", 322 AcpiGbl_RootTableList.Tables[i].Signature.Ascii)); 323 } 324 } 325 326 AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE; 327 328 Status = AcpiTbResizeRootTableList (); 329 return_ACPI_STATUS (Status); 330 } 331 332 ACPI_EXPORT_SYMBOL_INIT (AcpiReallocateRootTable) 333 334 335 /******************************************************************************* 336 * 337 * FUNCTION: AcpiGetTableHeader 338 * 339 * PARAMETERS: Signature - ACPI signature of needed table 340 * Instance - Which instance (for SSDTs) 341 * OutTableHeader - The pointer to the table header to fill 342 * 343 * RETURN: Status and pointer to mapped table header 344 * 345 * DESCRIPTION: Finds an ACPI table header. 346 * 347 * NOTE: Caller is responsible in unmapping the header with 348 * AcpiOsUnmapMemory 349 * 350 ******************************************************************************/ 351 352 ACPI_STATUS 353 AcpiGetTableHeader ( 354 char *Signature, 355 UINT32 Instance, 356 ACPI_TABLE_HEADER *OutTableHeader) 357 { 358 UINT32 i; 359 UINT32 j; 360 ACPI_TABLE_HEADER *Header; 361 362 363 /* Parameter validation */ 364 365 if (!Signature || !OutTableHeader) 366 { 367 return (AE_BAD_PARAMETER); 368 } 369 370 /* Walk the root table list */ 371 372 for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) 373 { 374 if (!ACPI_COMPARE_NAME ( 375 &(AcpiGbl_RootTableList.Tables[i].Signature), Signature)) 376 { 377 continue; 378 } 379 380 if (++j < Instance) 381 { 382 continue; 383 } 384 385 if (!AcpiGbl_RootTableList.Tables[i].Pointer) 386 { 387 if ((AcpiGbl_RootTableList.Tables[i].Flags & 388 ACPI_TABLE_ORIGIN_MASK) == 389 ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL) 390 { 391 Header = AcpiOsMapMemory ( 392 AcpiGbl_RootTableList.Tables[i].Address, 393 sizeof (ACPI_TABLE_HEADER)); 394 if (!Header) 395 { 396 return (AE_NO_MEMORY); 397 } 398 399 memcpy (OutTableHeader, Header, sizeof (ACPI_TABLE_HEADER)); 400 AcpiOsUnmapMemory (Header, sizeof (ACPI_TABLE_HEADER)); 401 } 402 else 403 { 404 return (AE_NOT_FOUND); 405 } 406 } 407 else 408 { 409 memcpy (OutTableHeader, 410 AcpiGbl_RootTableList.Tables[i].Pointer, 411 sizeof (ACPI_TABLE_HEADER)); 412 } 413 414 return (AE_OK); 415 } 416 417 return (AE_NOT_FOUND); 418 } 419 420 ACPI_EXPORT_SYMBOL (AcpiGetTableHeader) 421 422 423 /******************************************************************************* 424 * 425 * FUNCTION: AcpiGetTable 426 * 427 * PARAMETERS: Signature - ACPI signature of needed table 428 * Instance - Which instance (for SSDTs) 429 * OutTable - Where the pointer to the table is returned 430 * 431 * RETURN: Status and pointer to the requested table 432 * 433 * DESCRIPTION: Finds and verifies an ACPI table. Table must be in the 434 * RSDT/XSDT. 435 * Note that an early stage AcpiGetTable() call must be paired 436 * with an early stage AcpiPutTable() call. otherwise the table 437 * pointer mapped by the early stage mapping implementation may be 438 * erroneously unmapped by the late stage unmapping implementation 439 * in an AcpiPutTable() invoked during the late stage. 440 * 441 ******************************************************************************/ 442 443 ACPI_STATUS 444 AcpiGetTable ( 445 char *Signature, 446 UINT32 Instance, 447 ACPI_TABLE_HEADER **OutTable) 448 { 449 UINT32 i; 450 UINT32 j; 451 ACPI_STATUS Status = AE_NOT_FOUND; 452 ACPI_TABLE_DESC *TableDesc; 453 454 455 /* Parameter validation */ 456 457 if (!Signature || !OutTable) 458 { 459 return (AE_BAD_PARAMETER); 460 } 461 462 /* 463 * Note that the following line is required by some OSPMs, they only 464 * check if the returned table is NULL instead of the returned status 465 * to determined if this function is succeeded. 466 */ 467 *OutTable = NULL; 468 469 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); 470 471 /* Walk the root table list */ 472 473 for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) 474 { 475 TableDesc = &AcpiGbl_RootTableList.Tables[i]; 476 477 if (!ACPI_COMPARE_NAME (&TableDesc->Signature, Signature)) 478 { 479 continue; 480 } 481 482 if (++j < Instance) 483 { 484 continue; 485 } 486 487 Status = AcpiTbGetTable (TableDesc, OutTable); 488 break; 489 } 490 491 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); 492 return (Status); 493 } 494 495 ACPI_EXPORT_SYMBOL (AcpiGetTable) 496 497 498 /******************************************************************************* 499 * 500 * FUNCTION: AcpiPutTable 501 * 502 * PARAMETERS: Table - The pointer to the table 503 * 504 * RETURN: None 505 * 506 * DESCRIPTION: Release a table returned by AcpiGetTable() and its clones. 507 * Note that it is not safe if this function was invoked after an 508 * uninstallation happened to the original table descriptor. 509 * Currently there is no OSPMs' requirement to handle such 510 * situations. 511 * 512 ******************************************************************************/ 513 514 void 515 AcpiPutTable ( 516 ACPI_TABLE_HEADER *Table) 517 { 518 UINT32 i; 519 ACPI_TABLE_DESC *TableDesc; 520 521 522 ACPI_FUNCTION_TRACE (AcpiPutTable); 523 524 525 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); 526 527 /* Walk the root table list */ 528 529 for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++) 530 { 531 TableDesc = &AcpiGbl_RootTableList.Tables[i]; 532 533 if (TableDesc->Pointer != Table) 534 { 535 continue; 536 } 537 538 AcpiTbPutTable (TableDesc); 539 break; 540 } 541 542 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); 543 return_VOID; 544 } 545 546 ACPI_EXPORT_SYMBOL (AcpiPutTable) 547 548 549 /******************************************************************************* 550 * 551 * FUNCTION: AcpiGetTableByIndex 552 * 553 * PARAMETERS: TableIndex - Table index 554 * OutTable - Where the pointer to the table is returned 555 * 556 * RETURN: Status and pointer to the requested table 557 * 558 * DESCRIPTION: Obtain a table by an index into the global table list. Used 559 * internally also. 560 * 561 ******************************************************************************/ 562 563 ACPI_STATUS 564 AcpiGetTableByIndex ( 565 UINT32 TableIndex, 566 ACPI_TABLE_HEADER **OutTable) 567 { 568 ACPI_STATUS Status; 569 570 571 ACPI_FUNCTION_TRACE (AcpiGetTableByIndex); 572 573 574 /* Parameter validation */ 575 576 if (!OutTable) 577 { 578 return_ACPI_STATUS (AE_BAD_PARAMETER); 579 } 580 581 /* 582 * Note that the following line is required by some OSPMs, they only 583 * check if the returned table is NULL instead of the returned status 584 * to determined if this function is succeeded. 585 */ 586 *OutTable = NULL; 587 588 (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES); 589 590 /* Validate index */ 591 592 if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount) 593 { 594 Status = AE_BAD_PARAMETER; 595 goto UnlockAndExit; 596 } 597 598 Status = AcpiTbGetTable ( 599 &AcpiGbl_RootTableList.Tables[TableIndex], OutTable); 600 601 UnlockAndExit: 602 (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES); 603 return_ACPI_STATUS (Status); 604 } 605 606 ACPI_EXPORT_SYMBOL (AcpiGetTableByIndex) 607 608 609 /******************************************************************************* 610 * 611 * FUNCTION: AcpiInstallTableHandler 612 * 613 * PARAMETERS: Handler - Table event handler 614 * Context - Value passed to the handler on each event 615 * 616 * RETURN: Status 617 * 618 * DESCRIPTION: Install a global table event handler. 619 * 620 ******************************************************************************/ 621 622 ACPI_STATUS 623 AcpiInstallTableHandler ( 624 ACPI_TABLE_HANDLER Handler, 625 void *Context) 626 { 627 ACPI_STATUS Status; 628 629 630 ACPI_FUNCTION_TRACE (AcpiInstallTableHandler); 631 632 633 if (!Handler) 634 { 635 return_ACPI_STATUS (AE_BAD_PARAMETER); 636 } 637 638 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); 639 if (ACPI_FAILURE (Status)) 640 { 641 return_ACPI_STATUS (Status); 642 } 643 644 /* Don't allow more than one handler */ 645 646 if (AcpiGbl_TableHandler) 647 { 648 Status = AE_ALREADY_EXISTS; 649 goto Cleanup; 650 } 651 652 /* Install the handler */ 653 654 AcpiGbl_TableHandler = Handler; 655 AcpiGbl_TableHandlerContext = Context; 656 657 Cleanup: 658 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); 659 return_ACPI_STATUS (Status); 660 } 661 662 ACPI_EXPORT_SYMBOL (AcpiInstallTableHandler) 663 664 665 /******************************************************************************* 666 * 667 * FUNCTION: AcpiRemoveTableHandler 668 * 669 * PARAMETERS: Handler - Table event handler that was installed 670 * previously. 671 * 672 * RETURN: Status 673 * 674 * DESCRIPTION: Remove a table event handler 675 * 676 ******************************************************************************/ 677 678 ACPI_STATUS 679 AcpiRemoveTableHandler ( 680 ACPI_TABLE_HANDLER Handler) 681 { 682 ACPI_STATUS Status; 683 684 685 ACPI_FUNCTION_TRACE (AcpiRemoveTableHandler); 686 687 688 Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS); 689 if (ACPI_FAILURE (Status)) 690 { 691 return_ACPI_STATUS (Status); 692 } 693 694 /* Make sure that the installed handler is the same */ 695 696 if (!Handler || 697 Handler != AcpiGbl_TableHandler) 698 { 699 Status = AE_BAD_PARAMETER; 700 goto Cleanup; 701 } 702 703 /* Remove the handler */ 704 705 AcpiGbl_TableHandler = NULL; 706 707 Cleanup: 708 (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS); 709 return_ACPI_STATUS (Status); 710 } 711 712 ACPI_EXPORT_SYMBOL (AcpiRemoveTableHandler) 713