diff options
| author | kochi <kochi@NetBSD.org> | 2003-02-26 17:06:40 +0000 |
|---|---|---|
| committer | kochi <kochi@NetBSD.org> | 2003-02-26 17:06:40 +0000 |
| commit | e2b5c0723f083c4f1da4f60e9339eb5e6408fa87 (patch) | |
| tree | d234cf0876de2af49bbe637123ec68356be7af8e /sys/dev | |
| parent | 8399be1bbab3909208aee2b4460dc435728f3dbc (diff) | |
Remove unexpectedly imported ACPI CA files and obsolete files
Diffstat (limited to 'sys/dev')
52 files changed, 0 insertions, 33095 deletions
diff --git a/sys/dev/acpi/acpica/Subsystem/16bit.h b/sys/dev/acpi/acpica/Subsystem/16bit.h deleted file mode 100644 index dcce05970ad..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/16bit.h +++ /dev/null @@ -1,160 +0,0 @@ -/****************************************************************************** - * - * Module Name: 16bit.h - 16-bit support - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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 GET_SEGMENT(ptr) ((UINT16)(_segment)(ptr)) -#define GET_OFFSET(ptr) ((UINT16)(UINT32) (ptr)) -#define GET_PHYSICAL_ADDRESS(ptr) (((((UINT32)GET_SEGMENT(ptr)) << 4)) + GET_OFFSET(ptr)) -#define PTR_OVL_BUILD_PTR(p,b,o) {p.ovl.base=b;p.ovl.offset=o;} - -typedef union ptr_ovl -{ - void *ptr; - UINT32 dword; - struct - { - UINT16 offset; - UINT16 base; - } ovl; - -} PTR_OVL; - - -int ACPI_INTERNAL_VAR_XFACE -FlatMove ( - UINT32 Dest, - UINT32 Src, - UINT16 Size); - - -ACPI_NATIVE_INT -AfWriteBuffer ( - char *Filename, - char *Buffer, - UINT32 Length); - -char * -AfGenerateFilename (char *TableId); - - -ACPI_STATUS -AfFindTable( - char *TableName, - UINT8 **TablePtr, - UINT32 *TableLength); - -void -AfDumpTables (void); - diff --git a/sys/dev/acpi/acpica/Subsystem/a16find.c b/sys/dev/acpi/acpica/Subsystem/a16find.c deleted file mode 100644 index 925e32fb471..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/a16find.c +++ /dev/null @@ -1,768 +0,0 @@ -/****************************************************************************** - * - * Module Name: a16find - 16-bit (real mode) routines to find ACPI - * tables in memory - * $Revision: 23 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include "acpi.h" -#include "amlcode.h" -#include "acparser.h" -#include "actables.h" - -#include "16bit.h" - - -#define _COMPONENT ACPI_TABLES - ACPI_MODULE_NAME ("a16find") - -/* - * This module finds ACPI tables located in memory. - * It is only generated for the 16-bit (real-mode) version of the utility. - */ - -#define ACPI_TABLE_FILE_SUFFIX ".dat" - - -#if ACPI_MACHINE_WIDTH == 16 - - -char FilenameBuf[20]; -ACPI_TABLE_HEADER AcpiTblHeader; -UINT32 TableSize; - -UINT32 AcpiGbl_SystemFlags; -UINT32 AcpiGbl_RsdpOriginalLocation; - -#if 0 -/****************************************************************************** - * - * FUNCTION: AfWriteBuffer - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: Open a file and write out a single buffer - * - ******************************************************************************/ - -ACPI_NATIVE_INT -AfWriteBuffer ( - char *Filename, - char *Buffer, - UINT32 Length) -{ - FILE *fp; - ACPI_NATIVE_INT Actual; - - - fp = fopen (Filename, "wb"); - if (!fp) - { - printf ("Couldn't open %s\n", Filename); - return -1; - } - - Actual = fwrite (Buffer, (size_t) Length, 1, fp); - fclose (fp); - return Actual; -} - - -/****************************************************************************** - * - * FUNCTION: AfGenerateFilename - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: Build an output filename from an ACPI table ID string - * - ******************************************************************************/ - -char * -AfGenerateFilename (char *TableId) -{ - ACPI_NATIVE_UINT i; - - - for (i = 0; i < 8 && TableId[i] != ' ' && TableId[i] != 0; i++) - { - FilenameBuf [i] = TableId[i]; - } - - FilenameBuf [i] = 0; - strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX); - return FilenameBuf; -} - - -/****************************************************************************** - * - * FUNCTION: AfDumpTables - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: Dump the loaded tables to a file (or files) - * - ******************************************************************************/ - -void -AfDumpTables (void) -{ - char *Filename; - - - if (!AcpiGbl_DSDT) - { - AcpiOsPrintf ("No DSDT!\n"); - return; - } - - - Filename = AfGenerateFilename (AcpiGbl_DSDT->OemTableId); - AfWriteBuffer (Filename, - (char *) AcpiGbl_DSDT, AcpiGbl_DSDT->Length); - - AcpiOsPrintf ("DSDT AML written to \"%s\"\n", Filename); -} - -#endif - -/****************************************************************************** - * - * FUNCTION: CopyExtendedToReal - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: Copy memory above 1meg - * - ******************************************************************************/ - -int -CopyExtendedToReal ( - void *Destination, - UINT32 PhysicalSource, - UINT32 Size) -{ - int RetVal; - - - RetVal = FlatMove (GET_PHYSICAL_ADDRESS (Destination), PhysicalSource, (UINT16) Size); - return (RetVal); -} - - -/****************************************************************************** - * - * FUNCTION: AfFindRsdp - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: Scan memory to find the RSDP - * - ******************************************************************************/ - -BOOLEAN -AfFindRsdp (RSDP_DESCRIPTOR **RSDP) -{ - PTR_OVL Rove; - - - PTR_OVL_BUILD_PTR (Rove, 0, 0); - - - /* Scan low memory */ - - do - { - if (strncmp (Rove.ptr, RSDP_SIG, (size_t) 8) == 0) - { - - /* TBD: Checksum check is invalid for X descriptor */ - -/* if (AcpiTbChecksum (Rove.ptr, sizeof(RSDP_DESCRIPTOR)) != 0) - { - */ - AcpiOsPrintf ("RSDP found at %p (Lo block)\n", Rove.ptr); - *RSDP = Rove.ptr; - return (TRUE); - } - - Rove.ovl.base++; - } - while (Rove.ovl.base < 0x3F); - - /* Scan high memory */ - - PTR_OVL_BUILD_PTR (Rove, 0xE000, 0); - do - { - if (strncmp (Rove.ptr, RSDP_SIG, (size_t) 8) == 0) - { - AcpiOsPrintf ("RSDP found at %p (Hi block)\n", Rove.ptr); - *RSDP = Rove.ptr; - return (TRUE); - } - - Rove.ovl.base++; - } - while (Rove.ovl.base < 0xFFFF); - - return (FALSE); -} - - -/****************************************************************************** - * - * FUNCTION: AfRecognizeTable - * - * PARAMETERS: TablePtr - Input buffer pointer, optional - * TableInfo - Return value from AcpiTbGetTable - * - * RETURN: Status - * - * DESCRIPTION: Check a table signature for a match against known table types - * - ******************************************************************************/ - -ACPI_STATUS -AfRecognizeTable ( - char *TablePtr, - UINT32 PhysAddr, - ACPI_TABLE_DESC *TableInfo) -{ - ACPI_TABLE_HEADER *TableHeader; - ACPI_STATUS Status; - ACPI_TABLE_TYPE TableType = 0; - void **TableGlobalPtr; - UINT32 i; - - - ACPI_FUNCTION_TRACE ("AfRecognizeTable"); - - - /* Ensure that we have a valid table pointer */ - - TableHeader = (ACPI_TABLE_HEADER *) TableInfo->Pointer; - if (!TableHeader) - { - return_ACPI_STATUS (AE_BAD_PARAMETER); - } - - /* Search for a signature match among the known table types */ - - Status = AE_SUPPORT; - for (i = 1; i < NUM_ACPI_TABLES; i++) /* Start at one -> Skip RSDP */ - { - if (!ACPI_STRNCMP (TableHeader->Signature, - AcpiGbl_AcpiTableData[i].Signature, - AcpiGbl_AcpiTableData[i].SigLength)) - { - AcpiOsPrintf ("Found table [%s] Length 0x%X\n", - AcpiGbl_AcpiTableData[i].Signature, (UINT32) TableHeader->Length); - - TableType = i; - TableGlobalPtr = AcpiGbl_AcpiTableData[i].GlobalPtr; - Status = AE_OK; - break; - } - } - - /* Return the table type via the info struct */ - - TableInfo->Type = (UINT8) TableType; - TableInfo->Length = (ACPI_SIZE) TableHeader->Length; - - /* - * An AE_SUPPORT means that the table was not recognized. - * We ignore this table; just print a debug message - */ - if (Status == AE_SUPPORT) - { - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, - "Unsupported table %s (Type %d) was found and discarded\n", - AcpiGbl_AcpiTableData[TableType].Name, (UINT32) TableType)); - - return_ACPI_STATUS (Status); - } - - Status = AcpiTbValidateTableHeader (TableHeader); - if (ACPI_FAILURE (Status)) - { - /* Table failed verification, map all errors to BAD_DATA */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid table header found in table named %s (Type %d)\n", - AcpiGbl_AcpiTableData[TableType].Name, (UINT32) TableType)); - - return_ACPI_STATUS (AE_BAD_DATA); - } - - /* Now get the rest of the table */ - - *TableGlobalPtr = ACPI_MEM_ALLOCATE (AcpiTblHeader.Length); - if (!*TableGlobalPtr) - { - AcpiOsPrintf ("Could not allocate buffer for Acpi table of length 0x%X\n", - (UINT32) ((FACS_DESCRIPTOR *) &AcpiTblHeader)->Length); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - TableInfo->Pointer = *TableGlobalPtr; - - CopyExtendedToReal (*TableGlobalPtr, PhysAddr, AcpiTblHeader.Length); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s=%p, (TableGlobalPtr=%p)\n", AcpiGbl_AcpiTableData[TableType].Signature, - *TableGlobalPtr, TableGlobalPtr)); - - if (AcpiGbl_DbOpt_verbose) - { - AcpiUtDumpBuffer (*TableGlobalPtr, 48, 0, 0); - } - - /* - * Validate checksum for _most_ tables, - * even the ones whose signature we don't recognize - */ - if (TableType != ACPI_TABLE_FACS) - { - /* But don't abort if the checksum is wrong */ - /* TBD: make this a configuration option? */ - - AcpiTbVerifyTableChecksum (*TableGlobalPtr); - } - - return_ACPI_STATUS (Status); -} - - -/****************************************************************************** - * - * FUNCTION: AfGetAllTables - * - * PARAMETERS: Root - Root of the parse tree - * - * RETURN: None - * - * DESCRIPTION: - * - *****************************************************************************/ - -ACPI_STATUS -AfGetAllTables ( - UINT32 NumberOfTables, - char *TablePtr) -{ - ACPI_STATUS Status = AE_OK; - UINT32 Index; - ACPI_TABLE_DESC TableInfo; - - - ACPI_FUNCTION_TRACE ("AfGetAllTables"); - - - if (AcpiGbl_DbOpt_verbose) - { - AcpiOsPrintf ("Number of tables: %d\n", (UINT32) NumberOfTables); - } - - /* - * Loop through all table pointers found in RSDT. - * This will NOT include the FACS and DSDT - we must get - * them after the loop - */ - for (Index = 0; Index < NumberOfTables; Index++) - { - /* Get the table via the RSDT */ - - CopyExtendedToReal (&AcpiTblHeader, ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index]), - sizeof (ACPI_TABLE_HEADER)); - - TableInfo.Pointer = &AcpiTblHeader; - TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length; - TableInfo.Allocation = ACPI_MEM_ALLOCATED; - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Table pointer: %X\n", - (UINT32) ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index]))); - - Status = AfRecognizeTable (NULL, ACPI_GET_ADDRESS (AcpiGbl_XSDT->TableOffsetEntry[Index]), &TableInfo); - if (ACPI_SUCCESS (Status)) - { - AcpiTbInitTableDescriptor (TableInfo.Type, &TableInfo); - } - - /* Ignore errors, just move on to next table */ - } - - if (!AcpiGbl_FADT) - { - AcpiOsPrintf ("FADT was not found, cannot obtain FACS and DSDT!\n"); - return (AE_NO_ACPI_TABLES); - } - - Status = AcpiTbConvertTableFadt (); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* - * Get the FACS - */ - CopyExtendedToReal (&AcpiTblHeader, ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl), - sizeof (ACPI_TABLE_HEADER)); - AcpiGbl_FACS = ACPI_MEM_ALLOCATE (AcpiTblHeader.Length); - if (!AcpiGbl_FACS) - { - AcpiOsPrintf ("Could not allocate buffer for FADT length 0x%X\n", - (UINT32) AcpiTblHeader.Length); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - CopyExtendedToReal (AcpiGbl_FACS, ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl), AcpiTblHeader.Length); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "FACS at %p (Phys %8.8X) length %X FADT at%p\n", - AcpiGbl_FACS, (UINT32) ACPI_GET_ADDRESS (AcpiGbl_FADT->XFirmwareCtrl), - (UINT32) AcpiTblHeader.Length, AcpiGbl_FADT)); - if (AcpiGbl_DbOpt_verbose) - { - AcpiUtDumpBuffer ((char *) AcpiGbl_FADT, sizeof (ACPI_TABLE_HEADER), 0, 0); - } - - TableInfo.Type = ACPI_TABLE_FADT; - TableInfo.Pointer = (void *) AcpiGbl_FADT; - TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length; - TableInfo.Allocation = ACPI_MEM_ALLOCATED; - - /* There is no checksum for the FACS, nothing to verify */ - - AcpiTbInitTableDescriptor (TableInfo.Type, &TableInfo); - - AcpiTbBuildCommonFacs (&TableInfo); - - /* - * Get the DSDT - */ - CopyExtendedToReal (&AcpiTblHeader, ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt), sizeof (ACPI_TABLE_HEADER)); - AcpiGbl_DSDT = ACPI_MEM_ALLOCATE (AcpiTblHeader.Length); - if (!AcpiGbl_DSDT) - { - AcpiOsPrintf ("Could not allocate buffer for DSDT length 0x%X\n", (UINT32) AcpiTblHeader.Length); - return_ACPI_STATUS (AE_NO_MEMORY); - } - - CopyExtendedToReal (AcpiGbl_DSDT, ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt), AcpiTblHeader.Length); - - AcpiOsPrintf ("DSDT at %p (Phys %8.8X) length %X FADT at %p\n", - AcpiGbl_DSDT, (UINT32) ACPI_GET_ADDRESS (AcpiGbl_FADT->XDsdt), - (UINT32) AcpiTblHeader.Length, AcpiGbl_FADT); - if (AcpiGbl_DbOpt_verbose) - { - AcpiUtDumpBuffer ((char *) AcpiGbl_DSDT, sizeof (ACPI_TABLE_HEADER), 0, 0); - } - - TableInfo.Type = ACPI_TABLE_DSDT; - TableInfo.Pointer = (void *) AcpiGbl_DSDT; - TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length; - TableInfo.Allocation = ACPI_MEM_ALLOCATED; - - AcpiTbInitTableDescriptor (TableInfo.Type, &TableInfo); - AcpiTbVerifyTableChecksum ((ACPI_TABLE_HEADER *) AcpiGbl_DSDT); - - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AfFindDsdt - * - * PARAMETERS: - * - * RETURN: Status - * - * DESCRIPTION: Load the DSDT from the file pointer - * - *****************************************************************************/ - -ACPI_STATUS -AfFindTable( - char *TableName, - UINT8 **TablePtr, - UINT32 *TableLength) -{ - ACPI_TABLE_DESC TableInfo; - BOOLEAN Found; - ACPI_STATUS Status; - UINT32 PhysicalAddress; - UINT32 SignatureLength; - char *TableSignature; - - - ACPI_FUNCTION_TRACE ("AfFindTable"); - - - if (!AcpiGbl_RSDP) - { - Found = AfFindRsdp (&AcpiGbl_RSDP); - if (!Found) - { - AcpiOsPrintf ("Could not find RSDP in the low megabyte\n"); - return (AE_NO_ACPI_TABLES); - } - - /* - * For RSDP revision 0 or 1, we use the RSDT. - * For RSDP revision 2 (and above), we use the XSDT - */ - if (AcpiGbl_RSDP->Revision < 2) - { - PhysicalAddress = AcpiGbl_RSDP->RsdtPhysicalAddress; - TableSignature = RSDT_SIG; - SignatureLength = sizeof (RSDT_SIG) -1; - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found ACPI 1.0 RSDP\n")); - } - else - { - PhysicalAddress = ACPI_GET_ADDRESS (AcpiGbl_RSDP->XsdtPhysicalAddress); - TableSignature = XSDT_SIG; - SignatureLength = sizeof (XSDT_SIG) -1; - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Found ACPI 2.0 RSDP\n")); - } - - if (AcpiGbl_DbOpt_verbose) - { - AcpiUtDumpBuffer ((char *) AcpiGbl_RSDP, sizeof (RSDP_DESCRIPTOR), 0, ACPI_UINT32_MAX); - } - - /* Get the RSDT/XSDT header to determine the table length */ - - CopyExtendedToReal (&AcpiTblHeader, PhysicalAddress, sizeof (ACPI_TABLE_HEADER)); - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDT/XSDT at %8.8X\n", (UINT32) PhysicalAddress)); - if (AcpiGbl_DbOpt_verbose) - { - AcpiUtDumpBuffer ((char *) &AcpiTblHeader, sizeof (ACPI_TABLE_HEADER), 0, ACPI_UINT32_MAX); - } - - /* Validate the table header */ - - Status = AcpiTbValidateTableHeader (&AcpiTblHeader); - if (ACPI_FAILURE (Status)) - { - /* Table failed verification, map all errors to BAD_DATA */ - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid RSDT table header\n")); - return (AE_BAD_DATA); - } - - /* Allocate a buffer for the entire table */ - - AcpiGbl_XSDT = (void *) malloc ((size_t) AcpiTblHeader.Length); - if (!AcpiGbl_XSDT) - { - AcpiOsPrintf ("Could not allocate buffer for RSDT length 0x%X\n", - (UINT32) AcpiTblHeader.Length); - return AE_NO_MEMORY; - } - - /* Get the entire RSDT/XSDT */ - - CopyExtendedToReal (AcpiGbl_XSDT, PhysicalAddress, AcpiTblHeader.Length); - AcpiOsPrintf ("%s at %p (Phys %8.8X)\n", - TableSignature, AcpiGbl_XSDT, (UINT32) PhysicalAddress); - - if (AcpiGbl_DbOpt_verbose) - { - AcpiUtDumpBuffer ((char *) &AcpiTblHeader, sizeof (ACPI_TABLE_HEADER), 0, 0); - } - - /* Convert to common format XSDT */ - - TableInfo.Pointer = (ACPI_TABLE_HEADER *) AcpiGbl_XSDT; - TableInfo.Length = (ACPI_SIZE) AcpiTblHeader.Length; - TableInfo.Allocation = ACPI_MEM_ALLOCATED; - - AcpiGbl_RsdtTableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, TableInfo.Pointer); - - Status = AcpiTbConvertToXsdt (&TableInfo); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - AcpiGbl_XSDT = (XSDT_DESCRIPTOR *) TableInfo.Pointer; - - /* Get the rest of the required tables (DSDT, FADT) */ - - Status = AfGetAllTables (AcpiGbl_RsdtTableCount, NULL); - if (ACPI_FAILURE (Status)) - { - goto ErrorExit; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n")); - } - - - if (!ACPI_STRNCMP (TableName, DSDT_SIG, ACPI_NAME_SIZE)) - { - *TablePtr = (UINT8 *) AcpiGbl_DSDT; - *TableLength = AcpiGbl_DSDT->Length; - } - else if (!ACPI_STRNCMP (TableName, FADT_SIG, ACPI_NAME_SIZE)) - { - *TablePtr = (UINT8 *) AcpiGbl_FADT; - *TableLength = AcpiGbl_FADT->Header.Length; - } - else if (!ACPI_STRNCMP (TableName, FACS_SIG, ACPI_NAME_SIZE)) - { - *TablePtr = (UINT8 *) AcpiGbl_FACS; - *TableLength = AcpiGbl_FACS->Length; - } - else if (!ACPI_STRNCMP (TableName, RSDT_SIG, ACPI_NAME_SIZE)) - { - *TablePtr = (UINT8 *) AcpiGbl_XSDT; - *TableLength = AcpiGbl_XSDT->Header.Length; - } - else - { - AcpiOsPrintf ("Unsupported table signature: [%4.4s]\n", TableName); - *TablePtr = NULL; - return AE_SUPPORT; - } - - return AE_OK; - -ErrorExit: - - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Failure during ACPI Table initialization: %s\n", - AcpiFormatException (Status))); - return (Status); -} - - -#endif /* IA16 */ diff --git a/sys/dev/acpi/acpica/Subsystem/acapps.h b/sys/dev/acpi/acpica/Subsystem/acapps.h deleted file mode 100644 index 154593f8f3d..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/acapps.h +++ /dev/null @@ -1,192 +0,0 @@ -/****************************************************************************** - * - * Module Name: acapps - common include for ACPI applications/tools - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#ifndef _ACAPPS -#define _ACAPPS - - -#ifdef _MSC_VER /* disable some level-4 warnings */ -#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */ -#endif - -extern UINT8 *DsdtPtr; -extern UINT32 AcpiDsdtLength; -extern UINT8 *AmlStart; -extern UINT32 AmlLength; - - -extern int AcpiGbl_Optind; -extern char *AcpiGbl_Optarg; - -int -AcpiGetopt( - int argc, - char **argv, - char *opts); - -ACPI_STATUS -AdInitialize ( - void); - -char * -FlGenerateFilename ( - char *InputFilename, - char *Suffix); - -ACPI_STATUS -FlSplitInputPathname ( - char *InputPath, - char **OutDirectoryPath, - char **OutFilename); - -ACPI_STATUS -AdAmlDisassemble ( - BOOLEAN OutToFile, - char *Filename, - char *Prefix, - char **OutFilename, - BOOLEAN GetAllTables); - -void -AdPrintStatistics (void); - -ACPI_STATUS -AdFindDsdt( - UINT8 **DsdtPtr, - UINT32 *DsdtLength); - -void -AdDumpTables (void); - -ACPI_STATUS -AdGetLocalTables ( - char *Filename, - BOOLEAN GetAllTables); - -ACPI_STATUS -AdParseTable ( - ACPI_TABLE_HEADER *Table); - -ACPI_STATUS -AdDisplayTables ( - char *Filename, - ACPI_TABLE_HEADER *Table); - -ACPI_STATUS -AdDisplayStatistics (void); - - -#endif /* _ACAPPS */ - diff --git a/sys/dev/acpi/acpica/Subsystem/acdos16.h b/sys/dev/acpi/acpica/Subsystem/acdos16.h deleted file mode 100644 index 0b2eaedbfab..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/acdos16.h +++ /dev/null @@ -1,161 +0,0 @@ -/****************************************************************************** - * - * Name: acdos16.h - DOS specific defines, etc. - * $Revision: 1.1.1.3 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#ifndef __ACDOS16_H__ -#define __ACDOS16_H__ - -#define ACPI_USE_STANDARD_HEADERS -#define ACPI_OS_NAME "Windows" - -#define ACPI_MACHINE_WIDTH 16 - -/* - * Calling conventions: - * - * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) - * ACPI_EXTERNAL_XFACE - External ACPI interfaces - * ACPI_INTERNAL_XFACE - Internal ACPI interfaces - * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces - */ -#define ACPI_SYSTEM_XFACE __cdecl -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE __cdecl - -#define ACPI_ASM_MACROS -#define BREAKPOINT3 -#define ACPI_DISABLE_IRQS() -#define ACPI_ENABLE_IRQS() -#define halt() -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) - - -/* This macro is used to tag functions as "printf-like" because - * some compilers can catch printf format string problems. MSVC - * doesn't, so this is proprocessed away. - */ -#define ACPI_PRINTF_LIKE_FUNC - -/* Some compilers complain about unused variables. Sometimes we don't want to - * use all the variables (most specifically for _THIS_MODULE). This allow us - * to to tell the compiler warning in a per-variable manner that a variable - * is unused. However, MSVC doesn't do this. - */ -#define ACPI_UNUSED_VAR - - -#endif /* __ACDOS16_H__ */ diff --git a/sys/dev/acpi/acpica/Subsystem/acefi.h b/sys/dev/acpi/acpica/Subsystem/acefi.h deleted file mode 100644 index 44344ba9c3c..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/acefi.h +++ /dev/null @@ -1,150 +0,0 @@ -/****************************************************************************** - * - * Name: acefi.h - OS specific defines, etc. - * $Revision: 1.1.1.3 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#ifndef __ACEFI_H__ -#define __ACEFI_H__ - -#define ACPI_OS_NAME "AED EFI" - -#include <efi.h> -#include <efistdarg.h> -#include <efilib.h> - - -/* _int64 works for both IA32 and IA64 */ - -#define COMPILER_DEPENDENT_INT64 __int64 -#define COMPILER_DEPENDENT_UINT64 unsigned __int64 - -/* - * Calling conventions: - * - * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) - * ACPI_EXTERNAL_XFACE - External ACPI interfaces - * ACPI_INTERNAL_XFACE - Internal ACPI interfaces - * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces - */ -#define ACPI_SYSTEM_XFACE -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE - -/* warn C4142: redefinition of type */ - -#pragma warning(disable:4142) - - -#endif /* __ACEFI_H__ */ diff --git a/sys/dev/acpi/acpica/Subsystem/acfreebsd.h b/sys/dev/acpi/acpica/Subsystem/acfreebsd.h deleted file mode 100644 index 9bc6ca58eea..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/acfreebsd.h +++ /dev/null @@ -1,200 +0,0 @@ -/****************************************************************************** - * - * Name: acfreebsd.h - OS specific defines, etc. - * $Revision: 1.1.1.3 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#ifndef __ACFREEBSD_H__ -#define __ACFREEBSD_H__ - -/* - * XXX this is technically correct, but will cause problems with some ASL - * which only works if the string names a Microsoft operating system. - */ -#define ACPI_OS_NAME "FreeBSD" - -/* FreeBSD uses GCC */ - -#include "acgcc.h" -#include <machine/acpica_machdep.h> - -#ifdef _KERNEL -#include <sys/ctype.h> -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/libkern.h> -#include <machine/stdarg.h> - -#define asm __asm -#define __cli() disable_intr() -#define __sti() enable_intr() - -#ifdef ACPI_DEBUG_OUTPUT -#ifdef DEBUGGER_THREADING -#undef DEBUGGER_THREADING -#endif /* DEBUGGER_THREADING */ -#define DEBUGGER_THREADING 0 /* integrated with DDB */ -#include "opt_ddb.h" -#ifdef DDB -#define ACPI_DEBUGGER -#endif /* DDB */ -#endif /* ACPI_DEBUG_OUTPUT */ - -#else /* _KERNEL */ - -/* Not building kernel code, so use libc */ -#define ACPI_USE_STANDARD_HEADERS - -#define __cli() -#define __sti() - -#endif /* _KERNEL */ - -/* Always use FreeBSD code over our local versions */ -#define ACPI_USE_SYSTEM_CLIBRARY - -/* FreeBSD doesn't have strupr, should be fixed. (move to libkern) */ -static __inline char * -strupr(char *str) -{ - char *c = str; - while(*c) { - *c = toupper(*c); - c++; - } - return(str); -} - -#ifdef _KERNEL -/* Or strstr (used in debugging mode, also move to libkern) */ -static __inline char * -strstr(char *s, char *find) -{ - char c, sc; - size_t len; - - if ((c = *find++) != 0) { - len = strlen(find); - do { - do { - if ((sc = *s++) == 0) - return (NULL); - } while (sc != c); - } while (strncmp(s, find, len) != 0); - s--; - } - return ((char *)s); -} -#endif /* _KERNEL */ - -#endif /* __ACFREEBSD_H__ */ diff --git a/sys/dev/acpi/acpica/Subsystem/acintel.h b/sys/dev/acpi/acpica/Subsystem/acintel.h deleted file mode 100644 index db10da858b7..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/acintel.h +++ /dev/null @@ -1,176 +0,0 @@ -/****************************************************************************** - * - * Name: acintel.h - VC specific defines, etc. - * $Revision: 1.1.1.3 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#ifndef __ACINTEL_H__ -#define __ACINTEL_H__ - - -#define COMPILER_DEPENDENT_INT64 __int64 -#define COMPILER_DEPENDENT_UINT64 unsigned __int64 - -/* - * Calling conventions: - * - * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) - * ACPI_EXTERNAL_XFACE - External ACPI interfaces - * ACPI_INTERNAL_XFACE - Internal ACPI interfaces - * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces - */ -#define ACPI_SYSTEM_XFACE -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE - -/* - * Math helper functions - */ -#define ACPI_DIV_64_BY_32(n, n_hi, n_lo, d32, q32, r32) \ -{ \ - q32 = n / d32; \ - r32 = n % d32; \ -} - -#define ACPI_SHIFT_RIGHT_64(n, n_hi, n_lo) \ -{ \ - n <<= 1; \ -} - -/* remark 981 - operands evaluated in no particular order */ -#pragma warning(disable:981) - -/* warn C4100: unreferenced formal parameter */ -#pragma warning(disable:4100) - -/* warn C4127: conditional expression is constant */ -#pragma warning(disable:4127) - -/* warn C4706: assignment within conditional expression */ -#pragma warning(disable:4706) - -/* This macro is used to tag functions as "printf-like" because - * some compilers can catch printf format string problems. MSVC - * doesn't, so this is proprocessed away. - */ -#define ACPI_PRINTF_LIKE_FUNC - -/* Some compilers complain about unused variables. Sometimes we don't want to - * use all the variables (most specifically for _THIS_MODULE). This allow us - * to to tell the compiler warning in a per-variable manner that a variable - * is unused. However, MSVC doesn't do this. - */ -#define ACPI_UNUSED_VAR - -#endif /* __ACINTEL_H__ */ diff --git a/sys/dev/acpi/acpica/Subsystem/aclinux.h b/sys/dev/acpi/acpica/Subsystem/aclinux.h deleted file mode 100644 index dab3fabef0f..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aclinux.h +++ /dev/null @@ -1,164 +0,0 @@ -/****************************************************************************** - * - * Name: aclinux.h - OS specific defines, etc. - * $Revision: 1.1.1.3 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#ifndef __ACLINUX_H__ -#define __ACLINUX_H__ - -#define ACPI_OS_NAME "Linux" - -#define ACPI_USE_SYSTEM_CLIBRARY - -#ifdef __KERNEL__ - -#include <linux/config.h> -#include <linux/string.h> -#include <linux/kernel.h> -#include <linux/ctype.h> -#include <asm/system.h> -#include <asm/atomic.h> -#include <asm/div64.h> -#include <asm/acpi.h> - -#define strtoul simple_strtoul - -#define ACPI_MACHINE_WIDTH BITS_PER_LONG - -#else /* !__KERNEL__ */ - -#include <stdarg.h> -#include <string.h> -#include <stdlib.h> -#include <ctype.h> -#include <unistd.h> - -#if defined(__ia64__) || defined(__x86_64__) -#define ACPI_MACHINE_WIDTH 64 -#define COMPILER_DEPENDENT_INT64 long -#define COMPILER_DEPENDENT_UINT64 unsigned long -#else -#define ACPI_MACHINE_WIDTH 32 -#define COMPILER_DEPENDENT_INT64 long long -#define COMPILER_DEPENDENT_UINT64 unsigned long long -#define ACPI_USE_NATIVE_DIVIDE -#endif - -#endif /* __KERNEL__ */ - -/* Linux uses GCC */ - -#include "acgcc.h" - -#endif /* __ACLINUX_H__ */ diff --git a/sys/dev/acpi/acpica/Subsystem/acmsvc.h b/sys/dev/acpi/acpica/Subsystem/acmsvc.h deleted file mode 100644 index 3d81027e67c..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/acmsvc.h +++ /dev/null @@ -1,194 +0,0 @@ -/****************************************************************************** - * - * Name: acmsvc.h - VC specific defines, etc. - * $Revision: 1.1.1.3 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#ifndef __ACMSVC_H__ -#define __ACMSVC_H__ - -#define COMPILER_DEPENDENT_INT64 __int64 -#define COMPILER_DEPENDENT_UINT64 unsigned __int64 - -/* - * Calling conventions: - * - * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) - * ACPI_EXTERNAL_XFACE - External ACPI interfaces - * ACPI_INTERNAL_XFACE - Internal ACPI interfaces - * ACPI_INTERNAL_VAR_XFACE - Internal variable-parameter list interfaces - */ -#define ACPI_SYSTEM_XFACE __cdecl -#define ACPI_EXTERNAL_XFACE -#define ACPI_INTERNAL_XFACE -#define ACPI_INTERNAL_VAR_XFACE __cdecl - -#ifndef _LINT -/* - * Math helper functions - */ -#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ -{ \ - __asm mov edx, n_hi \ - __asm mov eax, n_lo \ - __asm div d32 \ - __asm mov q32, eax \ - __asm mov r32, edx \ -} - -#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ -{ \ - __asm shr n_hi, 1 \ - __asm rcr n_lo, 1 \ -} -#else - -/* Fake versions to make lint happy */ - -#define ACPI_DIV_64_BY_32(n_hi, n_lo, d32, q32, r32) \ -{ \ - q32 = n_hi / d32; \ - r32 = n_lo / d32; \ -} - -#define ACPI_SHIFT_RIGHT_64(n_hi, n_lo) \ -{ \ - n_hi >>= 1; \ - n_lo >>= 1; \ -} -#endif - -/* warn C4100: unreferenced formal parameter */ -#pragma warning(disable:4100) - -/* warn C4127: conditional expression is constant */ -#pragma warning(disable:4127) - -/* warn C4706: assignment within conditional expression */ -#pragma warning(disable:4706) - -/* This macro is used to tag functions as "printf-like" because - * some compilers can catch printf format string problems. MSVC - * doesn't, so this is proprocessed away. - */ -#define ACPI_PRINTF_LIKE_FUNC - -/* Some compilers complain about unused variables. Sometimes we don't want to - * use all the variables (most specifically for _THIS_MODULE). This allow us - * to to tell the compiler warning in a per-variable manner that a variable - * is unused. However, MSVC doesn't do this. - */ -#define ACPI_UNUSED_VAR - - -#endif /* __ACMSVC_H__ */ diff --git a/sys/dev/acpi/acpica/Subsystem/acpisrc.h b/sys/dev/acpi/acpica/Subsystem/acpisrc.h deleted file mode 100644 index d918671c66c..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/acpisrc.h +++ /dev/null @@ -1,466 +0,0 @@ - -/****************************************************************************** - * - * Module Name: acpisrc.h - Include file for AcpiSrc utility - * $Revision: 29 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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 LINES_IN_LEGAL_HEADER 105 /* See above */ - - -#include <stdio.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <fcntl.h> -#include <ctype.h> -#ifdef WIN32 -#include <io.h> -#include <direct.h> -#endif -#include <errno.h> - -#include "acpi.h" - - -/* Fixups for non-Win32 compilation */ -#ifndef WIN32 - -static inline int -max (int a, int b) -{ - return (a > b ? a : b); -} - -#define O_BINARY 0x0 - -#define mkdir(x) mkdir(x, 0) -#define stricmp strcasecmp - -char * strlwr(char* str); - -#endif - - -/* Constants */ - - -#define ASRC_MAX_FILE_SIZE (1024 * 100) - -#define FILE_TYPE_SOURCE 1 -#define FILE_TYPE_HEADER 2 -#define FILE_TYPE_DIRECTORY 3 - - -#define CVT_COUNT_TABS 0x00000001 -#define CVT_COUNT_NON_ANSI_COMMENTS 0x00000002 -#define CVT_TRIM_LINES 0x00000004 -#define CVT_CHECK_BRACES 0x00000008 -#define CVT_COUNT_LINES 0x00000010 -#define CVT_BRACES_ON_SAME_LINE 0x00000020 -#define CVT_MIXED_CASE_TO_UNDERSCORES 0x00000040 -#define CVT_LOWER_CASE_IDENTIFIERS 0x00000080 -#define CVT_REMOVE_DEBUG_MACROS 0x00000100 -#define CVT_TRIM_WHITESPACE 0x00000200 /* Should be after all line removal */ -#define CVT_REMOVE_EMPTY_BLOCKS 0x00000400 /* Should be after trimming lines */ -#define CVT_REDUCE_TYPEDEFS 0x00000800 -#define CVT_SPACES_TO_TABS4 0x40000000 /* Tab conversion should be last */ -#define CVT_SPACES_TO_TABS8 0x80000000 /* Tab conversion should be last */ - - -#define FLG_DEFAULT_FLAGS 0x00000000 -#define FLG_NO_CARRIAGE_RETURNS 0x00000001 -#define FLG_NO_FILE_OUTPUT 0x00000002 -#define FLG_LOWERCASE_DIRNAMES 0x00000004 - - -/* Globals */ - -extern UINT32 Gbl_Files; -extern UINT32 Gbl_MissingBraces; -extern UINT32 Gbl_Tabs; -extern UINT32 Gbl_NonAnsiComments; -extern UINT32 Gbl_SourceLines; -extern UINT32 Gbl_WhiteLines; -extern UINT32 Gbl_CommentLines; -extern UINT32 Gbl_LongLines; -extern UINT32 Gbl_TotalLines; -extern struct stat Gbl_StatBuf; -extern char *Gbl_FileBuffer; -extern UINT32 Gbl_FileSize; -extern UINT32 Gbl_FileType; -extern BOOLEAN Gbl_VerboseMode; -extern BOOLEAN Gbl_BatchMode; -extern BOOLEAN Gbl_MadeChanges; -extern BOOLEAN Gbl_Overwrite; -extern BOOLEAN Gbl_WidenDeclarations; - -#define PARAM_LIST(pl) pl -#define TERSE_PRINT(a) if (!Gbl_VerboseMode) printf PARAM_LIST(a) -#define VERBOSE_PRINT(a) if (Gbl_VerboseMode) printf PARAM_LIST(a) - - -#define REPLACE_WHOLE_WORD 0x00 -#define REPLACE_SUBSTRINGS 0x01 -#define REPLACE_MASK 0x01 - -#define EXTRA_INDENT_C 0x02 -#define INDENT_MASK 0x02 - - -/* Conversion table structs */ - -typedef struct acpi_string_table -{ - char *Target; - char *Replacement; - UINT8 Type; - -} ACPI_STRING_TABLE; - - -typedef struct acpi_typed_identifier_table -{ - char *Identifier; - UINT8 Type; - -} ACPI_TYPED_IDENTIFIER_TABLE; - -#define SRC_TYPE_SIMPLE 0 -#define SRC_TYPE_STRUCT 1 -#define SRC_TYPE_UNION 2 - - -typedef struct acpi_identifier_table -{ - char *Identifier; - -} ACPI_IDENTIFIER_TABLE; - -typedef struct acpi_conversion_table -{ - char *NewHeader; - UINT32 Flags; - - ACPI_TYPED_IDENTIFIER_TABLE *LowerCaseTable; - - ACPI_STRING_TABLE *SourceStringTable; - ACPI_IDENTIFIER_TABLE *SourceLineTable; - ACPI_IDENTIFIER_TABLE *SourceConditionalTable; - ACPI_IDENTIFIER_TABLE *SourceMacroTable; - ACPI_TYPED_IDENTIFIER_TABLE *SourceStructTable; - UINT32 SourceFunctions; - - ACPI_STRING_TABLE *HeaderStringTable; - ACPI_IDENTIFIER_TABLE *HeaderLineTable; - ACPI_IDENTIFIER_TABLE *HeaderConditionalTable; - ACPI_IDENTIFIER_TABLE *HeaderMacroTable; - ACPI_TYPED_IDENTIFIER_TABLE *HeaderStructTable; - UINT32 HeaderFunctions; - -} ACPI_CONVERSION_TABLE; - - -/* Prototypes */ - -char * -AsSkipUntilChar ( - char *Buffer, - char Target); - -char * -AsSkipPastChar ( - char *Buffer, - char Target); - -char * -AsReplaceData ( - char *Buffer, - UINT32 LengthToRemove, - char *BufferToAdd, - UINT32 LengthToAdd); - -int -AsReplaceString ( - char *Target, - char *Replacement, - UINT8 Type, - char *Buffer); - -int -AsLowerCaseString ( - char *Target, - char *Buffer); - -void -AsRemoveLine ( - char *Buffer, - char *Keyword); - -void -AsRemoveMacro ( - char *Buffer, - char *Keyword); - -void -AsCheckForBraces ( - char *Buffer, - char *Filename); - -void -AsTrimLines ( - char *Buffer, - char *Filename); - -void -AsMixedCaseToUnderscores ( - char *Buffer); - -void -AsCountTabs ( - char *Buffer, - char *Filename); - -void -AsBracesOnSameLine ( - char *Buffer); - -void -AsLowerCaseIdentifiers ( - char *Buffer); - -void -AsReduceTypedefs ( - char *Buffer, - char *Keyword); - -void -AsRemoveDebugMacros ( - char *Buffer); - -void -AsRemoveEmptyBlocks ( - char *Buffer, - char *Filename); - -void -AsCountSourceLines ( - char *Buffer, - char *Filename); - -void -AsCountNonAnsiComments ( - char *Buffer, - char *Filename); - -void -AsTrimWhitespace ( - char *Buffer); - -void -AsTabify4 ( - char *Buffer); - -void -AsTabify8 ( - char *Buffer); - -void -AsRemoveConditionalCompile ( - char *Buffer, - char *Keyword); - -ACPI_NATIVE_INT -AsProcessTree ( - ACPI_CONVERSION_TABLE *ConversionTable, - char *SourcePath, - char *TargetPath); - -int -AsGetFile ( - char *FileName, - char **FileBuffer, - UINT32 *FileSize); - -int -AsPutFile ( - char *Pathname, - char *FileBuffer, - UINT32 SystemFlags); - -void -AsReplaceHeader ( - char *Buffer, - char *NewHeader); - -void -AsConvertFile ( - ACPI_CONVERSION_TABLE *ConversionTable, - char *FileBuffer, - char *Filename, - ACPI_NATIVE_INT FileType); - -ACPI_NATIVE_INT -AsProcessOneFile ( - ACPI_CONVERSION_TABLE *ConversionTable, - char *SourcePath, - char *TargetPath, - int MaxPathLength, - char *Filename, - ACPI_NATIVE_INT FileType); - -ACPI_NATIVE_INT -AsCheckForDirectory ( - char *SourceDirPath, - char *TargetDirPath, - char *Filename, - char **SourcePath, - char **TargetPath); - -BOOLEAN -AsMatchExactWord ( - char *Word, - UINT32 WordLength); - -void -AsPrint ( - char *Message, - UINT32 Count, - char *Filename); - -void -AsInsertPrefix ( - char *Buffer, - char *Keyword, - UINT8 Type); - -char * -AsInsertData ( - char *Buffer, - char *BufferToAdd, - UINT32 LengthToAdd); - -char * -AsRemoveData ( - char *StartPointer, - char *EndPointer); - -void -AsInsertCarriageReturns ( - char *Buffer); - -void -AsConvertToLineFeeds ( - char *Buffer); - - - diff --git a/sys/dev/acpi/acpica/Subsystem/actbl71.h b/sys/dev/acpi/acpica/Subsystem/actbl71.h deleted file mode 100644 index 54096ee4f97..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/actbl71.h +++ /dev/null @@ -1,238 +0,0 @@ -/****************************************************************************** - * - * Name: actbl71.h - IA-64 Extensions to the ACPI Spec Rev. 0.71 - * This file includes tables specific to this - * specification revision. - * xRevision: 12 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2002, 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. - * - *****************************************************************************/ - -#ifndef __ACTBL71_H__ -#define __ACTBL71_H__ - - -/* 0.71 FADT AddressSpace data item bitmasks defines */ -/* If the associated bit is zero then it is in memory space else in io space */ - -#define SMI_CMD_ADDRESS_SPACE 0x01 -#define PM1_BLK_ADDRESS_SPACE 0x02 -#define PM2_CNT_BLK_ADDRESS_SPACE 0x04 -#define PM_TMR_BLK_ADDRESS_SPACE 0x08 -#define GPE0_BLK_ADDRESS_SPACE 0x10 -#define GPE1_BLK_ADDRESS_SPACE 0x20 - -/* Only for clarity in declarations */ - -typedef UINT64 IO_ADDRESS; - - -#pragma pack(1) -typedef struct /* Root System Descriptor Pointer */ -{ - NATIVE_CHAR Signature [8]; /* contains "RSD PTR " */ - UINT8 Checksum; /* to make sum of struct == 0 */ - NATIVE_CHAR OemId [6]; /* OEM identification */ - UINT8 Reserved; /* Must be 0 for 1.0, 2 for 2.0 */ - UINT64 RsdtPhysicalAddress; /* 64-bit physical address of RSDT */ -} RSDP_DESCRIPTOR_REV071; - - -/*****************************************/ -/* IA64 Extensions to ACPI Spec Rev 0.71 */ -/* for the Root System Description Table */ -/*****************************************/ -typedef struct -{ - ACPI_TABLE_HEADER header; /* Table header */ - UINT32 ReservedPad; /* IA64 alignment, must be 0 */ - UINT64 TableOffsetEntry [1]; /* Array of pointers to other */ - /* tables' headers */ -} RSDT_DESCRIPTOR_REV071; - - -/*******************************************/ -/* IA64 Extensions to ACPI Spec Rev 0.71 */ -/* for the Firmware ACPI Control Structure */ -/*******************************************/ -typedef struct -{ - NATIVE_CHAR Signature[4]; /* signature "FACS" */ - UINT32 Length; /* length of structure, in bytes */ - UINT32 HardwareSignature; /* hardware configuration signature */ - UINT32 Reserved4; /* must be 0 */ - UINT64 FirmwareWakingVector; /* ACPI OS waking vector */ - UINT64 GlobalLock; /* Global Lock */ - UINT32_BIT S4Bios_f : 1; /* Indicates if S4BIOS support is present */ - UINT32_BIT Reserved1 : 31; /* must be 0 */ - UINT8 Reserved3 [28]; /* reserved - must be zero */ - -} FACS_DESCRIPTOR_REV071; - - -/******************************************/ -/* IA64 Extensions to ACPI Spec Rev 0.71 */ -/* for the Fixed ACPI Description Table */ -/******************************************/ -typedef struct -{ - ACPI_TABLE_HEADER header; /* table header */ - UINT32 ReservedPad; /* IA64 alignment, must be 0 */ - UINT64 FirmwareCtrl; /* 64-bit Physical address of FACS */ - UINT64 Dsdt; /* 64-bit Physical address of DSDT */ - UINT8 Model; /* System Interrupt Model */ - UINT8 AddressSpace; /* Address Space Bitmask */ - UINT16 SciInt; /* System vector of SCI interrupt */ - UINT8 AcpiEnable; /* value to write to smi_cmd to enable ACPI */ - UINT8 AcpiDisable; /* value to write to smi_cmd to disable ACPI */ - UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */ - UINT8 Reserved2; /* reserved - must be zero */ - UINT64 SmiCmd; /* Port address of SMI command port */ - UINT64 Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */ - UINT64 Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */ - UINT64 Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */ - UINT64 Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */ - UINT64 Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */ - UINT64 PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ - UINT64 Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */ - UINT64 Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */ - UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */ - UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */ - UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */ - UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */ - UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */ - UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */ - UINT8 Gpe1Base; /* offset in gpe model where gpe1 events start */ - UINT8 Reserved3; /* reserved */ - UINT16 Plvl2Lat; /* worst case HW latency to enter/exit C2 state */ - UINT16 Plvl3Lat; /* worst case HW latency to enter/exit C3 state */ - UINT8 DayAlrm; /* index to day-of-month alarm in RTC CMOS RAM */ - UINT8 MonAlrm; /* index to month-of-year alarm in RTC CMOS RAM */ - UINT8 Century; /* index to century in RTC CMOS RAM */ - UINT8 Reserved4; /* reserved */ - UINT32_BIT FlushCash : 1; /* PAL_FLUSH_CACHE is correctly supported */ - UINT32_BIT Reserved5 : 1; /* reserved - must be zero */ - UINT32_BIT ProcC1 : 1; /* all processors support C1 state */ - UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */ - UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */ - UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */ - UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */ - UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */ - UINT32_BIT TmrValExt : 1; /* tmr_val is 32 bits */ - UINT32_BIT DockCap : 1; /* Supports Docking */ - UINT32_BIT Reserved6 : 22; /* reserved - must be zero */ - -} FADT_DESCRIPTOR_REV071; - -#pragma pack() - -#endif /* __ACTBL71_H__ */ - diff --git a/sys/dev/acpi/acpica/Subsystem/acwin.h b/sys/dev/acpi/acpica/Subsystem/acwin.h deleted file mode 100644 index b03bd86dbf1..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/acwin.h +++ /dev/null @@ -1,194 +0,0 @@ -/****************************************************************************** - * - * Name: acwin.h - OS specific defines, etc. - * $Revision: 1.1.1.3 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#ifndef __ACWIN_H__ -#define __ACWIN_H__ - -/*! [Begin] no source code translation (Keep the include) */ - -/* Windows uses VC */ -#ifdef _MSC_VER -#include "acmsvc.h" -#endif -/*! [End] no source code translation !*/ - -#define ACPI_OS_NAME "Windows" - -#define ACPI_MACHINE_WIDTH 32 - -#define strupr _strupr -#define isascii __isascii - -#define ACPI_USE_STANDARD_HEADERS - -/* - * Handle platform- and compiler-specific assembly language differences. - * - * Notes: - * 1) Interrupt 3 is used to break into a debugger - * 2) Interrupts are turned off during ACPI register setup - */ - -/*! [Begin] no source code translation */ - -#define ACPI_ASM_MACROS -#define BREAKPOINT3 __asm {int 3} -#define ACPI_DISABLE_IRQS() __asm {cli} -#define ACPI_ENABLE_IRQS() __asm {sti} -#define ACPI_FLUSH_CPU_CACHE() __asm {WBINVD} - - -/* - * For Acpi applications, we don't want to try to access the global lock - */ -#ifdef ACPI_APPLICATION -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) if (AcpiGbl_GlobalLockPresent) Acq = TRUE; -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) Pnd = 0; -#else -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) __asm { \ - __asm mov ecx, GLptr \ - __asm acq10: \ - __asm mov eax, [ecx] \ - __asm mov edx, eax \ - __asm and edx, 0xFFFFFFFE \ - __asm bts edx, 1 \ - __asm adc edx, 0 \ - __asm lock cmpxchg dword ptr [ecx], edx \ - __asm jnz acq10 \ - \ - __asm cmp dl, 3 \ - __asm sbb eax, eax \ - __asm mov Acq, al \ -} - -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) __asm { \ - __asm mov ecx, GLptr \ - __asm Rel10: \ - __asm mov eax, [ecx] \ - __asm mov edx, eax \ - __asm and edx, 0xFFFFFFFC \ - __asm lock cmpxchg dword ptr [ecx], edx \ - __asm jnz Rel10 \ - \ - __asm cmp dl, 3 \ - __asm and eax, 1 \ - __asm mov Pnd, al \ -} - -#endif - - -#endif /* __ACWIN_H__ */ diff --git a/sys/dev/acpi/acpica/Subsystem/acwin64.h b/sys/dev/acpi/acpica/Subsystem/acwin64.h deleted file mode 100644 index 9e888b22458..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/acwin64.h +++ /dev/null @@ -1,165 +0,0 @@ -/****************************************************************************** - * - * Name: acwin.h - OS specific defines, etc. - * $Revision: 1.1.1.2 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#ifndef __ACWIN64_H__ -#define __ACWIN64_H__ - -/*! [Begin] no source code translation (Keep the include) */ - -#include "acintel.h" -/*! [End] no source code translation !*/ - -#define ACPI_OS_NAME "Windows" - -#define ACPI_MACHINE_WIDTH 64 - -#define strupr _strupr -#define ACPI_USE_STANDARD_HEADERS - -/* - * Handle platform- and compiler-specific assembly language differences. - * - * Notes: - * 1) Interrupt 3 is used to break into a debugger - * 2) Interrupts are turned off during ACPI register setup - */ - -/*! [Begin] no source code translation */ - -#define ACPI_ASM_MACROS -#define causeinterrupt(level) -#define BREAKPOINT3 -#define ACPI_DISABLE_IRQS() -#define ACPI_ENABLE_IRQS() -#define ACPI_FLUSH_CPU_CACHE() - - -/* - * For Acpi applications, we don't want to try to access the global lock - */ -#ifdef ACPI_APPLICATION -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) if (AcpiGbl_GlobalLockPresent) {Acq = 0xFF;} else {Acq = 0;} -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) if (AcpiGbl_GlobalLockPresent) {Pnd = 0xFF;} else {Pnd = 0;} -#else - -#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acq) - -#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pnd) - -#endif - - -#endif /* __ACWIN_H__ */ diff --git a/sys/dev/acpi/acpica/Subsystem/adisasm.c b/sys/dev/acpi/acpica/Subsystem/adisasm.c deleted file mode 100644 index 05f78f59567..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/adisasm.c +++ /dev/null @@ -1,1045 +0,0 @@ -/****************************************************************************** - * - * Module Name: adisasm - Application-level disassembler routines - * $Revision: 55 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "acpi.h" -#include "acparser.h" -#include "amlcode.h" -#include "acdebug.h" -#include "acdisasm.h" -#include "acdispat.h" -#include "acnamesp.h" -#include "acapps.h" - -#include <stdio.h> -#include <string.h> -#include <time.h> - - -#define _COMPONENT ACPI_TOOLS - ACPI_MODULE_NAME ("adisasm") - - -ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot; - - -#ifndef _ACPI_ASL_COMPILER -BOOLEAN -AcpiDsIsResultUsed ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - return TRUE; -} -#endif - - -ACPI_STATUS -AcpiDsRestartControlMethod ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ReturnDesc) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsTerminateControlMethod ( - ACPI_WALK_STATE *WalkState) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsCallControlMethod ( - ACPI_THREAD_STATE *Thread, - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsMethodDataInitArgs ( - ACPI_OPERAND_OBJECT **Params, - UINT32 MaxParamCount, - ACPI_WALK_STATE *WalkState) -{ - return (AE_OK); -} - - -#define FILE_SUFFIX_DISASSEMBLY "dsl" -#define ACPI_TABLE_FILE_SUFFIX ".dat" -char FilenameBuf[20]; - -/****************************************************************************** - * - * FUNCTION: AfGenerateFilename - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: Build an output filename from an ACPI table ID string - * - ******************************************************************************/ - -char * -AdGenerateFilename ( - char *Prefix, - char *TableId) -{ - ACPI_NATIVE_UINT i; - ACPI_NATIVE_UINT j; - - - for (i = 0; Prefix[i]; i++) - { - FilenameBuf[i] = Prefix[i]; - } - - FilenameBuf[i] = '_'; - i++; - - for (j = 0; j < 8 && (TableId[j] != ' ') && (TableId[j] != 0); i++, j++) - { - FilenameBuf[i] = TableId[j]; - } - - FilenameBuf[i] = 0; - strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX); - return FilenameBuf; -} - - -/****************************************************************************** - * - * FUNCTION: AfWriteBuffer - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: Open a file and write out a single buffer - * - ******************************************************************************/ - -ACPI_NATIVE_INT -AdWriteBuffer ( - char *Filename, - char *Buffer, - UINT32 Length) -{ - FILE *fp; - ACPI_NATIVE_INT Actual; - - - fp = fopen (Filename, "wb"); - if (!fp) - { - printf ("Couldn't open %s\n", Filename); - return -1; - } - - Actual = fwrite (Buffer, (size_t) Length, 1, fp); - fclose (fp); - return Actual; -} - - -/****************************************************************************** - * - * FUNCTION: AfWriteTable - * - * PARAMETERS: - * - * RETURN: - * - * DESCRIPTION: Dump the loaded tables to a file (or files) - * - ******************************************************************************/ - -void -AdWriteTable ( - ACPI_TABLE_HEADER *Table, - UINT32 Length, - char *TableName, - char *OemTableId) -{ - char *Filename; - - - Filename = AdGenerateFilename (TableName, OemTableId); - AdWriteBuffer (Filename, (char *) Table, Length); - - AcpiOsPrintf ("Table [%s] written to \"%s\"\n", TableName, Filename); -} - - -/******************************************************************************* - * - * FUNCTION: AdInitialize - * - * PARAMETERS: None. - * - * RETURN: Status - * - * DESCRIPTION: CA initialization - * - ******************************************************************************/ - -ACPI_STATUS -AdInitialize ( - void) -{ - ACPI_STATUS Status; - - - /* ACPI CA subsystem initialization */ - - AcpiUtInitGlobals (); - Status = AcpiUtMutexInitialize (); - if (ACPI_FAILURE (Status)) - { - return Status; - } - - Status = AcpiNsRootInitialize (); - return Status; -} - - -/******************************************************************************* - * - * FUNCTION: FlGenerateFilename - * - * PARAMETERS: InputFilename - Original ASL source filename - * Suffix - New extension. - * - * RETURN: New filename containing the original base + the new suffix - * - * DESCRIPTION: Generate a new filename from the ASL source filename and a new - * extension. Used to create the *.LST, *.TXT, etc. files. - * - ******************************************************************************/ - -char * -FlGenerateFilename ( - char *InputFilename, - char *Suffix) -{ - char *Position; - char *NewFilename; - - - /* Copy the original filename to a new buffer */ - - NewFilename = ACPI_MEM_CALLOCATE (strlen (InputFilename) + strlen (Suffix)); - strcpy (NewFilename, InputFilename); - - /* Try to find the last dot in the filename */ - - Position = strrchr (NewFilename, '.'); - if (Position) - { - /* Tack on the new suffix */ - - Position++; - *Position = 0; - strcat (Position, Suffix); - } - else - { - /* No dot, add one and then the suffix */ - - strcat (NewFilename, "."); - strcat (NewFilename, Suffix); - } - - return NewFilename; -} - - -/******************************************************************************* - * - * FUNCTION: FlSplitInputPathname - * - * PARAMETERS: InputFilename - The user-specified ASL source file to be - * compiled - * - * RETURN: Status - * - * DESCRIPTION: Split the input path into a directory and filename part - * 1) Directory part used to open include files - * 2) Filename part used to generate output filenames - * - ******************************************************************************/ - -ACPI_STATUS -FlSplitInputPathname ( - char *InputPath, - char **OutDirectoryPath, - char **OutFilename) -{ - char *Substring; - char *DirectoryPath; - char *Filename; - - - *OutDirectoryPath = NULL; - *OutFilename = NULL; - - if (!InputPath) - { - return (AE_OK); - } - - /* Get the path to the input filename's directory */ - - DirectoryPath = strdup (InputPath); - if (!DirectoryPath) - { - return (AE_NO_MEMORY); - } - - Substring = strrchr (DirectoryPath, '\\'); - if (!Substring) - { - Substring = strrchr (DirectoryPath, '/'); - if (!Substring) - { - Substring = strrchr (DirectoryPath, ':'); - } - } - - if (!Substring) - { - DirectoryPath[0] = 0; - Filename = strdup (InputPath); - } - else - { - Filename = strdup (Substring + 1); - *(Substring+1) = 0; - } - - if (!Filename) - { - return (AE_NO_MEMORY); - } - - *OutDirectoryPath = DirectoryPath; - *OutFilename = Filename; - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AdAmlDisassemble - * - * PARAMETERS: OutToFile - TRUE if output should go to a file - * Filename - AML input filename - * - * RETURN: Status - * - * DESCRIPTION: Disassemble an entire ACPI table - * - *****************************************************************************/ - -ACPI_STATUS -AdAmlDisassemble ( - BOOLEAN OutToFile, - char *Filename, - char *Prefix, - char **OutFilename, - BOOLEAN GetAllTables) -{ - ACPI_STATUS Status; - char *DisasmFilename = NULL; - FILE *File = NULL; - ACPI_TABLE_HEADER *Table; - - - /* - * Input: AML Code from either a file, - * or via GetTables (memory or registry) - */ - if (Filename) - { - Status = AcpiDbGetTableFromFile (Filename, &Table); - if (ACPI_FAILURE (Status)) - { - return Status; - } - } - else - { - Status = AdGetLocalTables (Filename, GetAllTables); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not get ACPI tables, %s\n", - AcpiFormatException (Status)); - return Status; - } - - if (!AcpiGbl_DbOpt_disasm) - { - return AE_OK; - } - - /* Obtained the local tables, just disassmeble the DSDT */ - - Table = AcpiGbl_DSDT; - AcpiOsPrintf ("\nDisassembly of DSDT\n"); - Prefix = AdGenerateFilename ("dsdt", AcpiGbl_DSDT->OemTableId); - } - - /* - * Output: ASL code. - * Redirect to a file if requested - */ - if (OutToFile) - { - /* Create/Open a disassembly output file */ - - DisasmFilename = FlGenerateFilename (Prefix, FILE_SUFFIX_DISASSEMBLY); - if (!OutFilename) - { - fprintf (stderr, "Could not generate output filename\n"); - } - - File = fopen (DisasmFilename, "w+"); - if (!File) - { - fprintf (stderr, "Could not open output file\n"); - } - - AcpiOsRedirectOutput (File); - } - - *OutFilename = DisasmFilename; - - /* Always parse the tables, only option is what to display */ - - Status = AdParseTable (Table); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Could not parse ACPI tables, %s\n", - AcpiFormatException (Status)); - goto Cleanup; - } - - /* Optional displays */ - - if (AcpiGbl_DbOpt_disasm) - { - AdDisplayTables (Filename, Table); - fprintf (stderr, "Disassembly completed, written to \"%s\"\n", DisasmFilename); - } - -Cleanup: - if (OutToFile) - { - fclose (File); - AcpiOsRedirectOutput (stdout); - } - - AcpiPsDeleteParseTree (AcpiGbl_ParsedNamespaceRoot); - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AdCreateTableHeader - * - * PARAMETERS: Filename - Input file for the table - * Table - Pointer to the raw table - * - * RETURN: None - * - * DESCRIPTION: Create the ASL table header, including ACPI CA signon with - * current time and date. - * - *****************************************************************************/ - -void -AdCreateTableHeader ( - char *Filename, - ACPI_TABLE_HEADER *Table) -{ - time_t Timer; - - - time (&Timer); - - AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n"); - AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION); - AcpiOsPrintf (" *\n * Disassembly of %s, %s */\n", Filename, ctime (&Timer)); - - AcpiOsPrintf ( - "DefinitionBlock (\"%4.4s.aml\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", %d)\n", - Table->Signature, Table->Signature, Table->Revision, - Table->OemId, Table->OemTableId, Table->OemRevision); -} - - -/****************************************************************************** - * - * FUNCTION: AdDisplayTables - * - * PARAMETERS: Filename - Input file for the table - * - * RETURN: Status - * - * DESCRIPTION: Display (disassemble) loaded tables and dump raw tables - * - *****************************************************************************/ - -ACPI_STATUS -AdDisplayTables ( - char *Filename, - ACPI_TABLE_HEADER *Table) -{ - - - if (!AcpiGbl_ParsedNamespaceRoot) - { - return AE_NOT_EXIST; - } - - if (!AcpiGbl_DbOpt_verbose) - { - AdCreateTableHeader (Filename, Table); - } - - AcpiDmDisassemble (NULL, AcpiGbl_ParsedNamespaceRoot, ACPI_UINT32_MAX); - - if (AcpiGbl_DbOpt_verbose) - { - AcpiOsPrintf ("\n\nTable Header:\n"); - AcpiUtDumpBuffer ((UINT8 *) Table, sizeof (ACPI_TABLE_HEADER), - DB_BYTE_DISPLAY, ACPI_UINT32_MAX); - - AcpiOsPrintf ("Table Body (Length 0x%X)\n", Table->Length); - AcpiUtDumpBuffer (((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)), Table->Length, - DB_BYTE_DISPLAY, ACPI_UINT32_MAX); - } - - return AE_OK; -} - - - -/****************************************************************************** - * - * FUNCTION: AdDeferredParse - * - * PARAMETERS: Op - Root Op of the deferred opcode - * Aml - Pointer to the raw AML - * AmlLength - Length of the AML - * - * RETURN: Status - * - * DESCRIPTION: Parse one deferred opcode - * (Methods, operation regions, etc.) - * - *****************************************************************************/ - -ACPI_STATUS -AdDeferredParse ( - ACPI_PARSE_OBJECT *Op, - UINT8 *Aml, - UINT32 AmlLength) -{ - ACPI_WALK_STATE *WalkState; - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *SearchOp; - ACPI_PARSE_OBJECT *StartOp; - UINT32 BaseAmlOffset; - ACPI_PARSE_OBJECT *ExtraOp; - - - ACPI_FUNCTION_TRACE ("AdDeferredParse"); - - - fprintf (stderr, "."); - - if (!Aml || !AmlLength) - { - return_ACPI_STATUS (AE_OK); - } - - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Parsing %s [%4.4s]\n", - Op->Common.AmlOpName, (char *) &Op->Named.Name)); - - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, Op, NULL, NULL); - if (!WalkState) - { - return_ACPI_STATUS (AE_NO_MEMORY); - } - - Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml, - AmlLength, NULL, NULL, 1); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - - /* Parse the method */ - - WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; - Status = AcpiPsParseAml (WalkState); - - /* - * We need to update all of the Aml offsets, since the parser thought - * that the method began at offset zero. In reality, it began somewhere - * within the ACPI table, at the BaseAmlOffset. Walk the entire tree that - * was just created and update the AmlOffset in each Op - */ - BaseAmlOffset = (Op->Common.Value.Arg)->Common.AmlOffset + 1; - StartOp = (Op->Common.Value.Arg)->Common.Next; - SearchOp = StartOp; - - /* Walk the parse tree */ - - while (SearchOp) - { - SearchOp->Common.AmlOffset += BaseAmlOffset; - SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); - } - - /* - * Link the newly parsed subtree into the main parse tree - */ - switch (Op->Common.AmlOpcode) - { - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - switch (Op->Common.AmlOpcode) - { - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - ExtraOp = Op->Common.Value.Arg; - ExtraOp = ExtraOp->Common.Next; - Op->Common.Value.Arg = ExtraOp->Common.Value.Arg; - break; - - case AML_BUFFER_OP: - default: - ExtraOp = Op->Common.Value.Arg; - Op->Common.Value.Arg = ExtraOp->Common.Value.Arg; - break; - } - - /* Must point all parents to the main tree */ - - StartOp = Op; - SearchOp = StartOp; - while (SearchOp) - { - if (SearchOp->Common.Parent == ExtraOp) - { - SearchOp->Common.Parent = Op; - } - SearchOp = AcpiPsGetDepthNext (StartOp, SearchOp); - } - break; - - default: - break; - } - - return_ACPI_STATUS (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AdParseDeferredOps - * - * PARAMETERS: Root - Root of the parse tree - * - * RETURN: Status - * - * DESCRIPTION: Parse the deferred opcodes (Methods, regions, etc.) - * - *****************************************************************************/ - -ACPI_STATUS -AdParseDeferredOps ( - ACPI_PARSE_OBJECT *Root) -{ - ACPI_PARSE_OBJECT *Op = Root; - ACPI_STATUS Status = AE_OK; - const ACPI_OPCODE_INFO *OpInfo; - - - ACPI_FUNCTION_NAME ("AdParseDeferredOps"); - fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n"); - - while (Op) - { - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (!(OpInfo->Flags & AML_DEFER)) - { - Op = AcpiPsGetDepthNext (Root, Op); - continue; - } - - switch (Op->Common.AmlOpcode) - { - case AML_METHOD_OP: - case AML_BUFFER_OP: - case AML_PACKAGE_OP: - case AML_VAR_PACKAGE_OP: - - Status = AdDeferredParse (Op, Op->Named.Data, Op->Named.Length); - if (ACPI_FAILURE (Status)) - { - return_ACPI_STATUS (Status); - } - break; - - case AML_REGION_OP: - case AML_CREATE_QWORD_FIELD_OP: - case AML_CREATE_DWORD_FIELD_OP: - case AML_CREATE_WORD_FIELD_OP: - case AML_CREATE_BYTE_FIELD_OP: - case AML_CREATE_BIT_FIELD_OP: - case AML_CREATE_FIELD_OP: - - /* Nothing to do in these cases */ - - break; - - default: - ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unhandled deferred opcode [%s]\n", - Op->Common.AmlOpName)); - break; - } - - Op = AcpiPsGetDepthNext (Root, Op); - } - - fprintf (stderr, "\n"); - return Status; -} - - -/****************************************************************************** - * - * FUNCTION: AdGetLocalTables - * - * PARAMETERS: - * - * RETURN: None - * - * DESCRIPTION: Get the ACPI tables from either memory or a file - * - *****************************************************************************/ - -ACPI_STATUS -AdGetLocalTables ( - char *Filename, - BOOLEAN GetAllTables) -{ - ACPI_STATUS Status; - ACPI_TABLE_HEADER TableHeader; - ACPI_TABLE_HEADER *NewTable; - UINT32 NumTables; - UINT32 PointerSize; - - - - if (GetAllTables) - { - ACPI_STRNCPY (TableHeader.Signature, "RSDT", 4); - AcpiOsTableOverride (&TableHeader, &NewTable); - -#if ACPI_MACHINE_WIDTH != 64 - - if (!ACPI_STRNCMP (NewTable->Signature, "RSDT", 4)) - { - PointerSize = sizeof (UINT32); - } - else -#endif - { - PointerSize = sizeof (UINT64); - } - - /* - * Determine the number of tables pointed to by the RSDT/XSDT. - * This is defined by the ACPI Specification to be the number of - * pointers contained within the RSDT/XSDT. The size of the pointers - * is architecture-dependent. - */ - NumTables = (NewTable->Length - sizeof (ACPI_TABLE_HEADER)) / PointerSize; - AcpiOsPrintf ("There are %d tables defined in the %4.4s\n\n", - NumTables, NewTable->Signature); - - /* Get the FADT */ - - ACPI_STRNCPY (TableHeader.Signature, "FADT", 4); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (NewTable) - { - AcpiGbl_FADT = (void *) NewTable; - AdWriteTable (NewTable, NewTable->Length, - "FADT", NewTable->OemTableId); - } - AcpiOsPrintf ("\n"); - - /* Get the FACS */ - - ACPI_STRNCPY (TableHeader.Signature, "FACS", 4); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (NewTable) - { - AcpiGbl_FACS = (void *) NewTable; - AdWriteTable (NewTable, AcpiGbl_FACS->Length, - "FACS", AcpiGbl_FADT->Header.OemTableId); - } - AcpiOsPrintf ("\n"); - } - - /* Always get the DSDT */ - - ACPI_STRNCPY (TableHeader.Signature, DSDT_SIG, 4); - AcpiOsTableOverride (&TableHeader, &NewTable); - if (NewTable) - { - Status = AE_OK; - AcpiGbl_DSDT = NewTable; - AdWriteTable (AcpiGbl_DSDT, AcpiGbl_DSDT->Length, - "DSDT", AcpiGbl_DSDT->OemTableId); - } - else - { - fprintf (stderr, "Could not obtain DSDT\n"); - Status = AE_NO_ACPI_TABLES; - } - - AcpiOsPrintf ("\n"); - - /* Get all SSDTs */ - - ACPI_STRNCPY (TableHeader.Signature, SSDT_SIG, 4); - Status = AcpiOsTableOverride (&TableHeader, &NewTable); - if (NewTable) - { - while (NewTable) - { - Status = AcpiOsTableOverride (&TableHeader, &NewTable); - } - } - - return Status; -} - -/****************************************************************************** - * - * FUNCTION: AdParseTable - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Parse the DSDT. - * - *****************************************************************************/ - -ACPI_STATUS -AdParseTable ( - ACPI_TABLE_HEADER *Table) -{ - ACPI_STATUS Status = AE_OK; - ACPI_WALK_STATE *WalkState; - ACPI_TABLE_DESC TableDesc; - UINT8 *AmlStart; - UINT32 AmlLength; - - - if (!Table) - { - return AE_NOT_EXIST; - } - - /* Pass 1: Parse everything except control method bodies */ - - fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature); - - AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER); - AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER)); - - /* Create the root object */ - - AcpiGbl_ParsedNamespaceRoot = AcpiPsCreateScopeOp (); - if (!AcpiGbl_ParsedNamespaceRoot) - { - return AE_NO_MEMORY; - } - - /* Create and initialize a new walk state */ - - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, - AcpiGbl_ParsedNamespaceRoot, NULL, NULL); - if (!WalkState) - { - return (AE_NO_MEMORY); - } - - Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParsedNamespaceRoot, - NULL, AmlStart, AmlLength, NULL, NULL, 1); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE; - - Status = AcpiPsParseAml (WalkState); - if (ACPI_FAILURE (Status)) - { - return Status; - } - - /* Pass 2 */ - - TableDesc.AmlStart = AmlStart; - TableDesc.AmlLength = AmlLength; - fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature); - - Status = AcpiNsOneCompleteParse (2, &TableDesc); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* Pass 3: Parse control methods and link their parse trees into the main parse tree */ - - Status = AdParseDeferredOps (AcpiGbl_ParsedNamespaceRoot); - - fprintf (stderr, "Parsing completed\n"); - return AE_OK; -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/adisasm.h b/sys/dev/acpi/acpica/Subsystem/adisasm.h deleted file mode 100644 index c5099cc3889..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/adisasm.h +++ /dev/null @@ -1,183 +0,0 @@ -/****************************************************************************** - * - * Module Name: adisasm - AML disassembler - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2002, 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. - * - *****************************************************************************/ - -#ifndef _ADISASM -#define _ADISASM - - -#ifdef _MSC_VER /* disable some level-4 warnings */ -#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */ - -int -getopt ( - int argc, - char **argv, - char *opts); -#endif - - -extern UINT8 *DsdtPtr; -extern UINT32 AcpiDsdtLength; -extern int optind; -extern char *optarg; -extern UINT8 *AmlStart; -extern UINT32 AmlLength; - - -ACPI_STATUS -AdInitialize ( - void); - -char * -FlGenerateFilename ( - char *InputFilename, - char *Suffix); - -ACPI_STATUS -AdAmlDisassemble ( - BOOLEAN OutToFile, - char *Filename, - char **OutFilename); - -void -AdPrintStatistics (void); - - -ACPI_STATUS -AdFindDsdt( - UINT8 **DsdtPtr, - UINT32 *DsdtLength); - -void -AdDumpTables (void); - - -ACPI_STATUS -AdGetTables ( - char *Filename); - -ACPI_STATUS -AdParseTables (void); - -ACPI_STATUS -AdDisplayTables ( - char *Filename); - -ACPI_STATUS -AdDisplayStatistics (void); - - -#endif - diff --git a/sys/dev/acpi/acpica/Subsystem/ascase.c b/sys/dev/acpi/acpica/Subsystem/ascase.c deleted file mode 100644 index 82d1ad1ce97..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/ascase.c +++ /dev/null @@ -1,553 +0,0 @@ - -/****************************************************************************** - * - * Module Name: ascase - Source conversion - lower/upper case utilities - * $Revision: 7 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#include "acpisrc.h" - - -/****************************************************************************** - * - * FUNCTION: AsLowerCaseString - * - * DESCRIPTION: LowerCase all instances of a target string with a replacement - * string. Returns count of the strings replaced. - * - ******************************************************************************/ - -int -AsLowerCaseString ( - char *Target, - char *Buffer) -{ - char *SubString1; - char *SubString2; - char *SubBuffer; - int TargetLength; - int LowerCaseCount = 0; - int i; - - - TargetLength = strlen (Target); - - SubBuffer = Buffer; - SubString1 = Buffer; - - while (SubString1) - { - /* Find the target string */ - - SubString1 = strstr (SubBuffer, Target); - if (!SubString1) - { - return LowerCaseCount; - } - - /* - * Check for translation escape string -- means to ignore - * blocks of code while replacing - */ - SubString2 = strstr (SubBuffer, "/*!"); - - if ((SubString2) && - (SubString2 < SubString1)) - { - /* Find end of the escape block starting at "Substring2" */ - - SubString2 = strstr (SubString2, "!*/"); - if (!SubString2) - { - /* Didn't find terminator */ - - return LowerCaseCount; - } - - /* Move buffer to end of escape block and continue */ - - SubBuffer = SubString2; - } - - /* Do the actual replace if the target was found */ - - else - { - if (!AsMatchExactWord (SubString1, TargetLength)) - { - SubBuffer = SubString1 + 1; - continue; - } - - for (i = 0; i < TargetLength; i++) - { - SubString1[i] = (char) tolower (SubString1[i]); - } - - SubBuffer = SubString1 + TargetLength; - - if (Gbl_WidenDeclarations) - { - if ((SubBuffer[0] == ' ') && (SubBuffer[1] == ' ')) - { - AsInsertData (SubBuffer, " ", 8); - } - } - - LowerCaseCount++; - } - } - - return LowerCaseCount; -} - - -/****************************************************************************** - * - * FUNCTION: AsMixedCaseToUnderscores - * - * DESCRIPTION: Converts mixed case identifiers to underscored identifiers. - * for example, - * - * ThisUsefullyNamedIdentifier becomes: - * - * this_usefully_named_identifier - * - ******************************************************************************/ - -void -AsMixedCaseToUnderscores ( - char *Buffer) -{ - UINT32 Length; - char *SubBuffer = Buffer; - char *TokenEnd; - char *TokenStart = NULL; - char *SubString; - - - while (*SubBuffer) - { - /* - * Check for translation escape string -- means to ignore - * blocks of code while replacing - */ - if ((SubBuffer[0] == '/') && - (SubBuffer[1] == '*') && - (SubBuffer[2] == '!')) - { - SubBuffer = strstr (SubBuffer, "!*/"); - if (!SubBuffer) - { - return; - } - } - - /* Ignore hex constants */ - - if (SubBuffer[0] == '0') - { - if ((SubBuffer[1] == 'x') || - (SubBuffer[1] == 'X')) - { - SubBuffer += 2; - while (isxdigit (*SubBuffer)) - { - SubBuffer++; - } - continue; - } - } - - /* Ignore format specification fields */ - - if (SubBuffer[0] == '%') - { - SubBuffer++; - - while ((isalnum (*SubBuffer)) || - (*SubBuffer == '.')) - { - SubBuffer++; - } - - continue; - } - - /* Ignore standard escape sequences (\n, \r, etc.) Not Hex or Octal escapes */ - - if (SubBuffer[0] == '\\') - { - SubBuffer += 2; - continue; - } - - /* A capital letter may indicate the start of a token; save it */ - - if (isupper (SubBuffer[0])) - { - TokenStart = SubBuffer; - } - - /* - * Convert each pair of letters that matches the form: - * - * <LowerCase><UpperCase> - * to - * <LowerCase><Underscore><LowerCase> - */ - else if ((islower (SubBuffer[0]) || isdigit (SubBuffer[0])) && - (isupper (SubBuffer[1]))) - { - if (isdigit (SubBuffer[0])) - { - /* Ignore <UpperCase><Digit><UpperCase> */ - /* Ignore <Underscore><Digit><UpperCase> */ - - if (isupper (*(SubBuffer-1)) || - *(SubBuffer-1) == '_') - { - SubBuffer++; - continue; - } - } - - /* - * Matched the pattern. - * Find the end of this identifier (token) - */ - TokenEnd = SubBuffer; - while ((isalnum (*TokenEnd)) || (*TokenEnd == '_')) - { - TokenEnd++; - } - - /* Force the UpperCase letter (#2) to lower case */ - - Gbl_MadeChanges = TRUE; - SubBuffer[1] = (char) tolower (SubBuffer[1]); - - SubString = TokenEnd; - Length = 0; - - while (*SubString != '\n') - { - /* - * If we have at least two trailing spaces, we can get rid of - * one to make up for the newly inserted underscore. This will - * help preserve the alignment of the text - */ - if ((SubString[0] == ' ') && - (SubString[1] == ' ')) - { - Length = SubString - SubBuffer - 2; - break; - } - - SubString++; - } - - if (!Length) - { - Length = strlen (&SubBuffer[1]); - } - - memmove (&SubBuffer[2], &SubBuffer[1], (Length+1)); - SubBuffer[1] = '_'; - SubBuffer +=2; - - /* Lower case the leading character of the token */ - - if (TokenStart) - { - *TokenStart = (char) tolower (*TokenStart); - TokenStart = NULL; - } - } - - SubBuffer++; - } -} - - -/****************************************************************************** - * - * FUNCTION: AsLowerCaseIdentifiers - * - * DESCRIPTION: Converts mixed case identifiers to lower case. Leaves comments, - * quoted strings, and all-upper-case macros alone. - * - ******************************************************************************/ - -void -AsLowerCaseIdentifiers ( - char *Buffer) -{ - char *SubBuffer = Buffer; - - - while (*SubBuffer) - { - /* - * Check for translation escape string -- means to ignore - * blocks of code while replacing - */ - if ((SubBuffer[0] == '/') && - (SubBuffer[1] == '*') && - (SubBuffer[2] == '!')) - { - SubBuffer = strstr (SubBuffer, "!*/"); - if (!SubBuffer) - { - return; - } - } - - /* Ignore comments */ - - if ((SubBuffer[0] == '/') && - (SubBuffer[1] == '*')) - { - SubBuffer = strstr (SubBuffer, "*/"); - if (!SubBuffer) - { - return; - } - - SubBuffer += 2; - } - - /* Ignore quoted strings */ - - if ((SubBuffer[0] == '\"') && (SubBuffer[1] != '\'')) - { - SubBuffer++; - - /* Find the closing quote */ - - while (SubBuffer[0]) - { - /* Ignore escaped quote characters */ - - if (SubBuffer[0] == '\\') - { - SubBuffer++; - } - else if (SubBuffer[0] == '\"') - { - SubBuffer++; - break; - } - SubBuffer++; - } - } - - if (!SubBuffer[0]) - { - return; - } - - /* - * Only lower case if we have an upper followed by a lower - * This leaves the all-uppercase things (macros, etc.) intact - */ - if ((isupper (SubBuffer[0])) && - (islower (SubBuffer[1]))) - { - Gbl_MadeChanges = TRUE; - *SubBuffer = (char) tolower (*SubBuffer); - } - - SubBuffer++; - } -} - - -/****************************************************************************** - * - * FUNCTION: AsUppercaseTokens - * - * DESCRIPTION: Force to uppercase all tokens that begin with the prefix string. - * used to convert mixed-case macros and constants to uppercase. - * - ******************************************************************************/ - -void -AsUppercaseTokens ( - char *Buffer, - char *PrefixString) -{ - char *SubBuffer; - char *TokenEnd; - char *SubString; - int i; - UINT32 Length; - - - SubBuffer = Buffer; - - while (SubBuffer) - { - SubBuffer = strstr (SubBuffer, PrefixString); - if (SubBuffer) - { - TokenEnd = SubBuffer; - while ((isalnum (*TokenEnd)) || (*TokenEnd == '_')) - { - TokenEnd++; - } - - for (i = 0; i < (TokenEnd - SubBuffer); i++) - { - if ((islower (SubBuffer[i])) && - (isupper (SubBuffer[i+1]))) - { - - SubString = TokenEnd; - Length = 0; - - while (*SubString != '\n') - { - if ((SubString[0] == ' ') && - (SubString[1] == ' ')) - { - Length = SubString - &SubBuffer[i] - 2; - break; - } - - SubString++; - } - - if (!Length) - { - Length = strlen (&SubBuffer[i+1]); - } - - memmove (&SubBuffer[i+2], &SubBuffer[i+1], (Length+1)); - SubBuffer[i+1] = '_'; - i +=2; - TokenEnd++; - } - } - - for (i = 0; i < (TokenEnd - SubBuffer); i++) - { - SubBuffer[i] = (char) toupper (SubBuffer[i]); - } - - SubBuffer = TokenEnd; - } - } -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/asconvrt.c b/sys/dev/acpi/acpica/Subsystem/asconvrt.c deleted file mode 100644 index 1b92ceb72fe..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asconvrt.c +++ /dev/null @@ -1,1344 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asconvrt - Source conversion code - * $Revision: 46 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#include "acpisrc.h" - - -/* Opening signature of the Intel legal header */ - -char *HeaderBegin = "/******************************************************************************\n *\n * 1. Copyright Notice"; - - -/****************************************************************************** - * - * FUNCTION: AsMatchExactWord - * - * DESCRIPTION: Check previous and next characters for whitespace - * - ******************************************************************************/ - -BOOLEAN -AsMatchExactWord ( - char *Word, - UINT32 WordLength) -{ - char NextChar; - char PrevChar; - - - NextChar = Word[WordLength]; - PrevChar = * (Word -1); - - if (isalnum (NextChar) || - (NextChar == '_') || - isalnum (PrevChar) || - (PrevChar == '_')) - { - return (FALSE); - } - - return (TRUE); -} - - -/****************************************************************************** - * - * FUNCTION: AsPrint - * - * DESCRIPTION: Common formatted print - * - ******************************************************************************/ - -void -AsPrint ( - char *Message, - UINT32 Count, - char *Filename) -{ - - - printf ("-- %4u %28.28s : %s\n", Count, Message, Filename); -} - - -/****************************************************************************** - * - * FUNCTION: AsCheckAndSkipLiterals - * - * DESCRIPTION: Generic routine to skip comments and quoted string literals. - * Keeps a line count. - * - ******************************************************************************/ - -char * -AsCheckAndSkipLiterals ( - char *Buffer, - UINT32 *TotalLines) -{ - UINT32 NewLines = 0; - char *SubBuffer = Buffer; - char *LiteralEnd; - - - /* Ignore comments */ - - if ((SubBuffer[0] == '/') && - (SubBuffer[1] == '*')) - { - LiteralEnd = strstr (SubBuffer, "*/"); - SubBuffer += 2; /* Get past comment opening */ - - if (!LiteralEnd) - { - return SubBuffer; - } - - while (SubBuffer < LiteralEnd) - { - if (*SubBuffer == '\n') - { - NewLines++; - } - - SubBuffer++; - } - - SubBuffer += 2; /* Get past comment close */ - } - - /* Ignore quoted strings */ - - else if (*SubBuffer == '\"') - { - SubBuffer++; - LiteralEnd = AsSkipPastChar (SubBuffer, '\"'); - if (!LiteralEnd) - { - return SubBuffer; - } - } - - if (TotalLines) - { - (*TotalLines) += NewLines; - } - return SubBuffer; -} - - -/****************************************************************************** - * - * FUNCTION: AsAsCheckForBraces - * - * DESCRIPTION: Check for an open brace after each if statement - * - ******************************************************************************/ - -void -AsCheckForBraces ( - char *Buffer, - char *Filename) -{ - char *SubBuffer = Buffer; - char *NextBrace; - char *NextSemicolon; - char *NextIf; - UINT32 TotalLines = 1; - - - while (*SubBuffer) - { - - SubBuffer = AsCheckAndSkipLiterals (SubBuffer, &TotalLines); - - if (*SubBuffer == '\n') - { - TotalLines++; - } - else if (!(strncmp (" if", SubBuffer, 3))) - { - SubBuffer += 2; - NextBrace = strstr (SubBuffer, "{"); - NextSemicolon = strstr (SubBuffer, ";"); - NextIf = strstr (SubBuffer, " if"); - - if ((!NextBrace) || - (NextSemicolon && (NextBrace > NextSemicolon)) || - (NextIf && (NextBrace > NextIf))) - { - Gbl_MissingBraces++; - printf ("Missing braces for <if>, line %d: %s\n", TotalLines, Filename); - } - } - else if (!(strncmp (" else if", SubBuffer, 8))) - { - SubBuffer += 7; - NextBrace = strstr (SubBuffer, "{"); - NextSemicolon = strstr (SubBuffer, ";"); - NextIf = strstr (SubBuffer, " if"); - - if ((!NextBrace) || - (NextSemicolon && (NextBrace > NextSemicolon)) || - (NextIf && (NextBrace > NextIf))) - { - Gbl_MissingBraces++; - printf ("Missing braces for <if>, line %d: %s\n", TotalLines, Filename); - } - } - else if (!(strncmp (" else", SubBuffer, 5))) - { - SubBuffer += 4; - NextBrace = strstr (SubBuffer, "{"); - NextSemicolon = strstr (SubBuffer, ";"); - NextIf = strstr (SubBuffer, " if"); - - if ((!NextBrace) || - (NextSemicolon && (NextBrace > NextSemicolon)) || - (NextIf && (NextBrace > NextIf))) - { - Gbl_MissingBraces++; - printf ("Missing braces for <else>, line %d: %s\n", TotalLines, Filename); - } - } - - SubBuffer++; - } -} - - -/****************************************************************************** - * - * FUNCTION: AsTrimLines - * - * DESCRIPTION: Remove extra blanks from the end of source lines. Does not - * check for tabs. - * - ******************************************************************************/ - -void -AsTrimLines ( - char *Buffer, - char *Filename) -{ - char *SubBuffer = Buffer; - char *StartWhiteSpace = NULL; - UINT32 SpaceCount = 0; - - - while (*SubBuffer) - { - while (*SubBuffer != '\n') - { - if (!*SubBuffer) - { - goto Exit; - } - - if (*SubBuffer == ' ') - { - if (!StartWhiteSpace) - { - StartWhiteSpace = SubBuffer; - } - } - else - { - StartWhiteSpace = NULL; - } - - SubBuffer++; - } - - if (StartWhiteSpace) - { - SpaceCount += (SubBuffer - StartWhiteSpace); - - /* Remove the spaces */ - - SubBuffer = AsRemoveData (StartWhiteSpace, SubBuffer); - StartWhiteSpace = NULL; - } - - SubBuffer++; - } - - -Exit: - if (SpaceCount) - { - Gbl_MadeChanges = TRUE; - AsPrint ("Extraneous spaces removed", SpaceCount, Filename); - } -} - - -/****************************************************************************** - * - * FUNCTION: AsTrimWhitespace - * - * DESCRIPTION: Remove "excess" blank lines - any more than 2 blank lines. - * this can happen during the translation when lines are removed. - * - ******************************************************************************/ - -void -AsTrimWhitespace ( - char *Buffer) -{ - int ReplaceCount = 1; - - - while (ReplaceCount) - { - ReplaceCount = AsReplaceString ("\n\n\n\n", "\n\n\n", REPLACE_SUBSTRINGS, Buffer); - } -} - - -/****************************************************************************** - * - * FUNCTION: AsReplaceHeader - * - * DESCRIPTION: Replace the default Intel legal header with a new header - * - ******************************************************************************/ - -void -AsReplaceHeader ( - char *Buffer, - char *NewHeader) -{ - char *SubBuffer; - char *TokenEnd; - - - /* Find the original header */ - - SubBuffer = strstr (Buffer, HeaderBegin); - if (!SubBuffer) - { - return; - } - - /* Find the end of the original header */ - - TokenEnd = strstr (SubBuffer, "*/"); - TokenEnd = AsSkipPastChar (TokenEnd, '\n'); - - /* Delete old header, insert new one */ - - AsReplaceData (SubBuffer, TokenEnd - SubBuffer, NewHeader, strlen (NewHeader)); -} - - -/****************************************************************************** - * - * FUNCTION: AsReplaceString - * - * DESCRIPTION: Replace all instances of a target string with a replacement - * string. Returns count of the strings replaced. - * - ******************************************************************************/ - -int -AsReplaceString ( - char *Target, - char *Replacement, - UINT8 Type, - char *Buffer) -{ - char *SubString1; - char *SubString2; - char *SubBuffer; - int TargetLength; - int ReplacementLength; - int ReplaceCount = 0; - - - TargetLength = strlen (Target); - ReplacementLength = strlen (Replacement); - - SubBuffer = Buffer; - SubString1 = Buffer; - - while (SubString1) - { - /* Find the target string */ - - SubString1 = strstr (SubBuffer, Target); - if (!SubString1) - { - return ReplaceCount; - } - - /* - * Check for translation escape string -- means to ignore - * blocks of code while replacing - */ - - SubString2 = strstr (SubBuffer, "/*!"); - - if ((SubString2) && - (SubString2 < SubString1)) - { - /* Find end of the escape block starting at "Substring2" */ - - SubString2 = strstr (SubString2, "!*/"); - if (!SubString2) - { - /* Didn't find terminator */ - - return ReplaceCount; - } - - /* Move buffer to end of escape block and continue */ - - SubBuffer = SubString2; - } - - /* Do the actual replace if the target was found */ - - else - { - if ((Type & REPLACE_MASK) == REPLACE_WHOLE_WORD) - { - if (!AsMatchExactWord (SubString1, TargetLength)) - { - SubBuffer = SubString1 + 1; - continue; - } - } - - SubBuffer = AsReplaceData (SubString1, TargetLength, Replacement, ReplacementLength); -/* - if (((Type & INDENT_MASK) == EXTRA_INDENT_C) && - (Gbl_FileType == FILE_TYPE_SOURCE)) - { - SubBuffer = AsReplaceData (SubBuffer, 0, " ", 4); - } -*/ - - ReplaceCount++; - } - } - - return ReplaceCount; -} - - -/****************************************************************************** - * - * FUNCTION: AsConvertToLineFeeds - * - * DESCRIPTION: - * - ******************************************************************************/ - -void -AsConvertToLineFeeds ( - char *Buffer) -{ - char *SubString; - char *SubBuffer; - - - SubBuffer = Buffer; - SubString = Buffer; - - while (SubString) - { - /* Find the target string */ - - SubString = strstr (SubBuffer, "\r\n"); - if (!SubString) - { - return; - } - - SubBuffer = AsReplaceData (SubString, 1, NULL, 0); - } - return; -} - - -/****************************************************************************** - * - * FUNCTION: AsInsertCarriageReturns - * - * DESCRIPTION: - * - ******************************************************************************/ - -void -AsInsertCarriageReturns ( - char *Buffer) -{ - char *SubString; - char *SubBuffer; - - - SubBuffer = Buffer; - SubString = Buffer; - - while (SubString) - { - /* Find the target string */ - - SubString = strstr (SubBuffer, "\n"); - if (!SubString) - { - return; - } - - SubBuffer = AsInsertData (SubString, "\r", 1); - } - return; -} - - -/****************************************************************************** - * - * FUNCTION: AsBracesOnSameLine - * - * DESCRIPTION: Move opening braces up to the same line as an if, for, else, - * or while statement (leave function opening brace on separate - * line). - * - ******************************************************************************/ - -void -AsBracesOnSameLine ( - char *Buffer) -{ - UINT32 Length; - char *SubBuffer = Buffer; - char *Beginning; - char *StartOfThisLine; - BOOLEAN BlockBegin = TRUE; - - - while (*SubBuffer) - { - /* Ignore comments */ - - if ((SubBuffer[0] == '/') && - (SubBuffer[1] == '*')) - { - SubBuffer = strstr (SubBuffer, "*/"); - if (!SubBuffer) - { - return; - } - - SubBuffer += 2; - continue; - } - - /* Ignore quoted strings */ - - if (*SubBuffer == '\"') - { - SubBuffer++; - SubBuffer = AsSkipPastChar (SubBuffer, '\"'); - if (!SubBuffer) - { - return; - } - } - - if (!strncmp ("\n}", SubBuffer, 2)) - { - /* - * A newline followed by a closing brace closes a function - * or struct or initializer block - */ - BlockBegin = TRUE; - } - - /* Move every standalone brace up to the previous line */ - - if (*SubBuffer == '{') - { - if (BlockBegin) - { - BlockBegin = FALSE; - } - else - { - /* - * Backup to previous non-whitespace - */ - Beginning = SubBuffer - 1; - while ((*Beginning == ' ') || - (*Beginning == '\n')) - { - Beginning--; - } - - StartOfThisLine = Beginning; - while (*StartOfThisLine != '\n') - { - StartOfThisLine--; - } - - /* - * Move the brace up to the previous line, UNLESS: - * - * 1) There is a conditional compile on the line (starts with '#') - * 2) Previous line ends with an '=' (Start of initializer block) - * 3) Previous line ends with a comma (part of an init list) - * - */ - if ((StartOfThisLine[1] != '#') && - (*Beginning != '=') && - (*Beginning != ',')) - { - Beginning++; - SubBuffer++; - Length = strlen (SubBuffer); - - Gbl_MadeChanges = TRUE; - -#ifdef ADD_EXTRA_WHITESPACE - AsReplaceData (Beginning, SubBuffer-Beginning, " {\n", 3); -#else - AsReplaceData (Beginning, SubBuffer-Beginning, " {", 2); -#endif - } - } - } - - SubBuffer++; - } -} - - -/****************************************************************************** - * - * FUNCTION: AsTabify4 - * - * DESCRIPTION: Convert the text to tabbed text. Alignment of text is - * preserved. - * - ******************************************************************************/ - -void -AsTabify4 ( - char *Buffer) -{ - char *SubBuffer = Buffer; - char *NewSubBuffer; - UINT32 SpaceCount = 0; - UINT32 Column = 0; - - - while (*SubBuffer) - { - if (*SubBuffer == '\n') - { - Column = 0; - } - else - { - Column++; - } - - /* Ignore comments */ - - if ((SubBuffer[0] == '/') && - (SubBuffer[1] == '*')) - { - SubBuffer = strstr (SubBuffer, "*/"); - if (!SubBuffer) - { - return; - } - - SubBuffer += 2; - continue; - } - - /* Ignore quoted strings */ - - if (*SubBuffer == '\"') - { - SubBuffer++; - SubBuffer = AsSkipPastChar (SubBuffer, '\"'); - if (!SubBuffer) - { - return; - } - SpaceCount = 0; - } - - if (*SubBuffer == ' ') - { - SpaceCount++; - - if (SpaceCount >= 4) - { - SpaceCount = 0; - - NewSubBuffer = (SubBuffer + 1) - 4; - *NewSubBuffer = '\t'; - NewSubBuffer++; - - /* Remove the spaces */ - - SubBuffer = AsRemoveData (NewSubBuffer, SubBuffer + 1); - } - - if ((Column % 4) == 0) - { - SpaceCount = 0; - } - } - else - { - SpaceCount = 0; - } - - SubBuffer++; - } -} - - -/****************************************************************************** - * - * FUNCTION: AsTabify8 - * - * DESCRIPTION: Convert the text to tabbed text. Alignment of text is - * preserved. - * - ******************************************************************************/ - -void -AsTabify8 ( - char *Buffer) -{ - char *SubBuffer = Buffer; - char *NewSubBuffer; - char *CommentEnd = NULL; - UINT32 SpaceCount = 0; - UINT32 Column = 0; - UINT32 TabCount = 0; - UINT32 LastLineTabCount = 0; - UINT32 LastLineColumnStart = 0; - UINT32 ThisColumnStart = 0; - UINT32 ThisTabCount = 0; - char *FirstNonBlank = NULL; - - - while (*SubBuffer) - { - if (*SubBuffer == '\n') - { - /* This is a standalone blank line */ - - FirstNonBlank = NULL; - Column = 0; - SpaceCount = 0; - TabCount = 0; - SubBuffer++; - continue; - } - - if (!FirstNonBlank) - { - /* Find the first non-blank character on this line */ - - FirstNonBlank = SubBuffer; - while (*FirstNonBlank == ' ') - { - FirstNonBlank++; - } - - /* - * This mechanism limits the difference in tab counts from - * line to line. It helps avoid the situation where a second - * continuation line (which was indented correctly for tabs=4) would - * get indented off the screen if we just blindly converted to tabs. - */ - ThisColumnStart = FirstNonBlank - SubBuffer; - - if (LastLineTabCount == 0) - { - ThisTabCount = 0; - } - else if (ThisColumnStart == LastLineColumnStart) - { - ThisTabCount = LastLineTabCount -1; - } - else - { - ThisTabCount = LastLineTabCount + 1; - } - } - - Column++; - - /* Check if we are in a comment */ - - if ((SubBuffer[0] == '*') && - (SubBuffer[1] == '/')) - { - SpaceCount = 0; - SubBuffer += 2; - - if (*SubBuffer == '\n') - { - if (TabCount > 0) - { - LastLineTabCount = TabCount; - TabCount = 0; - } - FirstNonBlank = NULL; - LastLineColumnStart = ThisColumnStart; - SubBuffer++; - } - - continue; - } - - /* Check for comment open */ - - if ((SubBuffer[0] == '/') && - (SubBuffer[1] == '*')) - { - /* Find the end of the comment, it must exist */ - - CommentEnd = strstr (SubBuffer, "*/"); - if (!CommentEnd) - { - return; - } - - /* Toss the rest of this line or single-line comment */ - - while ((SubBuffer < CommentEnd) && - (*SubBuffer != '\n')) - { - SubBuffer++; - } - - if (*SubBuffer == '\n') - { - if (TabCount > 0) - { - LastLineTabCount = TabCount; - TabCount = 0; - } - FirstNonBlank = NULL; - LastLineColumnStart = ThisColumnStart; - } - - SpaceCount = 0; - continue; - } - - /* Ignore quoted strings */ - - if ((!CommentEnd) && (*SubBuffer == '\"')) - { - SubBuffer++; - SubBuffer = AsSkipPastChar (SubBuffer, '\"'); - if (!SubBuffer) - { - return; - } - SpaceCount = 0; - } - - if (*SubBuffer != ' ') - { - /* Not a space, skip to end of line */ - - SubBuffer = AsSkipUntilChar (SubBuffer, '\n'); - if (!SubBuffer) - { - return; - } - if (TabCount > 0) - { - LastLineTabCount = TabCount; - TabCount = 0; - } - - FirstNonBlank = NULL; - LastLineColumnStart = ThisColumnStart; - Column = 0; - SpaceCount = 0; - } - else - { - /* Another space */ - - SpaceCount++; - - if (SpaceCount >= 4) - { - /* Replace this group of spaces with a tab character */ - - SpaceCount = 0; - - NewSubBuffer = SubBuffer - 3; - - if (TabCount <= ThisTabCount ? (ThisTabCount +1) : 0) - { - *NewSubBuffer = '\t'; - NewSubBuffer++; - SubBuffer++; - TabCount++; - } - - /* Remove the spaces */ - - SubBuffer = AsRemoveData (NewSubBuffer, SubBuffer); - continue; - } - } - - SubBuffer++; - } -} - - -/****************************************************************************** - * - * FUNCTION: AsCountLines - * - * DESCRIPTION: Count the number of lines in the input buffer. Also count - * the number of long lines (lines longer than 80 chars). - * - ******************************************************************************/ - -UINT32 -AsCountLines ( - char *Buffer, - char *Filename) -{ - char *SubBuffer = Buffer; - char *EndOfLine; - UINT32 LineCount = 0; - UINT32 LongLineCount = 0; - - - while (*SubBuffer) - { - EndOfLine = AsSkipUntilChar (SubBuffer, '\n'); - if (!EndOfLine) - { - Gbl_TotalLines += LineCount; - return LineCount; - } - - if ((EndOfLine - SubBuffer) > 80) - { - LongLineCount++; - } - - LineCount++; - SubBuffer = EndOfLine + 1; - } - - if (LongLineCount) - { - VERBOSE_PRINT (("%d Lines longer than 80 found in %s\n", LongLineCount, Filename)); - Gbl_LongLines += LongLineCount; - } - - Gbl_TotalLines += LineCount; - return LineCount; -} - - -/****************************************************************************** - * - * FUNCTION: AsCountTabs - * - * DESCRIPTION: Simply count the number of tabs in the input file buffer - * - ******************************************************************************/ - -void -AsCountTabs ( - char *Buffer, - char *Filename) -{ - UINT32 i; - UINT32 TabCount = 0; - - - for (i = 0; Buffer[i]; i++) - { - if (Buffer[i] == '\t') - { - TabCount++; - } - } - - if (TabCount) - { - AsPrint ("Tabs found", TabCount, Filename); - Gbl_Tabs += TabCount; - } - - AsCountLines (Buffer, Filename); -} - - -/****************************************************************************** - * - * FUNCTION: AsCountNonAnsiComments - * - * DESCRIPTION: Count the number of "//" comments. This type of comment is - * non-ANSI C. - * - ******************************************************************************/ - -void -AsCountNonAnsiComments ( - char *Buffer, - char *Filename) -{ - char *SubBuffer = Buffer; - UINT32 CommentCount = 0; - - - while (SubBuffer) - { - SubBuffer = strstr (SubBuffer, "//"); - if (SubBuffer) - { - CommentCount++; - SubBuffer += 2; - } - } - - if (CommentCount) - { - AsPrint ("Non-ANSI Comments found", CommentCount, Filename); - Gbl_NonAnsiComments += CommentCount; - } -} - - -/****************************************************************************** - * - * FUNCTION: AsCountSourceLines - * - * DESCRIPTION: Count the number of C source lines. Defined by 1) not a - * comment, and 2) not a blank line. - * - ******************************************************************************/ - -void -AsCountSourceLines ( - char *Buffer, - char *Filename) -{ - char *SubBuffer = Buffer; - UINT32 LineCount = 0; - UINT32 WhiteCount = 0; - UINT32 CommentCount = 0; - - - while (*SubBuffer) - { - /* Ignore comments */ - - if ((SubBuffer[0] == '/') && - (SubBuffer[1] == '*')) - { - CommentCount++; - SubBuffer += 2; - - while (SubBuffer[0] && SubBuffer[1] && - !(((SubBuffer[0] == '*') && - (SubBuffer[1] == '/')))) - { - if (SubBuffer[0] == '\n') - { - CommentCount++; - } - - SubBuffer++; - } - } - - /* A linefeed followed by a non-linefeed is a valid source line */ - - else if ((SubBuffer[0] == '\n') && - (SubBuffer[1] != '\n')) - { - LineCount++; - } - - /* Two back-to-back linefeeds indicate a whitespace line */ - - else if ((SubBuffer[0] == '\n') && - (SubBuffer[1] == '\n')) - { - WhiteCount++; - } - - SubBuffer++; - } - - /* Adjust comment count for legal header */ - - CommentCount -= LINES_IN_LEGAL_HEADER; - - Gbl_SourceLines += LineCount; - Gbl_WhiteLines += WhiteCount; - Gbl_CommentLines += CommentCount; - - VERBOSE_PRINT (("%d Comment %d White %d Code %d Lines in %s\n", - CommentCount, WhiteCount, LineCount, LineCount+WhiteCount+CommentCount, Filename)); -} - - -/****************************************************************************** - * - * FUNCTION: AsInsertPrefix - * - * DESCRIPTION: Insert struct or union prefixes - * - ******************************************************************************/ - -void -AsInsertPrefix ( - char *Buffer, - char *Keyword, - UINT8 Type) -{ - char *SubString; - char *SubBuffer; - char *EndKeyword; - int StrLength; - int InsertLength; - char *InsertString; - int TrailingSpaces; - char LowerKeyword[128]; - int KeywordLength; - - - switch (Type) - { - case SRC_TYPE_STRUCT: - InsertString = "struct "; - break; - - case SRC_TYPE_UNION: - InsertString = "union "; - break; - - default: - return; - } - - strcpy (LowerKeyword, Keyword); - strlwr (LowerKeyword); - - SubBuffer = Buffer; - SubString = Buffer; - InsertLength = strlen (InsertString); - KeywordLength = strlen (Keyword); - - - while (SubString) - { - /* Find an instance of the keyword */ - - SubString = strstr (SubBuffer, LowerKeyword); - - if (!SubString) - { - return; - } - - SubBuffer = SubString; - - /* Must be standalone word, not a substring */ - - if (AsMatchExactWord (SubString, KeywordLength)) - { - /* Make sure the keyword isn't already prefixed with the insert */ - - if (!strncmp (SubString - InsertLength, InsertString, InsertLength)) - { - /* Add spaces if not already at the end-of-line */ - - if (*(SubBuffer + KeywordLength) != '\n') - { - /* Already present, add spaces after to align structure members */ - - AsInsertData (SubBuffer + KeywordLength, " ", 8); - } - goto Next; - } - - /* Make sure the keyword isn't at the end of a struct/union */ - /* Note: This code depends on a single space after the brace */ - - if (*(SubString - 2) == '}') - { - goto Next; - } - - /* Prefix the keyword with the insert string */ - - Gbl_MadeChanges = TRUE; - StrLength = strlen (SubString); - - /* Is there room for insertion */ - - EndKeyword = SubString + strlen (LowerKeyword); - - TrailingSpaces = 0; - while (EndKeyword[TrailingSpaces] == ' ') - { - TrailingSpaces++; - } - - /* - * Use "if (TrailingSpaces > 1)" if we want to ignore casts - */ - SubBuffer = SubString + InsertLength; - - if (TrailingSpaces > InsertLength) - { - /* Insert the keyword */ - - memmove (SubBuffer, SubString, KeywordLength); - - /* Insert the keyword */ - - memmove (SubString, InsertString, InsertLength); - } - else - { - AsInsertData (SubString, InsertString, InsertLength); - } - } - -Next: - SubBuffer += KeywordLength; - } -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/asfile.c b/sys/dev/acpi/acpica/Subsystem/asfile.c deleted file mode 100644 index e966156db9e..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asfile.c +++ /dev/null @@ -1,815 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asfile - Main module for the acpi source processor utility - * $Revision: 30 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#include "acpisrc.h" - - -/****************************************************************************** - * - * FUNCTION: AsDoWildcard - * - * DESCRIPTION: Process files via wildcards - * - ******************************************************************************/ - -void -AsDoWildcard ( - ACPI_CONVERSION_TABLE *ConversionTable, - char *SourcePath, - char *TargetPath, - int MaxPathLength, - int FileType, - char *WildcardSpec) -{ - void *DirInfo; - char *Filename; - char *SourceDirPath; - char *TargetDirPath; - char RequestedFileType; - - - if (FileType == FILE_TYPE_DIRECTORY) - { - RequestedFileType = REQUEST_DIR_ONLY; - } - else - { - RequestedFileType = REQUEST_FILE_ONLY; - } - - VERBOSE_PRINT (("Checking for %s source files in directory \"%s\"\n", - WildcardSpec, SourcePath)); - - /* Open the directory for wildcard search */ - - DirInfo = AcpiOsOpenDirectory (SourcePath, WildcardSpec, RequestedFileType); - if (DirInfo) - { - /* - * Get all of the files that match both the - * wildcard and the requested file type - */ - while ((Filename = AcpiOsGetNextFilename (DirInfo))) - { - /* Looking for directory files, must check file type */ - - switch (RequestedFileType) - { - case REQUEST_DIR_ONLY: - - /* If we actually have a dir, process the subtree */ - - if (!AsCheckForDirectory (SourcePath, TargetPath, Filename, - &SourceDirPath, &TargetDirPath)) - { - VERBOSE_PRINT (("Subdirectory: %s\n", Filename)); - - AsProcessTree (ConversionTable, SourceDirPath, TargetDirPath); - free (SourceDirPath); - free (TargetDirPath); - } - break; - - case REQUEST_FILE_ONLY: - - /* Otherwise, this is a file, not a directory */ - - VERBOSE_PRINT (("File: %s\n", Filename)); - - AsProcessOneFile (ConversionTable, SourcePath, TargetPath, - MaxPathLength, Filename, FileType); - break; - } - } - - /* Cleanup */ - - AcpiOsCloseDirectory (DirInfo); - } -} - - -/****************************************************************************** - * - * FUNCTION: AsProcessTree - * - * DESCRIPTION: Process the directory tree. Files with the extension ".C" and - * ".H" are processed as the tree is traversed. - * - ******************************************************************************/ - -ACPI_NATIVE_INT -AsProcessTree ( - ACPI_CONVERSION_TABLE *ConversionTable, - char *SourcePath, - char *TargetPath) -{ - int MaxPathLength; - - - MaxPathLength = max (strlen (SourcePath), strlen (TargetPath)); - - if (!(ConversionTable->Flags & FLG_NO_FILE_OUTPUT)) - { - if (ConversionTable->Flags & FLG_LOWERCASE_DIRNAMES) - { - strlwr (TargetPath); - } - - VERBOSE_PRINT (("Creating Directory \"%s\"\n", TargetPath)); - if (mkdir (TargetPath)) - { - if (errno != EEXIST) - { - printf ("Could not create target directory\n"); - return -1; - } - } - } - - /* Do the C source files */ - - AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_SOURCE, "*.c"); - - /* Do the C header files */ - - AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_HEADER, "*.h"); - - /* Do the Lex file(s) */ - - AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_SOURCE, "*.l"); - - /* Do the yacc file(s) */ - - AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_SOURCE, "*.y"); - - /* Do any subdirectories */ - - AsDoWildcard (ConversionTable, SourcePath, TargetPath, MaxPathLength, - FILE_TYPE_DIRECTORY, "*"); - - return 0; -} - - -/****************************************************************************** - * - * FUNCTION: AsDetectLoneLineFeeds - * - * DESCRIPTION: Find LF without CR. - * - ******************************************************************************/ - -BOOLEAN -AsDetectLoneLineFeeds ( - char *Filename, - char *Buffer) -{ - UINT32 i = 1; - UINT32 LfCount = 0; - - - if (!Buffer[0]) - { - return FALSE; - } - - while (Buffer[i]) - { - if (Buffer[i] == 0x0A) - { - if (Buffer[i-1] != 0x0D) - { - LfCount++; - } - } - - i++; - } - - if (LfCount) - { - printf ("****UNIX CONTAMINATION DETECTED****\n"); - printf ("%d lone linefeeds in file %s\n", LfCount, Filename); - return TRUE; - } - - return (FALSE); -} - - -/****************************************************************************** - * - * FUNCTION: AsConvertFile - * - * DESCRIPTION: Perform the requested transforms on the file buffer (as - * determined by the ConversionTable and the FileType). - * - ******************************************************************************/ - -void -AsConvertFile ( - ACPI_CONVERSION_TABLE *ConversionTable, - char *FileBuffer, - char *Filename, - ACPI_NATIVE_INT FileType) -{ - UINT32 i; - UINT32 Functions; - ACPI_STRING_TABLE *StringTable; - ACPI_IDENTIFIER_TABLE *ConditionalTable; - ACPI_IDENTIFIER_TABLE *LineTable; - ACPI_IDENTIFIER_TABLE *MacroTable; - ACPI_TYPED_IDENTIFIER_TABLE *StructTable; - - - switch (FileType) - { - case FILE_TYPE_SOURCE: - Functions = ConversionTable->SourceFunctions; - StringTable = ConversionTable->SourceStringTable; - LineTable = ConversionTable->SourceLineTable; - ConditionalTable = ConversionTable->SourceConditionalTable; - MacroTable = ConversionTable->SourceMacroTable; - StructTable = ConversionTable->SourceStructTable; - break; - - case FILE_TYPE_HEADER: - Functions = ConversionTable->HeaderFunctions; - StringTable = ConversionTable->HeaderStringTable; - LineTable = ConversionTable->HeaderLineTable; - ConditionalTable = ConversionTable->HeaderConditionalTable; - MacroTable = ConversionTable->HeaderMacroTable; - StructTable = ConversionTable->HeaderStructTable; - break; - - default: - printf ("Unknown file type, cannot process\n"); - return; - } - - Gbl_Files++; - VERBOSE_PRINT (("Processing %d bytes\n", strlen (FileBuffer))); - - if (ConversionTable->LowerCaseTable) - { - for (i = 0; ConversionTable->LowerCaseTable[i].Identifier; i++) - { - AsLowerCaseString (ConversionTable->LowerCaseTable[i].Identifier, - FileBuffer); - } - } - - /* Process all the string replacements */ - - if (StringTable) - { - for (i = 0; StringTable[i].Target; i++) - { - AsReplaceString (StringTable[i].Target, StringTable[i].Replacement, - StringTable[i].Type, FileBuffer); - } - } - - if (LineTable) - { - for (i = 0; LineTable[i].Identifier; i++) - { - AsRemoveLine (FileBuffer, LineTable[i].Identifier); - } - } - - if (ConditionalTable) - { - for (i = 0; ConditionalTable[i].Identifier; i++) - { - AsRemoveConditionalCompile (FileBuffer, ConditionalTable[i].Identifier); - } - } - - if (MacroTable) - { - for (i = 0; MacroTable[i].Identifier; i++) - { - AsRemoveMacro (FileBuffer, MacroTable[i].Identifier); - } - } - - if (StructTable) - { - for (i = 0; StructTable[i].Identifier; i++) - { - AsInsertPrefix (FileBuffer, StructTable[i].Identifier, StructTable[i].Type); - } - } - - /* Process the function table */ - - for (i = 0; i < 32; i++) - { - /* Decode the function bitmap */ - - switch ((1 << i) & Functions) - { - case 0: - /* This function not configured */ - break; - - - case CVT_COUNT_TABS: - - AsCountTabs (FileBuffer, Filename); - break; - - - case CVT_COUNT_NON_ANSI_COMMENTS: - - AsCountNonAnsiComments (FileBuffer, Filename); - break; - - - case CVT_CHECK_BRACES: - - AsCheckForBraces (FileBuffer, Filename); - break; - - - case CVT_TRIM_LINES: - - AsTrimLines (FileBuffer, Filename); - break; - - - case CVT_COUNT_LINES: - - AsCountSourceLines (FileBuffer, Filename); - break; - - - case CVT_BRACES_ON_SAME_LINE: - - AsBracesOnSameLine (FileBuffer); - break; - - - case CVT_MIXED_CASE_TO_UNDERSCORES: - - AsMixedCaseToUnderscores (FileBuffer); - break; - - - case CVT_LOWER_CASE_IDENTIFIERS: - - AsLowerCaseIdentifiers (FileBuffer); - break; - - - case CVT_REMOVE_DEBUG_MACROS: - - AsRemoveDebugMacros (FileBuffer); - break; - - - case CVT_TRIM_WHITESPACE: - - AsTrimWhitespace (FileBuffer); - break; - - - case CVT_REMOVE_EMPTY_BLOCKS: - - AsRemoveEmptyBlocks (FileBuffer, Filename); - break; - - - case CVT_REDUCE_TYPEDEFS: - - AsReduceTypedefs (FileBuffer, "typedef union"); - AsReduceTypedefs (FileBuffer, "typedef struct"); - break; - - - case CVT_SPACES_TO_TABS4: - - AsTabify4 (FileBuffer); - break; - - - case CVT_SPACES_TO_TABS8: - - AsTabify8 (FileBuffer); - break; - - - default: - - printf ("Unknown conversion subfunction opcode\n"); - break; - } - } - - if (ConversionTable->NewHeader) - { - AsReplaceHeader (FileBuffer, ConversionTable->NewHeader); - } -} - - -/****************************************************************************** - * - * FUNCTION: AsProcessOneFile - * - * DESCRIPTION: Process one source file. The file is opened, read entirely - * into a buffer, converted, then written to a new file. - * - ******************************************************************************/ - -ACPI_NATIVE_INT -AsProcessOneFile ( - ACPI_CONVERSION_TABLE *ConversionTable, - char *SourcePath, - char *TargetPath, - int MaxPathLength, - char *Filename, - ACPI_NATIVE_INT FileType) -{ - char *Pathname; - char *OutPathname = NULL; - - - /* Allocate a file pathname buffer for both source and target */ - - Pathname = calloc (MaxPathLength + strlen (Filename) + 2, 1); - if (!Pathname) - { - printf ("Could not allocate buffer for file pathnames\n"); - return -1; - } - - Gbl_FileType = FileType; - - /* Generate the source pathname and read the file */ - - if (SourcePath) - { - strcpy (Pathname, SourcePath); - strcat (Pathname, "/"); - } - - strcat (Pathname, Filename); - - if (AsGetFile (Pathname, &Gbl_FileBuffer, &Gbl_FileSize)) - { - return -1; - } - - /* Process the file in the buffer */ - - Gbl_MadeChanges = FALSE; - AsConvertFile (ConversionTable, Gbl_FileBuffer, Pathname, FileType); - - if (!(ConversionTable->Flags & FLG_NO_FILE_OUTPUT)) - { - if (!(Gbl_Overwrite && !Gbl_MadeChanges)) - { - /* Generate the target pathname and write the file */ - - OutPathname = calloc (MaxPathLength + strlen (Filename) + 2 + strlen (TargetPath), 1); - if (!OutPathname) - { - printf ("Could not allocate buffer for file pathnames\n"); - return -1; - } - - strcpy (OutPathname, TargetPath); - if (SourcePath) - { - strcat (OutPathname, "/"); - strcat (OutPathname, Filename); - } - - AsPutFile (OutPathname, Gbl_FileBuffer, ConversionTable->Flags); - } - } - - free (Gbl_FileBuffer); - free (Pathname); - if (OutPathname) - { - free (OutPathname); - } - - return 0; -} - - -/****************************************************************************** - * - * FUNCTION: AsCheckForDirectory - * - * DESCRIPTION: Check if the current file is a valid directory. If not, - * construct the full pathname for the source and target paths. - * Checks for the dot and dot-dot files (they are ignored) - * - ******************************************************************************/ - -ACPI_NATIVE_INT -AsCheckForDirectory ( - char *SourceDirPath, - char *TargetDirPath, - char *Filename, - char **SourcePath, - char **TargetPath) -{ - char *SrcPath; - char *TgtPath; - - - if (!(strcmp (Filename, ".")) || - !(strcmp (Filename, ".."))) - { - return -1; - } - - SrcPath = calloc (strlen (SourceDirPath) + strlen (Filename) + 2, 1); - if (!SrcPath) - { - printf ("Could not allocate buffer for directory source pathname\n"); - return -1; - } - - TgtPath = calloc (strlen (TargetDirPath) + strlen (Filename) + 2, 1); - if (!TgtPath) - { - printf ("Could not allocate buffer for directory target pathname\n"); - free (SrcPath); - return -1; - } - - strcpy (SrcPath, SourceDirPath); - strcat (SrcPath, "/"); - strcat (SrcPath, Filename); - - strcpy (TgtPath, TargetDirPath); - strcat (TgtPath, "/"); - strcat (TgtPath, Filename); - - *SourcePath = SrcPath; - *TargetPath = TgtPath; - return 0; -} - - -/****************************************************************************** - * - * FUNCTION: AsGetFile - * - * DESCRIPTION: Open a file and read it entirely into a an allocated buffer - * - ******************************************************************************/ - -int -AsGetFile ( - char *Filename, - char **FileBuffer, - UINT32 *FileSize) -{ - - int FileHandle; - UINT32 Size; - char *Buffer; - - - /* Binary mode leaves CR/LF pairs */ - - FileHandle = open (Filename, O_BINARY | O_RDONLY); - if (!FileHandle) - { - printf ("Could not open %s\n", Filename); - return -1; - } - - if (fstat (FileHandle, &Gbl_StatBuf)) - { - printf ("Could not get file status for %s\n", Filename); - goto ErrorExit; - } - - /* - * Create a buffer for the entire file - * Add plenty extra buffer to accomodate string replacements - */ - Size = Gbl_StatBuf.st_size; - Buffer = calloc (Size * 2, 1); - if (!Buffer) - { - printf ("Could not allocate buffer of size %d\n", Size + (Size / 10)); - goto ErrorExit; - } - - /* Read the entire file */ - - Size = read (FileHandle, Buffer, Size); - if (Size == -1) - { - printf ("Could not read the input file %s\n", Filename); - goto ErrorExit; - } - - Buffer [Size] = 0; /* Null terminate the buffer */ - close (FileHandle); - - /* Check for unix contamination */ - - if (AsDetectLoneLineFeeds (Filename, Buffer)) - { - return -1; - } - - /* - * Convert all CR/LF pairs to LF only. We do this locally so that - * this code is portable across operating systems. - */ - AsConvertToLineFeeds (Buffer); - - *FileBuffer = Buffer; - *FileSize = Size; - - return 0; - - -ErrorExit: - - close (FileHandle); - return -1; -} - - -/****************************************************************************** - * - * FUNCTION: AsPutFile - * - * DESCRIPTION: Create a new output file and write the entire contents of the - * buffer to the new file. Buffer must be a zero terminated string - * - ******************************************************************************/ - -int -AsPutFile ( - char *Pathname, - char *FileBuffer, - UINT32 SystemFlags) -{ - UINT32 FileSize; - int DestHandle; - int OpenFlags; - - - /* Create the target file */ - - OpenFlags = O_TRUNC | O_CREAT | O_WRONLY | O_BINARY; - - if (!(SystemFlags & FLG_NO_CARRIAGE_RETURNS)) - { - /* Put back the CR before each LF */ - - AsInsertCarriageReturns (FileBuffer); - } - - DestHandle = open (Pathname, OpenFlags, S_IREAD | S_IWRITE); - if (DestHandle == -1) - { - perror ("Could not create destination file"); - printf ("Could not create destination file \"%s\"\n", Pathname); - return -1; - } - - /* Write the buffer to the file */ - - FileSize = strlen (FileBuffer); - write (DestHandle, FileBuffer, FileSize); - - close (DestHandle); - - return 0; -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslanalyze.c b/sys/dev/acpi/acpica/Subsystem/aslanalyze.c deleted file mode 100644 index 5196bea74eb..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslanalyze.c +++ /dev/null @@ -1,1679 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslanalyze.c - check for semantic errors - * $Revision: 72 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "acparser.h" -#include "amlcode.h" - -#include <ctype.h> - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslanalyze") - - -/******************************************************************************* - * - * FUNCTION: AnMapArgTypeToBtype - * - * PARAMETERS: ArgType - The ARGI required type(s) for this argument, - * from the opcode info table - * - * RETURN: The corresponding Bit-encoded types - * - * DESCRIPTION: Convert an encoded ARGI required argument type code into a - * bitfield type code. Implements the implicit source conversion - * rules. - * - ******************************************************************************/ - -UINT32 -AnMapArgTypeToBtype ( - UINT32 ArgType) -{ - - switch (ArgType) - { - case ARGI_ANYTYPE: - return (ACPI_BTYPE_OBJECTS_AND_REFS); - - case ARGI_TARGETREF: - case ARGI_FIXED_TARGET: - case ARGI_SIMPLE_TARGET: - return (ACPI_BTYPE_OBJECTS_AND_REFS); - - case ARGI_REFERENCE: - return (ACPI_BTYPE_REFERENCE); - - case ARGI_INTEGER_REF: - return (ACPI_BTYPE_INTEGER); - - case ARGI_OBJECT_REF: - return (ACPI_BTYPE_ALL_OBJECTS); - - case ARGI_DEVICE_REF: - return (ACPI_BTYPE_DEVICE_OBJECTS); - - case ARGI_IF: - return (ACPI_BTYPE_ANY); - - /* - * Source conversion rules: - * Integer, String, and Buffer are interchangable - */ - case ARGI_INTEGER: - return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER); - - case ARGI_STRING: - return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER); - - case ARGI_BUFFER: - return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER); - - case ARGI_PACKAGE: - return (ACPI_BTYPE_PACKAGE); - - case ARGI_COMPUTEDATA: - return (ACPI_BTYPE_COMPUTE_DATA); - - case ARGI_DATAOBJECT: - - /* Buffer, string, package or reference to a Op - Used only by SizeOf operator*/ - - return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE); - - case ARGI_COMPLEXOBJ: - - /* Buffer, String, or package */ - - return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE); - - case ARGI_MUTEX: - return (ACPI_BTYPE_MUTEX); - - case ARGI_EVENT: - return (ACPI_BTYPE_EVENT); - - case ARGI_REGION: - return (ACPI_BTYPE_REGION); - - case ARGI_DDBHANDLE: - return (ACPI_BTYPE_DDB_HANDLE); - - default: - break; - } - - return (ACPI_BTYPE_OBJECTS_AND_REFS); -} - - -/******************************************************************************* - * - * FUNCTION: AnMapEtypeToBtype - * - * PARAMETERS: Etype - Encoded ACPI Type - * - * RETURN: Btype corresponding to the Etype - * - * DESCRIPTION: Convert an encoded ACPI type to a bitfield type applying the - * operand conversion rules. In other words, returns the type(s) - * this Etype is implicitly converted to during interpretation. - * - ******************************************************************************/ - -UINT32 -AnMapEtypeToBtype ( - UINT32 Etype) -{ - - - if (Etype == ACPI_TYPE_ANY) - { - return ACPI_BTYPE_OBJECTS_AND_REFS; - } - - /* Try the standard ACPI data types */ - - if (Etype <= ACPI_TYPE_EXTERNAL_MAX) - { - /* - * This switch statement implements the allowed operand conversion - * rules as per the "ASL Data Types" section of the ACPI - * specification. - */ - switch (Etype) - { - case ACPI_TYPE_INTEGER: - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_DDB_HANDLE); - - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - return (ACPI_BTYPE_COMPUTE_DATA); - - case ACPI_TYPE_PACKAGE: - return (ACPI_BTYPE_PACKAGE); - - case ACPI_TYPE_FIELD_UNIT: - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_FIELD_UNIT); - - case ACPI_TYPE_BUFFER_FIELD: - return (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_BUFFER_FIELD); - - case ACPI_TYPE_DDB_HANDLE: - return (ACPI_BTYPE_INTEGER | ACPI_BTYPE_DDB_HANDLE); - - case ACPI_BTYPE_DEBUG_OBJECT: - - /* Cannot be used as a source operand */ - - return (0); - - default: - return (1 << (Etype - 1)); - } - } - - /* Try the internal data types */ - - switch (Etype) - { - case ACPI_TYPE_LOCAL_REGION_FIELD: - case ACPI_TYPE_LOCAL_BANK_FIELD: - case ACPI_TYPE_LOCAL_INDEX_FIELD: - - /* Named fields can be either Integer/Buffer/String */ - - return (ACPI_BTYPE_COMPUTE_DATA); - - case ACPI_TYPE_LOCAL_ALIAS: - - return (ACPI_BTYPE_INTEGER); - - - case ACPI_TYPE_LOCAL_RESOURCE: - case ACPI_TYPE_LOCAL_RESOURCE_FIELD: - - return (ACPI_BTYPE_REFERENCE); - - default: - printf ("Unhandled encoded type: %X\n", Etype); - return (0); - } -} - - -/******************************************************************************* - * - * FUNCTION: AnMapBtypeToEtype - * - * PARAMETERS: Btype - Bitfield of ACPI types - * - * RETURN: The Etype corresponding the the Btype - * - * DESCRIPTION: Convert a bitfield type to an encoded type - * - ******************************************************************************/ - -UINT32 -AnMapBtypeToEtype ( - UINT32 Btype) -{ - UINT32 i; - UINT32 Etype; - - - if (Btype == 0) - { - return 0; - } - - Etype = 1; - for (i = 1; i < Btype; i *= 2) - { - Etype++; - } - - return (Etype); -} - - -/******************************************************************************* - * - * FUNCTION: AnFormatBtype - * - * PARAMETERS: Btype - Bitfield of ACPI types - * Buffer - Where to put the ascii string - * - * RETURN: None. - * - * DESCRIPTION: Convert a Btype to a string of ACPI types - * - ******************************************************************************/ - -void -AnFormatBtype ( - char *Buffer, - UINT32 Btype) -{ - UINT32 Type; - BOOLEAN First = TRUE; - - - *Buffer = 0; - - if (Btype == 0) - { - strcat (Buffer, "NoReturnValue"); - return; - } - - for (Type = 1; Type < ACPI_TYPE_EXTERNAL_MAX; Type++) - { - if (Btype & 0x00000001) - { - if (!First) - { - strcat (Buffer, "|"); - } - First = FALSE; - strcat (Buffer, AcpiUtGetTypeName (Type)); - } - Btype >>= 1; - } - - if (Btype & 0x00000001) - { - if (!First) - { - strcat (Buffer, "|"); - } - First = FALSE; - strcat (Buffer, "Reference"); - } - - Btype >>= 1; - if (Btype & 0x00000001) - { - if (!First) - { - strcat (Buffer, "|"); - } - First = FALSE; - strcat (Buffer, "Resource"); - } -} - - -/******************************************************************************* - * - * FUNCTION: AnGetBtype - * - * PARAMETERS: Op - Parse node whose type will be returned. - * - * RETURN: The Btype associated with the Op. - * - * DESCRIPTION: Get the (bitfield) ACPI type associated with the parse node. - * Handles the case where the node is a name or method call and - * the actual type must be obtained from the namespace node. - * - ******************************************************************************/ - -UINT32 -AnGetBtype ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_PARSE_OBJECT *ReferencedNode; - UINT32 ThisNodeBtype = 0; - - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - Node = Op->Asl.Node; - if (!Node) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "Null attached Nsnode: [%s] at line %d\n", - Op->Asl.ParseOpName, Op->Asl.LineNumber); - return ACPI_UINT32_MAX; - } - - ThisNodeBtype = AnMapEtypeToBtype (Node->Type); - - /* - * Since it was a named reference, enable the - * reference bit also - */ - ThisNodeBtype |= ACPI_BTYPE_REFERENCE; - - if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - ReferencedNode = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object); - if (!ReferencedNode) - { - printf ("No back ptr to Op: type %X\n", Node->Type); - return ACPI_UINT32_MAX; - } - - if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED) - { - ThisNodeBtype = ReferencedNode->Asl.AcpiBtype; - } - else - { - return (ACPI_UINT32_MAX -1); - } - } - } - else - { - ThisNodeBtype = Op->Asl.AcpiBtype; - } - - return (ThisNodeBtype); -} - - -/******************************************************************************* - * - * FUNCTION: AnCheckForReservedName - * - * PARAMETERS: Op - A parse node - * Name - NameSeg to check - * - * RETURN: None - * - * DESCRIPTION: Check a NameSeg against the reserved list. - * - ******************************************************************************/ - -#define ACPI_VALID_RESERVED_NAME_MAX 0x80000000 -#define ACPI_NOT_RESERVED_NAME ACPI_UINT32_MAX -#define ACPI_PREDEFINED_NAME (ACPI_UINT32_MAX - 1) -#define ACPI_EVENT_RESERVED_NAME (ACPI_UINT32_MAX - 2) -#define ACPI_COMPILER_RESERVED_NAME (ACPI_UINT32_MAX - 3) - -UINT32 -AnCheckForReservedName ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - UINT32 i; - - - if (Name[0] == 0) - { - AcpiOsPrintf ("Found a null name, external = %s\n", Op->Asl.ExternalName); - } - - /* All reserved names are prefixed with a single underscore */ - - if (Name[0] != '_') - { - return (ACPI_NOT_RESERVED_NAME); - } - - /* Check for a standard reserved method name */ - - for (i = 0; ReservedMethods[i].Name; i++) - { - if (!ACPI_STRNCMP (Name, ReservedMethods[i].Name, ACPI_NAME_SIZE)) - { - if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName); - return (ACPI_PREDEFINED_NAME); - } - else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName); - return (ACPI_PREDEFINED_NAME); - } - - /* Return index into reserved array */ - - return i; - } - } - - /* - * Now check for the "special" reserved names -- - * GPE: _Lxx - * GPE: _Exx - * EC: _Qxx - */ - if ((Name[1] == 'L') || - (Name[1] == 'E') || - (Name[1] == 'Q')) - { - /* The next two characters must be hex digits */ - - if ((isxdigit (Name[2])) && - (isxdigit (Name[3]))) - { - return (ACPI_EVENT_RESERVED_NAME); - } - } - - - /* Check for the names reserved for the compiler itself: _T_x */ - - else if ((Op->Asl.ExternalName[1] == 'T') && - (Op->Asl.ExternalName[2] == '_')) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName); - return (ACPI_COMPILER_RESERVED_NAME); - } - - /* - * The name didn't match any of the known reserved names. Flag it as a - * warning, since the entire namespace starting with an underscore is - * reserved by the ACPI spec. - */ - AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op, Op->Asl.ExternalName); - - return (ACPI_NOT_RESERVED_NAME); -} - - -/******************************************************************************* - * - * FUNCTION: AnCheckForReservedMethod - * - * PARAMETERS: Op - A parse node of type "METHOD". - * MethodInfo - Saved info about this method - * - * RETURN: None - * - * DESCRIPTION: If method is a reserved name, check that the number of arguments - * and the return type (returns a value or not) is correct. - * - ******************************************************************************/ - -void -AnCheckForReservedMethod ( - ACPI_PARSE_OBJECT *Op, - ASL_METHOD_INFO *MethodInfo) -{ - UINT32 Index; - - - /* Check for a match against the reserved name list */ - - Index = AnCheckForReservedName (Op, Op->Asl.NameSeg); - - switch (Index) - { - case ACPI_NOT_RESERVED_NAME: - case ACPI_PREDEFINED_NAME: - case ACPI_COMPILER_RESERVED_NAME: - - /* Just return, nothing to do */ - break; - - - case ACPI_EVENT_RESERVED_NAME: - - Gbl_ReservedMethods++; - - /* NumArguments must be zero for all _Lxx, _Exx, and _Qxx methods */ - - if (MethodInfo->NumArguments != 0) - { - sprintf (MsgBuffer, " %s requires %d", - Op->Asl.ExternalName, 0); - - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer); - } - break; - - - default: - - Gbl_ReservedMethods++; - - /* Matched a reserved method name */ - - if (MethodInfo->NumArguments != ReservedMethods[Index].NumArguments) - { - sprintf (MsgBuffer, " %s requires %d", - ReservedMethods[Index].Name, - ReservedMethods[Index].NumArguments); - - if (MethodInfo->NumArguments > ReservedMethods[Index].NumArguments) - { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer); - } - else - { - AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, MsgBuffer); - } - } - - if (MethodInfo->NumReturnNoValue && - ReservedMethods[Index].Flags & ASL_RSVD_RETURN_VALUE) - { - sprintf (MsgBuffer, "%s", ReservedMethods[Index].Name); - - AslError (ASL_WARNING, ASL_MSG_RESERVED_RETURN_VALUE, Op, MsgBuffer); - } - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodAnalysisWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the analysis walk. Check methods for : - * 1) Initialized local variables - * 2) Valid arguments - * 3) Return types - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context; - ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack; - ACPI_PARSE_OBJECT *Next; - UINT32 RegisterNumber; - UINT32 i; - char LocalName[] = "Local0"; - char ArgName[] = "Arg0"; - - - ACPI_FUNCTION_NAME ("AnMethodAnalysisWalkBegin"); - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - - TotalMethods++; - - /* - * Create and init method info - */ - MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO)); - MethodInfo->Next = WalkInfo->MethodStack; - MethodInfo->Op = Op; - - WalkInfo->MethodStack = MethodInfo; - - /* Get the NumArguments node */ - - Next = Op->Asl.Child; - Next = Next->Asl.Next; - MethodInfo->NumArguments = (UINT8) (Next->Asl.Value.Integer8 & 0x07); - - /* - * Actual arguments are initialized at method entry. - * All other ArgX "registers" can be used as locals, so we - * track their initialization. - */ - for (i = 0; i < MethodInfo->NumArguments; i++) - { - MethodInfo->ArgInitialized[i] = TRUE; - } - - break; - - - case PARSEOP_METHODCALL: - - if (MethodInfo && - (Op->Asl.Node == MethodInfo->Op->Asl.Node)) - { - AslError (ASL_REMARK, ASL_MSG_RECURSION, Op, Op->Asl.ExternalName); - } - break; - - - case PARSEOP_LOCAL0: - case PARSEOP_LOCAL1: - case PARSEOP_LOCAL2: - case PARSEOP_LOCAL3: - case PARSEOP_LOCAL4: - case PARSEOP_LOCAL5: - case PARSEOP_LOCAL6: - case PARSEOP_LOCAL7: - - if (!MethodInfo) - { - /* Probably was an error in the method declaration, no additional error here */ - - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op)); - return (AE_ERROR); - } - - RegisterNumber = (Op->Asl.AmlOpcode & 0x000F); - - /* - * If the local is being used as a target, mark the local - * initialized - */ - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - MethodInfo->LocalInitialized[RegisterNumber] = TRUE; - } - - /* - * Otherwise, this is a reference, check if the local - * has been previously initialized. - */ - else if (!MethodInfo->LocalInitialized[RegisterNumber]) - { - LocalName[strlen (LocalName) -1] = (char) (RegisterNumber + 0x30); - AslError (ASL_ERROR, ASL_MSG_LOCAL_INIT, Op, LocalName); - } - break; - - - case PARSEOP_ARG0: - case PARSEOP_ARG1: - case PARSEOP_ARG2: - case PARSEOP_ARG3: - case PARSEOP_ARG4: - case PARSEOP_ARG5: - case PARSEOP_ARG6: - - if (!MethodInfo) - { - /* Probably was an error in the method declaration, no additional error here */ - - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op)); - return (AE_ERROR); - } - - RegisterNumber = (Op->Asl.AmlOpcode & 0x000F) - 8; - ArgName[strlen (ArgName) -1] = (char) (RegisterNumber + 0x30); - - /* - * If the Arg is being used as a target, mark the local - * initialized - */ - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - MethodInfo->ArgInitialized[RegisterNumber] = TRUE; - } - - /* - * Otherwise, this is a reference, check if the Arg - * has been previously initialized. - */ - else if (!MethodInfo->ArgInitialized[RegisterNumber]) - { - AslError (ASL_ERROR, ASL_MSG_ARG_INIT, Op, ArgName); - } - - /* Flag this arg if it is not a "real" argument to the method */ - - if (RegisterNumber >= MethodInfo->NumArguments) - { - AslError (ASL_REMARK, ASL_MSG_NOT_PARAMETER, Op, ArgName); - } - break; - - - case PARSEOP_RETURN: - - if (!MethodInfo) - { - /* Probably was an error in the method declaration, no additional error here */ - - ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op)); - return (AE_ERROR); - } - - /* Child indicates a return value */ - - if ((Op->Asl.Child) && - (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - MethodInfo->NumReturnWithValue++; - } - else - { - MethodInfo->NumReturnNoValue++; - } - break; - - - case PARSEOP_BREAK: - case PARSEOP_CONTINUE: - - Next = Op->Asl.Parent; - while (Next) - { - if (Next->Asl.ParseOpcode == PARSEOP_WHILE) - { - break; - } - Next = Next->Asl.Parent; - } - - if (!Next) - { - AslError (ASL_ERROR, ASL_MSG_NO_WHILE, Op, NULL); - } - break; - - - case PARSEOP_DEVICE: - case PARSEOP_EVENT: - case PARSEOP_MUTEX: - case PARSEOP_OPERATIONREGION: - case PARSEOP_POWERRESOURCE: - case PARSEOP_PROCESSOR: - case PARSEOP_THERMALZONE: - - /* - * The first operand is a name to be created in the namespace. - * Check against the reserved list. - */ - i = AnCheckForReservedName (Op, Op->Asl.NameSeg); - if (i < ACPI_VALID_RESERVED_NAME_MAX) - { - AslError (ASL_ERROR, ASL_MSG_RESERVED_USE, Op, Op->Asl.ExternalName); - } - break; - - - case PARSEOP_NAME: - - i = AnCheckForReservedName (Op, Op->Asl.NameSeg); - if (i < ACPI_VALID_RESERVED_NAME_MAX) - { - if (ReservedMethods[i].NumArguments > 0) - { - /* - * This reserved name must be a control method because - * it must have arguments - */ - AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, "with arguments"); - } - - /* - * Typechecking for _HID - */ - else if (!ACPI_STRCMP ("_HID", ReservedMethods[i].Name)) - { - /* Examine the second operand to typecheck it */ - - Next = Op->Asl.Child->Asl.Next; - - if ((Next->Asl.ParseOpcode != PARSEOP_INTEGER) && - (Next->Asl.ParseOpcode != PARSEOP_STRING_LITERAL)) - { - /* _HID must be a string or an integer */ - - AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Next, "String or Integer"); - } - - if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) - { - /* - * _HID is a string, all characters must be alphanumeric. - * One of the things we want to catch here is the use of - * a leading asterisk in the string. - */ - for (i = 0; Next->Asl.Value.String[i]; i++) - { - if (!isalnum (Next->Asl.Value.String[i])) - { - AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, Next, Next->Asl.Value.String); - break; - } - } - } - } - } - - break; - - - default: - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnLastStatementIsReturn - * - * PARAMETERS: Op - A method parse node - * - * RETURN: TRUE if last statement is an ASL RETURN. False otherwise - * - * DESCRIPTION: Walk down the list of top level statements within a method - * to find the last one. Check if that last statement is in - * fact a RETURN statement. - * - ******************************************************************************/ - -BOOLEAN -AnLastStatementIsReturn ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* - * Check if last statement is a return - */ - Next = ASL_GET_CHILD_NODE (Op); - while (Next) - { - if ((!Next->Asl.Next) && - (Next->Asl.ParseOpcode == PARSEOP_RETURN)) - { - return TRUE; - } - - Next = ASL_GET_PEER_NODE (Next); - } - - return FALSE; -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodAnalysisWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for analysis walk. Complete method - * return analysis. - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ASL_ANALYSIS_WALK_INFO *WalkInfo = (ASL_ANALYSIS_WALK_INFO *) Context; - ASL_METHOD_INFO *MethodInfo = WalkInfo->MethodStack; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - case PARSEOP_RETURN: - if (!MethodInfo) - { - printf ("No method info for method! [%s]\n", Op->Asl.Namepath); - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, "No method info for this method"); - CmCleanupAndExit (); - return (AE_AML_INTERNAL); - } - break; - - default: - break; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - - WalkInfo->MethodStack = MethodInfo->Next; - - /* - * Check if there is no return statement at the end of the - * method AND we can actually get there -- i.e., the execution - * of the method can possibly terminate without a return statement. - */ - if ((!AnLastStatementIsReturn (Op)) && - (!(Op->Asl.CompileFlags & NODE_HAS_NO_EXIT))) - { - /* - * No return statement, and execution can possibly exit - * via this path. This is equivalent to Return () - */ - MethodInfo->NumReturnNoValue++; - } - - /* - * Check for case where some return statements have a return value - * and some do not. Exit without a return statement is a return with - * no value - */ - if (MethodInfo->NumReturnNoValue && - MethodInfo->NumReturnWithValue) - { - AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op, Op->Asl.ExternalName); - } - - /* - * If there are any RETURN() statements with no value, or there is a - * control path that allows the method to exit without a return value, - * we mark the method as a method that does not return a value. This - * knowledge can be used to check method invocations that expect a - * returned value. - */ - if (MethodInfo->NumReturnNoValue) - { - if (MethodInfo->NumReturnWithValue) - { - Op->Asl.CompileFlags |= NODE_METHOD_SOME_NO_RETVAL; - } - else - { - Op->Asl.CompileFlags |= NODE_METHOD_NO_RETVAL; - } - } - - /* - * Check predefined method names for correct return behavior - * and correct number of arguments - */ - AnCheckForReservedMethod (Op, MethodInfo); - ACPI_MEM_FREE (MethodInfo); - break; - - - case PARSEOP_RETURN: - - Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT; - Op->Asl.ParentMethod = MethodInfo->Op; /* Used in the "typing" pass later */ - - /* - * If there is a peer node after the return statement, then this - * node is unreachable code -- i.e., it won't be executed because of the - * preceeding Return(). - */ - if (Op->Asl.Next) - { - AslError (ASL_WARNING, ASL_MSG_UNREACHABLE_CODE, Op->Asl.Next, NULL); - } - break; - - - case PARSEOP_IF: - - if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) && - (Op->Asl.Next) && - (Op->Asl.Next->Asl.ParseOpcode == PARSEOP_ELSE)) - { - Op->Asl.Next->Asl.CompileFlags |= NODE_IF_HAS_NO_EXIT; - } - break; - - - case PARSEOP_ELSE: - - if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) && - (Op->Asl.CompileFlags & NODE_IF_HAS_NO_EXIT)) - { - Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT; - } - break; - - - default: - - if ((Op->Asl.CompileFlags & NODE_HAS_NO_EXIT) && - (Op->Asl.Parent)) - { - Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT; - } - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodTypingWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the typing walk. - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodTypingWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnMethodTypingWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for typing walk. Complete method - * return analysis. Check methods for : - * 1) Initialized local variables - * 2) Valid arguments - * 3) Return types - * - ******************************************************************************/ - -ACPI_STATUS -AnMethodTypingWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - UINT32 ThisNodeBtype; - - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_METHOD: - - Op->Asl.CompileFlags |= NODE_METHOD_TYPED; - break; - - case PARSEOP_RETURN: - - if ((Op->Asl.Child) && - (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - ThisNodeBtype = AnGetBtype (Op->Asl.Child); - - if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_METHODCALL) && - (ThisNodeBtype == (ACPI_UINT32_MAX -1))) - { - /* - * The method is untyped at this time (typically a forward reference). - * We must recursively type the method here - */ - TrWalkParseTree (ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Op->Asl.Child->Asl.Node->Object), - ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin, - AnMethodTypingWalkEnd, NULL); - - ThisNodeBtype = AnGetBtype (Op->Asl.Child); - } - - /* Returns a value, get it's type */ - - if (Op->Asl.ParentMethod) - { - Op->Asl.ParentMethod->Asl.AcpiBtype |= ThisNodeBtype; - } - } - break; - - default: - break; - } - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnCheckMethodReturnValue - * - * PARAMETERS: Op - Parent - * OpInfo - Parent info - * ArgOp - Method invocation op - * RequiredBtypes - What caller requires - * ThisNodeBtype - What this node returns (if anything) - * - * RETURN: None - * - * DESCRIPTION: Check a method invocation for 1) A return value and if it does - * in fact return a value, 2) check the type of the return value. - * - ******************************************************************************/ - -void -AnCheckMethodReturnValue ( - ACPI_PARSE_OBJECT *Op, - const ACPI_OPCODE_INFO *OpInfo, - ACPI_PARSE_OBJECT *ArgOp, - UINT32 RequiredBtypes, - UINT32 ThisNodeBtype) -{ - ACPI_PARSE_OBJECT *OwningOp; - ACPI_NAMESPACE_NODE *Node; - - - Node = ArgOp->Asl.Node; - - - /* Examine the parent op of this method */ - - OwningOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object); - if (OwningOp->Asl.CompileFlags & NODE_METHOD_NO_RETVAL) - { - /* - * Method NEVER returns a value - */ - AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, Op->Asl.ExternalName); - } - else if (OwningOp->Asl.CompileFlags & NODE_METHOD_SOME_NO_RETVAL) - { - /* - * Method SOMETIMES returns a value, SOMETIMES not - */ - AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, Op->Asl.ExternalName); - } - else if (!(ThisNodeBtype & RequiredBtypes)) - { - /* - * Method returns a value, but the type is wrong - */ - AnFormatBtype (StringBuffer, ThisNodeBtype); - AnFormatBtype (StringBuffer2, RequiredBtypes); - - - /* - * The case where the method does not return any value at all - * was already handled in the namespace cross reference - * -- Only issue an error if the method in fact returns a value, - * but it is of the wrong type - */ - if (ThisNodeBtype != 0) - { - sprintf (MsgBuffer, "Method returns [%s], %s operator requires [%s]", - StringBuffer, OpInfo->Name, StringBuffer2); - - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AnOperandTypecheckWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the analysis walk. Check methods for : - * 1) Initialized local variables - * 2) Valid arguments - * 3) Return types - * - ******************************************************************************/ - -ACPI_STATUS -AnOperandTypecheckWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnOperandTypecheckWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for analysis walk. Complete method - * return analysis. - * - ******************************************************************************/ - -ACPI_STATUS -AnOperandTypecheckWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - const ACPI_OPCODE_INFO *OpInfo; - UINT32 RuntimeArgTypes; - UINT32 RuntimeArgTypes2; - UINT32 RequiredBtypes; - UINT32 ThisNodeBtype; - UINT32 CommonBtypes; - UINT32 OpcodeClass; - ACPI_PARSE_OBJECT *ArgOp; - UINT32 ArgType; - - - switch (Op->Asl.AmlOpcode) - { - case AML_RAW_DATA_BYTE: - case AML_RAW_DATA_WORD: - case AML_RAW_DATA_DWORD: - case AML_RAW_DATA_QWORD: - case AML_RAW_DATA_BUFFER: - case AML_RAW_DATA_CHAIN: - case AML_PACKAGE_LENGTH: - case AML_UNASSIGNED_OPCODE: - case AML_DEFAULT_ARG_OP: - - /* Ignore the internal (compiler-only) AML opcodes */ - - return (AE_OK); - - default: - break; - } - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - if (!OpInfo) - { - return (AE_OK); - } - - ArgOp = Op->Asl.Child; - RuntimeArgTypes = OpInfo->RuntimeArgs; - OpcodeClass = OpInfo->Class; - - - /* - * Special case for control opcodes IF/RETURN/WHILE since they - * have no runtime arg list (at this time) - */ - switch (Op->Asl.AmlOpcode) - { - case AML_IF_OP: - case AML_WHILE_OP: - case AML_RETURN_OP: - - if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - /* The lone arg is a method call, check it */ - - RequiredBtypes = AnMapArgTypeToBtype (ARGI_INTEGER); - if (Op->Asl.AmlOpcode == AML_RETURN_OP) - { - RequiredBtypes = 0xFFFFFFFF; - } - - ThisNodeBtype = AnGetBtype (ArgOp); - if (ThisNodeBtype == ACPI_UINT32_MAX) - { - return (AE_OK); - } - AnCheckMethodReturnValue (Op, OpInfo, ArgOp, RequiredBtypes, ThisNodeBtype); - } - return (AE_OK); - - default: - break; - } - - /* Ignore the non-executable opcodes */ - - if (RuntimeArgTypes == ARGI_INVALID_OPCODE) - { - return (AE_OK); - } - - switch (OpcodeClass) - { - case AML_CLASS_EXECUTE: - case AML_CLASS_CREATE: - case AML_CLASS_CONTROL: - case AML_CLASS_RETURN_VALUE: - - /* TBD: Change class or fix typechecking for these */ - - if ((Op->Asl.AmlOpcode == AML_BUFFER_OP) || - (Op->Asl.AmlOpcode == AML_PACKAGE_OP) || - (Op->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)) - { - break; - } - - /* Reverse the runtime argument list */ - - RuntimeArgTypes2 = 0; - while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes))) - { - RuntimeArgTypes2 <<= ARG_TYPE_WIDTH; - RuntimeArgTypes2 |= ArgType; - INCREMENT_ARG_LIST (RuntimeArgTypes); - } - - while ((ArgType = GET_CURRENT_ARG_TYPE (RuntimeArgTypes2))) - { - RequiredBtypes = AnMapArgTypeToBtype (ArgType); - - ThisNodeBtype = AnGetBtype (ArgOp); - if (ThisNodeBtype == ACPI_UINT32_MAX) - { - goto NextArgument; - } - - /* Examine the arg based on the required type of the arg */ - - switch (ArgType) - { - case ARGI_TARGETREF: - - if (ArgOp->Asl.ParseOpcode == PARSEOP_ZERO) - { - /* ZERO is the placeholder for "don't store result" */ - - ThisNodeBtype = RequiredBtypes; - break; - } - - if (ArgOp->Asl.ParseOpcode == PARSEOP_INTEGER) - { - /* - * This is the case where an original reference to a resource - * descriptor field has been replaced by an (Integer) offset. - * These named fields are supported at compile-time only; - * the names are not passed to the interpreter (via the AML). - */ - if ((ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || - (ArgOp->Asl.Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) - { - AslError (ASL_ERROR, ASL_MSG_RESOURCE_FIELD, ArgOp, NULL); - } - else - { - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, NULL); - } - break; - } - - if ((ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) || - (ArgOp->Asl.ParseOpcode == PARSEOP_DEREFOF)) - { - break; - } - - ThisNodeBtype = RequiredBtypes; - break; - - - case ARGI_REFERENCE: /* References */ - case ARGI_INTEGER_REF: - case ARGI_OBJECT_REF: - case ARGI_DEVICE_REF: - - switch (ArgOp->Asl.ParseOpcode) - { - case PARSEOP_LOCAL0: - case PARSEOP_LOCAL1: - case PARSEOP_LOCAL2: - case PARSEOP_LOCAL3: - case PARSEOP_LOCAL4: - case PARSEOP_LOCAL5: - case PARSEOP_LOCAL6: - case PARSEOP_LOCAL7: - - /* TBD: implement analysis of current value (type) of the local */ - /* For now, just treat any local as a typematch */ - - /*ThisNodeBtype = RequiredBtypes;*/ - break; - - case PARSEOP_ARG0: - case PARSEOP_ARG1: - case PARSEOP_ARG2: - case PARSEOP_ARG3: - case PARSEOP_ARG4: - case PARSEOP_ARG5: - case PARSEOP_ARG6: - - /* Hard to analyze argument types, sow we won't */ - /* For now, just treat any arg as a typematch */ - - /* ThisNodeBtype = RequiredBtypes; */ - break; - - case PARSEOP_DEBUG: - break; - - case PARSEOP_REFOF: - case PARSEOP_INDEX: - default: - break; - - } - break; - - case ARGI_INTEGER: - default: - break; - } - - - CommonBtypes = ThisNodeBtype & RequiredBtypes; - - if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - /* Check a method call for a valid return value */ - - AnCheckMethodReturnValue (Op, OpInfo, ArgOp, RequiredBtypes, ThisNodeBtype); - } - - /* - * Now check if the actual type(s) match at least one - * bit to the required type - */ - else if (!CommonBtypes) - { - /* No match -- this is a type mismatch error */ - - AnFormatBtype (StringBuffer, ThisNodeBtype); - AnFormatBtype (StringBuffer2, RequiredBtypes); - - sprintf (MsgBuffer, "[%s] found, %s operator requires [%s]", - StringBuffer, OpInfo->Name, StringBuffer2); - - AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer); - } - - NextArgument: - ArgOp = ArgOp->Asl.Next; - INCREMENT_ARG_LIST (RuntimeArgTypes2); - } - break; - - default: - break; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: AnOtherSemanticAnalysisWalkBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for the analysis walk. Check methods for : - * 1) Initialized local variables - * 2) Valid arguments - * 3) Return types - * - ******************************************************************************/ - -ACPI_STATUS -AnOtherSemanticAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: AnOtherSemanticAnalysisWalkEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for analysis walk. Complete method - * return analysis. - * - ******************************************************************************/ - -ACPI_STATUS -AnOtherSemanticAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - return AE_OK; - -} diff --git a/sys/dev/acpi/acpica/Subsystem/aslcodegen.c b/sys/dev/acpi/acpica/Subsystem/aslcodegen.c deleted file mode 100644 index 47d3b14426e..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslcodegen.c +++ /dev/null @@ -1,608 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslcodegen - AML code generation - * $Revision: 46 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslcodegen") - - -/******************************************************************************* - * - * FUNCTION: CgGenerateAmlOutput - * - * PARAMETERS: None. - * - * RETURN: None - * - * DESCRIPTION: Generate AML code. Currently generates the listing file - * simultaneously. - * - ******************************************************************************/ - -void -CgGenerateAmlOutput (void) -{ - - DbgPrint (ASL_DEBUG_OUTPUT, "\nWriting AML\n\n"); - - /* Generate the AML output file */ - - FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); - Gbl_SourceLine = 0; - Gbl_NextError = Gbl_ErrorLog; - - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, CgAmlWriteWalk, NULL, NULL); - CgCloseTable (); -} - - -/******************************************************************************* - * - * FUNCTION: CgAmlWriteWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Parse tree walk to generate the AML code. - * - ******************************************************************************/ - -ACPI_STATUS -CgAmlWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* - * Debug output - */ - DbgPrint (ASL_TREE_OUTPUT, - "%5.5d [%d]", Op->Asl.LogicalLineNumber, Level); - UtPrintFormattedName (Op->Asl.ParseOpcode, Level); - - if (Op->Asl.ParseOpcode == PARSEOP_NAMESEG || - Op->Asl.ParseOpcode == PARSEOP_NAMESTRING || - Op->Asl.ParseOpcode == PARSEOP_METHODCALL) - { - DbgPrint (ASL_TREE_OUTPUT, - "%10.32s ", Op->Asl.ExternalName); - } - else - { - DbgPrint (ASL_TREE_OUTPUT, " "); - } - - DbgPrint (ASL_TREE_OUTPUT, - "Val-%08X POp-%04X AOp-%04X OpLen-%01X PByts-%01X Len-%04X SubLen-%04X PSubLen-%04X Op-%08X Chld-%08X Paren-%08X Flags-%04X AcTyp-%08X C-%2d L-%d\n", - Op->Asl.Value.Integer32, - Op->Asl.ParseOpcode, - Op->Asl.AmlOpcode, - Op->Asl.AmlOpcodeLength, - Op->Asl.AmlPkgLenBytes, - Op->Asl.AmlLength, - Op->Asl.AmlSubtreeLength, - Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0, - Op, - Op->Asl.Child, - Op->Asl.Parent, - Op->Asl.CompileFlags, - Op->Asl.AcpiBtype, - Op->Asl.Column, - Op->Asl.LineNumber); - - /* - * Generate the AML for this node - */ - CgWriteNode (Op); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: CgLocalWriteAmlData - * - * PARAMETERS: Buffer - Buffer to write - * Length - Size of data in buffer - * - * RETURN: None - * - * DESCRIPTION: Write a buffer of AML data to the AML output file. - * - ******************************************************************************/ - -void -CgLocalWriteAmlData ( - ACPI_PARSE_OBJECT *Op, - void *Buffer, - UINT32 Length) -{ - - - /* Write the raw data to the AML file */ - - FlWriteFile (ASL_FILE_AML_OUTPUT, Buffer, Length); - - /* Update the final AML length for this node (used for listings) */ - - if (Op) - { - Op->Asl.FinalAmlLength += Length; - } -} - - -/******************************************************************************* - * - * FUNCTION: CgWriteAmlOpcode - * - * PARAMETERS: Op - Parse node with an AML opcode - * - * RETURN: None. - * - * DESCRIPTION: Write the AML opcode corresponding to a parse node. - * - ******************************************************************************/ - -void -CgWriteAmlOpcode ( - ACPI_PARSE_OBJECT *Op) -{ - union { - UINT16 Opcode; - UINT8 OpcodeBytes[2]; - } Aml; - union { - UINT32 Len; - UINT8 LenBytes[4]; - } PkgLen; - - UINT8 PkgLenFirstByte; - UINT32 i; - - - /* We expect some DEFAULT_ARGs, just ignore them */ - - if (Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - return; - } - - switch (Op->Asl.AmlOpcode) - { - case AML_UNASSIGNED_OPCODE: - - /* These opcodes should not get here */ - - printf ("Found a node with an unassigned AML opcode\n"); - fprintf (stderr, "Found a node with an unassigned AML opcode\n"); - return; - - case AML_INT_RESERVEDFIELD_OP: - - /* Special opcodes for within a field definition */ - - Aml.Opcode = 0x00; - break; - - case AML_INT_ACCESSFIELD_OP: - - Aml.Opcode = 0x01; - break; - - default: - Aml.Opcode = Op->Asl.AmlOpcode; - break; - } - - - switch (Aml.Opcode) - { - case AML_PACKAGE_LENGTH: - - /* Value is the length to be encoded (Used in field definitions) */ - - PkgLen.Len = Op->Asl.Value.Integer32; - break; - - default: - - /* Check for two-byte opcode */ - - if (Aml.Opcode > 0x00FF) - { - /* Write the high byte first */ - - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[1], 1); - } - - CgLocalWriteAmlData (Op, &Aml.OpcodeBytes[0], 1); - - /* Subtreelength doesn't include length of package length bytes */ - - PkgLen.Len = Op->Asl.AmlSubtreeLength + Op->Asl.AmlPkgLenBytes; - break; - } - - /* Does this opcode have an associated "PackageLength" field? */ - - if (Op->Asl.CompileFlags & NODE_AML_PACKAGE) - { - if (Op->Asl.AmlPkgLenBytes == 1) - { - /* Simplest case -- no bytes to follow, just write the count */ - - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1); - } - else - { - /* - * Encode the "bytes to follow" in the first byte, top two bits. - * The low-order nybble of the length is in the bottom 4 bits - */ - PkgLenFirstByte = (UINT8) (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) | - (PkgLen.LenBytes[0] & 0x0F)); - - CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1); - - /* Shift the length over by the 4 bits we just stuffed in the first byte */ - - PkgLen.Len >>= 4; - - /* Now we can write the remaining bytes - either 1, 2, or 3 bytes */ - - for (i = 0; i < (UINT32) (Op->Asl.AmlPkgLenBytes - 1); i++) - { - CgLocalWriteAmlData (Op, &PkgLen.LenBytes[i], 1); - } - } - } - - switch (Aml.Opcode) - { - case AML_BYTE_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer8, 1); - break; - - case AML_WORD_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer16, 2); - break; - - case AML_DWORD_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer32, 4); - break; - - case AML_QWORD_OP: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer64, 8); - break; - - case AML_STRING_OP: - - CgLocalWriteAmlData (Op, Op->Asl.Value.String, Op->Asl.AmlLength); - break; - - default: - /* All data opcodes must appear above */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: CgWriteTableHeader - * - * PARAMETERS: Op - The DEFINITIONBLOCK node - * - * RETURN: None. - * - * DESCRIPTION: Write a table header corresponding to the DEFINITIONBLOCK - * - ******************************************************************************/ - -void -CgWriteTableHeader ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child; - - - /* AML filename */ - - Child = Op->Asl.Child; - - /* Signature */ - - Child = Child->Asl.Next; - strncpy (TableHeader.Signature, Child->Asl.Value.String, 4); - - /* Revision */ - - Child = Child->Asl.Next; - TableHeader.Revision = Child->Asl.Value.Integer8; - - /* OEMID */ - - Child = Child->Asl.Next; - strncpy (TableHeader.OemId, Child->Asl.Value.String, 6); - - /* OEM TableID */ - - Child = Child->Asl.Next; - strncpy (TableHeader.OemTableId, Child->Asl.Value.String, 8); - - /* OEM Revision */ - - Child = Child->Asl.Next; - TableHeader.OemRevision = Child->Asl.Value.Integer32; - - /* Compiler ID */ - - strncpy (TableHeader.AslCompilerId, CompilerCreatorId, 4); - - /* Compiler version */ - - TableHeader.AslCompilerRevision = CompilerCreatorRevision; - - /* Table length. Checksum zero for now, will rewrite later */ - - TableHeader.Length = Gbl_TableLength; - TableHeader.Checksum = 0; - - CgLocalWriteAmlData (Op, &TableHeader, sizeof (ACPI_TABLE_HEADER)); -} - - -/******************************************************************************* - * - * FUNCTION: CgCloseTable - * - * PARAMETERS: None. - * - * RETURN: None. - * - * DESCRIPTION: Complete the ACPI table by calculating the checksum and - * re-writing the header. - * - ******************************************************************************/ - -void -CgCloseTable (void) -{ - signed char Sum; - UINT8 FileByte; - - - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - Sum = 0; - - /* Calculate the checksum over the entire file */ - - while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1) == AE_OK) - { - Sum = (signed char) (Sum + FileByte); - } - - /* Re-write the table header with the checksum */ - - TableHeader.Checksum = (UINT8) (0 - Sum); - - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - CgLocalWriteAmlData (NULL, &TableHeader, sizeof (ACPI_TABLE_HEADER)); -} - - -/******************************************************************************* - * - * FUNCTION: CgWriteNode - * - * PARAMETERS: Op - Parse node to write. - * - * RETURN: None. - * - * DESCRIPTION: Write the AML that corresponds to a parse node. - * - ******************************************************************************/ - -void -CgWriteNode ( - ACPI_PARSE_OBJECT *Op) -{ - ASL_RESOURCE_NODE *Rnode; - - - Op->Asl.FinalAmlLength = 0; - - /* Always check for DEFAULT_ARG and other "Noop" nodes */ - /* TBD: this may not be the best place for this check */ - - if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) || - (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) || - (Op->Asl.ParseOpcode == PARSEOP_INCLUDE) || - (Op->Asl.ParseOpcode == PARSEOP_INCLUDE_END)) - { - return; - } - - switch (Op->Asl.AmlOpcode) - { - case AML_RAW_DATA_BYTE: - case AML_RAW_DATA_WORD: - case AML_RAW_DATA_DWORD: - case AML_RAW_DATA_QWORD: - - CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, Op->Asl.AmlLength); - return; - - - case AML_RAW_DATA_BUFFER: - - CgLocalWriteAmlData (Op, Op->Asl.Value.Buffer, Op->Asl.AmlLength); - return; - - - case AML_RAW_DATA_CHAIN: - - Rnode = ACPI_CAST_PTR (ASL_RESOURCE_NODE, Op->Asl.Value.Buffer); - while (Rnode) - { - CgLocalWriteAmlData (Op, Rnode->Buffer, Rnode->BufferLength); - Rnode = Rnode->Next; - } - return; - - default: - /* Internal data opcodes must all appear above */ - break; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFAULT_ARG: - - break; - - case PARSEOP_DEFINITIONBLOCK: - - CgWriteTableHeader (Op); - break; - - case PARSEOP_NAMESEG: - case PARSEOP_NAMESTRING: - case PARSEOP_METHODCALL: - - CgLocalWriteAmlData (Op, Op->Asl.Value.String, Op->Asl.AmlLength); - break; - - default: - - CgWriteAmlOpcode (Op); - break; - } -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslcompile.c b/sys/dev/acpi/acpica/Subsystem/aslcompile.c deleted file mode 100644 index fa3d45e2c7d..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslcompile.c +++ /dev/null @@ -1,615 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslcompile - top level compile module - * $Revision: 69 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#include <stdio.h> -#include "aslcompiler.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslcompile") - - -/******************************************************************************* - * - * FUNCTION: AslCompilerSignon - * - * PARAMETERS: FileId - ID of the output file - * - * RETURN: None - * - * DESCRIPTION: Display compiler signon - * - ******************************************************************************/ - -void -AslCompilerSignon ( - UINT32 FileId) -{ - char *Prefix = ""; - - - /* - * Set line prefix depending on the destination file type - */ - switch (FileId) - { - case ASL_FILE_ASM_SOURCE_OUTPUT: - case ASL_FILE_ASM_INCLUDE_OUTPUT: - - Prefix = "; "; - break; - - case ASL_FILE_HEX_OUTPUT: - - if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM) - { - Prefix = "; "; - } - else if (Gbl_HexOutputFlag == HEX_OUTPUT_C) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n"); - Prefix = " * "; - } - break; - - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - - Prefix = " * "; - break; - - default: - /* No other output types supported */ - break; - } - - /* Compiler signon with copyright */ - - FlPrintFile (FileId, - "%s\n%s%s\n%s%s version %X [%s]\n%s%s\n%sSupports ACPI Specification Revision 2.0b\n%s\n", - Prefix, - Prefix, IntelAcpiCA, - Prefix, CompilerId, ACPI_CA_VERSION, __DATE__, - Prefix, CompilerCopyright, - Prefix, - Prefix); -} - - -/******************************************************************************* - * - * FUNCTION: AslCompilerFileHeader - * - * PARAMETERS: FileId - ID of the output file - * - * RETURN: None - * - * DESCRIPTION: Header used at the beginning of output files - * - ******************************************************************************/ - -void -AslCompilerFileHeader ( - UINT32 FileId) -{ - struct tm *NewTime; - time_t Aclock; - char *Prefix = ""; - - - /* - * Set line prefix depending on the destination file type - */ - switch (FileId) - { - case ASL_FILE_ASM_SOURCE_OUTPUT: - case ASL_FILE_ASM_INCLUDE_OUTPUT: - - Prefix = "; "; - break; - - case ASL_FILE_HEX_OUTPUT: - - if (Gbl_HexOutputFlag == HEX_OUTPUT_ASM) - { - Prefix = "; "; - } - else if (Gbl_HexOutputFlag == HEX_OUTPUT_C) - { - Prefix = " * "; - } - break; - - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - - Prefix = " * "; - break; - - default: - /* No other output types supported */ - break; - } - - /* Compilation header with timestamp */ - - (void) time (&Aclock); - NewTime = localtime (&Aclock); - - FlPrintFile (FileId, - "%sCompilation of \"%s\" - %s%s\n", - Prefix, Gbl_Files[ASL_FILE_INPUT].Filename, asctime (NewTime), - Prefix); - - switch (FileId) - { - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - FlPrintFile (FileId, " */\n"); - break; - - default: - /* Nothing to do for other output types */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: CmFlushSourceCode - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Read in any remaining source code after the parse tree - * has been constructed. - * - ******************************************************************************/ - -void -CmFlushSourceCode (void) -{ - char Buffer; - - - while (FlReadFile (ASL_FILE_INPUT, &Buffer, 1) != AE_ERROR) - { - InsertLineBuffer ((int) Buffer); - } - - ResetCurrentLineBuffer (); -} - - -/******************************************************************************* - * - * FUNCTION: CmDoCompile - * - * PARAMETERS: None - * - * RETURN: Status (0 = OK) - * - * DESCRIPTION: This procedure performs the entire compile - * - ******************************************************************************/ - -int -CmDoCompile (void) -{ - ACPI_STATUS Status; - UINT32 i = 0; - - - UtBeginEvent (12, "Total Compile time"); - UtBeginEvent (i, "Initialize"); - - /* Open the required input and output files */ - - Status = FlOpenInputFile (Gbl_Files[ASL_FILE_INPUT].Filename); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return -1; - } - - Status = FlOpenMiscOutputFiles (Gbl_OutputFilenamePrefix); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return -1; - } - - UtEndEvent (i++); - - /* Build the parse tree */ - - UtBeginEvent (i, "Parse source code and build parse tree"); - AslCompilerparse(); - UtEndEvent (i++); - - /* Flush out any remaining source after parse tree is complete */ - - CmFlushSourceCode (); - - /* Did the parse tree get successfully constructed? */ - - if (!RootNode) - { - CmCleanupAndExit (); - return -1; - } - - OpcGetIntegerWidth (RootNode); - - /* Pre-process parse tree for any operator transforms */ - - UtBeginEvent (i, "Generate AML opcodes"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, TrAmlTransformWalk, NULL, NULL); - - /* Generate AML opcodes corresponding to the parse tokens */ - - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, OpcAmlOpcodeWalk, NULL); - UtEndEvent (i++); - - /* - * Now that the input is parsed, we can open the AML output file. - * Note: by default, the name of this file comes from the table descriptor - * within the input file. - */ - Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix); - if (ACPI_FAILURE (Status)) - { - AePrintErrorLog (ASL_FILE_STDERR); - return -1; - } - - /* Interpret and generate all compile-time constants */ - - UtBeginEvent (i, "Constant folding via AML interpreter"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nInterpreting compile-time constant expressions\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, OpcAmlConstantWalk, NULL, NULL); - UtEndEvent (i++); - - /* Calculate all AML package lengths */ - - UtBeginEvent (i, "Generate AML package lengths"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, LnPackageLengthWalk, NULL); - UtEndEvent (i++); - - if (Gbl_ParseOnlyFlag) - { - AePrintErrorLog (ASL_FILE_STDOUT); - UtDisplaySummary (ASL_FILE_STDOUT); - if (Gbl_DebugFlag) - { - /* Print error summary to the debug file */ - - AePrintErrorLog (ASL_FILE_STDERR); - UtDisplaySummary (ASL_FILE_STDERR); - } - return 0; - } - - /* - * Create an internal namespace and use it as a symbol table - */ - - /* Namespace loading */ - - UtBeginEvent (i, "Create ACPI Namespace"); - Status = LdLoadNamespace (RootNode); - UtEndEvent (i++); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - /* Namespace lookup */ - - UtBeginEvent (i, "Cross reference parse tree and Namespace"); - Status = LkCrossReferenceNamespace (); - UtEndEvent (i++); - UtEndEvent (i++); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - /* - * Semantic analysis. This can happen only after the - * namespace has been loaded and cross-referenced. - * - * part one - check control methods - */ - UtBeginEvent (i, "Analyze control method return types"); - AnalysisWalkInfo.MethodStack = NULL; - - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnMethodAnalysisWalkBegin, - AnMethodAnalysisWalkEnd, &AnalysisWalkInfo); - UtEndEvent (i++); - - /* Semantic error checking part two - typing of method returns */ - - UtBeginEvent (i, "Determine object types returned by methods"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing \n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin, - AnMethodTypingWalkEnd, NULL); - UtEndEvent (i++); - - /* Semantic error checking part three - operand type checking */ - - UtBeginEvent (i, "Analyze AML operand types"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking \n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnOperandTypecheckWalkBegin, - AnOperandTypecheckWalkEnd, &AnalysisWalkInfo); - UtEndEvent (i++); - - /* Semantic error checking part four - other miscellaneous checks */ - - UtBeginEvent (i, "Miscellaneous analysis"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous \n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnOtherSemanticAnalysisWalkBegin, - AnOtherSemanticAnalysisWalkEnd, &AnalysisWalkInfo); - UtEndEvent (i++); - - /* Calculate all AML package lengths */ - - UtBeginEvent (i, "Finish AML package length generation"); - DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n"); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, LnInitLengthsWalk, NULL); - TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, LnPackageLengthWalk, NULL); - UtEndEvent (i++); - - - /* Code generation - emit the AML */ - - UtBeginEvent (i, "Generate AML code and write output files"); - CgGenerateAmlOutput (); - UtEndEvent (i++); - - UtBeginEvent (i, "Write optional output files"); - CmDoOutputFiles (); - UtEndEvent (i++); - - UtEndEvent (13); - CmCleanupAndExit (); - return 0; -} - -void -CmDoOutputFiles (void) -{ - - /* Create listings and hex files */ - - LsDoListings (); - LsDoHexOutput (); - - /* Dump the namespace to the .nsp file if requested */ - - LsDisplayNamespace (); -} - - -/******************************************************************************* - * - * FUNCTION: CmCleanupAndExit - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Close all open files and exit the compiler - * - ******************************************************************************/ - -void -CmCleanupAndExit (void) -{ - UINT32 i; - - - AePrintErrorLog (ASL_FILE_STDOUT); - if (Gbl_DebugFlag) - { - /* Print error summary to the debug file */ - - AePrintErrorLog (ASL_FILE_STDERR); - } - - DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n"); - for (i = 0; i < 13; i++) - { - if (AslGbl_Events[i].Valid) - { - DbgPrint (ASL_DEBUG_OUTPUT, "%8lu ms - %s\n", - AslGbl_Events[i].EndTime - - AslGbl_Events[i].StartTime, - AslGbl_Events[i].EventName); - } - } - - if (Gbl_CompileTimesFlag) - { - printf ("\nElapsed time for major events\n\n"); - for (i = 0; i < 13; i++) - { - if (AslGbl_Events[i].Valid) - { - printf ("%8lu ms : %s\n", - AslGbl_Events[i].EndTime - - AslGbl_Events[i].StartTime, - AslGbl_Events[i].EventName); - } - } - printf ("\nMiscellaneous compile statistics\n\n"); - printf ("%11u : %s\n", TotalParseNodes, "Parse nodes"); - printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches"); - printf ("%11u : %s\n", TotalNamedObjects, "Named objects"); - printf ("%11u : %s\n", TotalMethods, "Control methods"); - printf ("%11u : %s\n", TotalAllocations, "Memory Allocations"); - printf ("%11u : %s\n", TotalAllocated, "Total allocated memory"); - printf ("%11u : %s\n", TotalFolds, "Constant subtrees folded"); - printf ("\n"); - } - - if (Gbl_NsLookupCount) - { - DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n"); - DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Total Namespace searches", Gbl_NsLookupCount); - DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Time per search", - ((UINT32) (AslGbl_Events[7].EndTime - AslGbl_Events[7].StartTime) * 1000) / - Gbl_NsLookupCount); - } - - /* Close all open files */ - - for (i = 2; i < ASL_MAX_FILE_TYPE; i++) - { - FlCloseFile (i); - } - - /* - * TBD: SourceOutput should be .TMP, then rename if we want to keep it? - */ - if (!Gbl_SourceOutputFlag) - { - unlink (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename); - } - - /* Delete AML file if there are errors */ - - if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors)) - { - unlink (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename); - } - - if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) - { - printf ("\nMaximum error count (%d) exceeded.\n", ASL_MAX_ERROR_COUNT); - } - - UtDisplaySummary (ASL_FILE_STDOUT); - exit (0); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslcompiler.h b/sys/dev/acpi/acpica/Subsystem/aslcompiler.h deleted file mode 100644 index 5e6724b12ce..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslcompiler.h +++ /dev/null @@ -1,1120 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslcompiler.h - common include file - * $Revision: 127 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#ifndef __ASLCOMPILER_H -#define __ASLCOMPILER_H - - -/* Microsoft-specific */ - -#if (defined WIN32 || defined WIN64) - -/* warn : used #pragma pack */ -#pragma warning(disable:4103) - -/* warn : named type definition in parentheses */ -#pragma warning(disable:4115) -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <errno.h> -#include <ctype.h> - - -#include "acpi.h" -#include "amlresrc.h" -#include "acdebug.h" -#include "asltypes.h" -#include "aslglobal.h" - - -/* - * Compiler versions and names - */ - -#define CompilerCreatorRevision ACPI_CA_VERSION - -#define IntelAcpiCA "Intel ACPI Component Architecture" -#define CompilerId "ASL Optimizing Compiler / AML Disassembler" -#define CompilerCopyright "Copyright (C) 2000 - 2003 Intel Corporation" -#define CompilerCompliance "ACPI 2.0b" -#define CompilerName "iasl" -#define CompilerCreatorId "INTL" - - -/* Configuration constants */ - -#define ASL_MAX_ERROR_COUNT 200 -#define ASL_NODE_CACHE_SIZE 1024 -#define ASL_STRING_CACHE_SIZE 32768 - -#define ASL_FIRST_PARSE_OPCODE PARSEOP_ACCESSAS -#define ASL_YYTNAME_START 3 - -/* - * Macros - */ - -#define ASL_RESDESC_OFFSET(m) ACPI_OFFSET (ASL_RESOURCE_DESC, m) -#define ASL_PTR_DIFF(a,b) ((UINT8 *)(b) - (UINT8 *)(a)) -#define ASL_PTR_ADD(a,b) ((UINT8 *)(a) = ((UINT8 *)(a) + (b))) -#define ASL_GET_CHILD_NODE(a) (a)->Asl.Child -#define ASL_GET_PEER_NODE(a) (a)->Asl.Next -#define OP_TABLE_ENTRY(a,b,c,d) {b,d,a,c} - - -#define ASL_PARSE_OPCODE_BASE PARSEOP_ACCESSAS /* First Lex type */ - - -/* Internal AML opcodes */ - -#define AML_RAW_DATA_BYTE (UINT16) 0xAA01 /* write one raw byte */ -#define AML_RAW_DATA_WORD (UINT16) 0xAA02 /* write 2 raw bytes */ -#define AML_RAW_DATA_DWORD (UINT16) 0xAA04 /* write 4 raw bytes */ -#define AML_RAW_DATA_QWORD (UINT16) 0xAA08 /* write 8 raw bytes */ -#define AML_RAW_DATA_BUFFER (UINT16) 0xAA0B /* raw buffer with length */ -#define AML_RAW_DATA_CHAIN (UINT16) 0xAA0C /* chain of raw buffers */ -#define AML_PACKAGE_LENGTH (UINT16) 0xAA10 -#define AML_UNASSIGNED_OPCODE (UINT16) 0xEEEE -#define AML_DEFAULT_ARG_OP (UINT16) 0xDDDD - - -/* filename suffixes for output files */ - -#define FILE_SUFFIX_AML_CODE "aml" -#define FILE_SUFFIX_LISTING "lst" -#define FILE_SUFFIX_HEX_DUMP "hex" -#define FILE_SUFFIX_DEBUG "txt" -#define FILE_SUFFIX_SOURCE "src" -#define FILE_SUFFIX_NAMESPACE "nsp" -#define FILE_SUFFIX_ASM_SOURCE "asm" -#define FILE_SUFFIX_C_SOURCE "c" -#define FILE_SUFFIX_DISASSEMBLY "dsl" -#define FILE_SUFFIX_ASM_INCLUDE "inc" -#define FILE_SUFFIX_C_INCLUDE "h" - - -/* Misc */ - -#define ASL_EXTERNAL_METHOD 255 -#define ASL_ABORT TRUE -#define ASL_NO_ABORT FALSE - - -/******************************************************************************* - * - * Compiler prototypes - * - ******************************************************************************/ - - -void -end_stmt (void); - - -/* parser */ - -int -AslCompilerparse( - void); - -ACPI_PARSE_OBJECT * -AslDoError ( - void); - -int -AslCompilererror( - char *s); - -int -AslCompilerlex( - void); - -void -ResetCurrentLineBuffer ( - void); - -void -InsertLineBuffer ( - int SourceChar); - -int -AslPopInputFileStack ( - void); - -void -AslPushInputFileStack ( - FILE *InputFile, - char *Filename); - -/* aslmain */ - -void -AslCompilerSignon ( - UINT32 FileId); - -void -AslCompilerFileHeader ( - UINT32 FileId); - -void -AslDoSourceOutputFile ( - char *Buffer); - -#define ASL_DEBUG_OUTPUT 0 -#define ASL_PARSE_OUTPUT 1 -#define ASL_TREE_OUTPUT 2 - - -void -DbgPrint ( - UINT32 Type, - char *Format, - ...); - -void -ErrorContext (void); - -/* aslcompile */ - -int -CmDoCompile (void); - -void -CmDoOutputFiles (void); - -void -CmCleanupAndExit (void); - - -/* aslerror */ - -void -AslError ( - UINT8 Level, - UINT8 MessageId, - ACPI_PARSE_OBJECT *Op, - char *ExtraMessage); - -void -AslCoreSubsystemError ( - ACPI_PARSE_OBJECT *Op, - ACPI_STATUS Status, - char *ExtraMessage, - BOOLEAN Abort); - -void -AslCommonError ( - UINT8 Level, - UINT8 MessageId, - UINT32 CurrentLineNumber, - UINT32 LogicalLineNumber, - UINT32 LogicalByteOffset, - UINT32 Column, - char *Filename, - char *ExtraMessage); - -void -AePrintException ( - UINT32 FileId, - ASL_ERROR_MSG *Enode, - char *Header); - -void -AePrintErrorLog ( - UINT32 FileId); - -ACPI_STATUS -AeLocalGetRootPointer ( - UINT32 Flags, - ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress); - - -/* asllisting */ - -void -LsWriteListingHexBytes ( - UINT8 *Buffer, - UINT32 Length, - UINT32 FileId); - -void -LsWriteNodeToListing ( - ACPI_PARSE_OBJECT *Op, - UINT32 FileId); - -void -LsWriteNodeToAsmListing ( - ACPI_PARSE_OBJECT *Op); - -void -LsWriteNode ( - ACPI_PARSE_OBJECT *Op, - UINT32 FileId); - -void -LsFinishSourceListing ( - UINT32 FileId); - -void -LsFlushListingBuffer ( - UINT32 FileId); - -void -LsDoHexOutput ( - void); - -void -LsDoHexOutputC ( - void); - -void -LsDoHexOutputAsm ( - void); - -void -LsPushNode ( - char *Filename); - -ASL_LISTING_NODE * -LsPopNode ( - void); - - -/* - * aslopcodes - generate AML opcodes - */ - -ACPI_STATUS -OpcAmlOpcodeWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -OpcAmlConstantWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -void -OpcGenerateAmlOpcode ( - ACPI_PARSE_OBJECT *Op); - -UINT32 -OpcSetOptimalIntegerSize ( - ACPI_PARSE_OBJECT *Op); - -void -OpcGetIntegerWidth ( - ACPI_PARSE_OBJECT *Op); - -/* - * asloperands - generate AML operands for the AML opcodes - */ - -void -OpnGenerateAmlOperands ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoField ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoBankField ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoBuffer ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoFieldCommon ( - ACPI_PARSE_OBJECT *FieldOp, - ACPI_PARSE_OBJECT *Op); - -void -OpnDoIndexField ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoLoadTable ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoMethod ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoPackage ( - ACPI_PARSE_OBJECT *Op); - -void -OpnDoRegion ( - ACPI_PARSE_OBJECT *Op); - -/* - * aslopt - optmization - */ - -void -OptOptimizeNamePath ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags, - ACPI_WALK_STATE *WalkState, - char *AmlNameString, - ACPI_NAMESPACE_NODE *TargetNode); - - -/* - * aslresource - resource template generation - */ - -void -RsDoResourceTemplate ( - ACPI_PARSE_OBJECT *Op); - - -void -CgGenerateAmlOutput (void); - -void -CgGenerateListing ( - UINT32 FileId); - -void -LsDoListings (void); - -void -CgGenerateAmlLengths ( - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -CgOpenOutputFile ( - char *InputFilename); - - -/* asllength */ - -ACPI_STATUS -LnPackageLengthWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -LnInitLengthsWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -ACPI_STATUS -CgAmlWriteWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -void -CgGenerateOutput( - void); - -void -CgCloseTable (void); - - -void -CgWriteNode ( - ACPI_PARSE_OBJECT *Op); - -/* - * aslmap - */ - -ACPI_OBJECT_TYPE -AslMapNamedOpcodeToDataType ( - UINT16 Opcode); - -/* - * asltransform - parse tree transformations - */ - -ACPI_STATUS -TrAmlTransformWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -void -TrTransformSubtree ( - ACPI_PARSE_OBJECT *Op); - -void -TrDoSwitch ( - ACPI_PARSE_OBJECT *Op); - -void -TrDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op); - -void -TrDoElseif ( - ACPI_PARSE_OBJECT *Op); - - -/* - * asltree - parse tree support - */ - -ACPI_STATUS -TrWalkParseTree ( - ACPI_PARSE_OBJECT *Op, - UINT32 Visitation, - ASL_WALK_CALLBACK DescendingCallback, - ASL_WALK_CALLBACK AscendingCallback, - void *Context); - -ACPI_PARSE_OBJECT * -TrAllocateNode ( - UINT32 ParseOpcode); - - -/* Values for "Visitation" parameter above */ - -#define ASL_WALK_VISIT_DOWNWARD 0x01 -#define ASL_WALK_VISIT_UPWARD 0x02 -#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD) - - -char * -TrAddNode ( - void *Thing); - -ACPI_PARSE_OBJECT * -TrUpdateNode ( - UINT32 ParseOpcode, - ACPI_PARSE_OBJECT *Op); - -ACPI_PARSE_OBJECT * -TrCreateNode ( - UINT32 ParseOpcode, - UINT32 NumChildren, - ...); - -ACPI_PARSE_OBJECT * -TrCreateLeafNode ( - UINT32 ParseOpcode); - -ACPI_PARSE_OBJECT * -TrCreateValuedLeafNode ( - UINT32 ParseOpcode, - ACPI_INTEGER Value); - -ACPI_PARSE_OBJECT * -TrLinkChildren ( - ACPI_PARSE_OBJECT *Op, - UINT32 NumChildren, - ...); - -void -TrSetEndLineNumber ( - ACPI_PARSE_OBJECT *Op); - -void -TrWalkTree (void); - -ACPI_PARSE_OBJECT * -TrLinkPeerNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2); - -ACPI_PARSE_OBJECT * -TrLinkChildNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2); - -ACPI_PARSE_OBJECT * -TrSetNodeFlags ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags); - -ACPI_PARSE_OBJECT * -TrLinkPeerNodes ( - UINT32 NumPeers, - ...); - -void -TrReleaseNode ( - ACPI_PARSE_OBJECT *Op); - -/* Analyze */ - -ACPI_STATUS -AnOtherSemanticAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnOtherSemanticAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnOperandTypecheckWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnOperandTypecheckWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodAnalysisWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodAnalysisWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodTypingWalkBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -AnMethodTypingWalkEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/* - * aslfiles - File I/O support - */ - -void -AslAbort (void); - -FILE * -FlOpenLocalFile ( - char *LocalName, - char *Mode); - -void -FlOpenIncludeFile ( - ACPI_PARSE_OBJECT *Op); - -void -FlFileError ( - UINT32 FileId, - UINT8 ErrorId); - -void -FlOpenFile ( - UINT32 FileId, - char *Filename, - char *Mode); - -ACPI_STATUS -FlReadFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length); - -void -FlWriteFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length); - -void -FlSeekFile ( - UINT32 FileId, - long Offset); - -void -FlCloseFile ( - UINT32 FileId); - -void -FlPrintFile ( - UINT32 FileId, - char *Format, - ...); - -void -FlSetLineNumber ( - ACPI_PARSE_OBJECT *Op); - -ACPI_STATUS -FlParseInputPathname ( - char *InputFilename); - -ACPI_STATUS -FlOpenInputFile ( - char *InputFilename); - -ACPI_STATUS -FlOpenAmlOutputFile ( - char *InputFilename); - -ACPI_STATUS -FlOpenMiscOutputFiles ( - char *InputFilename); - -void -MpDisplayReservedNames ( - void); - - -/* Load */ - -ACPI_STATUS -LdLoadNamespace ( - ACPI_PARSE_OBJECT *RootOp); - - -ACPI_STATUS -LdNamespace1Begin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -LdNamespace1End ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -/* Lookup */ - -ACPI_STATUS -LkCrossReferenceNamespace (void); - -ACPI_STATUS -LkNamespaceLocateBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -LkNamespaceLocateEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - -ACPI_STATUS -LsDisplayNamespace ( - void); - -ACPI_STATUS -LsCompareOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue); - - -/* Utils */ - -void -UtDisplayConstantOpcodes ( - void); - -void -UtBeginEvent ( - UINT32 Event, - char *Name); - -void -UtEndEvent ( - UINT32 Event); - -void * -UtLocalCalloc ( - UINT32 Size); - -void -UtPrintFormattedName ( - UINT16 ParseOpcode, - UINT32 Level); - -void -UtDisplaySummary ( - UINT32 FileId); - -UINT8 -UtHexCharToValue ( - int hc); - -void -UtConvertByteToHex ( - UINT8 RawByte, - UINT8 *Buffer); - -void -UtConvertByteToAsmHex ( - UINT8 RawByte, - UINT8 *Buffer); - -char * -UtGetOpName ( - UINT32 ParseOpcode); - -void -UtSetParseOpName ( - ACPI_PARSE_OBJECT *Op); - -ACPI_PARSE_OBJECT * -UtGetArg ( - ACPI_PARSE_OBJECT *Op, - UINT32 Argn); - -char * -UtGetStringBuffer ( - UINT32 Length); - -ACPI_STATUS -UtInternalizeName ( - char *ExternalName, - char **ConvertedName); - -void -UtAttachNamepathToOwner ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NameNode); - -ACPI_PARSE_OBJECT * -UtCheckIntegerRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 LowValue, - UINT32 HighValue); - -ACPI_STATUS -UtStrtoul64 ( - char *String, - UINT32 Base, - ACPI_INTEGER *RetInteger); - -ACPI_INTEGER -UtDoConstant ( - char *String); - - -/* Find */ - -void -LnAdjustLengthToRoot ( - ACPI_PARSE_OBJECT *Op, - UINT32 LengthDelta); - - -#define NEXT_RESOURCE_DESC(a,b) (ASL_RESOURCE_DESC *) (((char *) (a)) + sizeof(b)) - -#define DEFAULT_RESOURCE_DESC_SIZE (sizeof (ASL_RESOURCE_DESC) + sizeof (ASL_END_TAG_DESC)) - - -/* - * Resource utilities - */ - -ASL_RESOURCE_NODE * -RsAllocateResourceNode ( - UINT32 Size); - - void -RsCreateBitField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset, - UINT32 BitOffset); - -void -RsCreateByteField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset); - -void -RsSetFlagBits ( - UINT8 *Flags, - ACPI_PARSE_OBJECT *Op, - UINT8 Position, - UINT8 DefaultBit); - -ACPI_PARSE_OBJECT * -RsCompleteNodeAndGetNext ( - ACPI_PARSE_OBJECT *Op); - -ASL_RESOURCE_NODE * -RsDoOneResourceDescriptor ( - ACPI_PARSE_OBJECT *DescriptorTypeOp, - UINT32 CurrentByteOffset, - UINT8 *State); - -#define ACPI_RSTATE_NORMAL 0 -#define ACPI_RSTATE_START_DEPENDENT 1 -#define ACPI_RSTATE_DEPENDENT_LIST 2 - -UINT32 -RsLinkDescriptorChain ( - ASL_RESOURCE_NODE **PreviousRnode, - ASL_RESOURCE_NODE *Rnode); - - -/* - * Small descriptors - */ - -ASL_RESOURCE_NODE * -RsDoDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoEndDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoFixedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoInterruptDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIrqDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIrqNoFlagsDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory24Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory32Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory32FixedDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoStartDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoStartDependentNoPriDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoVendorSmallDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * Large descriptors - */ - -UINT32 -RsGetStringDataLength ( - ACPI_PARSE_OBJECT *InitializerOp); - -ASL_RESOURCE_NODE * -RsDoDwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoDwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoQwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoQwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoWordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoWordBusNumberDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoVendorLargeDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoGeneralRegisterDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -#endif /* __ASLCOMPILER_H */ - diff --git a/sys/dev/acpi/acpica/Subsystem/aslerror.c b/sys/dev/acpi/acpica/Subsystem/aslerror.c deleted file mode 100644 index 6ab54ffa0b7..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslerror.c +++ /dev/null @@ -1,621 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslerror - Error handling and statistics - * $Revision: 82 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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 ASL_EXCEPTIONS -#include "aslcompiler.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslerror") - - -/******************************************************************************* - * - * FUNCTION: AeAddToErrorLog - * - * PARAMETERS: Enode - An error node to add to the log - * - * RETURN: None - * - * DESCRIPTION: Add a new error node to the error log. The error log is - * ordered by the "logical" line number (cumulative line number - * including all include files.) - * - ******************************************************************************/ - -void -AeAddToErrorLog ( - ASL_ERROR_MSG *Enode) -{ - ASL_ERROR_MSG *Next; - ASL_ERROR_MSG *Prev; - - - if (!Gbl_ErrorLog) - { - Gbl_ErrorLog = Enode; - return; - } - - /* List is sorted according to line number */ - - if (!Gbl_ErrorLog) - { - Gbl_ErrorLog = Enode; - return; - } - - /* Walk error list until we find a line number greater than ours */ - - Prev = NULL; - Next = Gbl_ErrorLog; - - while ((Next) && - (Next->LogicalLineNumber <= Enode->LogicalLineNumber)) - { - Prev = Next; - Next = Next->Next; - } - - /* Found our place in the list */ - - Enode->Next = Next; - - if (Prev) - { - Prev->Next = Enode; - } - else - { - Gbl_ErrorLog = Enode; - } -} - - -/******************************************************************************* - * - * FUNCTION: AePrintException - * - * PARAMETERS: Where - Where to send the message - * Enode - Error node to print - * Header - Additional text before each message - * - * RETURN: None - * - * DESCRIPTION: Print the contents of an error node. - * - * NOTE: We don't use the FlxxxFile I/O functions here because on error - * they abort the compiler and call this function! Since we - * are reporting errors here, we ignore most output errors and - * just try to get out as much as we can. - * - ******************************************************************************/ - -void -AePrintException ( - UINT32 FileId, - ASL_ERROR_MSG *Enode, - char *Header) -{ - UINT8 SourceByte; - UINT32 Actual; - UINT32 MsgLength; - char *MainMessage; - char *ExtraMessage; - UINT32 SourceColumn; - UINT32 ErrorColumn; - FILE *OutputFile; - FILE *SourceFile; - - - /* Only listing files have a header, and remarks/optimizations are always output */ - - if (!Header) - { - /* Ignore remarks if requested */ - - switch (Enode->Level) - { - case ASL_REMARK: - if (!Gbl_DisplayRemarks) - { - return; - } - break; - - case ASL_OPTIMIZATION: - if (!Gbl_DisplayOptimizations) - { - return; - } - break; - - default: - break; - } - } - - /* Get the file handles */ - - OutputFile = Gbl_Files[FileId].Handle; - SourceFile = Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Handle; - - if (Header) - { - fprintf (OutputFile, "%s", Header); - } - - /* Print filename and line number if present and valid */ - - if (Enode->Filename) - { - if (Gbl_VerboseErrors) - { - fprintf (OutputFile, "%6s", Enode->Filename); - - if (Enode->LineNumber) - { - fprintf (OutputFile, "%6u: ", Enode->LineNumber); - - /* - * Seek to the offset in the combined source file, read the source - * line, and write it to the output. - */ - Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, SEEK_SET); - if (Actual) - { - fprintf (OutputFile, "[*** iASL: Seek error on source code temp file ***]"); - } - else - { - Actual = fread (&SourceByte, 1, 1, SourceFile); - if (!Actual) - { - fprintf (OutputFile, "[*** iASL: Read error on source code temp file ***]"); - } - - else while (Actual && SourceByte && (SourceByte != '\n')) - { - fwrite (&SourceByte, 1, 1, OutputFile); - Actual = fread (&SourceByte, 1, 1, SourceFile); - } - } - fprintf (OutputFile, "\n"); - } - } - else - { - fprintf (OutputFile, "%s", Enode->Filename); - - if (Enode->LineNumber) - { - fprintf (OutputFile, "(%u) : ", Enode->LineNumber); - } - } - } - - /* NULL message ID, just print the raw message */ - - if (Enode->MessageId == 0) - { - fprintf (OutputFile, "%s\n", Enode->Message); - } - else - { - /* Decode the message ID */ - - fprintf (OutputFile, "%s %4.4d -", - AslErrorLevel[Enode->Level], - Enode->MessageId + ((Enode->Level+1) * 1000)); - - MainMessage = AslMessages[Enode->MessageId]; - ExtraMessage = Enode->Message; - - if (Enode->LineNumber) - { - MsgLength = strlen (MainMessage); - if (MsgLength == 0) - { - MainMessage = Enode->Message; - - MsgLength = strlen (MainMessage); - ExtraMessage = NULL; - } - - if (Gbl_VerboseErrors) - { - SourceColumn = Enode->Column + Enode->FilenameLength + 6 + 2; - ErrorColumn = ASL_ERROR_LEVEL_LENGTH + 5 + 2 + 1; - - if ((MsgLength + ErrorColumn) < (SourceColumn - 1)) - { - fprintf (OutputFile, "%*s%s", - (int) ((SourceColumn - 1) - ErrorColumn), - MainMessage, " ^ "); - } - else - { - fprintf (OutputFile, "%*s %s", - (int) ((SourceColumn - ErrorColumn) + 1), "^", - MainMessage); - } - } - else - { - fprintf (OutputFile, " %s", MainMessage); - } - - /* Print the extra info message if present */ - - if (ExtraMessage) - { - fprintf (OutputFile, " (%s)", ExtraMessage); - } - - fprintf (OutputFile, "\n"); - if (Gbl_VerboseErrors) - { - fprintf (OutputFile, "\n"); - } - } - else - { - fprintf (OutputFile, " %s %s\n\n", - MainMessage, - ExtraMessage); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: AePrintErrorLog - * - * PARAMETERS: FileId - Where to output the error log - * - * RETURN: None - * - * DESCRIPTION: Print the entire contents of the error log - * - ******************************************************************************/ - -void -AePrintErrorLog ( - UINT32 FileId) -{ - ASL_ERROR_MSG *Enode = Gbl_ErrorLog; - - - /* Walk the error node list */ - - while (Enode) - { - AePrintException (FileId, Enode, NULL); - Enode = Enode->Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: AslCommonError - * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) - * MessageId - Index into global message buffer - * CurrentLineNumber - Actual file line number - * LogicalLineNumber - Cumulative line number - * LogicalByteOffset - Byte offset in source file - * Column - Column in current line - * Filename - source filename - * ExtraMessage - additional error message - * - * RETURN: New error node for this error - * - * DESCRIPTION: Create a new error node and add it to the error log - * - ******************************************************************************/ - -void -AslCommonError ( - UINT8 Level, - UINT8 MessageId, - UINT32 CurrentLineNumber, - UINT32 LogicalLineNumber, - UINT32 LogicalByteOffset, - UINT32 Column, - char *Filename, - char *ExtraMessage) -{ - UINT32 MessageSize; - char *MessageBuffer = NULL; - ASL_ERROR_MSG *Enode; - - - Enode = UtLocalCalloc (sizeof (ASL_ERROR_MSG)); - - if (ExtraMessage) - { - /* Allocate a buffer for the message and a new error node */ - - MessageSize = strlen (ExtraMessage) + 1; - MessageBuffer = UtLocalCalloc (MessageSize); - - /* Keep a copy of the extra message */ - - ACPI_STRCPY (MessageBuffer, ExtraMessage); - } - - /* Initialize the error node */ - - if (Filename) - { - Enode->Filename = Filename; - Enode->FilenameLength = strlen (Filename); - if (Enode->FilenameLength < 6) - { - Enode->FilenameLength = 6; - } - } - - Enode->MessageId = MessageId; - Enode->Level = Level; - Enode->LineNumber = CurrentLineNumber; - Enode->LogicalLineNumber = LogicalLineNumber; - Enode->LogicalByteOffset = LogicalByteOffset; - Enode->Column = Column; - Enode->Message = MessageBuffer; - - /* Add the new node to the error node list */ - - AeAddToErrorLog (Enode); - - if (Gbl_DebugFlag) - { - /* stderr is a file, send error to it immediately */ - - AePrintException (ASL_FILE_STDERR, Enode, NULL); - } - - Gbl_ExceptionCount[Level]++; - if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT) - { - printf ("\nMaximum error count (%d) exceeded.\n", ASL_MAX_ERROR_COUNT); - - Gbl_SourceLine = 0; - Gbl_NextError = Gbl_ErrorLog; - CmDoOutputFiles (); - CmCleanupAndExit (); - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: AslError - * - * PARAMETERS: Level - Seriousness (Warning/error, etc.) - * MessageId - Index into global message buffer - * Op - Parse node where error happened - * ExtraMessage - additional error message - * - * RETURN: None - * - * DESCRIPTION: Main error reporting routine for the ASL compiler (all code - * except the parser.) - * - ******************************************************************************/ - -void -AslError ( - UINT8 Level, - UINT8 MessageId, - ACPI_PARSE_OBJECT *Op, - char *ExtraMessage) -{ - - if (Op) - { - AslCommonError (Level, MessageId, Op->Asl.LineNumber, - Op->Asl.LogicalLineNumber, - Op->Asl.LogicalByteOffset, - Op->Asl.Column, - Op->Asl.Filename, ExtraMessage); - } - else - { - AslCommonError (Level, MessageId, 0, - 0, 0, 0, NULL, ExtraMessage); - } -} - - -/******************************************************************************* - * - * FUNCTION: AslCoreSubsystemError - * - * PARAMETERS: Op - Parse node where error happened - * Status - The ACPI CA Exception - * ExtraMessage - additional error message - * Abort - TRUE -> Abort compilation - * - * RETURN: None - * - * DESCRIPTION: Error reporting routine for exceptions returned by the ACPI - * CA core subsystem. - * - ******************************************************************************/ - -void -AslCoreSubsystemError ( - ACPI_PARSE_OBJECT *Op, - ACPI_STATUS Status, - char *ExtraMessage, - BOOLEAN Abort) -{ - - sprintf (MsgBuffer, "%s %s", AcpiFormatException (Status), ExtraMessage); - - if (Op) - { - AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Op->Asl.LineNumber, - Op->Asl.LogicalLineNumber, - Op->Asl.LogicalByteOffset, - Op->Asl.Column, - Op->Asl.Filename, MsgBuffer); - } - else - { - AslCommonError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, 0, - 0, 0, 0, NULL, MsgBuffer); - } - - if (Abort) - { - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: AslCompilererror - * - * PARAMETERS: CompilerMessage - Error message from the parser - * - * RETURN: Status? - * - * DESCRIPTION: Report an error situation discovered in a production - * NOTE: don't change the name of this function. - * - ******************************************************************************/ - -int -AslCompilererror ( - char *CompilerMessage) -{ - - AslCommonError (ASL_ERROR, ASL_MSG_SYNTAX, Gbl_CurrentLineNumber, - Gbl_LogicalLineNumber, Gbl_CurrentLineOffset, - Gbl_CurrentColumn, Gbl_Files[ASL_FILE_INPUT].Filename, - CompilerMessage); - - return 0; -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslfiles.c b/sys/dev/acpi/acpica/Subsystem/aslfiles.c deleted file mode 100644 index e653655d464..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslfiles.c +++ /dev/null @@ -1,847 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslfiles - file I/O suppoert - * $Revision: 44 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#include "aslcompiler.h" -#include "acapps.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslfiles") - - -/******************************************************************************* - * - * FUNCTION: AslAbort - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Dump the error log and abort the compiler. Used for serious - * I/O errors - * - ******************************************************************************/ - -void -AslAbort (void) -{ - - AePrintErrorLog (ASL_FILE_STDOUT); - if (Gbl_DebugFlag) - { - /* Print error summary to the debug file */ - - AePrintErrorLog (ASL_FILE_STDERR); - } - - exit (0); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenLocalFile - * - * PARAMETERS: LocalName - Single filename (not a pathname) - * Mode - Open mode for fopen - * - * RETURN: File descriptor - * - * DESCRIPTION: Build a complete pathname for the input filename and open - * the file. - * - ******************************************************************************/ - -FILE * -FlOpenLocalFile ( - char *LocalName, - char *Mode) -{ - - strcpy (StringBuffer, Gbl_DirectoryPath); - strcat (StringBuffer, LocalName); - - DbgPrint (ASL_PARSE_OUTPUT, "FlOpenLocalFile: %s\n", StringBuffer); - return (fopen (StringBuffer, (const char *) Mode)); -} - - -/******************************************************************************* - * - * FUNCTION: FlFileError - * - * PARAMETERS: FileId - Index into file info array - * ErrorId - Index into error message array - * - * RETURN: None - * - * DESCRIPTION: Decode errno to an error message and add the entire error - * to the error log. - * - ******************************************************************************/ - -void -FlFileError ( - UINT32 FileId, - UINT8 ErrorId) -{ - - sprintf (MsgBuffer, "\"%s\" (%s)", Gbl_Files[FileId].Filename, strerror (errno)); - AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenFile - * - * PARAMETERS: FileId - Index into file info array - * Filename - file pathname to open - * Mode - Open mode for fopen - * - * RETURN: File descriptor - * - * DESCRIPTION: Open a file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlOpenFile ( - UINT32 FileId, - char *Filename, - char *Mode) -{ - FILE *File; - - - File = fopen (Filename, Mode); - - Gbl_Files[FileId].Filename = Filename; - Gbl_Files[FileId].Handle = File; - - if (!File) - { - FlFileError (FileId, ASL_MSG_OPEN); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlReadFile - * - * PARAMETERS: FileId - Index into file info array - * Buffer - Where to place the data - * Length - Amount to read - * - * RETURN: Status. AE_ERROR indicates EOF. - * - * DESCRIPTION: Read data from an open file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -ACPI_STATUS -FlReadFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length) -{ - UINT32 Actual; - - - /* Read and check for error */ - - Actual = fread (Buffer, 1, Length, Gbl_Files[FileId].Handle); - if (Actual != Length) - { - if (feof (Gbl_Files[FileId].Handle)) - { - /* End-of-file, just return error */ - - return (AE_ERROR); - } - - FlFileError (FileId, ASL_MSG_READ); - AslAbort (); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlWriteFile - * - * PARAMETERS: FileId - Index into file info array - * Buffer - Data to write - * Length - Amount of data to write - * - * RETURN: Status - * - * DESCRIPTION: Write data to an open file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlWriteFile ( - UINT32 FileId, - void *Buffer, - UINT32 Length) -{ - UINT32 Actual; - - - /* Write and check for error */ - - Actual = fwrite ((char *) Buffer, 1, Length, Gbl_Files[FileId].Handle); - if (Actual != Length) - { - FlFileError (FileId, ASL_MSG_WRITE); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlPrintFile - * - * PARAMETERS: FileId - Index into file info array - * Format - Printf format string - * ... - Printf arguments - * - * RETURN: None - * - * DESCRIPTION: Formatted write to an open file. - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlPrintFile ( - UINT32 FileId, - char *Format, - ...) -{ - INT32 Actual; - va_list Args; - - - va_start (Args, Format); - - Actual = vfprintf (Gbl_Files[FileId].Handle, Format, Args); - if (Actual == -1) - { - FlFileError (FileId, ASL_MSG_WRITE); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlSeekFile - * - * PARAMETERS: FileId - Index into file info array - * Offset - Absolute byte offset in file - * - * RETURN: Status - * - * DESCRIPTION: Seek to absolute offset - * NOTE: Aborts compiler on any error. - * - ******************************************************************************/ - -void -FlSeekFile ( - UINT32 FileId, - long Offset) -{ - int Error; - - - Error = fseek (Gbl_Files[FileId].Handle, Offset, SEEK_SET); - if (Error) - { - FlFileError (FileId, ASL_MSG_SEEK); - AslAbort (); - } -} - - -/******************************************************************************* - * - * FUNCTION: FlCloseFile - * - * PARAMETERS: FileId - Index into file info array - * - * RETURN: Status - * - * DESCRIPTION: Close an open file. Aborts compiler on error - * - ******************************************************************************/ - -void -FlCloseFile ( - UINT32 FileId) -{ - int Error; - - - if (!Gbl_Files[FileId].Handle) - { - return; - } - - Error = fclose (Gbl_Files[FileId].Handle); - Gbl_Files[FileId].Handle = NULL; - - if (Error) - { - FlFileError (FileId, ASL_MSG_CLOSE); - AslAbort (); - } - - return; -} - - -/******************************************************************************* - * - * FUNCTION: FlSetLineNumber - * - * PARAMETERS: Op - Parse node for the LINE asl statement - * - * RETURN: None. - * - * DESCRIPTION: Set the current line number - * - ******************************************************************************/ - -void -FlSetLineNumber ( - ACPI_PARSE_OBJECT *Op) -{ - - Gbl_CurrentLineNumber = Op->Asl.Value.Integer32; - Gbl_LogicalLineNumber = Op->Asl.Value.Integer32; -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenIncludeFile - * - * PARAMETERS: Op - Parse node for the INCLUDE ASL statement - * - * RETURN: None. - * - * DESCRIPTION: Open an include file and push it on the input file stack. - * - ******************************************************************************/ - -void -FlOpenIncludeFile ( - ACPI_PARSE_OBJECT *Op) -{ - FILE *IncFile; - - - /* Op must be valid */ - - if (!Op) - { - AslCommonError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, " - Null parse node"); - - return; - } - - /* - * Flush out the "include ()" statement on this line, start - * the actual include file on the next line - */ - ResetCurrentLineBuffer (); - FlPrintFile (ASL_FILE_SOURCE_OUTPUT, "\n"); - Gbl_CurrentLineOffset++; - - /* Prepend the directory pathname and open the include file */ - - DbgPrint (ASL_PARSE_OUTPUT, "\nOpen include file: path %s\n\n", Op->Asl.Value.String); - IncFile = FlOpenLocalFile (Op->Asl.Value.String, "r"); - if (!IncFile) - { - sprintf (MsgBuffer, "%s (%s)", Op->Asl.Value.String, strerror (errno)); - AslError (ASL_ERROR, ASL_MSG_INCLUDE_FILE_OPEN, Op, MsgBuffer); - return; - } - - /* Push the include file on the open input file stack */ - - AslPushInputFileStack (IncFile, Op->Asl.Value.String); -} - - -/******************************************************************************* - * - * FUNCTION: FlParseInputPathname - * - * PARAMETERS: InputFilename - The user-specified ASL source file to be - * compiled - * - * RETURN: Status - * - * DESCRIPTION: Split the input path into a directory and filename part - * 1) Directory part used to open include files - * 2) Filename part used to generate output filenames - * - ******************************************************************************/ - -ACPI_STATUS -FlParseInputPathname ( - char *InputFilename) -{ - char *Substring; - - - if (!InputFilename) - { - return (AE_OK); - } - - /* Get the path to the input filename's directory */ - - Gbl_DirectoryPath = strdup (InputFilename); - if (!Gbl_DirectoryPath) - { - return (AE_NO_MEMORY); - } - - Substring = strrchr (Gbl_DirectoryPath, '\\'); - if (!Substring) - { - Substring = strrchr (Gbl_DirectoryPath, '/'); - if (!Substring) - { - Substring = strrchr (Gbl_DirectoryPath, ':'); - } - } - - if (!Substring) - { - Gbl_DirectoryPath[0] = 0; - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = strdup (InputFilename); - } - } - else - { - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = strdup (Substring + 1); - } - *(Substring+1) = 0; - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenInputFile - * - * PARAMETERS: InputFilename - The user-specified ASL source file to be - * compiled - * - * RETURN: Status - * - * DESCRIPTION: Open the specified input file, and save the directory path to - * the file so that include files can be opened in - * the same directory. - * - ******************************************************************************/ - -ACPI_STATUS -FlOpenInputFile ( - char *InputFilename) -{ - - - /* Open the input ASL file, text mode */ - - FlOpenFile (ASL_FILE_INPUT, InputFilename, "r"); - AslCompilerin = Gbl_Files[ASL_FILE_INPUT].Handle; - - /* Get the path to the input filename's directory */ - - Gbl_DirectoryPath = strdup (InputFilename); - if (!Gbl_DirectoryPath) - { - return (AE_NO_MEMORY); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenAmlOutputFile - * - * PARAMETERS: FilenamePrefix - The user-specified ASL source file - * - * RETURN: Status - * - * DESCRIPTION: Create the output filename (*.AML) and open the file. The file - * is created in the same directory as the parent input file. - * - ******************************************************************************/ - -ACPI_STATUS -FlOpenAmlOutputFile ( - char *FilenamePrefix) -{ - char *Filename; - - - /* Output filename usually comes from the ASL itself */ - - Filename = Gbl_Files[ASL_FILE_AML_OUTPUT].Filename; - if (!Filename) - { - /* Create the output AML filename */ - - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_OUTPUT_FILENAME, 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - } - - /* Open the output AML file in binary mode */ - - FlOpenFile (ASL_FILE_AML_OUTPUT, Filename, "w+b"); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: FlOpenMiscOutputFiles - * - * PARAMETERS: FilenamePrefix - The user-specified ASL source file - * - * RETURN: Status - * - * DESCRIPTION: Create and open the various output files needed, depending on - * the command line options - * - ******************************************************************************/ - -ACPI_STATUS -FlOpenMiscOutputFiles ( - char *FilenamePrefix) -{ - char *Filename; - - - /* Create/Open a combined source output file */ - - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* - * Open the source output file, binary mode (so that LF does not get - * expanded to CR/LF on some systems, messing up our seek - * calculations.) - */ - FlOpenFile (ASL_FILE_SOURCE_OUTPUT, Filename, "w+b"); - - /* Create/Open a listing output file if asked */ - - if (Gbl_ListingFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_LISTING); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the listing file, text mode */ - - FlOpenFile (ASL_FILE_LISTING_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_LISTING_OUTPUT); - AslCompilerFileHeader (ASL_FILE_LISTING_OUTPUT); - } - - /* Create/Open a assembly code source output file if asked */ - - if (Gbl_AsmOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_SOURCE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the assembly code source file, text mode */ - - FlOpenFile (ASL_FILE_ASM_SOURCE_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_ASM_SOURCE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_ASM_SOURCE_OUTPUT); - } - - /* Create/Open a C code source output file if asked */ - - if (Gbl_C_OutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_SOURCE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the C code source file, text mode */ - - FlOpenFile (ASL_FILE_C_SOURCE_OUTPUT, Filename, "w+"); - - FlPrintFile (ASL_FILE_C_SOURCE_OUTPUT, "/*\n"); - AslCompilerSignon (ASL_FILE_C_SOURCE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_C_SOURCE_OUTPUT); - } - - /* Create/Open a assembly include output file if asked */ - - if (Gbl_AsmIncludeOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_INCLUDE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the assembly include file, text mode */ - - FlOpenFile (ASL_FILE_ASM_INCLUDE_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_ASM_INCLUDE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_ASM_INCLUDE_OUTPUT); - } - - /* Create/Open a C include output file if asked */ - - if (Gbl_C_IncludeOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_INCLUDE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the C include file, text mode */ - - FlOpenFile (ASL_FILE_C_INCLUDE_OUTPUT, Filename, "w+"); - - FlPrintFile (ASL_FILE_C_INCLUDE_OUTPUT, "/*\n"); - AslCompilerSignon (ASL_FILE_C_INCLUDE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_C_INCLUDE_OUTPUT); - } - - /* Create/Open a hex output file if asked */ - - if (Gbl_HexOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the hex file, text mode */ - - FlOpenFile (ASL_FILE_HEX_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_HEX_OUTPUT); - AslCompilerFileHeader (ASL_FILE_HEX_OUTPUT); - } - - /* Create a namespace output file if asked */ - - if (Gbl_NsOutputFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_NAMESPACE); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the namespace file, text mode */ - - FlOpenFile (ASL_FILE_NAMESPACE_OUTPUT, Filename, "w+"); - - AslCompilerSignon (ASL_FILE_NAMESPACE_OUTPUT); - AslCompilerFileHeader (ASL_FILE_NAMESPACE_OUTPUT); - } - - /* Create/Open a debug output file if asked */ - - if (Gbl_DebugFlag) - { - Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG); - if (!Filename) - { - AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, 0, 0, 0, 0, NULL, NULL); - return (AE_ERROR); - } - - /* Open the debug file as STDERR, text mode */ - - /* TBD: hide this behind a FlReopenFile function */ - - Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename; - Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = freopen (Filename, "w+t", stderr); - - AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT); - AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT); - } - - return (AE_OK); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslfold.c b/sys/dev/acpi/acpica/Subsystem/aslfold.c deleted file mode 100644 index bd78627e091..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslfold.c +++ /dev/null @@ -1,532 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslfold - Constant folding - * $Revision: 6 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - -#include "acdispat.h" -#include "acparser.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslfold") - - -/******************************************************************************* - * - * FUNCTION: OpcAmlEvaluationWalk1 - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback for AML execution of constant subtrees - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlEvaluationWalk1 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = Context; - ACPI_STATUS Status; - ACPI_PARSE_OBJECT *OutOp; - - - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* Copy child pointer to Arg for compatibility with Interpreter */ - - if (Op->Asl.Child) - { - Op->Common.Value.Arg = Op->Asl.Child; - } - - /* Call AML dispatcher */ - - Status = AcpiDsExecBeginOp (WalkState, &OutOp); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Constant interpretation failed - %s\n", - AcpiFormatException (Status)); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlEvaluationWalk2 - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback for AML execution of constant subtrees - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlEvaluationWalk2 ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = Context; - ACPI_STATUS Status; - - - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* Copy child pointer to Arg for compatibility with Interpreter */ - - if (Op->Asl.Child) - { - Op->Common.Value.Arg = Op->Asl.Child; - } - - /* Call AML dispatcher */ - - Status = AcpiDsExecEndOp (WalkState); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("Constant interpretation failed - %s\n", - AcpiFormatException (Status)); - } - - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlCheckForConstant - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Check one Op for a type 3/4/5 AML opcode - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlCheckForConstant ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = Context; - - - WalkState->Op = Op; - WalkState->Opcode = Op->Common.AmlOpcode; - WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, "[%.4d] Opcode: %12.12s ", - Op->Asl.LogicalLineNumber, Op->Asl.ParseOpName); - - if (!(WalkState->OpInfo->Flags & AML_CONSTANT)) - { - /* The opcode is not a Type 3/4/5 opcode */ - - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - DbgPrint (ASL_PARSE_OUTPUT, "**** Valid Target, cannot reduce ****\n"); - } - else - { - DbgPrint (ASL_PARSE_OUTPUT, "**** Not a Type 3/4/5 opcode ****\n"); - } - - if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL) - { - /* - * We are looking at at normal expression to see if it can be - * reduced. It can't. No error - */ - return (AE_TYPE); - } - - /* - * This is an expression that MUST reduce to a constant, and it - * can't be reduced. This is an error - */ - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op, Op->Asl.ParseOpName); - } - else - { - AslError (ASL_ERROR, ASL_MSG_INVALID_CONSTANT_OP, Op, Op->Asl.ParseOpName); - } - - return (AE_TYPE); - } - - /* Debug output */ - - DbgPrint (ASL_PARSE_OUTPUT, "TYPE_345"); - - if (Op->Asl.CompileFlags & NODE_IS_TARGET) - { - DbgPrint (ASL_PARSE_OUTPUT, " TARGET"); - } - if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG) - { - DbgPrint (ASL_PARSE_OUTPUT, " TERMARG"); - } - DbgPrint (ASL_PARSE_OUTPUT, "\n"); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OpcAmlConstantWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Reduce an Op and its subtree to a constant if possible - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlConstantWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState; - ACPI_STATUS Status = AE_OK; - ACPI_OPERAND_OBJECT *ObjDesc; - ACPI_PARSE_OBJECT *RootOp; - ACPI_PARSE_OBJECT *OriginalParentOp; - UINT8 WalkType; - - - /* - * Only interested in subtrees that could possibly contain - * expressions that can be evaluated at this time - */ - if ((!(Op->Asl.CompileFlags & NODE_COMPILE_TIME_CONST)) || - (Op->Asl.CompileFlags & NODE_IS_TARGET)) - { - return (AE_OK); - } - - /* - * Set the walk type based on the reduction used for this op - */ - if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG) - { - /* Op is a TermArg, constant folding is merely optional */ - - if (!Gbl_FoldConstants) - { - return (AE_CTRL_DEPTH); - } - - WalkType = ACPI_WALK_CONST_OPTIONAL; - } - else - { - /* Op is a DataObject, the expression MUST reduced to a constant */ - - WalkType = ACPI_WALK_CONST_REQUIRED; - } - - /* Create a new walk state */ - - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL); - if (!WalkState) - { - return AE_NO_MEMORY; - } - - WalkState->NextOp = NULL; - WalkState->Params = NULL; - WalkState->CallerReturnDesc = &ObjDesc; - WalkState->WalkType = WalkType; - - /* Examine the entire subtree -- all nodes must be constants or type 3/4/5 opcodes */ - - Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD, - OpcAmlCheckForConstant, NULL, WalkState); - - /* - * Did we find an entire subtree that contains all constants and type 3/4/5 - * opcodes? (Only AE_OK or AE_TYPE returned from above) - */ - if (Status == AE_TYPE) - { - /* Subtree cannot be reduced to a constant */ - - if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL) - { - AcpiDsDeleteWalkState (WalkState); - return (AE_OK); - } - - /* Don't descend any further, and use a default "constant" value */ - - Status = AE_CTRL_DEPTH; - } - else - { - /* Subtree can be reduced */ - - /* Allocate a new temporary root for this subtree */ - - RootOp = TrAllocateNode (PARSEOP_INTEGER); - if (!RootOp) - { - return (AE_NO_MEMORY); - } - - RootOp->Common.AmlOpcode = AML_INT_EVAL_SUBTREE_OP; - - OriginalParentOp = Op->Common.Parent; - Op->Common.Parent = RootOp; - - /* - * Hand off the subtree to the AML interpreter - */ - Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState); - Op->Common.Parent = OriginalParentOp; - - /* TBD: we really *should* release the RootOp node */ - - if (ACPI_SUCCESS (Status)) - { - TotalFolds++; - - /* Get the final result */ - - Status = AcpiDsResultPop (&ObjDesc, WalkState); - } - } - - if (ACPI_FAILURE (Status)) - { - /* We could not resolve the subtree for some reason */ - - AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op, Op->Asl.ParseOpName); - - /* Set the subtree value to ZERO anyway. Eliminates further errors */ - - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Common.Value.Integer = 0; - OpcSetOptimalIntegerSize (Op); - } - else - { - AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op, Op->Asl.ParseOpName); - - /* - * Because we know we executed type 3/4/5 opcodes above, we know that - * the result must be either an Integer, String, or Buffer. - */ - switch (ACPI_GET_OBJECT_TYPE (ObjDesc)) - { - case ACPI_TYPE_INTEGER: - - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Common.Value.Integer = ObjDesc->Integer.Value; - OpcSetOptimalIntegerSize (Op); - - DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (INTEGER) %8.8X%8.8X\n", - ACPI_HIDWORD (ObjDesc->Integer.Value), - ACPI_LODWORD (ObjDesc->Integer.Value)); - break; - - - case ACPI_TYPE_STRING: - - Op->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; - Op->Common.AmlOpcode = AML_STRING_OP; - Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1; - Op->Common.Value.String = ObjDesc->String.Pointer; - - DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (STRING) %s\n", - Op->Common.Value.String); - - break; - - - case ACPI_TYPE_BUFFER: - - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Common.AmlOpcode = AML_BUFFER_OP; - UtSetParseOpName (Op); - - /* Child node is the buffer length */ - - RootOp = TrAllocateNode (PARSEOP_INTEGER); - - RootOp->Asl.AmlOpcode = AML_DWORD_OP; - RootOp->Asl.Value.Integer = ObjDesc->Buffer.Length; - RootOp->Asl.Parent = Op; - - (void) OpcSetOptimalIntegerSize (RootOp); - - Op->Asl.Child = RootOp; - Op = RootOp; - UtSetParseOpName (Op); - - /* Peer to the child is the raw buffer data */ - - RootOp = TrAllocateNode (PARSEOP_RAW_DATA); - RootOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - RootOp->Asl.AmlLength = ObjDesc->Buffer.Length; - RootOp->Asl.Value.String = (char *) ObjDesc->Buffer.Pointer; - RootOp->Asl.Parent = Op->Asl.Parent; - - Op->Asl.Next = RootOp; - Op = RootOp; - - DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (BUFFER) length %X\n", - ObjDesc->Buffer.Length); - break; - - - default: - printf ("Unsupported return type: %s\n", - AcpiUtGetObjectTypeName (ObjDesc)); - break; - } - } - - UtSetParseOpName (Op); - Op->Asl.Child = NULL; - - AcpiDsDeleteWalkState (WalkState); - - return (AE_CTRL_DEPTH); -} - diff --git a/sys/dev/acpi/acpica/Subsystem/aslglobal.h b/sys/dev/acpi/acpica/Subsystem/aslglobal.h deleted file mode 100644 index f5e40efb9e6..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslglobal.h +++ /dev/null @@ -1,265 +0,0 @@ - - -/****************************************************************************** - * - * Module Name: aslglobal.h - Global variable definitions - * $Revision: 38 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#ifndef __ASLGLOBAL_H -#define __ASLGLOBAL_H - - -/* - * Global variables. Defined in aslmain.c only, externed in all other files - */ - -#ifdef _DECLARE_GLOBALS -#define ASL_EXTERN -#define ASL_INIT_GLOBAL(a,b) (a)=(b) -#else -#define ASL_EXTERN extern -#define ASL_INIT_GLOBAL(a,b) (a) -#endif - - -/* - * Parser and other externals - */ -extern int yydebug; -extern FILE *AslCompilerin; -extern int AslCompilerdebug; -extern const ASL_MAPPING_ENTRY AslKeywordMapping[]; -extern char *AslCompilertext; -extern char hex[]; - -#define ASL_LINE_BUFFER_SIZE 512 -#define ASL_MSG_BUFFER_SIZE (ASL_LINE_BUFFER_SIZE * 2) - - -/* Source code buffers and pointers for error reporting */ - -ASL_EXTERN char Gbl_CurrentLineBuffer[ASL_LINE_BUFFER_SIZE]; -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentColumn, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineNumber, 1); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_LogicalLineNumber, 1); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLineOffset, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_LineBufPtr, Gbl_CurrentLineBuffer); - - -/* Exception reporting */ - -ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_ErrorLog,NULL); -ASL_EXTERN ASL_ERROR_MSG ASL_INIT_GLOBAL (*Gbl_NextError,NULL); -extern UINT32 Gbl_ExceptionCount[]; - - -/* Option flags */ - -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_OutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_AsmIncludeOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE); -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE); - - -#define HEX_OUTPUT_NONE 0 -#define HEX_OUTPUT_C 1 -#define HEX_OUTPUT_ASM 2 -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE); - - -/* Files */ - -ASL_EXTERN ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES]; - -ASL_EXTERN char *Gbl_DirectoryPath; -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL); -ASL_EXTERN char *Gbl_CurrentInputFilename; - -ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HasIncludeFiles, FALSE); - - -/* Statistics */ - -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_InputByteCount, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NsLookupCount, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalKeywords, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalNamedObjects, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalExecutableOpcodes, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalParseNodes, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalMethods, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocations, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalAllocated, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (TotalFolds, 0); - - -/* Misc */ - -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*RootNode, NULL); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TableLength, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_SourceLine, 0); -ASL_EXTERN ASL_LISTING_NODE ASL_INIT_GLOBAL (*Gbl_ListingNode, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheNext, NULL); -ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TempCount, 0); -ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode; - - -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentHexColumn, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentAmlOffset, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_CurrentLine, 0); -ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_HexBytesWereWritten, FALSE); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_NumNamespaceObjects, 0); -ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_ReservedMethods, 0); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableSignature, "NO_SIG"); -ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_TableId, "NO_ID"); -ASL_EXTERN FILE *AcpiGbl_DebugFile; /* Placeholder for oswinxf only */ - - -/* Static structures */ - -ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo; -ASL_EXTERN ACPI_TABLE_HEADER TableHeader; -extern const ASL_RESERVED_INFO ReservedMethods[]; -ASL_EXTERN ASL_EVENT_INFO AslGbl_Events[21]; - - -/* Scratch buffers */ - -ASL_EXTERN UINT8 Gbl_AmlBuffer[16]; -ASL_EXTERN char MsgBuffer[ASL_MSG_BUFFER_SIZE]; -ASL_EXTERN char StringBuffer[ASL_MSG_BUFFER_SIZE]; -ASL_EXTERN char StringBuffer2[ASL_MSG_BUFFER_SIZE]; - -#endif /* __ASLGLOBAL_H */ - diff --git a/sys/dev/acpi/acpica/Subsystem/asllength.c b/sys/dev/acpi/acpica/Subsystem/asllength.c deleted file mode 100644 index 9ef8c31900a..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asllength.c +++ /dev/null @@ -1,504 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asllength - Tree walk to determine package and opcode lengths - * $Revision: 29 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asllength") - - -/******************************************************************************* - * - * FUNCTION: LnInitLengthsWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Walk callback to initialize (and re-initialize) the node - * subtree length(s) to zero. The Subtree lengths are bubbled - * up to the root node in order to get a total AML length. - * - ******************************************************************************/ - -ACPI_STATUS -LnInitLengthsWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - Op->Asl.AmlSubtreeLength = 0; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LnPackageLengthWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Walk callback to calculate the total AML length. - * 1) Calculate the AML lengths (opcode, package length, etc.) for - * THIS node. - * 2) Bubbble up all of these lengths to the parent node by summing - * them all into the parent subtree length. - * - * Note: The SubtreeLength represents the total AML length of all child nodes - * in all subtrees under a given node. Therefore, once this walk is - * complete, the Root Node subtree length is the AML length of the entire - * tree (and thus, the entire ACPI table) - * - ******************************************************************************/ - -ACPI_STATUS -LnPackageLengthWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - /* Generate the AML lengths for this node */ - - CgGenerateAmlLengths (Op); - - /* Bubble up all lengths (this node and all below it) to the parent */ - - if ((Op->Asl.Parent) && - (Op->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - Op->Asl.Parent->Asl.AmlSubtreeLength += (Op->Asl.AmlLength + - Op->Asl.AmlOpcodeLength + - Op->Asl.AmlPkgLenBytes + - Op->Asl.AmlSubtreeLength); - } - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LnAdjustLengthToRoot - * - * PARAMETERS: Op - Node whose Length was changed - * - * RETURN: None. - * - * DESCRIPTION: Change the Subtree length of the given node, and bubble the - * change all the way up to the root node. This allows for - * last second changes to a package length (for example, if the - * package length encoding gets shorter or longer.) - * - ******************************************************************************/ - -void -LnAdjustLengthToRoot ( - ACPI_PARSE_OBJECT *SubtreeOp, - UINT32 LengthDelta) -{ - ACPI_PARSE_OBJECT *Op; - - - /* Adjust all subtree lengths up to the root */ - - Op = SubtreeOp->Asl.Parent; - while (Op) - { - Op->Asl.AmlSubtreeLength -= LengthDelta; - Op = Op->Asl.Parent; - } - - /* Adjust the global table length */ - - Gbl_TableLength -= LengthDelta; -} - - -/******************************************************************************* - * - * FUNCTION: CgGetPackageLenByteCount - * - * PARAMETERS: Op - Parse node - * PackageLength - Length to be encoded - * - * RETURN: Required length of the package length encoding - * - * DESCRIPTION: Calculate the number of bytes required to encode the given - * package length. - * - ******************************************************************************/ - -UINT8 -CgGetPackageLenByteCount ( - ACPI_PARSE_OBJECT *Op, - UINT32 PackageLength) -{ - - /* - * Determine the number of bytes required to encode the package length - * Note: the package length includes the number of bytes used to encode - * the package length, so we must account for this also. - */ - if (PackageLength <= (0x0000003F - 1)) - { - return (1); - } - else if (PackageLength <= (0x00000FFF - 2)) - { - return (2); - } - else if (PackageLength <= (0x000FFFFF - 3)) - { - return (3); - } - else if (PackageLength <= (0x0FFFFFFF - 4)) - { - return (4); - } - else - { - /* Fatal error - the package length is too large to encode */ - - AslError (ASL_ERROR, ASL_MSG_ENCODING_LENGTH, Op, NULL); - } - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: CgGenerateAmlOpcodeLength - * - * PARAMETERS: Op - Parse node whose AML opcode lengths will be - * calculated - * - * RETURN: None. - * - * DESCRIPTION: Calculate the AmlOpcodeLength, AmlPkgLenBytes, and AmlLength - * fields for this node. - * - ******************************************************************************/ - -void -CgGenerateAmlOpcodeLength ( - ACPI_PARSE_OBJECT *Op) -{ - - /* Check for two-byte opcode */ - - if (Op->Asl.AmlOpcode > 0x00FF) - { - Op->Asl.AmlOpcodeLength = 2; - } - else - { - Op->Asl.AmlOpcodeLength = 1; - } - - /* Does this opcode have an associated "PackageLength" field? */ - - Op->Asl.AmlPkgLenBytes = 0; - if (Op->Asl.CompileFlags & NODE_AML_PACKAGE) - { - Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op, Op->Asl.AmlSubtreeLength); - } - - /* Data opcode lengths are easy */ - - switch (Op->Asl.AmlOpcode) - { - case AML_BYTE_OP: - - Op->Asl.AmlLength = 1; - break; - - case AML_WORD_OP: - - Op->Asl.AmlLength = 2; - break; - - case AML_DWORD_OP: - - Op->Asl.AmlLength = 4; - break; - - case AML_QWORD_OP: - - Op->Asl.AmlLength = 8; - break; - - default: - /* All data opcodes must be above */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: CgGenerateAmlLengths - * - * PARAMETERS: Op - Parse node - * - * RETURN: None. - * - * DESCRIPTION: Generate internal length fields based on the AML opcode or - * parse opcode. - * - ******************************************************************************/ - -void -CgGenerateAmlLengths ( - ACPI_PARSE_OBJECT *Op) -{ - char *Buffer; - ACPI_STATUS Status; - - - switch (Op->Asl.AmlOpcode) - { - case AML_RAW_DATA_BYTE: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 1; - return; - - case AML_RAW_DATA_WORD: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 2; - return; - - case AML_RAW_DATA_DWORD: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 4; - return; - - case AML_RAW_DATA_QWORD: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 8; - return; - - case AML_RAW_DATA_BUFFER: - - /* Aml length is/was set by creator */ - - Op->Asl.AmlOpcodeLength = 0; - return; - - case AML_RAW_DATA_CHAIN: - - /* Aml length is/was set by creator */ - - Op->Asl.AmlOpcodeLength = 0; - return; - - default: - break; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - - Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength; - break; - - case PARSEOP_NAMESEG: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlLength = 4; - Op->Asl.ExternalName = Op->Asl.Value.String; - break; - - case PARSEOP_NAMESTRING: - case PARSEOP_METHODCALL: - - if (Op->Asl.CompileFlags & NODE_NAME_INTERNALIZED) - { - break; - } - - Op->Asl.AmlOpcodeLength = 0; - Status = UtInternalizeName (Op->Asl.Value.String, &Buffer); - if (ACPI_FAILURE (Status)) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "Failure from internalize name %X\n", Status); - break; - } - - Op->Asl.ExternalName = Op->Asl.Value.String; - Op->Asl.Value.String = Buffer; - Op->Asl.CompileFlags |= NODE_NAME_INTERNALIZED; - - Op->Asl.AmlLength = strlen (Buffer); - - /* - * Check for single backslash reference to root, - * make it a null terminated string in the AML - */ - if (Op->Asl.AmlLength == 1) - { - Op->Asl.AmlLength = 2; - } - break; - - case PARSEOP_STRING_LITERAL: - - Op->Asl.AmlOpcodeLength = 1; - Op->Asl.AmlLength = strlen (Op->Asl.Value.String) + 1; /* Get null terminator */ - break; - - case PARSEOP_PACKAGE_LENGTH: - - Op->Asl.AmlOpcodeLength = 0; - Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op, Op->Asl.Value.Integer32); - break; - - case PARSEOP_RAW_DATA: - - Op->Asl.AmlOpcodeLength = 0; - break; - - case PARSEOP_DEFAULT_ARG: - case PARSEOP_EXTERNAL: - case PARSEOP_INCLUDE: - case PARSEOP_INCLUDE_END: - - /* Ignore the "default arg" nodes, they are extraneous at this point */ - - break; - - default: - - CgGenerateAmlOpcodeLength (Op); - break; - } -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/asllisting.c b/sys/dev/acpi/acpica/Subsystem/asllisting.c deleted file mode 100644 index 75b29f14095..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asllisting.c +++ /dev/null @@ -1,1269 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asllisting - Listing file generation - * $Revision: 49 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" -#include "acparser.h" -#include "acnamesp.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslisting") - - -/******************************************************************************* - * - * FUNCTION: LsAmlListingWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Process one node during a listing file generation. - * - ******************************************************************************/ - -ACPI_STATUS -LsAmlListingWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - UINT8 FileByte; - UINT32 i; - UINT32 FileId = (UINT32) Context; - - - LsWriteNodeToListing (Op, FileId); - - /* Write the hex bytes to the listing file(s) (if requested) */ - - for (i = 0; i < Op->Asl.FinalAmlLength; i++) - { - if (ACPI_FAILURE (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte, 1))) - { - FlFileError (ASL_FILE_AML_OUTPUT, ASL_MSG_READ); - AslAbort (); - } - LsWriteListingHexBytes (&FileByte, 1, FileId); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LsGenerateListing - * - * PARAMETERS: FileId - ID of listing file - * - * RETURN: None - * - * DESCRIPTION: Generate a listing file. This can be one of the several types - * of "listings" supported. - * - ******************************************************************************/ - -void -LsGenerateListing ( - UINT32 FileId) -{ - - /* Start at the beginning of both the source and AML files */ - - FlSeekFile (ASL_FILE_SOURCE_OUTPUT, 0); - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - Gbl_SourceLine = 0; - Gbl_CurrentHexColumn = 0; - LsPushNode (Gbl_Files[ASL_FILE_INPUT].Filename); - - /* Process all parse nodes */ - - TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, LsAmlListingWalk, - NULL, (void *) ACPI_TO_POINTER (FileId)); - - /* Final processing */ - - LsFinishSourceListing (FileId); -} - - -/******************************************************************************* - * - * FUNCTION: LsDoListings - * - * PARAMETERS: None. - * - * RETURN: None - * - * DESCRIPTION: Generate all requested listing files. - * - ******************************************************************************/ - -void -LsDoListings (void) -{ - - if (Gbl_C_OutputFlag) - { - LsGenerateListing (ASL_FILE_C_SOURCE_OUTPUT); - } - - if (Gbl_ListingFlag) - { - LsGenerateListing (ASL_FILE_LISTING_OUTPUT); - } - - if (Gbl_AsmOutputFlag) - { - LsGenerateListing (ASL_FILE_ASM_SOURCE_OUTPUT); - } - - if (Gbl_C_IncludeOutputFlag) - { - LsGenerateListing (ASL_FILE_C_INCLUDE_OUTPUT); - } - - if (Gbl_AsmIncludeOutputFlag) - { - LsGenerateListing (ASL_FILE_ASM_INCLUDE_OUTPUT); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsPushNode - * - * PARAMETERS: Filename - Pointer to the include filename - * - * RETURN: None - * - * DESCRIPTION: Push a listing node on the listing/include file stack. This - * stack enables tracking of include files (infinitely nested) - * and resumption of the listing of the parent file when the - * include file is finished. - * - ******************************************************************************/ - -void -LsPushNode ( - char *Filename) -{ - ASL_LISTING_NODE *Lnode; - - - /* Create a new node */ - - Lnode = UtLocalCalloc (sizeof (ASL_LISTING_NODE)); - - /* Initialize */ - - Lnode->Filename = Filename; - Lnode->LineNumber = 0; - - /* Link (push) */ - - Lnode->Next = Gbl_ListingNode; - Gbl_ListingNode = Lnode; -} - - -/******************************************************************************* - * - * FUNCTION: LsPopNode - * - * PARAMETERS: None - * - * RETURN: List head after current head is popped off - * - * DESCRIPTION: Pop the current head of the list, free it, and return the - * next node on the stack (the new current node). - * - ******************************************************************************/ - -ASL_LISTING_NODE * -LsPopNode (void) -{ - ASL_LISTING_NODE *Lnode; - - - /* Just grab the node at the head of the list */ - - Lnode = Gbl_ListingNode; - if ((!Lnode) || - (!Lnode->Next)) - { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, "Could not pop empty listing stack"); - return Gbl_ListingNode; - } - - Gbl_ListingNode = Lnode->Next; - ACPI_MEM_FREE (Lnode); - - /* New "Current" node is the new head */ - - return (Gbl_ListingNode); -} - - -/******************************************************************************* - * - * FUNCTION: LsCheckException - * - * PARAMETERS: LineNumber - Current logical (cumulative) line # - * FileId - ID of output listing file - * - * RETURN: None - * - * DESCRIPTION: Check if there is an exception for this line, and if there is, - * put it in the listing immediately. Handles multiple errors - * per line. Gbl_NextError points to the next error in the - * sorted (by line #) list of compile errors/warnings. - * - ******************************************************************************/ - -void -LsCheckException ( - UINT32 LineNumber, - UINT32 FileId) -{ - - if ((!Gbl_NextError) || - (LineNumber < Gbl_NextError->LogicalLineNumber )) - { - return; - } - - /* Handle multiple errors per line */ - - if (FileId == ASL_FILE_LISTING_OUTPUT) - { - while (Gbl_NextError && - (LineNumber >= Gbl_NextError->LogicalLineNumber)) - { - AePrintException (FileId, Gbl_NextError, "\n[****iasl****]\n"); - - Gbl_NextError = Gbl_NextError->Next; - } - - FlPrintFile (FileId, "\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsFlushListingBuffer - * - * PARAMETERS: FileId - ID of the listing file - * - * RETURN: None - * - * DESCRIPTION: Flush out the current contents of the 16-byte hex AML code - * buffer. Usually called at the termination of a single line - * of source code or when the buffer is full. - * - ******************************************************************************/ - -void -LsFlushListingBuffer ( - UINT32 FileId) -{ - UINT32 i; - UINT8 BufChar; - - - if (Gbl_CurrentHexColumn == 0) - { - return; - } - - /* Write the hex bytes */ - - switch (FileId) - { - case ASL_FILE_LISTING_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - FlPrintFile (FileId, "%2.2X ", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((16 - Gbl_CurrentHexColumn) * 3); i++) - { - FlWriteFile (FileId, ".", 1); - } - - FlPrintFile (FileId, " \""); - break; - - - case ASL_FILE_ASM_SOURCE_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - if (i > 0) - { - FlPrintFile (FileId, ","); - } - FlPrintFile (FileId, "0%2.2Xh", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((16 - Gbl_CurrentHexColumn) * 5); i++) - { - FlWriteFile (FileId, " ", 1); - } - - FlPrintFile (FileId, " ;%8.8X \"", Gbl_CurrentAmlOffset); - break; - - - case ASL_FILE_C_SOURCE_OUTPUT: - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - FlPrintFile (FileId, "0x%2.2X,", Gbl_AmlBuffer[i]); - } - - for (i = 0; i < ((16 - Gbl_CurrentHexColumn) * 5); i++) - { - FlWriteFile (FileId, " ", 1); - } - - FlPrintFile (FileId, " /* %8.8X \"", Gbl_CurrentAmlOffset); - break; - - default: - /* No other types supported */ - return; - } - - /* Write the ASCII character associated with each of the bytes */ - - for (i = 0; i < Gbl_CurrentHexColumn; i++) - { - BufChar = Gbl_AmlBuffer[i]; - if (isprint (BufChar) && !isspace (BufChar)) - { - FlPrintFile (FileId, "%c", BufChar); - } - else - { - FlWriteFile (FileId, ".", 1); - } - } - - FlPrintFile (FileId, "\""); - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " */"); - } - FlPrintFile (FileId, "\n"); - - Gbl_CurrentHexColumn = 0; - Gbl_HexBytesWereWritten = TRUE; -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteListingHexBytes - * - * PARAMETERS: Buffer - AML code buffer - * Length - Number of AML bytes to write - * FileId - ID of current listing file. - * - * RETURN: None - * - * DESCRIPTION: Write the contents of the AML buffer to the listing file via - * the listing buffer. The listing buffer is flushed every 16 - * AML bytes. - * - ******************************************************************************/ - -void -LsWriteListingHexBytes ( - UINT8 *Buffer, - UINT32 Length, - UINT32 FileId) -{ - UINT32 i; - - - /* Transfer all requested bytes */ - - for (i = 0; i < Length; i++) - { - /* Print line header when buffer is empty */ - - if (Gbl_CurrentHexColumn == 0) - { - if (Gbl_HasIncludeFiles) - { - FlPrintFile (FileId, "%*s", 10, " "); - } - - switch (FileId) - { - case ASL_FILE_LISTING_OUTPUT: - - FlPrintFile (FileId, "%8.8X....", Gbl_CurrentAmlOffset); - break; - - case ASL_FILE_ASM_SOURCE_OUTPUT: - - FlPrintFile (FileId, " db "); - break; - - case ASL_FILE_C_SOURCE_OUTPUT: - - FlPrintFile (FileId, " "); - break; - - default: - /* No other types supported */ - return; - } - } - - /* Transfer AML byte and update counts */ - - Gbl_AmlBuffer[Gbl_CurrentHexColumn] = Buffer[i]; - - Gbl_CurrentHexColumn++; - Gbl_CurrentAmlOffset++; - - /* Flush buffer when it is full */ - - if (Gbl_CurrentHexColumn >= 16) - { - LsFlushListingBuffer (FileId); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteOneSourceLine - * - * PARAMETERS: FileID - ID of current listing file - * - * RETURN: FALSE on EOF (input source file), TRUE otherwise - * - * DESCRIPTION: Read one line from the input source file and echo it to the - * listing file, prefixed with the line number, and if the source - * file contains include files, prefixed with the current filename - * - ******************************************************************************/ - -UINT32 -LsWriteOneSourceLine ( - UINT32 FileId) -{ - UINT8 FileByte; - - - Gbl_SourceLine++; - Gbl_ListingNode->LineNumber++; - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " *"); - } - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) - { - FlPrintFile (FileId, "; "); - } - - if (Gbl_HasIncludeFiles) - { - /* - * This file contains "include" statements, print the current - * filename and line number within the current file - */ - FlPrintFile (FileId, "%12s %5d....", - Gbl_ListingNode->Filename, Gbl_ListingNode->LineNumber); - } - else - { - /* No include files, just print the line number */ - - FlPrintFile (FileId, "%8d....", Gbl_SourceLine); - } - - /* Read one line (up to a newline or EOF) */ - - while (FlReadFile (ASL_FILE_SOURCE_OUTPUT, &FileByte, 1) == AE_OK) - { - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - if (FileByte == '/') - { - FileByte = '*'; - } - } - - FlWriteFile (FileId, &FileByte, 1); - if (FileByte == '\n') - { - /* - * Check if an error occurred on this source line during the compile. - * If so, we print the error message after the source line. - */ - LsCheckException (Gbl_SourceLine, FileId); - return (1); - } - } - - /* EOF on the input file was reached */ - - return (0); -} - - -/******************************************************************************* - * - * FUNCTION: LsFinishSourceListing - * - * PARAMETERS: FileId - ID of current listing file. - * - * RETURN: None - * - * DESCRIPTION: Cleanup routine for the listing file. Flush the hex AML - * listing buffer, and flush out any remaining lines in the - * source input file. - * - ******************************************************************************/ - -void -LsFinishSourceListing ( - UINT32 FileId) -{ - - if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || - (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) - { - return; - } - - LsFlushListingBuffer (FileId); - Gbl_CurrentAmlOffset = 0; - - /* Flush any remaining text in the source file */ - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " /*\n"); - } - - while (LsWriteOneSourceLine (FileId)) - { ; } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, "\n */\n };\n"); - } - - FlPrintFile (FileId, "\n"); - - if (FileId == ASL_FILE_LISTING_OUTPUT) - { - /* Print a summary of the compile exceptions */ - - FlPrintFile (FileId, "\n\nSummary of errors and warnings\n\n"); - AePrintErrorLog (FileId); - FlPrintFile (FileId, "\n\n"); - UtDisplaySummary (FileId); - FlPrintFile (FileId, "\n\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteSourceLines - * - * PARAMETERS: ToLineNumber - - * ToLogicalLineNumber - Write up to this source line number - * FileId - ID of current listing file - * - * RETURN: None - * - * DESCRIPTION: Read then write source lines to the listing file until we have - * reached the specified logical (cumulative) line number. This - * automatically echos out comment blocks and other non-AML - * generating text until we get to the actual AML-generating line - * of ASL code specified by the logical line number. - * - ******************************************************************************/ - -void -LsWriteSourceLines ( - UINT32 ToLineNumber, - UINT32 ToLogicalLineNumber, - UINT32 FileId) -{ - - if ((FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) || - (FileId == ASL_FILE_C_INCLUDE_OUTPUT)) - { - return; - } - - Gbl_CurrentLine = ToLogicalLineNumber; - - /* Flush any hex bytes remaining from the last opcode */ - - LsFlushListingBuffer (FileId); - - /* - * Read lines and write them as long as we are not caught up - */ - if (Gbl_SourceLine < Gbl_CurrentLine) - { - /* - * If we just completed writing some AML hex bytes, output a linefeed - * to add some whitespace for readability. - */ - if (Gbl_HexBytesWereWritten) - { - FlPrintFile (FileId, "\n"); - Gbl_HexBytesWereWritten = FALSE; - } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " /*\n"); - } - - /* - * Write one line at a time until we have reached the target line # - */ - while ((Gbl_SourceLine < Gbl_CurrentLine) && - LsWriteOneSourceLine (FileId)) - { ; } - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " */"); - } - FlPrintFile (FileId, "\n"); - } -} - - -/******************************************************************************* - * - * FUNCTION: LsWriteNodeToListing - * - * PARAMETERS: Op - Parse node to write to the listing file. - * FileId - ID of current listing file - * - * RETURN: None. - * - * DESCRIPTION: Write "a node" to the listing file. This means to - * 1) Write out all of the source text associated with the node - * 2) Write out all of the AML bytes associated with the node - * 3) Write any compiler exceptions associated with the node - * - ******************************************************************************/ - -void -LsWriteNodeToListing ( - ACPI_PARSE_OBJECT *Op, - UINT32 FileId) -{ - const ACPI_OPCODE_INFO *OpInfo; - UINT32 OpClass; - char *Pathname; - UINT32 Length; - UINT32 i; - - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - OpClass = OpInfo->Class; - - /* TBD: clean this up with a single flag that says: I start a named output block */ - - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - case PARSEOP_METHODCALL: - case PARSEOP_INCLUDE: - case PARSEOP_INCLUDE_END: - case PARSEOP_DEFAULT_ARG: - - break; - - default: - switch (OpClass) - { - case AML_CLASS_NAMED_OBJECT: - switch (Op->Asl.AmlOpcode) - { - case AML_SCOPE_OP: - case AML_ALIAS_OP: - break; - - default: - if (Op->Asl.ExternalName) - { - LsFlushListingBuffer (FileId); - FlPrintFile (FileId, " };\n"); - } - break; - } - break; - - default: - /* Don't care about other objects */ - break; - } - break; - } - } - - - /* These cases do not have a corresponding AML opcode */ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - - LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId); - - /* Use the table Signature and TableId to build a unique name */ - - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) - { - FlPrintFile (FileId, "%s_%s_Header \\\n", - Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " unsigned char %s_%s_Header [] = \n {\n", - Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, "extrn %s_%s_Header : byte\n", - Gbl_TableSignature, Gbl_TableId); - } - if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, "extern unsigned char %s_%s_Header [];\n", - Gbl_TableSignature, Gbl_TableId); - } - return; - - - case PARSEOP_METHODCALL: - - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId); - return; - - - case PARSEOP_INCLUDE: - - /* - * Flush everything up to and including the include source line - */ - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId); - - /* - * Create a new listing node and push it - */ - LsPushNode (Op->Asl.Child->Asl.Value.String); - return; - - - case PARSEOP_INCLUDE_END: - - /* - * Flush out the rest of the include file - */ - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId); - - /* - * Pop off this listing node and go back to the parent file - */ - LsPopNode (); - return; - - - case PARSEOP_DEFAULT_ARG: - return; - - - default: - /* All other opcodes have an AML opcode */ - break; - } - - /* - * Otherwise, we look at the AML opcode because we can - * switch on the opcode type, getting an entire class - * at once - */ - switch (OpClass) - { - case AML_CLASS_ARGUMENT: /* argument type only */ - case AML_CLASS_INTERNAL: - - break; - - - case AML_CLASS_NAMED_OBJECT: - - switch (Op->Asl.AmlOpcode) - { - case AML_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_BANK_FIELD_OP: - case AML_NAME_OP: - - /* For fields, we want to dump all the AML after the entire definition */ - - LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId); - break; - - default: - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId); - break; - } - - switch (Op->Asl.AmlOpcode) - { - case AML_SCOPE_OP: - case AML_ALIAS_OP: - - /* These opcodes do not declare a new object, ignore them */ - - break; - - default: - - /* All other named object opcodes come here */ - - switch (FileId) - { - case ASL_FILE_ASM_SOURCE_OUTPUT: - case ASL_FILE_C_SOURCE_OUTPUT: - case ASL_FILE_ASM_INCLUDE_OUTPUT: - case ASL_FILE_C_INCLUDE_OUTPUT: - - /* - * For named objects, we will create a valid symbol so that the - * AML code can be referenced from C or ASM - */ - if (Op->Asl.ExternalName) - { - /* Get the full pathname associated with this node */ - - Pathname = AcpiNsGetExternalPathname (Op->Asl.Node); - Length = strlen (Pathname); - if (Length >= 4) - { - /* Convert all dots in the path to underscores */ - - for (i = 0; i < Length; i++) - { - if (Pathname[i] == '.') - { - Pathname[i] = '_'; - } - } - - /* Create the appropriate symbol in the output file */ - - if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT) - { - FlPrintFile (FileId, "%s_%s_%s \\\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_C_SOURCE_OUTPUT) - { - FlPrintFile (FileId, " unsigned char %s_%s_%s [] = \n {\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, "extrn %s_%s_%s : byte\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - if (FileId == ASL_FILE_C_INCLUDE_OUTPUT) - { - FlPrintFile (FileId, "extern unsigned char %s_%s_%s [];\n", - Gbl_TableSignature, Gbl_TableId, &Pathname[1]); - } - } - ACPI_MEM_FREE (Pathname); - } - break; - - default: - /* Nothing to do for listing file */ - break; - } - } - break; - - case AML_CLASS_EXECUTE: - case AML_CLASS_CREATE: - default: - - LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId); - break; - - case AML_CLASS_UNKNOWN: - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: LsDumpAscii - * - * PARAMETERS: FileId - ID of current listing file - * Count - Number of bytes to convert - * Buffer - Buffer of bytes to convert - * - * RETURN: None. - * - * DESCRIPTION: Convert hex bytes to ascii - * - ******************************************************************************/ - -void -LsDumpAscii ( - UINT32 FileId, - UINT32 Count, - UINT8 *Buffer) -{ - UINT8 BufChar; - UINT32 i; - - - for (i = 0; i < Count; i++) - { - BufChar = Buffer[i]; - if (isprint (BufChar)) - { - FlPrintFile (FileId, "%c", BufChar); - } - else - { - /* Not a printable character, just put out a dot */ - - FlPrintFile (FileId, "."); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutput - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. - * - ******************************************************************************/ - -void -LsDoHexOutput (void) -{ - - switch (Gbl_HexOutputFlag) - { - case HEX_OUTPUT_C: - - LsDoHexOutputC (); - break; - - case HEX_OUTPUT_ASM: - - LsDoHexOutputAsm (); - break; - - default: - /* No other output types supported */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutputC - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. This is the same data as the AML - * output file, but formatted into hex/ascii bytes suitable for - * inclusion into a C source file. - * - ******************************************************************************/ - -#define HEX_CHARS_PER_LINE 8 - -void -LsDoHexOutputC (void) -{ - UINT32 j; - UINT8 FileByte[HEX_CHARS_PER_LINE]; - UINT8 Buffer[4]; - UINT32 Offset = 0; - - - FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n *\n */\n"); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] = \n{\n"); - - /* Start at the beginning of the AML file */ - - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - - /* Process all AML bytes in the AML file */ - - j = 0; - while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK) - { - if (j == 0) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, " "); - } - - /* - * Convert each AML byte to hex - */ - UtConvertByteToHex (FileByte[j], Buffer); - FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4); - FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); - - /* An occasional linefeed improves readability */ - - Offset++; - j++; - if (j >= HEX_CHARS_PER_LINE) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X \"", Offset - HEX_CHARS_PER_LINE); - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAscii (ASL_FILE_HEX_OUTPUT, HEX_CHARS_PER_LINE, FileByte); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "\" */\n"); - j = 0; - } - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n};\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); -} - - -/******************************************************************************* - * - * FUNCTION: LsDoHexOutputAsm - * - * PARAMETERS: None - * - * RETURN: None. - * - * DESCRIPTION: Create the hex output file. This is the same data as the AML - * output file, but formatted into hex/ascii bytes suitable for - * inclusion into a ASM source file. - * - ******************************************************************************/ - -#define ASM_HEX_CHARS_PER_LINE 8 - - -void -LsDoHexOutputAsm ( - void) -{ - UINT32 j; - UINT8 FileByte[HEX_CHARS_PER_LINE]; - UINT8 Buffer[4]; - UINT32 Offset = 0; - BOOLEAN DoComma = FALSE; - - - FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n;\n"); - - /* Start at the beginning of the AML file */ - - FlSeekFile (ASL_FILE_AML_OUTPUT, 0); - - /* Process all AML bytes in the AML file */ - - j = 0; - while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK) - { - if (j == 0) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, " db "); - } - else if (DoComma) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, ","); - DoComma = FALSE; - } - - /* - * Convert each AML byte to hex - */ - UtConvertByteToAsmHex (FileByte[j], Buffer); - FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4); - - /* An occasional linefeed improves readability */ - - Offset++; - j++; - if (j >= ASM_HEX_CHARS_PER_LINE) - { - FlPrintFile (ASL_FILE_HEX_OUTPUT, " ;%8.8X \"", Offset - ASM_HEX_CHARS_PER_LINE); - - /* Write the ASCII character associated with each of the bytes */ - - LsDumpAscii (ASL_FILE_HEX_OUTPUT, ASM_HEX_CHARS_PER_LINE, FileByte); - FlPrintFile (ASL_FILE_HEX_OUTPUT, "\"\n"); - j = 0; - } - else - { - DoComma = TRUE; - } - } - - FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n"); - FlCloseFile (ASL_FILE_HEX_OUTPUT); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslload.c b/sys/dev/acpi/acpica/Subsystem/aslload.c deleted file mode 100644 index d57a5444024..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslload.c +++ /dev/null @@ -1,691 +0,0 @@ -/****************************************************************************** - * - * Module Name: dswload - Dispatcher namespace load callbacks - * $Revision: 57 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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 __ASLLOAD_C__ - -#include "aslcompiler.h" -#include "amlcode.h" -#include "acdispat.h" -#include "acnamesp.h" - -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslload") - - -/******************************************************************************* - * - * FUNCTION: LdLoadNamespace - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Perform a walk of the parse tree that in turn loads all of the - * named ASL/AML objects into the namespace. The namespace is - * constructed in order to resolve named references and references - * to named fields within resource templates/descriptors. - * - ******************************************************************************/ - -ACPI_STATUS -LdLoadNamespace ( - ACPI_PARSE_OBJECT *RootOp) -{ - ACPI_WALK_STATE *WalkState; - - - DbgPrint (ASL_DEBUG_OUTPUT, "\nCreating namespace\n\n"); - - /* Create a new walk state */ - - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL); - if (!WalkState) - { - return AE_NO_MEMORY; - } - - /* Perform the walk of the parse tree */ - - TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace1Begin, - LdNamespace1End, WalkState); - - /* Dump the namespace if debug is enabled */ - - AcpiNsDumpTables (ACPI_NS_ALL, ACPI_UINT32_MAX); - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: LdLoadFieldElements - * - * PARAMETERS: Op - Parent node (Field) - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Enter the named elements of the field (children of the parent) - * into the namespace. - * - ******************************************************************************/ - -ACPI_STATUS -LdLoadFieldElements ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *Child = NULL; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* Get the first named field element */ - - switch (Op->Asl.AmlOpcode) - { - case AML_BANK_FIELD_OP: - - Child = UtGetArg (Op, 6); - break; - - case AML_INDEX_FIELD_OP: - - Child = UtGetArg (Op, 5); - break; - - case AML_FIELD_OP: - - Child = UtGetArg (Op, 4); - break; - - default: - /* No other opcodes should arrive here */ - return (AE_BAD_PARAMETER); - } - - /* Enter all elements into the namespace */ - - while (Child) - { - switch (Child->Asl.AmlOpcode) - { - case AML_INT_RESERVEDFIELD_OP: - case AML_INT_ACCESSFIELD_OP: - - break; - - default: - - Status = AcpiNsLookup (WalkState->ScopeInfo, Child->Asl.Value.String, - ACPI_TYPE_LOCAL_REGION_FIELD, ACPI_IMODE_LOAD_PASS1, - ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND, - NULL, &Node); - if (ACPI_FAILURE (Status)) - { - if (Status != AE_ALREADY_EXISTS) - { - return (Status); - } - - /* - * The name already exists in this scope - * But continue processing the elements - */ - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, Child->Asl.Value.String); - } - else - { - Child->Asl.Node = Node; - Node->Object = (ACPI_OPERAND_OBJECT *) Child; - } - break; - } - Child = Child->Asl.Next; - } - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LdLoadResourceElements - * - * PARAMETERS: Op - Parent node (Resource Descriptor) - * WalkState - Current walk state - * - * RETURN: Status - * - * DESCRIPTION: Enter the named elements of the resource descriptor (children - * of the parent) into the namespace. - * - * NOTE: In the real AML namespace, these named elements never exist. But - * we simply use the namespace here as a symbol table so we can look - * them up as they are referenced. - * - ******************************************************************************/ - -ACPI_STATUS -LdLoadResourceElements ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState) -{ - ACPI_PARSE_OBJECT *InitializerOp = NULL; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - - - /* - * Enter the resouce name into the namespace - * This opens a scope - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath, - ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH, - WalkState, &Node); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Now enter the predefined fields, for easy lookup when referenced - * by the source ASL - */ - InitializerOp = ASL_GET_CHILD_NODE (Op); - while (InitializerOp) - { - - if (InitializerOp->Asl.ExternalName) - { - Status = AcpiNsLookup (WalkState->ScopeInfo, - InitializerOp->Asl.ExternalName, - ACPI_TYPE_LOCAL_RESOURCE_FIELD, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, - NULL, &Node); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * Store the field offset in the namespace node so it - * can be used when the field is referenced - */ - Node->OwnerId = InitializerOp->Asl.Value.Integer16; - InitializerOp->Asl.Node = Node; - Node->Object = (ACPI_OPERAND_OBJECT *) InitializerOp; - - /* Pass thru the field type (Bitfield or Bytefield) */ - - if (InitializerOp->Asl.CompileFlags & NODE_IS_BIT_OFFSET) - { - Node->Flags |= ANOBJ_IS_BIT_OFFSET; - } - } - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LdNamespace1Begin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during the parse tree walk. If this - * is a named AML opcode, enter into the namespace - * - ******************************************************************************/ - -ACPI_STATUS -LdNamespace1Begin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - ACPI_OBJECT_TYPE ActualObjectType = ACPI_TYPE_ANY; - char *Path; - UINT32 Flags = ACPI_NS_NO_UPSEARCH; - ACPI_PARSE_OBJECT *Arg; - UINT32 i; - - - ACPI_FUNCTION_NAME ("LdNamespace1Begin"); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n", - Op, Op->Asl.ParseOpName)); - - - /* - * We are only interested in opcodes that have an associated name - * (or multiple names) - */ - switch (Op->Asl.AmlOpcode) - { - case AML_BANK_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_FIELD_OP: - - Status = LdLoadFieldElements (Op, WalkState); - return (Status); - - default: - - /* All other opcodes go below */ - break; - } - - /* Check if this object has already been installed in the namespace */ - - if (Op->Asl.Node) - { - return (AE_OK); - } - - Path = Op->Asl.Namepath; - if (!Path) - { - return (AE_OK); - } - - /* Map the raw opcode into an internal object type */ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_NAME: - - Arg = Op->Asl.Child; /* Get the NameSeg/NameString node */ - Arg = Arg->Asl.Next; /* First peer is the object to be associated with the name */ - - /* Get the data type associated with the named object, not the name itself */ - - /* Log2 loop to convert from Btype (binary) to Etype (encoded) */ - - ObjectType = 1; - for (i = 1; i < Arg->Asl.AcpiBtype; i *= 2) - { - ObjectType++; - } - break; - - - case PARSEOP_EXTERNAL: - - /* - * "External" simply enters a name and type into the namespace. - * We must be careful to not open a new scope, however, no matter - * what type the external name refers to (e.g., a method) - * - * first child is name, next child is ObjectType - */ - ActualObjectType = Op->Asl.Child->Asl.Next->Asl.Value.Integer8; - ObjectType = ACPI_TYPE_ANY; - break; - - - case PARSEOP_DEFAULT_ARG: - - if(Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC) - { - Status = LdLoadResourceElements (Op, WalkState); - goto Exit; - } - - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - break; - - - case PARSEOP_SCOPE: - - /* - * The name referenced by Scope(Name) must already exist at this point. - * In other words, forward references for Scope() are not supported. - * The only real reason for this is that the MS interpreter cannot - * handle this case. Perhaps someday this case can go away. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - /* The name was not found, go ahead and create it */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_LOCAL_SCOPE, - ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node)); - - /* - * However, this is an error -- primarily because the MS - * interpreter can't handle a forward reference from the - * Scope() operator. - */ - AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, Op->Asl.ExternalName); - AslError (ASL_ERROR, ASL_MSG_SCOPE_FWD_REF, Op, Op->Asl.ExternalName); - goto FinishNode; - } - - AslCoreSubsystemError (Op, Status, "Failure from lookup\n", FALSE); - goto Exit; - } - - /* We found a node with this name, now check the type */ - - switch (Node->Type) - { - case ACPI_TYPE_LOCAL_SCOPE: - case ACPI_TYPE_DEVICE: - case ACPI_TYPE_POWER: - case ACPI_TYPE_PROCESSOR: - case ACPI_TYPE_THERMAL: - - /* These are acceptable types - they all open a new scope */ - break; - - case ACPI_TYPE_INTEGER: - case ACPI_TYPE_STRING: - case ACPI_TYPE_BUFFER: - - /* - * These types we will allow, but we will change the type. This - * enables some existing code of the form: - * - * Name (DEB, 0) - * Scope (DEB) { ... } - * - * Which is used to workaround the fact that the MS interpreter - * does not allow Scope() forward references. - */ - sprintf (MsgBuffer, "%s, %s, Changing type to (Scope)", - Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); - - /* - * Switch the type - */ - Node->Type = ACPI_TYPE_ANY; - break; - - default: - - /* - * All other types are an error - */ - sprintf (MsgBuffer, "%s, %s", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer); - - /* - * However, switch the type to be an actual scope so - * that compilation can continue without generating a whole - * cascade of additional errors. - */ - Node->Type = ACPI_TYPE_ANY; - break; - } - - Status = AE_OK; - goto FinishNode; - - - default: - - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - break; - } - - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Loading name: %s, (%s)\n", - Op->Asl.ExternalName, AcpiUtGetTypeName (ObjectType))); - - /* The name must not already exist */ - - Flags |= ACPI_NS_ERROR_IF_FOUND; - - /* - * Enter the named type into the internal namespace. We enter the name - * as we go downward in the parse tree. Any necessary subobjects that involve - * arguments to the opcode must be created as we go back up the parse tree later. - */ - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_ALREADY_EXISTS) - { - /* The name already exists in this scope */ - - if (Node->Type == ACPI_TYPE_LOCAL_SCOPE) - { - Node->Type = (UINT8) ObjectType; - Status = AE_OK; - } - else - { - AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, Op->Asl.ExternalName); - Status = AE_OK; - goto Exit; - } - } - else - { - AslCoreSubsystemError (Op, Status, "Failure from lookup %s\n", FALSE); - goto Exit; - } - } - - -FinishNode: - /* - * Point the parse node to the new namespace node, and point - * the Node back to the original Parse node - */ - Op->Asl.Node = Node; - Node->Object = (ACPI_OPERAND_OBJECT *) Op; - - /* Set the actual data type if appropriate (EXTERNAL term only) */ - - if (ActualObjectType != ACPI_TYPE_ANY) - { - Node->Type = (UINT8) ActualObjectType; - Node->OwnerId = ASL_EXTERNAL_METHOD; - } - - if (Op->Asl.ParseOpcode == PARSEOP_METHOD) - { - /* - * Get the method argument count from "Extra" and store - * it in the OwnerId field of the namespace node - */ - Node->OwnerId = (UINT16) Op->Asl.Extra; - } - -Exit: - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: LdNamespace1End - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during the loading of the namespace, - * We only need to worry about managing the scope stack here. - * - ******************************************************************************/ - -ACPI_STATUS -LdNamespace1End ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_OBJECT_TYPE ObjectType; - - - ACPI_FUNCTION_NAME ("LdNamespace1End"); - - - /* We are only interested in opcodes that have an associated name */ - - if (!Op->Asl.Namepath) - { - return (AE_OK); - } - - /* Get the type to determine if we should pop the scope */ - - if ((Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) && - (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)) - { - /* TBD: Merge into AcpiDsMapNamedOpcodeToDataType */ - - ObjectType = ACPI_TYPE_LOCAL_RESOURCE; - } - else - { - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - } - - /* Pop the scope stack */ - - if (AcpiNsOpensScope (ObjectType)) - { - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "(%s): Popping scope for Op [%s] %p\n", - AcpiUtGetTypeName (ObjectType), Op->Asl.ParseOpName, Op)); - - AcpiDsScopeStackPop (WalkState); - } - - return (AE_OK); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/asllookup.c b/sys/dev/acpi/acpica/Subsystem/asllookup.c deleted file mode 100644 index 4ed62c4619e..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asllookup.c +++ /dev/null @@ -1,974 +0,0 @@ -/****************************************************************************** - * - * Module Name: asllookup- Namespace lookup - * $Revision: 80 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#include "acparser.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdispat.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asllookup") - - -/******************************************************************************* - * - * FUNCTION: LsDoOneNamespaceObject - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Dump a namespace object to the namespace output file. - * Called during the walk of the namespace to dump all objects. - * - ******************************************************************************/ - -ACPI_STATUS -LsDoOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - ACPI_PARSE_OBJECT *Op; - - - Gbl_NumNamespaceObjects++; - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5d [%d] %*s %4.4s - %s", - Gbl_NumNamespaceObjects, Level, (Level * 3), " ", - &Node->Name, - AcpiUtGetTypeName (Node->Type)); - - Op = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object); - - if (Op) - { - if (Op->Asl.ParseOpcode == PARSEOP_NAME) - { - Op = Op->Asl.Child; - } - - switch (Node->Type) - { - case ACPI_TYPE_INTEGER: - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Next; - } - - if (Op->Asl.Value.Integer > ACPI_UINT32_MAX) - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = 0x%X%X]", - ACPI_HIDWORD (Op->Asl.Value.Integer64), Op->Asl.Value.Integer32); - } - else - { - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = 0x%X]", - Op->Asl.Value.Integer32); - } - break; - - - case ACPI_TYPE_STRING: - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Next; - } - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = \"%s\"]", - Op->Asl.Value.String); - break; - - - case ACPI_TYPE_LOCAL_REGION_FIELD: - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING)) - { - Op = Op->Asl.Child; - } - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Offset 0x%02X, Length 0x%02X]", - Op->Asl.Parent->Asl.ExtraValue, Op->Asl.Value.Integer32); - break; - - - default: - /* Nothing to do for other types */ - break; - } - } - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n"); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LsDisplayNamespace - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Walk the namespace an display information about each node - * in the tree. Information is written to the optional - * namespace output file. - * - ******************************************************************************/ - -ACPI_STATUS -LsDisplayNamespace ( - void) -{ - ACPI_STATUS Status; - - - if (!Gbl_NsOutputFlag) - { - return (AE_OK); - } - - /* File header */ - - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n"); - FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Count Depth Name - Type\n\n"); - - /* Walk entire namespace from the root */ - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject, - NULL, NULL); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: LsCompareOneNamespaceObject - * - * PARAMETERS: ACPI_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Compare name of one object. - * - ******************************************************************************/ - -ACPI_STATUS -LsCompareOneNamespaceObject ( - ACPI_HANDLE ObjHandle, - UINT32 Level, - void *Context, - void **ReturnValue) -{ - ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle; - - - /* Simply check the name */ - - if (*((UINT32 *) (Context)) == Node->Name.Integer) - { - /* Abort walk if we found one instance */ - - return (AE_CTRL_TRUE); - } - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: LkObjectExists - * - * PARAMETERS: Name - 4 char ACPI name - * - * RETURN: TRUE if name exists in namespace - * - * DESCRIPTION: Walk the namespace to find an object - * - ******************************************************************************/ - -BOOLEAN -LkObjectExists ( - char *Name) -{ - ACPI_STATUS Status; - - - /* Walk entire namespace from the supplied root */ - - Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, - ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject, - Name, NULL); - if (Status == AE_CTRL_TRUE) - { - /* At least one instance of the name was found */ - - return (TRUE); - } - - return (FALSE); -} - - -/******************************************************************************* - * - * FUNCTION: LkCrossReferenceNamespace - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Perform a cross reference check of the parse tree against the - * namespace. Every named referenced within the parse tree - * should be get resolved with a namespace lookup. If not, the - * original reference in the ASL code is invalid -- i.e., refers - * to a non-existent object. - * - * NOTE: The ASL "External" operator causes the name to be inserted into the - * namespace so that references to the external name will be resolved - * correctly here. - * - ******************************************************************************/ - -ACPI_STATUS -LkCrossReferenceNamespace ( - void) -{ - ACPI_WALK_STATE *WalkState; - - - DbgPrint (ASL_DEBUG_OUTPUT, "\nCross referencing namespace\n\n"); - - /* - * Create a new walk state for use when looking up names - * within the namespace (Passed as context to the callbacks) - */ - WalkState = AcpiDsCreateWalkState (TABLE_ID_DSDT, NULL, NULL, NULL); - if (!WalkState) - { - return AE_NO_MEMORY; - } - - /* Walk the entire parse tree */ - - TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, LkNamespaceLocateBegin, - LkNamespaceLocateEnd, WalkState); - return AE_OK; -} - - -/******************************************************************************* - * - * FUNCTION: LkCheckFieldRange - * - * PARAMETERS: RegionBitLength - Length of entire parent region - * FieldBitOffset - Start of the field unit (within region) - * FieldBitLength - Entire length of field unit - * AccessBitWidth - Access width of the field unit - * - * RETURN: None - * - * DESCRIPTION: Check one field unit to make sure it fits in the parent - * op region. - * - * Note: AccessBitWidth must be either 8,16,32, or 64 - * - ******************************************************************************/ - -void -LkCheckFieldRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 RegionBitLength, - UINT32 FieldBitOffset, - UINT32 FieldBitLength, - UINT32 AccessBitWidth) -{ - UINT32 FieldEndBitOffset; - - /* - * Check each field unit against the region size. The entire - * field unit (start offset plus length) must fit within the - * region. - */ - FieldEndBitOffset = FieldBitOffset + FieldBitLength; - - if (FieldEndBitOffset > RegionBitLength) - { - /* Field definition itself is beyond the end-of-region */ - - AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_OFFSET, Op, NULL); - return; - } - - /* - * Now check that the field plus AccessWidth doesn't go beyond - * the end-of-region. Assumes AccessBitWidth is a power of 2 - */ - FieldEndBitOffset = ACPI_ROUND_UP (FieldEndBitOffset, AccessBitWidth); - - if (FieldEndBitOffset > RegionBitLength) - { - /* Field definition combined with the access is beyond EOR */ - - AslError (ASL_ERROR, ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, Op, NULL); - } -} - -/******************************************************************************* - * - * FUNCTION: LkNamespaceLocateBegin - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Descending callback used during cross-reference. For named - * object references, attempt to locate the name in the - * namespace. - * - * NOTE: ASL references to named fields within resource descriptors are - * resolved to integer values here. Therefore, this step is an - * important part of the code generation. We don't know that the - * name refers to a resource descriptor until now. - * - ******************************************************************************/ - -ACPI_STATUS -LkNamespaceLocateBegin ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - ACPI_NAMESPACE_NODE *Node; - ACPI_STATUS Status; - ACPI_OBJECT_TYPE ObjectType; - char *Path; - UINT8 PassedArgs; - ACPI_PARSE_OBJECT *NextOp; - ACPI_PARSE_OBJECT *OwningOp; - ACPI_PARSE_OBJECT *SpaceIdOp; - UINT32 MinimumLength; - UINT32 Temp; - const ACPI_OPCODE_INFO *OpInfo; - UINT32 Flags; - - - ACPI_FUNCTION_TRACE_PTR ("LkNamespaceLocateBegin", Op); - - /* - * If this node is the actual declaration of a name - * [such as the XXXX name in "Method (XXXX)"], - * we are not interested in it here. We only care about names that are - * references to other objects within the namespace and the parent objects - * of name declarations - */ - if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) - { - return (AE_OK); - } - - /* We are only interested in opcodes that have an associated name */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - - if ((!(OpInfo->Flags & AML_NAMED)) && - (!(OpInfo->Flags & AML_CREATE)) && - (Op->Asl.ParseOpcode != PARSEOP_NAMESTRING) && - (Op->Asl.ParseOpcode != PARSEOP_NAMESEG) && - (Op->Asl.ParseOpcode != PARSEOP_METHODCALL)) - { - return (AE_OK); - } - - /* - * We must enable the "search-to-root" for single NameSegs, but - * we have to be very careful about opening up scopes - */ - Flags = ACPI_NS_SEARCH_PARENT; - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - /* - * These are name references, do not push the scope stack - * for them. - */ - Flags |= ACPI_NS_DONT_OPEN_SCOPE; - } - - /* Get the NamePath from the appropriate place */ - - if (OpInfo->Flags & AML_NAMED) - { - /* For all NAMED operators, the name reference is the first child */ - - Path = Op->Asl.Child->Asl.Value.String; - if (Op->Asl.AmlOpcode == AML_ALIAS_OP) - { - /* - * ALIAS is the only oddball opcode, the name declaration - * (alias name) is the second operand - */ - Path = Op->Asl.Child->Asl.Next->Asl.Value.String; - } - } - else if (OpInfo->Flags & AML_CREATE) - { - /* Name must appear as the last parameter */ - - NextOp = Op->Asl.Child; - while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) - { - NextOp = NextOp->Asl.Next; - } - Path = NextOp->Asl.Value.String; - } - else - { - Path = Op->Asl.Value.String; - } - - ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode); - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Type=%s\n", AcpiUtGetTypeName (ObjectType))); - - /* - * Lookup the name in the namespace. Name must exist at this point, or it - * is an invalid reference. - * - * The namespace is also used as a lookup table for references to resource - * descriptors and the fields within them. - */ - Gbl_NsLookupCount++; - - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType, - ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - if (Status == AE_NOT_FOUND) - { - /* - * We didn't find the name reference by path -- we can qualify this - * a little better before we print an error message - */ - if (strlen (Path) == ACPI_NAME_SIZE) - { - /* A simple, one-segment ACPI name */ - - if (LkObjectExists (Path)) - { - /* There exists such a name, but we couldn't get to it from this scope */ - - AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, Op->Asl.ExternalName); - } - else - { - /* The name doesn't exist, period */ - - AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName); - } - } - else - { - /* Check for a fully qualified path */ - - if (Path[0] == AML_ROOT_PREFIX) - { - /* Gave full path, the object does not exist */ - - AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName); - } - else - { - /* We can't tell whether it doesn't exist or just can't be reached. */ - - AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, Op->Asl.ExternalName); - } - } - - Status = AE_OK; - } - return (Status); - } - - /* Attempt to optimize the NamePath */ - - OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node); - - /* - * Dereference an alias. (A name reference that is an alias.) - * Aliases are not nested; The alias always points to the final object - */ - if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) && (Node->Type == ACPI_TYPE_LOCAL_ALIAS)) - { - /* This node points back to the original PARSEOP_ALIAS */ - - NextOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object); - - /* The first child is the alias target op */ - - NextOp = NextOp->Asl.Child; - - /* Who in turn points back to original target alias node */ - - if (NextOp->Asl.Node) - { - Node = NextOp->Asl.Node; - } - else - { - AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, "Missing alias link"); - } - } - - /* 1) Check for a reference to a resource descriptor */ - - else if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) || - (Node->Type == ACPI_TYPE_LOCAL_RESOURCE)) - { - /* - * This was a reference to a field within a resource descriptor. Extract - * the associated field offset (either a bit or byte offset depending on - * the field type) and change the named reference into an integer for - * AML code generation - */ - Temp = (UINT32) Node->OwnerId; - if (Node->Flags & ANOBJ_IS_BIT_OFFSET) - { - Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET; - } - - /* Perform BitOffset <--> ByteOffset conversion if necessary */ - - switch (Op->Asl.Parent->Asl.AmlOpcode) - { - case AML_CREATE_FIELD_OP: - - /* We allow a Byte offset to Bit Offset conversion for this op */ - - if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) - { - /* Simply multiply byte offset times 8 to get bit offset */ - - Temp = ACPI_MUL_8 (Temp); - } - break; - - - case AML_CREATE_BIT_FIELD_OP: - - /* This op requires a Bit Offset */ - - if (!(Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET)) - { - AslError (ASL_ERROR, ASL_MSG_BYTES_TO_BITS, Op, NULL); - } - break; - - - case AML_CREATE_BYTE_FIELD_OP: - case AML_CREATE_WORD_FIELD_OP: - case AML_CREATE_DWORD_FIELD_OP: - case AML_CREATE_QWORD_FIELD_OP: - case AML_INDEX_OP: - - /* These Ops require Byte offsets */ - - if (Op->Asl.CompileFlags & NODE_IS_BIT_OFFSET) - { - AslError (ASL_ERROR, ASL_MSG_BITS_TO_BYTES, Op, NULL); - } - break; - - - default: - /* Nothing to do for other opcodes */ - break; - } - - /* Now convert this node to an integer whose value is the field offset */ - - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - Op->Asl.Value.Integer = (UINT64) Temp; - Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; - - OpcGenerateAmlOpcode (Op); - Op->Asl.AmlLength = OpcSetOptimalIntegerSize (Op); - } - - /* 2) Check for a method invocation */ - - else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) && - (Node->Type == ACPI_TYPE_METHOD) && - (Op->Asl.Parent) && - (Op->Asl.Parent->Asl.ParseOpcode != PARSEOP_METHOD)) || - - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - - /* - * There are two types of method invocation: - * 1) Invocation with arguments -- the parser recognizes this as a METHODCALL - * 2) Invocation with no arguments --the parser cannot determine that this is a method - * invocation, therefore we have to figure it out here. - */ - if (Node->Type != ACPI_TYPE_METHOD) - { - sprintf (MsgBuffer, "%s is a %s", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type)); - - AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer); - return (AE_OK); - } - - /* Save the method node in the caller's op */ - - Op->Asl.Node = Node; - if (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF) - { - return (AE_OK); - } - - /* - * This is a method invocation, with or without arguments. - * Count the number of arguments, each appears as a child - * under the parent node - */ - Op->Asl.ParseOpcode = PARSEOP_METHODCALL; - UtSetParseOpName (Op); - - PassedArgs = 0; - NextOp = Op->Asl.Child; - - while (NextOp) - { - PassedArgs++; - NextOp = NextOp->Asl.Next; - } - - if (Node->OwnerId != ASL_EXTERNAL_METHOD) - { - /* - * Check the parsed arguments with the number expected by the - * method declaration itself - */ - if (PassedArgs != Node->OwnerId) - { - sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName, - Node->OwnerId); - - if (PassedArgs < Node->OwnerId) - { - AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer); - } - else - { - AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_HI, Op, MsgBuffer); - } - } - } - } - - /* - * 3) Check for an ASL Field definition - */ - else if ((Op->Asl.Parent) && - ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) || - (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD))) - { - /* - * Offset checking for fields. If the parent operation region has a - * constant length (known at compile time), we can check fields - * defined in that region against the region length. This will catch - * fields and field units that cannot possibly fit within the region. - * - * Note: Index fields do not directly reference an operation region, - * thus they are not included in this check. - */ - if (Op == Op->Asl.Parent->Asl.Child) - { - /* - * This is the first child of the field node, which is - * the name of the region. Get the parse node for the - * region -- which contains the length of the region. - */ - OwningOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object); - Op->Asl.Parent->Asl.ExtraValue = ACPI_MUL_8 (OwningOp->Asl.Value.Integer32); - - /* Examine the field access width */ - - switch (Op->Asl.Parent->Asl.Value.Integer8) - { - case AML_FIELD_ACCESS_ANY: - case AML_FIELD_ACCESS_BYTE: - case AML_FIELD_ACCESS_BUFFER: - default: - MinimumLength = 1; - break; - - case AML_FIELD_ACCESS_WORD: - MinimumLength = 2; - break; - - case AML_FIELD_ACCESS_DWORD: - MinimumLength = 4; - break; - - case AML_FIELD_ACCESS_QWORD: - MinimumLength = 8; - break; - } - - /* - * Is the region at least as big as the access width? - * Note: DataTableRegions have 0 length - */ - if ((OwningOp->Asl.Value.Integer32) && - (OwningOp->Asl.Value.Integer32 < MinimumLength)) - { - AslError (ASL_ERROR, ASL_MSG_FIELD_ACCESS_WIDTH, Op, NULL); - } - - /* - * Check EC/CMOS/SMBUS fields to make sure that the correct - * access type is used (BYTE for EC/CMOS, BUFFER for SMBUS) - */ - SpaceIdOp = OwningOp->Asl.Child->Asl.Next; - switch (SpaceIdOp->Asl.Value.Integer32) - { - case REGION_EC: - case REGION_CMOS: - - if (Op->Asl.Parent->Asl.Value.Integer8 != AML_FIELD_ACCESS_BYTE) - { - AslError (ASL_ERROR, ASL_MSG_REGION_BYTE_ACCESS, Op, NULL); - } - break; - - case REGION_SMBUS: - - if (Op->Asl.Parent->Asl.Value.Integer8 != AML_FIELD_ACCESS_BUFFER) - { - AslError (ASL_ERROR, ASL_MSG_REGION_BUFFER_ACCESS, Op, NULL); - } - break; - - default: - - /* Nothing to do for other address spaces */ - break; - } - } - else - { - /* - * This is one element of the field list. Check to make sure - * that it does not go beyond the end of the parent operation region. - * - * In the code below: - * Op->Asl.Parent->Asl.ExtraValue - Region Length (bits) - * Op->Asl.ExtraValue - Field start offset (bits) - * Op->Asl.Child->Asl.Value.Integer32 - Field length (bits) - * Op->Asl.Child->Asl.ExtraValue - Field access width (bits) - */ - if (Op->Asl.Parent->Asl.ExtraValue && Op->Asl.Child) - { - LkCheckFieldRange (Op, - Op->Asl.Parent->Asl.ExtraValue, - Op->Asl.ExtraValue, - Op->Asl.Child->Asl.Value.Integer32, - Op->Asl.Child->Asl.ExtraValue); - } - } - } - - Op->Asl.Node = Node; - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: LkNamespaceLocateEnd - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Ascending callback used during cross reference. We only - * need to worry about scope management here. - * - ******************************************************************************/ - -ACPI_STATUS -LkNamespaceLocateEnd ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context; - const ACPI_OPCODE_INFO *OpInfo; - - - ACPI_FUNCTION_TRACE ("LkNamespaceLocateEnd"); - - - /* We are only interested in opcodes that have an associated name */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode); - if (!(OpInfo->Flags & AML_NAMED)) - { - return (AE_OK); - } - - /* Not interested in name references, we did not open a scope for them */ - - if ((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || - (Op->Asl.ParseOpcode == PARSEOP_NAMESEG) || - (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)) - { - return (AE_OK); - } - - /* Pop the scope stack if necessary */ - - if (AcpiNsOpensScope (AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode))) - { - - ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, - "%s: Popping scope for Op %p\n", - AcpiUtGetTypeName (OpInfo->ObjectType), Op)); - - AcpiDsScopeStackPop (WalkState); - } - - return (AE_OK); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslmain.c b/sys/dev/acpi/acpica/Subsystem/aslmain.c deleted file mode 100644 index decfc6b340d..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslmain.c +++ /dev/null @@ -1,785 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslmain - compiler main and utilities - * $Revision: 74 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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 _DECLARE_GLOBALS - -#include "aslcompiler.h" -#include "acnamesp.h" -#include "acapps.h" - -#ifdef _DEBUG -#include <crtdbg.h> -#endif - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslmain") - -BOOLEAN AslToFile = TRUE; -BOOLEAN DoCompile = TRUE; -BOOLEAN DoSignon = TRUE; - -char hex[] = {'0','1','2','3','4','5','6','7', - '8','9','A','B','C','D','E','F'}; - - -/******************************************************************************* - * - * FUNCTION: Options - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display option help message - * - ******************************************************************************/ - -void -Options ( - void) -{ - - printf ("General Output:\n"); - printf (" -p <prefix> Specify filename prefix for all output files (including .aml)\n"); - printf (" -vi Less verbose errors and warnings for use with IDEs\n"); - printf (" -vo Enable optimization comments\n"); - printf (" -vr Disable remarks\n"); - printf (" -vs Disable signon\n"); - - printf ("\nAML Output:\n"); - printf (" -s<a|c> Create AML in assembler or C source file (*.asm or *.c)\n"); - printf (" -i<a|c> Create assembler or C include file (*.inc or *.h)\n"); - printf (" -t<a|c> Create AML in assembler or C hex table (*.hex)\n"); - - printf ("\nAML Optimization:\n"); - printf (" -oa Disable all optimizations (compatibility mode)\n"); - printf (" -of Disable constant folding\n"); - printf (" -oi Disable integer optimization to Zero/One/Ones\n"); - printf (" -on Disable named reference string optimization\n"); - - printf ("\nListings:\n"); - printf (" -l Create mixed listing file (ASL source and AML) (*.lst)\n"); - printf (" -ln Create namespace file (*.nsp)\n"); - printf (" -ls Create combined source file (expanded includes) (*.src)\n"); - - printf ("\nACPI Tables and AML Disassembler:\n"); - printf (" -d [file] Disassemble AML to ASL source code file (*.dsl)\n"); - printf (" -dc [file] Disassemble AML and immediately compile it\n"); - printf (" (Obtain DSDT from current system if no input file)\n"); - printf (" -g Get ACPI tables and write to files (*.dat)\n"); - - printf ("\nHelp:\n"); - printf (" -h Additional help and compiler debug options\n"); - printf (" -hc Display operators allowed in constant expressions\n"); - printf (" -hr Display ACPI reserved method names\n"); -} - - -/******************************************************************************* - * - * FUNCTION: Usage - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display help message - * - ******************************************************************************/ - -void -HelpMessage ( - void) -{ - - printf ("AML output filename generation:\n"); - printf (" Output filenames are generated by appending an extension to a common\n"); - printf (" filename prefix. The filename prefix is obtained via one of the\n"); - printf (" following methods (in priority order):\n"); - printf (" 1) The -p option specifies the prefix\n"); - printf (" 2) The prefix of the AMLFileName in the ASL Definition Block\n"); - printf (" 3) The prefix of the input filename\n"); - printf ("\n"); - - Options (); - - printf ("\nCompiler Debug Options:\n"); - printf (" -b<p|t|b> Create compiler debug/trace file (*.txt)\n"); - printf (" Types: Parse/Tree/Both\n"); - printf (" -e Ignore errors, always create AML output file(s)\n"); - printf (" -c Parse only, no output generation\n"); - printf (" -ot Display compile times\n"); - printf (" -x<level> Set debug level for trace output\n"); -} - - -/******************************************************************************* - * - * FUNCTION: Usage - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display usage and option message - * - ******************************************************************************/ - -void -Usage ( - void) -{ - - printf ("Usage: %s [Options] [InputFile]\n\n", CompilerName); - Options (); -} - - -/******************************************************************************* - * - * FUNCTION: AslInitialize - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Initialize compiler globals - * - ******************************************************************************/ - -void -AslInitialize (void) -{ - UINT32 i; - - -#ifdef _DEBUG - _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CrtSetDbgFlag(0)); -#endif - - AcpiDbgLevel = 0; - - for (i = 0; i < ASL_NUM_FILES; i++) - { - Gbl_Files[i].Handle = NULL; - Gbl_Files[i].Filename = NULL; - } - - Gbl_Files[ASL_FILE_STDOUT].Handle = stdout; - Gbl_Files[ASL_FILE_STDOUT].Filename = "STDOUT"; - - Gbl_Files[ASL_FILE_STDERR].Handle = stderr; - Gbl_Files[ASL_FILE_STDERR].Filename = "STDERR"; -} - - -/******************************************************************************* - * - * FUNCTION: AslCommandLine - * - * PARAMETERS: argc/argv - * - * RETURN: None - * - * DESCRIPTION: Command line processing - * - ******************************************************************************/ - -void -AslCommandLine ( - int argc, - char **argv) -{ - BOOLEAN BadCommandLine = FALSE; - ACPI_NATIVE_UINT j; - - - /* Minimum command line contains at least one option or an input file */ - - if (argc < 2) - { - AslCompilerSignon (ASL_FILE_STDOUT); - Usage (); - exit (1); - } - - /* Get the command line options */ - - while ((j = AcpiGetopt (argc, argv, "b:cd^egh^i^l^o:p:rs:t:v:x:")) != EOF) switch (j) - { - case 'b': - - switch (AcpiGbl_Optarg[0]) - { - case 'b': - AslCompilerdebug = 1; /* same as yydebug */ - break; - - case 'p': - AslCompilerdebug = 1; /* same as yydebug */ - break; - - case 't': - break; - - default: - printf ("Unknown option: -b%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; - } - - /* Produce debug output file */ - - Gbl_DebugFlag = TRUE; - break; - - - case 'c': - - /* Parse only */ - - Gbl_ParseOnlyFlag = TRUE; - break; - - - case 'd': - switch (AcpiGbl_Optarg[0]) - { - case '^': - DoCompile = FALSE; - break; - - case 'c': - break; - - default: - printf ("Unknown option: -d%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; - } - - Gbl_DisasmFlag = TRUE; - break; - - - case 'e': - - /* Ignore errors and always attempt to create aml file */ - - Gbl_IgnoreErrors = TRUE; - break; - - - case 'g': - - /* Get all ACPI tables */ - - Gbl_GetAllTables = TRUE; - DoCompile = FALSE; - break; - - - case 'h': - - switch (AcpiGbl_Optarg[0]) - { - case '^': - HelpMessage (); - exit (0); - - case 'c': - UtDisplayConstantOpcodes (); - exit (0); - - case 'r': - /* reserved names */ - - MpDisplayReservedNames (); - exit (0); - - default: - printf ("Unknown option: -h%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; - } - break; - - - case 'i': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - - /* Produce assembly code include file */ - - Gbl_AsmIncludeOutputFlag = TRUE; - break; - - case 'c': - - /* Produce C include file */ - - Gbl_C_IncludeOutputFlag = TRUE; - break; - - default: - printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; - } - break; - - - case 'l': - - switch (AcpiGbl_Optarg[0]) - { - case '^': - /* Produce listing file (Mixed source/aml) */ - - Gbl_ListingFlag = TRUE; - break; - - case 'n': - /* Produce namespace file */ - - Gbl_NsOutputFlag = TRUE; - break; - - case 's': - /* Produce combined source file */ - - Gbl_SourceOutputFlag = TRUE; - break; - - default: - printf ("Unknown option: -l%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; - } - break; - - - case 'o': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - - /* Disable all optimizations */ - - Gbl_FoldConstants = FALSE; - Gbl_IntegerOptimizationFlag = FALSE; - Gbl_ReferenceOptimizationFlag = FALSE; - break; - - case 'f': - - /* Disable folding on "normal" expressions */ - - Gbl_FoldConstants = FALSE; - break; - - case 'i': - - /* Disable integer optimization to constants */ - - Gbl_IntegerOptimizationFlag = FALSE; - break; - - case 'n': - - /* Disable named reference optimization */ - - Gbl_ReferenceOptimizationFlag = FALSE; - break; - - case 't': - - /* Display compile time(s) */ - - Gbl_CompileTimesFlag = TRUE; - break; - - default: - printf ("Unknown option: -c%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; - } - break; - - - case 'p': - - /* Override default AML output filename */ - - Gbl_OutputFilenamePrefix = AcpiGbl_Optarg; - Gbl_UseDefaultAmlFilename = FALSE; - break; - - - case 'r': - AslToFile = FALSE; - break; - - - case 's': - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - - /* Produce assembly code output file */ - - Gbl_AsmOutputFlag = TRUE; - break; - - case 'c': - - /* Produce C hex output file */ - - Gbl_C_OutputFlag = TRUE; - break; - - default: - printf ("Unknown option: -s%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; - } - break; - - - case 't': - - /* Produce hex table output file */ - - switch (AcpiGbl_Optarg[0]) - { - case 'a': - Gbl_HexOutputFlag = HEX_OUTPUT_ASM; - break; - - case 'c': - Gbl_HexOutputFlag = HEX_OUTPUT_C; - break; - - default: - printf ("Unknown option: -t%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; - } - break; - - - case 'v': - - switch (AcpiGbl_Optarg[0]) - { - case 'i': - /* Less verbose error messages */ - - Gbl_VerboseErrors = FALSE; - break; - - case 'o': - Gbl_DisplayOptimizations = TRUE; - break; - - case 'r': - Gbl_DisplayRemarks = FALSE; - break; - - case 's': - DoSignon = FALSE; - break; - - default: - printf ("Unknown option: -v%s\n", AcpiGbl_Optarg); - BadCommandLine = TRUE; - break; - } - break; - - - case 'x': - - AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16); - break; - - - default: - - BadCommandLine = TRUE; - break; - } - - /* Next parameter must be the input filename */ - - Gbl_Files[ASL_FILE_INPUT].Filename = argv[AcpiGbl_Optind]; - if (!Gbl_Files[ASL_FILE_INPUT].Filename && !Gbl_DisasmFlag && !Gbl_GetAllTables) - { - printf ("Missing input filename\n"); - BadCommandLine = TRUE; - } - - if (DoSignon) - { - AslCompilerSignon (ASL_FILE_STDOUT); - } - - /* Abort if anything went wrong on the command line */ - - if (BadCommandLine) - { - printf ("\n"); - Usage (); - exit (1); - } - - if ((AcpiGbl_Optind + 1) < argc) - { - printf ("Warning: extra arguments (%d) after input filename are ignored\n\n", - argc - AcpiGbl_Optind - 1); - } -} - - -/******************************************************************************* - * - * FUNCTION: main - * - * PARAMETERS: Standard argc/argv - * - * RETURN: Program termination code - * - * DESCRIPTION: C main routine for the Asl Compiler. Handle command line - * options and begin the compile. - * - ******************************************************************************/ - -int ACPI_SYSTEM_XFACE -main ( - int argc, - char **argv) -{ - ACPI_STATUS Status; - char *Prefix; - - - /* Init and command line */ - - AslInitialize (); - AslCommandLine (argc, argv); - - /* - * If -p not specified, we will use the input filename as the - * output filename prefix - */ - FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename, - &Gbl_DirectoryPath, &Prefix); - - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = Prefix; - } - - /* - * AML Disassembly (Optional) - */ - if (Gbl_DisasmFlag || Gbl_GetAllTables) - { - /* ACPI CA subsystem initialization */ - - Status = AcpiOsInitialize (); - AcpiUtInitGlobals (); - Status = AcpiUtMutexInitialize (); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - Status = AcpiNsRootInitialize (); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - /* This is where the disassembly happens */ - - AcpiGbl_DbOpt_disasm = TRUE; - Status = AdAmlDisassemble (AslToFile, - Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_OutputFilenamePrefix, - &Gbl_Files[ASL_FILE_INPUT].Filename, - Gbl_GetAllTables); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - /* - * Gbl_Files[ASL_FILE_INPUT].Filename was replaced with the - * .DSL disassembly file, which can now be compiled if requested - */ - if (DoCompile) - { - AcpiOsPrintf ("\nCompiling \"%s\"\n", - Gbl_Files[ASL_FILE_INPUT].Filename); - } - } - - /* - * ASL Compilation (Optional) - */ - if (DoCompile) - { - /* - * If -p not specified, we will use the input filename as the - * output filename prefix - */ - FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename, - &Gbl_DirectoryPath, &Prefix); - - if (Gbl_UseDefaultAmlFilename) - { - Gbl_OutputFilenamePrefix = Prefix; - } - - /* ACPI CA subsystem initialization (Must be re-initialized) */ - - Status = AcpiOsInitialize (); - AcpiUtInitGlobals (); - Status = AcpiUtMutexInitialize (); - if (ACPI_FAILURE (Status)) - { - return -1; - } - - Status = AcpiNsRootInitialize (); - if (ACPI_FAILURE (Status)) - { - return -1; - } - Status = CmDoCompile (); - } - - return (0); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslmap.c b/sys/dev/acpi/acpica/Subsystem/aslmap.c deleted file mode 100644 index 6e374d068e6..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslmap.c +++ /dev/null @@ -1,674 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslmap - parser to AML opcode mapping table - * $Revision: 68 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "amlcode.h" -#include "acparser.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslmap") - - -/******************************************************************************* - * - * FUNCTION: AslMapNamedOpcodeToDataType - * - * PARAMETERS: Opcode - The Named AML opcode to map - * - * RETURN: The ACPI type associated with the named opcode - * - * DESCRIPTION: Convert a raw Named AML opcode to the associated data type. - * Named opcodes are a subset of the AML opcodes. - * - ******************************************************************************/ - -ACPI_OBJECT_TYPE -AslMapNamedOpcodeToDataType ( - UINT16 Opcode) -{ - const ACPI_OPCODE_INFO *OpInfo; - - - /* - * There are some differences from the opcode table types, we - * catch them here. - */ - OpInfo = AcpiPsGetOpcodeInfo (Opcode); - - if (Opcode == AML_INT_NAMEPATH_OP) - { - return (ACPI_TYPE_ANY); - } - - if (Opcode == AML_INT_METHODCALL_OP) - { - return (ACPI_TYPE_ANY); - } - - if (OpInfo->Flags & AML_NSOBJECT) - { - return (OpInfo->ObjectType); - } - - return (ACPI_TYPE_ANY); -} - - -/******************************************************************************* - * - * DATA STRUCTURE: ReservedMethods - * - * DESCRIPTION: Contains all reserved methods and names as defined in the - * ACPI specification. Used during the analysis phase to - * ensure that reserved methods have the required number of - * arguments and the proper return type. - * - * Each entry in the table contains the following items: - * - * Name - The ACPI reserved name - * Args - Number of arguments to the method - * Flags - Whether this method must return a value or not - * - ******************************************************************************/ - -const ASL_RESERVED_INFO ReservedMethods[] = { - {"_AC0", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC1", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC2", 0, ASL_RSVD_RETURN_VALUE}, - {"_AC3", 0, ASL_RSVD_RETURN_VALUE}, - {"_ADR", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL0", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL1", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL2", 0, ASL_RSVD_RETURN_VALUE}, - {"_AL3", 0, ASL_RSVD_RETURN_VALUE}, - {"_ALN", 0, ASL_RSVD_RESOURCE_NAME}, - {"_ASI", 0, ASL_RSVD_RESOURCE_NAME}, - {"_BAS", 0, ASL_RSVD_RESOURCE_NAME}, - {"_BBN", 0, ASL_RSVD_RETURN_VALUE}, - {"_BCL", 0, ASL_RSVD_RETURN_VALUE}, - {"_BCM", 1, 0}, - {"_BDN", 0, ASL_RSVD_RETURN_VALUE}, - {"_BFS", 1, 0}, - {"_BIF", 0, ASL_RSVD_RETURN_VALUE}, - {"_BM_", 0, ASL_RSVD_RESOURCE_NAME}, - {"_BST", 0, ASL_RSVD_RETURN_VALUE}, - {"_BTP", 1, 0}, - {"_CID", 0, ASL_RSVD_RETURN_VALUE}, - {"_CRS", 0, ASL_RSVD_RETURN_VALUE}, - {"_CRT", 0, ASL_RSVD_RETURN_VALUE}, - {"_CST", 0, ASL_RSVD_RETURN_VALUE}, - {"_DCK", 1, ASL_RSVD_RETURN_VALUE}, - {"_DCS", 0, ASL_RSVD_RETURN_VALUE}, - {"_DDC", 1, ASL_RSVD_RETURN_VALUE}, - {"_DDN", 0, 0}, - {"_DEC", 0, ASL_RSVD_RESOURCE_NAME}, - {"_DGS", 0, ASL_RSVD_RETURN_VALUE}, - {"_DIS", 0, 0}, - {"_DMA", 0, ASL_RSVD_RETURN_VALUE}, - {"_DOD", 0, ASL_RSVD_RETURN_VALUE}, - {"_DOS", 1, 0}, - {"_DSS", 1, 0}, - {"_EC_", 0, ASL_RSVD_RETURN_VALUE}, - {"_EDL", 0, ASL_RSVD_RETURN_VALUE}, - {"_EJ0", 1, 0}, - {"_EJ1", 1, 0}, - {"_EJ2", 1, 0}, - {"_EJ3", 1, 0}, - {"_EJ4", 1, 0}, - {"_EJD", 0, ASL_RSVD_RETURN_VALUE}, - {"_FDE", 0, ASL_RSVD_RETURN_VALUE}, - {"_FDI", 0, ASL_RSVD_RETURN_VALUE}, - {"_FDM", 1, 0}, - {"_FIX", 0, ASL_RSVD_RETURN_VALUE}, - {"_GL_", 0, ASL_RSVD_RETURN_VALUE}, - {"_GLK", 0, ASL_RSVD_RETURN_VALUE}, - {"_GPD", 0, ASL_RSVD_RETURN_VALUE}, - {"_GPE", 0, ASL_RSVD_RETURN_VALUE}, - {"_GRA", 0, ASL_RSVD_RESOURCE_NAME}, - {"_GTF", 0, ASL_RSVD_RETURN_VALUE}, - {"_GTM", 0, ASL_RSVD_RETURN_VALUE}, - {"_GTS", 1, 0}, - {"_HE_", 0, ASL_RSVD_RESOURCE_NAME}, - {"_HID", 0, ASL_RSVD_RETURN_VALUE}, - {"_HOT", 0, ASL_RSVD_RETURN_VALUE}, - {"_HPP", 0, ASL_RSVD_RETURN_VALUE}, - {"_INI", 0, 0}, - {"_INT", 0, ASL_RSVD_RESOURCE_NAME}, - {"_IRC", 0, 0}, - {"_LCK", 1, 0}, - {"_LEN", 0, ASL_RSVD_RESOURCE_NAME}, - {"_LID", 0, ASL_RSVD_RETURN_VALUE}, - {"_LL_", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MAF", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MAT", 0, ASL_RSVD_RETURN_VALUE}, - {"_MAX", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MEM", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MIF", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MIN", 0, ASL_RSVD_RESOURCE_NAME}, - {"_MSG", 1, 0}, - {"_OFF", 0, 0}, - {"_ON_", 0, 0}, - {"_OS_", 0, ASL_RSVD_RETURN_VALUE}, - {"_OSI", 1, ASL_RSVD_RETURN_VALUE}, - {"_PCL", 0, ASL_RSVD_RETURN_VALUE}, - {"_PCT", 0, ASL_RSVD_RETURN_VALUE}, - {"_PIC", 1, 0}, - {"_PPC", 0, ASL_RSVD_RETURN_VALUE}, - {"_PR0", 0, ASL_RSVD_RETURN_VALUE}, - {"_PR1", 0, ASL_RSVD_RETURN_VALUE}, - {"_PR2", 0, ASL_RSVD_RETURN_VALUE}, - {"_PRS", 0, ASL_RSVD_RETURN_VALUE}, - {"_PRT", 0, ASL_RSVD_RETURN_VALUE}, - {"_PRW", 0, ASL_RSVD_RETURN_VALUE}, - {"_PS0", 0, 0}, - {"_PS1", 0, 0}, - {"_PS2", 0, 0}, - {"_PS3", 0, 0}, - {"_PSC", 0, ASL_RSVD_RETURN_VALUE}, - {"_PSL", 0, ASL_RSVD_RETURN_VALUE}, - {"_PSR", 0, ASL_RSVD_RETURN_VALUE}, - {"_PSS", 0, ASL_RSVD_RETURN_VALUE}, - {"_PSV", 0, ASL_RSVD_RETURN_VALUE}, - {"_PSW", 1, 0}, - {"_PTC", 0, ASL_RSVD_RETURN_VALUE}, - {"_PTS", 1, 0}, - {"_PXM", 0, ASL_RSVD_RETURN_VALUE}, - {"_RBO", 0, ASL_RSVD_RESOURCE_NAME}, - {"_RBW", 0, ASL_RSVD_RESOURCE_NAME}, - {"_REG", 2, 0}, - {"_REV", 0, ASL_RSVD_RETURN_VALUE}, - {"_RMV", 0, ASL_RSVD_RETURN_VALUE}, - {"_RNG", 0, ASL_RSVD_RESOURCE_NAME}, - {"_ROM", 2, ASL_RSVD_RETURN_VALUE}, - {"_RW_", 0, ASL_RSVD_RESOURCE_NAME}, - {"_S0_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S1_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S2_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S3_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S4_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S5_", 0, ASL_RSVD_RETURN_VALUE}, - {"_S1D", 0, ASL_RSVD_RETURN_VALUE}, - {"_S2D", 0, ASL_RSVD_RETURN_VALUE}, - {"_S3D", 0, ASL_RSVD_RETURN_VALUE}, - {"_S4D", 0, ASL_RSVD_RETURN_VALUE}, - {"_SB_", 0, ASL_RSVD_SCOPE}, - {"_SBS", 0, ASL_RSVD_RETURN_VALUE}, - {"_SCP", 1, 0}, - {"_SEG", 0, ASL_RSVD_RETURN_VALUE}, - {"_SHR", 0, ASL_RSVD_RESOURCE_NAME}, - {"_SI_", 0, ASL_RSVD_SCOPE}, - {"_SIZ", 0, ASL_RSVD_RESOURCE_NAME}, - {"_SPD", 1, ASL_RSVD_RETURN_VALUE}, - {"_SRS", 1, 0}, - {"_SST", 1, 0}, - {"_STA", 0, ASL_RSVD_RETURN_VALUE}, - {"_STM", 3, 0}, - {"_STR", 0, ASL_RSVD_RETURN_VALUE}, - {"_SUN", 0, ASL_RSVD_RETURN_VALUE}, - {"_TC1", 0, ASL_RSVD_RETURN_VALUE}, - {"_TC2", 0, ASL_RSVD_RETURN_VALUE}, - {"_TMP", 0, ASL_RSVD_RETURN_VALUE}, - {"_TRA", 0, ASL_RSVD_RESOURCE_NAME}, - {"_TRS", 0, ASL_RSVD_RESOURCE_NAME}, - {"_TSP", 0, ASL_RSVD_RETURN_VALUE}, - {"_TTP", 0, ASL_RSVD_RESOURCE_NAME}, - {"_TYP", 0, ASL_RSVD_RESOURCE_NAME}, - {"_TZ_", 0, ASL_RSVD_SCOPE}, - {"_TZD", 0, ASL_RSVD_RETURN_VALUE}, - {"_TZP", 0, ASL_RSVD_RETURN_VALUE}, - {"_UID", 0, ASL_RSVD_RETURN_VALUE}, - {"_VPO", 0, ASL_RSVD_RETURN_VALUE}, - {"_WAK", 1, ASL_RSVD_RETURN_VALUE}, - {NULL, 0, 0}, -}; - - -/******************************************************************************* - * - * FUNCTION: MpDisplayReservedNames - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Print the table above - * - ******************************************************************************/ - -void -MpDisplayReservedNames ( - void) -{ - UINT32 i; - - printf ("Reserved name information\n\n"); - - for (i = 0; ReservedMethods[i].Name; i++) - { - printf ("%s ", ReservedMethods[i].Name); - - if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE) - { - printf ("Reserved scope name\n"); - } - else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME) - { - printf ("Resource data type reserved field name\n"); - } - else - { - printf ("Method with %d arguments, ", ReservedMethods[i].NumArguments); - if (ReservedMethods[i].Flags & ASL_RSVD_RETURN_VALUE) - { - printf ("must return a value\n"); - } - else - { - printf ("no return value\n"); - } - } - } -} - - -/******************************************************************************* - * - * DATA STRUCTURE: AslKeywordMapping - * - * DESCRIPTION: Maps the ParseOpcode to the actual AML opcode. The parse - * opcodes are generated from Bison, and this table must - * track any additions to them. - * - * Each entry in the table contains the following items: - * - * AML opcode - Opcode that is written to the AML file - * Value - Value of the object to be written (if applicable) - * Flags - 1) Whether this opcode opens an AML "package". - * - ******************************************************************************/ -/* - * TBD: - * AccessAttrib - * AccessType - * AMlop for DMA? - * ObjectType keywords - * Register - */ - -const ASL_MAPPING_ENTRY AslKeywordMapping [] = -{ -/*! [Begin] no source code translation (keep the table structure) */ - - -/* ACCESSAS */ OP_TABLE_ENTRY (AML_INT_ACCESSFIELD_OP, 0, 0, 0), -/* ACCESSATTRIB_BLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BLOCK, 0, 0), -/* ACCESSATTRIB_BLOCK_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BLOCK_CALL,0, 0), -/* ACCESSATTRIB_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_BYTE, 0, 0), -/* ACCESSATTRIB_WORD_CALL */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_WORD_CALL, 0, 0), -/* ACCESSATTRIB_QUICK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_QUICK, 0, 0), -/* ACCESSATTRIB_SND_RCV */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_SEND_RCV, 0, 0), -/* ACCESSATTRIB_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ATTRIB_SMB_WORD, 0, 0), -/* ACCESSTYPE_ANY */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_ANY, 0, 0), -/* ACCESSTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BUFFER, 0, 0), -/* ACCESSTYPE_BYTE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_BYTE, 0, 0), -/* ACCESSTYPE_DWORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_DWORD, 0, 0), -/* ACCESSTYPE_QWORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_QWORD, 0, 0), -/* ACCESSTYPE_WORD */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_ACCESS_WORD, 0, 0), -/* ACQUIRE */ OP_TABLE_ENTRY (AML_ACQUIRE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ADD */ OP_TABLE_ENTRY (AML_ADD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ADDRESSSPACE_FFIXEDHW */ OP_TABLE_ENTRY (AML_BYTE_OP, REGION_FIXED_HW, 0, 0), -/* ADDRESSTYPE_ACPI */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* ADDRESSTYPE_MEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* ADDRESSTYPE_NVS */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* ADDRESSTYPE_RESERVED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* ALIAS */ OP_TABLE_ENTRY (AML_ALIAS_OP, 0, 0, 0), -/* AND */ OP_TABLE_ENTRY (AML_BIT_AND_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ARG0 */ OP_TABLE_ENTRY (AML_ARG0, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG1 */ OP_TABLE_ENTRY (AML_ARG1, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG2 */ OP_TABLE_ENTRY (AML_ARG2, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG3 */ OP_TABLE_ENTRY (AML_ARG3, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG4 */ OP_TABLE_ENTRY (AML_ARG4, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG5 */ OP_TABLE_ENTRY (AML_ARG5, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* ARG6 */ OP_TABLE_ENTRY (AML_ARG6, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* BANKFIELD */ OP_TABLE_ENTRY (AML_BANK_FIELD_OP, 0, NODE_AML_PACKAGE, 0), -/* BREAK */ OP_TABLE_ENTRY (AML_BREAK_OP, 0, 0, 0), -/* BREAKPOINT */ OP_TABLE_ENTRY (AML_BREAK_POINT_OP, 0, 0, 0), -/* BUFFER */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_BUFFER), -/* BUSMASTERTYPE_MASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* BUSMASTERTYPE_NOTMASTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* BYTECONST */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, 0, 0, ACPI_BTYPE_INTEGER), -/* CASE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* CONCATENATE */ OP_TABLE_ENTRY (AML_CONCAT_OP, 0, 0, ACPI_BTYPE_COMPUTE_DATA), -/* CONCATENATERESTEMPLATE */ OP_TABLE_ENTRY (AML_CONCAT_RES_OP, 0, 0, ACPI_BTYPE_BUFFER), -/* CONDREFOF */ OP_TABLE_ENTRY (AML_COND_REF_OF_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* CONTINUE */ OP_TABLE_ENTRY (AML_CONTINUE_OP, 0, 0, 0), -/* COPY */ OP_TABLE_ENTRY (AML_COPY_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), -/* CREATEBITFIELD */ OP_TABLE_ENTRY (AML_CREATE_BIT_FIELD_OP, 0, 0, 0), -/* CREATEBYTEFIELD */ OP_TABLE_ENTRY (AML_CREATE_BYTE_FIELD_OP, 0, 0, 0), -/* CREATEDWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_DWORD_FIELD_OP, 0, 0, 0), -/* CREATEFIELD */ OP_TABLE_ENTRY (AML_CREATE_FIELD_OP, 0, 0, 0), -/* CREATEQWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_QWORD_FIELD_OP, 0, 0, 0), -/* CREATEWORDFIELD */ OP_TABLE_ENTRY (AML_CREATE_WORD_FIELD_OP, 0, 0, 0), -/* DATATABLEREGION */ OP_TABLE_ENTRY (AML_DATA_REGION_OP, 0, 0, 0), -/* DEBUG */ OP_TABLE_ENTRY (AML_DEBUG_OP, 0, 0, ACPI_BTYPE_DEBUG_OBJECT), -/* DECODETYPE_POS */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* DECODETYPE_SUB */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* DECREMENT */ OP_TABLE_ENTRY (AML_DECREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* DEFAULT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DEFAULT_ARG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DEFINITIONBLOCK */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DEREFOF */ OP_TABLE_ENTRY (AML_DEREF_OF_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE | ACPI_BTYPE_STRING), -/* DEVICE */ OP_TABLE_ENTRY (AML_DEVICE_OP, 0, NODE_AML_PACKAGE, 0), -/* DIVIDE */ OP_TABLE_ENTRY (AML_DIVIDE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* DMA */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DMATYPE_A */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* DMATYPE_COMPATIBILITY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* DMATYPE_B */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* DMATYPE_F */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* DWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_DWORD, 0, 0, ACPI_BTYPE_INTEGER), -/* DWORDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* DWORDMEMORY */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* EISAID */ OP_TABLE_ENTRY (AML_DWORD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ELSE */ OP_TABLE_ENTRY (AML_ELSE_OP, 0, NODE_AML_PACKAGE, 0), -/* ELSEIF */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, NODE_AML_PACKAGE, 0), -/* ENDDEPENDENTFN */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* ERRORNODE */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0), -/* EVENT */ OP_TABLE_ENTRY (AML_EVENT_OP, 0, 0, 0), -/* EXTERNAL */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* FATAL */ OP_TABLE_ENTRY (AML_FATAL_OP, 0, 0, 0), -/* FIELD */ OP_TABLE_ENTRY (AML_FIELD_OP, 0, NODE_AML_PACKAGE, 0), -/* FINDSETLEFTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_LEFT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* FINDSETRIGHTBIT */ OP_TABLE_ENTRY (AML_FIND_SET_RIGHT_BIT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* FIXEDIO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* FROMBCD */ OP_TABLE_ENTRY (AML_FROM_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* IF */ OP_TABLE_ENTRY (AML_IF_OP, 0, NODE_AML_PACKAGE, 0), -/* INCLUDE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INCLUDE_CSTYLE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INCLUDE_END */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INCREMENT */ OP_TABLE_ENTRY (AML_INCREMENT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* INDEX */ OP_TABLE_ENTRY (AML_INDEX_OP, 0, 0, ACPI_BTYPE_REFERENCE), -/* INDEXFIELD */ OP_TABLE_ENTRY (AML_INDEX_FIELD_OP, 0, NODE_AML_PACKAGE, 0), -/* INTEGER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* INTERRUPT */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* INTLEVEL_ACTIVEHIGH */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* INTLEVEL_ACTIVELOW */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* INTTYPE_EDGE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* INTTYPE_LEVEL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* IO */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* IODECODETYPE_10 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* IODECODETYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* IRQ */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* IRQNOFLAGS */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* LAND */ OP_TABLE_ENTRY (AML_LAND_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LEQUAL */ OP_TABLE_ENTRY (AML_LEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LGREATER */ OP_TABLE_ENTRY (AML_LGREATER_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LGREATEREQUAL */ OP_TABLE_ENTRY (AML_LGREATEREQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LINE */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* LLESS */ OP_TABLE_ENTRY (AML_LLESS_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LLESSEQUAL */ OP_TABLE_ENTRY (AML_LLESSEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LNOT */ OP_TABLE_ENTRY (AML_LNOT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LNOTEQUAL */ OP_TABLE_ENTRY (AML_LNOTEQUAL_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* LOAD */ OP_TABLE_ENTRY (AML_LOAD_OP, 0, 0, 0), -/* LOADTABLE */ OP_TABLE_ENTRY (AML_LOAD_TABLE_OP, 0, 0, ACPI_BTYPE_DDB_HANDLE), -/* LOCAL0 */ OP_TABLE_ENTRY (AML_LOCAL0, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL1 */ OP_TABLE_ENTRY (AML_LOCAL1, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL2 */ OP_TABLE_ENTRY (AML_LOCAL2, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL3 */ OP_TABLE_ENTRY (AML_LOCAL3, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL4 */ OP_TABLE_ENTRY (AML_LOCAL4, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL5 */ OP_TABLE_ENTRY (AML_LOCAL5, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL6 */ OP_TABLE_ENTRY (AML_LOCAL6, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCAL7 */ OP_TABLE_ENTRY (AML_LOCAL7, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* LOCKRULE_LOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_LOCK_ALWAYS, 0, 0), -/* LOCKRULE_NOLOCK */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_LOCK_NEVER, 0, 0), -/* LOR */ OP_TABLE_ENTRY (AML_LOR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MATCH */ OP_TABLE_ENTRY (AML_MATCH_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MEQ */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MEQ, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MGE */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MGE, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MGT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MGT, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MLE */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MLE, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MLT */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MLT, 0, ACPI_BTYPE_INTEGER), -/* MATCHTYPE_MTR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, MATCH_MTR, 0, ACPI_BTYPE_INTEGER), -/* MAXTYPE_FIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* MAXTYPE_NOTFIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* MEMORY24 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* MEMORY32 */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* MEMORY32FIXED */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* MEMTYPE_CACHEABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* MEMTYPE_NONCACHEABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* MEMTYPE_PREFETCHABLE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* MEMTYPE_WRITECOMBINING */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* METHOD */ OP_TABLE_ENTRY (AML_METHOD_OP, 0, NODE_AML_PACKAGE, 0), -/* METHODCALL */ OP_TABLE_ENTRY (AML_INT_METHODCALL_OP, 0, 0, ACPI_BTYPE_OBJECTS_AND_REFS), -/* MID */ OP_TABLE_ENTRY (AML_MID_OP, 0, 0, ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER), -/* MINTYPE_FIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* MINTYPE_NOTFIXED */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* MOD */ OP_TABLE_ENTRY (AML_MOD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MULTIPLY */ OP_TABLE_ENTRY (AML_MULTIPLY_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* MUTEX */ OP_TABLE_ENTRY (AML_MUTEX_OP, 0, 0, 0), -/* NAME */ OP_TABLE_ENTRY (AML_NAME_OP, 0, 0, 0), -/* NAMESEG */ OP_TABLE_ENTRY (AML_INT_NAMEPATH_OP, 0, 0, 0), -/* NAMESTRING */ OP_TABLE_ENTRY (AML_INT_NAMEPATH_OP, 0, 0, 0), -/* NAND */ OP_TABLE_ENTRY (AML_BIT_NAND_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* NOOP */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0), -/* NOR */ OP_TABLE_ENTRY (AML_BIT_NOR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* NOT */ OP_TABLE_ENTRY (AML_BIT_NOT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* NOTIFY */ OP_TABLE_ENTRY (AML_NOTIFY_OP, 0, 0, 0), -/* OBJECTTYPE */ OP_TABLE_ENTRY (AML_TYPE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* OBJECTTYPE_BFF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER_FIELD, 0, 0), -/* OBJECTTYPE_BUF */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_BUFFER, 0, 0), -/* OBJECTTYPE_DDB */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DDB_HANDLE, 0, 0), -/* OBJECTTYPE_DEV */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_DEVICE, 0, 0), -/* OBJECTTYPE_EVT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_EVENT, 0, 0), -/* OBJECTTYPE_FLD */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_FIELD_UNIT, 0, 0), -/* OBJECTTYPE_INT */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_INTEGER, 0, 0), -/* OBJECTTYPE_MTH */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_METHOD, 0, 0), -/* OBJECTTYPE_MTX */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_MUTEX, 0, 0), -/* OBJECTTYPE_OPR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_REGION, 0, 0), -/* OBJECTTYPE_PKG */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PACKAGE, 0, 0), -/* OBJECTTYPE_POW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_POWER, 0, 0), -/* OBJECTTYPE_STR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_STRING, 0, 0), -/* OBJECTTYPE_THZ */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_THERMAL, 0, 0), -/* OBJECTTYPE_UNK */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_ANY, 0, 0), -/* OFFSET */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0), -/* ONE */ OP_TABLE_ENTRY (AML_ONE_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ONES */ OP_TABLE_ENTRY (AML_ONES_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* OPERATIONREGION */ OP_TABLE_ENTRY (AML_REGION_OP, 0, 0, 0), -/* OR */ OP_TABLE_ENTRY (AML_BIT_OR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* PACKAGE */ OP_TABLE_ENTRY (AML_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE), -/* PACKAGEP_LENGTH */ OP_TABLE_ENTRY (AML_PACKAGE_LENGTH, 0, NODE_AML_PACKAGE, 0), -/* POWERRESOURCE */ OP_TABLE_ENTRY (AML_POWER_RES_OP, 0, NODE_AML_PACKAGE, 0), -/* PROCESSOR */ OP_TABLE_ENTRY (AML_PROCESSOR_OP, 0, NODE_AML_PACKAGE, 0), -/* QWORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_QWORD, 0, 0, ACPI_BTYPE_INTEGER), -/* QWORDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* QWORDMEMORY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* RANGE_TYPE_ENTIRE */ OP_TABLE_ENTRY (AML_BYTE_OP, 3, 0, 0), -/* RANGE_TYPE_ISAONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* RANGE_TYPE_NONISAONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* RAW_DATA */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* READWRITETYPE_BOTH */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* READWRITETYPE_READONLY */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* REFOF */ OP_TABLE_ENTRY (AML_REF_OF_OP, 0, 0, ACPI_BTYPE_REFERENCE), -/* REGIONSPACE_CMOS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_CMOS, 0, 0), -/* REGIONSPACE_EC */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_EC, 0, 0), -/* REGIONSPACE_IO */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_IO, 0, 0), -/* REGIONSPACE_MEM */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_MEMORY, 0, 0), -/* REGIONSPACE_PCI */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_CONFIG, 0, 0), -/* REGIONSPACE_PCIBAR */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_PCI_BAR, 0, 0), -/* REGIONSPACE_SMBUS */ OP_TABLE_ENTRY (AML_RAW_DATA_BYTE, REGION_SMBUS, 0, 0), -/* REGISTER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* RELEASE */ OP_TABLE_ENTRY (AML_RELEASE_OP, 0, 0, 0), -/* RESERVED_BYTES */ OP_TABLE_ENTRY (AML_INT_RESERVEDFIELD_OP, 0, 0, 0), -/* RESET */ OP_TABLE_ENTRY (AML_RESET_OP, 0, 0, 0), -/* RESOURCETEMPLATE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, 0, ACPI_BTYPE_BUFFER), -/* RESOURCETYPE_CONSUMER */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* RESOURCETYPE_PRODUCER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* RETURN */ OP_TABLE_ENTRY (AML_RETURN_OP, 0, 0, 0), -/* REVISION */ OP_TABLE_ENTRY (AML_REVISION_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SCOPE */ OP_TABLE_ENTRY (AML_SCOPE_OP, 0, NODE_AML_PACKAGE, 0), -/* SERIALIZERULE_NOTSERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* SERIALIZERULE_SERIAL */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* SHARETYPE_EXCLUSIVE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* SHARETYPE_SHARED */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* SHIFTLEFT */ OP_TABLE_ENTRY (AML_SHIFT_LEFT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SHIFTRIGHT */ OP_TABLE_ENTRY (AML_SHIFT_RIGHT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SIGNAL */ OP_TABLE_ENTRY (AML_SIGNAL_OP, 0, 0, 0), -/* SIZEOF */ OP_TABLE_ENTRY (AML_SIZE_OF_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SLEEP */ OP_TABLE_ENTRY (AML_SLEEP_OP, 0, 0, 0), -/* STALL */ OP_TABLE_ENTRY (AML_STALL_OP, 0, 0, 0), -/* STARTDEPENDENTFN */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* STARTDEPENDENTFN_NOPRI */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* STORE */ OP_TABLE_ENTRY (AML_STORE_OP, 0, 0, ACPI_BTYPE_DATA_REFERENCE), -/* STRING_LITERAL */ OP_TABLE_ENTRY (AML_STRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* SUBTRACT */ OP_TABLE_ENTRY (AML_SUBTRACT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* SWITCH */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0), -/* THERMALZONE */ OP_TABLE_ENTRY (AML_THERMAL_ZONE_OP, 0, NODE_AML_PACKAGE, 0), -/* TOBCD */ OP_TABLE_ENTRY (AML_TO_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* TOBUFFER */ OP_TABLE_ENTRY (AML_TO_BUFFER_OP, 0, 0, ACPI_BTYPE_COMPUTE_DATA), -/* TODECIMALSTRING */ OP_TABLE_ENTRY (AML_TO_DECSTRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* TOHEXSTRING */ OP_TABLE_ENTRY (AML_TO_HEXSTRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* TOINTEGER */ OP_TABLE_ENTRY (AML_TO_INTEGER_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* TOSTRING */ OP_TABLE_ENTRY (AML_TO_STRING_OP, 0, 0, ACPI_BTYPE_STRING), -/* TRANSLATIONTYPE_DENSE */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* TRANSLATIONTYPE_SPARSE */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* TYPE_STATIC */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* TYPE_TRANSLATION */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* UNICODE */ OP_TABLE_ENTRY (AML_BUFFER_OP, 0, NODE_AML_PACKAGE, 0), -/* UNLOAD */ OP_TABLE_ENTRY (AML_UNLOAD_OP, 0, 0, 0), -/* UPDATERULE_ONES */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ONES, 0, 0), -/* UPDATERULE_PRESERVE */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_PRESERVE, 0, 0), -/* UPDATERULE_ZEROS */ OP_TABLE_ENTRY (AML_BYTE_OP, AML_FIELD_UPDATE_WRITE_AS_ZEROS,0, 0), -/* VAR_PACKAGE */ OP_TABLE_ENTRY (AML_VAR_PACKAGE_OP, 0, NODE_AML_PACKAGE, ACPI_BTYPE_PACKAGE), -/* VENDORLONG */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* VENDORSHORT */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* WAIT */ OP_TABLE_ENTRY (AML_WAIT_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* WHILE */ OP_TABLE_ENTRY (AML_WHILE_OP, 0, NODE_AML_PACKAGE, 0), -/* WORDBUSNUMBER */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* WORDCONST */ OP_TABLE_ENTRY (AML_RAW_DATA_WORD, 0, 0, ACPI_BTYPE_INTEGER), -/* WORDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* XFERTYPE_8 */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0), -/* XFERTYPE_8_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 1, 0, 0), -/* XFERTYPE_16 */ OP_TABLE_ENTRY (AML_BYTE_OP, 2, 0, 0), -/* XOR */ OP_TABLE_ENTRY (AML_BIT_XOR_OP, 0, 0, ACPI_BTYPE_INTEGER), -/* ZERO */ OP_TABLE_ENTRY (AML_ZERO_OP, 0, 0, ACPI_BTYPE_INTEGER), - -/*! [End] no source code translation !*/ - -}; - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslopcodes.c b/sys/dev/acpi/acpica/Subsystem/aslopcodes.c deleted file mode 100644 index fdc696c65d7..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslopcodes.c +++ /dev/null @@ -1,620 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslopcode - AML opcode generation - * $Revision: 52 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslopcodes") - - -/******************************************************************************* - * - * FUNCTION: OpcAmlOpcodeWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: Status - * - * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML - * operands. - * - ******************************************************************************/ - -ACPI_STATUS -OpcAmlOpcodeWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - TotalParseNodes++; - - OpcGenerateAmlOpcode (Op); - OpnGenerateAmlOperands (Op); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OpcGetIntegerWidth - * - * PARAMETERS: Op - DEFINITION BLOCK op - * - * RETURN: none - * - * DESCRIPTION: Extract integer width from the table revision - * - ******************************************************************************/ - -void -OpcGetIntegerWidth ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child; - - if (!Op) - { - return; - } - - Child = Op->Asl.Child; - Child = Child->Asl.Next; - Child = Child->Asl.Next; - - /* Use the revision to set the integer width */ - - AcpiUtSetIntegerWidth (Child->Asl.Value.Integer8); -} - - -/******************************************************************************* - * - * FUNCTION: OpcSetOptimalIntegerSize - * - * PARAMETERS: Op - A parse tree node - * - * RETURN: Integer width, in bytes. Also sets the node AML opcode to the - * optimal integer AML prefix opcode. - * - * DESCRIPTION: Determine the optimal AML encoding of an integer. All leading - * zeros can be truncated to squeeze the integer into the - * minimal number of AML bytes. - * - ******************************************************************************/ - -UINT32 -OpcSetOptimalIntegerSize ( - ACPI_PARSE_OBJECT *Op) -{ - - /* - * Check for the special AML integers first - Zero, One, Ones. - * These are single-byte opcodes that are the smallest possible - * representation of an integer. - * - * This optimization is optional. - */ - if (Gbl_IntegerOptimizationFlag) - { - switch (Op->Asl.Value.Integer) - { - case 0: - - Op->Asl.AmlOpcode = AML_ZERO_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Zero"); - return 1; - - case 1: - - Op->Asl.AmlOpcode = AML_ONE_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "One"); - return 1; - - case ACPI_UINT32_MAX: - - /* Check for table integer width (32 or 64) */ - - if (AcpiGbl_IntegerByteWidth == 4) - { - Op->Asl.AmlOpcode = AML_ONES_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Ones"); - return 1; - } - break; - - case ACPI_INTEGER_MAX: - - /* Check for table integer width (32 or 64) */ - - if (AcpiGbl_IntegerByteWidth == 8) - { - Op->Asl.AmlOpcode = AML_ONES_OP; - AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Ones"); - return 1; - } - break; - - default: - break; - } - } - - /* Find the best fit using the various AML integer prefixes */ - - if (Op->Asl.Value.Integer <= ACPI_UINT8_MAX) - { - Op->Asl.AmlOpcode = AML_BYTE_OP; - return 1; - } - if (Op->Asl.Value.Integer <= ACPI_UINT16_MAX) - { - Op->Asl.AmlOpcode = AML_WORD_OP; - return 2; - } - if (Op->Asl.Value.Integer <= ACPI_UINT32_MAX) - { - Op->Asl.AmlOpcode = AML_DWORD_OP; - return 4; - } - else - { - Op->Asl.AmlOpcode = AML_QWORD_OP; - return 8; - } -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoAccessAs - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Implement the ACCESS_AS ASL keyword. - * - ******************************************************************************/ - -void -OpcDoAccessAs ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - Op->Asl.AmlOpcodeLength = 1; - Next = Op->Asl.Child; - - /* First child is the access type */ - - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - /* Second child is the optional access attribute */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - Next->Asl.Value.Integer = 0; - } - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoUnicode - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Implement the UNICODE ASL "macro". Convert the input string - * to a unicode buffer. There is no Unicode AML opcode. - * - * Note: The Unicode string is 16 bits per character, no leading signature, - * with a 16-bit terminating NULL. - * - ******************************************************************************/ - -void -OpcDoUnicode ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *InitializerOp; - UINT32 Length; - UINT32 Count; - UINT32 i; - UINT8 *AsciiString; - UINT16 *UnicodeString; - ACPI_PARSE_OBJECT *BufferLengthOp; - - - /* Change op into a buffer object */ - - Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - UtSetParseOpName (Op); - - /* Buffer Length is first, followed by the string */ - - BufferLengthOp = Op->Asl.Child; - InitializerOp = BufferLengthOp->Asl.Next; - - AsciiString = (UINT8 *) InitializerOp->Asl.Value.String; - - /* Create a new buffer for the Unicode string */ - - Count = strlen (InitializerOp->Asl.Value.String) + 1; - Length = Count * sizeof (UINT16); - UnicodeString = UtLocalCalloc (Length); - - /* Convert to Unicode string (including null terminator) */ - - for (i = 0; i < Count; i++) - { - UnicodeString[i] = (UINT16) AsciiString[i]; - } - - /* - * Just set the buffer size node to be the buffer length, regardless - * of whether it was previously an integer or a default_arg placeholder - */ - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; - BufferLengthOp->Asl.Value.Integer = Length; - UtSetParseOpName (BufferLengthOp); - - (void) OpcSetOptimalIntegerSize (BufferLengthOp); - - /* The Unicode string is a raw data buffer */ - - InitializerOp->Asl.Value.Buffer = (UINT8 *) UnicodeString; - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - InitializerOp->Asl.AmlLength = Length; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - InitializerOp->Asl.Child = NULL; - UtSetParseOpName (InitializerOp); -} - - -/******************************************************************************* - * - * FUNCTION: OpcDoEisaId - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * - * DESCRIPTION: Convert a string EISA ID to numeric representation. See the - * Pnp BIOS Specification for details. Here is an excerpt: - * - * A seven character ASCII representation of the product - * identifier compressed into a 32-bit identifier. The seven - * character ID consists of a three character manufacturer code, - * a three character hexadecimal product identifier, and a one - * character hexadecimal revision number. The manufacturer code - * is a 3 uppercase character code that is compressed into 3 5-bit - * values as follows: - * 1) Find hex ASCII value for each letter - * 2) Subtract 40h from each ASCII value - * 3) Retain 5 least signficant bits for each letter by - * discarding upper 3 bits because they are always 0. - * 4) Compressed code = concatenate 0 and the 3 5-bit values - * - * The format of the compressed product identifier is as follows: - * Byte 0: Bit 7 - Reserved (0) - * Bits 6-2: - 1st character of compressed mfg code - * Bits 1-0 - Upper 2 bits of 2nd character of mfg code - * Byte 1: Bits 7-5 - Lower 3 bits of 2nd character of mfg code - * Bits 4-0 - 3rd character of mfg code - * Byte 2: Bits 7-4 - 1st hex digit of product number - * Bits 3-0 - 2nd hex digit of product number - * Byte 3: Bits 7-4 - 3st hex digit of product number - * Bits 3-0 - Hex digit of the revision number - * - ******************************************************************************/ - -void -OpcDoEisaId ( - ACPI_PARSE_OBJECT *Op) -{ - UINT32 EisaId = 0; - UINT32 BigEndianId; - char *InString; - ACPI_STATUS Status = AE_OK; - ACPI_NATIVE_UINT i; - - - InString = (char *) Op->Asl.Value.String; - - /* - * The EISAID string must be exactly 7 characters and of the form - * "LLLXXXX" -- 3 letters and 4 hex digits (e.g., "PNP0001") - */ - if (ACPI_STRLEN (InString) != 7) - { - Status = AE_BAD_PARAMETER; - } - else - { - /* Check all 7 characters for correct format */ - - for (i = 0; i < 7; i++) - { - /* First 3 characters must be letters */ - - if (i < 3) - { - if (!isalpha (InString[i])) - { - Status = AE_BAD_PARAMETER; - } - } - - /* Last 4 characters must be hex digits */ - - else if (!isxdigit (InString[i])) - { - Status = AE_BAD_PARAMETER; - } - } - } - - if (ACPI_FAILURE (Status)) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_EISAID, Op, Op->Asl.Value.String); - } - else - { - /* Create ID big-endian first (bits are contiguous) */ - - BigEndianId = (UINT32) (InString[0] - 0x40) << 26 | - (UINT32) (InString[1] - 0x40) << 21 | - (UINT32) (InString[2] - 0x40) << 16 | - - (UtHexCharToValue (InString[3])) << 12 | - (UtHexCharToValue (InString[4])) << 8 | - (UtHexCharToValue (InString[5])) << 4 | - UtHexCharToValue (InString[6]); - - /* Swap to little-endian to get final ID (see function header) */ - - EisaId = AcpiUtDwordByteSwap (BigEndianId); - } - - /* - * Morph the Op into an integer, regardless of whether there - * was an error in the EISAID string - */ - Op->Asl.Value.Integer32 = EisaId; - - Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; - Op->Asl.ParseOpcode = PARSEOP_INTEGER; - (void) OpcSetOptimalIntegerSize (Op); - - /* Op is now an integer */ - - UtSetParseOpName (Op); -} - - -/******************************************************************************* - * - * FUNCTION: OpcGenerateAmlOpcode - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Generate the AML opcode associated with the node and its - * parse (lex/flex) keyword opcode. Essentially implements - * a mapping between the parse opcodes and the actual AML opcodes. - * - ******************************************************************************/ - -void -OpcGenerateAmlOpcode ( - ACPI_PARSE_OBJECT *Op) -{ - - UINT16 Index; - - - Index = (UINT16) (Op->Asl.ParseOpcode - ASL_PARSE_OPCODE_BASE); - - Op->Asl.AmlOpcode = AslKeywordMapping[Index].AmlOpcode; - Op->Asl.AcpiBtype = AslKeywordMapping[Index].AcpiBtype; - Op->Asl.CompileFlags |= AslKeywordMapping[Index].Flags; - - if (!Op->Asl.Value.Integer) - { - Op->Asl.Value.Integer = AslKeywordMapping[Index].Value; - } - - /* Special handling for some opcodes */ - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_INTEGER: - /* - * Set the opcode based on the size of the integer - */ - (void) OpcSetOptimalIntegerSize (Op); - break; - - case PARSEOP_OFFSET: - - Op->Asl.AmlOpcodeLength = 1; - break; - - case PARSEOP_ACCESSAS: - - OpcDoAccessAs (Op); - break; - - case PARSEOP_EISAID: - - OpcDoEisaId (Op); - break; - - case PARSEOP_UNICODE: - - OpcDoUnicode (Op); - break; - - case PARSEOP_INCLUDE: - - Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - Gbl_HasIncludeFiles = TRUE; - break; - - case PARSEOP_EXTERNAL: - - Op->Asl.Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - break; - - case PARSEOP_PACKAGE: - /* - * The variable-length package has a different opcode - */ - if ((Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) && - (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_BYTECONST)) - { - Op->Asl.AmlOpcode = AML_VAR_PACKAGE_OP; - } - break; - - default: - /* Nothing to do for other opcodes */ - break; - } - - return; -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/asloperands.c b/sys/dev/acpi/acpica/Subsystem/asloperands.c deleted file mode 100644 index 9255c317412..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asloperands.c +++ /dev/null @@ -1,1112 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asloperands - AML operand processing - * $Revision: 44 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asloperands") - - -/******************************************************************************* - * - * FUNCTION: OpnDoMethod - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the operands for the METHOD ASL keyword. - * - ******************************************************************************/ - -void -OpnDoMethod ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - /* Optional arguments for this opcode with defaults */ - - UINT8 NumArgs = 0; - UINT8 Serialized = 0; - UINT8 Concurrency = 0; - UINT8 MethodFlags; - - - /* Opcode and package length first */ - /* Method name */ - - Next = Op->Asl.Child; - - /* Num args */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - NumArgs = Next->Asl.Value.Integer8; - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - - /* Serialized Flag */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - Serialized = Next->Asl.Value.Integer8; - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - - /* Concurrency value (0-15 valid) */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - Concurrency = Next->Asl.Value.Integer8; - } - - /* Put the bits in their proper places */ - - MethodFlags = (UINT8) ((NumArgs & 0x7) | - ((Serialized & 0x1) << 3) | - ((Concurrency & 0xF) << 4)); - - /* Use the last node for the combined flags byte */ - - Next->Asl.Value.Integer = MethodFlags; - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - /* Save the arg count in the first node */ - - Op->Asl.Extra = NumArgs; -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoFieldCommon - * - * PARAMETERS: FieldOp - Node for an ASL field - * Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the various field keywords, - * FIELD, BANKFIELD, INDEXFIELD - * - ******************************************************************************/ - -void -OpnDoFieldCommon ( - ACPI_PARSE_OBJECT *FieldOp, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - ACPI_PARSE_OBJECT *PkgLengthNode; - UINT32 CurrentBitOffset; - UINT32 NewBitOffset; - UINT8 AccessType; - UINT8 LockRule; - UINT8 UpdateRule; - UINT8 FieldFlags; - UINT32 MinimumLength; - - - /* AccessType -- not optional, so no need to check for DEFAULT_ARG */ - - AccessType = Op->Asl.Value.Integer8; - Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* Set the access type in the parent (field) node for use later */ - - FieldOp->Asl.Value.Integer8 = AccessType; - - /* LockRule -- not optional, so no need to check for DEFAULT_ARG */ - - Next = Op->Asl.Next; - LockRule = Next->Asl.Value.Integer8; - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* UpdateRule -- not optional, so no need to check for DEFAULT_ARG */ - - Next = Next->Asl.Next; - UpdateRule = Next->Asl.Value.Integer8; - - /* - * Generate the flags byte. The various fields are already - * in the right bit position via translation from the - * keywords by the parser. - */ - FieldFlags = (UINT8) (AccessType | LockRule | UpdateRule); - - /* Use the previous node to be the FieldFlags node */ - - /* Set the node to RAW_DATA */ - - Next->Asl.Value.Integer = FieldFlags; - Next->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - /* Process the FieldUnitList */ - - Next = Next->Asl.Next; - CurrentBitOffset = 0; - - while (Next) - { - /* Save the offset of this field unit */ - - Next->Asl.ExtraValue = CurrentBitOffset; - - switch (Next->Asl.ParseOpcode) - { - case PARSEOP_ACCESSAS: - - PkgLengthNode = Next->Asl.Child; - AccessType = PkgLengthNode->Asl.Value.Integer8; - - /* Nothing additional to do */ - break; - - - case PARSEOP_OFFSET: - - /* New offset into the field */ - - PkgLengthNode = Next->Asl.Child; - NewBitOffset = PkgLengthNode->Asl.Value.Integer32 * 8; - - /* - * Examine the specified offset in relation to the - * current offset counter. - */ - if (NewBitOffset < CurrentBitOffset) - { - /* - * Not allowed to specify a backwards offset! - * Issue error and ignore this node. - */ - AslError (ASL_ERROR, ASL_MSG_BACKWARDS_OFFSET, PkgLengthNode, NULL); - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - else if (NewBitOffset == CurrentBitOffset) - { - /* - * Offset is redundant; we don't need to output an - * offset opcode. Just set these nodes to default - */ - Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - } - else - { - /* - * Valid new offset - set the value to be inserted into the AML - * and update the offset counter. - */ - PkgLengthNode->Asl.Value.Integer = NewBitOffset - CurrentBitOffset; - CurrentBitOffset = NewBitOffset; - } - break; - - - case PARSEOP_NAMESEG: - case PARSEOP_RESERVED_BYTES: - - /* Named or reserved field entry */ - - PkgLengthNode = Next->Asl.Child; - NewBitOffset = PkgLengthNode->Asl.Value.Integer32; - CurrentBitOffset += NewBitOffset; - - /* Save the current AccessAs value for error checking later */ - - switch (AccessType) - { - case AML_FIELD_ACCESS_ANY: - case AML_FIELD_ACCESS_BYTE: - case AML_FIELD_ACCESS_BUFFER: - default: - MinimumLength = 8; - break; - - case AML_FIELD_ACCESS_WORD: - MinimumLength = 16; - break; - - case AML_FIELD_ACCESS_DWORD: - MinimumLength = 32; - break; - - case AML_FIELD_ACCESS_QWORD: - MinimumLength = 64; - break; - } - - PkgLengthNode->Asl.ExtraValue = MinimumLength; - break; - - default: - /* All supported field opcodes must appear above */ - break; - } - - /* Move on to next entry in the field list */ - - Next = Next->Asl.Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoField - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the FIELD ASL keyword - * - ******************************************************************************/ - -void -OpnDoField ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is field name */ - - Next = Op->Asl.Child; - - /* Second child is the AccessType */ - - OpnDoFieldCommon (Op, Next->Asl.Next); -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoIndexField - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the INDEXFIELD ASL keyword - * - ******************************************************************************/ - -void -OpnDoIndexField ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the index name */ - - Next = Op->Asl.Child; - - /* Second child is the data name */ - - Next = Next->Asl.Next; - - /* Third child is the AccessType */ - - OpnDoFieldCommon (Op, Next->Asl.Next); -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoBankField - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the BANKFIELD ASL keyword - * - ******************************************************************************/ - -void -OpnDoBankField ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the region name */ - - Next = Op->Asl.Child; - - /* Second child is the bank name */ - - Next = Next->Asl.Next; - - /* Third child is the bank value */ - - Next = Next->Asl.Next; - - /* Fourth child is the AccessType */ - - OpnDoFieldCommon (Op, Next->Asl.Next); -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoRegion - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Tries to get the length of the region. Can only do this at - * compile time if the length is a constant. - * - ******************************************************************************/ - -void -OpnDoRegion ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the region name */ - - Next = Op->Asl.Child; - - /* Second child is the space ID*/ - - Next = Next->Asl.Next; - - /* Third child is the region offset */ - - Next = Next->Asl.Next; - - /* Fourth child is the region length */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_INTEGER) - { - Op->Asl.Value.Integer = Next->Asl.Value.Integer; - } - else - { - Op->Asl.Value.Integer = ACPI_INTEGER_MAX; - } -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoBuffer - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the BUFFER ASL keyword. We - * build a single raw byte buffer from the initialization nodes, - * each parse node contains a buffer byte. - * - ******************************************************************************/ - -void -OpnDoBuffer ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *BufferLengthOp; - - /* Optional arguments for this opcode with defaults */ - - UINT32 BufferLength = 0; - - - /* Opcode and package length first */ - /* Buffer Length is next, followed by the initializer list */ - - BufferLengthOp = Op->Asl.Child; - InitializerOp = BufferLengthOp->Asl.Next; - - /* - * If the BufferLength is not an INTEGER or was not specified in the ASL - * (DEFAULT_ARG), it is a TermArg that is - * evaluated at run-time, and we are therefore finished. - */ - if ((BufferLengthOp->Asl.ParseOpcode != PARSEOP_INTEGER) && - (BufferLengthOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)) - { - return; - } - - /* - * We want to count the number of items in the initializer list, because if - * it is larger than the buffer length, we will define the buffer size - * to be the size of the initializer list (as per the ACPI Specification) - */ - switch (InitializerOp->Asl.ParseOpcode) - { - case PARSEOP_INTEGER: - case PARSEOP_BYTECONST: - case PARSEOP_WORDCONST: - case PARSEOP_DWORDCONST: - - /* The peer list contains the byte list (if any...) */ - - while (InitializerOp) - { - /* For buffers, this is a list of raw bytes */ - - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - InitializerOp->Asl.AmlLength = 1; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - - BufferLength++; - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - } - break; - - - case PARSEOP_STRING_LITERAL: - - /* - * Only one initializer, the string. Buffer must be big enough to hold - * the string plus the null termination byte - */ - BufferLength = strlen (InitializerOp->Asl.Value.String) + 1; - - InitializerOp->Asl.AmlOpcode = AML_RAW_DATA_BUFFER; - InitializerOp->Asl.AmlLength = BufferLength; - InitializerOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - break; - - - case PARSEOP_RAW_DATA: - - /* Buffer nodes are already initialized (e.g. Unicode operator) */ - return; - - - case PARSEOP_DEFAULT_ARG: - break; - - - default: - AslError (ASL_ERROR, ASL_MSG_INVALID_OPERAND, InitializerOp, - "Unknown buffer initializer opcode"); - printf ("Unknown buffer initializer opcode [%s]\n", - UtGetOpName (InitializerOp->Asl.ParseOpcode)); - return; - } - - /* Check if initializer list is longer than the buffer length */ - - if (BufferLengthOp->Asl.Value.Integer > BufferLength) - { - BufferLength = BufferLengthOp->Asl.Value.Integer32; - } - - if (!BufferLength) - { - /* No length AND no items -- issue a warning */ - - AslError (ASL_WARNING, ASL_MSG_BUFFER_LENGTH, BufferLengthOp, NULL); - - /* But go ahead and put the buffer length of zero into the AML */ - } - - /* - * Just set the buffer size node to be the buffer length, regardless - * of whether it was previously an integer or a default_arg placeholder - */ - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.AmlOpcode = AML_DWORD_OP; - BufferLengthOp->Asl.Value.Integer = BufferLength; - - (void) OpcSetOptimalIntegerSize (BufferLengthOp); - - /* Remaining nodes are handled via the tree walk */ -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoPackage - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword. - * - ******************************************************************************/ - -void -OpnDoPackage ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *InitializerOp; - ACPI_PARSE_OBJECT *PackageLengthOp; - - /* Optional arguments for this opcode with defaults */ - - UINT32 PackageLength = 0; - - - /* Opcode and package length first */ - /* Buffer Length is next, followed by the initializer list */ - - PackageLengthOp = Op->Asl.Child; - InitializerOp = PackageLengthOp->Asl.Next; - - /* - * We always count the number of items in the initializer list, because if - * it is larger than the buffer length, we will define the buffer size - * to be the size of the initializer list (Per ACPI Spec) - */ - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - /* The peer list contains the byte list (if any...) */ - - while (InitializerOp) - { - PackageLength++; - InitializerOp = InitializerOp->Asl.Next; - } - } - - /* Check if initializer list is longer than the buffer length */ - - if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) || - (PackageLengthOp->Asl.ParseOpcode == PARSEOP_BYTECONST)) - { - if (PackageLengthOp->Asl.Value.Integer > PackageLength) - { - PackageLength = PackageLengthOp->Asl.Value.Integer32; - } - } - - /* - * If not a variable-length package, check for a zero - * package length - */ - if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) || - (PackageLengthOp->Asl.ParseOpcode == PARSEOP_BYTECONST) || - (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)) - { - if (!PackageLength) - { - /* No length AND no items -- issue a warning */ - - AslError (ASL_WARNING, ASL_MSG_PACKAGE_LENGTH, PackageLengthOp, NULL); - - /* But go ahead and put the buffer length of zero into the AML */ - } - } - - /* - * Just set the buffer size node to be the buffer length, regardless - * of whether it was previously an integer or a default_arg placeholder - */ - PackageLengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE; - PackageLengthOp->Asl.AmlLength = 1; - PackageLengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - PackageLengthOp->Asl.Value.Integer = PackageLength; - - /* Remaining nodes are handled via the tree walk */ -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoLoadTable - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the LOADTABLE ASL keyword. - * - ******************************************************************************/ - -void -OpnDoLoadTable ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - - - /* Opcode is parent node */ - /* First child is the table signature */ - - Next = Op->Asl.Child; - - /* Second child is the OEM ID*/ - - Next = Next->Asl.Next; - - /* Third child is the OEM table ID */ - - Next = Next->Asl.Next; - - /* Fourth child is the RootPath string */ - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_ZERO) - { - Next->Asl.ParseOpcode = PARSEOP_STRING_LITERAL; - Next->Asl.Value.String = "\\"; - Next->Asl.AmlLength = 2; - OpcGenerateAmlOpcode (Next); - } - - /* Fifth child is the [optional] ParameterPathString */ - /* Sixth child is the [optional] ParameterData */ - -/* - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == DEFAULT_ARG) - { - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = ZERO; - OpcGenerateAmlOpcode (Next); - } - - - Next = Next->Asl.Next; - if (Next->Asl.ParseOpcode == DEFAULT_ARG) - { - Next->Asl.AmlLength = 1; - Next->Asl.ParseOpcode = ZERO; - OpcGenerateAmlOpcode (Next); - } - */ -} - - -/******************************************************************************* - * - * FUNCTION: OpnDoDefinitionBlock - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Construct the AML operands for the DEFINITIONBLOCK ASL keyword - * - ******************************************************************************/ - -void -OpnDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child; - ACPI_SIZE Length; - ACPI_NATIVE_UINT i; - - - /* - * These nodes get stuffed into the table header. They are special - * cased when the table is written to the output file. - * - * Mark all of these nodes as non-usable so they won't get output - * as AML opcodes! - */ - - /* AML filename */ - - Child = Op->Asl.Child; - if ((Child->Asl.Value.Buffer) && (Gbl_UseDefaultAmlFilename)) - { - Gbl_OutputFilenamePrefix = (char *) Child->Asl.Value.Buffer; - } - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* Signature */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - if (Child->Asl.Value.String) - { - Gbl_TableSignature = Child->Asl.Value.String; - if (ACPI_STRLEN (Gbl_TableSignature) != 4) - { - AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Length not exactly 4"); - } - - for (i = 0; i < 4; i++) - { - if (!isalnum (Gbl_TableSignature[i])) - { - AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Contains non-alphanumeric characters"); - } - } - } - - /* Revision */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* Use the revision to set the integer width */ - - AcpiUtSetIntegerWidth (Child->Asl.Value.Integer8); - - /* OEMID */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* OEM TableID */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - if (Child->Asl.Value.String) - { - Length = ACPI_STRLEN (Child->Asl.Value.String); - Gbl_TableId = AcpiOsAllocate (Length + 1); - ACPI_STRCPY (Gbl_TableId, Child->Asl.Value.String); - - for (i = 0; i < Length; i++) - { - if (Gbl_TableId[i] == ' ') - { - Gbl_TableId[i] = 0; - break; - } - } - } - - /* OEM Revision */ - - Child = Child->Asl.Next; - Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; -} - - -/******************************************************************************* - * - * FUNCTION: UtGetArg - * - * PARAMETERS: Op - Get an argument for this op - * Argn - Nth argument to get - * - * RETURN: The argument (as an Op object). NULL if argument does not exist - * - * DESCRIPTION: Get the specified op's argument (peer) - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -UtGetArg ( - ACPI_PARSE_OBJECT *Op, - UINT32 Argn) -{ - ACPI_PARSE_OBJECT *Arg = NULL; - - - /* Get the requested argument object */ - - Arg = Op->Asl.Child; - while (Arg && Argn) - { - Argn--; - Arg = Arg->Asl.Next; - } - - return (Arg); -} - - -/******************************************************************************* - * - * FUNCTION: OpnAttachNameToNode - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: For the named ASL/AML operators, get the actual name from the - * argument list and attach it to the parent node so that we - * can get to it quickly later. - * - ******************************************************************************/ - -void -OpnAttachNameToNode ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Child = NULL; - - - if (Op->Asl.ParseOpcode == PARSEOP_EXTERNAL) - { - Child = UtGetArg (Op, 0); - } - else switch (Op->Asl.AmlOpcode) - { - case AML_DATA_REGION_OP: - case AML_DEVICE_OP: - case AML_EVENT_OP: - case AML_METHOD_OP: - case AML_MUTEX_OP: - case AML_REGION_OP: - case AML_POWER_RES_OP: - case AML_PROCESSOR_OP: - case AML_THERMAL_ZONE_OP: - case AML_NAME_OP: - case AML_SCOPE_OP: - - Child = UtGetArg (Op, 0); - break; - - case AML_ALIAS_OP: - - Child = UtGetArg (Op, 1); - break; - - case AML_CREATE_BIT_FIELD_OP: - case AML_CREATE_BYTE_FIELD_OP: - case AML_CREATE_WORD_FIELD_OP: - case AML_CREATE_DWORD_FIELD_OP: - case AML_CREATE_QWORD_FIELD_OP: - - Child = UtGetArg (Op, 2); - break; - - case AML_CREATE_FIELD_OP: - - Child = UtGetArg (Op, 3); - break; - - case AML_BANK_FIELD_OP: - case AML_INDEX_FIELD_OP: - case AML_FIELD_OP: - - return; - - default: - return; - } - - if (Child) - { - UtAttachNamepathToOwner (Op, Child); - } -} - - -/******************************************************************************* - * - * FUNCTION: OpnGenerateAmlOperands - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more - * complex AML opcodes require processing of the child nodes - * (arguments/operands). - * - ******************************************************************************/ - -void -OpnGenerateAmlOperands ( - ACPI_PARSE_OBJECT *Op) -{ - - - if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE) - { - return; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - OpnDoDefinitionBlock (Op); - break; - - case PARSEOP_METHOD: - OpnDoMethod (Op); - break; - - case PARSEOP_FIELD: - OpnDoField (Op); - break; - - case PARSEOP_INDEXFIELD: - OpnDoIndexField (Op); - break; - - case PARSEOP_BANKFIELD: - OpnDoBankField (Op); - break; - - case PARSEOP_BUFFER: - OpnDoBuffer (Op); - break; - - case PARSEOP_LOADTABLE: - OpnDoLoadTable (Op); - break; - - case PARSEOP_PACKAGE: - OpnDoPackage (Op); - break; - - case PARSEOP_OPERATIONREGION: - OpnDoRegion (Op); - break; - - case PARSEOP_RESOURCETEMPLATE: - RsDoResourceTemplate (Op); - break; - - case PARSEOP_NAMESEG: - case PARSEOP_NAMESTRING: - case PARSEOP_METHODCALL: - case PARSEOP_STRING_LITERAL: - break; - - default: - break; - } - - /* TBD: move */ - - OpnAttachNameToNode (Op); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslopt.c b/sys/dev/acpi/acpica/Subsystem/aslopt.c deleted file mode 100644 index 73435c5f697..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslopt.c +++ /dev/null @@ -1,800 +0,0 @@ -/****************************************************************************** - * - * Module Name: aslopt- Compiler optimizations - * $Revision: 12 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#include "acparser.h" -#include "amlcode.h" -#include "acnamesp.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslopt") - - -UINT32 OptTotal = 0; - - -/******************************************************************************* - * - * FUNCTION: OptSearchToRoot - * - * PARAMETERS: Op - Current parser op - * WalkState - Current state - * CurrentNode - Where we are in the namespace - * TargetNode - Node to which we are referring - * TargetPath - External full path to the target node - * NewPath - Where the optimized path is returned - * - * RETURN: Status - * - * DESCRIPTION: Attempt to optimize a reference to a single 4-character ACPI - * name utilizing the search-to-root name resolution algorithm - * that is used by AML interpreters. - * - ******************************************************************************/ - -ACPI_STATUS -OptSearchToRoot ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - ACPI_BUFFER *TargetPath, - char **NewPath) -{ - ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_STATUS Status; - char *Path; - - - ACPI_FUNCTION_NAME ("OptSearchToRoot"); - - - /* - * Check if search-to-root can be utilized. Use the last NameSeg of - * the NamePath and 1) See if can be found and 2) If found, make - * sure that it is the same node that we want. If there is another - * name in the search path before the one we want, the nodes will - * not match, and we cannot use this optimization. - */ - Path = &(((char *) TargetPath->Pointer)[TargetPath->Length - ACPI_NAME_SIZE]), - ScopeInfo.Scope.Node = CurrentNode; - - /* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */ - - Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &(Node)); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - /* - * We found the name, but we must check to make sure that the node - * matches. Otherwise, there is another identical name in the search - * path that precludes the use of this optimization. - */ - if (Node != TargetNode) - { - /* - * This means that another object with the same name was found first, - * and we cannot use this optimization. - */ - return (AE_NOT_FOUND); - } - - /* Found the node, we can use this optimization */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "NAMESEG: %-24s", Path)); - - /* We must allocate a new string for the name (TargetPath gets deleted) */ - - *NewPath = ACPI_MEM_CALLOCATE (ACPI_NAME_SIZE + 1); - ACPI_STRCPY (*NewPath, Path); - - AslError (ASL_OPTIMIZATION, ASL_MSG_SINGLE_NAME_OPTIMIZATION, Op, - *NewPath); - - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: OptBuildShortestPath - * - * PARAMETERS: Op - Current parser op - * WalkState - Current state - * CurrentNode - Where we are in the namespace - * TargetNode - Node to which we are referring - * CurrentPath - External full path to the current node - * TargetPath - External full path to the target node - * AmlNameStringLength - Length of the original namepath - * IsDeclaration - TRUE for declaration, FALSE for reference - * ReturnNewPath - Where the optimized path is returned - * - * RETURN: Status - * - * DESCRIPTION: Build an optimal NamePath using carats - * - ******************************************************************************/ - -ACPI_STATUS -OptBuildShortestPath ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - ACPI_BUFFER *CurrentPath, - ACPI_BUFFER *TargetPath, - ACPI_SIZE AmlNameStringLength, - UINT8 IsDeclaration, - char **ReturnNewPath) -{ - UINT32 NumCommonSegments; - UINT32 MaxCommonSegments; - ACPI_NATIVE_UINT Index; - UINT32 NumCarats; - ACPI_NATIVE_UINT i; - char *NewPath; - char *NewPathExternal; - ACPI_NAMESPACE_NODE *Node; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_STATUS Status; - BOOLEAN SubPath = FALSE; - - - ACPI_FUNCTION_NAME ("OptBuildShortestPath"); - - - ScopeInfo.Scope.Node = CurrentNode; - - /* - * Determine the maximum number of NameSegs that the Target and Current paths - * can possibly have in common. (To optimize, we have to have at least 1) - * - * Note: The external NamePath string lengths are always a multiple of 5 - * (ACPI_NAME_SIZE + separator) - */ - MaxCommonSegments = TargetPath->Length / ACPI_PATH_SEGMENT_LENGTH; - if (CurrentPath->Length < TargetPath->Length) - { - MaxCommonSegments = CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH; - } - - /* - * Determine how many NameSegs the two paths have in common. - * (Starting from the root) - */ - for (NumCommonSegments = 0; - NumCommonSegments < MaxCommonSegments; - NumCommonSegments++) - { - /* Compare two single NameSegs */ - - if (ACPI_STRNCMP ( - &((char *) TargetPath->Pointer)[(NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1], - &((char *) CurrentPath->Pointer)[(NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1], - ACPI_NAME_SIZE)) - { - /* Mismatch */ - - break; - } - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %d", NumCommonSegments)); - - /* There must be at least 1 common NameSeg in order to optimize */ - - if (NumCommonSegments == 0) - { - return (AE_NOT_FOUND); - } - - if (NumCommonSegments == MaxCommonSegments) - { - if (CurrentPath->Length == TargetPath->Length) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SAME PATH")); - return (AE_NOT_FOUND); - } - else - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " SUBPATH")); - SubPath = TRUE; - } - } - - /* Determine how many prefix Carats are required */ - - NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) - NumCommonSegments; - - /* - * Construct a new target string - */ - NewPathExternal = ACPI_MEM_CALLOCATE (TargetPath->Length + NumCarats); - - /* Insert the Carats into the Target string */ - - for (i = 0; i < NumCarats; i++) - { - NewPathExternal[i] = '^'; - } - - /* Copy only the necessary (optimal) segments from the original target string */ - - Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1; - - /* Special handling for exact subpath in a name declaration */ - - if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length)) - { - /* - * The current path is longer than the target, and the target is a subpath - * of the current path. We must include one more NameSeg of the target path - */ - Index -= ACPI_PATH_SEGMENT_LENGTH; - } - - ACPI_STRCPY (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]); - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal)); - - /* - * Internalize the new target string and check it against the original string - * to make sure that this is in fact an optimization. If the original string - * is already optimal, there is no point in continuing. - */ - Status = AcpiNsInternalizeName (NewPathExternal, &NewPath); - - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Internalizing new NamePath", ASL_NO_ABORT); - ACPI_MEM_FREE (NewPathExternal); - return (Status); - } - - if (ACPI_STRLEN (NewPath) >= AmlNameStringLength) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " NOT SHORTER (New %d old %d)", - ACPI_STRLEN (NewPath), AmlNameStringLength)); - ACPI_MEM_FREE (NewPathExternal); - return (AE_NOT_FOUND); - } - - /* - * Check to make sure that the optimization finds the node we are - * looking for. This is simply a sanity check on the new - * path that has been created. - */ - Status = AcpiNsLookup (&ScopeInfo, NewPath, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); - if (ACPI_SUCCESS (Status)) - { - /* Found the namepath, but make sure the node is correct */ - - if (Node == TargetNode) - { - /* The lookup matched the node, accept this optimization */ - - AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, - Op, NewPathExternal); - *ReturnNewPath = NewPath; - } - else - { - /* Node is not correct, do not use this optimization */ - - Status = AE_NOT_FOUND; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - found wrong node"); - } - } - else - { - /* The lookup failed, we obviously cannot use this optimization */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - did not find node"); - } - - ACPI_MEM_FREE (NewPathExternal); - return (Status); -} - - -/******************************************************************************* - * - * FUNCTION: OptOptimizeNameDeclaration - * - * PARAMETERS: Op - Current parser op - * WalkState - Current state - * CurrentNode - Where we are in the namespace - * AmlNameString - Unoptimized namepath - * NewPath - Where the optimized path is returned - * - * RETURN: Status. AE_OK If path is optimized - * - * DESCRIPTION: Perform a simple optimization of removing an extraneous - * backslash prefix if we are already at the root scope. - * - ******************************************************************************/ - -ACPI_STATUS -OptOptimizeNameDeclaration ( - ACPI_PARSE_OBJECT *Op, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE *CurrentNode, - ACPI_NAMESPACE_NODE *TargetNode, - char *AmlNameString, - char **NewPath) -{ - ACPI_STATUS Status; - char *NewPathExternal; - ACPI_GENERIC_STATE ScopeInfo; - ACPI_NAMESPACE_NODE *Node; - - - ACPI_FUNCTION_TRACE ("OptOptimizeNameDeclaration"); - - - if (((CurrentNode == AcpiGbl_RootNode) || - (Op->Common.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK)) && - (AmlNameString[0] == '\\')) - { - /* - * The current scope is the root, and the namepath has a root prefix - * that is therefore extraneous. Remove it. - */ - *NewPath = &AmlNameString[1]; - - /* Debug output */ - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, *NewPath, - NULL, &NewPathExternal); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Externalizing NamePath", ASL_NO_ABORT); - return (Status); - } - - /* - * Check to make sure that the optimization finds the node we are - * looking for. This is simply a sanity check on the new - * path that has been created. - */ - ScopeInfo.Scope.Node = CurrentNode; - Status = AcpiNsLookup (&ScopeInfo, *NewPath, - ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, - ACPI_NS_DONT_OPEN_SCOPE, WalkState, &(Node)); - if (ACPI_SUCCESS (Status)) - { - /* Found the namepath, but make sure the node is correct */ - - if (Node == TargetNode) - { - /* The lookup matched the node, accept this optimization */ - - AslError (ASL_OPTIMIZATION, ASL_MSG_NAME_OPTIMIZATION, - Op, NewPathExternal); - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "AT ROOT: %-24s", NewPathExternal)); - } - else - { - /* Node is not correct, do not use this optimization */ - - Status = AE_NOT_FOUND; - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - found wrong node"); - } - } - else - { - /* The lookup failed, we obviously cannot use this optimization */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND")); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op, - "Not using optimized name - did not find node"); - } - - ACPI_MEM_FREE (NewPathExternal); - return (Status); - } - - /* Could not optimize */ - - return (AE_NOT_FOUND); -} - - -/******************************************************************************* - * - * FUNCTION: OptOptimizeNamePath - * - * PARAMETERS: Op - Current parser op - * Flags - Opcode info flags - * WalkState - Current state - * AmlNameString - Unoptimized namepath - * TargetNode - Node to which AmlNameString refers - * - * RETURN: None. If path is optimized, the Op is updated with new path - * - * DESCRIPTION: Optimize a Named Declaration or Reference to the minimal length. - * Must take into account both the current location in the - * namespace and the actual reference path. - * - ******************************************************************************/ - -void -OptOptimizeNamePath ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags, - ACPI_WALK_STATE *WalkState, - char *AmlNameString, - ACPI_NAMESPACE_NODE *TargetNode) -{ - ACPI_STATUS Status; - ACPI_BUFFER TargetPath; - ACPI_BUFFER CurrentPath; - ACPI_SIZE AmlNameStringLength; - ACPI_NAMESPACE_NODE *CurrentNode; - char *ExternalNameString; - char *NewPath = NULL; - ACPI_SIZE HowMuchShorter; - ACPI_PARSE_OBJECT *NextOp; - - - ACPI_FUNCTION_TRACE ("OptOptimizeNamePath"); - - - /* This is an optional optimization */ - - if (!Gbl_ReferenceOptimizationFlag) - { - return_VOID; - } - - /* Various required items */ - - if (!TargetNode || !WalkState || !Op->Common.Parent) - { - return_VOID; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "%5d [%12.12s] [%12.12s] ", - Op->Asl.LogicalLineNumber, - AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), - AcpiPsGetOpcodeName (Op->Common.AmlOpcode))); - - if (!(Flags & (AML_NAMED | AML_CREATE))) - { - if (Op->Asl.CompileFlags & NODE_IS_NAME_DECLARATION) - { - /* We don't want to fuss with actual name declaration nodes here */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "******* NAME DECLARATION\n")); - return_VOID; - } - } - - /* - * The original path must be longer than one NameSeg (4 chars) for there - * to be any possibility that it can be optimized to a shorter string - */ - AmlNameStringLength = ACPI_STRLEN (AmlNameString); - if (AmlNameStringLength <= ACPI_NAME_SIZE) - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "NAMESEG %4.4s\n", AmlNameString)); - return_VOID; - } - - /* - * We need to obtain the node that represents the current scope -- where - * we are right now in the namespace. We will compare this path - * against the Namepath, looking for commonality. - */ - CurrentNode = AcpiGbl_RootNode; - if (WalkState->ScopeInfo) - { - CurrentNode = WalkState->ScopeInfo->Scope.Node; - } - - if (Flags & (AML_NAMED | AML_CREATE)) - { - /* This is the declaration of a new name */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "NAME")); - - /* The node of interest is the parent of this node (the containing scope) */ - - CurrentNode = Op->Asl.Parent->Asl.Node; - if (!CurrentNode) - { - CurrentNode = AcpiGbl_RootNode; - } - } - else - { - /* This is a reference to an existing named object */ - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "REF ")); - } - - /* - * Obtain the full paths to the two nodes that we are interested in - * (Target and current namespace location) in external - * format -- something we can easily manipulate - */ - TargetPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (TargetNode, &TargetPath); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Getting Target NamePath", ASL_NO_ABORT); - return_VOID; - } - TargetPath.Length--; /* Subtract one for null terminator */ - - /* CurrentPath is the path to this scope (where we are in the namespace) */ - - CurrentPath.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Getting Current NamePath", ASL_NO_ABORT); - return_VOID; - } - CurrentPath.Length--; /* Subtract one for null terminator */ - - /* Debug output only */ - - Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, AmlNameString, - NULL, &ExternalNameString); - if (ACPI_FAILURE (Status)) - { - AslCoreSubsystemError (Op, Status, "Externalizing NamePath", ASL_NO_ABORT); - return_VOID; - } - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, - "%37s (%2d) ==> %-32s(%2d) %-32s", - (char *) CurrentPath.Pointer, CurrentPath.Length, - (char *) TargetPath.Pointer, TargetPath.Length, ExternalNameString)); - - ACPI_MEM_FREE (ExternalNameString); - - /* - * Attempt an optmization depending on the type of namepath - */ - if (Flags & (AML_NAMED | AML_CREATE)) - { - /* - * This is a named opcode and the namepath is a name declaration, not - * a reference. - */ - Status = OptOptimizeNameDeclaration (Op, WalkState, CurrentNode, - TargetNode, AmlNameString, &NewPath); - if (ACPI_FAILURE (Status)) - { - /* - * 2) now attempt to - * optimize the namestring with carats (up-arrow) - */ - Status = OptBuildShortestPath (Op, WalkState, CurrentNode, - TargetNode, &CurrentPath, &TargetPath, - AmlNameStringLength, 1, &NewPath); - } - } - else - { - /* - * This is a reference to an existing named object - * - * 1) Check if search-to-root can be utilized using the last - * NameSeg of the NamePath - */ - Status = OptSearchToRoot (Op, WalkState, CurrentNode, - TargetNode, &TargetPath, &NewPath); - if (ACPI_FAILURE (Status)) - { - /* - * 2) Search-to-root could not be used, now attempt to - * optimize the namestring with carats (up-arrow) - */ - Status = OptBuildShortestPath (Op, WalkState, CurrentNode, - TargetNode, &CurrentPath, &TargetPath, - AmlNameStringLength, 0, &NewPath); - } - } - - /* - * Success from above indicates that the NamePath was successfully - * optimized. We need to update the parse op with the new name - */ - if (ACPI_SUCCESS (Status)) - { - HowMuchShorter = (AmlNameStringLength - ACPI_STRLEN (NewPath)); - OptTotal += HowMuchShorter; - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2d (%d)", - HowMuchShorter, OptTotal)); - - if (Flags & AML_NAMED) - { - if (Op->Asl.AmlOpcode == AML_ALIAS_OP) - { - /* - * ALIAS is the only oddball opcode, the name declaration - * (alias name) is the second operand - */ - Op->Asl.Child->Asl.Next->Asl.Value.String = NewPath; - Op->Asl.Child->Asl.Next->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - else - { - Op->Asl.Child->Asl.Value.String = NewPath; - Op->Asl.Child->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - } - else if (Flags & AML_CREATE) - { - /* Name must appear as the last parameter */ - - NextOp = Op->Asl.Child; - while (!(NextOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION)) - { - NextOp = NextOp->Asl.Next; - } - /* Update the parse node with the new NamePath */ - - NextOp->Asl.Value.String = NewPath; - NextOp->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - else - { - /* Update the parse node with the new NamePath */ - - Op->Asl.Value.String = NewPath; - Op->Asl.AmlLength = ACPI_STRLEN (NewPath); - } - } - else - { - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ALREADY OPTIMAL")); - } - - /* Cleanup path buffers */ - - ACPI_MEM_FREE (TargetPath.Pointer); - ACPI_MEM_FREE (CurrentPath.Pointer); - - ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "\n")); - return_VOID; -} - diff --git a/sys/dev/acpi/acpica/Subsystem/aslresource.c b/sys/dev/acpi/acpica/Subsystem/aslresource.c deleted file mode 100644 index 56d90c4f471..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslresource.c +++ /dev/null @@ -1,632 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslresource - Resource templates and descriptors - * $Revision: 30 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "amlcode.h" - - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslresource") - - -/******************************************************************************* - * - * FUNCTION: RsAllocateResourceNode - * - * PARAMETERS: Size - Size of node in bytes - * - * RETURN: The allocated node - aborts on allocation failure - * - * DESCRIPTION: Allocate a resource description node and the resource - * descriptor itself (the nodes are used to link descriptors). - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsAllocateResourceNode ( - UINT32 Size) -{ - ASL_RESOURCE_NODE *Rnode; - - - /* Allocate the node */ - - Rnode = UtLocalCalloc (sizeof (ASL_RESOURCE_NODE)); - - /* Allocate the resource descriptor itself */ - - Rnode->Buffer = UtLocalCalloc (Size); - Rnode->BufferLength = Size; - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsCreateBitField - * - * PARAMETERS: Op - Resource field node - * Name - Name of the field (Used only to reference - * the field in the ASL, not in the AML) - * ByteOffset - Offset from the field start - * BitOffset - Additional bit offset - * - * RETURN: None, sets fields within the input node - * - * DESCRIPTION: Utility function to generate a named bit field within a - * resource descriptor. Mark a node as 1) a field in a resource - * descriptor, and 2) set the value to be a BIT offset - * - ******************************************************************************/ - -void -RsCreateBitField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset, - UINT32 BitOffset) -{ - - Op->Asl.ExternalName = Name; - Op->Asl.Value.Integer32 = (ByteOffset * 8) + BitOffset; - Op->Asl.CompileFlags |= (NODE_IS_RESOURCE_FIELD | NODE_IS_BIT_OFFSET); -} - - -/******************************************************************************* - * - * FUNCTION: RsCreateByteField - * - * PARAMETERS: Op - Resource field node - * Name - Name of the field (Used only to reference - * the field in the ASL, not in the AML) - * ByteOffset - Offset from the field start - * - * RETURN: None, sets fields within the input node - * - * DESCRIPTION: Utility function to generate a named byte field within a - * resource descriptor. Mark a node as 1) a field in a resource - * descriptor, and 2) set the value to be a BYTE offset - * - ******************************************************************************/ - -void -RsCreateByteField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset) -{ - - Op->Asl.ExternalName = Name; - Op->Asl.Value.Integer32 = ByteOffset; - Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD; -} - - -/******************************************************************************* - * - * FUNCTION: RsSetFlagBits - * - * PARAMETERS: *Flags - Pointer to the flag byte - * Op - Flag initialization node - * Position - Bit position within the flag byte - * Default - Used if the node is DEFAULT. - * - * RETURN: Sets bits within the *Flags output byte. - * - * DESCRIPTION: Set a bit in a cumulative flags word from an initialization - * node. Will use a default value if the node is DEFAULT, meaning - * that no value was specified in the ASL. Used to merge multiple - * keywords into a single flags byte. - * - ******************************************************************************/ - -void -RsSetFlagBits ( - UINT8 *Flags, - ACPI_PARSE_OBJECT *Op, - UINT8 Position, - UINT8 DefaultBit) -{ - - if (Op->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG) - { - /* Use the default bit */ - - *Flags |= (DefaultBit << Position); - } - else - { - /* Use the bit specified in the initialization node */ - - *Flags |= (Op->Asl.Value.Integer8 << Position); - } -} - - -/******************************************************************************* - * - * FUNCTION: RsCompleteNodeAndGetNext - * - * PARAMETERS: Op - Resource node to be completed - * - * RETURN: The next peer to the input node. - * - * DESCRIPTION: Mark the current node completed and return the next peer. - * The node ParseOpcode is set to DEFAULT_ARG, meaning that - * this node is to be ignored from now on. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -RsCompleteNodeAndGetNext ( - ACPI_PARSE_OBJECT *Op) -{ - - /* Mark this node unused */ - - Op->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - - /* Move on to the next peer node in the initializer list */ - - return (ASL_GET_PEER_NODE (Op)); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoOneResourceDescriptor - * - * PARAMETERS: DescriptorTypeOp - Parent parse node of the descriptor - * CurrentByteOffset - Offset in the resource descriptor - * buffer. - * - * RETURN: A valid resource node for the descriptor - * - * DESCRIPTION: Dispatches the processing of one resource descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoOneResourceDescriptor ( - ACPI_PARSE_OBJECT *DescriptorTypeOp, - UINT32 CurrentByteOffset, - UINT8 *State) -{ - ASL_RESOURCE_NODE *Rnode = NULL; - - - /* Determine type of resource */ - - switch (DescriptorTypeOp->Asl.ParseOpcode) - { - case PARSEOP_DMA: - Rnode = RsDoDmaDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_DWORDIO: - Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_DWORDMEMORY: - Rnode = RsDoDwordMemoryDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_ENDDEPENDENTFN: - switch (*State) - { - case ACPI_RSTATE_NORMAL: - AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT, DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_START_DEPENDENT: - AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_DEPENDENT_LIST: - default: - break; - } - - *State = ACPI_RSTATE_NORMAL; - Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_FIXEDIO: - Rnode = RsDoFixedIoDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_INTERRUPT: - Rnode = RsDoInterruptDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_IO: - Rnode = RsDoIoDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_IRQ: - Rnode = RsDoIrqDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_IRQNOFLAGS: - Rnode = RsDoIrqNoFlagsDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_MEMORY24: - Rnode = RsDoMemory24Descriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_MEMORY32: - Rnode = RsDoMemory32Descriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_MEMORY32FIXED: - Rnode = RsDoMemory32FixedDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_QWORDIO: - Rnode = RsDoQwordIoDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_QWORDMEMORY: - Rnode = RsDoQwordMemoryDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_REGISTER: - Rnode = RsDoGeneralRegisterDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_STARTDEPENDENTFN: - switch (*State) - { - case ACPI_RSTATE_START_DEPENDENT: - AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_NORMAL: - case ACPI_RSTATE_DEPENDENT_LIST: - default: - break; - } - - *State = ACPI_RSTATE_START_DEPENDENT; - Rnode = RsDoStartDependentDescriptor (DescriptorTypeOp, CurrentByteOffset); - *State = ACPI_RSTATE_DEPENDENT_LIST; - break; - - case PARSEOP_STARTDEPENDENTFN_NOPRI: - switch (*State) - { - case ACPI_RSTATE_START_DEPENDENT: - AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL); - break; - - case ACPI_RSTATE_NORMAL: - case ACPI_RSTATE_DEPENDENT_LIST: - default: - break; - } - - *State = ACPI_RSTATE_START_DEPENDENT; - Rnode = RsDoStartDependentNoPriDescriptor (DescriptorTypeOp, CurrentByteOffset); - *State = ACPI_RSTATE_DEPENDENT_LIST; - break; - - case PARSEOP_VENDORLONG: - Rnode = RsDoVendorLargeDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_VENDORSHORT: - Rnode = RsDoVendorSmallDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_WORDBUSNUMBER: - Rnode = RsDoWordBusNumberDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_WORDIO: - Rnode = RsDoWordIoDescriptor (DescriptorTypeOp, CurrentByteOffset); - break; - - case PARSEOP_DEFAULT_ARG: - /* Just ignore any of these, they are used as fillers/placeholders */ - break; - - default: - printf ("Unknown resource descriptor type [%s]\n", - DescriptorTypeOp->Asl.ParseOpName); - break; - } - - /* - * Mark original node as unused, but head of a resource descriptor. - * This allows the resource to be installed in the namespace so that - * references to the descriptor can be resolved. - */ - DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG; - DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC; - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsLinkDescriptorChain - * - * PARAMETERS: PreviousRnode - Pointer to the node that will be previous - * to the linked node, At exit, set to the - * last node in the new chain. - * Rnode - Resource node to link into the list - * - * RETURN: Cumulative buffer byte offset of the new segment of chain - * - * DESCRIPTION: Link a descriptor chain at the end of an existing chain. - * - ******************************************************************************/ - -UINT32 -RsLinkDescriptorChain ( - ASL_RESOURCE_NODE **PreviousRnode, - ASL_RESOURCE_NODE *Rnode) -{ - ASL_RESOURCE_NODE *LastRnode; - UINT32 CurrentByteOffset; - - - /* Anything to do? */ - - if (!Rnode) - { - return 0; - } - - /* Point the previous node to the new node */ - - (*PreviousRnode)->Next = Rnode; - CurrentByteOffset = Rnode->BufferLength; - - /* Walk to the end of the chain headed by Rnode */ - - LastRnode = Rnode; - while (LastRnode->Next) - { - LastRnode = LastRnode->Next; - CurrentByteOffset += LastRnode->BufferLength; - } - - /* Previous node becomes the last node in the chain */ - - *PreviousRnode = LastRnode; - return CurrentByteOffset; -} - - -/******************************************************************************* - * - * FUNCTION: RsDoResourceTemplate - * - * PARAMETERS: Op - Parent of a resource template list - * - * RETURN: None. Sets input node to point to a list of AML code - * - * DESCRIPTION: Merge a list of resource descriptors into a single AML buffer, - * in preparation for output to the AML output file. - * - ******************************************************************************/ - -void -RsDoResourceTemplate ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *BufferLengthOp; - ACPI_PARSE_OBJECT *BufferOp; - ACPI_PARSE_OBJECT *DescriptorTypeOp; - ACPI_PARSE_OBJECT *LastOp = NULL; - ASL_RESOURCE_DESC *Descriptor; - UINT32 CurrentByteOffset = 0; - ASL_RESOURCE_NODE HeadRnode; - ASL_RESOURCE_NODE *PreviousRnode; - ASL_RESOURCE_NODE *Rnode; - UINT8 State; - - - /* ResourceTemplate Opcode is first (Op) */ - /* Buffer Length node is first child */ - - BufferLengthOp = ASL_GET_CHILD_NODE (Op); - - /* Buffer Op is first peer */ - - BufferOp = ASL_GET_PEER_NODE (BufferLengthOp); - - /* First Descriptor type is next */ - - DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp); - - /* Process all resource descriptors in the list */ - - State = ACPI_RSTATE_NORMAL; - PreviousRnode = &HeadRnode; - while (DescriptorTypeOp) - { - Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset, &State); - - /* - * Update current byte offset to indicate the number of bytes from the - * start of the buffer. Buffer can include multiple descriptors, we - * must keep track of the offset of not only each descriptor, but each - * element (field) within each descriptor as well. - */ - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode); - - /* Get the next descriptor in the list */ - - LastOp = DescriptorTypeOp; - DescriptorTypeOp = ASL_GET_PEER_NODE (DescriptorTypeOp); - } - - if (State == ACPI_RSTATE_DEPENDENT_LIST) - { - if (LastOp) - { - LastOp = LastOp->Asl.Parent; - } - AslError (ASL_ERROR, ASL_MSG_MISSING_ENDDEPENDENT, LastOp, NULL); - } - - /* - * Insert the EndTag descriptor after all other descriptors have been processed - */ - Rnode = RsAllocateResourceNode (sizeof (ASL_END_TAG_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->Et.DescriptorType = ACPI_RDESC_TYPE_END_TAG | - ASL_RDESC_END_TAG_SIZE; - Descriptor->Et.Checksum = 0; - - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode); - - /* - * Transform the nodes into the following - * - * Op -> AML_BUFFER_OP - * First Child -> BufferLength - * Second Child -> Descriptor Buffer (raw byte data) - */ - Op->Asl.ParseOpcode = PARSEOP_BUFFER; - Op->Asl.AmlOpcode = AML_BUFFER_OP; - Op->Asl.CompileFlags = NODE_AML_PACKAGE; - - BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER; - BufferLengthOp->Asl.Value.Integer = CurrentByteOffset; - - (void) OpcSetOptimalIntegerSize (BufferLengthOp); - - BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA; - BufferOp->Asl.AmlOpcode = AML_RAW_DATA_CHAIN; - BufferOp->Asl.AmlOpcodeLength = 0; - BufferOp->Asl.AmlLength = CurrentByteOffset; - BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next; - - return; -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslresource.h b/sys/dev/acpi/acpica/Subsystem/aslresource.h deleted file mode 100644 index 7f7aa66869b..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslresource.h +++ /dev/null @@ -1,603 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslresource.h - ASL resource descriptors - * $Revision: 19 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2002, 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. - * - *****************************************************************************/ - - -#ifndef __ASLRESOURCE_H -#define __ASLRESOURCE_H - - -#define ASL_RESNAME_ADDRESS "_ADR" -#define ASL_RESNAME_ALIGNMENT "_ALN" -#define ASL_RESNAME_ADDRESSSPACE "_ASI" -#define ASL_RESNAME_BASEADDRESS "_BAS" -#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */ -#define ASL_RESNAME_DECODE "_DEC" -#define ASL_RESNAME_DMA "_DMA" -#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */ -#define ASL_RESNAME_GRANULARITY "_GRA" -#define ASL_RESNAME_INTERRUPT "_INT" -#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */ -#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */ -#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */ -#define ASL_RESNAME_LENGTH "_LEN" -#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */ -#define ASL_RESNAME_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */ -#define ASL_RESNAME_MAXADDR "_MAX" -#define ASL_RESNAME_MINADDR "_MIN" -#define ASL_RESNAME_MAXTYPE "_MAF" -#define ASL_RESNAME_MINTYPE "_MIF" -#define ASL_RESNAME_REGISTERBITOFFSET "_RBO" -#define ASL_RESNAME_REGISTERBITWIDTH "_RBW" -#define ASL_RESNAME_RANGETYPE "_RNG" -#define ASL_RESNAME_READWRITETYPE "_RW_" /* ReadOnly(0), Writable (1) */ -#define ASL_RESNAME_TRANSLATION "_TRA" -#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */ -#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */ -#define ASL_RESNAME_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */ - - -/* Default sizes for "small" resource descriptors */ - -#define ASL_RDESC_IRQ_SIZE 0x02 -#define ASL_RDESC_DMA_SIZE 0x02 -#define ASL_RDESC_ST_DEPEND_SIZE 0x00 -#define ASL_RDESC_END_DEPEND_SIZE 0x00 -#define ASL_RDESC_IO_SIZE 0x07 -#define ASL_RDESC_FIXED_IO_SIZE 0x03 -#define ASL_RDESC_END_TAG_SIZE 0x01 - - -typedef struct asl_resource_node -{ - UINT32 BufferLength; - void *Buffer; - struct asl_resource_node *Next; - -} ASL_RESOURCE_NODE; - - -/* - * Resource descriptors defined in the ACPI specification - */ - - -#pragma pack(1) -typedef struct asl_irq_format_desc -{ - UINT8 DescriptorType; - UINT16 IrqMask; - UINT8 Flags; - -} ASL_IRQ_FORMAT_DESC; - - -#pragma pack(1) -typedef struct asl_irq_noflags_desc -{ - UINT8 DescriptorType; - UINT16 IrqMask; - -} ASL_IRQ_NOFLAGS_DESC; - - -#pragma pack(1) -typedef struct asl_dma_format_desc -{ - UINT8 DescriptorType; - UINT8 DmaChannelMask; - UINT8 Flags; - -} ASL_DMA_FORMAT_DESC; - - -#pragma pack(1) -typedef struct asl_start_dependent_desc -{ - UINT8 DescriptorType; - UINT8 Flags; - -} ASL_START_DEPENDENT_DESC; - - -#pragma pack(1) -typedef struct asl_start_dependent_noprio_desc -{ - UINT8 DescriptorType; - -} ASL_START_DEPENDENT_NOPRIO_DESC; - - -#pragma pack(1) -typedef struct asl_end_dependent_desc -{ - UINT8 DescriptorType; - -} ASL_END_DEPENDENT_DESC; - - -#pragma pack(1) -typedef struct asl_io_port_desc -{ - UINT8 DescriptorType; - UINT8 Information; - UINT16 AddressMin; - UINT16 AddressMax; - UINT8 Alignment; - UINT8 Length; - -} ASL_IO_PORT_DESC; - - -#pragma pack(1) -typedef struct asl_fixed_io_port_desc -{ - UINT8 DescriptorType; - UINT16 BaseAddress; - UINT8 Length; - -} ASL_FIXED_IO_PORT_DESC; - - -#pragma pack(1) -typedef struct asl_small_vendor_desc -{ - UINT8 DescriptorType; - UINT8 VendorDefined[7]; - -} ASL_SMALL_VENDOR_DESC; - - -#pragma pack(1) -typedef struct asl_end_tag_desc -{ - UINT8 DescriptorType; - UINT8 Checksum; - -} ASL_END_TAG_DESC; - - -/* LARGE descriptors */ - -#pragma pack(1) -typedef struct asl_memory_24_desc -{ - UINT8 DescriptorType; - UINT16 Length; - UINT8 Information; - UINT16 AddressMin; - UINT16 AddressMax; - UINT16 Alignment; - UINT16 RangeLength; - -} ASL_MEMORY_24_DESC; - - -#pragma pack(1) -typedef struct asl_large_vendor_desc -{ - UINT8 DescriptorType; - UINT16 Length; - UINT8 VendorDefined[1]; - -} ASL_LARGE_VENDOR_DESC; - - -#pragma pack(1) -typedef struct asl_memory_32_desc -{ - UINT8 DescriptorType; - UINT16 Length; - UINT8 Information; - UINT32 AddressMin; - UINT32 AddressMax; - UINT32 Alignment; - UINT32 RangeLength; - -} ASL_MEMORY_32_DESC; - - -#pragma pack(1) -typedef struct asl_fixed_memory_32_desc -{ - UINT8 DescriptorType; - UINT16 Length; - UINT8 Information; - UINT32 BaseAddress; - UINT32 RangeLength; - -} ASL_FIXED_MEMORY_32_DESC; - - -#pragma pack(1) -typedef struct asl_qword_address_desc -{ - UINT8 DescriptorType; - UINT16 Length; - UINT8 ResourceType; - UINT8 Flags; - UINT8 SpecificFlags; - UINT64 Granularity; - UINT64 AddressMin; - UINT64 AddressMax; - UINT64 TranslationOffset; - UINT64 AddressLength; - UINT8 OptionalFields[2]; - -} ASL_QWORD_ADDRESS_DESC; - - -#pragma pack(1) -typedef struct asl_dword_address_desc -{ - UINT8 DescriptorType; - UINT16 Length; - UINT8 ResourceType; - UINT8 Flags; - UINT8 SpecificFlags; - UINT32 Granularity; - UINT32 AddressMin; - UINT32 AddressMax; - UINT32 TranslationOffset; - UINT32 AddressLength; - UINT8 OptionalFields[2]; - -} ASL_DWORD_ADDRESS_DESC; - - -#pragma pack(1) -typedef struct asl_word_address_desc -{ - UINT8 DescriptorType; - UINT16 Length; - UINT8 ResourceType; - UINT8 Flags; - UINT8 SpecificFlags; - UINT16 Granularity; - UINT16 AddressMin; - UINT16 AddressMax; - UINT16 TranslationOffset; - UINT16 AddressLength; - UINT8 OptionalFields[2]; - -} ASL_WORD_ADDRESS_DESC; - - -#pragma pack(1) -typedef struct asl_extended_xrupt_desc -{ - UINT8 DescriptorType; - UINT16 Length; - UINT8 Flags; - UINT8 TableLength; - UINT32 InterruptNumber[1]; - /* ResSourceIndex, ResSource optional fields follow */ - -} ASL_EXTENDED_XRUPT_DESC; - - -#pragma pack(1) -typedef struct asl_general_register_desc -{ - UINT8 DescriptorType; - UINT16 Length; - UINT8 AddressSpaceId; - UINT8 BitWidth; - UINT8 BitOffset; - UINT8 Reserved; - UINT64 Address; - -} ASL_GENERAL_REGISTER_DESC; - - -/* Union of all resource descriptors, sow we can allocate the worst case */ - -typedef union asl_resource_desc -{ - ASL_IRQ_FORMAT_DESC Irq; - ASL_DMA_FORMAT_DESC Dma; - ASL_START_DEPENDENT_DESC Std; - ASL_END_DEPENDENT_DESC End; - ASL_IO_PORT_DESC Iop; - ASL_FIXED_IO_PORT_DESC Fio; - ASL_SMALL_VENDOR_DESC Smv; - ASL_END_TAG_DESC Et; - - ASL_MEMORY_24_DESC M24; - ASL_LARGE_VENDOR_DESC Lgv; - ASL_MEMORY_32_DESC M32; - ASL_FIXED_MEMORY_32_DESC F32; - ASL_QWORD_ADDRESS_DESC Qas; - ASL_DWORD_ADDRESS_DESC Das; - ASL_WORD_ADDRESS_DESC Was; - ASL_EXTENDED_XRUPT_DESC Exx; - ASL_GENERAL_REGISTER_DESC Grg; - UINT32 U32Item; - UINT16 U16Item; - UINT8 U8Item; - -} ASL_RESOURCE_DESC; - - -#define NEXT_RESOURCE_DESC(a,b) (ASL_RESOURCE_DESC *) (((char *) (a)) + sizeof(b)) - -#define DEFAULT_RESOURCE_DESC_SIZE (sizeof (ASL_RESOURCE_DESC) + sizeof (ASL_END_TAG_DESC)) - - -/* - * Resource utilities - */ - -ASL_RESOURCE_NODE * -RsAllocateResourceNode ( - UINT32 Size); - - void -RsCreateBitField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset, - UINT32 BitOffset); - -void -RsCreateByteField ( - ACPI_PARSE_OBJECT *Op, - char *Name, - UINT32 ByteOffset); - -void -RsSetFlagBits ( - UINT8 *Flags, - ACPI_PARSE_OBJECT *Op, - UINT8 Position, - UINT8 Default); - -ACPI_PARSE_OBJECT * -RsCompleteNodeAndGetNext ( - ACPI_PARSE_OBJECT *Op); - -ASL_RESOURCE_NODE * -RsDoOneResourceDescriptor ( - ACPI_PARSE_OBJECT *DescriptorTypeOp, - UINT32 CurrentByteOffset); - -UINT32 -RsLinkDescriptorChain ( - ASL_RESOURCE_NODE **PreviousRnode, - ASL_RESOURCE_NODE *Rnode); - - -/* - * Small descriptors - */ - -ASL_RESOURCE_NODE * -RsDoDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoEndDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoFixedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoInterruptDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIrqDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoIrqNoFlagsDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory24Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory32Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoMemory32FixedDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoStartDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoStartDependentNoPriDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoVendorSmallDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -/* - * Large descriptors - */ - -UINT32 -RsGetStringDataLength ( - ACPI_PARSE_OBJECT *InitializerOp); - -ASL_RESOURCE_NODE * -RsDoDwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoDwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoQwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoQwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoWordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoWordBusNumberDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoVendorLargeDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - -ASL_RESOURCE_NODE * -RsDoGeneralRegisterDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset); - - -#endif - diff --git a/sys/dev/acpi/acpica/Subsystem/aslrestype1.c b/sys/dev/acpi/acpica/Subsystem/aslrestype1.c deleted file mode 100644 index 1affb55bfe1..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslrestype1.c +++ /dev/null @@ -1,1041 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype1 - Short (type1) resource templates and descriptors - * $Revision: 24 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype1") - - -/******************************************************************************* - * - * FUNCTION: RsDoDmaDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "DMA" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDmaDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - UINT8 DmaChannelMask = 0; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_DMA_FORMAT_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->Dma.DescriptorType = ACPI_RDESC_TYPE_DMA_FORMAT | - ASL_RDESC_DMA_SIZE; - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* DMA type */ - - RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_DMATYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5); - break; - - case 1: /* Bus Master */ - - RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_BUSMASTER, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2); - break; - - case 2: /* Xfer Type (transfer width) */ - - RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_XFERTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0); - break; - - case 3: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - /* All DMA channel bytes are handled here, after the flags and name */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - DmaChannelMask |= (1 << InitializerOp->Asl.Value.Integer8); - } - - if (i == 4) /* case 4: First DMA byte */ - { - RsCreateByteField (InitializerOp, ASL_RESNAME_DMA, - CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.DmaChannelMask)); - } - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Now we can set the channel mask */ - - Descriptor->Dma.DmaChannelMask = DmaChannelMask; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoEndDependentDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "EndDependentFn" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoEndDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ASL_RESOURCE_NODE *Rnode; - - - Rnode = RsAllocateResourceNode (sizeof (ASL_END_DEPENDENT_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->End.DescriptorType = ACPI_RDESC_TYPE_END_DEPENDENT | - ASL_RDESC_END_DEPEND_SIZE; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoFixedIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "FixedIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoFixedIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_FIXED_IO_PORT_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->Iop.DescriptorType = ACPI_RDESC_TYPE_FIXED_IO_PORT | - ASL_RDESC_FIXED_IO_SIZE; - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Base Address */ - - Descriptor->Fio.BaseAddress = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (Fio.BaseAddress)); - break; - - case 1: /* Length */ - - Descriptor->Fio.Length = InitializerOp->Asl.Value.Integer8; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Fio.Length)); - break; - - case 2: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "IO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_IO_PORT_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->Iop.DescriptorType = ACPI_RDESC_TYPE_IO_PORT | - ASL_RDESC_IO_SIZE; - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Decode size */ - - RsSetFlagBits (&Descriptor->Iop.Information, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Information), 0); - break; - - case 1: /* Min Address */ - - Descriptor->Iop.AddressMin = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.AddressMin)); - break; - - case 2: /* Max Address */ - - Descriptor->Iop.AddressMax = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.AddressMax)); - break; - - case 3: /* Alignment */ - - Descriptor->Iop.Alignment = InitializerOp->Asl.Value.Integer8; - RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Alignment)); - break; - - case 4: /* Length */ - - Descriptor->Iop.Length = InitializerOp->Asl.Value.Integer8; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Length)); - break; - - case 5: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoIrqDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "IRQ" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoIrqDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - UINT16 IrqMask = 0; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_IRQ_FORMAT_DESC)); - - /* Length = 3 (with flag byte) */ - - Descriptor = Rnode->Buffer; - Descriptor->Irq.DescriptorType = ACPI_RDESC_TYPE_IRQ_FORMAT | - (ASL_RDESC_IRQ_SIZE + 0x01); - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Interrupt Type (or Mode - edge/level) */ - - RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0); - break; - - case 1: /* Interrupt Level (or Polarity - Active high/low) */ - - RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3); - break; - - case 2: /* Share Type - Default: exclusive (0) */ - - RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4); - break; - - case 3: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - /* All IRQ bytes are handled here, after the flags and name */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - IrqMask |= (1 << InitializerOp->Asl.Value.Integer8); - } - - if (i == 4) /* case 4: First IRQ byte */ - { - RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask)); - } - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Now we can set the channel mask */ - - Descriptor->Irq.IrqMask = IrqMask; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoIrqNoFlagsDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "IRQNoFlags" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoIrqNoFlagsDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - UINT16 IrqMask = 0; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_IRQ_NOFLAGS_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->Irq.DescriptorType = ACPI_RDESC_TYPE_IRQ_FORMAT | - ASL_RDESC_IRQ_SIZE; - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - /* IRQ bytes are handled here, after the flags and name */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - IrqMask |= (1 << InitializerOp->Asl.Value.Integer8); - } - - if (i == 1) /* case 1: First IRQ byte */ - { - RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask)); - } - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Now we can set the interrupt mask */ - - Descriptor->Irq.IrqMask = IrqMask; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoMemory24Descriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "Memory24" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoMemory24Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_MEMORY_24_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->M24.DescriptorType = ACPI_RDESC_TYPE_MEMORY_24; - Descriptor->M24.Length = 9; - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Read/Write type */ - - RsSetFlagBits (&Descriptor->M24.Information, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (M24.Information), 0); - break; - - case 1: /* Min Address */ - - Descriptor->M24.AddressMin = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (M24.AddressMin)); - break; - - case 2: /* Max Address */ - - Descriptor->M24.AddressMax = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (M24.AddressMax)); - break; - - case 3: /* Alignment */ - - Descriptor->M24.Alignment = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT, - CurrentByteOffset + ASL_RESDESC_OFFSET (M24.Alignment)); - break; - - case 4: /* Length */ - - Descriptor->M24.RangeLength = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (M24.RangeLength)); - break; - - case 5: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoMemory32Descriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "Memory32" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoMemory32Descriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_MEMORY_32_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->M32.DescriptorType = ACPI_RDESC_TYPE_MEMORY_32; - Descriptor->M32.Length = 17; - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Read/Write type */ - - RsSetFlagBits (&Descriptor->M32.Information, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (M32.Information), 0); - break; - - case 1: /* Min Address */ - - Descriptor->M32.AddressMin = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (M32.AddressMin)); - break; - - case 2: /* Max Address */ - - Descriptor->M32.AddressMax = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (M32.AddressMax)); - break; - - case 3: /* Alignment */ - - Descriptor->M32.Alignment = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT, - CurrentByteOffset + ASL_RESDESC_OFFSET (M32.Alignment)); - break; - - case 4: /* Length */ - - Descriptor->M32.RangeLength = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (M32.RangeLength)); - break; - - case 5: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoMemory32FixedDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "Memory32Fixed" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoMemory32FixedDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_FIXED_MEMORY_32_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->F32.DescriptorType = ACPI_RDESC_TYPE_FIXED_MEMORY_32; - Descriptor->F32.Length = 9; - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Read/Write type */ - - RsSetFlagBits (&Descriptor->F32.Information, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (F32.Information), 0); - break; - - case 1: /* Address */ - - Descriptor->F32.BaseAddress = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (F32.BaseAddress)); - break; - - case 2: /* Length */ - - Descriptor->F32.RangeLength = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (F32.RangeLength)); - break; - - case 3: /* Name */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoStartDependentDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "StartDependentFn" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoStartDependentDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - ASL_RESOURCE_NODE *PreviousRnode; - ASL_RESOURCE_NODE *NextRnode; - UINT32 i; - UINT8 State; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_START_DEPENDENT_DESC)); - - PreviousRnode = Rnode; - Descriptor = Rnode->Buffer; - - /* Descriptor has priority byte */ - - Descriptor->Std.DescriptorType = ACPI_RDESC_TYPE_START_DEPENDENT | - (ASL_RDESC_ST_DEPEND_SIZE + 0x01); - - /* - * Process all child initialization nodes - */ - State = ACPI_RSTATE_START_DEPENDENT; - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Compatibility Priority */ - - if (InitializerOp->Asl.Value.Integer8 > 2) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY, InitializerOp, NULL); - } - - RsSetFlagBits (&Descriptor->Std.Flags, InitializerOp, 0, 0); - break; - - case 1: /* Performance/Robustness Priority */ - - if (InitializerOp->Asl.Value.Integer8 > 2) - { - AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE, InitializerOp, NULL); - } - - RsSetFlagBits (&Descriptor->Std.Flags, InitializerOp, 2, 0); - break; - - default: - NextRnode = RsDoOneResourceDescriptor (InitializerOp, CurrentByteOffset, &State); - - /* - * Update current byte offset to indicate the number of bytes from the - * start of the buffer. Buffer can include multiple descriptors, we - * must keep track of the offset of not only each descriptor, but each - * element (field) within each descriptor as well. - */ - - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoStartDependentNoPriDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "StartDependentNoPri" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoStartDependentNoPriDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - ASL_RESOURCE_NODE *PreviousRnode; - ASL_RESOURCE_NODE *NextRnode; - UINT8 State; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_START_DEPENDENT_NOPRIO_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->Std.DescriptorType = ACPI_RDESC_TYPE_START_DEPENDENT | - ASL_RDESC_ST_DEPEND_SIZE; - PreviousRnode = Rnode; - - /* - * Process all child initialization nodes - */ - State = ACPI_RSTATE_START_DEPENDENT; - while (InitializerOp) - { - NextRnode = RsDoOneResourceDescriptor (InitializerOp, CurrentByteOffset, &State); - - /* - * Update current byte offset to indicate the number of bytes from the - * start of the buffer. Buffer can include multiple descriptors, we - * must keep track of the offset of not only each descriptor, but each - * element (field) within each descriptor as well. - */ - - CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode); - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoVendorSmallDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a short "VendorShort" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoVendorSmallDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_SMALL_VENDOR_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->Smv.DescriptorType = ACPI_RDESC_TYPE_SMALL_VENDOR; - - /* - * Process all child initialization nodes - */ - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - for (i = 0; (InitializerOp && (i < 7)); i++) - { - Descriptor->Smv.VendorDefined[i] = InitializerOp->Asl.Value.Integer8; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* Adjust the Rnode buffer size, so correct number of bytes are emitted */ - - Rnode->BufferLength -= (7 - i); - - /* Set the length in the Type Tag */ - - Descriptor->Smv.DescriptorType |= (UINT8) i; - return (Rnode); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslrestype2.c b/sys/dev/acpi/acpica/Subsystem/aslrestype2.c deleted file mode 100644 index 35412240412..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslrestype2.c +++ /dev/null @@ -1,1536 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslrestype2 - Long (type2) resource templates and descriptors - * $Revision: 24 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslrestype2") - - -/******************************************************************************* - * - * FUNCTION: RsGetStringDataLength - * - * PARAMETERS: InitializerOp - Start of a subtree of init nodes - * - * RETURN: Valid string length if a string node is found - * - * DESCRIPTION: In a list of peer nodes, find the first one that contains a - * string and return the length of the string. - * - ******************************************************************************/ - -UINT32 -RsGetStringDataLength ( - ACPI_PARSE_OBJECT *InitializerOp) -{ - - while (InitializerOp) - { - if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) - { - return (strlen (InitializerOp->Asl.Value.String) + 1); - } - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - } - - return 0; -} - - -/******************************************************************************* - * - * FUNCTION: RsDoDwordIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "DwordIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode (sizeof (ASL_DWORD_ADDRESS_DESC) + - StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Das.DescriptorType = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE; - Descriptor->Das.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - Descriptor->Das.Length = (UINT16) (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Das.ResourceType)); - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->Das.Granularity = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Granularity)); - break; - - case 6: /* Address Min */ - - Descriptor->Das.AddressMin = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMin)); - break; - - case 7: /* Address Max */ - - Descriptor->Das.AddressMax = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMax)); - break; - - case 8: /* Translation Offset */ - - Descriptor->Das.TranslationOffset = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->Das.AddressLength = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressLength)); - break; - - case 10: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - Descriptor->Das.OptionalFields[0] = InitializerOp->Asl.Value.Integer8; - OptionIndex++; - Descriptor->Das.Length++; - } - break; - - case 11: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Das.Length = (UINT16) (Descriptor->Das.Length + StringLength); - - strcpy ((char *) &Descriptor->Das.OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - } - } - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 13: /* Type */ - - RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 4); - break; - - case 14: /* Translation Type */ - - RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - Rnode->BufferLength = (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Das.DescriptorType)) - + OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoDwordMemoryDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "DwordMemory" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoDwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode (sizeof (ASL_DWORD_ADDRESS_DESC) + - StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Das.DescriptorType = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE; - Descriptor->Das.ResourceType = ACPI_RESOURCE_TYPE_MEMORY_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - Descriptor->Das.Length = (UINT16) (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Das.ResourceType)); - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 0, 1); - break; - - case 1: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 1); - break; - - case 2: /* MinType */ - - RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 2); - break; - - case 3: /* MaxType */ - - RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 3); - break; - - case 4: /* Memory Type */ - - RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 1); - break; - - case 5: /* Read/Write Type */ - - RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 0); - break; - - case 6: /* Address Granularity */ - - Descriptor->Das.Granularity = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Granularity)); - break; - - case 7: /* Min Address */ - - Descriptor->Das.AddressMin = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMin)); - break; - - case 8: /* Max Address */ - - Descriptor->Das.AddressMax = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMax)); - break; - - case 9: /* Translation Offset */ - - Descriptor->Das.TranslationOffset = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Das.AddressLength = InitializerOp->Asl.Value.Integer32; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressLength)); - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - Descriptor->Das.OptionalFields[0] = InitializerOp->Asl.Value.Integer8; - OptionIndex++; - Descriptor->Das.Length++; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Das.Length = (UINT16) (Descriptor->Das.Length + StringLength); - - strcpy ((char *) &Descriptor->Das.OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - } - } - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - - case 14: /* Address Range */ - - RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 3); - break; - - case 15: /* Type */ - - RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - Rnode->BufferLength = (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Das.DescriptorType)) - + OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoQwordIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "QwordIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoQwordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode (sizeof (ASL_QWORD_ADDRESS_DESC) + - StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Qas.DescriptorType = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE; - Descriptor->Qas.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - Descriptor->Qas.Length = (UINT16) (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Qas.ResourceType)); - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->Qas.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Granularity)); - break; - - case 6: /* Address Min */ - - Descriptor->Qas.AddressMin = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMin)); - break; - - case 7: /* Address Max */ - - Descriptor->Qas.AddressMax = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMax)); - break; - - case 8: /* Translation Offset */ - - Descriptor->Qas.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->Qas.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressLength)); - break; - - case 10: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - Descriptor->Qas.OptionalFields[0] = InitializerOp->Asl.Value.Integer8; - OptionIndex++; - Descriptor->Qas.Length++; - } - break; - - case 11: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Qas.Length = (UINT16) (Descriptor->Qas.Length + StringLength); - - strcpy ((char *) &Descriptor->Qas.OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - } - } - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 13: /* Type */ - - RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 4); - break; - - case 14: /* Translation Type */ - - RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - Rnode->BufferLength = (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Qas.DescriptorType)) - + OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoQwordMemoryDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "QwordMemory" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoQwordMemoryDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode (sizeof (ASL_QWORD_ADDRESS_DESC) + - StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Qas.DescriptorType = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE; - Descriptor->Qas.ResourceType = ACPI_RESOURCE_TYPE_MEMORY_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - Descriptor->Qas.Length = (UINT16) (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Qas.ResourceType)); - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 0, 1); - break; - - case 1: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 1); - break; - - case 2: /* MinType */ - - RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 2); - break; - - case 3: /* MaxType */ - - RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 3); - break; - - case 4: /* Memory Type */ - - RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 1); - break; - - case 5: /* Read/Write Type */ - - RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 0, 1); - RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 0); - break; - - case 6: /* Address Granularity */ - - Descriptor->Qas.Granularity = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Granularity)); - break; - - case 7: /* Min Address */ - - Descriptor->Qas.AddressMin = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMin)); - break; - - case 8: /* Max Address */ - - Descriptor->Qas.AddressMax = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMax)); - break; - - case 9: /* Translation Offset */ - - Descriptor->Qas.TranslationOffset = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.TranslationOffset)); - break; - - case 10: /* Address Length */ - - Descriptor->Qas.AddressLength = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressLength)); - break; - - case 11: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - Descriptor->Qas.OptionalFields[0] = InitializerOp->Asl.Value.Integer8; - OptionIndex++; - Descriptor->Qas.Length++; - } - break; - - case 12: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Qas.Length = (UINT16) (Descriptor->Qas.Length + StringLength); - - strcpy ((char *) &Descriptor->Qas.OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - } - } - break; - - case 13: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - - case 14: /* Address Range */ - - RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 3); - break; - - case 15: /* Type */ - - RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - Rnode->BufferLength = (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Qas.DescriptorType)) - + OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoWordIoDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "WordIO" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoWordIoDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode (sizeof (ASL_WORD_ADDRESS_DESC) + - StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Was.DescriptorType = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE; - Descriptor->Was.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - Descriptor->Was.Length = (UINT16) (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Was.ResourceType)); - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 1); - break; - - case 4: /* Range Type */ - - RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 0, 3); - RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 0); - break; - - case 5: /* Address Granularity */ - - Descriptor->Was.Granularity = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Granularity)); - break; - - case 6: /* Address Min */ - - Descriptor->Was.AddressMin = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMin)); - break; - - case 7: /* Address Max */ - - Descriptor->Was.AddressMax = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMax)); - break; - - case 8: /* Translation Offset */ - - Descriptor->Was.TranslationOffset = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.TranslationOffset)); - break; - - case 9: /* Address Length */ - - Descriptor->Was.AddressLength = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressLength)); - break; - - case 10: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - Descriptor->Was.OptionalFields[0] = InitializerOp->Asl.Value.Integer8; - OptionIndex++; - Descriptor->Was.Length++; - } - break; - - case 11: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Was.Length = (UINT16) (Descriptor->Was.Length +StringLength); - - strcpy ((char *) &Descriptor->Was.OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - } - } - break; - - case 12: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - case 13: /* Type */ - - RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 4, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 4); - break; - - case 14: /* Translation Type */ - - RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 5, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 5); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - Rnode->BufferLength = (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Was.DescriptorType)) - + OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoWordBusNumberDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "WordBusNumber" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoWordBusNumberDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - - Rnode = RsAllocateResourceNode (sizeof (ASL_WORD_ADDRESS_DESC) + - StringLength); - - Descriptor = Rnode->Buffer; - Descriptor->Was.DescriptorType = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE; - Descriptor->Was.ResourceType = ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - Descriptor->Was.Length = (UINT16) (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Was.ResourceType)); - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type */ - - RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 0, 1); - break; - - case 1: /* MinType */ - - RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 2); - break; - - case 2: /* MaxType */ - - RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 3); - break; - - case 3: /* DecodeType */ - - RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 1); - break; - - case 4: /* Address Granularity */ - - Descriptor->Was.Granularity = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Granularity)); - break; - - case 5: /* Min Address */ - - Descriptor->Was.AddressMin = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMin)); - break; - - case 6: /* Max Address */ - - Descriptor->Was.AddressMax = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMax)); - break; - - case 7: /* Translation Offset */ - - Descriptor->Was.TranslationOffset = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.TranslationOffset)); - break; - - case 8: /* Address Length */ - - Descriptor->Was.AddressLength = InitializerOp->Asl.Value.Integer16; - RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressLength)); - break; - - case 9: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - Descriptor->Was.OptionalFields[0] = InitializerOp->Asl.Value.Integer8; - OptionIndex++; - Descriptor->Was.Length++; - } - break; - - case 10: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - Descriptor->Was.Length = (UINT16) (Descriptor->Was.Length + StringLength); - - strcpy ((char *) &Descriptor->Was.OptionalFields[OptionIndex], - InitializerOp->Asl.Value.String); - } - } - break; - - case 11: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - Rnode->BufferLength = (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) - - ASL_RESDESC_OFFSET (Was.DescriptorType)) - + OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoInterruptDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "Interrupt" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoInterruptDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ASL_RESOURCE_DESC *Rover = NULL; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 StringLength = 0; - UINT32 OptionIndex = 0; - UINT32 i; - BOOLEAN HasResSourceIndex = FALSE; - UINT8 ResSourceIndex = 0; - UINT8 *ResSourceString = NULL; - - - InitializerOp = Op->Asl.Child; - StringLength = RsGetStringDataLength (InitializerOp); - if (StringLength) - { - /* Make room for the ResourceSourceIndex */ - - OptionIndex++; - } - - /* Count the interrupt numbers */ - - for (i = 0; InitializerOp; i++) - { - InitializerOp = ASL_GET_PEER_NODE (InitializerOp); - if (i <= 6) - { - continue; - } - - OptionIndex += 4; - } - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_EXTENDED_XRUPT_DESC) + - OptionIndex + StringLength); - Descriptor = Rnode->Buffer; - Descriptor->Exx.DescriptorType = ACPI_RDESC_TYPE_EXTENDED_XRUPT; - - /* - * Initial descriptor length -- may be enlarged if there are - * optional fields present - */ - Descriptor->Exx.Length = 2; /* Flags and table length byte */ - Descriptor->Exx.TableLength = 0; - - Rover = ACPI_CAST_PTR (ASL_RESOURCE_DESC, (&(Descriptor->Exx.InterruptNumber[0]))); - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Resource Type (Default: consumer (1) */ - - RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 0, 1); - break; - - case 1: /* Interrupt Type (or Mode - edge/level) */ - - RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 1, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 0); - break; - - case 2: /* Interrupt Level (or Polarity - Active high/low) */ - - RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 2, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL, - CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 2); - break; - - case 3: /* Share Type - Default: exclusive (0) */ - - RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 3, 0); - RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 3); - break; - - case 4: /* ResSourceIndex [Optional Field - BYTE] */ - - if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) - { - HasResSourceIndex = TRUE; - ResSourceIndex = InitializerOp->Asl.Value.Integer8; - } - break; - - case 5: /* ResSource [Optional Field - STRING] */ - - if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) && - (InitializerOp->Asl.Value.String)) - { - if (StringLength) - { - ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String; - } - } - break; - - case 6: /* ResourceTag */ - - UtAttachNamepathToOwner (Op, InitializerOp); - break; - - default: - /* - * Interrupt Numbers come through here, repeatedly. - * Store the integer and move pointer to the next one. - */ - Rover->U32Item = InitializerOp->Asl.Value.Integer32; - Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U32Item), 4); - - Descriptor->Exx.TableLength++; - Descriptor->Exx.Length += 4; - - if (i == 7) /* case 7: First interrupt number */ - { - RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT, - CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.InterruptNumber[0])); - } - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - /* - * Add optional ResSourceIndex if present - */ - if (HasResSourceIndex) - { - Rover->U8Item = ResSourceIndex; - Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U8Item), 1); - Descriptor->Exx.Length += 1; - } - - /* - * Add optional ResSource string if present - */ - if (StringLength && ResSourceString) - { - - strcpy ((char *) Rover, (char *) ResSourceString); - Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U8Item), StringLength); - Descriptor->Exx.Length = (UINT16) (Descriptor->Exx.Length + StringLength); - } - - Rnode->BufferLength = (ASL_RESDESC_OFFSET (Exx.InterruptNumber[0]) - - ASL_RESDESC_OFFSET (Exx.DescriptorType)) - + OptionIndex + StringLength; - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoVendorLargeDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "VendorLong" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoVendorLargeDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - /* Count the number of data bytes */ - - InitializerOp = Op->Asl.Child; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - - for (i = 0; InitializerOp; i++) - { - InitializerOp = InitializerOp->Asl.Next; - } - - InitializerOp = Op->Asl.Child; - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - Rnode = RsAllocateResourceNode (sizeof (ASL_LARGE_VENDOR_DESC) + (i - 1)); - - Descriptor = Rnode->Buffer; - Descriptor->Lgv.DescriptorType = ACPI_RDESC_TYPE_LARGE_VENDOR; - Descriptor->Lgv.Length = (UINT16) i; - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - Descriptor->Lgv.VendorDefined[i] = InitializerOp->Asl.Value.Integer8; - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - - return (Rnode); -} - - -/******************************************************************************* - * - * FUNCTION: RsDoGeneralRegisterDescriptor - * - * PARAMETERS: Op - Parent resource descriptor parse node - * CurrentByteOffset - Offset into the resource template AML - * buffer (to track references to the desc) - * - * RETURN: Completed resource node - * - * DESCRIPTION: Construct a long "Register" descriptor - * - ******************************************************************************/ - -ASL_RESOURCE_NODE * -RsDoGeneralRegisterDescriptor ( - ACPI_PARSE_OBJECT *Op, - UINT32 CurrentByteOffset) -{ - ASL_RESOURCE_DESC *Descriptor; - ACPI_PARSE_OBJECT *InitializerOp; - ASL_RESOURCE_NODE *Rnode; - UINT32 i; - - - InitializerOp = Op->Asl.Child; - Rnode = RsAllocateResourceNode (sizeof (ASL_GENERAL_REGISTER_DESC)); - - Descriptor = Rnode->Buffer; - Descriptor->Grg.DescriptorType = ACPI_RDESC_TYPE_GENERAL_REGISTER; - Descriptor->Grg.Length = 12; - - /* - * Process all child initialization nodes - */ - for (i = 0; InitializerOp; i++) - { - switch (i) - { - case 0: /* Address space */ - - Descriptor->Grg.AddressSpaceId = InitializerOp->Asl.Value.Integer8; - RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESSSPACE, - CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.AddressSpaceId)); - break; - - case 1: /* Register Bit Width */ - - Descriptor->Grg.BitWidth = InitializerOp->Asl.Value.Integer8; - RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITWIDTH, - CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.BitWidth)); - break; - - case 2: /* Register Bit Offset */ - - Descriptor->Grg.BitOffset = InitializerOp->Asl.Value.Integer8; - RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITOFFSET, - CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.BitOffset)); - break; - - case 3: /* Register Address */ - - Descriptor->Grg.Address = InitializerOp->Asl.Value.Integer; - RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESS, - CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.Address)); - break; - - - default: - - AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL); - break; - } - - InitializerOp = RsCompleteNodeAndGetNext (InitializerOp); - } - return (Rnode); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/aslstubs.c b/sys/dev/acpi/acpica/Subsystem/aslstubs.c deleted file mode 100644 index 3b023e03f6b..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslstubs.c +++ /dev/null @@ -1,259 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslstubs - Stubs used to link to Aml interpreter - * $Revision: 10 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#include <stdio.h> -#include "aslcompiler.h" -#include "acdispat.h" -#include "actables.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslstubs") - - -/* - * Stubs to simplify linkage to the ACPI CA core subsystem. - * Things like Events, Global Lock, etc. are not used - * by the compiler, so they are stubbed out here. - */ -ACPI_STATUS -AeLocalGetRootPointer ( - UINT32 Flags, - ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress) -{ - return AE_ERROR; -} - -ACPI_STATUS -AcpiDsMethodDataGetValue ( - UINT16 Opcode, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **DestDesc) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsMethodDataGetNode ( - UINT16 Opcode, - UINT32 Index, - ACPI_WALK_STATE *WalkState, - ACPI_NAMESPACE_NODE **Node) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiDsStoreObjectToLocal ( - UINT16 Opcode, - UINT32 Index, - ACPI_OPERAND_OBJECT *SrcDesc, - ACPI_WALK_STATE *WalkState) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvQueueNotifyRequest ( - ACPI_NAMESPACE_NODE *Node, - UINT32 NotifyValue) -{ - return (AE_OK); -} - -BOOLEAN -AcpiEvIsNotifyObject ( - ACPI_NAMESPACE_NODE *Node) -{ - return (FALSE); -} - -ACPI_STATUS -AcpiEvAcquireGlobalLock( - UINT32 Timeout) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvReleaseGlobalLock( - void) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiEvInitializeRegion ( - ACPI_OPERAND_OBJECT *RegionObj, - BOOLEAN AcpiNsLocked) -{ - return (AE_OK); -} - -ACPI_STATUS -AcpiExReadDataFromField ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **RetBufferDesc) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExWriteDataToField ( - ACPI_OPERAND_OBJECT *SourceDesc, - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT **ResultDesc) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExLoadTableOp ( - ACPI_WALK_STATE *WalkState, - ACPI_OPERAND_OBJECT **ReturnDesc) -{ - return (AE_SUPPORT); -} - - -ACPI_STATUS -AcpiExUnloadTable ( - ACPI_OPERAND_OBJECT *DdbHandle) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiExLoadOp ( - ACPI_OPERAND_OBJECT *ObjDesc, - ACPI_OPERAND_OBJECT *Target, - ACPI_WALK_STATE *WalkState) -{ - return (AE_SUPPORT); -} - -ACPI_STATUS -AcpiTbFindTable ( - char *Signature, - char *OemId, - char *OemTableId, - ACPI_TABLE_HEADER **TablePtr) -{ - return (AE_SUPPORT); -} - diff --git a/sys/dev/acpi/acpica/Subsystem/asltransform.c b/sys/dev/acpi/acpica/Subsystem/asltransform.c deleted file mode 100644 index f3e440aadce..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asltransform.c +++ /dev/null @@ -1,608 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asltransform - Parse tree transforms - * $Revision: 16 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2002, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asltransform") - - -/******************************************************************************* - * - * FUNCTION: TrAmlGetNextTempName - * - * PARAMETERS: NamePath - Where a pointer to the temp name is returned - * - * RETURN: A pointer to the second character of the name - * - * DESCRIPTION: Generate an ACPI name of the form _Txx. These names are - * reserved for use by the ASL compiler. - * - ******************************************************************************/ - -char * -TrAmlGetNextTempName ( - char **NamePath) -{ - char *TempName; - - - if (Gbl_TempCount > 255) - { - /* Too many temps */ - /* TBD: issue eror message */ - *NamePath = "ERROR"; - return ("Error"); - } - - TempName = UtLocalCalloc (6); - UtConvertByteToHex ((UINT8) Gbl_TempCount, (UINT8 *) &TempName [1]); - Gbl_TempCount++; - - /* First three characters are always "\_T" */ - - TempName[0] = '\\'; - TempName[1] = '_'; - TempName[2] = 'T'; - - *NamePath = TempName; - return (&TempName[1]); -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlInitLineNumbers - * - * PARAMETERS: Op - Op to be initialized - * Neighbor - Op used for initialization values - * - * RETURN: None - * - * DESCRIPTION: Initialized the various line numbers for a parse node. - * - ******************************************************************************/ - -void -TrAmlInitLineNumbers ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Neighbor) -{ - - Op->Asl.EndLine = Neighbor->Asl.EndLine; - Op->Asl.EndLogicalLine = Neighbor->Asl.EndLogicalLine; - Op->Asl.LineNumber = Neighbor->Asl.LineNumber; - Op->Asl.LogicalByteOffset = Neighbor->Asl.LogicalByteOffset; - Op->Asl.LogicalLineNumber = Neighbor->Asl.LogicalLineNumber; -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlInitNode - * - * PARAMETERS: Op - Op to be initialized - * ParseOpcode - Opcode for this node - * - * RETURN: None - * - * DESCRIPTION: Initialize a node with the parse opcode and opcode name. - * - ******************************************************************************/ - -void -TrAmlInitNode ( - ACPI_PARSE_OBJECT *Op, - UINT16 ParseOpcode) -{ - - Op->Asl.ParseOpcode = ParseOpcode; - UtSetParseOpName (Op); -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlSetSubtreeParent - * - * PARAMETERS: Op - First node in a list of peer nodes - * Parent - Parent of the subtree - * - * RETURN: None - * - * DESCRIPTION: Set the parent for all peer nodes in a subtree - * - ******************************************************************************/ - -void -TrAmlSetSubtreeParent ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *Parent) -{ - ACPI_PARSE_OBJECT *Next; - - - Next = Op; - while (Next) - { - Next->Asl.Parent = Parent; - Next = Next->Asl.Next; - } -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlInsertPeer - * - * PARAMETERS: Op - First node in a list of peer nodes - * NewPeer - Peer node to insert - * - * RETURN: None - * - * DESCRIPTION: Insert a new peer node into a list of peers. - * - ******************************************************************************/ - -void -TrAmlInsertPeer ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NewPeer) -{ - - NewPeer->Asl.Next = Op->Asl.Next; - Op->Asl.Next = NewPeer; -} - - -/******************************************************************************* - * - * FUNCTION: TrAmlTransformWalk - * - * PARAMETERS: ASL_WALK_CALLBACK - * - * RETURN: None - * - * DESCRIPTION: Parse tree walk to generate both the AML opcodes and the AML - * operands. - * - ******************************************************************************/ - -ACPI_STATUS -TrAmlTransformWalk ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context) -{ - - TrTransformSubtree (Op); - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: TrTransformSubtree - * - * PARAMETERS: Op - The parent parse node - * - * RETURN: None - * - * DESCRIPTION: Prepare nodes to be output as AML data and operands. The more - * complex AML opcodes require processing of the child nodes - * (arguments/operands). - * - ******************************************************************************/ - -void -TrTransformSubtree ( - ACPI_PARSE_OBJECT *Op) -{ - - if (Op->Asl.AmlOpcode == AML_RAW_DATA_BYTE) - { - return; - } - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - TrDoDefinitionBlock (Op); - break; - - case PARSEOP_ELSEIF: - TrDoElseif (Op); - break; - - case PARSEOP_SWITCH: - TrDoSwitch (Op); - break; - - default: - /* Nothing to do here for other opcodes */ - break; - } -} - - -/******************************************************************************* - * - * FUNCTION: TrDoDefinitionBlock - * - * PARAMETERS: Op - Parse node - * - * RETURN: None - * - * DESCRIPTION: Find the end of the definition block and set a global to this - * node. It is used by the compiler to insert compiler-generated - * names at the root level of the namespace. - * - ******************************************************************************/ - -void -TrDoDefinitionBlock ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Next; - UINT32 i; - - - Next = Op->Asl.Child; - for (i = 0; i < 5; i++) - { - Next = Next->Asl.Next; - } - - Gbl_FirstLevelInsertionNode = Next; -} - - -/******************************************************************************* - * - * FUNCTION: TrDoElseif - * - * PARAMETERS: Op - Parse node for ELSEIF - * - * RETURN: None - * - * DESCRIPTION: Transform an Elseif into an Else and If AML opcode - * - ******************************************************************************/ - -void -TrDoElseif ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *IfNode; - - - /* Change the ELSEIF into an ELSE */ - - TrAmlInitNode (Op, PARSEOP_ELSE); - - /* Create a new IF node */ - - IfNode = TrCreateLeafNode (PARSEOP_IF); - IfNode->Asl.Parent = Op; - TrAmlInitLineNumbers (IfNode, Op); - - /* Insert the the IF node first in the ELSE child list */ - - IfNode->Asl.Child = Op->Asl.Child; - Op->Asl.Child = IfNode; - - TrAmlSetSubtreeParent (IfNode->Asl.Child, IfNode); -} - - -/******************************************************************************* - * - * FUNCTION: TrDoSwitch - * - * PARAMETERS: StartNode - Parse node for SWITCH - * - * RETURN: None - * - * - * DESCRIPTION: Translate ASL SWITCH statement to if/else pairs. There is - * no actual AML opcode for SWITCH -- it must be simulated. - * - ******************************************************************************/ - -void -TrDoSwitch ( - ACPI_PARSE_OBJECT *StartNode) -{ - ACPI_PARSE_OBJECT *Next; - ACPI_PARSE_OBJECT *Case = NULL; - ACPI_PARSE_OBJECT *CaseBlock = NULL; - ACPI_PARSE_OBJECT *Default = NULL; - ACPI_PARSE_OBJECT *CurrentParentNode; - ACPI_PARSE_OBJECT *Conditional = NULL; - ACPI_PARSE_OBJECT *Predicate; - ACPI_PARSE_OBJECT *Peer; - ACPI_PARSE_OBJECT *NewOp; - ACPI_PARSE_OBJECT *NewOp2; - char *PredicateValueName; - char *PredicateValuePath; - - - CurrentParentNode = StartNode; - PredicateValueName = TrAmlGetNextTempName (&PredicateValuePath); - - /* First child is the predicate */ - - Next = StartNode->Asl.Child; - Peer = Next->Asl.Next; - - /* CASE statements start at next child */ - - while (Peer) - { - Next = Peer; - Peer = Next->Asl.Next; - - if (Next->Asl.ParseOpcode == PARSEOP_CASE) - { - if (Case) - { - /* Add an ELSE to complete the previous CASE */ - - NewOp = TrCreateLeafNode (PARSEOP_ELSE); - NewOp->Asl.Parent = Conditional->Asl.Parent; - TrAmlInitLineNumbers (NewOp, NewOp->Asl.Parent); - - /* Link ELSE node as a peer to the previous IF */ - - TrAmlInsertPeer (Conditional, NewOp); - CurrentParentNode = NewOp; - } - - Case = Next; - Conditional = Case; - CaseBlock = Case->Asl.Child->Asl.Next; - Conditional->Asl.Child->Asl.Next = NULL; - - /* - * change Case() to: If (PredicateValue == CaseValue) {...} - * Case->Child is the case value - * Case->Child->Peer is the beginning of the case block - */ - NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, - (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValuePath)); - - Predicate = Case->Asl.Child; - Predicate->Asl.Next = NewOp; - TrAmlInitLineNumbers (NewOp, Predicate); - - NewOp2 = TrCreateLeafNode (PARSEOP_LEQUAL); - NewOp2->Asl.Parent = Conditional; - NewOp2->Asl.Child = Predicate; - TrAmlInitLineNumbers (NewOp2, Conditional); - - TrAmlSetSubtreeParent (Predicate, NewOp2); - - Predicate = NewOp2; - Predicate->Asl.Next = CaseBlock; - - TrAmlSetSubtreeParent (Predicate, Conditional); - - /* Reinitialize the CASE node to an IF node */ - - Conditional->Asl.Child = Predicate; - TrAmlInitNode (Conditional, PARSEOP_IF); - - /* - * The first CASE(IF) is not nested under an ELSE. - * All other CASEs are children of a parent ELSE. - */ - if (CurrentParentNode == StartNode) - { - Conditional->Asl.Parent = CurrentParentNode->Asl.Parent; - - /* Link IF into the peer list */ - - TrAmlInsertPeer (CurrentParentNode, Conditional); - } - else - { - /* - * The IF is a child of previous IF/ELSE. It - * is therefore without peer. - */ - CurrentParentNode->Asl.Child = Conditional; - Conditional->Asl.Parent = CurrentParentNode; - Conditional->Asl.Next = NULL; - } - } - else if (Next->Asl.ParseOpcode == PARSEOP_DEFAULT) - { - if (Default) - { - /* More than one Default */ - } - - /* Save the DEFAULT node for later, after CASEs */ - - Default = Next; - } - else - { - /* Unknown peer opcode */ - - printf ("Unknown parse opcode for switch statement: %s (%d)\n", - Next->Asl.ParseOpName, Next->Asl.ParseOpcode); - } - } - - /* - * Add the default at the end of the if/else construct - */ - if (Default) - { - if (Case) - { - /* Add an ELSE first */ - - TrAmlInitNode (Default, PARSEOP_ELSE); - Default->Asl.Parent = Conditional->Asl.Parent; - } - else - { - /* There were no CASE statements, no ELSE needed */ - - TrAmlInsertPeer (CurrentParentNode, Default->Asl.Child); - } - } - - /* - * Add a NAME node for the temp integer - */ - NewOp = TrCreateLeafNode (PARSEOP_NAME); - NewOp->Asl.Parent = Gbl_FirstLevelInsertionNode->Asl.Parent; - - NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, - (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName)); - NewOp->Asl.Child = NewOp2; - NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_INTEGER, (ACPI_INTEGER) 0); - - TrAmlSetSubtreeParent (NewOp2, NewOp); - - /* Insert this node at the global level of the ASL */ - - TrAmlInsertPeer (Gbl_FirstLevelInsertionNode, NewOp); - TrAmlInitLineNumbers (NewOp, Gbl_FirstLevelInsertionNode); - TrAmlInitLineNumbers (NewOp2, Gbl_FirstLevelInsertionNode); - TrAmlInitLineNumbers (NewOp2->Asl.Next, Gbl_FirstLevelInsertionNode); - - /* - * Change the SWITCH node to a STORE (predicate value, _Txx) - */ - TrAmlInitNode (StartNode, PARSEOP_STORE); - - Predicate = StartNode->Asl.Child; - Predicate->Asl.Child = NULL; - - NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, - (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValuePath)); - NewOp->Asl.Parent = StartNode; - Predicate->Asl.Next = NewOp; -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/asltree.c b/sys/dev/acpi/acpica/Subsystem/asltree.c deleted file mode 100644 index 0518303ce3b..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asltree.c +++ /dev/null @@ -1,1182 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asltree - parse tree management - * $Revision: 53 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("asltree") - - -/******************************************************************************* - * - * FUNCTION: TrGetNextNode - * - * PARAMETERS: None - * - * RETURN: New parse node. Aborts on allocation failure - * - * DESCRIPTION: Allocate a new parse node for the parse tree. Bypass the local - * dynamic memory manager for performance reasons (This has a - * major impact on the speed of the compiler.) - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrGetNextNode (void) -{ - - if (Gbl_NodeCacheNext >= Gbl_NodeCacheLast) - { - Gbl_NodeCacheNext = UtLocalCalloc (sizeof (ACPI_PARSE_OBJECT) * ASL_NODE_CACHE_SIZE); - Gbl_NodeCacheLast = Gbl_NodeCacheNext + ASL_NODE_CACHE_SIZE; - } - - return (Gbl_NodeCacheNext++); -} - - -/******************************************************************************* - * - * FUNCTION: TrAllocateNode - * - * PARAMETERS: ParseOpcode - Opcode to be assigned to the node - * - * RETURN: New parse node. Aborts on allocation failure - * - * DESCRIPTION: Allocate and initialize a new parse node for the parse tree - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrAllocateNode ( - UINT32 ParseOpcode) -{ - ACPI_PARSE_OBJECT *Op; - - - Op = TrGetNextNode (); - - Op->Asl.ParseOpcode = (UINT16) ParseOpcode; - Op->Asl.Filename = Gbl_Files[ASL_FILE_INPUT].Filename; - Op->Asl.LineNumber = Gbl_CurrentLineNumber; - Op->Asl.LogicalLineNumber = Gbl_LogicalLineNumber; - Op->Asl.LogicalByteOffset = Gbl_CurrentLineOffset; - Op->Asl.Column = Gbl_CurrentColumn; - - UtSetParseOpName (Op); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrReleaseNode - * - * PARAMETERS: Op - Op to be released - * - * RETURN: None - * - * DESCRIPTION: "release" a node. In truth, nothing is done since the node - * is part of a larger buffer - * - ******************************************************************************/ - -void -TrReleaseNode ( - ACPI_PARSE_OBJECT *Op) -{ - - return; -} - - -/******************************************************************************* - * - * FUNCTION: TrUpdateNode - * - * PARAMETERS: ParseOpcode - New opcode to be assigned to the node - * Op - An existing parse node - * - * RETURN: The updated node - * - * DESCRIPTION: Change the parse opcode assigned to a node. Usually used to - * change an opcode to DEFAULT_ARG so that the node is ignored - * during the code generation. Also used to set generic integers - * to a specific size (8, 16, 32, or 64 bits) - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrUpdateNode ( - UINT32 ParseOpcode, - ACPI_PARSE_OBJECT *Op) -{ - - if (!Op) - { - return NULL; - } - - DbgPrint (ASL_PARSE_OUTPUT, - "\nUpdateNode: Old - %s, New - %s\n\n", - UtGetOpName (Op->Asl.ParseOpcode), - UtGetOpName (ParseOpcode)); - - /* Assign new opcode and name */ - - if (Op->Asl.ParseOpcode == PARSEOP_ONES) - { - switch (ParseOpcode) - { - case PARSEOP_BYTECONST: - Op->Asl.Value.Integer = 0xFF; - break; - - case PARSEOP_WORDCONST: - Op->Asl.Value.Integer = 0xFFFF; - break; - - case PARSEOP_DWORDCONST: - Op->Asl.Value.Integer = 0xFFFFFFFF; - break; - - default: - /* Don't care about others, don't need to check QWORD */ - break; - } - } - - Op->Asl.ParseOpcode = (UINT16) ParseOpcode; - UtSetParseOpName (Op); - - /* - * For the BYTE, WORD, and DWORD constants, make sure that the integer - * that was passed in will actually fit into the data type - */ - switch (ParseOpcode) - { - case PARSEOP_BYTECONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT8_MAX); - break; - - case PARSEOP_WORDCONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT16_MAX); - break; - - case PARSEOP_DWORDCONST: - Op = UtCheckIntegerRange (Op, 0x00, ACPI_UINT32_MAX); - break; - - default: - /* Don't care about others, don't need to check QWORD */ - break; - } - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrGetNodeFlagName - * - * PARAMETERS: Flags - Flags word to be decoded - * - * RETURN: Name string - * - * DESCRIPTION: Decode a flags word - * - ******************************************************************************/ - -char * -TrGetNodeFlagName ( - UINT32 Flags) -{ - - switch (Flags) - { - case NODE_VISITED: - return ("NODE_VISITED"); - - case NODE_AML_PACKAGE: - return ("NODE_AML_PACKAGE"); - - case NODE_IS_TARGET: - return ("NODE_IS_TARGET"); - - case NODE_IS_RESOURCE_DESC: - return ("NODE_IS_RESOURCE_DESC"); - - case NODE_IS_RESOURCE_FIELD: - return ("NODE_IS_RESOURCE_FIELD"); - - case NODE_HAS_NO_EXIT: - return ("NODE_HAS_NO_EXIT"); - - case NODE_IF_HAS_NO_EXIT: - return ("NODE_IF_HAS_NO_EXIT"); - - case NODE_NAME_INTERNALIZED: - return ("NODE_NAME_INTERNALIZED"); - - case NODE_METHOD_NO_RETVAL: - return ("NODE_METHOD_NO_RETVAL"); - - case NODE_METHOD_SOME_NO_RETVAL: - return ("NODE_METHOD_SOME_NO_RETVAL"); - - case NODE_RESULT_NOT_USED: - return ("NODE_RESULT_NOT_USED"); - - case NODE_METHOD_TYPED: - return ("NODE_METHOD_TYPED"); - - case NODE_IS_BIT_OFFSET: - return ("NODE_IS_BIT_OFFSET"); - - case NODE_COMPILE_TIME_CONST: - return ("NODE_COMPILE_TIME_CONST"); - - case NODE_IS_TERM_ARG: - return ("NODE_IS_TERM_ARG"); - - case NODE_WAS_ONES_OP: - return ("NODE_WAS_ONES_OP"); - - case NODE_IS_NAME_DECLARATION: - return ("NODE_IS_NAME_DECLARATION"); - - default: - return ("Multiple Flags (or unknown flag) set"); - } -} - - -/******************************************************************************* - * - * FUNCTION: TrSetNodeFlags - * - * PARAMETERS: Op - An existing parse node - * Flags - New flags word - * - * RETURN: The updated node - * - * DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrSetNodeFlags ( - ACPI_PARSE_OBJECT *Op, - UINT32 Flags) -{ - - DbgPrint (ASL_PARSE_OUTPUT, - "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags, TrGetNodeFlagName (Flags)); - - if (!Op) - { - return NULL; - } - - Op->Asl.CompileFlags |= Flags; - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrSetEndLineNumber - * - * PARAMETERS: Op - An existing parse node - * - * RETURN: None. - * - * DESCRIPTION: Set the ending line numbers (file line and logical line) of a - * parse node to the current line numbers. - * - ******************************************************************************/ - -void -TrSetEndLineNumber ( - ACPI_PARSE_OBJECT *Op) -{ - - /* If the end line # is already set, just return */ - - if (Op->Asl.EndLine) - { - return; - } - - Op->Asl.EndLine = Gbl_CurrentLineNumber; - Op->Asl.EndLogicalLine = Gbl_LogicalLineNumber; -} - - -/******************************************************************************* - * - * FUNCTION: TrCreateLeafNode - * - * PARAMETERS: ParseOpcode - New opcode to be assigned to the node - * - * RETURN: Pointer to the new node. Aborts on allocation failure - * - * DESCRIPTION: Create a simple leaf node (no children or peers, and no value - * assigned to the node) - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrCreateLeafNode ( - UINT32 ParseOpcode) -{ - ACPI_PARSE_OBJECT *Op; - - - Op = TrAllocateNode (ParseOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateLeafNode Line %d NewNode %p Op %s\n\n", - Op->Asl.LineNumber, Op, UtGetOpName(ParseOpcode)); - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrCreateValuedLeafNode - * - * PARAMETERS: ParseOpcode - New opcode to be assigned to the node - * Value - Value to be assigned to the node - * - * RETURN: Pointer to the new node. Aborts on allocation failure - * - * DESCRIPTION: Create a leaf node (no children or peers) with a value - * assigned to it - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrCreateValuedLeafNode ( - UINT32 ParseOpcode, - ACPI_INTEGER Value) -{ - ACPI_PARSE_OBJECT *Op; - - - Op = TrAllocateNode (ParseOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateValuedLeafNode Line %d NewNode %p Op %s Value %8.8X%8.8X ", - Op->Asl.LineNumber, Op, UtGetOpName(ParseOpcode), - ACPI_HIDWORD (Value), ACPI_LODWORD (Value)); - Op->Asl.Value.Integer = Value; - - switch (ParseOpcode) - { - case PARSEOP_STRING_LITERAL: - DbgPrint (ASL_PARSE_OUTPUT, "STRING->%s", Value); - break; - - case PARSEOP_NAMESEG: - DbgPrint (ASL_PARSE_OUTPUT, "NAMESEG->%s", Value); - break; - - case PARSEOP_NAMESTRING: - DbgPrint (ASL_PARSE_OUTPUT, "NAMESTRING->%s", Value); - break; - - case PARSEOP_EISAID: - DbgPrint (ASL_PARSE_OUTPUT, "EISAID->%s", Value); - break; - - case PARSEOP_METHOD: - DbgPrint (ASL_PARSE_OUTPUT, "METHOD"); - break; - - case PARSEOP_INTEGER: - DbgPrint (ASL_PARSE_OUTPUT, "INTEGER"); - break; - - default: - break; - } - - DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrCreateNode - * - * PARAMETERS: ParseOpcode - Opcode to be assigned to the node - * NumChildren - Number of children to follow - * ... - A list of child nodes to link to the new - * node. NumChildren long. - * - * RETURN: Pointer to the new node. Aborts on allocation failure - * - * DESCRIPTION: Create a new parse node and link together a list of child - * nodes underneath the new node. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrCreateNode ( - UINT32 ParseOpcode, - UINT32 NumChildren, - ...) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_PARSE_OBJECT *Child; - ACPI_PARSE_OBJECT *PrevChild; - va_list ap; - UINT32 i; - BOOLEAN FirstChild; - - - va_start (ap, NumChildren); - - /* Allocate one new node */ - - Op = TrAllocateNode (ParseOpcode); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nCreateNode Line %d NewParent %p Child %d Op %s ", - Op->Asl.LineNumber, Op, NumChildren, UtGetOpName(ParseOpcode)); - - /* Some extra debug output based on the parse opcode */ - - switch (ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - RootNode = Op; - DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->"); - break; - - case PARSEOP_OPERATIONREGION: - DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->"); - break; - - case PARSEOP_OR: - DbgPrint (ASL_PARSE_OUTPUT, "OR->"); - break; - - default: - /* Nothing to do for other opcodes */ - break; - } - - /* Link the new node to its children */ - - PrevChild = NULL; - FirstChild = TRUE; - for (i = 0; i < NumChildren; i++) - { - /* Get the next child */ - - Child = va_arg (ap, ACPI_PARSE_OBJECT *); - DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); - - /* - * If child is NULL, this means that an optional argument - * was omitted. We must create a placeholder with a special - * opcode (DEFAULT_ARG) so that the code generator will know - * that it must emit the correct default for this argument - */ - if (!Child) - { - Child = TrAllocateNode (PARSEOP_DEFAULT_ARG); - } - - /* Link first child to parent */ - - if (FirstChild) - { - FirstChild = FALSE; - Op->Asl.Child = Child; - } - - /* Point all children to parent */ - - Child->Asl.Parent = Op; - - /* Link children in a peer list */ - - if (PrevChild) - { - PrevChild->Asl.Next = Child; - }; - - /* - * This child might be a list, point all nodes in the list - * to the same parent - */ - while (Child->Asl.Next) - { - Child = Child->Asl.Next; - Child->Asl.Parent = Op; - } - - PrevChild = Child; - } - va_end(ap); - - DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkChildren - * - * PARAMETERS: Op - An existing parse node - * NumChildren - Number of children to follow - * ... - A list of child nodes to link to the new - * node. NumChildren long. - * - * RETURN: The updated (linked) node - * - * DESCRIPTION: Link a group of nodes to an existing parse node - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkChildren ( - ACPI_PARSE_OBJECT *Op, - UINT32 NumChildren, - ...) -{ - ACPI_PARSE_OBJECT *Child; - ACPI_PARSE_OBJECT *PrevChild; - va_list ap; - UINT32 i; - BOOLEAN FirstChild; - - - va_start (ap, NumChildren); - - - TrSetEndLineNumber (Op); - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkChildren Line [%d to %d] NewParent %p Child %d Op %s ", - Op->Asl.LineNumber, Op->Asl.EndLine, - Op, NumChildren, UtGetOpName(Op->Asl.ParseOpcode)); - - switch (Op->Asl.ParseOpcode) - { - case PARSEOP_DEFINITIONBLOCK: - RootNode = Op; - DbgPrint (ASL_PARSE_OUTPUT, "DEFINITION_BLOCK (Tree Completed)->"); - break; - - case PARSEOP_OPERATIONREGION: - DbgPrint (ASL_PARSE_OUTPUT, "OPREGION->"); - break; - - case PARSEOP_OR: - DbgPrint (ASL_PARSE_OUTPUT, "OR->"); - break; - - default: - /* Nothing to do for other opcodes */ - break; - } - - /* Link the new node to it's children */ - - PrevChild = NULL; - FirstChild = TRUE; - for (i = 0; i < NumChildren; i++) - { - Child = va_arg (ap, ACPI_PARSE_OBJECT *); - - if ((Child == PrevChild) && (Child != NULL)) - { - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child, "Child node list invalid"); - return Op; - } - - DbgPrint (ASL_PARSE_OUTPUT, "%p, ", Child); - - /* - * If child is NULL, this means that an optional argument - * was omitted. We must create a placeholder with a special - * opcode (DEFAULT_ARG) so that the code generator will know - * that it must emit the correct default for this argument - */ - if (!Child) - { - Child = TrAllocateNode (PARSEOP_DEFAULT_ARG); - } - - /* Link first child to parent */ - - if (FirstChild) - { - FirstChild = FALSE; - Op->Asl.Child = Child; - } - - /* Point all children to parent */ - - Child->Asl.Parent = Op; - - /* Link children in a peer list */ - - if (PrevChild) - { - PrevChild->Asl.Next = Child; - }; - - /* - * This child might be a list, point all nodes in the list - * to the same parent - */ - while (Child->Asl.Next) - { - Child = Child->Asl.Next; - Child->Asl.Parent = Op; - } - PrevChild = Child; - } - va_end(ap); - - DbgPrint (ASL_PARSE_OUTPUT, "\n\n"); - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkPeerNode - * - * PARAMETERS: Op1 - First peer - * Op2 - Second peer - * - * RETURN: Op1 or the non-null node. - * - * DESCRIPTION: Link two nodes as peers. Handles cases where one peer is null. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkPeerNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2) -{ - ACPI_PARSE_OBJECT *Next; - - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkPeerNode: 1=%p (%s), 2=%p (%s)\n\n", - Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode) : NULL, - Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode) : NULL); - - - if ((!Op1) && (!Op2)) - { - DbgPrint (ASL_PARSE_OUTPUT, "\nTwo Null nodes!\n"); - return Op1; - } - - /* If one of the nodes is null, just return the non-null node */ - - if (!Op2) - { - return Op1; - } - - if (!Op1) - { - return Op2; - } - - if (Op1 == Op2) - { - DbgPrint (ASL_DEBUG_OUTPUT, - "\n\n************* Internal error, linking node to itself %p\n\n\n", Op1); - AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op1, "Linking node to itself"); - return Op1; - } - - Op1->Asl.Parent = Op2->Asl.Parent; - - /* - * Op 1 may already have a peer list (such as an IF/ELSE pair), - * so we must walk to the end of the list and attach the new - * peer at the end - */ - Next = Op1; - while (Next->Asl.Next) - { - Next = Next->Asl.Next; - } - - Next->Asl.Next = Op2; - return Op1; -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkPeerNodes - * - * PARAMETERS: NumPeers - The number of nodes in the list to follow - * ... - A list of nodes to link together as peers - * - * RETURN: The first node in the list (head of the peer list) - * - * DESCRIPTION: Link together an arbitrary number of peer nodes. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkPeerNodes ( - UINT32 NumPeers, - ...) -{ - ACPI_PARSE_OBJECT *This; - ACPI_PARSE_OBJECT *Next; - va_list ap; - UINT32 i; - ACPI_PARSE_OBJECT *Start; - - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkPeerNodes: (%d) ", NumPeers); - - va_start (ap, NumPeers); - This = va_arg (ap, ACPI_PARSE_OBJECT *); - Start = This; - - /* - * Link all peers - */ - for (i = 0; i < (NumPeers -1); i++) - { - DbgPrint (ASL_PARSE_OUTPUT, "%d=%p ", (i+1), This); - - while (This->Asl.Next) - { - This = This->Asl.Next; - } - - /* Get another peer node */ - - Next = va_arg (ap, ACPI_PARSE_OBJECT *); - if (!Next) - { - Next = TrAllocateNode (PARSEOP_DEFAULT_ARG); - } - - /* link new node to the current node */ - - This->Asl.Next = Next; - This = Next; - } - - DbgPrint (ASL_PARSE_OUTPUT,"\n\n"); - return (Start); -} - - -/******************************************************************************* - * - * FUNCTION: TrLinkChildNode - * - * PARAMETERS: Op1 - Parent node - * Op2 - Op to become a child - * - * RETURN: The parent node - * - * DESCRIPTION: Link two nodes together as a parent and child - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -TrLinkChildNode ( - ACPI_PARSE_OBJECT *Op1, - ACPI_PARSE_OBJECT *Op2) -{ - ACPI_PARSE_OBJECT *Next; - - - DbgPrint (ASL_PARSE_OUTPUT, - "\nLinkChildNode: Parent=%p (%s), Child=%p (%s)\n\n", - Op1, Op1 ? UtGetOpName(Op1->Asl.ParseOpcode): NULL, - Op2, Op2 ? UtGetOpName(Op2->Asl.ParseOpcode): NULL); - - if (!Op1 || !Op2) - { - return Op1; - } - - Op1->Asl.Child = Op2; - - /* Set the child and all peers of the child to point to the parent */ - - Next = Op2; - while (Next) - { - Next->Asl.Parent = Op1; - Next = Next->Asl.Next; - } - - return Op1; -} - - -/******************************************************************************* - * - * FUNCTION: TrWalkParseTree - * - * PARAMETERS: Visitation - Type of walk - * DescendingCallback - Called during tree descent - * AscendingCallback - Called during tree ascent - * Context - To be passed to the callbacks - * - * RETURN: Status from callback(s) - * - * DESCRIPTION: Walk the entire parse tree. - * - ******************************************************************************/ - -ACPI_STATUS -TrWalkParseTree ( - ACPI_PARSE_OBJECT *Op, - UINT32 Visitation, - ASL_WALK_CALLBACK DescendingCallback, - ASL_WALK_CALLBACK AscendingCallback, - void *Context) -{ - UINT32 Level; - BOOLEAN NodePreviouslyVisited; - ACPI_PARSE_OBJECT *StartOp = Op; - ACPI_STATUS Status; - - - if (!RootNode) - { - return (AE_OK); - } - - Level = 0; - NodePreviouslyVisited = FALSE; - - switch (Visitation) - { - case ASL_WALK_VISIT_DOWNWARD: - - while (Op) - { - if (!NodePreviouslyVisited) - { - /* - * Let the callback process the node. - */ - Status = DescendingCallback (Op, Level, Context); - if (ACPI_SUCCESS (Status)) - { - /* Visit children first, once */ - - if (Op->Asl.Child) - { - Level++; - Op = Op->Asl.Child; - continue; - } - } - else if (Status != AE_CTRL_DEPTH) - { - /* Exit immediately on any error */ - - return (Status); - } - } - - /* Terminate walk at start op */ - - if (Op == StartOp) - { - break; - } - - /* No more children, visit peers */ - - if (Op->Asl.Next) - { - Op = Op->Asl.Next; - NodePreviouslyVisited = FALSE; - } - else - { - /* No children or peers, re-visit parent */ - - if (Level != 0 ) - { - Level--; - } - Op = Op->Asl.Parent; - NodePreviouslyVisited = TRUE; - } - } - break; - - - case ASL_WALK_VISIT_UPWARD: - - while (Op) - { - /* Visit leaf node (no children) or parent node on return trip */ - - if ((!Op->Asl.Child) || - (NodePreviouslyVisited)) - { - /* - * Let the callback process the node. - * - */ - Status = AscendingCallback (Op, Level, Context); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else - { - /* Visit children first, once */ - - Level++; - Op = Op->Asl.Child; - continue; - } - - /* Terminate walk at start op */ - - if (Op == StartOp) - { - break; - } - - /* No more children, visit peers */ - - if (Op->Asl.Next) - { - Op = Op->Asl.Next; - NodePreviouslyVisited = FALSE; - } - else - { - /* No children or peers, re-visit parent */ - - if (Level != 0 ) - { - Level--; - } - Op = Op->Asl.Parent; - NodePreviouslyVisited = TRUE; - } - } - break; - - - case ASL_WALK_VISIT_TWICE: - - while (Op) - { - if (NodePreviouslyVisited) - { - Status = AscendingCallback (Op, Level, Context); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - } - else - { - /* - * Let the callback process the node. - */ - Status = DescendingCallback (Op, Level, Context); - if (ACPI_SUCCESS (Status)) - { - /* Visit children first, once */ - - if (Op->Asl.Child) - { - Level++; - Op = Op->Asl.Child; - continue; - } - } - else if (Status != AE_CTRL_DEPTH) - { - /* Exit immediately on any error */ - - return (Status); - } - } - - /* Terminate walk at start op */ - - if (Op == StartOp) - { - break; - } - - /* No more children, visit peers */ - - if (Op->Asl.Next) - { - Op = Op->Asl.Next; - NodePreviouslyVisited = FALSE; - } - else - { - /* No children or peers, re-visit parent */ - - if (Level != 0 ) - { - Level--; - } - Op = Op->Asl.Parent; - NodePreviouslyVisited = TRUE; - } - } - break; - - default: - /* No other types supported */ - break; - } - - /* If we get here, the walk completed with no errors */ - - return (AE_OK); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/asltypes.h b/sys/dev/acpi/acpica/Subsystem/asltypes.h deleted file mode 100644 index 8881ba506ab..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asltypes.h +++ /dev/null @@ -1,496 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asltypes.h - compiler data types and struct definitions - * $Revision: 59 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#ifndef __ASLTYPES_H -#define __ASLTYPES_H - - -#include <time.h> - - -/******************************************************************************* - * - * Structure definitions - * - ******************************************************************************/ - - -/* Op flags for the ACPI_PARSE_OBJECT */ - -#define NODE_VISITED 0x00000001 -#define NODE_AML_PACKAGE 0x00000002 -#define NODE_IS_TARGET 0x00000004 -#define NODE_IS_RESOURCE_DESC 0x00000008 -#define NODE_IS_RESOURCE_FIELD 0x00000010 -#define NODE_HAS_NO_EXIT 0x00000020 -#define NODE_IF_HAS_NO_EXIT 0x00000040 -#define NODE_NAME_INTERNALIZED 0x00000080 -#define NODE_METHOD_NO_RETVAL 0x00000100 -#define NODE_METHOD_SOME_NO_RETVAL 0x00000200 -#define NODE_RESULT_NOT_USED 0x00000400 -#define NODE_METHOD_TYPED 0x00000800 -#define NODE_IS_BIT_OFFSET 0x00001000 -#define NODE_COMPILE_TIME_CONST 0x00002000 -#define NODE_IS_TERM_ARG 0x00004000 -#define NODE_WAS_ONES_OP 0x00008000 -#define NODE_IS_NAME_DECLARATION 0x00010000 - -/* Keeps information about individual control methods */ - -typedef struct asl_method_info -{ - UINT8 NumArguments; - UINT8 LocalInitialized[ACPI_METHOD_NUM_LOCALS]; - UINT8 ArgInitialized[ACPI_METHOD_NUM_ARGS]; - UINT32 NumReturnNoValue; - UINT32 NumReturnWithValue; - ACPI_PARSE_OBJECT *Op; - struct asl_method_info *Next; - UINT8 HasBeenTyped; - -} ASL_METHOD_INFO; - - -/* Parse tree walk info for control method analysis */ - -typedef struct asl_analysis_walk_info -{ - ASL_METHOD_INFO *MethodStack; - -} ASL_ANALYSIS_WALK_INFO; - - -/* An entry in the ParseOpcode to AmlOpcode mapping table */ - -typedef struct asl_mapping_entry -{ - UINT32 Value; - UINT32 AcpiBtype; /* Object type or return type */ - UINT16 AmlOpcode; - UINT8 Flags; - -} ASL_MAPPING_ENTRY; - - -/* An entry in the Reserved Name information table */ - -#define ASL_RSVD_RETURN_VALUE 0x01 -#define ASL_RSVD_RESOURCE_NAME 0x02 -#define ASL_RSVD_SCOPE 0x04 - -typedef struct asl_reserved_info -{ - char *Name; - UINT8 NumArguments; - UINT8 Flags; - -} ASL_RESERVED_INFO; - - -/* Parse tree walk info structure */ - -typedef struct asl_walk_info -{ - ACPI_PARSE_OBJECT **NodePtr; - UINT32 *LevelPtr; - -} ASL_WALK_INFO; - - -/* File info */ - -typedef struct asl_file_info -{ - FILE *Handle; - char *Filename; - -} ASL_FILE_INFO; - - -/* File types */ - -typedef enum -{ - ASL_FILE_STDOUT = 0, - ASL_FILE_STDERR, - ASL_FILE_INPUT, - ASL_FILE_AML_OUTPUT, - ASL_FILE_SOURCE_OUTPUT, - ASL_FILE_LISTING_OUTPUT, - ASL_FILE_HEX_OUTPUT, - ASL_FILE_NAMESPACE_OUTPUT, - ASL_FILE_DEBUG_OUTPUT, - ASL_FILE_ASM_SOURCE_OUTPUT, - ASL_FILE_C_SOURCE_OUTPUT, - ASL_FILE_ASM_INCLUDE_OUTPUT, - ASL_FILE_C_INCLUDE_OUTPUT - -} ASL_FILE_TYPES; - - -#define ASL_MAX_FILE_TYPE 12 -#define ASL_NUM_FILES (ASL_MAX_FILE_TYPE + 1) - - -/* An entry in the exception list, one for each error/warning */ - -typedef struct asl_error_msg -{ - UINT32 LineNumber; - UINT32 LogicalLineNumber; - UINT32 LogicalByteOffset; - UINT32 Column; - char *Message; - struct asl_error_msg *Next; - char *Filename; - UINT32 FilenameLength; - UINT8 MessageId; - UINT8 Level; - -} ASL_ERROR_MSG; - - -/* An entry in the listing file stack (for include files) */ - -typedef struct asl_listing_node -{ - char *Filename; - UINT32 LineNumber; - struct asl_listing_node *Next; - -} ASL_LISTING_NODE; - - -/* Callback interface for a parse tree walk */ - -typedef -ACPI_STATUS (*ASL_WALK_CALLBACK) ( - ACPI_PARSE_OBJECT *Op, - UINT32 Level, - void *Context); - - -typedef struct asl_event_info -{ - time_t StartTime; - time_t EndTime; - char *EventName; - BOOLEAN Valid; - -} ASL_EVENT_INFO; - - -#define ASL_ERROR 0 -#define ASL_WARNING 1 -#define ASL_REMARK 2 -#define ASL_OPTIMIZATION 3 -#define ASL_NUM_REPORT_LEVELS 4 - - -typedef enum -{ - ASL_MSG_NULL = 0, - ASL_MSG_MEMORY_ALLOCATION, - ASL_MSG_INPUT_FILE_OPEN, - ASL_MSG_OUTPUT_FILENAME, - ASL_MSG_OUTPUT_FILE_OPEN, - ASL_MSG_LISTING_FILENAME, - ASL_MSG_LISTING_FILE_OPEN, - ASL_MSG_DEBUG_FILENAME, - ASL_MSG_DEBUG_FILE_OPEN, - ASL_MSG_INCLUDE_FILE_OPEN, - ASL_MSG_ENCODING_LENGTH, - ASL_MSG_INVALID_PRIORITY, - ASL_MSG_INVALID_PERFORMANCE, - ASL_MSG_LOCAL_INIT, - ASL_MSG_ARG_INIT, - ASL_MSG_UNSUPPORTED, - ASL_MSG_RESERVED_WORD, - ASL_MSG_BUFFER_LENGTH, - ASL_MSG_PACKAGE_LENGTH, - ASL_MSG_RETURN_TYPES, - ASL_MSG_NOT_FOUND, - ASL_MSG_NOT_REACHABLE, - ASL_MSG_NOT_EXIST, - ASL_MSG_NESTED_COMMENT, - ASL_MSG_RESERVED_ARG_COUNT_HI, - ASL_MSG_RESERVED_ARG_COUNT_LO, - ASL_MSG_RESERVED_RETURN_VALUE, - ASL_MSG_ARG_COUNT_HI, - ASL_MSG_ARG_COUNT_LO, - ASL_MSG_NO_RETVAL, - ASL_MSG_SOME_NO_RETVAL, - ASL_MSG_COMPILER_INTERNAL, - ASL_MSG_BACKWARDS_OFFSET, - ASL_MSG_UNKNOWN_RESERVED_NAME, - ASL_MSG_NAME_EXISTS, - ASL_MSG_INVALID_TYPE, - ASL_MSG_MULTIPLE_TYPES, - ASL_MSG_SYNTAX, - ASL_MSG_NOT_METHOD, - ASL_MSG_LONG_LINE, - ASL_MSG_RECURSION, - ASL_MSG_NOT_PARAMETER, - ASL_MSG_OPEN, - ASL_MSG_READ, - ASL_MSG_WRITE, - ASL_MSG_SEEK, - ASL_MSG_CLOSE, - ASL_MSG_FIELD_ACCESS_WIDTH, - ASL_MSG_REGION_BYTE_ACCESS, - ASL_MSG_REGION_BUFFER_ACCESS, - ASL_MSG_FIELD_UNIT_OFFSET, - ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, - ASL_MSG_RESOURCE_FIELD, - ASL_MSG_BYTES_TO_BITS, - ASL_MSG_BITS_TO_BYTES, - ASL_MSG_AML_NOT_IMPLEMENTED, - ASL_MSG_NO_WHILE, - ASL_MSG_INVALID_ESCAPE, - ASL_MSG_INVALID_STRING, - ASL_MSG_TABLE_SIGNATURE, - ASL_MSG_RESOURCE_LIST, - ASL_MSG_INVALID_TARGET, - ASL_MSG_INVALID_CONSTANT_OP, - ASL_MSG_CONSTANT_EVALUATION, - ASL_MSG_CONSTANT_FOLDED, - ASL_MSG_INVALID_EISAID, - ASL_MSG_RESERVED_OPERAND_TYPE, - ASL_MSG_RESERVED_METHOD, - ASL_MSG_ALPHANUMERIC_STRING, - ASL_MSG_RESERVED_USE, - ASL_MSG_INVALID_OPERAND, - ASL_MSG_MISSING_ENDDEPENDENT, - ASL_MSG_MISSING_STARTDEPENDENT, - ASL_MSG_DEPENDENT_NESTING, - ASL_MSG_NAME_OPTIMIZATION, - ASL_MSG_SINGLE_NAME_OPTIMIZATION, - ASL_MSG_INTEGER_OPTIMIZATION, - ASL_MSG_SCOPE_TYPE, - ASL_MSG_CORE_EXCEPTION, - ASL_MSG_UNREACHABLE_CODE, - ASL_MSG_EARLY_EOF, - ASL_MSG_SCOPE_FWD_REF - -} ASL_MESSAGE_IDS; - -#ifdef ASL_EXCEPTIONS - -char *AslMessages [] = { -/* ASL_MSG_NULL */ NULL, -/* ASL_MSG_MEMORY_ALLOCATION, */ "Memory allocation failure", -/* ASL_MSG_INPUT_FILE_OPEN, */ "Could not open input file", -/* ASL_MSG_OUTPUT_FILENAME, */ "Could not create output filename", -/* ASL_MSG_OUTPUT_FILE_OPEN, */ "Could not open output AML file", -/* ASL_MSG_LISTING_FILENAME, */ "Could not create listing filename", -/* ASL_MSG_LISTING_FILE_OPEN, */ "Could not open listing file", -/* ASL_MSG_DEBUG_FILENAME, */ "Could not create debug filename", -/* ASL_MSG_DEBUG_FILE_OPEN, */ "Could not open debug file", -/* ASL_MSG_INCLUDE_FILE_OPEN, */ "Could not open include file", -/* ASL_MSG_ENCODING_LENGTH, */ "Package length too long to encode", -/* ASL_MSG_INVALID_PRIORITY, */ "Invalid priority value", -/* ASL_MSG_INVALID_PERFORMANCE, */ "Invalid performance/robustness value", -/* ASL_MSG_LOCAL_INIT, */ "Method local variable is not initialized", -/* ASL_MSG_ARG_INIT, */ "Method argument is not initialized", -/* ASL_MSG_UNSUPPORTED, */ "Unsupported feature", -/* ASL_MSG_RESERVED_WORD, */ "Use of reserved word", -/* ASL_MSG_BUFFER_LENGTH, */ "Effective AML buffer length is zero", -/* ASL_MSG_PACKAGE_LENGTH, */ "Effective AML package length is zero", -/* ASL_MSG_RETURN_TYPES, */ "Not all control paths return a value", -/* ASL_MSG_NOT_FOUND, */ "Object not found or not accessible from scope", -/* ASL_MSG_NOT_REACHABLE, */ "Object not accessible from this scope", -/* ASL_MSG_NOT_EXIST, */ "Object does not exist", -/* ASL_MSG_NESTED_COMMENT, */ "Nested comment found", -/* ASL_MSG_RESERVED_ARG_COUNT_HI, */ "Reserved method has too many arguments", -/* ASL_MSG_RESERVED_ARG_COUNT_LO, */ "Reserved method has too few arguments", -/* ASL_MSG_RESERVED_RETURN_VALUE, */ "Reserved method must return a value", -/* ASL_MSG_ARG_COUNT_HI, */ "Too many arguments", -/* ASL_MSG_ARG_COUNT_LO, */ "Too few arguments", -/* ASL_MSG_NO_RETVAL, */ "Called method returns no value", -/* ASL_MSG_SOME_NO_RETVAL, */ "Called method may not always return a value", -/* ASL_MSG_COMPILER_INTERNAL, */ "Internal compiler error", -/* ASL_MSG_BACKWARDS_OFFSET, */ "Invalid backwards offset", -/* ASL_MSG_UNKNOWN_RESERVED_NAME, */ "Unknown reserved name", -/* ASL_MSG_NAME_EXISTS, */ "Name already exists in scope", -/* ASL_MSG_INVALID_TYPE, */ "Invalid type", -/* ASL_MSG_MULTIPLE_TYPES, */ "Multiple types", -/* ASL_MSG_SYNTAX, */ "", -/* ASL_MSG_NOT_METHOD, */ "Not a control method, cannot invoke", -/* ASL_MSG_LONG_LINE, */ "Splitting long input line", -/* ASL_MSG_RECURSION, */ "Recursive method call", -/* ASL_MSG_NOT_PARAMETER, */ "Not a parameter, used as local only", -/* ASL_MSG_OPEN, */ "Could not open file", -/* ASL_MSG_READ, */ "Could not read file", -/* ASL_MSG_WRITE, */ "Could not write file", -/* ASL_MSG_SEEK, */ "Could not seek file", -/* ASL_MSG_CLOSE, */ "Could not close file", -/* ASL_MSG_FIELD_ACCESS_WIDTH, */ "Access width is greater than region size", -/* ASL_MSG_REGION_BYTE_ACCESS, */ "Host Operation Region requires ByteAcc access", -/* ASL_MSG_REGION_BUFFER_ACCESS, */ "Host Operation Region requires BufferAcc access", -/* ASL_MSG_FIELD_UNIT_OFFSET, */ "Field Unit extends beyond region limit", -/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, */ "Access width of Field Unit extends beyond region limit", -/* ASL_MSG_RESOURCE_FIELD, */ "Resource field name cannot be used as a target", -/* ASL_MSG_BYTES_TO_BITS, */ "Field offset is in bytes, but a bit offset is required", -/* ASL_MSG_BITS_TO_BYTES, */ "Field offset is in bits, but a byte offset is required", -/* ASL_MSG_AML_NOT_IMPLEMENTED, */ "Opcode is not implemented in compiler AML code generator", -/* ASL_MSG_NO_WHILE, */ "No enclosing While statement", -/* ASL_MSG_INVALID_ESCAPE, */ "Invalid or unknown escape sequence", -/* ASL_MSG_INVALID_STRING, */ "Invalid Hex/Octal Escape - Non-ASCII or NULL", -/* ASL_MSG_TABLE_SIGNATURE, */ "Invalid Table Signature", -/* ASL_MSG_RESOURCE_LIST, */ "Too many resource items (internal error)", -/* ASL_MSG_INVALID_TARGET, */ "Target operand not allowed in constant expression", -/* ASL_MSG_INVALID_CONSTANT_OP, */ "Invalid operator in constant expression (not type 3/4/5)", -/* ASL_MSG_CONSTANT_EVALUATION, */ "Could not evaluate constant expression", -/* ASL_MSG_CONSTANT_FOLDED, */ "Constant expression evaluated and reduced", -/* ASL_MSG_INVALID_EISAID, */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)", -/* ASL_MSG_RESERVED_OPERAND_TYPE, */ "Invalid operand type for reserved name, must be", -/* ASL_MSG_RESERVED_METHOD, */ "Reserved name must be a control method", -/* ASL_MSG_ALPHANUMERIC_STRING, */ "String must be entirely alphanumeric", -/* ASL_MSG_RESERVED_USE, */ "Invalid use of reserved name", -/* ASL_MSG_INVALID_OPERAND, */ "Invalid operand", -/* ASL_MSG_MISSING_ENDDEPENDENT, */ "Missing EndDependentFn() macro in dependent resource list", -/* ASL_MSG_MISSING_STARTDEPENDENT, */ "Missing StartDependentFn() macro in dependent resource list", -/* ASL_MSG_DEPENDENT_NESTING, */ "Dependent function macros cannot be nested",\ -/* ASL_MSG_NAME_OPTIMIZATION, */ "NamePath optimized", -/* ASL_MSG_SINGLE_NAME_OPTIMIZATION, */ "NamePath optimized to NameSeg (uses run-time search path)", -/* ASL_MSG_INTEGER_OPTIMIZATION, */ "Integer optimized to single-byte AML opcode", -/* ASL_MSG_SCOPE_TYPE, */ "Existing object has invalid type for Scope operator", -/* ASL_MSG_CORE_EXCEPTION, */ "From ACPI CA Subsystem", -/* ASL_MSG_UNREACHABLE_CODE, */ "Statement is unreachable", -/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached", -/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope() not allowed" -}; - - -char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = { - "Error ", - "Warning ", - "Remark ", - "Optimize" -}; - -#define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */ - -/* Exception counters */ - -UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0}; - -#endif - - -#endif /* __ASLTYPES_H */ diff --git a/sys/dev/acpi/acpica/Subsystem/aslutils.c b/sys/dev/acpi/acpica/Subsystem/aslutils.c deleted file mode 100644 index 0583d1b5aac..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/aslutils.c +++ /dev/null @@ -1,1015 +0,0 @@ - -/****************************************************************************** - * - * Module Name: aslutils -- compiler utilities - * $Revision: 56 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "aslcompiler.h" -#include "aslcompiler.y.h" -#include "acnamesp.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_COMPILER - ACPI_MODULE_NAME ("aslutils") - -#ifdef _USE_BERKELEY_YACC -extern const char * const AslCompilername[]; -static const char * const *yytname = &AslCompilername[255]; -#else -extern const char * const yytname[]; -#endif - - -void -AslOptimizeNamepath ( - char *Buffer) -{ - printf ("NamePath: %s\n", Buffer); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsDisplayConstantOpcodes - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Print AML opcodes that can be used in constant expressions. - * - ******************************************************************************/ - -void -UtDisplayConstantOpcodes ( - void) -{ - UINT32 i; - - printf ("Constant expression opcode information\n\n"); - - for (i = 0; i < sizeof (AcpiGbl_AmlOpInfo) / sizeof (ACPI_OPCODE_INFO); i++) - { - if (AcpiGbl_AmlOpInfo[i].Flags & AML_CONSTANT) - { - printf ("%s\n", AcpiGbl_AmlOpInfo[i].Name); - } - } -} - - -/******************************************************************************* - * - * FUNCTION: UtLocalCalloc - * - * PARAMETERS: Size - Bytes to be allocated - * - * RETURN: Pointer to the allocated memory. Guaranteed to be valid. - * - * DESCRIPTION: Allocate zero-initialized memory. Aborts the compile on an - * allocation failure, on the assumption that nothing more can be - * accomplished. - * - ******************************************************************************/ - -void * -UtLocalCalloc ( - UINT32 Size) -{ - void *Allocated; - - - Allocated = ACPI_MEM_CALLOCATE (Size); - if (!Allocated) - { - AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION, - Gbl_CurrentLineNumber, Gbl_LogicalLineNumber, - Gbl_InputByteCount, Gbl_CurrentColumn, - Gbl_Files[ASL_FILE_INPUT].Filename, NULL); - exit (1); - } - - TotalAllocations++; - TotalAllocated += Size; - return Allocated; -} - - -/******************************************************************************* - * - * FUNCTION: UtBeginEvent - * - * PARAMETERS: Event - Event number (integer index) - * Name - Ascii name of this event - * - * RETURN: None - * - * DESCRIPTION: Saves the current time with this event - * - ******************************************************************************/ - -void -UtBeginEvent ( - UINT32 Event, - char *Name) -{ - - AslGbl_Events[Event].StartTime = (time_t) AcpiOsGetTimer(); - AslGbl_Events[Event].EventName = Name; - AslGbl_Events[Event].Valid = TRUE; -} - - -/******************************************************************************* - * - * FUNCTION: UtEndEvent - * - * PARAMETERS: Event - Event number (integer index) - * - * RETURN: None - * - * DESCRIPTION: Saves the current time (end time) with this event - * - ******************************************************************************/ - -void -UtEndEvent ( - UINT32 Event) -{ - - AslGbl_Events[Event].EndTime = (time_t) AcpiOsGetTimer(); -} - - -/******************************************************************************* - * - * FUNCTION: UtHexCharToValue - * - * PARAMETERS: hc - Hex character in Ascii - * - * RETURN: The binary value of the hex character - * - * DESCRIPTION: Perform ascii-to-hex translation - * - ******************************************************************************/ - -UINT8 -UtHexCharToValue ( - int hc) -{ - - if (hc <= 0x39) - { - return ((UINT8) (hc - 0x30)); - } - - if (hc <= 0x46) - { - return ((UINT8) (hc - 0x37)); - } - - return ((UINT8) (hc - 0x57)); -} - - -/******************************************************************************* - * - * FUNCTION: UtConvertByteToHex - * - * PARAMETERS: RawByte - Binary data - * *Buffer - Pointer to where the hex bytes will be stored - * - * RETURN: Ascii hex byte is stored in Buffer. - * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed - * with "0x" - * - ******************************************************************************/ - -void -UtConvertByteToHex ( - UINT8 RawByte, - UINT8 *Buffer) -{ - - Buffer[0] = '0'; - Buffer[1] = 'x'; - - Buffer[2] = (UINT8) hex[(RawByte >> 4) & 0xF]; - Buffer[3] = (UINT8) hex[RawByte & 0xF]; -} - - -/******************************************************************************* - * - * FUNCTION: UtConvertByteToAsmHex - * - * PARAMETERS: RawByte - Binary data - * *Buffer - Pointer to where the hex bytes will be stored - * - * RETURN: Ascii hex byte is stored in Buffer. - * - * DESCRIPTION: Perform hex-to-ascii translation. The return data is prefixed - * with "0x" - * - ******************************************************************************/ - -void -UtConvertByteToAsmHex ( - UINT8 RawByte, - UINT8 *Buffer) -{ - - Buffer[0] = '0'; - - Buffer[1] = (UINT8) hex[(RawByte >> 4) & 0xF]; - Buffer[2] = (UINT8) hex[RawByte & 0xF]; - Buffer[3] = 'h'; -} - - -/******************************************************************************* - * - * FUNCTION: DbgPrint - * - * PARAMETERS: Fmt - Printf format string - * ... - variable printf list - * - * RETURN: None - * - * DESCRIPTION: Conditional print statement. Prints to stderr only if the - * debug flag is set. - * - ******************************************************************************/ - -void -DbgPrint ( - UINT32 Type, - char *Fmt, - ...) -{ - va_list Args; - - - va_start (Args, Fmt); - - if (!Gbl_DebugFlag) - { - return; - } - - if ((Type == ASL_PARSE_OUTPUT) && - (!(AslCompilerdebug))) - { - return; - } - - (void) vfprintf (stderr, Fmt, Args); - va_end (Args); - return; -} - - -/******************************************************************************* - * - * FUNCTION: UtPrintFormattedName - * - * PARAMETERS: ParseOpcode - Parser keyword ID - * Level - Indentation level - * - * RETURN: None - * - * DESCRIPTION: Print the ascii name of the parse opcode. - * - ******************************************************************************/ - -#define TEXT_OFFSET 10 - -void -UtPrintFormattedName ( - UINT16 ParseOpcode, - UINT32 Level) -{ - - DbgPrint (ASL_TREE_OUTPUT, - "%*s %-16.16s", (3 * Level), " ", - UtGetOpName (ParseOpcode)); - - if (Level < TEXT_OFFSET) - { - DbgPrint (ASL_TREE_OUTPUT, - "%*s", (TEXT_OFFSET - Level) * 3, " "); - } -} - - -/******************************************************************************* - * - * FUNCTION: UtSetParseOpName - * - * PARAMETERS: Op - * - * RETURN: None - * - * DESCRIPTION: Insert the ascii name of the parse opcode - * - ******************************************************************************/ - -void -UtSetParseOpName ( - ACPI_PARSE_OBJECT *Op) -{ - strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), 12); -} - - -/******************************************************************************* - * - * FUNCTION: UtGetOpName - * - * PARAMETERS: ParseOpcode - Parser keyword ID - * - * RETURN: Pointer to the opcode name - * - * DESCRIPTION: Get the ascii name of the parse opcode - * - ******************************************************************************/ - -char * -UtGetOpName ( - UINT32 ParseOpcode) -{ - - /* - * First entries (ASL_YYTNAME_START) in yytname are special reserved names. - * Ignore first 8 characters of the name - */ - return ((char *) yytname [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8); -} - - -/******************************************************************************* - * - * FUNCTION: UtDisplaySummary - * - * PARAMETERS: None - * - * RETURN: None - * - * DESCRIPTION: Display compilation statistics - * - ******************************************************************************/ - -void -UtDisplaySummary ( - UINT32 FileId) -{ - - if (FileId != ASL_FILE_STDOUT) - { - /* Compiler name and version number */ - - FlPrintFile (FileId, "%s version %X [%s]\n", - CompilerId, (UINT32) ACPI_CA_VERSION, __DATE__); - } - - /* Input/Output summary */ - - FlPrintFile (FileId, - "ASL Input: %s - %d lines, %d bytes, %d keywords\n", - Gbl_Files[ASL_FILE_INPUT].Filename, Gbl_CurrentLineNumber, - Gbl_InputByteCount, TotalKeywords); - - /* AML summary */ - - if ((Gbl_ExceptionCount[ASL_ERROR] == 0) || (Gbl_IgnoreErrors)) - { - FlPrintFile (FileId, - "AML Output: %s - %d bytes %d named objects %d executable opcodes\n\n", - Gbl_Files[ASL_FILE_AML_OUTPUT].Filename, Gbl_TableLength, - TotalNamedObjects, TotalExecutableOpcodes); - } - - /* Error summary */ - - FlPrintFile (FileId, - "Compilation complete. %d Errors, %d Warnings, %d Remarks, %d Optimizations\n", - Gbl_ExceptionCount[ASL_ERROR], - Gbl_ExceptionCount[ASL_WARNING], - Gbl_ExceptionCount[ASL_REMARK], - Gbl_ExceptionCount[ASL_OPTIMIZATION]); -} - - -/******************************************************************************* - * - * FUNCTION: UtDisplaySummary - * - * PARAMETERS: Op - Integer parse node - * LowValue - Smallest allowed value - * HighValue - Largest allowed value - * - * RETURN: Op if OK, otherwise NULL - * - * DESCRIPTION: Check integer for an allowable range - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -UtCheckIntegerRange ( - ACPI_PARSE_OBJECT *Op, - UINT32 LowValue, - UINT32 HighValue) -{ - char *ParseError = NULL; - char Buffer[64]; - - - if (!Op) - { - return NULL; - } - - if (Op->Asl.Value.Integer < LowValue) - { - ParseError = "Value below valid range"; - Op->Asl.Value.Integer = LowValue; - } - - if (Op->Asl.Value.Integer > HighValue) - { - ParseError = "Value above valid range"; - Op->Asl.Value.Integer = HighValue; - } - - if (ParseError) - { - sprintf (Buffer, "%s 0x%X-0x%X", ParseError, LowValue, HighValue); - AslCompilererror (Buffer); - - return NULL; - } - - return Op; -} - - -/******************************************************************************* - * - * FUNCTION: UtGetStringBuffer - * - * PARAMETERS: Length - Size of buffer requested - * - * RETURN: Pointer to the buffer. Aborts on allocation failure - * - * DESCRIPTION: Allocate a string buffer. Bypass the local - * dynamic memory manager for performance reasons (This has a - * major impact on the speed of the compiler.) - * - ******************************************************************************/ - -char * -UtGetStringBuffer ( - UINT32 Length) -{ - char *Buffer; - - - if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast) - { - Gbl_StringCacheNext = UtLocalCalloc (ASL_STRING_CACHE_SIZE + Length); - Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE + Length; - } - - Buffer = Gbl_StringCacheNext; - Gbl_StringCacheNext += Length; - - return (Buffer); -} - - -/******************************************************************************* - * - * FUNCTION: UtInternalizeName - * - * PARAMETERS: ExternalName - Name to convert - * ConvertedName - Where the converted name is returned - * - * RETURN: Status - * - * DESCRIPTION: Convert an external (ASL) name to an internal (AML) name - * - ******************************************************************************/ - -ACPI_STATUS -UtInternalizeName ( - char *ExternalName, - char **ConvertedName) -{ - ACPI_NAMESTRING_INFO Info; - ACPI_STATUS Status; - - - if (!ExternalName) - { - return (AE_OK); - } - - /* Get the length of the new internal name */ - - Info.ExternalName = ExternalName; - AcpiNsGetInternalNameLength (&Info); - - /* We need a segment to store the internal name */ - - Info.InternalName = UtGetStringBuffer (Info.Length); - if (!Info.InternalName) - { - return (AE_NO_MEMORY); - } - - /* Build the name */ - - Status = AcpiNsBuildInternalName (&Info); - if (ACPI_FAILURE (Status)) - { - return (Status); - } - - *ConvertedName = Info.InternalName; - return (AE_OK); -} - - -/******************************************************************************* - * - * FUNCTION: UtPadNameWithUnderscores - * - * PARAMETERS: NameSeg - Input nameseg - * PaddedNameSeg - Output padded nameseg - * - * RETURN: Padded nameseg. - * - * DESCRIPTION: Pads a NameSeg with underscores if necessary to form a full - * ACPI_NAME. - * - ******************************************************************************/ - -void -UtPadNameWithUnderscores ( - char *NameSeg, - char *PaddedNameSeg) -{ - UINT32 i; - - - for (i = 0; (i < ACPI_NAME_SIZE); i++) - { - if (*NameSeg) - { - *PaddedNameSeg = *NameSeg; - NameSeg++; - } - else - { - *PaddedNameSeg = '_'; - } - PaddedNameSeg++; - } -} - - -/******************************************************************************* - * - * FUNCTION: UtAttachNameseg - * - * PARAMETERS: Op - Parent parse node - * Name - Full ExternalName - * - * RETURN: Sets the NameSeg field in parent node - * - * DESCRIPTION: Extract the last nameseg of the ExternalName and store it - * in the NameSeg field of the Op. - * - ******************************************************************************/ - -void -UtAttachNameseg ( - ACPI_PARSE_OBJECT *Op, - char *Name) -{ - char *NameSeg; - char PaddedNameSeg[4]; - - - if (!Name) - { - return; - } - - /* Look for the last dot in the namepath */ - - NameSeg = strrchr (Name, '.'); - if (NameSeg) - { - /* Found last dot, we have also found the final nameseg */ - - NameSeg++; - UtPadNameWithUnderscores (NameSeg, PaddedNameSeg); - } - else - { - /* No dots in the namepath, there is only a single nameseg. */ - /* Handle prefixes */ - - while ((*Name == '\\') || (*Name == '^')) - { - Name++; - } - - /* Remaing string should be one single nameseg */ - - UtPadNameWithUnderscores (Name, PaddedNameSeg); - } - - strncpy (Op->Asl.NameSeg, PaddedNameSeg, 4); -} - - -/******************************************************************************* - * - * FUNCTION: UtAttachNamepathToOwner - * - * PARAMETERS: Op - Parent parse node - * NameOp - Node that contains the name - * - * RETURN: Sets the ExternalName and Namepath in the parent node - * - * DESCRIPTION: Store the name in two forms in the parent node: The original - * (external) name, and the internalized name that is used within - * the ACPI namespace manager. - * - ******************************************************************************/ - -void -UtAttachNamepathToOwner ( - ACPI_PARSE_OBJECT *Op, - ACPI_PARSE_OBJECT *NameOp) -{ - ACPI_STATUS Status; - - - /* Full external path */ - - Op->Asl.ExternalName = NameOp->Asl.Value.String; - - /* Last nameseg of the path */ - - UtAttachNameseg (Op, Op->Asl.ExternalName); - - /* Create internalized path */ - - Status = UtInternalizeName (NameOp->Asl.Value.String, &Op->Asl.Namepath); - if (ACPI_FAILURE (Status)) - { - /* TBD: abort on no memory */ - } -} - - -/******************************************************************************* - * - * FUNCTION: UtDoConstant - * - * PARAMETERS: String - Hex, Octal, or Decimal string - * - * RETURN: Converted Integer - * - * DESCRIPTION: Convert a string to an integer. With error checking. - * - ******************************************************************************/ - -ACPI_INTEGER -UtDoConstant ( - char *String) -{ - ACPI_STATUS Status; - ACPI_INTEGER Converted; - char ErrBuf[64]; - - - Status = UtStrtoul64 (String, 0, &Converted); - if (ACPI_FAILURE (Status)) - { - sprintf (ErrBuf, "%s %s\n", "Conversion error:", AcpiFormatException (Status)); - AslCompilererror (ErrBuf); - } - - return (Converted); -} - - -/******************************************************************************* - * - * FUNCTION: UtStrtoul64 - * - * 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. - * - ******************************************************************************/ -#define NEGATIVE 1 -#define POSITIVE 0 - -ACPI_STATUS -UtStrtoul64 ( - char *String, - UINT32 Base, - ACPI_INTEGER *RetInteger) -{ - UINT32 Index; - UINT32 Sign; - ACPI_INTEGER ReturnValue = 0; - ACPI_STATUS Status = AE_OK; - - - *RetInteger = 0; - - switch (Base) - { - case 0: - case 8: - case 10: - case 16: - break; - - default: - /* - * The specified Base parameter is not in the domain of - * this function: - */ - return (AE_BAD_PARAMETER); - } - - /* - * skip over any white space in the buffer: - */ - while (isspace (*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 (tolower (*(++String)) == 'x') - { - Base = 16; - ++String; - } - else - { - Base = 8; - } - } - else - { - Base = 10; - } - } - - /* - * 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' && - tolower (*(++String)) == 'x') - { - String++; - } - - /* Main loop: convert the string to an unsigned long */ - - while (*String) - { - if (isdigit (*String)) - { - Index = ((UINT8) *String) - '0'; - } - else - { - Index = (UINT8) toupper (*String); - if (isupper ((char) Index)) - { - Index = Index - 'A' + 10; - } - else - { - goto ErrorExit; - } - } - - if (Index >= Base) - { - goto ErrorExit; - } - - /* Check to see if value is out of range: */ - - if (ReturnValue > ((ACPI_INTEGER_MAX - (ACPI_INTEGER) Index) / - (ACPI_INTEGER) Base)) - { - goto ErrorExit; - } - else - { - ReturnValue *= Base; - ReturnValue += Index; - } - - ++String; - } - - - /* - * If a minus sign was present, then "the conversion is negated": - */ - if (Sign == NEGATIVE) - { - ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1; - } - - *RetInteger = ReturnValue; - return (Status); - - -ErrorExit: - switch (Base) - { - case 8: - Status = AE_BAD_OCTAL_CONSTANT; - break; - - case 10: - Status = AE_BAD_DECIMAL_CONSTANT; - break; - - case 16: - Status = AE_BAD_HEX_CONSTANT; - break; - - default: - /* Base validated above */ - break; - } - - return (Status); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/asmain.c b/sys/dev/acpi/acpica/Subsystem/asmain.c deleted file mode 100644 index 2ab8dfc9e2e..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asmain.c +++ /dev/null @@ -1,920 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asmain - Main module for the acpi source processor utility - * $Revision: 57 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include "acpisrc.h" -#include "acapps.h" - - -/* Globals */ - -UINT32 Gbl_Tabs = 0; -UINT32 Gbl_MissingBraces = 0; -UINT32 Gbl_NonAnsiComments = 0; -UINT32 Gbl_Files = 0; -UINT32 Gbl_WhiteLines = 0; -UINT32 Gbl_CommentLines = 0; -UINT32 Gbl_SourceLines = 0; -UINT32 Gbl_LongLines = 0; -UINT32 Gbl_TotalLines = 0; - -struct stat Gbl_StatBuf; -char *Gbl_FileBuffer; -UINT32 Gbl_FileSize; -UINT32 Gbl_FileType; -BOOLEAN Gbl_VerboseMode = FALSE; -BOOLEAN Gbl_BatchMode = FALSE; -BOOLEAN Gbl_DebugStatementsMode = FALSE; -BOOLEAN Gbl_MadeChanges = FALSE; -BOOLEAN Gbl_Overwrite = FALSE; -BOOLEAN Gbl_WidenDeclarations = FALSE; - - -/****************************************************************************** - * - * Standard/Common translation tables - * - ******************************************************************************/ - - -ACPI_STRING_TABLE StandardDataTypes[] = { - - /* Declarations first */ - - {"UINT32_BIT ", "unsigned int", REPLACE_SUBSTRINGS}, - - {"UINT32 ", "unsigned int", REPLACE_SUBSTRINGS}, - {"UINT16 ", "unsigned short", REPLACE_SUBSTRINGS}, - {"UINT8 ", "unsigned char", REPLACE_SUBSTRINGS}, - {"BOOLEAN ", "unsigned char", REPLACE_SUBSTRINGS}, - - /* Now do embedded typecasts */ - - {"UINT32", "unsigned int", REPLACE_SUBSTRINGS}, - {"UINT16", "unsigned short", REPLACE_SUBSTRINGS}, - {"UINT8", "unsigned char", REPLACE_SUBSTRINGS}, - {"BOOLEAN", "unsigned char", REPLACE_SUBSTRINGS}, - - {"INT32 ", "int ", REPLACE_SUBSTRINGS}, - {"INT32", "int", REPLACE_SUBSTRINGS}, - {"INT16", "short", REPLACE_SUBSTRINGS}, - {"INT8", "char", REPLACE_SUBSTRINGS}, - - /* Put back anything we broke (such as anything with _INT32_ in it) */ - - {"_int_", "_INT32_", REPLACE_SUBSTRINGS}, - {"_unsigned int_", "_UINT32_", REPLACE_SUBSTRINGS}, - {NULL, NULL, 0} -}; - - -/****************************************************************************** - * - * Linux-specific translation tables - * - ******************************************************************************/ - -char LinuxHeader[] = -"/*\n" -" * Copyright (C) 2000 - 2003, R. Byron Moore\n" -" *\n" -" * This program is free software; you can redistribute it and/or modify\n" -" * it under the terms of the GNU General Public License as published by\n" -" * the Free Software Foundation; either version 2 of the License, or\n" -" * (at your option) any later version.\n" -" *\n" -" * This program is distributed in the hope that it will be useful,\n" -" * but WITHOUT ANY WARRANTY; without even the implied warranty of\n" -" * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" -" * GNU General Public License for more details.\n" -" *\n" -" * You should have received a copy of the GNU General Public License\n" -" * along with this program; if not, write to the Free Software\n" -" * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n" -" */\n"; - - -ACPI_STRING_TABLE LinuxDataTypes[] = { - - /* Declarations first */ - - {"UINT32_BIT ", "u32 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"INT64 ", "s64 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"UINT64 ", "u64 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"UINT32 ", "u32 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"INT32 ", "s32 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"UINT16 ", "u16 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"INT16 ", "s16 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"UINT8 ", "u8 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"BOOLEAN ", "u8 ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"char ", "char ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"void ", "void ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"char * ", "char * ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"void * ", "void * ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - {"int ", "int ", REPLACE_WHOLE_WORD | EXTRA_INDENT_C}, - - /* Now do embedded typecasts */ - - {"UINT64", "u64", REPLACE_WHOLE_WORD}, - {"UINT32", "u32", REPLACE_WHOLE_WORD}, - {"UINT16", "u16", REPLACE_WHOLE_WORD}, - {"UINT8", "u8", REPLACE_WHOLE_WORD}, - {"BOOLEAN", "u8", REPLACE_WHOLE_WORD}, - - {"INT64 ", "s64 ", REPLACE_WHOLE_WORD}, - {"INT64", "s64", REPLACE_WHOLE_WORD}, - {"INT32 ", "s32 ", REPLACE_WHOLE_WORD}, - {"INT32", "s32", REPLACE_WHOLE_WORD}, - {"INT16 ", "s16 ", REPLACE_WHOLE_WORD}, - {"INT8 ", "s8 ", REPLACE_WHOLE_WORD}, - {"INT16", "s16", REPLACE_WHOLE_WORD}, - {"INT8", "s8", REPLACE_WHOLE_WORD}, - - {NULL, NULL, 0}, -}; - - -ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { - - {"ACPI_ADR_SPACE_HANDLER", SRC_TYPE_SIMPLE}, - {"ACPI_ADR_SPACE_SETUP", SRC_TYPE_SIMPLE}, - {"ACPI_ADR_SPACE_TYPE", SRC_TYPE_SIMPLE}, - {"ACPI_AML_OPERANDS", SRC_TYPE_UNION}, - {"ACPI_BIT_REGISTER_INFO", SRC_TYPE_STRUCT}, - {"ACPI_BUFFER", SRC_TYPE_STRUCT}, - {"ACPI_BUS_ATTRIBUTE", SRC_TYPE_STRUCT}, - {"ACPI_COMMON_FACS", SRC_TYPE_STRUCT}, - {"ACPI_COMMON_STATE", SRC_TYPE_STRUCT}, - {"ACPI_CONTROL_STATE", SRC_TYPE_STRUCT}, - {"ACPI_CREATE_FIELD_INFO", SRC_TYPE_STRUCT}, - {"ACPI_DB_METHOD_INFO", SRC_TYPE_STRUCT}, - {"ACPI_DEBUG_MEM_BLOCK", SRC_TYPE_STRUCT}, - {"ACPI_DEBUG_MEM_HEADER", SRC_TYPE_STRUCT}, - {"ACPI_DEBUG_PRINT_INFO", SRC_TYPE_STRUCT}, - {"ACPI_DESCRIPTOR", SRC_TYPE_UNION}, - {"ACPI_DEVICE_ID", SRC_TYPE_STRUCT}, - {"ACPI_DEVICE_INFO", SRC_TYPE_STRUCT}, - {"ACPI_DEVICE_WALK_INFO", SRC_TYPE_STRUCT}, - {"ACPI_EVENT_HANDLER", SRC_TYPE_SIMPLE}, - {"ACPI_EVENT_STATUS", SRC_TYPE_SIMPLE}, - {"ACPI_EVENT_TYPE", SRC_TYPE_SIMPLE}, - {"ACPI_FIELD_INFO", SRC_TYPE_STRUCT}, - {"ACPI_FIND_CONTEXT", SRC_TYPE_STRUCT}, - {"ACPI_FIXED_EVENT_HANDLER", SRC_TYPE_STRUCT}, - {"ACPI_FIXED_EVENT_INFO", SRC_TYPE_STRUCT}, - {"ACPI_GENERIC_ADDRESS", SRC_TYPE_STRUCT}, - {"ACPI_GENERIC_STATE", SRC_TYPE_UNION}, - {"ACPI_GET_DEVICES_INFO", SRC_TYPE_STRUCT}, - {"ACPI_GPE_BLOCK_INFO", SRC_TYPE_STRUCT}, - {"ACPI_GPE_HANDLER", SRC_TYPE_SIMPLE}, - {"ACPI_GPE_INDEX_INFO", SRC_TYPE_STRUCT}, - {"ACPI_GPE_NUMBER_INFO", SRC_TYPE_STRUCT}, - {"ACPI_GPE_REGISTER_INFO", SRC_TYPE_STRUCT}, - {"ACPI_HANDLE", SRC_TYPE_SIMPLE}, - {"ACPI_INIT_HANDLER", SRC_TYPE_SIMPLE}, - {"ACPI_INIT_WALK_INFO", SRC_TYPE_STRUCT}, - {"ACPI_INTEGER", SRC_TYPE_SIMPLE}, - {"ACPI_INTEGRITY_INFO", SRC_TYPE_STRUCT}, - {"ACPI_INTERPRETER_MODE", SRC_TYPE_SIMPLE}, - {"ACPI_IO_ADDRESS", SRC_TYPE_SIMPLE}, - {"ACPI_IO_ATTRIBUTE", SRC_TYPE_STRUCT}, - {"ACPI_MEM_SPACE_CONTEXT", SRC_TYPE_STRUCT}, - {"ACPI_MEMORY_ATTRIBUTE", SRC_TYPE_STRUCT}, - {"ACPI_MEMORY_LIST", SRC_TYPE_STRUCT}, - {"ACPI_MUTEX", SRC_TYPE_SIMPLE}, - {"ACPI_MUTEX_HANDLE", SRC_TYPE_SIMPLE}, - {"ACPI_MUTEX_INFO", SRC_TYPE_STRUCT}, - {"ACPI_NAME", SRC_TYPE_SIMPLE}, - {"ACPI_NAME_UNION", SRC_TYPE_UNION}, - {"ACPI_NAMESPACE_NODE", SRC_TYPE_STRUCT}, - {"ACPI_NAMESTRING_INFO", SRC_TYPE_STRUCT}, - {"ACPI_NATIVE_INT", SRC_TYPE_SIMPLE}, - {"ACPI_NATIVE_UINT", SRC_TYPE_SIMPLE}, - {"ACPI_NOTIFY_HANDLER", SRC_TYPE_SIMPLE}, - {"ACPI_NOTIFY_INFO", SRC_TYPE_STRUCT}, - {"ACPI_NS_SEARCH_DATA", SRC_TYPE_STRUCT}, - {"ACPI_OBJ_INFO_HEADER", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT", SRC_TYPE_UNION}, - {"ACPI_OBJECT_ADDR_HANDLER", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_BANK_FIELD", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_BUFFER", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_BUFFER_FIELD", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_CACHE_LIST", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_COMMON", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_DATA", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_DEVICE", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_EVENT", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_EXTRA", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_FIELD_COMMON", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_HANDLER", SRC_TYPE_SIMPLE}, - {"ACPI_OBJECT_INDEX_FIELD", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_INTEGER", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_LIST", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_METHOD", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_MUTEX", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_NOTIFY_COMMON", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_NOTIFY_HANDLER", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_PACKAGE", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_POWER_RESOURCE", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_PROCESSOR", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_REFERENCE", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_REGION", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_REGION_FIELD", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_STRING", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_THERMAL_ZONE", SRC_TYPE_STRUCT}, - {"ACPI_OBJECT_TYPE", SRC_TYPE_SIMPLE}, - {"ACPI_OBJECT_TYPE8", SRC_TYPE_SIMPLE}, - {"ACPI_OP_WALK_INFO", SRC_TYPE_STRUCT}, - {"ACPI_OPCODE_INFO", SRC_TYPE_STRUCT}, - {"ACPI_OPERAND_OBJECT", SRC_TYPE_UNION}, - {"ACPI_OWNER_ID", SRC_TYPE_SIMPLE}, - {"ACPI_PARSE_DOWNWARDS", SRC_TYPE_SIMPLE}, - {"ACPI_PARSE_OBJ_ASL", SRC_TYPE_STRUCT}, - {"ACPI_PARSE_OBJ_COMMON", SRC_TYPE_STRUCT}, - {"ACPI_PARSE_OBJ_NAMED", SRC_TYPE_STRUCT}, - {"ACPI_PARSE_OBJECT", SRC_TYPE_UNION}, - {"ACPI_PARSE_STATE", SRC_TYPE_STRUCT}, - {"ACPI_PARSE_UPWARDS", SRC_TYPE_SIMPLE}, - {"ACPI_PARSE_VALUE", SRC_TYPE_UNION}, - {"ACPI_PCI_ID", SRC_TYPE_STRUCT}, - {"ACPI_PCI_ROUTING_TABLE", SRC_TYPE_STRUCT}, - {"ACPI_PHYSICAL_ADDRESS", SRC_TYPE_SIMPLE}, - {"ACPI_PKG_CALLBACK", SRC_TYPE_SIMPLE}, - {"ACPI_PKG_INFO", SRC_TYPE_STRUCT}, - {"ACPI_PKG_STATE", SRC_TYPE_STRUCT}, - {"ACPI_POINTER", SRC_TYPE_STRUCT}, - {"ACPI_POINTERS", SRC_TYPE_UNION}, - {"ACPI_PREDEFINED_NAMES", SRC_TYPE_STRUCT}, - {"ACPI_PSCOPE_STATE", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_ADDRESS16", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_ADDRESS32", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_ADDRESS64", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_ATTRIBUTE", SRC_TYPE_UNION}, - {"ACPI_RESOURCE_DATA", SRC_TYPE_UNION}, - {"ACPI_RESOURCE_DMA", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_END_TAG", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_EXT_IRQ", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_FIXED_IO", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_FIXED_MEM32", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_IO", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_IRQ", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_MEM24", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_MEM32", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_SOURCE", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_START_DPF", SRC_TYPE_STRUCT}, - {"ACPI_RESOURCE_TYPE", SRC_TYPE_SIMPLE}, - {"ACPI_RESOURCE_VENDOR", SRC_TYPE_STRUCT}, - {"ACPI_RESULT_VALUES", SRC_TYPE_STRUCT}, - {"ACPI_SCOPE_STATE", SRC_TYPE_STRUCT}, - {"ACPI_SIGNAL_FATAL_INFO", SRC_TYPE_STRUCT}, - {"ACPI_SIZE", SRC_TYPE_SIMPLE}, - {"ACPI_STATUS", SRC_TYPE_SIMPLE}, - {"ACPI_STRING", SRC_TYPE_SIMPLE}, - {"ACPI_SYSTEM_INFO", SRC_TYPE_STRUCT}, - {"ACPI_TABLE_DESC", SRC_TYPE_STRUCT}, - {"ACPI_TABLE_HEADER", SRC_TYPE_STRUCT}, - {"ACPI_TABLE_INFO", SRC_TYPE_STRUCT}, - {"ACPI_TABLE_PTR", SRC_TYPE_SIMPLE}, - {"ACPI_TABLE_SUPPORT", SRC_TYPE_STRUCT}, - {"ACPI_TABLE_TYPE", SRC_TYPE_SIMPLE}, - {"ACPI_THREAD_STATE", SRC_TYPE_STRUCT}, - {"ACPI_UPDATE_STATE", SRC_TYPE_STRUCT}, - {"ACPI_WALK_CALLBACK", SRC_TYPE_SIMPLE}, - {"ACPI_WALK_INFO", SRC_TYPE_STRUCT}, - {"ACPI_WALK_STATE", SRC_TYPE_STRUCT}, - {"APIC_HEADER", SRC_TYPE_STRUCT}, - {"ARGUMENT_INFO", SRC_TYPE_STRUCT}, - {"ASL_ANALYSIS_WALK_INFO", SRC_TYPE_STRUCT}, - {"ASL_DMA_FORMAT_DESC", SRC_TYPE_STRUCT}, - {"ASL_DWORD_ADDRESS_DESC", SRC_TYPE_STRUCT}, - {"ASL_END_DEPENDENT_DESC", SRC_TYPE_STRUCT}, - {"ASL_END_TAG_DESC", SRC_TYPE_STRUCT}, - {"ASL_ERROR_MSG", SRC_TYPE_STRUCT}, - {"ASL_EVENT_INFO", SRC_TYPE_STRUCT}, - {"ASL_EXTENDED_XRUPT_DESC", SRC_TYPE_STRUCT}, - {"ASL_FILE_INFO", SRC_TYPE_STRUCT}, - {"ASL_FIXED_IO_PORT_DESC", SRC_TYPE_STRUCT}, - {"ASL_FIXED_MEMORY_32_DESC", SRC_TYPE_STRUCT}, - {"ASL_GENERAL_REGISTER_DESC", SRC_TYPE_STRUCT}, - {"ASL_IO_PORT_DESC", SRC_TYPE_STRUCT}, - {"ASL_IRQ_FORMAT_DESC", SRC_TYPE_STRUCT}, - {"ASL_IRQ_NOFLAGS_DESC", SRC_TYPE_STRUCT}, - {"ASL_LARGE_VENDOR_DESC", SRC_TYPE_STRUCT}, - {"ASL_LISTING_NODE", SRC_TYPE_STRUCT}, - {"ASL_MAPPING_ENTRY", SRC_TYPE_STRUCT}, - {"ASL_MEMORY_24_DESC", SRC_TYPE_STRUCT}, - {"ASL_MEMORY_32_DESC", SRC_TYPE_STRUCT}, - {"ASL_METHOD_INFO", SRC_TYPE_STRUCT}, - {"ASL_QWORD_ADDRESS_DESC", SRC_TYPE_STRUCT}, - {"ASL_RESERVED_INFO", SRC_TYPE_STRUCT}, - {"ASL_RESOURCE_DESC", SRC_TYPE_UNION}, - {"ASL_RESOURCE_NODE", SRC_TYPE_STRUCT}, - {"ASL_SMALL_VENDOR_DESC", SRC_TYPE_STRUCT}, - {"ASL_START_DEPENDENT_DESC", SRC_TYPE_STRUCT}, - {"ASL_START_DEPENDENT_NOPRIO_DESC", SRC_TYPE_STRUCT}, - {"ASL_WALK_CALLBACK", SRC_TYPE_SIMPLE}, - {"ASL_WORD_ADDRESS_DESC", SRC_TYPE_STRUCT}, - {"COMMAND_INFO", SRC_TYPE_STRUCT}, -/* {"FACS_DESCRIPTOR", SRC_TYPE_SIMPLE}, */ - {"FACS_DESCRIPTOR_REV1", SRC_TYPE_STRUCT}, - {"FACS_DESCRIPTOR_REV2", SRC_TYPE_STRUCT}, -/* {"FADT_DESCRIPTOR", SRC_TYPE_SIMPLE}, */ - {"FADT_DESCRIPTOR_REV1", SRC_TYPE_STRUCT}, - {"FADT_DESCRIPTOR_REV2", SRC_TYPE_STRUCT}, - {"RSDP_DESCRIPTOR", SRC_TYPE_STRUCT}, -/* {"RSDT_DESCRIPTOR", SRC_TYPE_SIMPLE}, */ - {"RSDT_DESCRIPTOR_REV1", SRC_TYPE_STRUCT}, - {"RSDT_DESCRIPTOR_REV2", SRC_TYPE_STRUCT}, - {"UINT32_STRUCT", SRC_TYPE_STRUCT}, - {"UINT64_OVERLAY", SRC_TYPE_UNION}, - {"UINT64_STRUCT", SRC_TYPE_STRUCT}, -/* {"XSDT_DESCRIPTOR", SRC_TYPE_SIMPLE}, */ - {"XSDT_DESCRIPTOR_REV2", SRC_TYPE_STRUCT}, - - {NULL} -}; - -ACPI_IDENTIFIER_TABLE LinuxAddStruct[] = { - {"acpi_namespace_node"}, - {"acpi_parse_object"}, - {"acpi_table_desc"}, - {"acpi_walk_state"}, - {NULL} -}; - - -ACPI_IDENTIFIER_TABLE LinuxEliminateMacros[] = { - - {"ACPI_GET_ADDRESS"}, - {"ACPI_VALID_ADDRESS"}, - {NULL} -}; - - -ACPI_IDENTIFIER_TABLE LinuxEliminateLines_C[] = { - - {"#define __"}, - {"$Revision"}, - {NULL} -}; - - -ACPI_IDENTIFIER_TABLE LinuxEliminateLines_H[] = { - - {"$Revision"}, - {NULL} -}; - - -ACPI_IDENTIFIER_TABLE LinuxConditionalIdentifiers[] = { - -// {"ACPI_USE_STANDARD_HEADERS"}, - {"WIN32"}, - {"_MSC_VER"}, - {NULL} -}; - -ACPI_CONVERSION_TABLE LinuxConversionTable = { - - LinuxHeader, - FLG_NO_CARRIAGE_RETURNS | FLG_LOWERCASE_DIRNAMES, - - AcpiIdentifiers, - - /* C source files */ - - LinuxDataTypes, - LinuxEliminateLines_C, - NULL, - LinuxEliminateMacros, - AcpiIdentifiers, - (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | - CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_BRACES_ON_SAME_LINE | - CVT_MIXED_CASE_TO_UNDERSCORES | CVT_LOWER_CASE_IDENTIFIERS | - CVT_REMOVE_DEBUG_MACROS | CVT_TRIM_WHITESPACE | - CVT_REMOVE_EMPTY_BLOCKS | CVT_SPACES_TO_TABS8), - - /* C header files */ - - LinuxDataTypes, - LinuxEliminateLines_H, - LinuxConditionalIdentifiers, - NULL, - AcpiIdentifiers, - (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | - CVT_TRIM_LINES | CVT_MIXED_CASE_TO_UNDERSCORES | - CVT_LOWER_CASE_IDENTIFIERS | CVT_TRIM_WHITESPACE | - CVT_REMOVE_EMPTY_BLOCKS| CVT_REDUCE_TYPEDEFS | CVT_SPACES_TO_TABS8), -}; - - -/****************************************************************************** - * - * Code cleanup translation tables - * - ******************************************************************************/ - - -ACPI_CONVERSION_TABLE CleanupConversionTable = { - - NULL, - FLG_DEFAULT_FLAGS, - NULL, - /* C source files */ - - NULL, - NULL, - NULL, - NULL, - NULL, - (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | - CVT_CHECK_BRACES | CVT_TRIM_LINES | CVT_TRIM_WHITESPACE), - - /* C header files */ - - NULL, - NULL, - NULL, - NULL, - NULL, - (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | - CVT_TRIM_LINES | CVT_TRIM_WHITESPACE), -}; - - -ACPI_CONVERSION_TABLE StatsConversionTable = { - - NULL, - FLG_NO_FILE_OUTPUT, - NULL, - - /* C source files */ - - NULL, - NULL, - NULL, - NULL, - NULL, - (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES), - - /* C header files */ - - NULL, - NULL, - NULL, - NULL, - NULL, - (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES), -}; - - -/****************************************************************************** - * - * Customizable translation tables - * - ******************************************************************************/ - -ACPI_STRING_TABLE CustomReplacements[] = { - - {"(c) 1999 - 2003", "(c) 1999 - 2003", REPLACE_WHOLE_WORD}, - -#if 0 - "ACPI_NATIVE_UINT", "ACPI_NATIVE_UINT", REPLACE_WHOLE_WORD, - "ACPI_NATIVE_UINT *", "ACPI_NATIVE_UINT *", REPLACE_WHOLE_WORD, - "ACPI_NATIVE_UINT", "ACPI_NATIVE_UINT", REPLACE_WHOLE_WORD, - "ACPI_NATIVE_INT", "ACPI_NATIVE_INT", REPLACE_WHOLE_WORD, - "ACPI_NATIVE_INT *", "ACPI_NATIVE_INT *", REPLACE_WHOLE_WORD, - "ACPI_NATIVE_INT", "ACPI_NATIVE_INT", REPLACE_WHOLE_WORD, -#endif - - {NULL, NULL, 0} -}; - - -ACPI_CONVERSION_TABLE CustomConversionTable = { - - NULL, - FLG_DEFAULT_FLAGS, - NULL, - - /* C source files */ - - CustomReplacements, - NULL, - NULL, - NULL, - NULL, - (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | - CVT_TRIM_LINES | CVT_TRIM_WHITESPACE), - - /* C header files */ - - CustomReplacements, - NULL, - NULL, - NULL, - NULL, - (CVT_COUNT_TABS | CVT_COUNT_NON_ANSI_COMMENTS | CVT_COUNT_LINES | - CVT_TRIM_LINES | CVT_TRIM_WHITESPACE), -}; - - -/****************************************************************************** - * - * FUNCTION: AsExaminePaths - * - * DESCRIPTION: Source and Target pathname verification and handling - * - ******************************************************************************/ - -int -AsExaminePaths ( - ACPI_CONVERSION_TABLE *ConversionTable, - char *Source, - char *Target, - UINT32 *SourceFileType) -{ - int Status; - char Response; - - - Status = stat (Source, &Gbl_StatBuf); - if (Status) - { - printf ("Source path \"%s\" does not exist\n", Source); - return -1; - } - - /* Return the filetype -- file or a directory */ - - *SourceFileType = 0; - if (Gbl_StatBuf.st_mode & S_IFDIR) - { - *SourceFileType = S_IFDIR; - } - - /* - * If we are in no-output mode or in batch mode, we are done - */ - if ((ConversionTable->Flags & FLG_NO_FILE_OUTPUT) || - (Gbl_BatchMode)) - { - return 0; - } - - if (!stricmp (Source, Target)) - { - printf ("Target path is the same as the source path, overwrite?\n"); - scanf ("%c", &Response); - - /* Check response */ - - if ((char) Response != 'y') - { - return -1; - } - - Gbl_Overwrite = TRUE; - } - else - { - Status = stat (Target, &Gbl_StatBuf); - if (!Status) - { - printf ("Target path already exists, overwrite?\n"); - scanf ("%c", &Response); - - /* Check response */ - - if ((char) Response != 'y') - { - return -1; - } - } - } - - return 0; -} - - -/****************************************************************************** - * - * FUNCTION: AsDisplayStats - * - * DESCRIPTION: Display global statistics gathered during translation - * - ******************************************************************************/ - -void -AsDisplayStats (void) -{ - - printf ("\nAcpiSrc statistics:\n\n"); - printf ("%6d Files processed\n", Gbl_Files); - printf ("%6d Tabs found\n", Gbl_Tabs); - printf ("%6d Missing if/else braces\n", Gbl_MissingBraces); - printf ("%6d Non-ANSI comments found\n", Gbl_NonAnsiComments); - printf ("%6d Total Lines\n", Gbl_TotalLines); - printf ("%6d Lines of code\n", Gbl_SourceLines); - printf ("%6d Lines of non-comment whitespace\n", Gbl_WhiteLines); - printf ("%6d Lines of comments\n", Gbl_CommentLines); - printf ("%6d Long lines found\n", Gbl_LongLines); - printf ("%6.1f Ratio of code to whitespace\n", ((float) Gbl_SourceLines / (float) Gbl_WhiteLines)); - printf ("%6.1f Ratio of code to comments\n", ((float) Gbl_SourceLines / (float) Gbl_CommentLines)); - return; -} - - -/****************************************************************************** - * - * FUNCTION: AsDisplayUsage - * - * DESCRIPTION: Usage message - * - ******************************************************************************/ - -void -AsDisplayUsage (void) -{ - - printf ("\n"); - printf ("Usage: acpisrc [-c|l|u] [-dsvy] <SourceDir> <DestinationDir>\n\n"); - printf ("Where: -c Generate cleaned version of the source\n"); - printf (" -l Generate Linux version of the source\n"); - printf (" -u Generate Custom source translation\n"); - printf ("\n"); - printf (" -d Leave debug statements in code\n"); - printf (" -s Generate source statistics only\n"); - printf (" -v Verbose mode\n"); - printf (" -y Suppress file overwrite prompts\n"); - printf ("\n"); - return; -} - - -/****************************************************************************** - * - * FUNCTION: main - * - * DESCRIPTION: C main function - * - ******************************************************************************/ - -int ACPI_SYSTEM_XFACE -main ( - int argc, - char *argv[]) -{ - int j; - ACPI_CONVERSION_TABLE *ConversionTable = NULL; - char *SourcePath; - char *TargetPath; - UINT32 FileType; - - - printf ("ACPI Source Code Conversion Utility"); - printf (" version %8.8X", ((UINT32) ACPI_CA_VERSION)); - printf (" [%s]\n\n", __DATE__); - - if (argc < 2) - { - AsDisplayUsage (); - return 0; - } - - /* Command line options */ - - while ((j = AcpiGetopt (argc, argv, "lcsuvyd")) != EOF) switch(j) - { - case 'l': - /* Linux code generation */ - - printf ("Creating Linux source code\n"); - ConversionTable = &LinuxConversionTable; - Gbl_WidenDeclarations = TRUE; - break; - - case 'c': - /* Cleanup code */ - - printf ("Code cleanup\n"); - ConversionTable = &CleanupConversionTable; - break; - - case 's': - /* Statistics only */ - - break; - - case 'u': - /* custom conversion */ - - printf ("Custom source translation\n"); - ConversionTable = &CustomConversionTable; - break; - - case 'v': - /* Verbose mode */ - - Gbl_VerboseMode = TRUE; - break; - - case 'y': - /* Batch mode */ - - Gbl_BatchMode = TRUE; - break; - - case 'd': - /* Leave debug statements in */ - - Gbl_DebugStatementsMode = TRUE; - break; - - default: - AsDisplayUsage (); - return -1; - } - - - SourcePath = argv[AcpiGbl_Optind]; - if (!SourcePath) - { - printf ("Missing source path\n"); - AsDisplayUsage (); - return -1; - } - - TargetPath = argv[AcpiGbl_Optind+1]; - - if (!ConversionTable) - { - /* Just generate statistics. Ignore target path */ - - TargetPath = SourcePath; - - printf ("Source code statistics only\n"); - ConversionTable = &StatsConversionTable; - } - else if (!TargetPath) - { - TargetPath = SourcePath; - } - - if (Gbl_DebugStatementsMode) - { - ConversionTable->SourceFunctions &= ~CVT_REMOVE_DEBUG_MACROS; - } - - /* Check source and target paths and files */ - - if (AsExaminePaths (ConversionTable, SourcePath, TargetPath, &FileType)) - { - return -1; - } - - /* Source/target can be either directories or a files */ - - if (FileType == S_IFDIR) - { - /* Process the directory tree */ - - AsProcessTree (ConversionTable, SourcePath, TargetPath); - } - else - { - /* Process a single file */ - - /* Differentiate between source and header files */ - - if (strstr (SourcePath, ".h")) - { - AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_HEADER); - } - else - { - AsProcessOneFile (ConversionTable, NULL, TargetPath, 0, SourcePath, FILE_TYPE_SOURCE); - } - } - - /* Always display final summary and stats */ - - AsDisplayStats (); - - return 0; -} diff --git a/sys/dev/acpi/acpica/Subsystem/asremove.c b/sys/dev/acpi/acpica/Subsystem/asremove.c deleted file mode 100644 index 10ce68c5249..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asremove.c +++ /dev/null @@ -1,681 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asremove - Source conversion - removal functions - * $Revision: 5 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#include "acpisrc.h" - - -/****************************************************************************** - * - * FUNCTION: AsRemoveStatement - * - * DESCRIPTION: Remove all statements that contain the given keyword. - * Limitations: Removes text from the start of the line that - * contains the keyword to the next semicolon. Currently - * doesn't ignore comments. - * - ******************************************************************************/ - -void -AsRemoveStatement ( - char *Buffer, - char *Keyword, - UINT32 Type) -{ - char *SubString; - char *SubBuffer; - int KeywordLength; - - - KeywordLength = strlen (Keyword); - SubBuffer = Buffer; - SubString = Buffer; - - - while (SubString) - { - SubString = strstr (SubBuffer, Keyword); - - if (SubString) - { - SubBuffer = SubString; - - if ((Type == REPLACE_WHOLE_WORD) && - (!AsMatchExactWord (SubString, KeywordLength))) - { - SubBuffer++; - continue; - } - - /* Find start of this line */ - - while (*SubString != '\n') - { - SubString--; - } - SubString++; - - /* Find end of this statement */ - - SubBuffer = AsSkipPastChar (SubBuffer, ';'); - if (!SubBuffer) - { - return; - } - - /* Find end of this line */ - - SubBuffer = AsSkipPastChar (SubBuffer, '\n'); - if (!SubBuffer) - { - return; - } - - /* If next line is blank, remove it too */ - - if (*SubBuffer == '\n') - { - SubBuffer++; - } - - /* Remove the lines */ - - SubBuffer = AsRemoveData (SubString, SubBuffer); - } - } -} - - -/****************************************************************************** - * - * FUNCTION: AsRemoveConditionalCompile - * - * DESCRIPTION: Remove a "#ifdef" statement, and all text that it encompasses. - * Limitations: cannot handle nested ifdefs. - * - ******************************************************************************/ - -void -AsRemoveConditionalCompile ( - char *Buffer, - char *Keyword) -{ - char *SubString; - char *SubBuffer; - char *IfPtr; - char *EndifPtr; - char *ElsePtr; - char *Comment; - int KeywordLength; - - - KeywordLength = strlen (Keyword); - SubBuffer = Buffer; - SubString = Buffer; - - - while (SubString) - { - SubBuffer = strstr (SubString, Keyword); - if (!SubBuffer) - { - return; - } - - /* - * Check for translation escape string -- means to ignore - * blocks of code while replacing - */ - Comment = strstr (SubString, "/*!"); - - if ((Comment) && - (Comment < SubBuffer)) - { - SubString = strstr (Comment, "!*/"); - if (!SubString) - { - return; - } - - SubString += 3; - continue; - } - - /* Check for ordinary comment */ - - Comment = strstr (SubString, "/*"); - - if ((Comment) && - (Comment < SubBuffer)) - { - SubString = strstr (Comment, "*/"); - if (!SubString) - { - return; - } - - SubString += 2; - continue; - } - - SubString = SubBuffer; - if (!AsMatchExactWord (SubString, KeywordLength)) - { - SubString++; - continue; - } - - /* Find start of this line */ - - while (*SubString != '\n' && (SubString > Buffer)) - { - SubString--; - } - SubString++; - - /* Find the "#ifxxxx" */ - - IfPtr = strstr (SubString, "#if"); - if (!IfPtr) - { - return; - } - - if (IfPtr > SubBuffer) - { - /* Not the right #if */ - - SubString = SubBuffer + strlen (Keyword); - continue; - } - - /* Find closing #endif or #else */ - - EndifPtr = strstr (SubBuffer, "#endif"); - if (!EndifPtr) - { - /* There has to be an #endif */ - - return; - } - - ElsePtr = strstr (SubBuffer, "#else"); - if ((ElsePtr) && - (EndifPtr > ElsePtr)) - { - /* This #ifdef contains an #else clause */ - /* Find end of this line */ - - SubBuffer = AsSkipPastChar (ElsePtr, '\n'); - if (!SubBuffer) - { - return; - } - - /* Remove the #ifdef .... #else code */ - - AsRemoveData (SubString, SubBuffer); - - /* Next, we will remove the #endif statement */ - - EndifPtr = strstr (SubString, "#endif"); - if (!EndifPtr) - { - /* There has to be an #endif */ - - return; - } - - SubString = EndifPtr; - } - - /* Remove the ... #endif part */ - /* Find end of this line */ - - SubBuffer = AsSkipPastChar (EndifPtr, '\n'); - if (!SubBuffer) - { - return; - } - - /* Remove the lines */ - - SubBuffer = AsRemoveData (SubString, SubBuffer); - } -} - - -/****************************************************************************** - * - * FUNCTION: AsRemoveMacro - * - * DESCRIPTION: Remove every line that contains the keyword. Does not - * skip comments. - * - ******************************************************************************/ - -void -AsRemoveMacro ( - char *Buffer, - char *Keyword) -{ - char *SubString; - char *SubBuffer; - int NestLevel; - - - SubBuffer = Buffer; - SubString = Buffer; - - - while (SubString) - { - SubString = strstr (SubBuffer, Keyword); - - if (SubString) - { - SubBuffer = SubString; - - /* Find start of the macro parameters */ - - while (*SubString != '(') - { - SubString++; - } - SubString++; - - /* Remove the macro name and opening paren */ - - SubString = AsRemoveData (SubBuffer, SubString); - - NestLevel = 1; - while (*SubString) - { - if (*SubString == '(') - { - NestLevel++; - } - else if (*SubString == ')') - { - NestLevel--; - } - - SubString++; - - if (NestLevel == 0) - { - break; - } - } - - /* Remove the closing paren */ - - SubBuffer = AsRemoveData (SubString-1, SubString); - } - } -} - - -/****************************************************************************** - * - * FUNCTION: AsRemoveLine - * - * DESCRIPTION: Remove every line that contains the keyword. Does not - * skip comments. - * - ******************************************************************************/ - -void -AsRemoveLine ( - char *Buffer, - char *Keyword) -{ - char *SubString; - char *SubBuffer; - - - SubBuffer = Buffer; - SubString = Buffer; - - - while (SubString) - { - SubString = strstr (SubBuffer, Keyword); - - if (SubString) - { - SubBuffer = SubString; - - /* Find start of this line */ - - while (*SubString != '\n') - { - SubString--; - } - SubString++; - - /* Find end of this line */ - - SubBuffer = AsSkipPastChar (SubBuffer, '\n'); - if (!SubBuffer) - { - return; - } - - /* Remove the line */ - - SubBuffer = AsRemoveData (SubString, SubBuffer); - } - } -} - - -/****************************************************************************** - * - * FUNCTION: AsReduceTypedefs - * - * DESCRIPTION: Eliminate certain typedefs - * - ******************************************************************************/ - -void -AsReduceTypedefs ( - char *Buffer, - char *Keyword) -{ - char *SubString; - char *SubBuffer; - int NestLevel; - - - SubBuffer = Buffer; - SubString = Buffer; - - - while (SubString) - { - SubString = strstr (SubBuffer, Keyword); - - if (SubString) - { - /* Remove the typedef itself */ - - SubBuffer = SubString + strlen ("typedef") + 1; - SubBuffer = AsRemoveData (SubString, SubBuffer); - - /* Find the opening brace of the struct or union */ - - while (*SubString != '{') - { - SubString++; - } - SubString++; - - /* Find the closing brace. Handles nested braces */ - - NestLevel = 1; - while (*SubString) - { - if (*SubString == '{') - { - NestLevel++; - } - else if (*SubString == '}') - { - NestLevel--; - } - - SubString++; - - if (NestLevel == 0) - { - break; - } - } - - /* Remove an extra line feed if present */ - - if (!strncmp (SubString - 3, "\n\n", 2)) - { - *(SubString -2) = '}'; - SubString--; - } - - /* Find the end of the typedef name */ - - SubBuffer = AsSkipUntilChar (SubString, ';'); - - /* And remove the typedef name */ - - SubBuffer = AsRemoveData (SubString, SubBuffer); - } - } -} - - -/****************************************************************************** - * - * FUNCTION: AsRemoveEmptyBlocks - * - * DESCRIPTION: Remove any C blocks (e.g., if {}) that contain no code. This - * can happen as a result of removing lines such as DEBUG_PRINT. - * - ******************************************************************************/ - -void -AsRemoveEmptyBlocks ( - char *Buffer, - char *Filename) -{ - char *SubBuffer; - char *BlockStart; - BOOLEAN EmptyBlock = TRUE; - BOOLEAN AnotherPassRequired = TRUE; - UINT32 BlockCount = 0; - - - while (AnotherPassRequired) - { - SubBuffer = Buffer; - AnotherPassRequired = FALSE; - - while (*SubBuffer) - { - if (*SubBuffer == '{') - { - BlockStart = SubBuffer; - EmptyBlock = TRUE; - - SubBuffer++; - while (*SubBuffer != '}') - { - if ((*SubBuffer != ' ') && - (*SubBuffer != '\n')) - { - EmptyBlock = FALSE; - break; - } - SubBuffer++; - } - - if (EmptyBlock) - { - /* Find start of the first line of the block */ - - while (*BlockStart != '\n') - { - BlockStart--; - } - - /* Find end of the last line of the block */ - - SubBuffer = AsSkipUntilChar (SubBuffer, '\n'); - if (!SubBuffer) - { - break; - } - - /* Remove the block */ - - SubBuffer = AsRemoveData (BlockStart, SubBuffer); - BlockCount++; - AnotherPassRequired = TRUE; - continue; - } - } - - SubBuffer++; - } - } - - if (BlockCount) - { - Gbl_MadeChanges = TRUE; - AsPrint ("Code blocks deleted", BlockCount, Filename); - } -} - - -/****************************************************************************** - * - * FUNCTION: AsRemoveDebugMacros - * - * DESCRIPTION: Remove all "Debug" macros -- macros that produce debug output. - * - ******************************************************************************/ - -void -AsRemoveDebugMacros ( - char *Buffer) -{ - AsRemoveConditionalCompile (Buffer, "ACPI_DEBUG_OUTPUT"); - - AsRemoveStatement (Buffer, "ACPI_DEBUG_PRINT", REPLACE_WHOLE_WORD); - AsRemoveStatement (Buffer, "ACPI_DEBUG_PRINT_RAW", REPLACE_WHOLE_WORD); - AsRemoveStatement (Buffer, "DEBUG_EXEC", REPLACE_WHOLE_WORD); - AsRemoveStatement (Buffer, "FUNCTION_ENTRY", REPLACE_WHOLE_WORD); - AsRemoveStatement (Buffer, "PROC_NAME", REPLACE_WHOLE_WORD); - AsRemoveStatement (Buffer, "FUNCTION_TRACE", REPLACE_SUBSTRINGS); - AsRemoveStatement (Buffer, "DUMP_", REPLACE_SUBSTRINGS); - - AsReplaceString ("return_VOID", "return", REPLACE_WHOLE_WORD, Buffer); - AsReplaceString ("return_PTR", "return", REPLACE_WHOLE_WORD, Buffer); - AsReplaceString ("return_ACPI_STATUS", "return", REPLACE_WHOLE_WORD, Buffer); - AsReplaceString ("return_acpi_status", "return", REPLACE_WHOLE_WORD, Buffer); - AsReplaceString ("return_VALUE", "return", REPLACE_WHOLE_WORD, Buffer); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/asutils.c b/sys/dev/acpi/acpica/Subsystem/asutils.c deleted file mode 100644 index 5ac720cd6e2..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/asutils.c +++ /dev/null @@ -1,307 +0,0 @@ - -/****************************************************************************** - * - * Module Name: asutils - common utilities - * $Revision: 9 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - -#include "acpisrc.h" - - -/****************************************************************************** - * - * FUNCTION: AsSkipUntilChar - * - * DESCRIPTION: Find the next instance of the input character - * - ******************************************************************************/ - -char * -AsSkipUntilChar ( - char *Buffer, - char Target) -{ - - while (*Buffer != Target) - { - if (!*Buffer) - { - return NULL; - } - - Buffer++; - } - - return (Buffer); -} - - -/****************************************************************************** - * - * FUNCTION: AsSkipPastChar - * - * DESCRIPTION: Find the next instance of the input character, return a buffer - * pointer to this character+1. - * - ******************************************************************************/ - -char * -AsSkipPastChar ( - char *Buffer, - char Target) -{ - - while (*Buffer != Target) - { - if (!*Buffer) - { - return NULL; - } - - Buffer++; - } - - Buffer++; - - return (Buffer); -} - - -/****************************************************************************** - * - * FUNCTION: AsReplaceData - * - * DESCRIPTION: This function inserts and removes data from the file buffer. - * if more data is inserted than is removed, the data in the buffer - * is moved to make room. If less data is inserted than is removed, - * the remaining data is moved to close the hole. - * - ******************************************************************************/ - -char * -AsReplaceData ( - char *Buffer, - UINT32 LengthToRemove, - char *BufferToAdd, - UINT32 LengthToAdd) -{ - UINT32 BufferLength; - - - /* - * Buffer is a string, so the length must include the terminating zero - */ - BufferLength = strlen (Buffer) + 1; - - if (LengthToRemove != LengthToAdd) - { - /* - * Move some of the existing data - * 1) If adding more bytes than removing, make room for the new data - * 2) if removing more bytes than adding, delete the extra space - */ - if (LengthToRemove > 0) - { - Gbl_MadeChanges = TRUE; - memmove ((Buffer + LengthToAdd), (Buffer + LengthToRemove), (BufferLength - LengthToRemove)); - } - } - - /* - * Now we can move in the new data - */ - if (LengthToAdd > 0) - { - Gbl_MadeChanges = TRUE; - memmove (Buffer, BufferToAdd, LengthToAdd); - } - - return (Buffer + LengthToAdd); -} - - -/****************************************************************************** - * - * FUNCTION: AsInsertData - * - * DESCRIPTION: This function inserts and removes data from the file buffer. - * if more data is inserted than is removed, the data in the buffer - * is moved to make room. If less data is inserted than is removed, - * the remaining data is moved to close the hole. - * - ******************************************************************************/ - -char * -AsInsertData ( - char *Buffer, - char *BufferToAdd, - UINT32 LengthToAdd) -{ - UINT32 BufferLength; - - - if (LengthToAdd > 0) - { - /* - * Buffer is a string, so the length must include the terminating zero - */ - BufferLength = strlen (Buffer) + 1; - - /* - * Move some of the existing data - * 1) If adding more bytes than removing, make room for the new data - * 2) if removing more bytes than adding, delete the extra space - */ - Gbl_MadeChanges = TRUE; - memmove ((Buffer + LengthToAdd), Buffer, BufferLength); - - /* - * Now we can move in the new data - */ - memmove (Buffer, BufferToAdd, LengthToAdd); - } - - return (Buffer + LengthToAdd); -} - - -/****************************************************************************** - * - * FUNCTION: AsRemoveData - * - * DESCRIPTION: This function inserts and removes data from the file buffer. - * if more data is inserted than is removed, the data in the buffer - * is moved to make room. If less data is inserted than is removed, - * the remaining data is moved to close the hole. - * - ******************************************************************************/ - -char * -AsRemoveData ( - char *StartPointer, - char *EndPointer) -{ - UINT32 BufferLength; - - - /* - * Buffer is a string, so the length must include the terminating zero - */ - BufferLength = strlen (EndPointer) + 1; - - Gbl_MadeChanges = TRUE; - memmove (StartPointer, EndPointer, BufferLength); - - return (StartPointer); -} - diff --git a/sys/dev/acpi/acpica/Subsystem/dbdisasm.c b/sys/dev/acpi/acpica/Subsystem/dbdisasm.c deleted file mode 100644 index 71635531ccf..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/dbdisasm.c +++ /dev/null @@ -1,871 +0,0 @@ -/******************************************************************************* - * - * Module Name: dbdisasm - parser op tree display routines - * $Revision: 1.5 $ - * - ******************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2002, 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. - * - *****************************************************************************/ - -#include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: dbdisasm.c,v 1.5 2002/06/15 17:59:50 thorpej Exp $"); - -#include "acpi.h" -#include "acparser.h" -#include "amlcode.h" -#include "acnamesp.h" -#include "acdebug.h" - - -#ifdef ENABLE_DEBUGGER - -#define _COMPONENT ACPI_DEBUGGER - ACPI_MODULE_NAME ("dbdisasm") - - -#define BLOCK_PAREN 1 -#define BLOCK_BRACE 2 -#define DB_NO_OP_INFO " [%2.2d] " -#define DB_FULL_OP_INFO "%5.5X #%4.4hX [%2.2d] " - - -NATIVE_CHAR *AcpiGbl_DbDisasmIndent = "...."; - - -/******************************************************************************* - * - * FUNCTION: AcpiDbBlockType - * - * PARAMETERS: Op - Object to be examined - * - * RETURN: Status - * - * DESCRIPTION: Type of block for this op (parens or braces) - * - ******************************************************************************/ - -UINT32 -AcpiDbBlockType ( - ACPI_PARSE_OBJECT *Op) -{ - - switch (Op->Common.AmlOpcode) - { - case AML_METHOD_OP: - return (BLOCK_BRACE); - - default: - break; - } - - return (BLOCK_PAREN); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsDisplayObjectPathname - * - * PARAMETERS: Op - Object whose pathname is to be obtained - * - * RETURN: Status - * - * DESCRIPTION: Diplay the pathname associated with a named object. Two - * versions. One searches the parse tree (for parser-only - * applications suchas AcpiDump), and the other searches the - * ACPI namespace (the parse tree is probably deleted) - * - ******************************************************************************/ - -#ifdef PARSER_ONLY - -ACPI_STATUS -AcpiPsDisplayObjectPathname ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *TargetOp; - char *Name; - - - if (Op->Common.Flags & ACPI_PARSEOP_GENERIC) - { - Name = Op->Common.Value.Name; - if (Name[0] == '\\') - { - AcpiOsPrintf (" (Fully Qualified Pathname)"); - return (AE_OK); - } - } - else - { - Name = (char *) &Op->Named.Name; - } - - /* Search parent tree up to the root if necessary */ - - TargetOp = AcpiPsFind (Op, Name, 0, 0); - if (!TargetOp) - { - /* - * Didn't find the name in the parse tree. This may be - * a problem, or it may simply be one of the predefined names - * (such as _OS_). Rather than worry about looking up all - * the predefined names, just display the name as given - */ - AcpiOsPrintf (" **** Path not found in parse tree"); - } - else - { - /* The target was found, print the name and complete path */ - - AcpiOsPrintf (" (Path "); - AcpiDbDisplayPath (TargetOp); - AcpiOsPrintf (")"); - } - - return (AE_OK); -} - -#else - -ACPI_STATUS -AcpiPsDisplayObjectPathname ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - ACPI_STATUS Status; - ACPI_NAMESPACE_NODE *Node; - ACPI_BUFFER Buffer; - UINT32 DebugLevel; - - - /* Save current debug level so we don't get extraneous debug output */ - - DebugLevel = AcpiDbgLevel; - AcpiDbgLevel = 0; - - /* Just get the Node out of the Op object */ - - Node = Op->Common.Node; - if (!Node) - { - /* Node not defined in this scope, look it up */ - - Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, ACPI_TYPE_ANY, - ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node)); - - if (ACPI_FAILURE (Status)) - { - /* - * We can't get the pathname since the object - * is not in the namespace. This can happen during single - * stepping where a dynamic named object is *about* to be created. - */ - AcpiOsPrintf (" [Path not found]"); - goto Exit; - } - - /* Save it for next time. */ - - Op->Common.Node = Node; - } - - /* Convert NamedDesc/handle to a full pathname */ - - Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiNsHandleToPathname (Node, &Buffer); - if (ACPI_FAILURE (Status)) - { - AcpiOsPrintf ("****Could not get pathname****)"); - goto Exit; - } - - AcpiOsPrintf (" (Path %s)", Buffer.Pointer); - ACPI_MEM_FREE (Buffer.Pointer); - - -Exit: - /* Restore the debug level */ - - AcpiDbgLevel = DebugLevel; - return (Status); -} - -#endif - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayOp - * - * PARAMETERS: Origin - Starting object - * NumOpcodes - Max number of opcodes to be displayed - * - * RETURN: None - * - * DESCRIPTION: Display parser object and its children - * - ******************************************************************************/ - -void -AcpiDbDisplayOp ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Origin, - UINT32 NumOpcodes) -{ - ACPI_PARSE_OBJECT *Op = Origin; - ACPI_PARSE_OBJECT *arg; - ACPI_PARSE_OBJECT *depth; - UINT32 DepthCount = 0; - UINT32 LastDepth = 0; - UINT32 i; - UINT32 j; - - - if (!Op) - { - AcpiDbDisplayOpcode (WalkState, Op); - return; - } - - - while (Op) - { - /* Indentation */ - - DepthCount = 0; - if (!AcpiGbl_DbOpt_verbose) - { - DepthCount++; - } - - /* Determine the nesting depth of this argument */ - - for (depth = Op->Common.Parent; depth; depth = depth->Common.Parent) - { - arg = AcpiPsGetArg (depth, 0); - while (arg && arg != Origin) - { - arg = arg->Common.Next; - } - - if (arg) - { - break; - } - - DepthCount++; - } - - /* Open a new block if we are nested further than last time */ - - if (DepthCount > LastDepth) - { - VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth)); - for (i = 0; i < LastDepth; i++) - { - AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); - } - - if (AcpiDbBlockType (Op) == BLOCK_PAREN) - { - AcpiOsPrintf ("(\n"); - } - else - { - AcpiOsPrintf ("{\n"); - } - } - - /* Close a block if we are nested less than last time */ - - else if (DepthCount < LastDepth) - { - for (j = LastDepth; j >= (DepthCount + 1); j--) - { - VERBOSE_PRINT ((DB_NO_OP_INFO, (j - 1))); - for (i = 1; i < j; i++) - { - AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); - } - - if (AcpiDbBlockType (Op) == BLOCK_PAREN) - { - AcpiOsPrintf (")\n"); - } - else - { - AcpiOsPrintf ("}\n"); - } - } - } - - /* In verbose mode, print the AML offset, opcode and depth count */ - - VERBOSE_PRINT ((DB_FULL_OP_INFO, (UINT32) Op->Common.AmlOffset, - Op->Common.AmlOpcode, DepthCount)); - - - /* Indent the output according to the depth count */ - - for (i = 0; i < DepthCount; i++) - { - AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); - } - - /* Now print the opcode */ - - AcpiDbDisplayOpcode (WalkState, Op); - - /* Resolve a name reference */ - - if ((Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP && Op->Common.Value.Name) && - (Op->Common.Parent) && - (AcpiGbl_DbOpt_verbose)) - { - (void) AcpiPsDisplayObjectPathname (WalkState, Op); - } - - AcpiOsPrintf ("\n"); - - /* Get the next node in the tree */ - - Op = AcpiPsGetDepthNext (Origin, Op); - LastDepth = DepthCount; - - NumOpcodes--; - if (!NumOpcodes) - { - Op = NULL; - } - } - - /* Close the last block(s) */ - - DepthCount = LastDepth -1; - for (i = 0; i < LastDepth; i++) - { - VERBOSE_PRINT ((DB_NO_OP_INFO, LastDepth - i)); - for (j = 0; j < DepthCount; j++) - { - AcpiOsPrintf ("%s", AcpiGbl_DbDisasmIndent); - } - AcpiOsPrintf ("}\n"); - DepthCount--; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayNamestring - * - * PARAMETERS: Name - ACPI Name string to store - * - * RETURN: None - * - * DESCRIPTION: Display namestring. Handles prefix characters - * - ******************************************************************************/ - -void -AcpiDbDisplayNamestring ( - NATIVE_CHAR *Name) -{ - UINT32 SegCount; - - - if (!Name) - { - AcpiOsPrintf ("<NULL NAME PTR>"); - return; - } - - /* Handle all Scope Prefix operators */ - - while (AcpiPsIsPrefixChar (ACPI_GET8 (Name))) - { - /* Append prefix character */ - - AcpiOsPrintf ("%1c", ACPI_GET8 (Name)); - Name++; - } - - switch (ACPI_GET8 (Name)) - { - case 0: - SegCount = 0; - break; - - case AML_DUAL_NAME_PREFIX: - SegCount = 2; - Name++; - break; - - case AML_MULTI_NAME_PREFIX_OP: - SegCount = (UINT32) ACPI_GET8 (Name + 1); - Name += 2; - break; - - default: - SegCount = 1; - break; - } - - while (SegCount) - { - /* Append Name segment */ - - AcpiOsPrintf ("%4.4s", Name); - - SegCount--; - if (SegCount) - { - /* Not last name, append dot separator */ - - AcpiOsPrintf ("."); - } - Name += ACPI_NAME_SIZE; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayPath - * - * PARAMETERS: Op - Named Op whose path is to be constructed - * - * RETURN: None - * - * DESCRIPTION: Walk backwards from current scope and display the name - * of each previous level of scope up to the root scope - * (like "pwd" does with file systems) - * - ******************************************************************************/ - -void -AcpiDbDisplayPath ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Prev; - ACPI_PARSE_OBJECT *Search; - UINT32 Name; - BOOLEAN DoDot = FALSE; - ACPI_PARSE_OBJECT *NamePath; - const ACPI_OPCODE_INFO *OpInfo; - - - /* We are only interested in named objects */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (!(OpInfo->Flags & AML_NSNODE)) - { - return; - } - - if (OpInfo->Flags & AML_CREATE) - { - /* Field creation - check for a fully qualified namepath */ - - if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) - { - NamePath = AcpiPsGetArg (Op, 3); - } - else - { - NamePath = AcpiPsGetArg (Op, 2); - } - - if ((NamePath) && - (NamePath->Common.Value.String) && - (NamePath->Common.Value.String[0] == '\\')) - { - AcpiDbDisplayNamestring (NamePath->Common.Value.String); - return; - } - } - - Prev = NULL; /* Start with Root Node */ - - while (Prev != Op) - { - /* Search upwards in the tree to find scope with "prev" as its parent */ - - Search = Op; - for (; ;) - { - if (Search->Common.Parent == Prev) - { - break; - } - - /* Go up one level */ - - Search = Search->Common.Parent; - } - - if (Prev) - { - OpInfo = AcpiPsGetOpcodeInfo (Search->Common.AmlOpcode); - if (!(OpInfo->Flags & AML_FIELD)) - { - /* below root scope, append scope name */ - - if (DoDot) - { - /* append dot */ - - AcpiOsPrintf ("."); - } - - if (OpInfo->Flags & AML_CREATE) - { - if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) - { - NamePath = AcpiPsGetArg (Op, 3); - } - else - { - NamePath = AcpiPsGetArg (Op, 2); - } - - if ((NamePath) && - (NamePath->Common.Value.String)) - { - AcpiOsPrintf ("%4.4s", NamePath->Common.Value.String); - } - } - else - { - Name = AcpiPsGetName (Search); - AcpiOsPrintf ("%4.4s", &Name); - } - - DoDot = TRUE; - } - } - - Prev = Search; - } -} - - -/******************************************************************************* - * - * FUNCTION: AcpiDbDisplayOpcode - * - * PARAMETERS: Op - Op that is to be printed - * - * RETURN: Status - * - * DESCRIPTION: Store printed op in a Buffer and return its length - * (or -1 if out of space) - * - * NOTE: Terse mode prints out ASL-like code. Verbose mode adds more info. - * - ******************************************************************************/ - -void -AcpiDbDisplayOpcode ( - ACPI_WALK_STATE *WalkState, - ACPI_PARSE_OBJECT *Op) -{ - UINT8 *ByteData; - UINT32 ByteCount; - UINT32 i; - const ACPI_OPCODE_INFO *OpInfo = NULL; - UINT32 Name; - - - if (!Op) - { - AcpiOsPrintf ("<NULL OP PTR>"); - return; - } - - /* op and arguments */ - - switch (Op->Common.AmlOpcode) - { - case AML_BYTE_OP: - - if (AcpiGbl_DbOpt_verbose) - { - AcpiOsPrintf ("(UINT8) 0x%2.2hX", Op->Common.Value.Integer8); - } - else - { - AcpiOsPrintf ("0x%2.2hX", Op->Common.Value.Integer8); - } - break; - - - case AML_WORD_OP: - - if (AcpiGbl_DbOpt_verbose) - { - AcpiOsPrintf ("(UINT16) 0x%4.4hX", Op->Common.Value.Integer16); - } - else - { - AcpiOsPrintf ("0x%4.4hX", Op->Common.Value.Integer16); - } - break; - - - case AML_DWORD_OP: - - if (AcpiGbl_DbOpt_verbose) - { - AcpiOsPrintf ("(UINT32) 0x%8.8X", Op->Common.Value.Integer32); - } - else - { - AcpiOsPrintf ("0x%8.8X", Op->Common.Value.Integer32); - } - break; - - - case AML_QWORD_OP: - - if (AcpiGbl_DbOpt_verbose) - { - AcpiOsPrintf ("(UINT64) 0x%8.8X%8.8X", Op->Common.Value.Integer64.Hi, - Op->Common.Value.Integer64.Lo); - } - else - { - AcpiOsPrintf ("0x%8.8X%8.8X", Op->Common.Value.Integer64.Hi, - Op->Common.Value.Integer64.Lo); - } - break; - - - case AML_STRING_OP: - - if (Op->Common.Value.String) - { - AcpiOsPrintf ("\"%s\"", Op->Common.Value.String); - } - else - { - AcpiOsPrintf ("<\"NULL STRING PTR\">"); - } - break; - - - case AML_INT_STATICSTRING_OP: - - if (Op->Common.Value.String) - { - AcpiOsPrintf ("\"%s\"", Op->Common.Value.String); - } - else - { - AcpiOsPrintf ("\"<NULL STATIC STRING PTR>\""); - } - break; - - - case AML_INT_NAMEPATH_OP: - - AcpiDbDisplayNamestring (Op->Common.Value.Name); - break; - - - case AML_INT_NAMEDFIELD_OP: - - AcpiOsPrintf ("NamedField (Length 0x%8.8X) ", Op->Common.Value.Integer32); - break; - - - case AML_INT_RESERVEDFIELD_OP: - - AcpiOsPrintf ("ReservedField (Length 0x%8.8X) ", Op->Common.Value.Integer32); - break; - - - case AML_INT_ACCESSFIELD_OP: - - AcpiOsPrintf ("AccessField (Length 0x%8.8X) ", Op->Common.Value.Integer32); - break; - - - case AML_INT_BYTELIST_OP: - - if (AcpiGbl_DbOpt_verbose) - { - AcpiOsPrintf ("ByteList (Length 0x%8.8X) ", Op->Common.Value.Integer32); - } - else - { - AcpiOsPrintf ("0x%2.2X", Op->Common.Value.Integer32); - - ByteCount = Op->Common.Value.Integer32; - ByteData = Op->Named.Data; - - for (i = 0; i < ByteCount; i++) - { - AcpiOsPrintf (", 0x%2.2X", ByteData[i]); - } - } - break; - - - default: - - /* Just get the opcode name and print it */ - - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - AcpiOsPrintf ("%s", OpInfo->Name); - - -#ifndef PARSER_ONLY - if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) && - (WalkState) && - (WalkState->Results) && - (WalkState->Results->Results.NumResults)) - { - AcpiDbDecodeInternalObject (WalkState->Results->Results.ObjDesc [WalkState->Results->Results.NumResults-1]); - } -#endif - break; - } - - if (!OpInfo) - { - /* If there is another element in the list, add a comma */ - - if (Op->Common.Next) - { - AcpiOsPrintf (","); - } - } - - /* - * If this is a named opcode, print the associated name value - */ - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - if (Op && (OpInfo->Flags & AML_NAMED)) - { - Name = AcpiPsGetName (Op); - AcpiOsPrintf (" %4.4s", &Name); - - if ((AcpiGbl_DbOpt_verbose) && (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)) - { - (void) AcpiPsDisplayObjectPathname (WalkState, Op); - } - } -} - -#endif /* ENABLE_DEBUGGER */ - diff --git a/sys/dev/acpi/acpica/Subsystem/getopt.c b/sys/dev/acpi/acpica/Subsystem/getopt.c deleted file mode 100644 index 05d22b32229..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/getopt.c +++ /dev/null @@ -1,246 +0,0 @@ - -/****************************************************************************** - * - * Module Name: getopt - * $Revision: 6 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include <stdio.h> -#include <string.h> - -#define ERR(szz,czz) if(AcpiGbl_Opterr){fprintf(stderr,"%s%s%c\n",argv[0],szz,czz);} - - -int AcpiGbl_Opterr = 1; -int AcpiGbl_Optind = 1; -int AcpiGbl_Optopt; -char *AcpiGbl_Optarg; - - -/******************************************************************************* - * - * FUNCTION: AcpiGetopt - * - * PARAMETERS: argc, argv - from main - * opts - options info list - * - * RETURN: Option character or EOF - * - * DESCRIPTION: Get the next option - * - ******************************************************************************/ - -int -AcpiGetopt( - int argc, - char **argv, - char *opts) -{ - static int CurrentCharPtr = 1; - int CurrentChar; - char *OptsPtr; - - - if (CurrentCharPtr == 1) - { - if (AcpiGbl_Optind >= argc || - argv[AcpiGbl_Optind][0] != '-' || - argv[AcpiGbl_Optind][1] == '\0') - { - return(EOF); - } - else if (strcmp (argv[AcpiGbl_Optind], "--") == 0) - { - AcpiGbl_Optind++; - return(EOF); - } - } - - /* Get the option */ - - CurrentChar = - AcpiGbl_Optopt = - argv[AcpiGbl_Optind][CurrentCharPtr]; - - /* Make sure that the option is legal */ - - if (CurrentChar == ':' || - (OptsPtr = strchr (opts, CurrentChar)) == NULL) - { - ERR (": illegal option -- ", CurrentChar); - - if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0') - { - AcpiGbl_Optind++; - CurrentCharPtr = 1; - } - - return ('?'); - } - - /* Option requires an argument? */ - - if (*++OptsPtr == ':') - { - if (argv[AcpiGbl_Optind][CurrentCharPtr+1] != '\0') - { - AcpiGbl_Optarg = &argv[AcpiGbl_Optind++][CurrentCharPtr+1]; - } - else if (++AcpiGbl_Optind >= argc) - { - ERR (": option requires an argument -- ", CurrentChar); - - CurrentCharPtr = 1; - return ('?'); - } - else - { - AcpiGbl_Optarg = argv[AcpiGbl_Optind++]; - } - - CurrentCharPtr = 1; - } - - /* Option has optional single-char arguments? */ - - else if (*OptsPtr == '^') - { - if (argv[AcpiGbl_Optind][CurrentCharPtr+1] != '\0') - { - AcpiGbl_Optarg = &argv[AcpiGbl_Optind][CurrentCharPtr+1]; - } - else - { - AcpiGbl_Optarg = "^"; - } - - AcpiGbl_Optind++; - CurrentCharPtr = 1; - } - - /* Option with no arguments */ - - else - { - if (argv[AcpiGbl_Optind][++CurrentCharPtr] == '\0') - { - CurrentCharPtr = 1; - AcpiGbl_Optind++; - } - - AcpiGbl_Optarg = NULL; - } - - return (CurrentChar); -} diff --git a/sys/dev/acpi/acpica/Subsystem/osunixdir.c b/sys/dev/acpi/acpica/Subsystem/osunixdir.c deleted file mode 100644 index 8c15b5755c6..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/osunixdir.c +++ /dev/null @@ -1,303 +0,0 @@ - -/****************************************************************************** - * - * Module Name: osunixdir - Unix directory access interfaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <dirent.h> -#include <fnmatch.h> -#include <ctype.h> -#include <sys/stat.h> - -#include "acpisrc.h" - -typedef struct ExternalFindInfo -{ - char *DirPathname; - DIR *DirPtr; - char temp_buffer[128]; - char *WildcardSpec; - char RequestedFileType; - -} EXTERNAL_FIND_INFO; - - -/******************************************************************************* - * - * FUNCTION: AcpiOsOpenDirectory - * - * PARAMETERS: DirPathname - Full pathname to the directory - * WildcardSpec - string of the form "*.c", etc. - * - * RETURN: A directory "handle" to be used in subsequent search operations. - * NULL returned on failure. - * - * DESCRIPTION: Open a directory in preparation for a wildcard search - * - ******************************************************************************/ - -void * -AcpiOsOpenDirectory ( - char *DirPathname, - char *WildcardSpec, - char RequestedFileType) -{ - EXTERNAL_FIND_INFO *ExternalInfo; - DIR *dir; - - - /* Allocate the info struct that will be returned to the caller */ - - ExternalInfo = calloc (sizeof (EXTERNAL_FIND_INFO), 1); - if (!ExternalInfo) - { - return NULL; - } - - /* Get the directory stream */ - - dir = opendir(DirPathname); - if (!dir) - { - free(ExternalInfo); - return NULL; - } - - /* Save the info in the return structure */ - - ExternalInfo->WildcardSpec = WildcardSpec; - ExternalInfo->RequestedFileType = RequestedFileType; - ExternalInfo->DirPathname = DirPathname; - ExternalInfo->DirPtr = dir; - return (ExternalInfo); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsGetNextFilename - * - * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory - * - * RETURN: Next filename matched. NULL if no more matches. - * - * DESCRIPTION: Get the next file in the directory that matches the wildcard - * specification. - * - ******************************************************************************/ - -char * -AcpiOsGetNextFilename ( - void *DirHandle) -{ - EXTERNAL_FIND_INFO *ExternalInfo = DirHandle; - struct dirent *dir_entry; - - while((dir_entry = readdir(ExternalInfo->DirPtr))) - { - if (!fnmatch(ExternalInfo->WildcardSpec, dir_entry->d_name, 0)) - { - char *temp_str; - int str_len; - struct stat temp_stat; - int err; - - if (dir_entry->d_name[0] == '.') - continue; - - str_len = strlen(dir_entry->d_name) + strlen (ExternalInfo->DirPathname) + 2; - - temp_str = calloc(str_len, 1); - if (!temp_str) - { - printf ("Could not allocate buffer for temporary string\n"); - return NULL; - } - - strcpy(temp_str, ExternalInfo->DirPathname); - strcat(temp_str, "/"); - strcat(temp_str, dir_entry->d_name); - - err = stat(temp_str, &temp_stat); - free (temp_str); - if (err == -1) - { - printf ("stat() error - should not happen\n"); - return NULL; - } - - if ((S_ISDIR(temp_stat.st_mode) - && (ExternalInfo->RequestedFileType == REQUEST_DIR_ONLY)) - || - ((!S_ISDIR(temp_stat.st_mode) - && ExternalInfo->RequestedFileType == REQUEST_FILE_ONLY))) - { - /* copy to a temp buffer because dir_entry struct is on the stack */ - strcpy(ExternalInfo->temp_buffer, dir_entry->d_name); - return (ExternalInfo->temp_buffer); - } - } - } - - return NULL; -} - - -/******************************************************************************* - * - * FUNCTION: AcpiOsCloseDirectory - * - * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory - * - * RETURN: None. - * - * DESCRIPTION: Close the open directory and cleanup. - * - ******************************************************************************/ - -void -AcpiOsCloseDirectory ( - void *DirHandle) -{ - EXTERNAL_FIND_INFO *ExternalInfo = DirHandle; - - - /* Close the directory and free allocations */ - - closedir(ExternalInfo->DirPtr); - free (DirHandle); -} - -/* Other functions acpisrc uses but that aren't standard on Unix */ - -/* lowercase a string */ -char* -strlwr ( - char *str) -{ - int length; - int i; - - length = strlen(str); - - for (i = 0; i < length; i++) - { - str[i] = tolower(str[i]); - } - - return str; -} diff --git a/sys/dev/acpi/acpica/Subsystem/osunixxf.c b/sys/dev/acpi/acpica/Subsystem/osunixxf.c deleted file mode 100644 index da927fe9155..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/osunixxf.c +++ /dev/null @@ -1,1024 +0,0 @@ -/****************************************************************************** - * - * Module Name: osunixxf - UNIX OSL interfaces - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2003, 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. - * - *****************************************************************************/ - - -/* - * These interfaces are required in order to compile the ASL compiler under - * Linux. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <stdarg.h> -#include <unistd.h> -#include <sys/time.h> - -#include "acpi.h" -#include "amlcode.h" -#include "acparser.h" -#include "acdebug.h" - -#define _COMPONENT ACPI_OS_SERVICES - ACPI_MODULE_NAME ("osunixxf") - - -extern FILE *AcpiGbl_DebugFile; -FILE *AcpiGbl_OutputFile; - - -/****************************************************************************** - * - * FUNCTION: AcpiOsInitialize, AcpiOsTerminate - * - * PARAMETERS: None - * - * RETURN: Status - * - * DESCRIPTION: Init and terminate. Nothing to do. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsInitialize (void) -{ - AcpiGbl_OutputFile = stdout; - - return AE_OK; -} - - -ACPI_STATUS -AcpiOsTerminate (void) -{ - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsGetRootPointer - * - * PARAMETERS: Flags - Logical or physical addressing mode - * Address - Where the address is returned - * - * RETURN: Status - * - * DESCRIPTION: Gets the root pointer (RSDP) - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsGetRootPointer ( - UINT32 Flags, - ACPI_POINTER *Address) -{ - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsTableOverride - * - * PARAMETERS: ExistingTable - Header of current table (probably firmware) - * NewTable - Where an entire new table is returned. - * - * RETURN: Status, pointer to new table. Null pointer returned if no - * table is available to override - * - * DESCRIPTION: Return a different version of a table if one is available - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsTableOverride ( - ACPI_TABLE_HEADER *ExistingTable, - ACPI_TABLE_HEADER **NewTable) -{ - - if (!ExistingTable || !NewTable) - { - return (AE_BAD_PARAMETER); - } - - *NewTable = NULL; - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsReadable - * - * PARAMETERS: Pointer - Area to be verified - * Length - Size of area - * - * RETURN: TRUE if readable for entire length - * - * DESCRIPTION: Verify that a pointer is valid for reading - * - *****************************************************************************/ - -BOOLEAN -AcpiOsReadable ( - void *Pointer, - UINT32 Length) -{ - - return (TRUE); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsWritable - * - * PARAMETERS: Pointer - Area to be verified - * Length - Size of area - * - * RETURN: TRUE if writable for entire length - * - * DESCRIPTION: Verify that a pointer is valid for writing - * - *****************************************************************************/ - -BOOLEAN -AcpiOsWritable ( - void *Pointer, - UINT32 Length) -{ - - return (TRUE); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsRedirectOutput - * - * PARAMETERS: Destination - An open file handle/pointer - * - * RETURN: None - * - * DESCRIPTION: Causes redirect of AcpiOsPrintf and AcpiOsVprintf - * - *****************************************************************************/ - -void -AcpiOsRedirectOutput ( - void *Destination) -{ - - AcpiGbl_OutputFile = Destination; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsPrintf - * - * PARAMETERS: fmt, ... Standard printf format - * - * RETURN: None - * - * DESCRIPTION: Formatted output - * - *****************************************************************************/ - -void ACPI_INTERNAL_VAR_XFACE -AcpiOsPrintf ( - const char *Fmt, - ...) -{ - va_list Args; - - - va_start (Args, Fmt); - - AcpiOsVprintf (Fmt, Args); - - va_end (Args); - return; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsVprintf - * - * PARAMETERS: fmt Standard printf format - * args Argument list - * - * RETURN: None - * - * DESCRIPTION: Formatted output with argument list pointer - * - *****************************************************************************/ - -void -AcpiOsVprintf ( - const char *Fmt, - va_list Args) -{ - INT32 Count = 0; - UINT8 Flags; - - - Flags = AcpiGbl_DbOutputFlags; - if (Flags & ACPI_DB_REDIRECTABLE_OUTPUT) - { - /* Output is directable to either a file (if open) or the console */ - - if (AcpiGbl_DebugFile) - { - /* Output file is open, send the output there */ - - Count = vfprintf (AcpiGbl_DebugFile, Fmt, Args); - } - else - { - /* No redirection, send output to console (once only!) */ - - Flags |= ACPI_DB_CONSOLE_OUTPUT; - } - } - - if (Flags & ACPI_DB_CONSOLE_OUTPUT) - { - Count = vfprintf (AcpiGbl_OutputFile, Fmt, Args); - } - - return; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsGetLine - * - * PARAMETERS: fmt Standard printf format - * args Argument list - * - * RETURN: Actual bytes read - * - * DESCRIPTION: Formatted input with argument list pointer - * - *****************************************************************************/ - -UINT32 -AcpiOsGetLine ( - char *Buffer) -{ - UINT8 Temp; - UINT32 i; - - - for (i = 0; ; i++) - { - scanf ("%1c", &Temp); - if (!Temp || Temp == '\n') - { - break; - } - - Buffer [i] = Temp; - } - - /* Null terminate the buffer */ - - Buffer [i] = 0; - - /* Return the number of bytes in the string */ - - return (i); -} - -/****************************************************************************** - * - * FUNCTION: AcpiOsMapMemory - * - * PARAMETERS: where Physical address of memory to be mapped - * length How much memory to map - * there Logical address of mapped memory - * - * RETURN: Pointer to mapped memory. Null on error. - * - * DESCRIPTION: Map physical memory into caller's address space - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsMapMemory ( - ACPI_PHYSICAL_ADDRESS where, - UINT32 length, - void **there) -{ - *there = (void *) (UINT32) where; - - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsUnmapMemory - * - * PARAMETERS: where Logical address of memory to be unmapped - * length How much memory to unmap - * - * RETURN: None. - * - * DESCRIPTION: Delete a previously created mapping. Where and Length must - * correspond to a previous mapping exactly. - * - *****************************************************************************/ - -void -AcpiOsUnmapMemory ( - void *where, - UINT32 length) -{ - - return; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsAllocate - * - * PARAMETERS: Size Amount to allocate, in bytes - * - * RETURN: Pointer to the new allocation. Null on error. - * - * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. - * - *****************************************************************************/ - -void * -AcpiOsAllocate ( - UINT32 size) -{ - void *Mem; - - - Mem = (void *) malloc ((size_t) size); - - return Mem; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsFree - * - * PARAMETERS: mem Pointer to previously allocated memory - * - * RETURN: None. - * - * DESCRIPTION: Free memory allocated via AcpiOsAllocate - * - *****************************************************************************/ - -void -AcpiOsFree ( - void *mem) -{ - - - free (mem); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsCreateSemaphore - * - * PARAMETERS: InitialUnits - Units to be assigned to the new semaphore - * OutHandle - Where a handle will be returned - * - * RETURN: Status - * - * DESCRIPTION: Create an OS semaphore - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsCreateSemaphore ( - UINT32 MaxUnits, - UINT32 InitialUnits, - ACPI_HANDLE *OutHandle) -{ - - - *OutHandle = (ACPI_HANDLE) 1; - return AE_OK; -} - -/****************************************************************************** - * - * FUNCTION: AcpiOsDeleteSemaphore - * - * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore - * - * RETURN: Status - * - * DESCRIPTION: Delete an OS semaphore - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsDeleteSemaphore ( - ACPI_HANDLE Handle) -{ - - if (!Handle) - { - return AE_BAD_PARAMETER; - } - - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsWaitSemaphore - * - * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore - * Units - How many units to wait for - * Timeout - How long to wait - * - * RETURN: Status - * - * DESCRIPTION: Wait for units - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsWaitSemaphore ( - ACPI_HANDLE Handle, - UINT32 Units, - UINT16 Timeout) -{ - - - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsSignalSemaphore - * - * PARAMETERS: Handle - Handle returned by AcpiOsCreateSemaphore - * Units - Number of units to send - * - * RETURN: Status - * - * DESCRIPTION: Send units - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsSignalSemaphore ( - ACPI_HANDLE Handle, - UINT32 Units) -{ - - - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsInstallInterruptHandler - * - * PARAMETERS: InterruptNumber Level handler should respond to. - * Isr Address of the ACPI interrupt handler - * ExceptPtr Where status is returned - * - * RETURN: Handle to the newly installed handler. - * - * DESCRIPTION: Install an interrupt handler. Used to install the ACPI - * OS-independent handler. - * - *****************************************************************************/ - -UINT32 -AcpiOsInstallInterruptHandler ( - UINT32 InterruptNumber, - OSD_HANDLER ServiceRoutine, - void *Context) -{ - - - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsRemoveInterruptHandler - * - * PARAMETERS: Handle Returned when handler was installed - * - * RETURN: Status - * - * DESCRIPTION: Uninstalls an interrupt handler. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsRemoveInterruptHandler ( - UINT32 InterruptNumber, - OSD_HANDLER ServiceRoutine) -{ - - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsQueueForExecution - * - * PARAMETERS: Priority - Requested execution priority - * Function - Address of the function to execute - * Context - Passed as a parameter to the function - * - * RETURN: Status. - * - * DESCRIPTION: Sleep at microsecond granularity - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsQueueForExecution ( - UINT32 Priority, - OSD_EXECUTION_CALLBACK Function, - void *Context) -{ - -// _beginthread (Function, (unsigned) 0, Context); - return 0; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsBreakpoint - * - * PARAMETERS: Msg Message to print - * - * RETURN: Status - * - * DESCRIPTION: Print a message and break to the debugger. - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsBreakpoint ( - char *Msg) -{ - - /* Print the message and do an INT 3 */ - - if (Msg) - { - AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg); - } - else - { - AcpiOsPrintf ("At AcpiOsBreakpoint ****\n"); - } - - - return AE_OK; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsSleepUsec - * - * PARAMETERS: microseconds To sleep - * - * RETURN: Blocks until sleep is completed. - * - * DESCRIPTION: Sleep at microsecond granularity - * - *****************************************************************************/ - -void -AcpiOsStall ( - UINT32 microseconds) -{ - - return; -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsSleep - * - * PARAMETERS: seconds To sleep - * milliseconds To sleep - * - * RETURN: Blocks until sleep is completed. - * - * DESCRIPTION: Sleep at second/millisecond granularity - * - *****************************************************************************/ - -void -AcpiOsSleep ( - UINT32 seconds, - UINT32 milliseconds) -{ - - sleep ((seconds * 1000) + milliseconds); - return; -} - -/****************************************************************************** - * - * FUNCTION: AcpiOsGetTimer - * - * PARAMETERS: None - * - * RETURN: Current time in milliseconds - * - * DESCRIPTION: Get the current system time (in milliseconds). - * - *****************************************************************************/ - -UINT32 -AcpiOsGetTimer (void) -{ - struct timeval time; - - gettimeofday(&time, NULL); - - return ((time.tv_sec/1000) + (time.tv_usec*1000)); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsReadPciConfiguration - * - * PARAMETERS: PciId Seg/Bus/Dev - * Register Device Register - * Value Buffer where value is placed - * Width Number of bits - * - * RETURN: Status - * - * DESCRIPTION: Read data from PCI configuration space - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsReadPciConfiguration ( - ACPI_PCI_ID *PciId, - UINT32 Register, - void *Value, - UINT32 Width) -{ - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsWritePciConfiguration - * - * PARAMETERS: PciId Seg/Bus/Dev - * Register Device Register - * Value Value to be written - * Width Number of bits - * - * RETURN: Status. - * - * DESCRIPTION: Write data to PCI configuration space - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsWritePciConfiguration ( - ACPI_PCI_ID *PciId, - UINT32 Register, - ACPI_INTEGER Value, - UINT32 Width) -{ - - return (AE_OK); -} - -/* TEMPORARY STUB FUNCTION */ -void -AcpiOsDerivePciId( - ACPI_HANDLE rhandle, - ACPI_HANDLE chandle, - ACPI_PCI_ID **PciId) -{ - -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsReadPort - * - * PARAMETERS: Address Address of I/O port/register to read - * Value Where value is placed - * Width Number of bits - * - * RETURN: Value read from port - * - * DESCRIPTION: Read data from an I/O port or register - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsReadPort ( - ACPI_IO_ADDRESS Address, - void *Value, - UINT32 Width) -{ - - switch (Width) - { - case 8: - *((UINT8 *) Value) = 0; - break; - - case 16: - *((UINT16 *) Value) = 0; - break; - - case 32: - *((UINT32 *) Value) = 0; - break; - } - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsWritePort - * - * PARAMETERS: Address Address of I/O port/register to write - * Value Value to write - * Width Number of bits - * - * RETURN: None - * - * DESCRIPTION: Write data to an I/O port or register - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsWritePort ( - ACPI_IO_ADDRESS Address, - ACPI_INTEGER Value, - UINT32 Width) -{ - - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsReadMemory - * - * PARAMETERS: Address Physical Memory Address to read - * Value Where value is placed - * Width Number of bits - * - * RETURN: Value read from physical memory address - * - * DESCRIPTION: Read data from a physical memory address - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsReadMemory ( - ACPI_PHYSICAL_ADDRESS Address, - void *Value, - UINT32 Width) -{ - - switch (Width) - { - case 8: - *((UINT8 *) Value) = 0; - break; - - case 16: - *((UINT16 *) Value) = 0; - break; - - case 32: - *((UINT32 *) Value) = 0; - break; - } - return (AE_OK); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsWriteMemory - * - * PARAMETERS: Address Physical Memory Address to write - * Value Value to write - * Width Number of bits - * - * RETURN: None - * - * DESCRIPTION: Write data to a physical memory address - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsWriteMemory ( - ACPI_PHYSICAL_ADDRESS Address, - ACPI_INTEGER Value, - UINT32 Width) -{ - - return (AE_OK); -} - - -UINT32 -AcpiOsGetThreadId(void) -{ - return getpid(); -} - - -/****************************************************************************** - * - * FUNCTION: AcpiOsSignal - * - * PARAMETERS: Function ACPI CA signal function code - * Info Pointer to function-dependent structure - * - * RETURN: Status - * - * DESCRIPTION: Miscellaneous functions - * - *****************************************************************************/ - -ACPI_STATUS -AcpiOsSignal ( - UINT32 Function, - void *Info) -{ - - switch (Function) - { - case ACPI_SIGNAL_FATAL: - break; - - case ACPI_SIGNAL_BREAKPOINT: - - if (Info) - { - AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Info); - } - else - { - AcpiOsPrintf ("At AcpiOsBreakpoint ****\n"); - } - - break; - } - - - return (AE_OK); -} - - diff --git a/sys/dev/acpi/acpica/Subsystem/psfind.c b/sys/dev/acpi/acpica/Subsystem/psfind.c deleted file mode 100644 index 7d820e782dd..00000000000 --- a/sys/dev/acpi/acpica/Subsystem/psfind.c +++ /dev/null @@ -1,487 +0,0 @@ - -/****************************************************************************** - * - * Module Name: psfind - Parse tree search routine - * xRevision: 42 $ - * - *****************************************************************************/ - -/****************************************************************************** - * - * 1. Copyright Notice - * - * Some or all of this work - Copyright (c) 1999 - 2002, 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. - * - *****************************************************************************/ - -#include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: psfind.c,v 1.4 2002/12/23 00:22:13 kanaoka Exp $"); - -#define __PSFIND_C__ - -#include "acpi.h" -#include "acparser.h" -#include "amlcode.h" - -#define _COMPONENT ACPI_PARSER - ACPI_MODULE_NAME ("psfind") - - -/******************************************************************************* - * - * FUNCTION: AcpiPsGetParent - * - * PARAMETERS: Op - Get the parent of this Op - * - * RETURN: The Parent op. - * - * DESCRIPTION: Get op's parent - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT* -AcpiPsGetParent ( - ACPI_PARSE_OBJECT *Op) -{ - ACPI_PARSE_OBJECT *Parent = Op; - - - /* Traverse the tree upward (to root if necessary) */ - - while (Parent) - { - switch (Parent->Common.AmlOpcode) - { - case AML_SCOPE_OP: - case AML_PACKAGE_OP: - case AML_METHOD_OP: - case AML_DEVICE_OP: - case AML_POWER_RES_OP: - case AML_THERMAL_ZONE_OP: - - return (Parent->Common.Parent); - - default: - break; - } - - Parent = Parent->Common.Parent; - } - - return (Parent); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsFindName - * - * PARAMETERS: Scope - Scope to search - * Name - ACPI name to search for - * Opcode - Opcode to search for - * - * RETURN: Op containing the name - * - * DESCRIPTION: Find name segment from a list of acpi_ops. Searches a single - * scope, no more. - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT * -AcpiPsFindName ( - ACPI_PARSE_OBJECT *Scope, - UINT32 Name, - UINT32 Opcode) -{ - ACPI_PARSE_OBJECT *Op; - ACPI_PARSE_OBJECT *Field; - const ACPI_OPCODE_INFO *OpInfo; - - - /* search scope level for matching name segment */ - - Op = AcpiPsGetChild (Scope); - - while (Op) - { - OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode); - - /* Check AML_CREATE first (since some opcodes have AML_FIELD set also )*/ - - if (OpInfo->Flags & AML_CREATE) - { - if (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP) - { - Field = AcpiPsGetArg (Op, 3); - } - else - { - /* CreateXXXField, check name */ - - Field = AcpiPsGetArg (Op, 2); - } - - if ((Field) && - (Field->Common.Value.String) && - (!ACPI_STRNCMP (Field->Common.Value.String, (char *) &Name, ACPI_NAME_SIZE))) - { - return (Op); - } - } - else if (OpInfo->Flags & AML_FIELD) - { - /* Field, search named fields */ - - Field = AcpiPsGetChild (Op); - while (Field) - { - OpInfo = AcpiPsGetOpcodeInfo (Field->Common.AmlOpcode); - - if ((OpInfo->Flags & AML_NAMED) && - AcpiPsGetName (Field) == Name && - (!Opcode || Field->Common.AmlOpcode == Opcode)) - { - return (Field); - } - - Field = Field->Common.Next; - } - } - else if ((OpInfo->Flags & AML_NAMED) && - (AcpiPsGetName (Op) == Name) && - (!Opcode || Op->Common.AmlOpcode == Opcode || Opcode == AML_SCOPE_OP)) - { - break; - } - - Op = Op->Common.Next; - } - - return (Op); -} - - -/******************************************************************************* - * - * FUNCTION: AcpiPsFind - * - * PARAMETERS: Scope - Where to begin the search - * Path - ACPI Path to the named object - * Opcode - Opcode associated with the object - * Create - if TRUE, create the object if not found. - * - * RETURN: Op if found, NULL otherwise. - * - * DESCRIPTION: Find object within scope - * - ******************************************************************************/ - -ACPI_PARSE_OBJECT* -AcpiPsFind ( - ACPI_PARSE_OBJECT *Scope, - NATIVE_CHAR *Path, - UINT16 Opcode, - UINT32 Create) -{ - UINT32 SegCount; - UINT32 Name; - UINT32 NameOp; - ACPI_PARSE_OBJECT *Op = NULL; - BOOLEAN Unprefixed = TRUE; - - - ACPI_FUNCTION_TRACE_PTR ("PsFind", Scope); - - - if (!Scope || !Path) - { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Null path (%p) or scope (%p)!\n", - Path, Scope)); - return_PTR (NULL); - } - - AcpiGbl_PsFindCount++; - -#if 0 - if ((Create) && (Opcode == AML_SCOPE_OP)) - { - Op = AcpiPsAllocOp (AML_SCOPE_OP); - if (Op) - { - AcpiPsSetName (Op, 'XXXX'); - AcpiPsAppendArg (Scope, Op); - } -/* return_PTR (Op);*/ - } -#endif - - /* Handle all prefixes in the name path */ - - while (AcpiPsIsPrefixChar (ACPI_GET8 (Path))) - { - switch (ACPI_GET8 (Path)) - { - case '\\': - - /* Could just use a global for "root scope" here */ - - while (Scope->Common.Parent) - { - Scope = Scope->Common.Parent; - } - break; - - - case '^': - - /* Go up to the next valid scoping Op (method, scope, etc.) */ - - if (AcpiPsGetParent (Scope)) - { - Scope = AcpiPsGetParent (Scope); - } - break; - - default: - /* Should not get here */ - break; - } - - Unprefixed = FALSE; - Path++; - } - - - /* get name segment count */ - - switch (ACPI_GET8 (Path)) - { - case 0: - SegCount = 0; - - /* Null name case */ - - if (Unprefixed) - { - Op = NULL; - } - else - { - Op = Scope; - } - - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Null path, returning current root scope Op=%p\n", Op)); - return_PTR (Op); - - case AML_DUAL_NAME_PREFIX: - SegCount = 2; - Path++; - break; - - case AML_MULTI_NAME_PREFIX_OP: - SegCount = ACPI_GET8 (Path + 1); - Path += 2; - break; - - default: - SegCount = 1; - break; - } - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Search scope %p Segs=%d Opcode=%4.4hX Create=%d\n", - Scope, SegCount, Opcode, Create)); - - - /* match each name segment */ - - while (Scope && SegCount) - { - ACPI_MOVE_UNALIGNED32_TO_32 (&Name, Path); - Path += 4; - SegCount --; - - if (SegCount) - { - NameOp = 0; - } - else - { - NameOp = Opcode; - } - - Op = AcpiPsFindName (Scope, Name, NameOp); - if (Op) - { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "[%4.4s] Found! Op=%p Opcode=%4.4hX\n", - (char *) &Name, Op, Op->Common.AmlOpcode)); - } - - if (!Op) - { - if (Create) - { - /* Create a new Scope level */ - - if (SegCount) - { - Op = AcpiPsAllocOp (AML_SCOPE_OP); - } - else - { - Op = AcpiPsAllocOp (Opcode); - } - - if (Op) - { - AcpiPsSetName (Op, Name); - AcpiPsAppendArg (Scope, Op); - - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "[%4.4s] Not found, created Op=%p Opcode=%4.4hX\n", - (char *) &Name, Op, Opcode)); - } - } - - else if (Unprefixed) - { - /* Search higher scopes for unprefixed name */ - - while (!Op && Scope->Common.Parent) - { - Scope = Scope->Common.Parent; - Op = AcpiPsFindName (Scope, Name, Opcode); - if (Op) - { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "[%4.4s] Found in parent tree! Op=%p Opcode=%4.4hX\n", - (char *) &Name, Op, Op->Common.AmlOpcode)); - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "[%4.4s] Not found in parent=%p\n", - (char *) &Name, Scope)); - } - } - } - else - { - ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, - "Segment [%4.4s] Not Found in scope %p!\n", - (char *) &Name, Scope)); - } - } - - Unprefixed = FALSE; - Scope = Op; - } - - return_PTR (Op); -} - - |
