167754Smsmith/****************************************************************************** 267754Smsmith * 367754Smsmith * Module Name: tbinstal - ACPI table installation and removal 467754Smsmith * 567754Smsmith *****************************************************************************/ 667754Smsmith 7217365Sjkim/* 8298714Sjkim * Copyright (C) 2000 - 2016, Intel Corp. 970243Smsmith * All rights reserved. 1067754Smsmith * 11217365Sjkim * Redistribution and use in source and binary forms, with or without 12217365Sjkim * modification, are permitted provided that the following conditions 13217365Sjkim * are met: 14217365Sjkim * 1. Redistributions of source code must retain the above copyright 15217365Sjkim * notice, this list of conditions, and the following disclaimer, 16217365Sjkim * without modification. 17217365Sjkim * 2. Redistributions in binary form must reproduce at minimum a disclaimer 18217365Sjkim * substantially similar to the "NO WARRANTY" disclaimer below 19217365Sjkim * ("Disclaimer") and any redistribution must be conditioned upon 20217365Sjkim * including a substantially similar Disclaimer requirement for further 21217365Sjkim * binary redistribution. 22217365Sjkim * 3. Neither the names of the above-listed copyright holders nor the names 23217365Sjkim * of any contributors may be used to endorse or promote products derived 24217365Sjkim * from this software without specific prior written permission. 2567754Smsmith * 26217365Sjkim * Alternatively, this software may be distributed under the terms of the 27217365Sjkim * GNU General Public License ("GPL") version 2 as published by the Free 28217365Sjkim * Software Foundation. 2967754Smsmith * 30217365Sjkim * NO WARRANTY 31217365Sjkim * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 32217365Sjkim * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 33217365Sjkim * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR 34217365Sjkim * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 35217365Sjkim * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 36217365Sjkim * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 37217365Sjkim * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 38217365Sjkim * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 39217365Sjkim * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 40217365Sjkim * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 41217365Sjkim * POSSIBILITY OF SUCH DAMAGES. 42217365Sjkim */ 4367754Smsmith 44193341Sjkim#include <contrib/dev/acpica/include/acpi.h> 45193341Sjkim#include <contrib/dev/acpica/include/accommon.h> 46193341Sjkim#include <contrib/dev/acpica/include/actables.h> 4767754Smsmith 4877424Smsmith#define _COMPONENT ACPI_TABLES 4991116Smsmith ACPI_MODULE_NAME ("tbinstal") 5067754Smsmith 51272444Sjkim/* Local prototypes */ 5267754Smsmith 53272444Sjkimstatic BOOLEAN 54272444SjkimAcpiTbCompareTables ( 55272444Sjkim ACPI_TABLE_DESC *TableDesc, 56272444Sjkim UINT32 TableIndex); 57272444Sjkim 58272444Sjkim 59272444Sjkim/******************************************************************************* 6067754Smsmith * 61272444Sjkim * FUNCTION: AcpiTbCompareTables 6291116Smsmith * 63272444Sjkim * PARAMETERS: TableDesc - Table 1 descriptor to be compared 64272444Sjkim * TableIndex - Index of table 2 to be compared 6591116Smsmith * 66272444Sjkim * RETURN: TRUE if both tables are identical. 6791116Smsmith * 68272444Sjkim * DESCRIPTION: This function compares a table with another table that has 69272444Sjkim * already been installed in the root table list. 7091116Smsmith * 71272444Sjkim ******************************************************************************/ 7291116Smsmith 73272444Sjkimstatic BOOLEAN 74272444SjkimAcpiTbCompareTables ( 75272444Sjkim ACPI_TABLE_DESC *TableDesc, 76272444Sjkim UINT32 TableIndex) 7791116Smsmith{ 78167802Sjkim ACPI_STATUS Status = AE_OK; 79272444Sjkim BOOLEAN IsIdentical; 80272444Sjkim ACPI_TABLE_HEADER *Table; 81272444Sjkim UINT32 TableLength; 82272444Sjkim UINT8 TableFlags; 8391116Smsmith 8491116Smsmith 85272444Sjkim Status = AcpiTbAcquireTable (&AcpiGbl_RootTableList.Tables[TableIndex], 86298714Sjkim &Table, &TableLength, &TableFlags); 87272444Sjkim if (ACPI_FAILURE (Status)) 8891116Smsmith { 89272444Sjkim return (FALSE); 90167802Sjkim } 9191116Smsmith 92272444Sjkim /* 93272444Sjkim * Check for a table match on the entire table length, 94272444Sjkim * not just the header. 95272444Sjkim */ 96272444Sjkim IsIdentical = (BOOLEAN)((TableDesc->Length != TableLength || 97284583Sjkim memcmp (TableDesc->Pointer, Table, TableLength)) ? 98272444Sjkim FALSE : TRUE); 9991116Smsmith 100272444Sjkim /* Release the acquired table */ 10191116Smsmith 102272444Sjkim AcpiTbReleaseTable (Table, TableLength, TableFlags); 103272444Sjkim return (IsIdentical); 10491116Smsmith} 10591116Smsmith 10691116Smsmith 10791116Smsmith/******************************************************************************* 10891116Smsmith * 109272444Sjkim * FUNCTION: AcpiTbInstallTableWithOverride 11067754Smsmith * 111287168Sjkim * PARAMETERS: NewTableDesc - New table descriptor to install 112272444Sjkim * Override - Whether override should be performed 113287168Sjkim * TableIndex - Where the table index is returned 11467754Smsmith * 115272444Sjkim * RETURN: None 11667754Smsmith * 117272444Sjkim * DESCRIPTION: Install an ACPI table into the global data structure. The 118272444Sjkim * table override mechanism is called to allow the host 119272444Sjkim * OS to replace any table before it is installed in the root 120272444Sjkim * table array. 12167754Smsmith * 12267754Smsmith ******************************************************************************/ 12367754Smsmith 124272444Sjkimvoid 125272444SjkimAcpiTbInstallTableWithOverride ( 126272444Sjkim ACPI_TABLE_DESC *NewTableDesc, 127287168Sjkim BOOLEAN Override, 128287168Sjkim UINT32 *TableIndex) 12967754Smsmith{ 130287168Sjkim UINT32 i; 131287168Sjkim ACPI_STATUS Status; 13267754Smsmith 133287168Sjkim 134287168Sjkim Status = AcpiTbGetNextTableDescriptor (&i, NULL); 135287168Sjkim if (ACPI_FAILURE (Status)) 136167802Sjkim { 137272444Sjkim return; 138167802Sjkim } 13967754Smsmith 140193267Sjkim /* 141272444Sjkim * ACPI Table Override: 142222544Sjkim * 143272444Sjkim * Before we install the table, let the host OS override it with a new 144272444Sjkim * one if desired. Any table within the RSDT/XSDT can be replaced, 145272444Sjkim * including the DSDT which is pointed to by the FADT. 146193267Sjkim */ 147272444Sjkim if (Override) 148222544Sjkim { 149272444Sjkim AcpiTbOverrideTable (NewTableDesc); 150222544Sjkim } 151222544Sjkim 152287168Sjkim AcpiTbInitTableDescriptor (&AcpiGbl_RootTableList.Tables[i], 153272444Sjkim NewTableDesc->Address, NewTableDesc->Flags, NewTableDesc->Pointer); 154167802Sjkim 155272444Sjkim AcpiTbPrintTableHeader (NewTableDesc->Address, NewTableDesc->Pointer); 156167802Sjkim 157287168Sjkim /* This synchronizes AcpiGbl_DsdtIndex */ 158287168Sjkim 159287168Sjkim *TableIndex = i; 160287168Sjkim 161272444Sjkim /* Set the global integer width (based upon revision of the DSDT) */ 162167802Sjkim 163287168Sjkim if (i == AcpiGbl_DsdtIndex) 164100966Siwasaki { 165272444Sjkim AcpiUtSetIntegerWidth (NewTableDesc->Pointer->Revision); 166100966Siwasaki } 16767754Smsmith} 16867754Smsmith 16967754Smsmith 17067754Smsmith/******************************************************************************* 17167754Smsmith * 172272444Sjkim * FUNCTION: AcpiTbInstallFixedTable 173231844Sjkim * 174272444Sjkim * PARAMETERS: Address - Physical address of DSDT or FACS 175272444Sjkim * Signature - Table signature, NULL if no need to 176272444Sjkim * match 177287168Sjkim * TableIndex - Where the table index is returned 178231844Sjkim * 179272444Sjkim * RETURN: Status 180231844Sjkim * 181272444Sjkim * DESCRIPTION: Install a fixed ACPI table (DSDT/FACS) into the global data 182272444Sjkim * structure. 183231844Sjkim * 184231844Sjkim ******************************************************************************/ 185231844Sjkim 186272444SjkimACPI_STATUS 187272444SjkimAcpiTbInstallFixedTable ( 188272444Sjkim ACPI_PHYSICAL_ADDRESS Address, 189272444Sjkim char *Signature, 190287168Sjkim UINT32 *TableIndex) 191231844Sjkim{ 192272444Sjkim ACPI_TABLE_DESC NewTableDesc; 193231844Sjkim ACPI_STATUS Status; 194231844Sjkim 195231844Sjkim 196272444Sjkim ACPI_FUNCTION_TRACE (TbInstallFixedTable); 197231844Sjkim 198272444Sjkim 199272444Sjkim if (!Address) 200231844Sjkim { 201272444Sjkim ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]", 202272444Sjkim Signature)); 203272444Sjkim return (AE_NO_MEMORY); 204231844Sjkim } 205231844Sjkim 206272444Sjkim /* Fill a table descriptor for validation */ 207231844Sjkim 208272444Sjkim Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, 209298714Sjkim ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); 210272444Sjkim if (ACPI_FAILURE (Status)) 211231844Sjkim { 212281396Sjkim ACPI_ERROR ((AE_INFO, "Could not acquire table length at %8.8X%8.8X", 213281396Sjkim ACPI_FORMAT_UINT64 (Address))); 214272444Sjkim return_ACPI_STATUS (Status); 215272444Sjkim } 216231844Sjkim 217272444Sjkim /* Validate and verify a table before installation */ 218231844Sjkim 219272444Sjkim Status = AcpiTbVerifyTempTable (&NewTableDesc, Signature); 220272444Sjkim if (ACPI_FAILURE (Status)) 221272444Sjkim { 222272444Sjkim goto ReleaseAndExit; 223231844Sjkim } 224231844Sjkim 225287168Sjkim /* Add the table to the global root table list */ 226231844Sjkim 227287168Sjkim AcpiTbInstallTableWithOverride (&NewTableDesc, TRUE, TableIndex); 228287168Sjkim 229272444SjkimReleaseAndExit: 230231844Sjkim 231272444Sjkim /* Release the temporary table descriptor */ 232231844Sjkim 233272444Sjkim AcpiTbReleaseTempTable (&NewTableDesc); 234272444Sjkim return_ACPI_STATUS (Status); 235231844Sjkim} 236231844Sjkim 237231844Sjkim 238231844Sjkim/******************************************************************************* 239231844Sjkim * 240272444Sjkim * FUNCTION: AcpiTbInstallStandardTable 24167754Smsmith * 242272444Sjkim * PARAMETERS: Address - Address of the table (might be a virtual 243272444Sjkim * address depending on the TableFlags) 244272444Sjkim * Flags - Flags for the table 245272444Sjkim * Reload - Whether reload should be performed 246272444Sjkim * Override - Whether override should be performed 247272444Sjkim * TableIndex - Where the table index is returned 24867754Smsmith * 24967754Smsmith * RETURN: Status 25067754Smsmith * 251272444Sjkim * DESCRIPTION: This function is called to install an ACPI table that is 252272444Sjkim * neither DSDT nor FACS (a "standard" table.) 253272444Sjkim * When this function is called by "Load" or "LoadTable" opcodes, 254272444Sjkim * or by AcpiLoadTable() API, the "Reload" parameter is set. 255272444Sjkim * After sucessfully returning from this function, table is 256272444Sjkim * "INSTALLED" but not "VALIDATED". 25767754Smsmith * 25867754Smsmith ******************************************************************************/ 25967754Smsmith 26067754SmsmithACPI_STATUS 261272444SjkimAcpiTbInstallStandardTable ( 262272444Sjkim ACPI_PHYSICAL_ADDRESS Address, 263272444Sjkim UINT8 Flags, 264272444Sjkim BOOLEAN Reload, 265272444Sjkim BOOLEAN Override, 266272444Sjkim UINT32 *TableIndex) 26767754Smsmith{ 268272444Sjkim UINT32 i; 269272444Sjkim ACPI_STATUS Status = AE_OK; 270272444Sjkim ACPI_TABLE_DESC NewTableDesc; 27167754Smsmith 27267754Smsmith 273272444Sjkim ACPI_FUNCTION_TRACE (TbInstallStandardTable); 27467754Smsmith 27567754Smsmith 276272444Sjkim /* Acquire a temporary table descriptor for validation */ 27767754Smsmith 278272444Sjkim Status = AcpiTbAcquireTempTable (&NewTableDesc, Address, Flags); 279272444Sjkim if (ACPI_FAILURE (Status)) 28067754Smsmith { 281298714Sjkim ACPI_ERROR ((AE_INFO, 282298714Sjkim "Could not acquire table length at %8.8X%8.8X", 283281396Sjkim ACPI_FORMAT_UINT64 (Address))); 284272444Sjkim return_ACPI_STATUS (Status); 28567754Smsmith } 28667754Smsmith 287272444Sjkim /* 288272444Sjkim * Optionally do not load any SSDTs from the RSDT/XSDT. This can 289272444Sjkim * be useful for debugging ACPI problems on some machines. 290272444Sjkim */ 291272444Sjkim if (!Reload && 292272444Sjkim AcpiGbl_DisableSsdtTableInstall && 293272444Sjkim ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) 294240716Sjkim { 295298714Sjkim ACPI_INFO (( 296298714Sjkim "Ignoring installation of %4.4s at %8.8X%8.8X", 297281396Sjkim NewTableDesc.Signature.Ascii, ACPI_FORMAT_UINT64 (Address))); 298272444Sjkim goto ReleaseAndExit; 299240716Sjkim } 300240716Sjkim 301272444Sjkim /* Validate and verify a table before installation */ 302272444Sjkim 303272444Sjkim Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL); 304272444Sjkim if (ACPI_FAILURE (Status)) 30567754Smsmith { 306272444Sjkim goto ReleaseAndExit; 30799146Siwasaki } 30891116Smsmith 309272444Sjkim if (Reload) 31099146Siwasaki { 311272444Sjkim /* 312272444Sjkim * Validate the incoming table signature. 313272444Sjkim * 314272444Sjkim * 1) Originally, we checked the table signature for "SSDT" or "PSDT". 315272444Sjkim * 2) We added support for OEMx tables, signature "OEM". 316272444Sjkim * 3) Valid tables were encountered with a null signature, so we just 317272444Sjkim * gave up on validating the signature, (05/2008). 318272444Sjkim * 4) We encountered non-AML tables such as the MADT, which caused 319272444Sjkim * interpreter errors and kernel faults. So now, we once again allow 320272444Sjkim * only "SSDT", "OEMx", and now, also a null signature. (05/2011). 321272444Sjkim */ 322272444Sjkim if ((NewTableDesc.Signature.Ascii[0] != 0x00) && 323272444Sjkim (!ACPI_COMPARE_NAME (&NewTableDesc.Signature, ACPI_SIG_SSDT)) && 324284583Sjkim (strncmp (NewTableDesc.Signature.Ascii, "OEM", 3))) 325272444Sjkim { 326272444Sjkim ACPI_BIOS_ERROR ((AE_INFO, 327272444Sjkim "Table has invalid signature [%4.4s] (0x%8.8X), " 328272444Sjkim "must be SSDT or OEMx", 329298714Sjkim AcpiUtValidNameseg (NewTableDesc.Signature.Ascii) ? 330272444Sjkim NewTableDesc.Signature.Ascii : "????", 331272444Sjkim NewTableDesc.Signature.Integer)); 332167802Sjkim 333272444Sjkim Status = AE_BAD_SIGNATURE; 334272444Sjkim goto ReleaseAndExit; 335167802Sjkim } 33691116Smsmith 337272444Sjkim /* Check if table is already registered */ 33899146Siwasaki 339272444Sjkim for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i) 340272444Sjkim { 341272444Sjkim /* 342272444Sjkim * Check for a table match on the entire table length, 343272444Sjkim * not just the header. 344272444Sjkim */ 345272444Sjkim if (!AcpiTbCompareTables (&NewTableDesc, i)) 346272444Sjkim { 347272444Sjkim continue; 348272444Sjkim } 34967754Smsmith 350272444Sjkim /* 351272444Sjkim * Note: the current mechanism does not unregister a table if it is 352272444Sjkim * dynamically unloaded. The related namespace entries are deleted, 353272444Sjkim * but the table remains in the root table list. 354272444Sjkim * 355272444Sjkim * The assumption here is that the number of different tables that 356272444Sjkim * will be loaded is actually small, and there is minimal overhead 357272444Sjkim * in just keeping the table in case it is needed again. 358272444Sjkim * 359272444Sjkim * If this assumption changes in the future (perhaps on large 360272444Sjkim * machines with many table load/unload operations), tables will 361272444Sjkim * need to be unregistered when they are unloaded, and slots in the 362272444Sjkim * root table list should be reused when empty. 363272444Sjkim */ 364298714Sjkim if (AcpiGbl_RootTableList.Tables[i].Flags & 365298714Sjkim ACPI_TABLE_IS_LOADED) 366272444Sjkim { 367272444Sjkim /* Table is still loaded, this is an error */ 36867754Smsmith 369272444Sjkim Status = AE_ALREADY_EXISTS; 370272444Sjkim goto ReleaseAndExit; 371272444Sjkim } 372272444Sjkim else 373272444Sjkim { 374272444Sjkim /* 375272444Sjkim * Table was unloaded, allow it to be reloaded. 376272444Sjkim * As we are going to return AE_OK to the caller, we should 377272444Sjkim * take the responsibility of freeing the input descriptor. 378272444Sjkim * Refill the input descriptor to ensure 379272444Sjkim * AcpiTbInstallTableWithOverride() can be called again to 380272444Sjkim * indicate the re-installation. 381272444Sjkim */ 382272444Sjkim AcpiTbUninstallTable (&NewTableDesc); 383272444Sjkim *TableIndex = i; 384272444Sjkim return_ACPI_STATUS (AE_OK); 385272444Sjkim } 386167802Sjkim } 387117521Snjl } 388117521Snjl 389272444Sjkim /* Add the table to the global root table list */ 390207344Sjkim 391287168Sjkim AcpiTbInstallTableWithOverride (&NewTableDesc, Override, TableIndex); 39267754Smsmith 393272444SjkimReleaseAndExit: 39467754Smsmith 395272444Sjkim /* Release the temporary table descriptor */ 396250838Sjkim 397272444Sjkim AcpiTbReleaseTempTable (&NewTableDesc); 398272444Sjkim return_ACPI_STATUS (Status); 39967754Smsmith} 40067754Smsmith 40167754Smsmith 40267754Smsmith/******************************************************************************* 40367754Smsmith * 404272444Sjkim * FUNCTION: AcpiTbOverrideTable 40567754Smsmith * 406272444Sjkim * PARAMETERS: OldTableDesc - Validated table descriptor to be 407272444Sjkim * overridden 40867754Smsmith * 409167802Sjkim * RETURN: None 41067754Smsmith * 411272444Sjkim * DESCRIPTION: Attempt table override by calling the OSL override functions. 412272444Sjkim * Note: If the table is overridden, then the entire new table 413272444Sjkim * is acquired and returned by this function. 414272444Sjkim * Before/after invocation, the table descriptor is in a state 415272444Sjkim * that is "VALIDATED". 41667754Smsmith * 41767754Smsmith ******************************************************************************/ 41867754Smsmith 41967754Smsmithvoid 420272444SjkimAcpiTbOverrideTable ( 421272444Sjkim ACPI_TABLE_DESC *OldTableDesc) 42267754Smsmith{ 423272444Sjkim ACPI_STATUS Status; 424272444Sjkim char *OverrideType; 425272444Sjkim ACPI_TABLE_DESC NewTableDesc; 426272444Sjkim ACPI_TABLE_HEADER *Table; 427272444Sjkim ACPI_PHYSICAL_ADDRESS Address; 428272444Sjkim UINT32 Length; 42967754Smsmith 43067754Smsmith 431272444Sjkim /* (1) Attempt logical override (returns a logical address) */ 432167802Sjkim 433272444Sjkim Status = AcpiOsTableOverride (OldTableDesc->Pointer, &Table); 434272444Sjkim if (ACPI_SUCCESS (Status) && Table) 435167802Sjkim { 436272444Sjkim AcpiTbAcquireTempTable (&NewTableDesc, ACPI_PTR_TO_PHYSADDR (Table), 437272444Sjkim ACPI_TABLE_ORIGIN_EXTERNAL_VIRTUAL); 438272444Sjkim OverrideType = "Logical"; 439272444Sjkim goto FinishOverride; 440167802Sjkim } 441167802Sjkim 442272444Sjkim /* (2) Attempt physical override (returns a physical address) */ 443272444Sjkim 444272444Sjkim Status = AcpiOsPhysicalTableOverride (OldTableDesc->Pointer, 445272444Sjkim &Address, &Length); 446272444Sjkim if (ACPI_SUCCESS (Status) && Address && Length) 44767754Smsmith { 448272444Sjkim AcpiTbAcquireTempTable (&NewTableDesc, Address, 449272444Sjkim ACPI_TABLE_ORIGIN_INTERNAL_PHYSICAL); 450272444Sjkim OverrideType = "Physical"; 451272444Sjkim goto FinishOverride; 45267754Smsmith } 453167802Sjkim 454272444Sjkim return; /* There was no override */ 455167802Sjkim 456241973Sjkim 457272444SjkimFinishOverride: 45867754Smsmith 459272444Sjkim /* Validate and verify a table before overriding */ 46067754Smsmith 461272444Sjkim Status = AcpiTbVerifyTempTable (&NewTableDesc, NULL); 462193267Sjkim if (ACPI_FAILURE (Status)) 46367754Smsmith { 464272444Sjkim return; 46567754Smsmith } 466193267Sjkim 467298714Sjkim ACPI_INFO (("%4.4s 0x%8.8X%8.8X" 468281396Sjkim " %s table override, new table: 0x%8.8X%8.8X", 469272444Sjkim OldTableDesc->Signature.Ascii, 470281396Sjkim ACPI_FORMAT_UINT64 (OldTableDesc->Address), 471281396Sjkim OverrideType, ACPI_FORMAT_UINT64 (NewTableDesc.Address))); 472193267Sjkim 473272444Sjkim /* We can now uninstall the original table */ 47467754Smsmith 475272444Sjkim AcpiTbUninstallTable (OldTableDesc); 476193267Sjkim 477193267Sjkim /* 478272444Sjkim * Replace the original table descriptor and keep its state as 479272444Sjkim * "VALIDATED". 480193267Sjkim */ 481272444Sjkim AcpiTbInitTableDescriptor (OldTableDesc, NewTableDesc.Address, 482272444Sjkim NewTableDesc.Flags, NewTableDesc.Pointer); 483272444Sjkim AcpiTbValidateTempTable (OldTableDesc); 484193267Sjkim 485272444Sjkim /* Release the temporary table descriptor */ 486193267Sjkim 487272444Sjkim AcpiTbReleaseTempTable (&NewTableDesc); 488167802Sjkim} 48967754Smsmith 49067754Smsmith 491167802Sjkim/******************************************************************************* 492167802Sjkim * 493272444Sjkim * FUNCTION: AcpiTbUninstallTable 49467754Smsmith * 495272444Sjkim * PARAMETERS: TableDesc - Table descriptor 49667754Smsmith * 497272444Sjkim * RETURN: None 49867754Smsmith * 499272444Sjkim * DESCRIPTION: Delete one internal ACPI table 50067754Smsmith * 50167754Smsmith ******************************************************************************/ 50267754Smsmith 503272444Sjkimvoid 504272444SjkimAcpiTbUninstallTable ( 505272444Sjkim ACPI_TABLE_DESC *TableDesc) 50667754Smsmith{ 50767754Smsmith 508272444Sjkim ACPI_FUNCTION_TRACE (TbUninstallTable); 50967754Smsmith 51067754Smsmith 511272444Sjkim /* Table must be installed */ 51267754Smsmith 513272444Sjkim if (!TableDesc->Address) 51467754Smsmith { 515272444Sjkim return_VOID; 51667754Smsmith } 51767754Smsmith 518272444Sjkim AcpiTbInvalidateTable (TableDesc); 51967754Smsmith 520272444Sjkim if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) == 521272444Sjkim ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL) 52267754Smsmith { 523281396Sjkim ACPI_FREE (ACPI_PHYSADDR_TO_PTR (TableDesc->Address)); 52467754Smsmith } 52567754Smsmith 526272444Sjkim TableDesc->Address = ACPI_PTR_TO_PHYSADDR (NULL); 527272444Sjkim return_VOID; 528167802Sjkim} 529