sbin/hammer2: Verify fstype UUID in hammer2_verify_volumes_common()
[dragonfly.git] / sys / contrib / dev / acpica / source / components / executer / exconfig.c
blobff26ade76570bbfb59c46bf16d5d6a22fd5d0bfd
1 /******************************************************************************
3 * Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
5 *****************************************************************************/
7 /******************************************************************************
9 * 1. Copyright Notice
11 * Some or all of this work - Copyright (c) 1999 - 2021, Intel Corp.
12 * All rights reserved.
14 * 2. License
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.
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
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;
37 * The above copyright and patent license is granted only if the following
38 * conditions are met:
40 * 3. Conditions
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.
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.
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.
72 * 3.4. Intel retains all right, title, and interest in and to the Original
73 * Intel Code.
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.
80 * 4. Disclaimer and Export Compliance
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
87 * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
88 * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
89 * PARTICULAR PURPOSE.
91 * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
92 * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
93 * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
94 * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
95 * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
96 * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
97 * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
98 * LIMITED REMEDY.
100 * 4.3. Licensee shall not export, either directly or indirectly, any of this
101 * software or system incorporating such software without first obtaining any
102 * required license or other approval from the U. S. Department of Commerce or
103 * any other agency or department of the United States Government. In the
104 * event Licensee exports any such software from the United States or
105 * re-exports any such software from a foreign destination, Licensee shall
106 * ensure that the distribution and export/re-export of the software is in
107 * compliance with all laws, regulations, orders, or other restrictions of the
108 * U.S. Export Administration Regulations. Licensee agrees that neither it nor
109 * any of its subsidiaries will export/re-export any technical data, process,
110 * software, or service, directly or indirectly, to any country for which the
111 * United States government or any agency thereof requires an export license,
112 * other governmental approval, or letter of assurance, without first obtaining
113 * such license, approval or letter.
115 *****************************************************************************
117 * Alternatively, you may choose to be licensed under the terms of the
118 * following license:
120 * Redistribution and use in source and binary forms, with or without
121 * modification, are permitted provided that the following conditions
122 * are met:
123 * 1. Redistributions of source code must retain the above copyright
124 * notice, this list of conditions, and the following disclaimer,
125 * without modification.
126 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
127 * substantially similar to the "NO WARRANTY" disclaimer below
128 * ("Disclaimer") and any redistribution must be conditioned upon
129 * including a substantially similar Disclaimer requirement for further
130 * binary redistribution.
131 * 3. Neither the names of the above-listed copyright holders nor the names
132 * of any contributors may be used to endorse or promote products derived
133 * from this software without specific prior written permission.
135 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
136 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
137 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
138 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
139 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
140 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
141 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
142 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
143 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
144 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
145 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
147 * Alternatively, you may choose to be licensed under the terms of the
148 * GNU General Public License ("GPL") version 2 as published by the Free
149 * Software Foundation.
151 *****************************************************************************/
153 #include "acpi.h"
154 #include "accommon.h"
155 #include "acinterp.h"
156 #include "acnamesp.h"
157 #include "actables.h"
158 #include "acdispat.h"
159 #include "acevents.h"
160 #include "amlcode.h"
163 #define _COMPONENT ACPI_EXECUTER
164 ACPI_MODULE_NAME ("exconfig")
166 /* Local prototypes */
168 static ACPI_STATUS
169 AcpiExAddTable (
170 UINT32 TableIndex,
171 ACPI_OPERAND_OBJECT **DdbHandle);
173 static ACPI_STATUS
174 AcpiExRegionRead (
175 ACPI_OPERAND_OBJECT *ObjDesc,
176 UINT32 Length,
177 UINT8 *Buffer);
180 /*******************************************************************************
182 * FUNCTION: AcpiExAddTable
184 * PARAMETERS: Table - Pointer to raw table
185 * ParentNode - Where to load the table (scope)
186 * DdbHandle - Where to return the table handle.
188 * RETURN: Status
190 * DESCRIPTION: Common function to Install and Load an ACPI table with a
191 * returned table handle.
193 ******************************************************************************/
195 static ACPI_STATUS
196 AcpiExAddTable (
197 UINT32 TableIndex,
198 ACPI_OPERAND_OBJECT **DdbHandle)
200 ACPI_OPERAND_OBJECT *ObjDesc;
203 ACPI_FUNCTION_TRACE (ExAddTable);
206 /* Create an object to be the table handle */
208 ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_LOCAL_REFERENCE);
209 if (!ObjDesc)
211 return_ACPI_STATUS (AE_NO_MEMORY);
214 /* Init the table handle */
216 ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
217 ObjDesc->Reference.Class = ACPI_REFCLASS_TABLE;
218 ObjDesc->Reference.Value = TableIndex;
219 *DdbHandle = ObjDesc;
220 return_ACPI_STATUS (AE_OK);
224 /*******************************************************************************
226 * FUNCTION: AcpiExLoadTableOp
228 * PARAMETERS: WalkState - Current state with operands
229 * ReturnDesc - Where to store the return object
231 * RETURN: Status
233 * DESCRIPTION: Load an ACPI table from the RSDT/XSDT
235 ******************************************************************************/
237 ACPI_STATUS
238 AcpiExLoadTableOp (
239 ACPI_WALK_STATE *WalkState,
240 ACPI_OPERAND_OBJECT **ReturnDesc)
242 ACPI_STATUS Status;
243 ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
244 ACPI_NAMESPACE_NODE *ParentNode;
245 ACPI_NAMESPACE_NODE *StartNode;
246 ACPI_NAMESPACE_NODE *ParameterNode = NULL;
247 ACPI_OPERAND_OBJECT *DdbHandle;
248 UINT32 TableIndex;
251 ACPI_FUNCTION_TRACE (ExLoadTableOp);
254 /* Find the ACPI table in the RSDT/XSDT */
256 AcpiExExitInterpreter ();
257 Status = AcpiTbFindTable (
258 Operand[0]->String.Pointer,
259 Operand[1]->String.Pointer,
260 Operand[2]->String.Pointer, &TableIndex);
261 AcpiExEnterInterpreter ();
262 if (ACPI_FAILURE (Status))
264 if (Status != AE_NOT_FOUND)
266 return_ACPI_STATUS (Status);
269 /* Table not found, return an Integer=0 and AE_OK */
271 DdbHandle = AcpiUtCreateIntegerObject ((UINT64) 0);
272 if (!DdbHandle)
274 return_ACPI_STATUS (AE_NO_MEMORY);
277 *ReturnDesc = DdbHandle;
278 return_ACPI_STATUS (AE_OK);
281 /* Default nodes */
283 StartNode = WalkState->ScopeInfo->Scope.Node;
284 ParentNode = AcpiGbl_RootNode;
286 /* RootPath (optional parameter) */
288 if (Operand[3]->String.Length > 0)
291 * Find the node referenced by the RootPathString. This is the
292 * location within the namespace where the table will be loaded.
294 Status = AcpiNsGetNodeUnlocked (StartNode,
295 Operand[3]->String.Pointer, ACPI_NS_SEARCH_PARENT,
296 &ParentNode);
297 if (ACPI_FAILURE (Status))
299 return_ACPI_STATUS (Status);
303 /* ParameterPath (optional parameter) */
305 if (Operand[4]->String.Length > 0)
307 if ((Operand[4]->String.Pointer[0] != AML_ROOT_PREFIX) &&
308 (Operand[4]->String.Pointer[0] != AML_PARENT_PREFIX))
311 * Path is not absolute, so it will be relative to the node
312 * referenced by the RootPathString (or the NS root if omitted)
314 StartNode = ParentNode;
317 /* Find the node referenced by the ParameterPathString */
319 Status = AcpiNsGetNodeUnlocked (StartNode,
320 Operand[4]->String.Pointer, ACPI_NS_SEARCH_PARENT,
321 &ParameterNode);
322 if (ACPI_FAILURE (Status))
324 return_ACPI_STATUS (Status);
328 /* Load the table into the namespace */
330 ACPI_INFO (("Dynamic OEM Table Load:"));
331 AcpiExExitInterpreter ();
332 Status = AcpiTbLoadTable (TableIndex, ParentNode);
333 AcpiExEnterInterpreter ();
334 if (ACPI_FAILURE (Status))
336 return_ACPI_STATUS (Status);
339 Status = AcpiExAddTable (TableIndex, &DdbHandle);
340 if (ACPI_FAILURE (Status))
342 return_ACPI_STATUS (Status);
345 /* Complete the initialization/resolution of new objects */
347 AcpiExExitInterpreter();
348 AcpiNsInitializeObjects();
349 AcpiExEnterInterpreter();
351 /* Parameter Data (optional) */
353 if (ParameterNode)
355 /* Store the parameter data into the optional parameter object */
357 Status = AcpiExStore (Operand[5],
358 ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode), WalkState);
359 if (ACPI_FAILURE (Status))
361 (void) AcpiExUnloadTable (DdbHandle);
363 AcpiUtRemoveReference (DdbHandle);
364 return_ACPI_STATUS (Status);
368 *ReturnDesc = DdbHandle;
369 return_ACPI_STATUS (Status);
373 /*******************************************************************************
375 * FUNCTION: AcpiExRegionRead
377 * PARAMETERS: ObjDesc - Region descriptor
378 * Length - Number of bytes to read
379 * Buffer - Pointer to where to put the data
381 * RETURN: Status
383 * DESCRIPTION: Read data from an operation region. The read starts from the
384 * beginning of the region.
386 ******************************************************************************/
388 static ACPI_STATUS
389 AcpiExRegionRead (
390 ACPI_OPERAND_OBJECT *ObjDesc,
391 UINT32 Length,
392 UINT8 *Buffer)
394 ACPI_STATUS Status;
395 UINT64 Value;
396 UINT32 RegionOffset = 0;
397 UINT32 i;
400 /* Bytewise reads */
402 for (i = 0; i < Length; i++)
404 Status = AcpiEvAddressSpaceDispatch (ObjDesc, NULL, ACPI_READ,
405 RegionOffset, 8, &Value);
406 if (ACPI_FAILURE (Status))
408 return (Status);
411 *Buffer = (UINT8) Value;
412 Buffer++;
413 RegionOffset++;
416 return (AE_OK);
420 /*******************************************************************************
422 * FUNCTION: AcpiExLoadOp
424 * PARAMETERS: ObjDesc - Region or Buffer/Field where the table will be
425 * obtained
426 * Target - Where a handle to the table will be stored
427 * WalkState - Current state
429 * RETURN: Status
431 * DESCRIPTION: Load an ACPI table from a field or operation region
433 * NOTE: Region Fields (Field, BankField, IndexFields) are resolved to buffer
434 * objects before this code is reached.
436 * If source is an operation region, it must refer to SystemMemory, as
437 * per the ACPI specification.
439 ******************************************************************************/
441 ACPI_STATUS
442 AcpiExLoadOp (
443 ACPI_OPERAND_OBJECT *ObjDesc,
444 ACPI_OPERAND_OBJECT *Target,
445 ACPI_WALK_STATE *WalkState)
447 ACPI_OPERAND_OBJECT *DdbHandle;
448 ACPI_TABLE_HEADER *TableHeader;
449 ACPI_TABLE_HEADER *Table;
450 UINT32 TableIndex;
451 ACPI_STATUS Status;
452 UINT32 Length;
455 ACPI_FUNCTION_TRACE (ExLoadOp);
458 /* Source Object can be either an OpRegion or a Buffer/Field */
460 switch (ObjDesc->Common.Type)
462 case ACPI_TYPE_REGION:
464 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
465 "Load table from Region %p\n", ObjDesc));
467 /* Region must be SystemMemory (from ACPI spec) */
469 if (ObjDesc->Region.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY)
471 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
475 * If the Region Address and Length have not been previously
476 * evaluated, evaluate them now and save the results.
478 if (!(ObjDesc->Common.Flags & AOPOBJ_DATA_VALID))
480 Status = AcpiDsGetRegionArguments (ObjDesc);
481 if (ACPI_FAILURE (Status))
483 return_ACPI_STATUS (Status);
487 /* Get the table header first so we can get the table length */
489 TableHeader = ACPI_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
490 if (!TableHeader)
492 return_ACPI_STATUS (AE_NO_MEMORY);
495 Status = AcpiExRegionRead (ObjDesc, sizeof (ACPI_TABLE_HEADER),
496 ACPI_CAST_PTR (UINT8, TableHeader));
497 Length = TableHeader->Length;
498 ACPI_FREE (TableHeader);
500 if (ACPI_FAILURE (Status))
502 return_ACPI_STATUS (Status);
505 /* Must have at least an ACPI table header */
507 if (Length < sizeof (ACPI_TABLE_HEADER))
509 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
513 * The original implementation simply mapped the table, with no copy.
514 * However, the memory region is not guaranteed to remain stable and
515 * we must copy the table to a local buffer. For example, the memory
516 * region is corrupted after suspend on some machines. Dynamically
517 * loaded tables are usually small, so this overhead is minimal.
519 * The latest implementation (5/2009) does not use a mapping at all.
520 * We use the low-level operation region interface to read the table
521 * instead of the obvious optimization of using a direct mapping.
522 * This maintains a consistent use of operation regions across the
523 * entire subsystem. This is important if additional processing must
524 * be performed in the (possibly user-installed) operation region
525 * handler. For example, AcpiExec and ASLTS depend on this.
528 /* Allocate a buffer for the table */
530 Table = ACPI_ALLOCATE (Length);
531 if (!Table)
533 return_ACPI_STATUS (AE_NO_MEMORY);
536 /* Read the entire table */
538 Status = AcpiExRegionRead (ObjDesc, Length,
539 ACPI_CAST_PTR (UINT8, Table));
540 if (ACPI_FAILURE (Status))
542 ACPI_FREE (Table);
543 return_ACPI_STATUS (Status);
545 break;
547 case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */
549 ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
550 "Load table from Buffer or Field %p\n", ObjDesc));
552 /* Must have at least an ACPI table header */
554 if (ObjDesc->Buffer.Length < sizeof (ACPI_TABLE_HEADER))
556 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
559 /* Get the actual table length from the table header */
561 TableHeader = ACPI_CAST_PTR (
562 ACPI_TABLE_HEADER, ObjDesc->Buffer.Pointer);
563 Length = TableHeader->Length;
565 /* Table cannot extend beyond the buffer */
567 if (Length > ObjDesc->Buffer.Length)
569 return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
571 if (Length < sizeof (ACPI_TABLE_HEADER))
573 return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
577 * Copy the table from the buffer because the buffer could be
578 * modified or even deleted in the future
580 Table = ACPI_ALLOCATE (Length);
581 if (!Table)
583 return_ACPI_STATUS (AE_NO_MEMORY);
586 memcpy (Table, TableHeader, Length);
587 break;
589 default:
591 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
594 /* Install the new table into the local data structures */
596 ACPI_INFO (("Dynamic OEM Table Load:"));
597 AcpiExExitInterpreter ();
598 Status = AcpiTbInstallAndLoadTable (ACPI_PTR_TO_PHYSADDR (Table),
599 ACPI_TABLE_ORIGIN_INTERNAL_VIRTUAL, Table, TRUE, &TableIndex);
600 AcpiExEnterInterpreter ();
601 if (ACPI_FAILURE (Status))
603 /* Delete allocated table buffer */
605 ACPI_FREE (Table);
606 return_ACPI_STATUS (Status);
610 * Add the table to the namespace.
612 * Note: Load the table objects relative to the root of the namespace.
613 * This appears to go against the ACPI specification, but we do it for
614 * compatibility with other ACPI implementations.
616 Status = AcpiExAddTable (TableIndex, &DdbHandle);
617 if (ACPI_FAILURE (Status))
619 /* On error, TablePtr was deallocated above */
621 return_ACPI_STATUS (Status);
624 /* Complete the initialization/resolution of new objects */
626 AcpiExExitInterpreter ();
627 AcpiNsInitializeObjects ();
628 AcpiExEnterInterpreter ();
630 /* Store the DdbHandle into the Target operand */
632 Status = AcpiExStore (DdbHandle, Target, WalkState);
633 if (ACPI_FAILURE (Status))
635 (void) AcpiExUnloadTable (DdbHandle);
637 /* TablePtr was deallocated above */
639 AcpiUtRemoveReference (DdbHandle);
640 return_ACPI_STATUS (Status);
643 /* Remove the reference by added by AcpiExStore above */
645 AcpiUtRemoveReference (DdbHandle);
646 return_ACPI_STATUS (Status);
650 /*******************************************************************************
652 * FUNCTION: AcpiExUnloadTable
654 * PARAMETERS: DdbHandle - Handle to a previously loaded table
656 * RETURN: Status
658 * DESCRIPTION: Unload an ACPI table
660 ******************************************************************************/
662 ACPI_STATUS
663 AcpiExUnloadTable (
664 ACPI_OPERAND_OBJECT *DdbHandle)
666 ACPI_STATUS Status = AE_OK;
667 ACPI_OPERAND_OBJECT *TableDesc = DdbHandle;
668 UINT32 TableIndex;
671 ACPI_FUNCTION_TRACE (ExUnloadTable);
675 * Temporarily emit a warning so that the ASL for the machine can be
676 * hopefully obtained. This is to say that the Unload() operator is
677 * extremely rare if not completely unused.
679 ACPI_WARNING ((AE_INFO,
680 "Received request to unload an ACPI table"));
683 * May 2018: Unload is no longer supported for the following reasons:
684 * 1) A correct implementation on some hosts may not be possible.
685 * 2) Other ACPI implementations do not correctly/fully support it.
686 * 3) It requires host device driver support which does not exist.
687 * (To properly support namespace unload out from underneath.)
688 * 4) This AML operator has never been seen in the field.
690 ACPI_EXCEPTION ((AE_INFO, AE_NOT_IMPLEMENTED,
691 "AML Unload operator is not supported"));
694 * Validate the handle
695 * Although the handle is partially validated in AcpiExReconfiguration()
696 * when it calls AcpiExResolveOperands(), the handle is more completely
697 * validated here.
699 * Handle must be a valid operand object of type reference. Also, the
700 * DdbHandle must still be marked valid (table has not been previously
701 * unloaded)
703 if ((!DdbHandle) ||
704 (ACPI_GET_DESCRIPTOR_TYPE (DdbHandle) != ACPI_DESC_TYPE_OPERAND) ||
705 (DdbHandle->Common.Type != ACPI_TYPE_LOCAL_REFERENCE) ||
706 (!(DdbHandle->Common.Flags & AOPOBJ_DATA_VALID)))
708 return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
711 /* Get the table index from the DdbHandle */
713 TableIndex = TableDesc->Reference.Value;
716 * Release the interpreter lock so that the table lock won't have
717 * strict order requirement against it.
719 AcpiExExitInterpreter ();
720 Status = AcpiTbUnloadTable (TableIndex);
721 AcpiExEnterInterpreter ();
724 * Invalidate the handle. We do this because the handle may be stored
725 * in a named object and may not be actually deleted until much later.
727 if (ACPI_SUCCESS (Status))
729 DdbHandle->Common.Flags &= ~AOPOBJ_DATA_VALID;
731 return_ACPI_STATUS (Status);