diff options
Diffstat (limited to 'sys/contrib/dev/acpica/Subsystem/Common')
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cmalloc.c | 799 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cmclib.c | 953 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cmcopy.c | 840 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cmdebug.c | 657 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cmdelete.c | 806 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cmeval.c | 494 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cmglobal.c | 792 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cminit.c | 359 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cmobject.c | 783 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cmutils.c | 1181 | ||||
-rw-r--r-- | sys/contrib/dev/acpica/Subsystem/Common/cmxface.c | 537 |
11 files changed, 0 insertions, 8201 deletions
diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cmalloc.c b/sys/contrib/dev/acpica/Subsystem/Common/cmalloc.c deleted file mode 100644 index 243ee21021e1d..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cmalloc.c +++ /dev/null @@ -1,799 +0,0 @@ -/****************************************************************************** - * - * Module Name: cmalloc - local memory allocation routines - * $Revision: 84 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __CMALLOC_C__ - -#include "acpi.h" -#include "acparser.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "acglobal.h" - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmalloc") - - -#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS - -/* - * Most of this code is for tracking memory leaks in the subsystem, and it - * gets compiled out when the ACPI_DEBUG flag is not set. - * Every memory allocation is kept track of in a doubly linked list. Each - * element contains the caller's component, module name, function name, and - * line number. _CmAllocate and _CmCallocate call AcpiCmAddElementToAllocList - * to add an element to the list; deletion occurs in the bosy of _CmFree. - */ - - -/***************************************************************************** - * - * FUNCTION: AcpiCmSearchAllocList - * - * PARAMETERS: Address - Address of allocated memory - * - * RETURN: A list element if found; NULL otherwise. - * - * DESCRIPTION: Searches for an element in the global allocation tracking list. - * - ****************************************************************************/ - -ALLOCATION_INFO * -AcpiCmSearchAllocList ( - void *Address) -{ - ALLOCATION_INFO *Element = AcpiGbl_HeadAllocPtr; - - - /* Search for the address. */ - - while (Element) - { - if (Element->Address == Address) - { - return (Element); - } - - Element = Element->Next; - } - - return (NULL); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiCmAddElementToAllocList - * - * PARAMETERS: Address - Address of allocated memory - * Size - Size of the allocation - * AllocType - MEM_MALLOC or MEM_CALLOC - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: None. - * - * DESCRIPTION: Inserts an element into the global allocation tracking list. - * - ****************************************************************************/ - -ACPI_STATUS -AcpiCmAddElementToAllocList ( - void *Address, - UINT32 Size, - UINT8 AllocType, - UINT32 Component, - NATIVE_CHAR *Module, - UINT32 Line) -{ - ALLOCATION_INFO *Element; - ACPI_STATUS Status = AE_OK; - - - FUNCTION_TRACE_PTR ("CmAddElementToAllocList", Address); - - - AcpiCmAcquireMutex (ACPI_MTX_MEMORY); - - /* Keep track of the running total of all allocations. */ - - AcpiGbl_CurrentAllocCount++; - AcpiGbl_RunningAllocCount++; - - if (AcpiGbl_MaxConcurrentAllocCount < AcpiGbl_CurrentAllocCount) - { - AcpiGbl_MaxConcurrentAllocCount = AcpiGbl_CurrentAllocCount; - } - - AcpiGbl_CurrentAllocSize += Size; - AcpiGbl_RunningAllocSize += Size; - - if (AcpiGbl_MaxConcurrentAllocSize < AcpiGbl_CurrentAllocSize) - { - AcpiGbl_MaxConcurrentAllocSize = AcpiGbl_CurrentAllocSize; - } - - /* If the head pointer is null, create the first element and fill it in. */ - - if (NULL == AcpiGbl_HeadAllocPtr) - { - AcpiGbl_HeadAllocPtr = - (ALLOCATION_INFO *) AcpiOsCallocate (sizeof (ALLOCATION_INFO)); - - if (!AcpiGbl_HeadAllocPtr) - { - DEBUG_PRINT (ACPI_ERROR, - ("Could not allocate memory info block\n")); - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - AcpiGbl_TailAllocPtr = AcpiGbl_HeadAllocPtr; - } - - else - { - AcpiGbl_TailAllocPtr->Next = - (ALLOCATION_INFO *) AcpiOsCallocate (sizeof (ALLOCATION_INFO)); - if (!AcpiGbl_TailAllocPtr->Next) - { - DEBUG_PRINT (ACPI_ERROR, - ("Could not allocate memory info block\n")); - Status = AE_NO_MEMORY; - goto UnlockAndExit; - } - - /* error check */ - - AcpiGbl_TailAllocPtr->Next->Previous = AcpiGbl_TailAllocPtr; - AcpiGbl_TailAllocPtr = AcpiGbl_TailAllocPtr->Next; - } - - /* - * Search list for this address to make sure it is not already on the list. - * This will catch several kinds of problems. - */ - - Element = AcpiCmSearchAllocList (Address); - if (Element) - { - REPORT_ERROR (("CmAddElementToAllocList: Address already present in list! (%p)\n", - Address)); - - DEBUG_PRINT (ACPI_ERROR, ("Element %p Address %p\n", Element, Address)); - - BREAKPOINT3; - } - - /* Fill in the instance data. */ - - AcpiGbl_TailAllocPtr->Address = Address; - AcpiGbl_TailAllocPtr->Size = Size; - AcpiGbl_TailAllocPtr->AllocType = AllocType; - AcpiGbl_TailAllocPtr->Component = Component; - AcpiGbl_TailAllocPtr->Line = Line; - - STRNCPY (AcpiGbl_TailAllocPtr->Module, Module, MAX_MODULE_NAME); - - -UnlockAndExit: - AcpiCmReleaseMutex (ACPI_MTX_MEMORY); - return_ACPI_STATUS (Status); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiCmDeleteElementFromAllocList - * - * PARAMETERS: Address - Address of allocated memory - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: - * - * DESCRIPTION: Deletes an element from the global allocation tracking list. - * - ****************************************************************************/ - -void -AcpiCmDeleteElementFromAllocList ( - void *Address, - UINT32 Component, - NATIVE_CHAR *Module, - UINT32 Line) -{ - ALLOCATION_INFO *Element; - UINT32 *DwordPtr; - UINT32 DwordLen; - UINT32 Size; - UINT32 i; - - - FUNCTION_TRACE ("CmDeleteElementFromAllocList"); - - if (NULL == AcpiGbl_HeadAllocPtr) - { - /* Boy we got problems. */ - - _REPORT_ERROR (Module, Line, Component, - ("CmDeleteElementFromAllocList: Empty allocation list, nothing to free!\n")); - - return_VOID; - } - - - AcpiCmAcquireMutex (ACPI_MTX_MEMORY); - - /* Keep track of the amount of memory allocated. */ - - Size = 0; - AcpiGbl_CurrentAllocCount--; - - if (AcpiGbl_HeadAllocPtr == AcpiGbl_TailAllocPtr) - { - if (Address != AcpiGbl_HeadAllocPtr->Address) - { - _REPORT_ERROR (Module, Line, Component, - ("CmDeleteElementFromAllocList: Deleting non-allocated memory\n")); - - goto Cleanup; - } - - Size = AcpiGbl_HeadAllocPtr->Size; - - AcpiOsFree (AcpiGbl_HeadAllocPtr); - AcpiGbl_HeadAllocPtr = NULL; - AcpiGbl_TailAllocPtr = NULL; - - DEBUG_PRINT (TRACE_ALLOCATIONS, - ("_CmFree: Allocation list deleted. There are no outstanding allocations\n")); - - goto Cleanup; - } - - - /* Search list for this address */ - - Element = AcpiCmSearchAllocList (Address); - if (Element) - { - /* cases: head, tail, other */ - - if (Element == AcpiGbl_HeadAllocPtr) - { - Element->Next->Previous = NULL; - AcpiGbl_HeadAllocPtr = Element->Next; - } - - else - { - if (Element == AcpiGbl_TailAllocPtr) - { - Element->Previous->Next = NULL; - AcpiGbl_TailAllocPtr = Element->Previous; - } - - else - { - Element->Previous->Next = Element->Next; - Element->Next->Previous = Element->Previous; - } - } - - - /* Mark the segment as deleted */ - - if (Element->Size >= 4) - { - DwordLen = DIV_4 (Element->Size); - DwordPtr = (UINT32 *) Element->Address; - - for (i = 0; i < DwordLen; i++) - { - DwordPtr[i] = 0x00DEAD00; - } - - /* Set obj type, desc, and ref count fields to all ones */ - - DwordPtr[0] = ACPI_UINT32_MAX; - if (Element->Size >= 8) - { - DwordPtr[1] = ACPI_UINT32_MAX; - } - } - - Size = Element->Size; - - MEMSET (Element, 0xEA, sizeof (ALLOCATION_INFO)); - - - if (Size == sizeof (ACPI_OPERAND_OBJECT)) - { - DEBUG_PRINT (TRACE_ALLOCATIONS, ("CmDelete: Freeing size %X (ACPI_OPERAND_OBJECT)\n", Size)); - } - else - { - DEBUG_PRINT (TRACE_ALLOCATIONS, ("CmDelete: Freeing size %X\n", Size)); - } - - AcpiOsFree (Element); - } - - else - { - _REPORT_ERROR (Module, Line, Component, - ("_CmFree: Entry not found in list\n")); - DEBUG_PRINT (ACPI_ERROR, - ("_CmFree: Entry %p was not found in allocation list\n", - Address)); - AcpiCmReleaseMutex (ACPI_MTX_MEMORY); - return_VOID; - } - - -Cleanup: - - AcpiGbl_CurrentAllocSize -= Size; - AcpiCmReleaseMutex (ACPI_MTX_MEMORY); - - return_VOID; -} - - -/***************************************************************************** - * - * FUNCTION: AcpiCmDumpAllocationInfo - * - * PARAMETERS: - * - * RETURN: None - * - * DESCRIPTION: Print some info about the outstanding allocations. - * - ****************************************************************************/ - -void -AcpiCmDumpAllocationInfo ( - void) -{ - FUNCTION_TRACE ("CmDumpAllocationInfo"); - - - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current allocations", - AcpiGbl_CurrentAllocCount, - ROUND_UP_TO_1K (AcpiGbl_CurrentAllocSize))); - - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations", - AcpiGbl_MaxConcurrentAllocCount, - ROUND_UP_TO_1K (AcpiGbl_MaxConcurrentAllocSize))); - - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current Internal objects", - AcpiGbl_CurrentObjectCount, - ROUND_UP_TO_1K (AcpiGbl_CurrentObjectSize))); - - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max internal objects", - AcpiGbl_MaxConcurrentObjectCount, - ROUND_UP_TO_1K (AcpiGbl_MaxConcurrentObjectSize))); - - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Current Nodes", - AcpiGbl_CurrentNodeCount, - ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize))); - - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Max Nodes", - AcpiGbl_MaxConcurrentNodeCount, - ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount * sizeof (ACPI_NAMESPACE_NODE))))); - - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects", - AcpiGbl_RunningObjectCount, - ROUND_UP_TO_1K (AcpiGbl_RunningObjectSize))); - - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%30s: %4d (%3d Kb)\n", "Total (all) allocations", - AcpiGbl_RunningAllocCount, - ROUND_UP_TO_1K (AcpiGbl_RunningAllocSize))); - - return_VOID; -} - - -/***************************************************************************** - * - * FUNCTION: AcpiCmDumpCurrentAllocations - * - * PARAMETERS: Component - Component(s) to dump info for. - * Module - Module to dump info for. NULL means all. - * - * RETURN: None - * - * DESCRIPTION: Print a list of all outstanding allocations. - * - ****************************************************************************/ - -void -AcpiCmDumpCurrentAllocations ( - UINT32 Component, - NATIVE_CHAR *Module) -{ - ALLOCATION_INFO *Element = AcpiGbl_HeadAllocPtr; - UINT32 i; - - - FUNCTION_TRACE ("CmDumpCurrentAllocations"); - - - if (Element == NULL) - { - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("No outstanding allocations.\n")); - return_VOID; - } - - - /* - * Walk the allocation list. - */ - - AcpiCmAcquireMutex (ACPI_MTX_MEMORY); - - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("Outstanding allocations:\n")); - - for (i = 1; ; i++) /* Just a counter */ - { - if ((Element->Component & Component) && - ((Module == NULL) || (0 == STRCMP (Module, Element->Module)))) - { - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("%p Len %04lX %9.9s-%ld", - Element->Address, Element->Size, Element->Module, - Element->Line)); - - /* Most of the elements will be internal objects. */ - - switch (((ACPI_OPERAND_OBJECT *) - (Element->Address))->Common.DataType) - { - case ACPI_DESC_TYPE_INTERNAL: - DEBUG_PRINT_RAW (TRACE_ALLOCATIONS | TRACE_TABLES, - (" ObjType %s", - AcpiCmGetTypeName (((ACPI_OPERAND_OBJECT *)(Element->Address))->Common.Type))); - break; - - case ACPI_DESC_TYPE_PARSER: - DEBUG_PRINT_RAW (TRACE_ALLOCATIONS | TRACE_TABLES, - (" ParseObj Opcode %04X", - ((ACPI_PARSE_OBJECT *)(Element->Address))->Opcode)); - break; - - case ACPI_DESC_TYPE_NAMED: - DEBUG_PRINT_RAW (TRACE_ALLOCATIONS | TRACE_TABLES, - (" Node %4.4s", - &((ACPI_NAMESPACE_NODE *)(Element->Address))->Name)); - break; - - case ACPI_DESC_TYPE_STATE: - DEBUG_PRINT_RAW (TRACE_ALLOCATIONS | TRACE_TABLES, - (" StateObj")); - break; - } - - DEBUG_PRINT_RAW (TRACE_ALLOCATIONS | TRACE_TABLES, ("\n")); - } - - if (Element->Next == NULL) - { - break; - } - - Element = Element->Next; - } - - AcpiCmReleaseMutex (ACPI_MTX_MEMORY); - - DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES, - ("Total number of unfreed allocations = %d(%X)\n", i,i)); - - - return_VOID; - -} -#endif /* #ifdef ACPI_DEBUG_TRACK_ALLOCATIONS */ - -/***************************************************************************** - * - * FUNCTION: _CmAllocate - * - * PARAMETERS: Size - Size of the allocation - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: The subsystem's equivalent of malloc. - * - ****************************************************************************/ - -void * -_CmAllocate ( - UINT32 Size, - UINT32 Component, - NATIVE_CHAR *Module, - UINT32 Line) -{ - void *Address = NULL; - - - FUNCTION_TRACE_U32 ("_CmAllocate", Size); - - - /* Check for an inadvertent size of zero bytes */ - - if (!Size) - { - _REPORT_ERROR (Module, Line, Component, - ("CmAllocate: Attempt to allocate zero bytes\n")); - Size = 1; - } - - Address = AcpiOsAllocate (Size); - if (!Address) - { - /* Report allocation error */ - - _REPORT_ERROR (Module, Line, Component, - ("CmAllocate: Could not allocate size %X\n", Size)); - - return_VALUE (NULL); - } - -#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS - - if (ACPI_FAILURE (AcpiCmAddElementToAllocList (Address, Size, MEM_MALLOC, - Component, Module, Line))) - { - AcpiOsFree (Address); - return_PTR (NULL); - } - - DEBUG_PRINT (TRACE_ALLOCATIONS, - ("CmAllocate: %p Size %X\n", Address, Size)); -#endif - - return_PTR (Address); -} - - -/***************************************************************************** - * - * FUNCTION: _CmCallocate - * - * PARAMETERS: Size - Size of the allocation - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: Address of the allocated memory on success, NULL on failure. - * - * DESCRIPTION: Subsystem equivalent of calloc. - * - ****************************************************************************/ - -void * -_CmCallocate ( - UINT32 Size, - UINT32 Component, - NATIVE_CHAR *Module, - UINT32 Line) -{ - void *Address = NULL; - - - FUNCTION_TRACE_U32 ("_CmCallocate", Size); - - - /* Check for an inadvertent size of zero bytes */ - - if (!Size) - { - _REPORT_ERROR (Module, Line, Component, - ("CmCallocate: Attempt to allocate zero bytes\n")); - return_VALUE (NULL); - } - - - Address = AcpiOsCallocate (Size); - - if (!Address) - { - /* Report allocation error */ - - _REPORT_ERROR (Module, Line, Component, - ("CmCallocate: Could not allocate size %X\n", Size)); - return_VALUE (NULL); - } - -#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS - - if (ACPI_FAILURE (AcpiCmAddElementToAllocList (Address, Size, MEM_CALLOC, - Component,Module, Line))) - { - AcpiOsFree (Address); - return_PTR (NULL); - } -#endif - - DEBUG_PRINT (TRACE_ALLOCATIONS, - ("CmCallocate: %p Size %X\n", Address, Size)); - - return_PTR (Address); -} - - -/***************************************************************************** - * - * FUNCTION: _CmFree - * - * PARAMETERS: Address - Address of the memory to deallocate - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * - * RETURN: None - * - * DESCRIPTION: Frees the memory at Address - * - ****************************************************************************/ - -void -_CmFree ( - void *Address, - UINT32 Component, - NATIVE_CHAR *Module, - UINT32 Line) -{ - FUNCTION_TRACE_PTR ("_CmFree", Address); - - - if (NULL == Address) - { - _REPORT_ERROR (Module, Line, Component, - ("_CmFree: Trying to delete a NULL address\n")); - - return_VOID; - } - -#ifdef ACPI_DEBUG_TRACK_ALLOCATIONS - AcpiCmDeleteElementFromAllocList (Address, Component, Module, Line); -#endif - - AcpiOsFree (Address); - - DEBUG_PRINT (TRACE_ALLOCATIONS, ("CmFree: %p freed\n", Address)); - - return_VOID; -} - - diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cmclib.c b/sys/contrib/dev/acpica/Subsystem/Common/cmclib.c deleted file mode 100644 index 2318d9e36430c..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cmclib.c +++ /dev/null @@ -1,953 +0,0 @@ -/****************************************************************************** - * - * Module Name: cmclib - Local implementation of C library functions - * $Revision: 32 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#define __CMCLIB_C__ - -#include "acpi.h" -#include "acevents.h" -#include "achware.h" -#include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" - -/* - * These implementations of standard C Library routines can optionally be - * used if a C library is not available. In general, they are less efficient - * than an inline or assembly implementation - */ - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmclib") - - -#ifndef ACPI_USE_SYSTEM_CLIBRARY - -/******************************************************************************* - * - * FUNCTION: strlen - * - * PARAMETERS: String - Null terminated string - * - * RETURN: Length - * - * DESCRIPTION: Returns the length of the input string - * - ******************************************************************************/ - - -NATIVE_UINT -AcpiCmStrlen ( - const NATIVE_CHAR *String) -{ - NATIVE_UINT Length = 0; - - - /* Count the string until a null is encountered */ - - while (*String) - { - Length++; - String++; - } - - return (Length); -} - - -/******************************************************************************* - * - * FUNCTION: strcpy - * - * PARAMETERS: DstString - Target of the copy - * SrcString - The source string to copy - * - * RETURN: DstString - * - * DESCRIPTION: Copy a null terminated string - * - ******************************************************************************/ - -NATIVE_CHAR * -AcpiCmStrcpy ( - NATIVE_CHAR *DstString, - const NATIVE_CHAR *SrcString) -{ - NATIVE_CHAR *String = DstString; - - - /* Move bytes brute force */ - - while (*SrcString) - { - *String = *SrcString; - - String++; - SrcString++; - } - - /* Null terminate */ - - *String = 0; - - return (DstString); -} - - -/******************************************************************************* - * - * FUNCTION: strncpy - * - * PARAMETERS: DstString - Target of the copy - * SrcString - The source string to copy - * Count - Maximum # of bytes to copy - * - * RETURN: DstString - * - * DESCRIPTION: Copy a null terminated string, with a maximum length - * - ******************************************************************************/ - -NATIVE_CHAR * -AcpiCmStrncpy ( - NATIVE_CHAR *DstString, - const NATIVE_CHAR *SrcString, - NATIVE_UINT Count) -{ - NATIVE_CHAR *String = DstString; - - - /* Copy the string */ - - for (String = DstString; - Count && (Count--, (*String++ = *SrcString++)); ) - {;} - - /* Pad with nulls if necessary */ - - while (Count--) - { - *String = 0; - String++; - } - - /* Return original pointer */ - - return (DstString); -} - - -/******************************************************************************* - * - * FUNCTION: strcmp - * - * PARAMETERS: String1 - First string - * String2 - Second string - * - * RETURN: Index where strings mismatched, or 0 if strings matched - * - * DESCRIPTION: Compare two null terminated strings - * - ******************************************************************************/ - -UINT32 -AcpiCmStrcmp ( - const NATIVE_CHAR *String1, - const NATIVE_CHAR *String2) -{ - - - for ( ; (*String1 == *String2); String2++) - { - if (!*String1++) - { - return (0); - } - } - - - return ((unsigned char) *String1 - (unsigned char) *String2); -} - - -/******************************************************************************* - * - * FUNCTION: strncmp - * - * PARAMETERS: String1 - First string - * String2 - Second string - * Count - Maximum # of bytes to compare - * - * RETURN: Index where strings mismatched, or 0 if strings matched - * - * DESCRIPTION: Compare two null terminated strings, with a maximum length - * - ******************************************************************************/ - -UINT32 -AcpiCmStrncmp ( - const NATIVE_CHAR *String1, - const NATIVE_CHAR *String2, - NATIVE_UINT Count) -{ - - - for ( ; Count-- && (*String1 == *String2); String2++) - { - if (!*String1++) - { - return (0); - } - } - - return ((Count == -1) ? 0 : ((unsigned char) *String1 - - (unsigned char) *String2)); -} - - -/******************************************************************************* - * - * FUNCTION: Strcat - * - * PARAMETERS: DstString - Target of the copy - * SrcString - The source string to copy - * - * RETURN: DstString - * - * DESCRIPTION: Append a null terminated string to a null terminated string - * - ******************************************************************************/ - -NATIVE_CHAR * -AcpiCmStrcat ( - NATIVE_CHAR *DstString, - const NATIVE_CHAR *SrcString) -{ - NATIVE_CHAR *String; - - - /* Find end of the destination string */ - - for (String = DstString; *String++; ) - { ; } - - /* Concatinate the string */ - - for (--String; (*String++ = *SrcString++); ) - { ; } - - return (DstString); -} - - -/******************************************************************************* - * - * FUNCTION: strncat - * - * PARAMETERS: DstString - Target of the copy - * SrcString - The source string to copy - * Count - Maximum # of bytes to copy - * - * RETURN: DstString - * - * DESCRIPTION: Append a null terminated string to a null terminated string, - * with a maximum count. - * - ******************************************************************************/ - -NATIVE_CHAR * -AcpiCmStrncat ( - NATIVE_CHAR *DstString, - const NATIVE_CHAR *SrcString, - NATIVE_UINT Count) -{ - NATIVE_CHAR *String; - - - if (Count) - { - /* Find end of the destination string */ - - for (String = DstString; *String++; ) - { ; } - - /* Concatinate the string */ - - for (--String; (*String++ = *SrcString++) && --Count; ) - { ; } - - /* Null terminate if necessary */ - - if (!Count) - { - *String = 0; - } - } - - return (DstString); -} - - -/******************************************************************************* - * - * FUNCTION: memcpy - * - * PARAMETERS: Dest - Target of the copy - * Src - Source buffer to copy - * Count - Number of bytes to copy - * - * RETURN: Dest - * - * DESCRIPTION: Copy arbitrary bytes of memory - * - ******************************************************************************/ - -void * -AcpiCmMemcpy ( - void *Dest, - const void *Src, - NATIVE_UINT Count) -{ - NATIVE_CHAR *New = (NATIVE_CHAR *) Dest; - NATIVE_CHAR *Old = (NATIVE_CHAR *) Src; - - - while (Count) - { - *New = *Old; - New++; - Old++; - Count--; - } - - return (Dest); -} - - -/******************************************************************************* - * - * FUNCTION: memset - * - * PARAMETERS: Dest - Buffer to set - * Value - Value to set each byte of memory - * Count - Number of bytes to set - * - * RETURN: Dest - * - * DESCRIPTION: Initialize a buffer to a known value. - * - ******************************************************************************/ - -void * -AcpiCmMemset ( - void *Dest, - NATIVE_UINT Value, - NATIVE_UINT Count) -{ - NATIVE_CHAR *New = (NATIVE_CHAR *) Dest; - - - while (Count) - { - *New = (char) Value; - New++; - Count--; - } - - return (Dest); -} - - -#define NEGATIVE 1 -#define POSITIVE 0 - - -#define _ACPI_XA 0x00 /* extra alphabetic - not supported */ -#define _ACPI_XS 0x40 /* extra space */ -#define _ACPI_BB 0x00 /* BEL, BS, etc. - not supported */ -#define _ACPI_CN 0x20 /* CR, FF, HT, NL, VT */ -#define _ACPI_DI 0x04 /* '0'-'9' */ -#define _ACPI_LO 0x02 /* 'a'-'z' */ -#define _ACPI_PU 0x10 /* punctuation */ -#define _ACPI_SP 0x08 /* space */ -#define _ACPI_UP 0x01 /* 'A'-'Z' */ -#define _ACPI_XD 0x80 /* '0'-'9', 'A'-'F', 'a'-'f' */ - -static const UINT8 _acpi_ctype[257] = { - _ACPI_CN, /* 0x0 0. */ - _ACPI_CN, /* 0x1 1. */ - _ACPI_CN, /* 0x2 2. */ - _ACPI_CN, /* 0x3 3. */ - _ACPI_CN, /* 0x4 4. */ - _ACPI_CN, /* 0x5 5. */ - _ACPI_CN, /* 0x6 6. */ - _ACPI_CN, /* 0x7 7. */ - _ACPI_CN, /* 0x8 8. */ - _ACPI_CN|_ACPI_SP, /* 0x9 9. */ - _ACPI_CN|_ACPI_SP, /* 0xA 10. */ - _ACPI_CN|_ACPI_SP, /* 0xB 11. */ - _ACPI_CN|_ACPI_SP, /* 0xC 12. */ - _ACPI_CN|_ACPI_SP, /* 0xD 13. */ - _ACPI_CN, /* 0xE 14. */ - _ACPI_CN, /* 0xF 15. */ - _ACPI_CN, /* 0x10 16. */ - _ACPI_CN, /* 0x11 17. */ - _ACPI_CN, /* 0x12 18. */ - _ACPI_CN, /* 0x13 19. */ - _ACPI_CN, /* 0x14 20. */ - _ACPI_CN, /* 0x15 21. */ - _ACPI_CN, /* 0x16 22. */ - _ACPI_CN, /* 0x17 23. */ - _ACPI_CN, /* 0x18 24. */ - _ACPI_CN, /* 0x19 25. */ - _ACPI_CN, /* 0x1A 26. */ - _ACPI_CN, /* 0x1B 27. */ - _ACPI_CN, /* 0x1C 28. */ - _ACPI_CN, /* 0x1D 29. */ - _ACPI_CN, /* 0x1E 30. */ - _ACPI_CN, /* 0x1F 31. */ - _ACPI_XS|_ACPI_SP, /* 0x20 32. ' ' */ - _ACPI_PU, /* 0x21 33. '!' */ - _ACPI_PU, /* 0x22 34. '"' */ - _ACPI_PU, /* 0x23 35. '#' */ - _ACPI_PU, /* 0x24 36. '$' */ - _ACPI_PU, /* 0x25 37. '%' */ - _ACPI_PU, /* 0x26 38. '&' */ - _ACPI_PU, /* 0x27 39. ''' */ - _ACPI_PU, /* 0x28 40. '(' */ - _ACPI_PU, /* 0x29 41. ')' */ - _ACPI_PU, /* 0x2A 42. '*' */ - _ACPI_PU, /* 0x2B 43. '+' */ - _ACPI_PU, /* 0x2C 44. ',' */ - _ACPI_PU, /* 0x2D 45. '-' */ - _ACPI_PU, /* 0x2E 46. '.' */ - _ACPI_PU, /* 0x2F 47. '/' */ - _ACPI_XD|_ACPI_DI, /* 0x30 48. '0' */ - _ACPI_XD|_ACPI_DI, /* 0x31 49. '1' */ - _ACPI_XD|_ACPI_DI, /* 0x32 50. '2' */ - _ACPI_XD|_ACPI_DI, /* 0x33 51. '3' */ - _ACPI_XD|_ACPI_DI, /* 0x34 52. '4' */ - _ACPI_XD|_ACPI_DI, /* 0x35 53. '5' */ - _ACPI_XD|_ACPI_DI, /* 0x36 54. '6' */ - _ACPI_XD|_ACPI_DI, /* 0x37 55. '7' */ - _ACPI_XD|_ACPI_DI, /* 0x38 56. '8' */ - _ACPI_XD|_ACPI_DI, /* 0x39 57. '9' */ - _ACPI_PU, /* 0x3A 58. ':' */ - _ACPI_PU, /* 0x3B 59. ';' */ - _ACPI_PU, /* 0x3C 60. '<' */ - _ACPI_PU, /* 0x3D 61. '=' */ - _ACPI_PU, /* 0x3E 62. '>' */ - _ACPI_PU, /* 0x3F 63. '?' */ - _ACPI_PU, /* 0x40 64. '@' */ - _ACPI_XD|_ACPI_UP, /* 0x41 65. 'A' */ - _ACPI_XD|_ACPI_UP, /* 0x42 66. 'B' */ - _ACPI_XD|_ACPI_UP, /* 0x43 67. 'C' */ - _ACPI_XD|_ACPI_UP, /* 0x44 68. 'D' */ - _ACPI_XD|_ACPI_UP, /* 0x45 69. 'E' */ - _ACPI_XD|_ACPI_UP, /* 0x46 70. 'F' */ - _ACPI_UP, /* 0x47 71. 'G' */ - _ACPI_UP, /* 0x48 72. 'H' */ - _ACPI_UP, /* 0x49 73. 'I' */ - _ACPI_UP, /* 0x4A 74. 'J' */ - _ACPI_UP, /* 0x4B 75. 'K' */ - _ACPI_UP, /* 0x4C 76. 'L' */ - _ACPI_UP, /* 0x4D 77. 'M' */ - _ACPI_UP, /* 0x4E 78. 'N' */ - _ACPI_UP, /* 0x4F 79. 'O' */ - _ACPI_UP, /* 0x50 80. 'P' */ - _ACPI_UP, /* 0x51 81. 'Q' */ - _ACPI_UP, /* 0x52 82. 'R' */ - _ACPI_UP, /* 0x53 83. 'S' */ - _ACPI_UP, /* 0x54 84. 'T' */ - _ACPI_UP, /* 0x55 85. 'U' */ - _ACPI_UP, /* 0x56 86. 'V' */ - _ACPI_UP, /* 0x57 87. 'W' */ - _ACPI_UP, /* 0x58 88. 'X' */ - _ACPI_UP, /* 0x59 89. 'Y' */ - _ACPI_UP, /* 0x5A 90. 'Z' */ - _ACPI_PU, /* 0x5B 91. '[' */ - _ACPI_PU, /* 0x5C 92. '\' */ - _ACPI_PU, /* 0x5D 93. ']' */ - _ACPI_PU, /* 0x5E 94. '^' */ - _ACPI_PU, /* 0x5F 95. '_' */ - _ACPI_PU, /* 0x60 96. '`' */ - _ACPI_XD|_ACPI_LO, /* 0x61 97. 'a' */ - _ACPI_XD|_ACPI_LO, /* 0x62 98. 'b' */ - _ACPI_XD|_ACPI_LO, /* 0x63 99. 'c' */ - _ACPI_XD|_ACPI_LO, /* 0x64 100. 'd' */ - _ACPI_XD|_ACPI_LO, /* 0x65 101. 'e' */ - _ACPI_XD|_ACPI_LO, /* 0x66 102. 'f' */ - _ACPI_LO, /* 0x67 103. 'g' */ - _ACPI_LO, /* 0x68 104. 'h' */ - _ACPI_LO, /* 0x69 105. 'i' */ - _ACPI_LO, /* 0x6A 106. 'j' */ - _ACPI_LO, /* 0x6B 107. 'k' */ - _ACPI_LO, /* 0x6C 108. 'l' */ - _ACPI_LO, /* 0x6D 109. 'm' */ - _ACPI_LO, /* 0x6E 110. 'n' */ - _ACPI_LO, /* 0x6F 111. 'o' */ - _ACPI_LO, /* 0x70 112. 'p' */ - _ACPI_LO, /* 0x71 113. 'q' */ - _ACPI_LO, /* 0x72 114. 'r' */ - _ACPI_LO, /* 0x73 115. 's' */ - _ACPI_LO, /* 0x74 116. 't' */ - _ACPI_LO, /* 0x75 117. 'u' */ - _ACPI_LO, /* 0x76 118. 'v' */ - _ACPI_LO, /* 0x77 119. 'w' */ - _ACPI_LO, /* 0x78 120. 'x' */ - _ACPI_LO, /* 0x79 121. 'y' */ - _ACPI_LO, /* 0x7A 122. 'z' */ - _ACPI_PU, /* 0x7B 123. '{' */ - _ACPI_PU, /* 0x7C 124. '|' */ - _ACPI_PU, /* 0x7D 125. '}' */ - _ACPI_PU, /* 0x7E 126. '~' */ - _ACPI_CN, /* 0x7F 127. */ - - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x80 to 0x8F */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0x90 to 0x9F */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xA0 to 0xAF */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xB0 to 0xBF */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xC0 to 0xCF */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xD0 to 0xDF */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* 0xE0 to 0xEF */ - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* 0xF0 to 0x100 */ -}; - -#define IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP)) -#define IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO)) -#define IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI)) -#define IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP)) -#define IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD)) - - -/******************************************************************************* - * - * FUNCTION: AcpiCmToUpper - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: Convert character to uppercase - * - ******************************************************************************/ - -UINT32 -AcpiCmToUpper ( - UINT32 c) -{ - - return (IS_LOWER(c) ? ((c)-0x20) : (c)); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmToLower - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: Convert character to lowercase - * - ******************************************************************************/ - -UINT32 -AcpiCmToLower ( - UINT32 c) -{ - - return (IS_UPPER(c) ? ((c)+0x20) : (c)); -} - - -/******************************************************************************* - * - * FUNCTION: strupr - * - * PARAMETERS: SrcString - The source string to convert to - * - * RETURN: SrcString - * - * DESCRIPTION: Convert string to uppercase - * - ******************************************************************************/ - -NATIVE_CHAR * -AcpiCmStrupr ( - NATIVE_CHAR *SrcString) -{ - NATIVE_CHAR *String; - - - /* Walk entire string, uppercasing the letters */ - - for (String = SrcString; *String; ) - { - *String = (char) AcpiCmToUpper (*String); - String++; - } - - - return (SrcString); -} - - -/******************************************************************************* - * - * FUNCTION: strstr - * - * PARAMETERS: String1 - - * String2 - * - * RETURN: - * - * DESCRIPTION: Checks if String2 occurs in String1. This is not really a - * full implementation of strstr, only sufficient for command - * matching - * - ******************************************************************************/ - -NATIVE_CHAR * -AcpiCmStrstr ( - NATIVE_CHAR *String1, - NATIVE_CHAR *String2) -{ - NATIVE_CHAR *String; - - - if (AcpiCmStrlen (String2) > AcpiCmStrlen (String1)) - { - return (NULL); - } - - /* Walk entire string, comparing the letters */ - - for (String = String1; *String2; ) - { - if (*String2 != *String) - { - return (NULL); - } - - String2++; - String++; - } - - - return (String1); -} - - -/******************************************************************************* - * - * FUNCTION: strtoul - * - * PARAMETERS: String - Null terminated string - * Terminater - Where a pointer to the terminating byte is returned - * Base - Radix of the string - * - * RETURN: Converted value - * - * DESCRIPTION: Convert a string into an unsigned value. - * - ******************************************************************************/ - -UINT32 -AcpiCmStrtoul ( - const NATIVE_CHAR *String, - NATIVE_CHAR **Terminator, - NATIVE_UINT Base) -{ - UINT32 converted = 0; - UINT32 index; - UINT32 sign; - const NATIVE_CHAR *StringStart; - UINT32 ReturnValue = 0; - ACPI_STATUS Status = AE_OK; - - - /* - * Save the value of the pointer to the buffer's first - * character, save the current errno value, and then - * skip over any white space in the buffer: - */ - StringStart = String; - while (IS_SPACE (*String) || *String == '\t') - { - ++String; - } - - /* - * The buffer may contain an optional plus or minus sign. - * If it does, then skip over it but remember what is was: - */ - if (*String == '-') - { - sign = NEGATIVE; - ++String; - } - - else if (*String == '+') - { - ++String; - sign = POSITIVE; - } - - else - { - sign = POSITIVE; - } - - /* - * If the input parameter Base is zero, then we need to - * determine if it is octal, decimal, or hexadecimal: - */ - if (Base == 0) - { - if (*String == '0') - { - if (AcpiCmToLower (*(++String)) == 'x') - { - Base = 16; - ++String; - } - - else - { - Base = 8; - } - } - - else - { - Base = 10; - } - } - - else if (Base < 2 || Base > 36) - { - /* - * The specified Base parameter is not in the domain of - * this function: - */ - goto done; - } - - /* - * For octal and hexadecimal bases, skip over the leading - * 0 or 0x, if they are present. - */ - if (Base == 8 && *String == '0') - { - String++; - } - - if (Base == 16 && - *String == '0' && - AcpiCmToLower (*(++String)) == 'x') - { - String++; - } - - - /* - * Main loop: convert the string to an unsigned long: - */ - while (*String) - { - if (IS_DIGIT (*String)) - { - index = *String - '0'; - } - - else - { - index = AcpiCmToUpper (*String); - if (IS_UPPER (index)) - { - index = index - 'A' + 10; - } - - else - { - goto done; - } - } - - if (index >= Base) - { - goto done; - } - - /* - * Check to see if value is out of range: - */ - - if (ReturnValue > ((ACPI_UINT32_MAX - (UINT32) index) / - (UINT32) Base)) - { - Status = AE_ERROR; - ReturnValue = 0L; /* reset */ - } - - else - { - ReturnValue *= Base; - ReturnValue += index; - converted = 1; - } - - ++String; - } - -done: - /* - * If appropriate, update the caller's pointer to the next - * unconverted character in the buffer. - */ - if (Terminator) - { - if (converted == 0 && ReturnValue == 0L && String != NULL) - { - *Terminator = (NATIVE_CHAR *) StringStart; - } - - else - { - *Terminator = (NATIVE_CHAR *) String; - } - } - - if (Status == AE_ERROR) - { - ReturnValue = ACPI_UINT32_MAX; - } - - /* - * If a minus sign was present, then "the conversion is negated": - */ - if (sign == NEGATIVE) - { - ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; - } - - return (ReturnValue); -} - -#endif /* ACPI_USE_SYSTEM_CLIBRARY */ - diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cmcopy.c b/sys/contrib/dev/acpica/Subsystem/Common/cmcopy.c deleted file mode 100644 index a081e835a87eb..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cmcopy.c +++ /dev/null @@ -1,840 +0,0 @@ -/****************************************************************************** - * - * Module Name: cmcopy - Internal to external object translation utilities - * $Revision: 66 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __CMCOPY_C__ - -#include "acpi.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "amlcode.h" - - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmcopy") - - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCopyIsimpleToEsimple - * - * PARAMETERS: *InternalObject - Pointer to the object we are examining - * *Buffer - Where the object is returned - * *SpaceUsed - Where the data length is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to place a simple object in a user - * buffer. - * - * The buffer is assumed to have sufficient space for the object. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiCmCopyIsimpleToEsimple ( - ACPI_OPERAND_OBJECT *InternalObject, - ACPI_OBJECT *ExternalObject, - UINT8 *DataSpace, - UINT32 *BufferSpaceUsed) -{ - UINT32 Length = 0; - ACPI_STATUS Status = AE_OK; - - - FUNCTION_TRACE ("CmCopyIsimpleToEsimple"); - - - /* - * Check for NULL object case (could be an uninitialized - * package element - */ - - if (!InternalObject) - { - *BufferSpaceUsed = 0; - return_ACPI_STATUS (AE_OK); - } - - /* Always clear the external object */ - - MEMSET (ExternalObject, 0, sizeof (ACPI_OBJECT)); - - /* - * In general, the external object will be the same type as - * the internal object - */ - - ExternalObject->Type = InternalObject->Common.Type; - - /* However, only a limited number of external types are supported */ - - switch (InternalObject->Common.Type) - { - - case ACPI_TYPE_STRING: - - Length = InternalObject->String.Length + 1; - ExternalObject->String.Length = InternalObject->String.Length; - ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace; - MEMCPY ((void *) DataSpace, (void *) InternalObject->String.Pointer, Length); - break; - - - case ACPI_TYPE_BUFFER: - - Length = InternalObject->Buffer.Length; - ExternalObject->Buffer.Length = InternalObject->Buffer.Length; - ExternalObject->Buffer.Pointer = DataSpace; - MEMCPY ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer, Length); - break; - - - case ACPI_TYPE_INTEGER: - - ExternalObject->Integer.Value= InternalObject->Integer.Value; - break; - - - case INTERNAL_TYPE_REFERENCE: - - /* - * This is an object reference. Attempt to dereference it. - */ - - switch (InternalObject->Reference.OpCode) - { - case AML_ZERO_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = 0; - break; - - case AML_ONE_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = 1; - break; - - case AML_ONES_OP: - ExternalObject->Type = ACPI_TYPE_INTEGER; - ExternalObject->Integer.Value = ACPI_INTEGER_MAX; - break; - - case AML_NAMEPATH_OP: - /* - * This is a named reference, get the string. We already know that - * we have room for it, use max length - */ - Length = MAX_STRING_LENGTH; - ExternalObject->Type = ACPI_TYPE_STRING; - ExternalObject->String.Pointer = (NATIVE_CHAR *) DataSpace; - Status = AcpiNsHandleToPathname ((ACPI_HANDLE *) InternalObject->Reference.Node, - &Length, (char *) DataSpace); - break; - - default: - /* - * Use the object type of "Any" to indicate a reference - * to object containing a handle to an ACPI named object. - */ - ExternalObject->Type = ACPI_TYPE_ANY; - ExternalObject->Reference.Handle = InternalObject->Reference.Node; - break; - } - break; - - - case ACPI_TYPE_PROCESSOR: - - ExternalObject->Processor.ProcId = InternalObject->Processor.ProcId; - ExternalObject->Processor.PblkAddress = InternalObject->Processor.Address; - ExternalObject->Processor.PblkLength = InternalObject->Processor.Length; - break; - - - case ACPI_TYPE_POWER: - - ExternalObject->PowerResource.SystemLevel = - InternalObject->PowerResource.SystemLevel; - - ExternalObject->PowerResource.ResourceOrder = - InternalObject->PowerResource.ResourceOrder; - break; - - - default: - /* - * There is no corresponding external object type - */ - return_ACPI_STATUS (AE_SUPPORT); - break; - } - - - - *BufferSpaceUsed = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCopyIelementToEelement - * - * PARAMETERS: ACPI_PKG_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Copy one package element to another package element - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmCopyIelementToEelement ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context; - UINT32 ObjectSpace; - UINT32 ThisIndex; - ACPI_OBJECT *TargetObject; - - - - ThisIndex = State->Pkg.Index; - TargetObject = (ACPI_OBJECT *) - &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex]; - - - switch (ObjectType) - { - case 0: - - /* - * This is a simple or null object -- get the size - */ - - Status = AcpiCmCopyIsimpleToEsimple (SourceObject, - TargetObject, Info->FreeSpace, &ObjectSpace); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - break; - - case 1: - - /* - * Build the package object - */ - TargetObject->Type = ACPI_TYPE_PACKAGE; - TargetObject->Package.Count = SourceObject->Package.Count; - TargetObject->Package.Elements = (ACPI_OBJECT *) Info->FreeSpace; - - /* - * Pass the new package object back to the package walk routine - */ - State->Pkg.ThisTargetObj = TargetObject; - - /* - * Save space for the array of objects (Package elements) - * update the buffer length counter - */ - ObjectSpace = (UINT32) ROUND_UP_TO_NATIVE_WORD ( - TargetObject->Package.Count * sizeof (ACPI_OBJECT)); - break; - - default: - return (AE_BAD_PARAMETER); - } - - - Info->FreeSpace += ObjectSpace; - Info->Length += ObjectSpace; - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCopyIpackageToEpackage - * - * PARAMETERS: *InternalObject - Pointer to the object we are returning - * *Buffer - Where the object is returned - * *SpaceUsed - Where the object length is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to place a package object in a user - * buffer. A package object by definition contains other objects. - * - * The buffer is assumed to have sufficient space for the object. - * The caller must have verified the buffer length needed using the - * AcpiCmGetObjectSize function before calling this function. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiCmCopyIpackageToEpackage ( - ACPI_OPERAND_OBJECT *InternalObject, - UINT8 *Buffer, - UINT32 *SpaceUsed) -{ - ACPI_OBJECT *ExternalObject; - ACPI_STATUS Status; - ACPI_PKG_INFO Info; - - - FUNCTION_TRACE ("CmCopyIpackageToEpackage"); - - - /* - * First package at head of the buffer - */ - ExternalObject = (ACPI_OBJECT *) Buffer; - - /* - * Free space begins right after the first package - */ - Info.Length = 0; - Info.ObjectSpace = 0; - Info.NumPackages = 1; - Info.FreeSpace = Buffer + ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - - - - ExternalObject->Type = InternalObject->Common.Type; - ExternalObject->Package.Count = InternalObject->Package.Count; - ExternalObject->Package.Elements = (ACPI_OBJECT *) Info.FreeSpace; - - - /* - * Build an array of ACPI_OBJECTS in the buffer - * and move the free space past it - */ - - Info.FreeSpace += ExternalObject->Package.Count * - ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)); - - - Status = AcpiCmWalkPackageTree (InternalObject, ExternalObject, - AcpiCmCopyIelementToEelement, &Info); - - *SpaceUsed = Info.Length; - - return_ACPI_STATUS (Status); - -} - -/******************************************************************************* - * - * FUNCTION: AcpiCmCopyIobjectToEobject - * - * PARAMETERS: *InternalObject - The internal object to be converted - * *BufferPtr - Where the object is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to build an API object to be returned to - * the caller. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmCopyIobjectToEobject ( - ACPI_OPERAND_OBJECT *InternalObject, - ACPI_BUFFER *RetBuffer) -{ - ACPI_STATUS Status; - - - FUNCTION_TRACE ("CmCopyIobjectToEobject"); - - - if (IS_THIS_OBJECT_TYPE (InternalObject, ACPI_TYPE_PACKAGE)) - { - /* - * Package object: Copy all subobjects (including - * nested packages) - */ - Status = AcpiCmCopyIpackageToEpackage (InternalObject, - RetBuffer->Pointer, &RetBuffer->Length); - } - - else - { - /* - * Build a simple object (no nested objects) - */ - Status = AcpiCmCopyIsimpleToEsimple (InternalObject, - (ACPI_OBJECT *) RetBuffer->Pointer, - ((UINT8 *) RetBuffer->Pointer + - ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))), - &RetBuffer->Length); - /* - * build simple does not include the object size in the length - * so we add it in here - */ - RetBuffer->Length += sizeof (ACPI_OBJECT); - } - - return_ACPI_STATUS (Status); -} - - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCopyEsimpleToIsimple - * - * PARAMETERS: *ExternalObject - The external object to be converted - * *InternalObject - Where the internal object is returned - * - * RETURN: Status - * - * DESCRIPTION: This function copies an external object to an internal one. - * NOTE: Pointers can be copied, we don't need to copy data. - * (The pointers have to be valid in our address space no matter - * what we do with them!) - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmCopyEsimpleToIsimple ( - ACPI_OBJECT *ExternalObject, - ACPI_OPERAND_OBJECT *InternalObject) -{ - - FUNCTION_TRACE ("CmCopyEsimpleToIsimple"); - - - InternalObject->Common.Type = (UINT8) ExternalObject->Type; - - switch (ExternalObject->Type) - { - - case ACPI_TYPE_STRING: - - InternalObject->String.Length = ExternalObject->String.Length; - InternalObject->String.Pointer = ExternalObject->String.Pointer; - break; - - - case ACPI_TYPE_BUFFER: - - InternalObject->Buffer.Length = ExternalObject->Buffer.Length; - InternalObject->Buffer.Pointer = ExternalObject->Buffer.Pointer; - break; - - - case ACPI_TYPE_INTEGER: - /* - * Number is included in the object itself - */ - InternalObject->Integer.Value = ExternalObject->Integer.Value; - break; - - - default: - return_ACPI_STATUS (AE_CTRL_RETURN_VALUE); - break; - } - - - return_ACPI_STATUS (AE_OK); -} - - -#ifdef ACPI_FUTURE_IMPLEMENTATION - -/* Code to convert packages that are parameters to control methods */ - -/******************************************************************************* - * - * FUNCTION: AcpiCmCopyEpackageToIpackage - * - * PARAMETERS: *InternalObject - Pointer to the object we are returning - * *Buffer - Where the object is returned - * *SpaceUsed - Where the length of the object is returned - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: This function is called to place a package object in a user - * buffer. A package object by definition contains other objects. - * - * The buffer is assumed to have sufficient space for the object. - * The caller must have verified the buffer length needed using the - * AcpiCmGetObjectSize function before calling this function. - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiCmCopyEpackageToIpackage ( - ACPI_OPERAND_OBJECT *InternalObject, - UINT8 *Buffer, - UINT32 *SpaceUsed) -{ - UINT8 *FreeSpace; - ACPI_OBJECT *ExternalObject; - UINT32 Length = 0; - UINT32 ThisIndex; - UINT32 ObjectSpace = 0; - ACPI_OPERAND_OBJECT *ThisInternalObj; - ACPI_OBJECT *ThisExternalObj; - - - FUNCTION_TRACE ("CmCopyEpackageToIpackage"); - - - /* - * First package at head of the buffer - */ - ExternalObject = (ACPI_OBJECT *)Buffer; - - /* - * Free space begins right after the first package - */ - FreeSpace = Buffer + sizeof(ACPI_OBJECT); - - - ExternalObject->Type = InternalObject->Common.Type; - ExternalObject->Package.Count = InternalObject->Package.Count; - ExternalObject->Package.Elements = (ACPI_OBJECT *)FreeSpace; - - - /* - * Build an array of ACPI_OBJECTS in the buffer - * and move the free space past it - */ - - FreeSpace += ExternalObject->Package.Count * sizeof(ACPI_OBJECT); - - - /* Call WalkPackage */ - -} - -#endif /* Future implementation */ - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCopyEobjectToIobject - * - * PARAMETERS: *InternalObject - The external object to be converted - * *BufferPtr - Where the internal object is returned - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: Converts an external object to an internal object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmCopyEobjectToIobject ( - ACPI_OBJECT *ExternalObject, - ACPI_OPERAND_OBJECT *InternalObject) -{ - ACPI_STATUS Status; - - - FUNCTION_TRACE ("AcpiCmCopyEobjectToIobject"); - - - if (ExternalObject->Type == ACPI_TYPE_PACKAGE) - { - /* - * Package objects contain other objects (which can be objects) - * buildpackage does it all - * - * TBD: Package conversion must be completed and tested - * NOTE: this code converts packages as input parameters to - * control methods only. This is a very, very rare case. - */ -/* - Status = AcpiCmCopyEpackageToIpackage(InternalObject, - RetBuffer->Pointer, - &RetBuffer->Length); -*/ - DEBUG_PRINT (ACPI_ERROR, - ("AcpiCmCopyEobjectToIobject: Packages as parameters not implemented!\n")); - - return_ACPI_STATUS (AE_NOT_IMPLEMENTED); - } - - else - { - /* - * Build a simple object (no nested objects) - */ - Status = AcpiCmCopyEsimpleToIsimple (ExternalObject, InternalObject); - /* - * build simple does not include the object size in the length - * so we add it in here - */ - } - - return_ACPI_STATUS (Status); -} - - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCopyIelementToIelement - * - * PARAMETERS: ACPI_PKG_CALLBACK - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: Copy one package element to another package element - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmCopyIelementToIelement ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context) -{ - ACPI_STATUS Status = AE_OK; - UINT32 ThisIndex; - ACPI_OPERAND_OBJECT **ThisTargetPtr; - ACPI_OPERAND_OBJECT *TargetObject; - - - - ThisIndex = State->Pkg.Index; - ThisTargetPtr = (ACPI_OPERAND_OBJECT **) - &State->Pkg.DestObject->Package.Elements[ThisIndex]; - - switch (ObjectType) - { - case 0: - - /* - * This is a simple object, just copy it - */ - TargetObject = AcpiCmCreateInternalObject (SourceObject->Common.Type); - if (!TargetObject) - { - return (AE_NO_MEMORY); - } - - Status = AcpiAmlStoreObjectToObject (SourceObject, TargetObject, - (ACPI_WALK_STATE *) Context); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - *ThisTargetPtr = TargetObject; - break; - - - case 1: - /* - * This object is a package - go down another nesting level - * Create and build the package object - */ - TargetObject = AcpiCmCreateInternalObject (ACPI_TYPE_PACKAGE); - if (!TargetObject) - { - /* TBD: must delete package created up to this point */ - - return (AE_NO_MEMORY); - } - - TargetObject->Package.Count = SourceObject->Package.Count; - - /* - * Pass the new package object back to the package walk routine - */ - State->Pkg.ThisTargetObj = TargetObject; - - /* - * Store the object pointer in the parent package object - */ - *ThisTargetPtr = TargetObject; - break; - - default: - return (AE_BAD_PARAMETER); - } - - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCopyIpackageToIpackage - * - * PARAMETERS: *SourceObj - Pointer to the source package object - * *DestObj - Where the internal object is returned - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: This function is called to copy an internal package object - * into another internal package object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmCopyIpackageToIpackage ( - ACPI_OPERAND_OBJECT *SourceObj, - ACPI_OPERAND_OBJECT *DestObj, - ACPI_WALK_STATE *WalkState) -{ - ACPI_STATUS Status = AE_OK; - - FUNCTION_TRACE ("CmCopyIpackageToIpackage"); - - - - DestObj->Common.Type = SourceObj->Common.Type; - DestObj->Package.Count = SourceObj->Package.Count; - - - /* - * Create the object array and walk the source package tree - */ - - DestObj->Package.Elements = AcpiCmCallocate ((SourceObj->Package.Count + 1) * - sizeof (void *)); - DestObj->Package.NextElement = DestObj->Package.Elements; - - if (!DestObj->Package.Elements) - { - REPORT_ERROR ( - ("AmlBuildCopyInternalPackageObject: Package allocation failure\n")); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - - Status = AcpiCmWalkPackageTree (SourceObj, DestObj, - AcpiCmCopyIelementToIelement, WalkState); - - return_ACPI_STATUS (Status); -} - diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cmdebug.c b/sys/contrib/dev/acpica/Subsystem/Common/cmdebug.c deleted file mode 100644 index 5792a138e3160..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cmdebug.c +++ /dev/null @@ -1,657 +0,0 @@ -/****************************************************************************** - * - * Module Name: cmdebug - Debug print routines - * $Revision: 64 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __CMDEBUG_C__ - -#include "acpi.h" - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmdebug") - - -/***************************************************************************** - * - * FUNCTION: Get/Set debug level - * - * DESCRIPTION: Get or set value of the debug flag - * - * These are used to allow user's to get/set the debug level - * - ****************************************************************************/ - - -UINT32 -GetDebugLevel (void) -{ - - return (AcpiDbgLevel); -} - -void -SetDebugLevel ( - UINT32 NewDebugLevel) -{ - - AcpiDbgLevel = NewDebugLevel; -} - - -/***************************************************************************** - * - * FUNCTION: FunctionTrace - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * FunctionName - Name of Caller's function - * - * RETURN: None - * - * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel - * - ****************************************************************************/ - -void -FunctionTrace ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - NATIVE_CHAR *FunctionName) -{ - - AcpiGbl_NestingLevel++; - - DebugPrint (ModuleName, LineNumber, ComponentId, - TRACE_FUNCTIONS, - " %2.2ld Entered Function: %s\n", - AcpiGbl_NestingLevel, FunctionName); -} - - -/***************************************************************************** - * - * FUNCTION: FunctionTracePtr - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * FunctionName - Name of Caller's function - * Pointer - Pointer to display - * - * RETURN: None - * - * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel - * - ****************************************************************************/ - -void -FunctionTracePtr ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - NATIVE_CHAR *FunctionName, - void *Pointer) -{ - - AcpiGbl_NestingLevel++; - DebugPrint (ModuleName, LineNumber, ComponentId, TRACE_FUNCTIONS, - " %2.2ld Entered Function: %s, %p\n", - AcpiGbl_NestingLevel, FunctionName, Pointer); -} - - -/***************************************************************************** - * - * FUNCTION: FunctionTraceStr - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * FunctionName - Name of Caller's function - * String - Additional string to display - * - * RETURN: None - * - * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel - * - ****************************************************************************/ - -void -FunctionTraceStr ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - NATIVE_CHAR *FunctionName, - NATIVE_CHAR *String) -{ - - AcpiGbl_NestingLevel++; - DebugPrint (ModuleName, LineNumber, ComponentId, TRACE_FUNCTIONS, - " %2.2ld Entered Function: %s, %s\n", - AcpiGbl_NestingLevel, FunctionName, String); -} - - -/***************************************************************************** - * - * FUNCTION: FunctionTraceU32 - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * FunctionName - Name of Caller's function - * Integer - Integer to display - * - * RETURN: None - * - * DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel - * - ****************************************************************************/ - -void -FunctionTraceU32 ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - NATIVE_CHAR *FunctionName, - UINT32 Integer) -{ - - AcpiGbl_NestingLevel++; - DebugPrint (ModuleName, LineNumber, ComponentId, TRACE_FUNCTIONS, - " %2.2ld Entered Function: %s, %lX\n", - AcpiGbl_NestingLevel, FunctionName, Integer); -} - - -/***************************************************************************** - * - * FUNCTION: FunctionExit - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * FunctionName - Name of Caller's function - * - * RETURN: None - * - * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel - * - ****************************************************************************/ - -void -FunctionExit ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - NATIVE_CHAR *FunctionName) -{ - - DebugPrint (ModuleName, LineNumber, ComponentId, TRACE_FUNCTIONS, - " %2.2ld Exiting Function: %s\n", - AcpiGbl_NestingLevel, FunctionName); - - AcpiGbl_NestingLevel--; -} - - -/***************************************************************************** - * - * FUNCTION: FunctionStatusExit - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * FunctionName - Name of Caller's function - * Status - Exit status code - * - * RETURN: None - * - * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel. Prints exit status also. - * - ****************************************************************************/ - -void -FunctionStatusExit ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - NATIVE_CHAR *FunctionName, - ACPI_STATUS Status) -{ - - DebugPrint (ModuleName, LineNumber, ComponentId, - TRACE_FUNCTIONS, - " %2.2ld Exiting Function: %s, %s\n", - AcpiGbl_NestingLevel, - FunctionName, - AcpiCmFormatException (Status)); - - AcpiGbl_NestingLevel--; -} - - -/***************************************************************************** - * - * FUNCTION: FunctionValueExit - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * FunctionName - Name of Caller's function - * Value - Value to be printed with exit msg - * - * RETURN: None - * - * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel. Prints exit value also. - * - ****************************************************************************/ - -void -FunctionValueExit ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - NATIVE_CHAR *FunctionName, - ACPI_INTEGER Value) -{ - - DebugPrint (ModuleName, LineNumber, ComponentId, TRACE_FUNCTIONS, - " %2.2ld Exiting Function: %s, %X\n", - AcpiGbl_NestingLevel, FunctionName, Value); - - AcpiGbl_NestingLevel--; -} - - -/***************************************************************************** - * - * FUNCTION: FunctionPtrExit - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * FunctionName - Name of Caller's function - * Value - Value to be printed with exit msg - * - * RETURN: None - * - * DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is - * set in DebugLevel. Prints exit value also. - * - ****************************************************************************/ - -void -FunctionPtrExit ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - NATIVE_CHAR *FunctionName, - UINT8 *Ptr) -{ - - DebugPrint (ModuleName, LineNumber, ComponentId, TRACE_FUNCTIONS, - " %2.2ld Exiting Function: %s, %p\n", - AcpiGbl_NestingLevel, FunctionName, Ptr); - - AcpiGbl_NestingLevel--; -} - - -/***************************************************************************** - * - * FUNCTION: DebugPrint - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * PrintLevel - Requested debug print level - * Format - Printf format field - * ... - Optional printf arguments - * - * RETURN: None - * - * DESCRIPTION: Print error message with prefix consisting of the module name, - * line number, and component ID. - * - ****************************************************************************/ - -void -DebugPrint ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - UINT32 PrintLevel, - NATIVE_CHAR *Format, - ...) -{ - va_list args; - - - /* Both the level and the component must be enabled */ - - if ((PrintLevel & AcpiDbgLevel) && - (ComponentId & AcpiDbgLayer)) - { - va_start (args, Format); - - AcpiOsPrintf ("%8s-%04d: ", ModuleName, LineNumber); - AcpiOsVprintf (Format, args); - } -} - - -/***************************************************************************** - * - * FUNCTION: DebugPrintPrefix - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * - * RETURN: None - * - * DESCRIPTION: Print the prefix part of an error message, consisting of the - * module name, and line number - * - ****************************************************************************/ - -void -DebugPrintPrefix ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber) -{ - - - AcpiOsPrintf ("%8s-%04d: ", ModuleName, LineNumber); -} - - -/***************************************************************************** - * - * FUNCTION: DebugPrintRaw - * - * PARAMETERS: Format - Printf format field - * ... - Optional printf arguments - * - * RETURN: None - * - * DESCRIPTION: Print error message -- without module/line indentifiers - * - ****************************************************************************/ - -void -DebugPrintRaw ( - NATIVE_CHAR *Format, - ...) -{ - va_list args; - - - va_start (args, Format); - - AcpiOsVprintf (Format, args); - - va_end (args); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiCmDumpBuffer - * - * PARAMETERS: Buffer - Buffer to dump - * Count - Amount to dump, in bytes - * ComponentID - Caller's component ID - * - * RETURN: None - * - * DESCRIPTION: Generic dump buffer in both hex and ascii. - * - ****************************************************************************/ - -void -AcpiCmDumpBuffer ( - UINT8 *Buffer, - UINT32 Count, - UINT32 Display, - UINT32 ComponentId) -{ - UINT32 i = 0; - UINT32 j; - UINT32 Temp32; - UINT8 BufChar; - - - /* Only dump the buffer if tracing is enabled */ - - if (!((TRACE_TABLES & AcpiDbgLevel) && - (ComponentId & AcpiDbgLayer))) - { - return; - } - - - /* - * Nasty little dump buffer routine! - */ - while (i < Count) - { - /* Print current offset */ - - AcpiOsPrintf ("%05X ", i); - - - /* Print 16 hex chars */ - - for (j = 0; j < 16;) - { - if (i + j >= Count) - { - AcpiOsPrintf ("\n"); - return; - } - - /* Make sure that the INT8 doesn't get sign-extended! */ - - switch (Display) - { - /* Default is BYTE display */ - - default: - - AcpiOsPrintf ("%02X ", - *((UINT8 *) &Buffer[i + j])); - j += 1; - break; - - - case DB_WORD_DISPLAY: - - MOVE_UNALIGNED16_TO_32 (&Temp32, - &Buffer[i + j]); - AcpiOsPrintf ("%04X ", Temp32); - j += 2; - break; - - - case DB_DWORD_DISPLAY: - - MOVE_UNALIGNED32_TO_32 (&Temp32, - &Buffer[i + j]); - AcpiOsPrintf ("%08X ", Temp32); - j += 4; - break; - - - case DB_QWORD_DISPLAY: - - MOVE_UNALIGNED32_TO_32 (&Temp32, - &Buffer[i + j]); - AcpiOsPrintf ("%08X", Temp32); - - MOVE_UNALIGNED32_TO_32 (&Temp32, - &Buffer[i + j + 4]); - AcpiOsPrintf ("%08X ", Temp32); - j += 8; - break; - } - } - - - /* - * Print the ASCII equivalent characters - * But watch out for the bad unprintable ones... - */ - - for (j = 0; j < 16; j++) - { - if (i + j >= Count) - { - AcpiOsPrintf ("\n"); - return; - } - - BufChar = Buffer[i + j]; - if ((BufChar > 0x1F && BufChar < 0x2E) || - (BufChar > 0x2F && BufChar < 0x61) || - (BufChar > 0x60 && BufChar < 0x7F)) - { - AcpiOsPrintf ("%c", BufChar); - } - else - { - AcpiOsPrintf ("."); - } - } - - /* Done with that line. */ - - AcpiOsPrintf ("\n"); - i += 16; - } - - return; -} - - diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cmdelete.c b/sys/contrib/dev/acpica/Subsystem/Common/cmdelete.c deleted file mode 100644 index 34a42aea40470..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cmdelete.c +++ /dev/null @@ -1,806 +0,0 @@ -/******************************************************************************* - * - * Module Name: cmdelete - object deletion and reference count utilities - * $Revision: 62 $ - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __CMDELETE_C__ - -#include "acpi.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "actables.h" -#include "acparser.h" - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmdelete") - - -/******************************************************************************* - * - * FUNCTION: AcpiCmDeleteInternalObj - * - * PARAMETERS: *Object - Pointer to the list to be deleted - * - * RETURN: None - * - * DESCRIPTION: Low level object deletion, after reference counts have been - * updated (All reference counts, including sub-objects!) - * - ******************************************************************************/ - -void -AcpiCmDeleteInternalObj ( - ACPI_OPERAND_OBJECT *Object) -{ - void *ObjPointer = NULL; - ACPI_OPERAND_OBJECT *HandlerDesc; - - - FUNCTION_TRACE_PTR ("CmDeleteInternalObj", Object); - - - if (!Object) - { - return_VOID; - } - - /* - * Must delete or free any pointers within the object that are not - * actual ACPI objects (for example, a raw buffer pointer). - */ - - switch (Object->Common.Type) - { - - case ACPI_TYPE_STRING: - - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: **** String %p, ptr %p\n", - Object, Object->String.Pointer)); - - /* Free the actual string buffer */ - - ObjPointer = Object->String.Pointer; - break; - - - case ACPI_TYPE_BUFFER: - - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: **** Buffer %p, ptr %p\n", - Object, Object->Buffer.Pointer)); - - /* Free the actual buffer */ - - ObjPointer = Object->Buffer.Pointer; - break; - - - case ACPI_TYPE_PACKAGE: - - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: **** Package of count %X\n", - Object->Package.Count)); - - /* - * Elements of the package are not handled here, they are deleted - * separately - */ - - /* Free the (variable length) element pointer array */ - - ObjPointer = Object->Package.Elements; - break; - - - case ACPI_TYPE_MUTEX: - - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: ***** Mutex %p, Semaphore %p\n", - Object, Object->Mutex.Semaphore)); - - AcpiOsDeleteSemaphore (Object->Mutex.Semaphore); - break; - - - case ACPI_TYPE_EVENT: - - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: ***** Event %p, Semaphore %p\n", - Object, Object->Event.Semaphore)); - - AcpiOsDeleteSemaphore (Object->Event.Semaphore); - Object->Event.Semaphore = NULL; - break; - - - case ACPI_TYPE_METHOD: - - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: ***** Method %p\n", Object)); - - /* Delete the method semaphore if it exists */ - - if (Object->Method.Semaphore) - { - AcpiOsDeleteSemaphore (Object->Method.Semaphore); - Object->Method.Semaphore = NULL; - } - - break; - - - case ACPI_TYPE_REGION: - - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: ***** Region %p\n", - Object)); - - - if (Object->Region.Extra) - { - /* - * Free the RegionContext if and only if the handler is one of the - * default handlers -- and therefore, we created the context object - * locally, it was not created by an external caller. - */ - HandlerDesc = Object->Region.AddrHandler; - if ((HandlerDesc) && - (HandlerDesc->AddrHandler.Hflags == ADDR_HANDLER_DEFAULT_INSTALLED)) - { - ObjPointer = Object->Region.Extra->Extra.RegionContext; - } - - /* Now we can free the Extra object */ - - AcpiCmDeleteObjectDesc (Object->Region.Extra); - } - break; - - - case ACPI_TYPE_FIELD_UNIT: - - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: ***** FieldUnit %p\n", - Object)); - - if (Object->FieldUnit.Extra) - { - AcpiCmDeleteObjectDesc (Object->FieldUnit.Extra); - } - break; - - default: - break; - } - - - /* - * Delete any allocated memory found above - */ - - if (ObjPointer) - { - if (!AcpiTbSystemTablePointer (ObjPointer)) - { - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: Deleting Obj Ptr %p \n", ObjPointer)); - - AcpiCmFree (ObjPointer); - } - } - - - /* Only delete the object if it was dynamically allocated */ - - if (Object->Common.Flags & AOPOBJ_STATIC_ALLOCATION) - { - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: Object %p [%s] static allocation, no delete\n", - Object, AcpiCmGetTypeName (Object->Common.Type))); - } - - if (!(Object->Common.Flags & AOPOBJ_STATIC_ALLOCATION)) - { - DEBUG_PRINT (ACPI_INFO, - ("CmDeleteInternalObj: Deleting object %p [%s]\n", - Object, AcpiCmGetTypeName (Object->Common.Type))); - - AcpiCmDeleteObjectDesc (Object); - - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmDeleteInternalObjectList - * - * PARAMETERS: *ObjList - Pointer to the list to be deleted - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: This function deletes an internal object list, including both - * simple objects and package objects - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmDeleteInternalObjectList ( - ACPI_OPERAND_OBJECT **ObjList) -{ - ACPI_OPERAND_OBJECT **InternalObj; - - - FUNCTION_TRACE ("CmDeleteInternalObjectList"); - - - /* Walk the null-terminated internal list */ - - for (InternalObj = ObjList; *InternalObj; InternalObj++) - { - /* - * Check for a package - * Simple objects are simply stored in the array and do not - * need to be deleted separately. - */ - - if (IS_THIS_OBJECT_TYPE ((*InternalObj), ACPI_TYPE_PACKAGE)) - { - /* Delete the package */ - - /* - * TBD: [Investigate] This might not be the right thing to do, - * depending on how the internal package object was allocated!!! - */ - AcpiCmDeleteInternalObj (*InternalObj); - } - - } - - /* Free the combined parameter pointer list and object array */ - - AcpiCmFree (ObjList); - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmUpdateRefCount - * - * PARAMETERS: *Object - Object whose ref count is to be updated - * Action - What to do - * - * RETURN: New ref count - * - * DESCRIPTION: Modify the ref count and return it. - * - ******************************************************************************/ - -static void -AcpiCmUpdateRefCount ( - ACPI_OPERAND_OBJECT *Object, - UINT32 Action) -{ - UINT16 Count; - UINT16 NewCount; - - - if (!Object) - { - return; - } - - - Count = Object->Common.ReferenceCount; - NewCount = Count; - - /* - * Reference count action (increment, decrement, or force delete) - */ - - switch (Action) - { - - case REF_INCREMENT: - - NewCount++; - Object->Common.ReferenceCount = NewCount; - - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateRefCount: Obj %p Refs=%X, [Incremented]\n", - Object, NewCount)); - break; - - - case REF_DECREMENT: - - if (Count < 1) - { - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateRefCount: Obj %p Refs=%X, can't decrement! (Set to 0)\n", - Object, NewCount)); - - NewCount = 0; - } - - else - { - NewCount--; - - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateRefCount: Obj %p Refs=%X, [Decremented]\n", - Object, NewCount)); - } - - if (Object->Common.Type == ACPI_TYPE_METHOD) - { - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateRefCount: Method Obj %p Refs=%X, [Decremented]\n", - Object, NewCount)); - } - - Object->Common.ReferenceCount = NewCount; - if (NewCount == 0) - { - AcpiCmDeleteInternalObj (Object); - } - - break; - - - case REF_FORCE_DELETE: - - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateRefCount: Obj %p Refs=%X, Force delete! (Set to 0)\n", - Object, Count)); - - NewCount = 0; - Object->Common.ReferenceCount = NewCount; - AcpiCmDeleteInternalObj (Object); - break; - - - default: - - DEBUG_PRINT (ACPI_ERROR, - ("CmUpdateRefCount: Unknown action (%X)\n", Action)); - break; - } - - - /* - * Sanity check the reference count, for debug purposes only. - * (A deleted object will have a huge reference count) - */ - - if (Count > MAX_REFERENCE_COUNT) - { - - DEBUG_PRINT (ACPI_ERROR, - ("CmUpdateRefCount: **** AE_ERROR **** Invalid Reference Count (%X) in object %p\n\n", - Count, Object)); - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmUpdateObjectReference - * - * PARAMETERS: *Object - Increment ref count for this object - * and all sub-objects - * Action - Either REF_INCREMENT or REF_DECREMENT or - * REF_FORCE_DELETE - * - * RETURN: Status - * - * DESCRIPTION: Increment the object reference count - * - * Object references are incremented when: - * 1) An object is attached to a Node (namespace object) - * 2) An object is copied (all subobjects must be incremented) - * - * Object references are decremented when: - * 1) An object is detached from an Node - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmUpdateObjectReference ( - ACPI_OPERAND_OBJECT *Object, - UINT16 Action) -{ - ACPI_STATUS Status; - UINT32 i; - ACPI_OPERAND_OBJECT *Next; - ACPI_OPERAND_OBJECT *New; - ACPI_GENERIC_STATE *StateList = NULL; - ACPI_GENERIC_STATE *State; - - - FUNCTION_TRACE_PTR ("CmUpdateObjectReference", Object); - - - /* Ignore a null object ptr */ - - if (!Object) - { - return_ACPI_STATUS (AE_OK); - } - - - /* - * Make sure that this isn't a namespace handle or an AML pointer - */ - - if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED)) - { - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateObjectReference: Object %p is NS handle\n", - Object)); - return_ACPI_STATUS (AE_OK); - } - - if (AcpiTbSystemTablePointer (Object)) - { - DEBUG_PRINT (ACPI_INFO, - ("CmUpdateObjectReference: **** Object %p is Pcode Ptr\n", - Object)); - return_ACPI_STATUS (AE_OK); - } - - - State = AcpiCmCreateUpdateState (Object, Action); - - while (State) - { - - Object = State->Update.Object; - Action = State->Update.Value; - AcpiCmDeleteGenericState (State); - - /* - * All sub-objects must have their reference count incremented also. - * Different object types have different subobjects. - */ - switch (Object->Common.Type) - { - - case ACPI_TYPE_DEVICE: - - Status = AcpiCmCreateUpdateStateAndPush (Object->Device.AddrHandler, - Action, &StateList); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - AcpiCmUpdateRefCount (Object->Device.SysHandler, Action); - AcpiCmUpdateRefCount (Object->Device.DrvHandler, Action); - break; - - - case INTERNAL_TYPE_ADDRESS_HANDLER: - - /* Must walk list of address handlers */ - - Next = Object->AddrHandler.Next; - while (Next) - { - New = Next->AddrHandler.Next; - AcpiCmUpdateRefCount (Next, Action); - - Next = New; - } - break; - - - case ACPI_TYPE_PACKAGE: - - /* - * We must update all the sub-objects of the package - * (Each of whom may have their own sub-objects, etc. - */ - for (i = 0; i < Object->Package.Count; i++) - { - /* - * Push each element onto the stack for later processing. - * Note: There can be null elements within the package, - * these are simply ignored - */ - - Status = AcpiCmCreateUpdateStateAndPush ( - Object->Package.Elements[i], Action, &StateList); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - break; - - - case ACPI_TYPE_FIELD_UNIT: - - Status = AcpiCmCreateUpdateStateAndPush ( - Object->FieldUnit.Container, Action, &StateList); - - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - break; - - - case INTERNAL_TYPE_DEF_FIELD: - - Status = AcpiCmCreateUpdateStateAndPush ( - Object->Field.Container, Action, &StateList); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - break; - - - case INTERNAL_TYPE_BANK_FIELD: - - Status = AcpiCmCreateUpdateStateAndPush ( - Object->BankField.BankSelect, Action, &StateList); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - Status = AcpiCmCreateUpdateStateAndPush ( - Object->BankField.Container, Action, &StateList); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - break; - - - case ACPI_TYPE_REGION: - - /* TBD: [Investigate] - AcpiCmUpdateRefCount (Object->Region.AddrHandler, Action); - */ -/* - Status = - AcpiCmCreateUpdateStateAndPush (Object->Region.AddrHandler, - Action, &StateList); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } -*/ - break; - - - case INTERNAL_TYPE_REFERENCE: - - break; - } - - - /* - * Now we can update the count in the main object. This can only - * happen after we update the sub-objects in case this causes the - * main object to be deleted. - */ - - AcpiCmUpdateRefCount (Object, Action); - - - /* Move on to the next object to be updated */ - - State = AcpiCmPopGenericState (&StateList); - } - - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmAddReference - * - * PARAMETERS: *Object - Object whose reference count is to be - * incremented - * - * RETURN: None - * - * DESCRIPTION: Add one reference to an ACPI object - * - ******************************************************************************/ - -void -AcpiCmAddReference ( - ACPI_OPERAND_OBJECT *Object) -{ - - FUNCTION_TRACE_PTR ("CmAddReference", Object); - - - /* - * Ensure that we have a valid object - */ - - if (!AcpiCmValidInternalObject (Object)) - { - return_VOID; - } - - /* - * We have a valid ACPI internal object, now increment the reference count - */ - - AcpiCmUpdateObjectReference (Object, REF_INCREMENT); - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmRemoveReference - * - * PARAMETERS: *Object - Object whose ref count will be decremented - * - * RETURN: None - * - * DESCRIPTION: Decrement the reference count of an ACPI internal object - * - ******************************************************************************/ - -void -AcpiCmRemoveReference ( - ACPI_OPERAND_OBJECT *Object) -{ - - FUNCTION_TRACE_PTR ("CmRemoveReference", Object); - - - /* - * Ensure that we have a valid object - */ - - if (!AcpiCmValidInternalObject (Object)) - { - return_VOID; - } - - DEBUG_PRINT (ACPI_INFO, ("CmRemoveReference: Obj %p Refs=%X\n", - Object, Object->Common.ReferenceCount)); - - /* - * Decrement the reference count, and only actually delete the object - * if the reference count becomes 0. (Must also decrement the ref count - * of all subobjects!) - */ - - AcpiCmUpdateObjectReference (Object, REF_DECREMENT); - - return_VOID; -} - - diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cmeval.c b/sys/contrib/dev/acpica/Subsystem/Common/cmeval.c deleted file mode 100644 index 2987090dbc9d3..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cmeval.c +++ /dev/null @@ -1,494 +0,0 @@ -/****************************************************************************** - * - * Module Name: cmeval - Object evaluation - * $Revision: 21 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __CMEVAL_C__ - -#include "acpi.h" -#include "acnamesp.h" -#include "acinterp.h" - - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmeval") - - -/**************************************************************************** - * - * FUNCTION: AcpiCmEvaluateNumericObject - * - * PARAMETERS: *ObjectName - Object name to be evaluated - * DeviceNode - Node for the device - * *Address - Where the value is returned - * - * RETURN: Status - * - * DESCRIPTION: evaluates a numeric namespace object for a selected device - * and stores results in *Address. - * - * NOTE: Internal function, no parameter validation - * - ***************************************************************************/ - -ACPI_STATUS -AcpiCmEvaluateNumericObject ( - NATIVE_CHAR *ObjectName, - ACPI_NAMESPACE_NODE *DeviceNode, - ACPI_INTEGER *Address) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - FUNCTION_TRACE ("CmEvaluateNumericObject"); - - - /* Execute the method */ - - Status = AcpiNsEvaluateRelative (DeviceNode, ObjectName, NULL, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - DEBUG_PRINT (ACPI_INFO, - ("%s on %4.4s was not found\n", ObjectName, - &DeviceNode->Name)); - } - else - { - DEBUG_PRINT (ACPI_ERROR, - ("%s on %4.4s failed with status %4.4x\n", ObjectName, - &DeviceNode->Name, - AcpiCmFormatException (Status))); - } - - return_ACPI_STATUS (Status); - } - - - /* Did we get a return object? */ - - if (!ObjDesc) - { - DEBUG_PRINT (ACPI_ERROR, - ("No object was returned from %s\n", ObjectName)); - return_ACPI_STATUS (AE_TYPE); - } - - /* Is the return object of the correct type? */ - - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) - { - Status = AE_TYPE; - DEBUG_PRINT (ACPI_ERROR, - ("Type returned from %s was not a number: %X \n", - ObjectName, ObjDesc->Common.Type)); - } - else - { - /* - * Since the structure is a union, setting any field will set all - * of the variables in the union - */ - *Address = ObjDesc->Integer.Value; - } - - /* On exit, we must delete the return object */ - - AcpiCmRemoveReference (ObjDesc); - - return_ACPI_STATUS (Status); -} - - -/**************************************************************************** - * - * FUNCTION: AcpiCmExecute_HID - * - * PARAMETERS: DeviceNode - Node for the device - * *Hid - Where the HID is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _HID control method that returns the hardware - * ID of the device. - * - * NOTE: Internal function, no parameter validation - * - ***************************************************************************/ - -ACPI_STATUS -AcpiCmExecute_HID ( - ACPI_NAMESPACE_NODE *DeviceNode, - DEVICE_ID *Hid) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - FUNCTION_TRACE ("CmExecute_HID"); - - - /* Execute the method */ - - Status = AcpiNsEvaluateRelative (DeviceNode, - METHOD_NAME__HID, NULL, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - DEBUG_PRINT (ACPI_INFO, - ("_HID on %4.4s was not found\n", - &DeviceNode->Name)); - } - - else - { - DEBUG_PRINT (ACPI_ERROR, - ("_HID on %4.4s failed with status %4.4x\n", - &DeviceNode->Name, - AcpiCmFormatException (Status))); - } - - return_ACPI_STATUS (Status); - } - - /* Did we get a return object? */ - - if (!ObjDesc) - { - DEBUG_PRINT (ACPI_ERROR, ("No object was returned from _HID\n")); - return_ACPI_STATUS (AE_TYPE); - } - - /* - * A _HID can return either a Number (32 bit compressed EISA ID) or - * a string - */ - - if ((ObjDesc->Common.Type != ACPI_TYPE_INTEGER) && - (ObjDesc->Common.Type != ACPI_TYPE_STRING)) - { - Status = AE_TYPE; - DEBUG_PRINT (ACPI_ERROR, - ("Type returned from _HID not a number or string: %s(%X) \n", - AcpiCmGetTypeName (ObjDesc->Common.Type), ObjDesc->Common.Type)); - } - - else - { - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - /* Convert the Numeric HID to string */ - - AcpiAmlEisaIdToString ((UINT32) ObjDesc->Integer.Value, Hid->Buffer); - } - - else - { - /* Copy the String HID from the returned object */ - - STRNCPY(Hid->Buffer, ObjDesc->String.Pointer, sizeof(Hid->Buffer)); - } - } - - - /* On exit, we must delete the return object */ - - AcpiCmRemoveReference (ObjDesc); - - return_ACPI_STATUS (Status); -} - - -/**************************************************************************** - * - * FUNCTION: AcpiCmExecute_UID - * - * PARAMETERS: DeviceNode - Node for the device - * *Uid - Where the UID is returned - * - * RETURN: Status - * - * DESCRIPTION: Executes the _UID control method that returns the hardware - * ID of the device. - * - * NOTE: Internal function, no parameter validation - * - ***************************************************************************/ - -ACPI_STATUS -AcpiCmExecute_UID ( - ACPI_NAMESPACE_NODE *DeviceNode, - DEVICE_ID *Uid) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - /* Execute the method */ - - Status = AcpiNsEvaluateRelative (DeviceNode, - METHOD_NAME__UID, NULL, &ObjDesc); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - DEBUG_PRINT (ACPI_INFO, - ("_UID on %4.4s was not found\n", - &DeviceNode->Name)); - } - - else - { - DEBUG_PRINT (ACPI_ERROR, - ("_UID on %4.4s failed with status %4.4x\n", - &DeviceNode->Name, - AcpiCmFormatException (Status))); - } - - return (Status); - } - - /* Did we get a return object? */ - - if (!ObjDesc) - { - DEBUG_PRINT (ACPI_ERROR, ("No object was returned from _UID\n")); - return (AE_TYPE); - } - - /* - * A _UID can return either a Number (32 bit compressed EISA ID) or - * a string - */ - - if ((ObjDesc->Common.Type != ACPI_TYPE_INTEGER) && - (ObjDesc->Common.Type != ACPI_TYPE_STRING)) - { - Status = AE_TYPE; - DEBUG_PRINT (ACPI_ERROR, - ("Type returned from _UID was not a number or string: %X \n", - ObjDesc->Common.Type)); - } - - else - { - if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER) - { - /* Convert the Numeric UID to string */ - - AcpiAmlUnsignedIntegerToString (ObjDesc->Integer.Value, Uid->Buffer); - } - - else - { - /* Copy the String UID from the returned object */ - - STRNCPY(Uid->Buffer, ObjDesc->String.Pointer, sizeof(Uid->Buffer)); - } - } - - - /* On exit, we must delete the return object */ - - AcpiCmRemoveReference (ObjDesc); - - return (Status); -} - -/**************************************************************************** - * - * FUNCTION: AcpiCmExecute_STA - * - * PARAMETERS: DeviceNode - Node for the device - * *Flags - Where the status flags are returned - * - * RETURN: Status - * - * DESCRIPTION: Executes _STA for selected device and stores results in - * *Flags. - * - * NOTE: Internal function, no parameter validation - * - ***************************************************************************/ - -ACPI_STATUS -AcpiCmExecute_STA ( - ACPI_NAMESPACE_NODE *DeviceNode, - UINT32 *Flags) -{ - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_STATUS Status; - - - FUNCTION_TRACE ("CmExecute_STA"); - - /* Execute the method */ - - Status = AcpiNsEvaluateRelative (DeviceNode, - METHOD_NAME__STA, NULL, &ObjDesc); - if (AE_NOT_FOUND == Status) - { - DEBUG_PRINT (ACPI_INFO, - ("_STA on %4.4s was not found, assuming present.\n", - &DeviceNode->Name)); - - *Flags = 0x0F; - Status = AE_OK; - } - - else if (ACPI_FAILURE (Status)) - { - DEBUG_PRINT (ACPI_ERROR, - ("_STA on %4.4s failed with status %s\n", - &DeviceNode->Name, - AcpiCmFormatException (Status))); - } - - else /* success */ - { - /* Did we get a return object? */ - - if (!ObjDesc) - { - DEBUG_PRINT (ACPI_ERROR, ("No object was returned from _STA\n")); - return_ACPI_STATUS (AE_TYPE); - } - - /* Is the return object of the correct type? */ - - if (ObjDesc->Common.Type != ACPI_TYPE_INTEGER) - { - Status = AE_TYPE; - DEBUG_PRINT (ACPI_ERROR, - ("Type returned from _STA was not a number: %X \n", - ObjDesc->Common.Type)); - } - - else - { - /* Extract the status flags */ - - *Flags = (UINT32) ObjDesc->Integer.Value; - } - - /* On exit, we must delete the return object */ - - AcpiCmRemoveReference (ObjDesc); - } - - return_ACPI_STATUS (Status); -} diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cmglobal.c b/sys/contrib/dev/acpica/Subsystem/Common/cmglobal.c deleted file mode 100644 index 2cea5c68d0b03..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cmglobal.c +++ /dev/null @@ -1,792 +0,0 @@ -/****************************************************************************** - * - * Module Name: cmglobal - Global variables for the ACPI subsystem - * $Revision: 116 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __CMGLOBAL_C__ -#define DEFINE_ACPI_GLOBALS - -#include "acpi.h" -#include "acevents.h" -#include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" - - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmglobal") - - -/****************************************************************************** - * - * Static global variable initialization. - * - ******************************************************************************/ - -/* - * We want the debug switches statically initialized so they - * are already set when the debugger is entered. - */ - -/* Debug switch - level and trace mask */ - -#ifdef ACPI_DEBUG -UINT32 AcpiDbgLevel = DEBUG_DEFAULT; -#else -UINT32 AcpiDbgLevel = NORMAL_DEFAULT; -#endif - -/* Debug switch - layer (component) mask */ - -UINT32 AcpiDbgLayer = COMPONENT_DEFAULT; -UINT32 AcpiGbl_NestingLevel = 0; - - -/* Debugger globals */ - -BOOLEAN AcpiGbl_DbTerminateThreads = FALSE; -BOOLEAN AcpiGbl_MethodExecuting = FALSE; - -/* System flags */ - -UINT32 AcpiGbl_SystemFlags = 0; -UINT32 AcpiGbl_StartupFlags = 0; - -/* System starts unitialized! */ -BOOLEAN AcpiGbl_Shutdown = TRUE; - - -UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128}; - - -/****************************************************************************** - * - * Namespace globals - * - ******************************************************************************/ - - -/* - * Names built-in to the interpreter - * - * Initial values are currently supported only for types String and Number. - * To avoid type punning, both are specified as strings in this table. - */ - -PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = -{ - {"_GPE", INTERNAL_TYPE_DEF_ANY}, - {"_PR_", INTERNAL_TYPE_DEF_ANY}, - {"_SB_", INTERNAL_TYPE_DEF_ANY}, - {"_SI_", INTERNAL_TYPE_DEF_ANY}, - {"_TZ_", INTERNAL_TYPE_DEF_ANY}, - {"_REV", ACPI_TYPE_INTEGER, "2"}, - {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, - {"_GL_", ACPI_TYPE_MUTEX, "0"}, - - /* Table terminator */ - - {NULL, ACPI_TYPE_ANY} -}; - - -/* - * Properties of the ACPI Object Types, both internal and external. - * - * Elements of AcpiNsProperties are bit significant - * and the table is indexed by values of ACPI_OBJECT_TYPE - */ - -UINT8 AcpiGbl_NsProperties[] = -{ - NSP_NORMAL, /* 00 Any */ - NSP_NORMAL, /* 01 Number */ - NSP_NORMAL, /* 02 String */ - NSP_NORMAL, /* 03 Buffer */ - NSP_LOCAL, /* 04 Package */ - NSP_NORMAL, /* 05 FieldUnit */ - NSP_NEWSCOPE | NSP_LOCAL, /* 06 Device */ - NSP_LOCAL, /* 07 AcpiEvent */ - NSP_NEWSCOPE | NSP_LOCAL, /* 08 Method */ - NSP_LOCAL, /* 09 Mutex */ - NSP_LOCAL, /* 10 Region */ - NSP_NEWSCOPE | NSP_LOCAL, /* 11 Power */ - NSP_NEWSCOPE | NSP_LOCAL, /* 12 Processor */ - NSP_NEWSCOPE | NSP_LOCAL, /* 13 Thermal */ - NSP_NORMAL, /* 14 BufferField */ - NSP_NORMAL, /* 15 DdbHandle */ - NSP_NORMAL, /* 16 Debug Object */ - NSP_NORMAL, /* 17 DefField */ - NSP_NORMAL, /* 18 BankField */ - NSP_NORMAL, /* 19 IndexField */ - NSP_NORMAL, /* 20 Reference */ - NSP_NORMAL, /* 21 Alias */ - NSP_NORMAL, /* 22 Notify */ - NSP_NORMAL, /* 23 Address Handler */ - NSP_NEWSCOPE | NSP_LOCAL, /* 24 Resource */ - NSP_NORMAL, /* 25 DefFieldDefn */ - NSP_NORMAL, /* 26 BankFieldDefn */ - NSP_NORMAL, /* 27 IndexFieldDefn */ - NSP_NORMAL, /* 28 If */ - NSP_NORMAL, /* 29 Else */ - NSP_NORMAL, /* 30 While */ - NSP_NEWSCOPE, /* 31 Scope */ - NSP_LOCAL, /* 32 DefAny */ - NSP_NORMAL, /* 33 Extra */ - NSP_NORMAL /* 34 Invalid */ -}; - - -/* Hex to ASCII conversion table */ - -NATIVE_CHAR AcpiGbl_HexToAscii[] = - {'0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F'}; - - -/****************************************************************************** - * - * Table globals - * - * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes. - * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables - * that are not used by the subsystem are simply ignored. - * - ******************************************************************************/ - - -ACPI_TABLE_DESC AcpiGbl_AcpiTables[NUM_ACPI_TABLES]; - - -ACPI_TABLE_SUPPORT AcpiGbl_AcpiTableData[NUM_ACPI_TABLES] = -{ - /*********** Name, Signature, Signature size, How many allowed?, Supported? Global typed pointer */ - - /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, sizeof (RSDP_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, - /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, sizeof (DSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_DSDT}, - /* FADT 2 */ {FADT_SIG, FADT_SIG, sizeof (FADT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FADT}, - /* FACS 3 */ {FACS_SIG, FACS_SIG, sizeof (FACS_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, (void **) &AcpiGbl_FACS}, - /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, sizeof (PSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, - /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, sizeof (SSDT_SIG)-1, ACPI_TABLE_MULTIPLE, AE_OK, NULL}, - /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, sizeof (RSDT_SIG)-1, ACPI_TABLE_SINGLE, AE_OK, NULL}, -}; - - -#ifdef ACPI_DEBUG - -/****************************************************************************** - * - * Strings and procedures used for debug only - * - ******************************************************************************/ - -NATIVE_CHAR *MsgAcpiErrorBreak = "*** Break on ACPI_ERROR ***\n"; - - -/***************************************************************************** - * - * FUNCTION: AcpiCmGetMutexName - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a mutex ID into a name string (Debug only) - * - ****************************************************************************/ - -NATIVE_CHAR * -AcpiCmGetMutexName ( - UINT32 MutexId) -{ - - if (MutexId > MAX_MTX) - { - return ("Invalid Mutex ID"); - } - - return (AcpiGbl_MutexNames[MutexId]); -} - - -/* - * Elements of AcpiGbl_NsTypeNames below must match - * one-to-one with values of ACPI_OBJECT_TYPE - * - * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when - * stored in a table it really means that we have thus far seen no evidence to - * indicatewhat type is actually going to be stored for this entry. - */ - -static NATIVE_CHAR AcpiGbl_BadType[] = "UNDEFINED"; -#define TYPE_NAME_LENGTH 9 /* Maximum length of each string */ - -static NATIVE_CHAR *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */ -{ - /* 00 */ "Untyped", - /* 01 */ "Integer", - /* 02 */ "String", - /* 03 */ "Buffer", - /* 04 */ "Package", - /* 05 */ "FieldUnit", - /* 06 */ "Device", - /* 07 */ "Event", - /* 08 */ "Method", - /* 09 */ "Mutex", - /* 10 */ "Region", - /* 11 */ "Power", - /* 12 */ "Processor", - /* 13 */ "Thermal", - /* 14 */ "BufferFld", - /* 15 */ "DdbHandle", - /* 16 */ "DebugObj", - /* 17 */ "DefField", - /* 18 */ "BnkField", - /* 19 */ "IdxField", - /* 20 */ "Reference", - /* 21 */ "Alias", - /* 22 */ "Notify", - /* 23 */ "AddrHndlr", - /* 24 */ "Resource", - /* 25 */ "DefFldDfn", - /* 26 */ "BnkFldDfn", - /* 27 */ "IdxFldDfn", - /* 28 */ "If", - /* 29 */ "Else", - /* 30 */ "While", - /* 31 */ "Scope", - /* 32 */ "DefAny", - /* 33 */ "Extra", - /* 34 */ "Invalid" -}; - - -/***************************************************************************** - * - * FUNCTION: AcpiCmGetTypeName - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a Type ID into a name string (Debug only) - * - ****************************************************************************/ - -NATIVE_CHAR * -AcpiCmGetTypeName ( - UINT32 Type) -{ - - if (Type > INTERNAL_TYPE_INVALID) - { - return (AcpiGbl_BadType); - } - - return (AcpiGbl_NsTypeNames[Type]); -} - - -/* Region type decoding */ - -NATIVE_CHAR *AcpiGbl_RegionTypes[NUM_REGION_TYPES] = -{ - "SystemMemory", - "SystemIO", - "PCIConfig", - "EmbeddedControl", - "SMBus", - "CMOS", - "PCIBarTarget", -}; - - -/***************************************************************************** - * - * FUNCTION: AcpiCmGetRegionName - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Translate a Space ID into a name string (Debug only) - * - ****************************************************************************/ - -NATIVE_CHAR * -AcpiCmGetRegionName ( - UINT8 SpaceId) -{ - - if (SpaceId >= USER_REGION_BEGIN) - { - return ("UserDefinedRegion"); - } - - else if (SpaceId >= NUM_REGION_TYPES) - { - return ("InvalidSpaceID"); - } - - return (AcpiGbl_RegionTypes[SpaceId]); -} - - -/* Data used in keeping track of fields */ - -NATIVE_CHAR *AcpiGbl_FENames[NUM_FIELD_NAMES] = -{ - "skip", - "?access?" -}; /* FE = Field Element */ - - -NATIVE_CHAR *AcpiGbl_MatchOps[NUM_MATCH_OPS] = -{ - "Error", - "MTR", - "MEQ", - "MLE", - "MLT", - "MGE", - "MGT" -}; - - -/* Access type decoding */ - -NATIVE_CHAR *AcpiGbl_AccessTypes[NUM_ACCESS_TYPES] = -{ - "AnyAcc", - "ByteAcc", - "WordAcc", - "DWordAcc", - "BlockAcc", - "SMBSendRecvAcc", - "SMBQuickAcc" -}; - - -/* Update rule decoding */ - -NATIVE_CHAR *AcpiGbl_UpdateRules[NUM_UPDATE_RULES] = -{ - "Preserve", - "WriteAsOnes", - "WriteAsZeros" -}; - -#endif - - -/***************************************************************************** - * - * FUNCTION: AcpiCmValidObjectType - * - * PARAMETERS: None. - * - * RETURN: TRUE if valid object type - * - * DESCRIPTION: Validate an object type - * - ****************************************************************************/ - -BOOLEAN -AcpiCmValidObjectType ( - UINT32 Type) -{ - - if (Type > ACPI_TYPE_MAX) - { - if ((Type < INTERNAL_TYPE_BEGIN) || - (Type > INTERNAL_TYPE_MAX)) - { - return (FALSE); - } - } - - return (TRUE); -} - - -/***************************************************************************** - * - * FUNCTION: AcpiCmFormatException - * - * PARAMETERS: Status - Acpi status to be formatted - * - * RETURN: Formatted status string - * - * DESCRIPTION: Convert an ACPI exception to a string - * - ****************************************************************************/ - -NATIVE_CHAR * -AcpiCmFormatException ( - ACPI_STATUS Status) -{ - NATIVE_CHAR *Exception = "UNKNOWN_STATUS"; - ACPI_STATUS SubStatus; - - - SubStatus = (Status & ~AE_CODE_MASK); - - - switch (Status & AE_CODE_MASK) - { - case AE_CODE_ENVIRONMENTAL: - - if (SubStatus <= AE_CODE_ENV_MAX) - { - Exception = AcpiGbl_ExceptionNames_Env [SubStatus]; - } - break; - - case AE_CODE_PROGRAMMER: - - if (SubStatus <= AE_CODE_PGM_MAX) - { - Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1]; - } - break; - - case AE_CODE_ACPI_TABLES: - - if (SubStatus <= AE_CODE_TBL_MAX) - { - Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1]; - } - break; - - case AE_CODE_AML: - - if (SubStatus <= AE_CODE_AML_MAX) - { - Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1]; - } - break; - - case AE_CODE_CONTROL: - - if (SubStatus <= AE_CODE_CTRL_MAX) - { - Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1]; - } - break; - - default: - break; - } - - - return (Exception); -} - - -/**************************************************************************** - * - * FUNCTION: AcpiCmAllocateOwnerId - * - * PARAMETERS: IdType - Type of ID (method or table) - * - * DESCRIPTION: Allocate a table or method owner id - * - ***************************************************************************/ - -ACPI_OWNER_ID -AcpiCmAllocateOwnerId ( - UINT32 IdType) -{ - ACPI_OWNER_ID OwnerId = 0xFFFF; - - - FUNCTION_TRACE ("CmAllocateOwnerId"); - - - AcpiCmAcquireMutex (ACPI_MTX_CACHES); - - switch (IdType) - { - case OWNER_TYPE_TABLE: - - OwnerId = AcpiGbl_NextTableOwnerId; - AcpiGbl_NextTableOwnerId++; - - if (AcpiGbl_NextTableOwnerId == FIRST_METHOD_ID) - { - AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; - } - break; - - - case OWNER_TYPE_METHOD: - - OwnerId = AcpiGbl_NextMethodOwnerId; - AcpiGbl_NextMethodOwnerId++; - - if (AcpiGbl_NextMethodOwnerId == FIRST_TABLE_ID) - { - AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; - } - break; - } - - - AcpiCmReleaseMutex (ACPI_MTX_CACHES); - - return_VALUE (OwnerId); -} - - -/**************************************************************************** - * - * FUNCTION: AcpiCmInitGlobals - * - * PARAMETERS: none - * - * DESCRIPTION: Init library globals. All globals that require specific - * initialization should be initialized here! - * - ***************************************************************************/ - -void -AcpiCmInitGlobals ( - void) -{ - UINT32 i; - - - FUNCTION_TRACE ("CmInitGlobals"); - - - /* ACPI table structure */ - - for (i = 0; i < NUM_ACPI_TABLES; i++) - { - AcpiGbl_AcpiTables[i].Prev = &AcpiGbl_AcpiTables[i]; - AcpiGbl_AcpiTables[i].Next = &AcpiGbl_AcpiTables[i]; - AcpiGbl_AcpiTables[i].Pointer = NULL; - AcpiGbl_AcpiTables[i].Length = 0; - AcpiGbl_AcpiTables[i].Allocation = ACPI_MEM_NOT_ALLOCATED; - AcpiGbl_AcpiTables[i].Count = 0; - } - - - /* Address Space handler array */ - - for (i = 0; i < ACPI_NUM_ADDRESS_SPACES; i++) - { - AcpiGbl_AddressSpaces[i].Handler = NULL; - AcpiGbl_AddressSpaces[i].Context = NULL; - } - - /* Mutex locked flags */ - - for (i = 0; i < NUM_MTX; i++) - { - AcpiGbl_AcpiMutexInfo[i].Mutex = NULL; - AcpiGbl_AcpiMutexInfo[i].Locked = FALSE; - AcpiGbl_AcpiMutexInfo[i].UseCount = 0; - } - - /* Global notify handlers */ - - AcpiGbl_SysNotify.Handler = NULL; - AcpiGbl_DrvNotify.Handler = NULL; - - /* Global "typed" ACPI table pointers */ - - AcpiGbl_RSDP = NULL; - AcpiGbl_XSDT = NULL; - AcpiGbl_FACS = NULL; - AcpiGbl_FADT = NULL; - AcpiGbl_DSDT = NULL; - - - /* Global Lock support */ - - AcpiGbl_GlobalLockAcquired = FALSE; - AcpiGbl_GlobalLockThreadCount = 0; - - /* Miscellaneous variables */ - - AcpiGbl_SystemFlags = 0; - AcpiGbl_StartupFlags = 0; - AcpiGbl_GlobalLockSet = FALSE; - AcpiGbl_RsdpOriginalLocation = 0; - AcpiGbl_CmSingleStep = FALSE; - AcpiGbl_DbTerminateThreads = FALSE; - AcpiGbl_Shutdown = FALSE; - AcpiGbl_NsLookupCount = 0; - AcpiGbl_PsFindCount = 0; - AcpiGbl_AcpiHardwarePresent = TRUE; - AcpiGbl_NextTableOwnerId = FIRST_TABLE_ID; - AcpiGbl_NextMethodOwnerId = FIRST_METHOD_ID; - AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING; - - /* Cache of small "state" objects */ - - AcpiGbl_GenericStateCache = NULL; - AcpiGbl_GenericStateCacheDepth = 0; - AcpiGbl_StateCacheRequests = 0; - AcpiGbl_StateCacheHits = 0; - - AcpiGbl_ParseCache = NULL; - AcpiGbl_ParseCacheDepth = 0; - AcpiGbl_ParseCacheRequests = 0; - AcpiGbl_ParseCacheHits = 0; - - AcpiGbl_ExtParseCache = NULL; - AcpiGbl_ExtParseCacheDepth = 0; - AcpiGbl_ExtParseCacheRequests = 0; - AcpiGbl_ExtParseCacheHits = 0; - - AcpiGbl_ObjectCache = NULL; - AcpiGbl_ObjectCacheDepth = 0; - AcpiGbl_ObjectCacheRequests = 0; - AcpiGbl_ObjectCacheHits = 0; - - AcpiGbl_WalkStateCache = NULL; - AcpiGbl_WalkStateCacheDepth = 0; - AcpiGbl_WalkStateCacheRequests = 0; - AcpiGbl_WalkStateCacheHits = 0; - - /* Hardware oriented */ - - AcpiGbl_Gpe0EnableRegisterSave = NULL; - AcpiGbl_Gpe1EnableRegisterSave = NULL; - AcpiGbl_OriginalMode = SYS_MODE_UNKNOWN; /* original ACPI/legacy mode */ - AcpiGbl_GpeRegisters = NULL; - AcpiGbl_GpeInfo = NULL; - - /* Namespace */ - - AcpiGbl_RootNode = NULL; - - AcpiGbl_RootNodeStruct.Name = ACPI_ROOT_NAME; - AcpiGbl_RootNodeStruct.DataType = ACPI_DESC_TYPE_NAMED; - AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_ANY; - AcpiGbl_RootNodeStruct.Child = NULL; - AcpiGbl_RootNodeStruct.Peer = NULL; - AcpiGbl_RootNodeStruct.Object = NULL; - AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST; - - /* Memory allocation metrics - compiled out in non-debug mode. */ - - INITIALIZE_ALLOCATION_METRICS(); - - return_VOID; -} - - diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cminit.c b/sys/contrib/dev/acpica/Subsystem/Common/cminit.c deleted file mode 100644 index f2972a00f5c65..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cminit.c +++ /dev/null @@ -1,359 +0,0 @@ -/****************************************************************************** - * - * Module Name: cminit - Common ACPI subsystem initialization - * $Revision: 93 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#define __CMINIT_C__ - -#include "acpi.h" -#include "achware.h" -#include "acnamesp.h" -#include "acevents.h" -#include "acparser.h" -#include "acdispat.h" - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cminit") - - -#define ACPI_OFFSET(d,o) ((UINT32) &(((d *)0)->o)) -#define ACPI_FADT_OFFSET(o) ACPI_OFFSET (FADT_DESCRIPTOR, o) - -/******************************************************************************* - * - * FUNCTION: AcpiCmFadtRegisterError - * - * PARAMETERS: *RegisterName - Pointer to string identifying register - * Value - Actual register contents value - * AcpiTestSpecSection - TDS section containing assertion - * AcpiAssertion - Assertion number being tested - * - * RETURN: AE_BAD_VALUE - * - * DESCRIPTION: Display failure message and link failure to TDS assertion - * - ******************************************************************************/ - -static ACPI_STATUS -AcpiCmFadtRegisterError ( - NATIVE_CHAR *RegisterName, - UINT32 Value, - UINT32 Offset) -{ - - REPORT_ERROR ( - ("Invalid FADT value %s=%lX at offset %lX FADT=%p\n", - RegisterName, Value, Offset, AcpiGbl_FADT)); - - - return (AE_BAD_VALUE); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiCmValidateFadt - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Validate various ACPI registers in the FADT - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmValidateFadt ( - void) -{ - ACPI_STATUS Status = AE_OK; - - - /* - * Verify Fixed ACPI Description Table fields, - * but don't abort on any problems, just display error - */ - - if (AcpiGbl_FADT->Pm1EvtLen < 4) - { - Status = AcpiCmFadtRegisterError ("PM1_EVT_LEN", - (UINT32) AcpiGbl_FADT->Pm1EvtLen, - ACPI_FADT_OFFSET (Pm1EvtLen)); - } - - if (!AcpiGbl_FADT->Pm1CntLen) - { - Status = AcpiCmFadtRegisterError ("PM1_CNT_LEN", 0, - ACPI_FADT_OFFSET (Pm1CntLen)); - } - - if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address)) - { - Status = AcpiCmFadtRegisterError ("X_PM1a_EVT_BLK", 0, - ACPI_FADT_OFFSET (XPm1aEvtBlk.Address)); - } - - if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aCntBlk.Address)) - { - Status = AcpiCmFadtRegisterError ("X_PM1a_CNT_BLK", 0, - ACPI_FADT_OFFSET (XPm1aCntBlk.Address)); - } - - if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address)) - { - Status = AcpiCmFadtRegisterError ("X_PM_TMR_BLK", 0, - ACPI_FADT_OFFSET (XPmTmrBlk.Address)); - } - - if ((ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address) && - !AcpiGbl_FADT->Pm2CntLen)) - { - Status = AcpiCmFadtRegisterError ("PM2_CNT_LEN", - (UINT32) AcpiGbl_FADT->Pm2CntLen, - ACPI_FADT_OFFSET (Pm2CntLen)); - } - - if (AcpiGbl_FADT->PmTmLen < 4) - { - Status = AcpiCmFadtRegisterError ("PM_TM_LEN", - (UINT32) AcpiGbl_FADT->PmTmLen, - ACPI_FADT_OFFSET (PmTmLen)); - } - - /* length of GPE blocks must be a multiple of 2 */ - - - if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) && - (AcpiGbl_FADT->Gpe0BlkLen & 1)) - { - Status = AcpiCmFadtRegisterError ("(x)GPE0_BLK_LEN", - (UINT32) AcpiGbl_FADT->Gpe0BlkLen, - ACPI_FADT_OFFSET (Gpe0BlkLen)); - } - - if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) && - (AcpiGbl_FADT->Gpe1BlkLen & 1)) - { - Status = AcpiCmFadtRegisterError ("(x)GPE1_BLK_LEN", - (UINT32) AcpiGbl_FADT->Gpe1BlkLen, - ACPI_FADT_OFFSET (Gpe1BlkLen)); - } - - return (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiCmTerminate - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: free memory allocated for table storage. - * - ******************************************************************************/ - -void -AcpiCmTerminate (void) -{ - - FUNCTION_TRACE ("CmTerminate"); - - - /* Free global tables, etc. */ - - if (AcpiGbl_Gpe0EnableRegisterSave) - { - AcpiCmFree (AcpiGbl_Gpe0EnableRegisterSave); - } - - if (AcpiGbl_Gpe1EnableRegisterSave) - { - AcpiCmFree (AcpiGbl_Gpe1EnableRegisterSave); - } - - - return_VOID; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiCmSubsystemShutdown - * - * PARAMETERS: none - * - * RETURN: none - * - * DESCRIPTION: Shutdown the various subsystems. Don't delete the mutex - * objects here -- because the AML debugger may be still running. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmSubsystemShutdown (void) -{ - - FUNCTION_TRACE ("CmSubsystemShutdown"); - - /* Just exit if subsystem is already shutdown */ - - if (AcpiGbl_Shutdown) - { - DEBUG_PRINT (ACPI_ERROR, ("ACPI Subsystem is already terminated\n")); - return_ACPI_STATUS (AE_OK); - } - - /* Subsystem appears active, go ahead and shut it down */ - - AcpiGbl_Shutdown = TRUE; - DEBUG_PRINT (ACPI_INFO, ("Shutting down ACPI Subsystem...\n")); - - - /* Close the Namespace */ - - AcpiNsTerminate (); - - /* Close the AcpiEvent Handling */ - - AcpiEvTerminate (); - - /* Close the globals */ - - AcpiCmTerminate (); - - /* Flush the local cache(s) */ - - AcpiCmDeleteGenericStateCache (); - AcpiCmDeleteObjectCache (); - AcpiDsDeleteWalkStateCache (); - - /* Close the Parser */ - - /* TBD: [Restructure] AcpiPsTerminate () */ - - AcpiPsDeleteParseCache (); - - /* Debug only - display leftover memory allocation, if any */ -#ifdef ENABLE_DEBUGGER - AcpiCmDumpCurrentAllocations (ACPI_UINT32_MAX, NULL); -#endif - - return_ACPI_STATUS (AE_OK); -} - - diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cmobject.c b/sys/contrib/dev/acpica/Subsystem/Common/cmobject.c deleted file mode 100644 index 13869b3fbe794..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cmobject.c +++ /dev/null @@ -1,783 +0,0 @@ -/****************************************************************************** - * - * Module Name: cmobject - ACPI object create/delete/size/cache routines - * $Revision: 36 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - -#define __CMOBJECT_C__ - -#include "acpi.h" -#include "acinterp.h" -#include "acnamesp.h" -#include "actables.h" -#include "amlcode.h" - - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmobject") - - -/******************************************************************************* - * - * FUNCTION: _CmCreateInternalObject - * - * PARAMETERS: Address - Address of the memory to deallocate - * Component - Component type of caller - * Module - Source file name of caller - * Line - Line number of caller - * Type - ACPI Type of the new object - * - * RETURN: Object - The new object. Null on failure - * - * DESCRIPTION: Create and initialize a new internal object. - * - * NOTE: We always allocate the worst-case object descriptor because - * these objects are cached, and we want them to be - * one-size-satisifies-any-request. This in itself may not be - * the most memory efficient, but the efficiency of the object - * cache should more than make up for this! - * - ******************************************************************************/ - -ACPI_OPERAND_OBJECT * -_CmCreateInternalObject ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId, - OBJECT_TYPE_INTERNAL Type) -{ - ACPI_OPERAND_OBJECT *Object; - - - FUNCTION_TRACE_STR ("CmCreateInternalObject", AcpiCmGetTypeName (Type)); - - - /* Allocate the raw object descriptor */ - - Object = _CmAllocateObjectDesc (ModuleName, LineNumber, ComponentId); - if (!Object) - { - /* Allocation failure */ - - return_VALUE (NULL); - } - - /* Save the object type in the object descriptor */ - - Object->Common.Type = Type; - - /* Init the reference count */ - - Object->Common.ReferenceCount = 1; - - /* Any per-type initialization should go here */ - - - return_PTR (Object); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmValidInternalObject - * - * PARAMETERS: Operand - Object to be validated - * - * RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT - * - ******************************************************************************/ - -BOOLEAN -AcpiCmValidInternalObject ( - void *Object) -{ - - /* Check for a null pointer */ - - if (!Object) - { - DEBUG_PRINT (ACPI_INFO, - ("CmValidInternalObject: **** Null Object Ptr\n")); - return (FALSE); - } - - /* Check for a pointer within one of the ACPI tables */ - - if (AcpiTbSystemTablePointer (Object)) - { - DEBUG_PRINT (ACPI_INFO, - ("CmValidInternalObject: **** Object %p is a Pcode Ptr\n", Object)); - return (FALSE); - } - - /* Check the descriptor type field */ - - if (!VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_INTERNAL)) - { - /* Not an ACPI internal object, do some further checking */ - - if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_NAMED)) - { - DEBUG_PRINT (ACPI_INFO, - ("CmValidInternalObject: **** Obj %p is a named obj, not ACPI obj\n", - Object)); - } - - else if (VALID_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_PARSER)) - { - DEBUG_PRINT (ACPI_INFO, - ("CmValidInternalObject: **** Obj %p is a parser obj, not ACPI obj\n", - Object)); - } - - else - { - DEBUG_PRINT (ACPI_INFO, - ("CmValidInternalObject: **** Obj %p is of unknown type\n", - Object)); - } - - return (FALSE); - } - - - /* The object appears to be a valid ACPI_OPERAND_OBJECT */ - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: _CmAllocateObjectDesc - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * Message - Error message to use on failure - * - * RETURN: Pointer to newly allocated object descriptor. Null on error - * - * DESCRIPTION: Allocate a new object descriptor. Gracefully handle - * error conditions. - * - ******************************************************************************/ - -void * -_CmAllocateObjectDesc ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId) -{ - ACPI_OPERAND_OBJECT *Object; - - - FUNCTION_TRACE ("_AllocateObjectDesc"); - - - AcpiCmAcquireMutex (ACPI_MTX_CACHES); - - AcpiGbl_ObjectCacheRequests++; - - /* Check the cache first */ - - if (AcpiGbl_ObjectCache) - { - /* There is an object available, use it */ - - Object = AcpiGbl_ObjectCache; - AcpiGbl_ObjectCache = Object->Cache.Next; - Object->Cache.Next = NULL; - - AcpiGbl_ObjectCacheHits++; - AcpiGbl_ObjectCacheDepth--; - - AcpiCmReleaseMutex (ACPI_MTX_CACHES); - } - - else - { - /* The cache is empty, create a new object */ - - AcpiCmReleaseMutex (ACPI_MTX_CACHES); - - /* Attempt to allocate new descriptor */ - - Object = _CmCallocate (sizeof (ACPI_OPERAND_OBJECT), ComponentId, - ModuleName, LineNumber); - if (!Object) - { - /* Allocation failed */ - - _REPORT_ERROR (ModuleName, LineNumber, ComponentId, - ("Could not allocate an object descriptor\n")); - - return_PTR (NULL); - } - - /* Memory allocation metrics - compiled out in non debug mode. */ - - INCREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); - } - - /* Mark the descriptor type */ - - Object->Common.DataType = ACPI_DESC_TYPE_INTERNAL; - - DEBUG_PRINT (TRACE_ALLOCATIONS, ("AllocateObjectDesc: %p Size %X\n", - Object, sizeof (ACPI_OPERAND_OBJECT))); - - return_PTR (Object); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmDeleteObjectDesc - * - * PARAMETERS: Object - Acpi internal object to be deleted - * - * RETURN: None. - * - * DESCRIPTION: Free an ACPI object descriptor or add it to the object cache - * - ******************************************************************************/ - -void -AcpiCmDeleteObjectDesc ( - ACPI_OPERAND_OBJECT *Object) -{ - - FUNCTION_TRACE_PTR ("AcpiCmDeleteObjectDesc", Object); - - - /* Make sure that the object isn't already in the cache */ - - if (Object->Common.DataType == (ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT)) - { - DEBUG_PRINT (ACPI_ERROR, - ("CmDeleteObjectDesc: Obj %p is already in the object cache\n", - Object)); - return_VOID; - } - - /* Object must be an ACPI_OPERAND_OBJECT */ - - if (Object->Common.DataType != ACPI_DESC_TYPE_INTERNAL) - { - DEBUG_PRINT (ACPI_ERROR, - ("CmDeleteObjectDesc: Obj %p is not an ACPI object\n", Object)); - return_VOID; - } - - - /* If cache is full, just free this object */ - - if (AcpiGbl_ObjectCacheDepth >= MAX_OBJECT_CACHE_DEPTH) - { - /* - * Memory allocation metrics. Call the macro here since we only - * care about dynamically allocated objects. - */ - DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); - - AcpiCmFree (Object); - return_VOID; - } - - AcpiCmAcquireMutex (ACPI_MTX_CACHES); - - /* Clear the entire object. This is important! */ - - MEMSET (Object, 0, sizeof (ACPI_OPERAND_OBJECT)); - Object->Common.DataType = ACPI_DESC_TYPE_INTERNAL | ACPI_CACHED_OBJECT; - - /* Put the object at the head of the global cache list */ - - Object->Cache.Next = AcpiGbl_ObjectCache; - AcpiGbl_ObjectCache = Object; - AcpiGbl_ObjectCacheDepth++; - - - AcpiCmReleaseMutex (ACPI_MTX_CACHES); - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmDeleteObjectCache - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Purge the global state object cache. Used during subsystem - * termination. - * - ******************************************************************************/ - -void -AcpiCmDeleteObjectCache ( - void) -{ - ACPI_OPERAND_OBJECT *Next; - - - FUNCTION_TRACE ("CmDeleteObjectCache"); - - - /* Traverse the global cache list */ - - while (AcpiGbl_ObjectCache) - { - /* Delete one cached state object */ - - Next = AcpiGbl_ObjectCache->Cache.Next; - AcpiGbl_ObjectCache->Cache.Next = NULL; - - /* - * Memory allocation metrics. Call the macro here since we only - * care about dynamically allocated objects. - */ - DECREMENT_OBJECT_METRICS (sizeof (ACPI_OPERAND_OBJECT)); - - AcpiCmFree (AcpiGbl_ObjectCache); - AcpiGbl_ObjectCache = Next; - AcpiGbl_ObjectCacheDepth--; - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmInitStaticObject - * - * PARAMETERS: ObjDesc - Pointer to a "static" object - on stack - * or in the data segment. - * - * RETURN: None. - * - * DESCRIPTION: Initialize a static object. Sets flags to disallow dynamic - * deletion of the object. - * - ******************************************************************************/ - -void -AcpiCmInitStaticObject ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - - FUNCTION_TRACE_PTR ("CmInitStaticObject", ObjDesc); - - - if (!ObjDesc) - { - return_VOID; - } - - - /* - * Clear the entire descriptor - */ - MEMSET ((void *) ObjDesc, 0, sizeof (ACPI_OPERAND_OBJECT)); - - - /* - * Initialize the header fields - * 1) This is an ACPI_OPERAND_OBJECT descriptor - * 2) The size is the full object (worst case) - * 3) The flags field indicates static allocation - * 4) Reference count starts at one (not really necessary since the - * object can't be deleted, but keeps everything sane) - */ - - ObjDesc->Common.DataType = ACPI_DESC_TYPE_INTERNAL; - ObjDesc->Common.Flags = AOPOBJ_STATIC_ALLOCATION; - ObjDesc->Common.ReferenceCount = 1; - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmGetSimpleObjectSize - * - * PARAMETERS: *InternalObject - Pointer to the object we are examining - * *RetLength - Where the length is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to determine the space required to - * contain a simple object for return to an API user. - * - * The length includes the object structure plus any additional - * needed space. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmGetSimpleObjectSize ( - ACPI_OPERAND_OBJECT *InternalObject, - UINT32 *ObjLength) -{ - UINT32 Length; - ACPI_STATUS Status = AE_OK; - - - FUNCTION_TRACE_PTR ("CmGetSimpleObjectSize", InternalObject); - - - /* Handle a null object (Could be a uninitialized package element -- which is legal) */ - - if (!InternalObject) - { - *ObjLength = 0; - return_ACPI_STATUS (AE_OK); - } - - - /* Start with the length of the Acpi object */ - - Length = sizeof (ACPI_OBJECT); - - if (VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_NAMED)) - { - /* Object is a named object (reference), just return the length */ - - *ObjLength = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length); - return_ACPI_STATUS (Status); - } - - - /* - * The final length depends on the object type - * Strings and Buffers are packed right up against the parent object and - * must be accessed bytewise or there may be alignment problems. - * - * TBD:[Investigate] do strings and buffers require alignment also? - */ - - switch (InternalObject->Common.Type) - { - - case ACPI_TYPE_STRING: - - Length += InternalObject->String.Length + 1; - break; - - - case ACPI_TYPE_BUFFER: - - Length += InternalObject->Buffer.Length; - break; - - - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_POWER: - - /* - * No extra data for these types - */ - break; - - - case INTERNAL_TYPE_REFERENCE: - - /* - * The only type that should be here is opcode AML_NAMEPATH_OP -- since - * this means an object reference - */ - if (InternalObject->Reference.OpCode != AML_NAMEPATH_OP) - { - DEBUG_PRINT (ACPI_ERROR, - ("CmGetSimpleObjectSize: Unsupported Reference opcode=%X in object %p\n", - InternalObject->Reference.OpCode, InternalObject)); - Status = AE_TYPE; - } - break; - - - default: - - DEBUG_PRINT (ACPI_ERROR, - ("CmGetSimpleObjectSize: Unsupported type=%X in object %p\n", - InternalObject->Common.Type, InternalObject)); - Status = AE_TYPE; - break; - } - - - /* - * Account for the space required by the object rounded up to the next - * multiple of the machine word size. This keeps each object aligned - * on a machine word boundary. (preventing alignment faults on some - * machines.) - */ - *ObjLength = (UINT32) ROUND_UP_TO_NATIVE_WORD (Length); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCopyPackageToInternal - * - * PARAMETERS: ACPI_PKG_CALLBACK - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmGetElementLength ( - UINT8 ObjectType, - ACPI_OPERAND_OBJECT *SourceObject, - ACPI_GENERIC_STATE *State, - void *Context) -{ - ACPI_STATUS Status = AE_OK; - ACPI_PKG_INFO *Info = (ACPI_PKG_INFO *) Context; - UINT32 ObjectSpace; - - - switch (ObjectType) - { - case 0: - - /* - * Simple object - just get the size (Null object/entry is handled - * here also) and sum it into the running package length - */ - Status = AcpiCmGetSimpleObjectSize (SourceObject, &ObjectSpace); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - Info->Length += ObjectSpace; - break; - - - case 1: - /* Package - nothing much to do here, let the walk handle it */ - - Info->NumPackages++; - State->Pkg.ThisTargetObj = NULL; - break; - - default: - return (AE_BAD_PARAMETER); - } - - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmGetPackageObjectSize - * - * PARAMETERS: *InternalObject - Pointer to the object we are examining - * *RetLength - Where the length is returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to determine the space required to - * contain a package object for return to an API user. - * - * This is moderately complex since a package contains other - * objects including packages. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmGetPackageObjectSize ( - ACPI_OPERAND_OBJECT *InternalObject, - UINT32 *ObjLength) -{ - ACPI_STATUS Status; - ACPI_PKG_INFO Info; - - - FUNCTION_TRACE_PTR ("CmGetPackageObjectSize", InternalObject); - - - Info.Length = 0; - Info.ObjectSpace = 0; - Info.NumPackages = 1; - - Status = AcpiCmWalkPackageTree (InternalObject, NULL, - AcpiCmGetElementLength, &Info); - - /* - * We have handled all of the objects in all levels of the package. - * just add the length of the package objects themselves. - * Round up to the next machine word. - */ - Info.Length += ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT)) * - Info.NumPackages; - - /* Return the total package length */ - - *ObjLength = Info.Length; - return_ACPI_STATUS (Status); -} - - - -/******************************************************************************* - * - * FUNCTION: AcpiCmGetObjectSize - * - * PARAMETERS: *InternalObject - Pointer to the object we are examining - * *RetLength - Where the length will be returned - * - * RETURN: Status - * - * DESCRIPTION: This function is called to determine the space required to - * contain an object for return to an API user. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmGetObjectSize( - ACPI_OPERAND_OBJECT *InternalObject, - UINT32 *ObjLength) -{ - ACPI_STATUS Status; - - - if ((VALID_DESCRIPTOR_TYPE (InternalObject, ACPI_DESC_TYPE_INTERNAL)) && - (IS_THIS_OBJECT_TYPE (InternalObject, ACPI_TYPE_PACKAGE))) - { - Status = AcpiCmGetPackageObjectSize (InternalObject, ObjLength); - } - - else - { - Status = AcpiCmGetSimpleObjectSize (InternalObject, ObjLength); - } - - return (Status); -} - - diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cmutils.c b/sys/contrib/dev/acpica/Subsystem/Common/cmutils.c deleted file mode 100644 index 123e4e1901b3e..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cmutils.c +++ /dev/null @@ -1,1181 +0,0 @@ -/******************************************************************************* - * - * Module Name: cmutils - common utility procedures - * $Revision: 27 $ - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#define __CMUTILS_C__ - -#include "acpi.h" -#include "acevents.h" -#include "achware.h" -#include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acdebug.h" - - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmutils") - - -/******************************************************************************* - * - * FUNCTION: AcpiCmValidAcpiName - * - * PARAMETERS: Character - The character to be examined - * - * RETURN: 1 if Character may appear in a name, else 0 - * - * DESCRIPTION: Check for a valid ACPI name. Each character must be one of: - * 1) Upper case alpha - * 2) numeric - * 3) underscore - * - ******************************************************************************/ - -BOOLEAN -AcpiCmValidAcpiName ( - UINT32 Name) -{ - NATIVE_CHAR *NamePtr = (NATIVE_CHAR *) &Name; - UINT32 i; - - - for (i = 0; i < ACPI_NAME_SIZE; i++) - { - if (!((NamePtr[i] == '_') || - (NamePtr[i] >= 'A' && NamePtr[i] <= 'Z') || - (NamePtr[i] >= '0' && NamePtr[i] <= '9'))) - { - return (FALSE); - } - } - - - return (TRUE); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmValidAcpiCharacter - * - * PARAMETERS: Character - The character to be examined - * - * RETURN: 1 if Character may appear in a name, else 0 - * - * DESCRIPTION: Check for a printable character - * - ******************************************************************************/ - -BOOLEAN -AcpiCmValidAcpiCharacter ( - NATIVE_CHAR Character) -{ - - return ((BOOLEAN) ((Character == '_') || - (Character >= 'A' && Character <= 'Z') || - (Character >= '0' && Character <= '9'))); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmMutexInitialize - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: Create the system mutex objects. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmMutexInitialize ( - void) -{ - UINT32 i; - ACPI_STATUS Status; - - - FUNCTION_TRACE ("CmMutexInitialize"); - - - /* - * Create each of the predefined mutex objects - */ - for (i = 0; i < NUM_MTX; i++) - { - Status = AcpiCmCreateMutex (i); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - return_ACPI_STATUS (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmMutexTerminate - * - * PARAMETERS: None. - * - * RETURN: None. - * - * DESCRIPTION: Delete all of the system mutex objects. - * - ******************************************************************************/ - -void -AcpiCmMutexTerminate ( - void) -{ - UINT32 i; - - - FUNCTION_TRACE ("CmMutexTerminate"); - - - /* - * Delete each predefined mutex object - */ - for (i = 0; i < NUM_MTX; i++) - { - AcpiCmDeleteMutex (i); - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCreateMutex - * - * PARAMETERS: MutexID - ID of the mutex to be created - * - * RETURN: Status - * - * DESCRIPTION: Create a mutex object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmCreateMutex ( - ACPI_MUTEX_HANDLE MutexId) -{ - ACPI_STATUS Status = AE_OK; - - - FUNCTION_TRACE_U32 ("CmCreateMutex", MutexId); - - - if (MutexId > MAX_MTX) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - - if (!AcpiGbl_AcpiMutexInfo[MutexId].Mutex) - { - Status = AcpiOsCreateSemaphore (1, 1, - &AcpiGbl_AcpiMutexInfo[MutexId].Mutex); - AcpiGbl_AcpiMutexInfo[MutexId].Locked = FALSE; - AcpiGbl_AcpiMutexInfo[MutexId].UseCount = 0; - } - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmDeleteMutex - * - * PARAMETERS: MutexID - ID of the mutex to be deleted - * - * RETURN: Status - * - * DESCRIPTION: Delete a mutex object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmDeleteMutex ( - ACPI_MUTEX_HANDLE MutexId) -{ - ACPI_STATUS Status; - - - FUNCTION_TRACE_U32 ("CmDeleteMutex", MutexId); - - - if (MutexId > MAX_MTX) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - - Status = AcpiOsDeleteSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex); - - AcpiGbl_AcpiMutexInfo[MutexId].Mutex = NULL; - AcpiGbl_AcpiMutexInfo[MutexId].Locked = FALSE; - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmAcquireMutex - * - * PARAMETERS: MutexID - ID of the mutex to be acquired - * - * RETURN: Status - * - * DESCRIPTION: Acquire a mutex object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmAcquireMutex ( - ACPI_MUTEX_HANDLE MutexId) -{ - ACPI_STATUS Status; - - - DEBUG_PRINT (TRACE_MUTEX, - ("Acquiring Mutex [%s]\n", AcpiCmGetMutexName (MutexId))); - - if (MutexId > MAX_MTX) - { - return (AE_BAD_PARAMETER); - } - - - Status = AcpiOsWaitSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex, - 1, WAIT_FOREVER); - - DEBUG_PRINT (TRACE_MUTEX, ("Acquired Mutex [%s] Status %s\n", - AcpiCmGetMutexName (MutexId), AcpiCmFormatException (Status))); - - if (ACPI_SUCCESS (Status)) - { - AcpiGbl_AcpiMutexInfo[MutexId].Locked = TRUE; - AcpiGbl_AcpiMutexInfo[MutexId].UseCount++; - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmReleaseMutex - * - * PARAMETERS: MutexID - ID of the mutex to be released - * - * RETURN: Status - * - * DESCRIPTION: Release a mutex object. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmReleaseMutex ( - ACPI_MUTEX_HANDLE MutexId) -{ - ACPI_STATUS Status; - - - DEBUG_PRINT (TRACE_MUTEX, - ("Releasing Mutex [%s]\n", AcpiCmGetMutexName (MutexId))); - - if (MutexId > MAX_MTX) - { - return (AE_BAD_PARAMETER); - } - - - AcpiGbl_AcpiMutexInfo[MutexId].Locked = FALSE; /* Mark before unlocking */ - - Status = AcpiOsSignalSemaphore (AcpiGbl_AcpiMutexInfo[MutexId].Mutex, 1); - - if (ACPI_FAILURE (Status)) - { - DEBUG_PRINT (ACPI_ERROR, ("Error Releasing Mutex [%s], %s\n", - AcpiCmGetMutexName (MutexId), AcpiCmFormatException (Status))); - } - else - { - DEBUG_PRINT (TRACE_MUTEX, ("Released Mutex [%s], %s\n", - AcpiCmGetMutexName (MutexId), AcpiCmFormatException (Status))); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCreateUpdateStateAndPush - * - * PARAMETERS: *Object - Object to be added to the new state - * Action - Increment/Decrement - * StateList - List the state will be added to - * - * RETURN: None - * - * DESCRIPTION: Create a new state and push it - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmCreateUpdateStateAndPush ( - ACPI_OPERAND_OBJECT *Object, - UINT16 Action, - ACPI_GENERIC_STATE **StateList) -{ - ACPI_GENERIC_STATE *State; - - - /* Ignore null objects; these are expected */ - - if (!Object) - { - return (AE_OK); - } - - State = AcpiCmCreateUpdateState (Object, Action); - if (!State) - { - return (AE_NO_MEMORY); - } - - - AcpiCmPushGenericState (StateList, State); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCreatePkgStateAndPush - * - * PARAMETERS: *Object - Object to be added to the new state - * Action - Increment/Decrement - * StateList - List the state will be added to - * - * RETURN: None - * - * DESCRIPTION: Create a new state and push it - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmCreatePkgStateAndPush ( - void *InternalObject, - void *ExternalObject, - UINT16 Index, - ACPI_GENERIC_STATE **StateList) -{ - ACPI_GENERIC_STATE *State; - - - - State = AcpiCmCreatePkgState (InternalObject, ExternalObject, Index); - if (!State) - { - return (AE_NO_MEMORY); - } - - - AcpiCmPushGenericState (StateList, State); - return (AE_OK); -} - - - -/******************************************************************************* - * - * FUNCTION: AcpiCmPushGenericState - * - * PARAMETERS: ListHead - Head of the state stack - * State - State object to push - * - * RETURN: Status - * - * DESCRIPTION: Push a state object onto a state stack - * - ******************************************************************************/ - -void -AcpiCmPushGenericState ( - ACPI_GENERIC_STATE **ListHead, - ACPI_GENERIC_STATE *State) -{ - FUNCTION_TRACE ("CmPushGenericState"); - - /* Push the state object onto the front of the list (stack) */ - - State->Common.Next = *ListHead; - *ListHead = State; - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmPopGenericState - * - * PARAMETERS: ListHead - Head of the state stack - * - * RETURN: Status - * - * DESCRIPTION: Pop a state object from a state stack - * - ******************************************************************************/ - -ACPI_GENERIC_STATE * -AcpiCmPopGenericState ( - ACPI_GENERIC_STATE **ListHead) -{ - ACPI_GENERIC_STATE *State; - - - FUNCTION_TRACE ("DsPopGenericState"); - - - /* Remove the state object at the head of the list (stack) */ - - State = *ListHead; - if (State) - { - /* Update the list head */ - - *ListHead = State->Common.Next; - } - - return_PTR (State); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCreateGenericState - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Create a generic state object. Attempt to obtain one from - * the global state cache; If none available, create a new one. - * - ******************************************************************************/ - -ACPI_GENERIC_STATE * -AcpiCmCreateGenericState (void) -{ - ACPI_GENERIC_STATE *State; - - - AcpiCmAcquireMutex (ACPI_MTX_CACHES); - - AcpiGbl_StateCacheRequests++; - - /* Check the cache first */ - - if (AcpiGbl_GenericStateCache) - { - /* There is an object available, use it */ - - State = AcpiGbl_GenericStateCache; - AcpiGbl_GenericStateCache = State->Common.Next; - State->Common.Next = NULL; - - AcpiGbl_StateCacheHits++; - AcpiGbl_GenericStateCacheDepth--; - - AcpiCmReleaseMutex (ACPI_MTX_CACHES); - - DEBUG_PRINT (TRACE_EXEC, ("CreateGenState: State %p from cache\n", State)); - } - - else - { - /* The cache is empty, create a new object */ - - AcpiCmReleaseMutex (ACPI_MTX_CACHES); - - State = AcpiCmCallocate (sizeof (ACPI_GENERIC_STATE)); - } - - /* Initialize */ - - if (State) - { - /* Always zero out the object before init */ - - MEMSET (State, 0, sizeof (ACPI_GENERIC_STATE)); - - State->Common.DataType = ACPI_DESC_TYPE_STATE; - } - - return (State); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCreateUpdateState - * - * PARAMETERS: Object - Initial Object to be installed in the - * state - * Action - Update action to be performed - * - * RETURN: Status - * - * DESCRIPTION: Create an "Update State" - a flavor of the generic state used - * to update reference counts and delete complex objects such - * as packages. - * - ******************************************************************************/ - -ACPI_GENERIC_STATE * -AcpiCmCreateUpdateState ( - ACPI_OPERAND_OBJECT *Object, - UINT16 Action) -{ - ACPI_GENERIC_STATE *State; - - - FUNCTION_TRACE_PTR ("CmCreateUpdateState", Object); - - - /* Create the generic state object */ - - State = AcpiCmCreateGenericState (); - if (!State) - { - return (NULL); - } - - /* Init fields specific to the update struct */ - - State->Update.Object = Object; - State->Update.Value = Action; - - return_PTR (State); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCreatePkgState - * - * PARAMETERS: Object - Initial Object to be installed in the - * state - * Action - Update action to be performed - * - * RETURN: Status - * - * DESCRIPTION: Create an "Update State" - a flavor of the generic state used - * to update reference counts and delete complex objects such - * as packages. - * - ******************************************************************************/ - -ACPI_GENERIC_STATE * -AcpiCmCreatePkgState ( - void *InternalObject, - void *ExternalObject, - UINT16 Index) -{ - ACPI_GENERIC_STATE *State; - - - FUNCTION_TRACE_PTR ("CmCreatePkgState", InternalObject); - - - /* Create the generic state object */ - - State = AcpiCmCreateGenericState (); - if (!State) - { - return (NULL); - } - - /* Init fields specific to the update struct */ - - State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject; - State->Pkg.DestObject = ExternalObject; - State->Pkg.Index = Index; - State->Pkg.NumPackages = 1; - - return_PTR (State); -} - - - -/******************************************************************************* - * - * FUNCTION: AcpiCmCreateControlState - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Create a "Control State" - a flavor of the generic state used - * to support nested IF/WHILE constructs in the AML. - * - ******************************************************************************/ - -ACPI_GENERIC_STATE * -AcpiCmCreateControlState ( - void) -{ - ACPI_GENERIC_STATE *State; - - - FUNCTION_TRACE ("CmCreateControlState"); - - /* Create the generic state object */ - - State = AcpiCmCreateGenericState (); - if (!State) - { - return (NULL); - } - - - /* Init fields specific to the control struct */ - - State->Common.State = CONTROL_CONDITIONAL_EXECUTING; - - return_PTR (State); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmDeleteGenericState - * - * PARAMETERS: State - The state object to be deleted - * - * RETURN: Status - * - * DESCRIPTION: Put a state object back into the global state cache. The object - * is not actually freed at this time. - * - ******************************************************************************/ - -void -AcpiCmDeleteGenericState ( - ACPI_GENERIC_STATE *State) -{ - FUNCTION_TRACE ("CmDeleteGenericState"); - - - /* If cache is full, just free this state object */ - - if (AcpiGbl_GenericStateCacheDepth >= MAX_STATE_CACHE_DEPTH) - { - AcpiCmFree (State); - } - - /* Otherwise put this object back into the cache */ - - else - { - AcpiCmAcquireMutex (ACPI_MTX_CACHES); - - /* Clear the state */ - - MEMSET (State, 0, sizeof (ACPI_GENERIC_STATE)); - State->Common.DataType = ACPI_DESC_TYPE_STATE; - - /* Put the object at the head of the global cache list */ - - State->Common.Next = AcpiGbl_GenericStateCache; - AcpiGbl_GenericStateCache = State; - AcpiGbl_GenericStateCacheDepth++; - - - AcpiCmReleaseMutex (ACPI_MTX_CACHES); - } - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmDeleteGenericStateCache - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Purge the global state object cache. Used during subsystem - * termination. - * - ******************************************************************************/ - -void -AcpiCmDeleteGenericStateCache ( - void) -{ - ACPI_GENERIC_STATE *Next; - - - FUNCTION_TRACE ("CmDeleteGenericStateCache"); - - - /* Traverse the global cache list */ - - while (AcpiGbl_GenericStateCache) - { - /* Delete one cached state object */ - - Next = AcpiGbl_GenericStateCache->Common.Next; - AcpiCmFree (AcpiGbl_GenericStateCache); - AcpiGbl_GenericStateCache = Next; - AcpiGbl_GenericStateCacheDepth--; - } - - return_VOID; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiCmResolvePackageReferences - * - * PARAMETERS: ObjDesc - The Package object on which to resolve refs - * - * RETURN: Status - * - * DESCRIPTION: Walk through a package and turn internal references into values - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmResolvePackageReferences ( - ACPI_OPERAND_OBJECT *ObjDesc) -{ - UINT32 Count; - ACPI_OPERAND_OBJECT *SubObject; - - - FUNCTION_TRACE ("AcpiCmResolvePackageReferences"); - - - if (ObjDesc->Common.Type != ACPI_TYPE_PACKAGE) - { - /* The object must be a package */ - - REPORT_ERROR (("Must resolve Package Refs on a Package\n")); - return_ACPI_STATUS(AE_ERROR); - } - - /* - * TBD: what about nested packages? */ - - for (Count = 0; Count < ObjDesc->Package.Count; Count++) - { - SubObject = ObjDesc->Package.Elements[Count]; - - if (SubObject->Common.Type == INTERNAL_TYPE_REFERENCE) - { - if (SubObject->Reference.OpCode == AML_ZERO_OP) - { - SubObject->Common.Type = ACPI_TYPE_INTEGER; - SubObject->Integer.Value = 0; - } - else if (SubObject->Reference.OpCode == AML_ONE_OP) - { - SubObject->Common.Type = ACPI_TYPE_INTEGER; - SubObject->Integer.Value = 1; - } - else if (SubObject->Reference.OpCode == AML_ONES_OP) - { - SubObject->Common.Type = ACPI_TYPE_INTEGER; - SubObject->Integer.Value = ACPI_INTEGER_MAX; - } - } - } - - return_ACPI_STATUS(AE_OK); -} - -#ifdef ACPI_DEBUG - -/****************************************************************************** - * - * FUNCTION: AcpiCmDisplayInitPathname - * - * PARAMETERS: ObjHandle - Handle whose pathname will be displayed - * Path - Additional path string to be appended - * - * RETURN: ACPI_STATUS - * - * DESCRIPTION: Display full pathnbame of an object, DEBUG ONLY - * - *****************************************************************************/ - -void -AcpiCmDisplayInitPathname ( - ACPI_HANDLE ObjHandle, - char *Path) -{ - ACPI_STATUS Status; - UINT32 Length = 128; - char Buffer[128]; - - - Status = AcpiNsHandleToPathname (ObjHandle, &Length, Buffer); - if (ACPI_SUCCESS (Status)) - { - if (Path) - { - DEBUG_PRINT (TRACE_INIT, ("%s.%s\n", Buffer, Path)) - } - else - { - DEBUG_PRINT (TRACE_INIT, ("%s\n", Buffer)) - } - } -} -#endif - -/******************************************************************************* - * - * FUNCTION: AcpiCmWalkPackageTree - * - * PARAMETERS: ObjDesc - The Package object on which to resolve refs - * - * RETURN: Status - * - * DESCRIPTION: Walk through a package - * - ******************************************************************************/ - -ACPI_STATUS -AcpiCmWalkPackageTree ( - ACPI_OPERAND_OBJECT *SourceObject, - void *TargetObject, - ACPI_PKG_CALLBACK WalkCallback, - void *Context) -{ - ACPI_STATUS Status = AE_OK; - ACPI_GENERIC_STATE *StateList = NULL; - ACPI_GENERIC_STATE *State; - UINT32 ThisIndex; - ACPI_OPERAND_OBJECT *ThisSourceObj; - - - FUNCTION_TRACE ("AcpiCmWalkPackageTree"); - - - State = AcpiCmCreatePkgState (SourceObject, TargetObject, 0); - if (!State) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - while (State) - { - ThisIndex = State->Pkg.Index; - ThisSourceObj = (ACPI_OPERAND_OBJECT *) - State->Pkg.SourceObject->Package.Elements[ThisIndex]; - - /* - * Check for - * 1) An uninitialized package element. It is completely - * legal to declare a package and leave it uninitialized - * 2) Not an internal object - can be a namespace node instead - * 3) Any type other than a package. Packages are handled in else case below. - */ - if ((!ThisSourceObj) || - (!VALID_DESCRIPTOR_TYPE ( - ThisSourceObj, ACPI_DESC_TYPE_INTERNAL)) || - (!IS_THIS_OBJECT_TYPE ( - ThisSourceObj, ACPI_TYPE_PACKAGE))) - { - - Status = WalkCallback (0, ThisSourceObj, State, Context); - if (ACPI_FAILURE (Status)) - { - /* TBD: must delete package created up to this point */ - - return_ACPI_STATUS (Status); - } - - State->Pkg.Index++; - while (State->Pkg.Index >= State->Pkg.SourceObject->Package.Count) - { - /* - * We've handled all of the objects at this level, This means - * that we have just completed a package. That package may - * have contained one or more packages itself. - * - * Delete this state and pop the previous state (package). - */ - AcpiCmDeleteGenericState (State); - State = AcpiCmPopGenericState (&StateList); - - - /* Finished when there are no more states */ - - if (!State) - { - /* - * We have handled all of the objects in the top level - * package just add the length of the package objects - * and exit - */ - return_ACPI_STATUS (AE_OK); - } - - /* - * Go back up a level and move the index past the just - * completed package object. - */ - State->Pkg.Index++; - } - } - - else - { - /* This is a sub-object of type package */ - - Status = WalkCallback (1, ThisSourceObj, State, Context); - if (ACPI_FAILURE (Status)) - { - /* TBD: must delete package created up to this point */ - - return_ACPI_STATUS (Status); - } - - - /* - * The callback above returned a new target package object. - */ - - /* - * Push the current state and create a new one - */ - AcpiCmPushGenericState (&StateList, State); - State = AcpiCmCreatePkgState (ThisSourceObj, State->Pkg.ThisTargetObj, 0); - if (!State) - { - /* TBD: must delete package created up to this point */ - - return_ACPI_STATUS (AE_NO_MEMORY); - } - } - } - - /* We should never get here */ - - return (AE_AML_INTERNAL); - -} - - - -/******************************************************************************* - * - * FUNCTION: _ReportError - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * Message - Error message to use on failure - * - * RETURN: None - * - * DESCRIPTION: Print error message - * - ******************************************************************************/ - -void -_ReportError ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId) -{ - - - AcpiOsPrintf ("%8s-%04d: *** Error: ", ModuleName, LineNumber); -} - - -/******************************************************************************* - * - * FUNCTION: _ReportWarning - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * Message - Error message to use on failure - * - * RETURN: None - * - * DESCRIPTION: Print warning message - * - ******************************************************************************/ - -void -_ReportWarning ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId) -{ - - AcpiOsPrintf ("%8s-%04d: *** Warning: ", ModuleName, LineNumber); -} - - -/******************************************************************************* - * - * FUNCTION: _ReportInfo - * - * PARAMETERS: ModuleName - Caller's module name (for error output) - * LineNumber - Caller's line number (for error output) - * ComponentId - Caller's component ID (for error output) - * Message - Error message to use on failure - * - * RETURN: None - * - * DESCRIPTION: Print information message - * - ******************************************************************************/ - -void -_ReportInfo ( - NATIVE_CHAR *ModuleName, - UINT32 LineNumber, - UINT32 ComponentId) -{ - - AcpiOsPrintf ("%8s-%04d: *** Info: ", ModuleName, LineNumber); -} - - diff --git a/sys/contrib/dev/acpica/Subsystem/Common/cmxface.c b/sys/contrib/dev/acpica/Subsystem/Common/cmxface.c deleted file mode 100644 index 92312b9a3eac8..0000000000000 --- a/sys/contrib/dev/acpica/Subsystem/Common/cmxface.c +++ /dev/null @@ -1,537 +0,0 @@ -/****************************************************************************** - * - * Module Name: cmxface - External interfaces for "global" ACPI functions - * $Revision: 64 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999, 2000, 2001, Intel Corp. - * All rights reserved. - * - * 2. License - * - * 2.1. This is your license from Intel Corp. under its intellectual property - * rights. You may have additional license terms from the party that provided - * you this software, covering your right to use that party's intellectual - * property rights. - * - * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a - * copy of the source code appearing in this file ("Covered Code") an - * irrevocable, perpetual, worldwide license under Intel's copyrights in the - * base code distributed originally by Intel ("Original Intel Code") to copy, - * make derivatives, distribute, use and display any portion of the Covered - * Code in any form, with the right to sublicense such rights; and - * - * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent - * license (with the right to sublicense), under only those claims of Intel - * patents that are infringed by the Original Intel Code, to make, use, sell, - * offer to sell, and import the Covered Code and derivative works thereof - * solely to the minimum extent necessary to exercise the above copyright - * license, and in no event shall the patent license extend to any additions - * to or modifications of the Original Intel Code. No other license or right - * is granted directly or by implication, estoppel or otherwise; - * - * The above copyright and patent license is granted only if the following - * conditions are met: - * - * 3. Conditions - * - * 3.1. Redistribution of Source with Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification with rights to further distribute source must include - * the above Copyright Notice, the above License, this list of Conditions, - * and the following Disclaimer and Export Compliance provision. In addition, - * Licensee must cause all Covered Code to which Licensee contributes to - * contain a file documenting the changes Licensee made to create that Covered - * Code and the date of any change. Licensee must include in that file the - * documentation of any changes made by any predecessor Licensee. Licensee - * must include a prominent statement that the modification is derived, - * directly or indirectly, from Original Intel Code. - * - * 3.2. Redistribution of Source with no Rights to Further Distribute Source. - * Redistribution of source code of any substantial portion of the Covered - * Code or modification without rights to further distribute source must - * include the following Disclaimer and Export Compliance provision in the - * documentation and/or other materials provided with distribution. In - * addition, Licensee may not authorize further sublicense of source of any - * portion of the Covered Code, and must include terms to the effect that the - * license from Licensee to its licensee is limited to the intellectual - * property embodied in the software Licensee provides to its licensee, and - * not to intellectual property embodied in modifications its licensee may - * make. - * - * 3.3. Redistribution of Executable. Redistribution in executable form of any - * substantial portion of the Covered Code or modification must reproduce the - * above Copyright Notice, and the following Disclaimer and Export Compliance - * provision in the documentation and/or other materials provided with the - * distribution. - * - * 3.4. Intel retains all right, title, and interest in and to the Original - * Intel Code. - * - * 3.5. Neither the name Intel nor any other trademark owned or controlled by - * Intel shall be used in advertising or otherwise to promote the sale, use or - * other dealings in products derived from or relating to the Covered Code - * without prior written authorization from Intel. - * - * 4. Disclaimer and Export Compliance - * - * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED - * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE - * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE, - * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY - * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY - * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A - * PARTICULAR PURPOSE. - * - * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES - * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR - * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT, - * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY - * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL - * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS - * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY - * LIMITED REMEDY. - * - * 4.3. Licensee shall not export, either directly or indirectly, any of this - * software or system incorporating such software without first obtaining any - * required license or other approval from the U. S. Department of Commerce or - * any other agency or department of the United States Government. In the - * event Licensee exports any such software from the United States or - * re-exports any such software from a foreign destination, Licensee shall - * ensure that the distribution and export/re-export of the software is in - * compliance with all laws, regulations, orders, or other restrictions of the - * U.S. Export Administration Regulations. Licensee agrees that neither it nor - * any of its subsidiaries will export/re-export any technical data, process, - * software, or service, directly or indirectly, to any country for which the - * United States government or any agency thereof requires an export license, - * other governmental approval, or letter of assurance, without first obtaining - * such license, approval or letter. - * - *****************************************************************************/ - - -#define __CMXFACE_C__ - -#include "acpi.h" -#include "acevents.h" -#include "achware.h" -#include "acnamesp.h" -#include "acinterp.h" -#include "amlcode.h" -#include "acdebug.h" - - -#define _COMPONENT MISCELLANEOUS - MODULE_NAME ("cmxface") - - -/******************************************************************************* - * - * FUNCTION: AcpiInitializeSubsystem - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Initializes all global variables. This is the first function - * called, so any early initialization belongs here. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiInitializeSubsystem ( - void) -{ - ACPI_STATUS Status; - - FUNCTION_TRACE ("AcpiInitializeSubsystem"); - - - /* Initialize all globals used by the subsystem */ - - AcpiCmInitGlobals (); - - /* Initialize the OS-Dependent layer */ - - Status = AcpiOsInitialize (); - if (ACPI_FAILURE (Status)) - { - REPORT_ERROR (("OSD failed to initialize, %s\n", - AcpiCmFormatException (Status))); - return_ACPI_STATUS (Status); - } - - /* Create the default mutex objects */ - - Status = AcpiCmMutexInitialize (); - if (ACPI_FAILURE (Status)) - { - REPORT_ERROR (("Global mutex creation failure, %s\n", - AcpiCmFormatException (Status))); - return_ACPI_STATUS (Status); - } - - /* - * Initialize the namespace manager and - * the root of the namespace tree - */ - - Status = AcpiNsRootInitialize (); - if (ACPI_FAILURE (Status)) - { - REPORT_ERROR (("Namespace initialization failure, %s\n", - AcpiCmFormatException (Status))); - return_ACPI_STATUS (Status); - } - - - /* If configured, initialize the AML debugger */ - - DEBUGGER_EXEC (AcpiDbInitialize ()); - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiEnableSubsystem - * - * PARAMETERS: Flags - Init/enable Options - * - * RETURN: Status - * - * DESCRIPTION: Completes the subsystem initialization including hardware. - * Puts system into ACPI mode if it isn't already. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiEnableSubsystem ( - UINT32 Flags) -{ - ACPI_STATUS Status = AE_OK; - - - FUNCTION_TRACE ("AcpiEnableSubsystem"); - - - /* Sanity check the FADT for valid values */ - - Status = AcpiCmValidateFadt (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Install the default OpRegion handlers. These are - * installed unless other handlers have already been - * installed via the InstallAddressSpaceHandler interface - */ - - if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT)) - { - DEBUG_PRINT (TRACE_EXEC, ("[Init] Installing default address space handlers\n")); - - Status = AcpiEvInstallDefaultAddressSpaceHandlers (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * We must initialize the hardware before we can enable ACPI. - */ - - if (!(Flags & ACPI_NO_HARDWARE_INIT)) - { - DEBUG_PRINT (TRACE_EXEC, ("[Init] Initializing ACPI hardware\n")); - - Status = AcpiHwInitialize (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - /* - * Enable ACPI on this platform - */ - - if (!(Flags & ACPI_NO_ACPI_ENABLE)) - { - DEBUG_PRINT (TRACE_EXEC, ("[Init] Going into ACPI mode\n")); - - Status = AcpiEnable (); - if (ACPI_FAILURE (Status)) - { - DEBUG_PRINT(ACPI_WARN, ("AcpiEnable failed.\n")); - return_ACPI_STATUS (Status); - } - } - - /* - * Note: - * We must have the hardware AND events initialized before we can execute - * ANY control methods SAFELY. Any control method can require ACPI hardware - * support, so the hardware MUST be initialized before execution! - */ - - if (!(Flags & ACPI_NO_EVENT_INIT)) - { - DEBUG_PRINT (TRACE_EXEC, ("[Init] Initializing ACPI events\n")); - - Status = AcpiEvInitialize (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - - /* - * Initialize all device objects in the namespace - * This runs the _STA and _INI methods. - */ - - if (!(Flags & ACPI_NO_DEVICE_INIT)) - { - DEBUG_PRINT (TRACE_EXEC, ("[Init] Initializing ACPI Devices\n")); - - Status = AcpiNsInitializeDevices (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - - /* - * Initialize the objects that remain uninitialized. This - * runs the executable AML that is part of the declaration of OpRegions - * and Fields. - */ - - if (!(Flags & ACPI_NO_OBJECT_INIT)) - { - DEBUG_PRINT (TRACE_EXEC, ("[Init] Initializing ACPI Objects\n")); - - Status = AcpiNsInitializeObjects (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - } - - - return_ACPI_STATUS (Status); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiTerminate - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Shutdown the ACPI subsystem. Release all resources. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiTerminate (void) -{ - - FUNCTION_TRACE ("AcpiTerminate"); - - /* Terminate the AML Debuger if present */ - - DEBUGGER_EXEC(AcpiGbl_DbTerminateThreads = TRUE); - - /* TBD: [Investigate] This is no longer needed?*/ -/* AcpiCmReleaseMutex (ACPI_MTX_DEBUG_CMD_READY); */ - - - /* Shutdown and free all resources */ - - AcpiCmSubsystemShutdown (); - - - /* Free the mutex objects */ - - AcpiCmMutexTerminate (); - - - /* Now we can shutdown the OS-dependent layer */ - - AcpiOsTerminate (); - - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiGetSystemInfo - * - * PARAMETERS: OutBuffer - a pointer to a buffer to receive the - * resources for the device - * BufferLength - the number of bytes available in the buffer - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: This function is called to get information about the current - * state of the ACPI subsystem. It will return system information - * in the OutBuffer. - * - * If the function fails an appropriate status will be returned - * and the value of OutBuffer is undefined. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiGetSystemInfo ( - ACPI_BUFFER *OutBuffer) -{ - ACPI_SYSTEM_INFO *InfoPtr; - UINT32 i; - - - FUNCTION_TRACE ("AcpiGetSystemInfo"); - - - /* - * Must have a valid buffer - */ - if ((!OutBuffer) || - (!OutBuffer->Pointer)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - if (OutBuffer->Length < sizeof (ACPI_SYSTEM_INFO)) - { - /* - * Caller's buffer is too small - */ - OutBuffer->Length = sizeof (ACPI_SYSTEM_INFO); - - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); - } - - - /* - * Set return length and get data - */ - OutBuffer->Length = sizeof (ACPI_SYSTEM_INFO); - InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer; - - InfoPtr->AcpiCaVersion = ACPI_CA_VERSION; - - /* System flags (ACPI capabilities) */ - - InfoPtr->Flags = AcpiGbl_SystemFlags; - - /* Timer resolution - 24 or 32 bits */ - if (!AcpiGbl_FADT) - { - InfoPtr->TimerResolution = 0; - } - else if (AcpiGbl_FADT->TmrValExt == 0) - { - InfoPtr->TimerResolution = 24; - } - else - { - InfoPtr->TimerResolution = 32; - } - - /* Clear the reserved fields */ - - InfoPtr->Reserved1 = 0; - InfoPtr->Reserved2 = 0; - - /* Current debug levels */ - - InfoPtr->DebugLayer = AcpiDbgLayer; - InfoPtr->DebugLevel = AcpiDbgLevel; - - /* Current status of the ACPI tables, per table type */ - - InfoPtr->NumTableTypes = NUM_ACPI_TABLES; - for (i = 0; i < NUM_ACPI_TABLES; i++) - { - InfoPtr->TableInfo[i].Count = AcpiGbl_AcpiTables[i].Count; - } - - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiFormatException - * - * PARAMETERS: OutBuffer - a pointer to a buffer to receive the - * exception name - * - * RETURN: Status - the status of the call - * - * DESCRIPTION: This function translates an ACPI exception into an ASCII string. - * - ******************************************************************************/ - -ACPI_STATUS -AcpiFormatException ( - ACPI_STATUS Exception, - ACPI_BUFFER *OutBuffer) -{ - UINT32 Length; - NATIVE_CHAR *FormattedException; - - - FUNCTION_TRACE ("AcpiFormatException"); - - - /* - * Must have a valid buffer - */ - if ((!OutBuffer) || - (!OutBuffer->Pointer)) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - - /* Convert the exception code (Handles bad exception codes) */ - - FormattedException = AcpiCmFormatException (Exception); - - /* - * Get length of string and check if it will fit in caller's buffer - */ - - Length = STRLEN (FormattedException); - if (OutBuffer->Length < Length) - { - OutBuffer->Length = Length; - return_ACPI_STATUS (AE_BUFFER_OVERFLOW); - } - - - /* Copy the string, all done */ - - STRCPY (OutBuffer->Pointer, FormattedException); - - return_ACPI_STATUS (AE_OK); -} - |