diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2010-10-13 20:35:34 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2010-10-13 20:35:34 +0000 |
commit | 11641cd290cbb4765d39dadd5a4eee278b8769ee (patch) | |
tree | 8b4567d2d969b27d3900a41337a0ad389480eae7 | |
parent | 65742a25f73183e6d4476539ba18aff6480e73d4 (diff) |
Import ACPICA 20101013.vendor/acpica/20101013
Notes
Notes:
svn path=/vendor-sys/acpica/dist/; revision=213800
svn path=/vendor-sys/acpica/20101013/; revision=213801; tag=vendor/acpica/20101013
41 files changed, 1730 insertions, 1013 deletions
diff --git a/changes.txt b/changes.txt index 9bb84d4c77b3..215384155349 100644 --- a/changes.txt +++ b/changes.txt @@ -1,4 +1,64 @@ ---------------------------------------- +13 October 2010. Summary of changes for version 20101013: + +This release is available at www.acpica.org/downloads + +1) ACPI CA Core Subsystem: + +Added support to clear the PCIEXP_WAKE event. When clearing ACPI events, now +clear the PCIEXP_WAKE_STS bit in the ACPI PM1 Status Register, via +HwClearAcpiStatus. Original change from Colin King. ACPICA BZ 880. + +Changed the type of the predefined namespace object _TZ from ThermalZone to +Device. This was found to be confusing to the host software that processes +the various thermal zones, since _TZ is not really a ThermalZone. However, a +Notify() can still be performed on it. ACPICA BZ 876. Suggestion from Rui +Zhang. + +Added Windows Vista SP2 to the list of supported _OSI strings. The actual +string is "Windows 2006 SP2". + +Eliminated duplicate code in AcpiUtExecute* functions. Now that the nsrepair +code automatically repairs _HID-related strings, this type of code is no +longer needed in Execute_HID, Execute_CID, and Execute_UID. ACPICA BZ 878. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 6.0 32-bit compiler. The +debug version of the code includes the debug output trace mechanism and has a +much larger code and data size. + + Previous Release: + Non-Debug Version: 89.9K Code, 19.0K Data, 108.9K Total + Debug Version: 166.3K Code, 52.1K Data, 218.4K Total + Current Release: + Non-Debug Version: 89.9K Code, 19.0K Data, 108.9K Total + Debug Version: 166.3K Code, 52.1K Data, 218.4K Total + +2) iASL Compiler/Disassembler and Tools: + +iASL: Implemented additional compile-time validation for _HID strings. The +non-hex prefix (such as "PNP" or "ACPI") must be uppercase, and the length of +the string must be exactly seven or eight characters. For both _HID and _CID +strings, all characters must be alphanumeric. ACPICA BZ 874. + +iASL: Allow certain "null" resource descriptors. Some BIOS code creates +descriptors that are mostly or all zeros, with the expectation that they will +be filled in at runtime. iASL now allows this as long as there is a "resource +tag" (name) associated with the descriptor, which gives the ASL a handle +needed to modify the descriptor. ACPICA BZ 873. + +Added single-thread support to the generic Unix application OSL. Primarily +for iASL support, this change removes the use of semaphores in the single- +threaded ACPICA tools/applications - increasing performance. The +_MULTI_THREADED option was replaced by the (reverse) ACPI_SINGLE_THREADED +option. ACPICA BZ 879. + +AcpiExec: several fixes for the 64-bit version. Adds XSDT support and support +for 64-bit DSDT/FACS addresses in the FADT. Lin Ming. + +iASL: Moved all compiler messages to a new file, aslmessages.h. + +---------------------------------------- 15 September 2010. Summary of changes for version 20100915: This release is available at www.acpica.org/downloads diff --git a/common/adisasm.c b/common/adisasm.c index 31985f7f3c30..99f91ba050d4 100644 --- a/common/adisasm.c +++ b/common/adisasm.c @@ -612,10 +612,10 @@ AdDisassemblerHeader ( /* Header and input table info */ - AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n"); - AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION); + AcpiOsPrintf ("/*\n"); + AcpiOsPrintf (ACPI_COMMON_HEADER ("AML Disassembler", " * ")); - AcpiOsPrintf (" *\n * Disassembly of %s, %s", Filename, ctime (&Timer)); + AcpiOsPrintf (" * Disassembly of %s, %s", Filename, ctime (&Timer)); AcpiOsPrintf (" *\n"); } diff --git a/compiler/aslanalyze.c b/compiler/aslanalyze.c index 4846c6b7d07b..1087bca67107 100644 --- a/compiler/aslanalyze.c +++ b/compiler/aslanalyze.c @@ -658,6 +658,95 @@ AnMapObjTypeToBtype ( /******************************************************************************* * + * FUNCTION: AnCheckId + * + * PARAMETERS: Op - Current parse op + * Type - HID or CID + * + * RETURN: None + * + * DESCRIPTION: Perform various checks on _HID and _CID strings. Only limited + * checks can be performed on _CID strings. + * + ******************************************************************************/ + +#define ASL_TYPE_HID 0 +#define ASL_TYPE_CID 1 +#include <string.h> + +static void +AnCheckId ( + ACPI_PARSE_OBJECT *Op, + ACPI_NAME Type) +{ + UINT32 i; + ACPI_SIZE Length; + UINT32 AlphaPrefixLength; + + + if (Op->Asl.ParseOpcode != PARSEOP_STRING_LITERAL) + { + return; + } + + Length = strlen (Op->Asl.Value.String); + + /* + * If _HID/_CID 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 -- an odd construct + * that certain platform manufacturers are fond of. + */ + for (i = 0; Op->Asl.Value.String[i]; i++) + { + if (!isalnum ((int) Op->Asl.Value.String[i])) + { + AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, + Op, Op->Asl.Value.String); + break; + } + } + + if (Type == ASL_TYPE_CID) + { + /* _CID strings are bus-specific, no more checks can be performed */ + + return; + } + + /* _HID String must be of the form "XXX####" or "ACPI####" */ + + if ((Length < 7) || (Length > 8)) + { + AslError (ASL_ERROR, ASL_MSG_HID_LENGTH, + Op, Op->Asl.Value.String); + return; + } + + /* _HID Length is valid, now check for uppercase (first 3 or 4 chars) */ + + AlphaPrefixLength = 3; + if (Length >= 8) + { + AlphaPrefixLength = 4; + } + + /* Ensure the alphabetic prefix is all uppercase */ + + for (i = 0; (i < AlphaPrefixLength) && Op->Asl.Value.String[i]; i++) + { + if (!isupper ((int) Op->Asl.Value.String[i])) + { + AslError (ASL_ERROR, ASL_MSG_UPPER_CASE, + Op, &Op->Asl.Value.String[i]); + break; + } + } +} + + +/******************************************************************************* + * * FUNCTION: AnMethodAnalysisWalkBegin * * PARAMETERS: ASL_WALK_CALLBACK @@ -983,23 +1072,29 @@ AnMethodAnalysisWalkBegin ( if (!ACPI_STRCMP (METHOD_NAME__HID, Op->Asl.NameSeg)) { Next = Op->Asl.Child->Asl.Next; - if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL) + AnCheckId (Next, ASL_TYPE_HID); + } + + /* Special typechecking for _CID */ + + else if (!ACPI_STRCMP (METHOD_NAME__CID, Op->Asl.NameSeg)) + { + Next = Op->Asl.Child->Asl.Next; + + if ((Next->Asl.ParseOpcode == PARSEOP_PACKAGE) || + (Next->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)) { - /* - * _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++) + Next = Next->Asl.Child; + while (Next) { - if (!isalnum ((int) Next->Asl.Value.String[i])) - { - AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, - Next, Next->Asl.Value.String); - break; - } + AnCheckId (Next, ASL_TYPE_CID); + Next = Next->Asl.Next; } } + else + { + AnCheckId (Next, ASL_TYPE_CID); + } } break; diff --git a/compiler/aslcodegen.c b/compiler/aslcodegen.c index dcd6997003ab..344645058c09 100644 --- a/compiler/aslcodegen.c +++ b/compiler/aslcodegen.c @@ -513,11 +513,11 @@ CgWriteTableHeader ( /* Compiler ID */ - strncpy (TableHeader.AslCompilerId, CompilerCreatorId, 4); + strncpy (TableHeader.AslCompilerId, ASL_CREATOR_ID, 4); /* Compiler version */ - TableHeader.AslCompilerRevision = CompilerCreatorRevision; + TableHeader.AslCompilerRevision = ASL_REVISION; /* Table length. Checksum zero for now, will rewrite later */ diff --git a/compiler/aslcompile.c b/compiler/aslcompile.c index f199c5b9b816..019f9e4f65b4 100644 --- a/compiler/aslcompile.c +++ b/compiler/aslcompile.c @@ -117,6 +117,7 @@ #include <stdio.h> #include <time.h> #include "aslcompiler.h" +#include <acapps.h> #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslcompile") @@ -155,6 +156,7 @@ AslCompilerSignon ( UINT32 FileId) { char *Prefix = ""; + char *UtilityName; /* Set line prefix depending on the destination file type */ @@ -192,36 +194,21 @@ AslCompilerSignon ( break; } - /* - * Compiler signon with copyright - */ - FlPrintFile (FileId, - "%s\n%s%s\n%s", - Prefix, - Prefix, IntelAcpiCA, - Prefix); - /* Running compiler or disassembler? */ if (Gbl_DisasmFlag) { - FlPrintFile (FileId, - "%s", DisassemblerId); + UtilityName = AML_DISASSEMBLER_NAME; } else { - FlPrintFile (FileId, - "%s", CompilerId); + UtilityName = ASL_COMPILER_NAME; } - /* Version, build date, copyright, compliance */ + /* Compiler signon with copyright */ - FlPrintFile (FileId, - " version %X [%s]\n%s%s\n%s%s\n%s\n", - (UINT32) ACPI_CA_VERSION, __DATE__, - Prefix, CompilerCopyright, - Prefix, CompilerCompliance, - Prefix); + FlPrintFile (FileId, "%s\n", Prefix); + FlPrintFile (FileId, ACPI_COMMON_HEADER (UtilityName, Prefix)); } diff --git a/compiler/aslcompiler.h b/compiler/aslcompiler.h index 4e97677b56e8..ac26bd1f6960 100644 --- a/compiler/aslcompiler.h +++ b/compiler/aslcompiler.h @@ -147,6 +147,7 @@ #include "asldefine.h" #include "asltypes.h" +#include "aslmessages.h" #include "aslglobal.h" @@ -795,7 +796,8 @@ RsSmallAddressCheck ( ACPI_PARSE_OBJECT *MinOp, ACPI_PARSE_OBJECT *MaxOp, ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *AlignOp); + ACPI_PARSE_OBJECT *AlignOp, + ACPI_PARSE_OBJECT *Op); void RsLargeAddressCheck ( @@ -807,7 +809,8 @@ RsLargeAddressCheck ( ACPI_PARSE_OBJECT *MinOp, ACPI_PARSE_OBJECT *MaxOp, ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *GranOp); + ACPI_PARSE_OBJECT *GranOp, + ACPI_PARSE_OBJECT *Op); UINT16 RsGetStringDataLength ( diff --git a/compiler/asldefine.h b/compiler/asldefine.h index 4cd8130b1347..4105aeb01510 100644 --- a/compiler/asldefine.h +++ b/compiler/asldefine.h @@ -122,15 +122,13 @@ /* * Compiler versions and names */ -#define CompilerCreatorRevision ACPI_CA_VERSION - -#define IntelAcpiCA "Intel ACPI Component Architecture" -#define CompilerId "ASL Optimizing Compiler" -#define DisassemblerId "AML Disassembler" -#define CompilerCopyright "Copyright (c) 2000 - 2010 Intel Corporation" -#define CompilerCompliance "Supports ACPI Specification Revision 4.0a" -#define CompilerName "iasl" -#define CompilerCreatorId "INTL" +#define ASL_REVISION ACPI_CA_VERSION +#define ASL_COMPILER_NAME "ASL Optimizing Compiler" +#define AML_DISASSEMBLER_NAME "AML Disassembler" +#define ASL_INVOCATION_NAME "iasl" +#define ASL_CREATOR_ID "INTL" + +#define ASL_COMPLIANCE "Supports ACPI Specification Revision 4.0a" /* Configuration constants */ diff --git a/compiler/aslmain.c b/compiler/aslmain.c index 90faff739f8c..7b5345b29d62 100644 --- a/compiler/aslmain.c +++ b/compiler/aslmain.c @@ -296,7 +296,8 @@ Usage ( void) { - printf ("Usage: %s [Options] [Files]\n\n", CompilerName); + printf ("%s\n", ASL_COMPLIANCE); + printf ("Usage: %s [Options] [Files]\n\n", ASL_INVOCATION_NAME); Options (); } @@ -903,7 +904,7 @@ AslCommandLine ( if (argc < 2) { - AslCompilerSignon (ASL_FILE_STDOUT); + printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); Usage (); exit (1); } @@ -934,7 +935,7 @@ AslCommandLine ( if (Gbl_DoSignon) { - AslCompilerSignon (ASL_FILE_STDOUT); + printf (ACPI_COMMON_SIGNON (ASL_COMPILER_NAME)); } /* Abort if anything went wrong on the command line */ diff --git a/compiler/aslmessages.h b/compiler/aslmessages.h new file mode 100644 index 000000000000..04578003df94 --- /dev/null +++ b/compiler/aslmessages.h @@ -0,0 +1,436 @@ + +/****************************************************************************** + * + * Module Name: aslmessages.h - Compiler error/warning messages + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, 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 __ASLMESSAGES_H +#define __ASLMESSAGES_H + + +#define ASL_WARNING 0 +#define ASL_WARNING2 1 +#define ASL_WARNING3 2 +#define ASL_ERROR 3 +#define ASL_REMARK 4 +#define ASL_OPTIMIZATION 5 +#define ASL_NUM_REPORT_LEVELS 6 + + +/* Values for all compiler messages */ + +typedef enum +{ + ASL_MSG_RESERVED = 0, + ASL_MSG_ALPHANUMERIC_STRING, + ASL_MSG_AML_NOT_IMPLEMENTED, + ASL_MSG_ARG_COUNT_HI, + ASL_MSG_ARG_COUNT_LO, + ASL_MSG_ARG_INIT, + ASL_MSG_BACKWARDS_OFFSET, + ASL_MSG_BITS_TO_BYTES, + ASL_MSG_BUFFER_LENGTH, + ASL_MSG_BYTES_TO_BITS, + ASL_MSG_CLOSE, + ASL_MSG_COMPILER_INTERNAL, + ASL_MSG_CONSTANT_EVALUATION, + ASL_MSG_CONSTANT_FOLDED, + ASL_MSG_CORE_EXCEPTION, + ASL_MSG_DEBUG_FILE_OPEN, + ASL_MSG_DEBUG_FILENAME, + ASL_MSG_DEPENDENT_NESTING, + ASL_MSG_DMA_CHANNEL, + ASL_MSG_DMA_LIST, + ASL_MSG_DUPLICATE_CASE, + ASL_MSG_DUPLICATE_ITEM, + ASL_MSG_EARLY_EOF, + ASL_MSG_ENCODING_LENGTH, + ASL_MSG_EX_INTERRUPT_LIST, + ASL_MSG_EX_INTERRUPT_LIST_MIN, + ASL_MSG_EX_INTERRUPT_NUMBER, + ASL_MSG_FIELD_ACCESS_WIDTH, + ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, + ASL_MSG_FIELD_UNIT_OFFSET, + ASL_MSG_INCLUDE_FILE_OPEN, + ASL_MSG_INPUT_FILE_OPEN, + ASL_MSG_INTEGER_LENGTH, + ASL_MSG_INTEGER_OPTIMIZATION, + ASL_MSG_INTERRUPT_LIST, + ASL_MSG_INTERRUPT_NUMBER, + ASL_MSG_INVALID_CONSTANT_OP, + ASL_MSG_INVALID_EISAID, + ASL_MSG_INVALID_ESCAPE, + ASL_MSG_INVALID_OPERAND, + ASL_MSG_INVALID_PERFORMANCE, + ASL_MSG_INVALID_PRIORITY, + ASL_MSG_INVALID_STRING, + ASL_MSG_INVALID_TARGET, + ASL_MSG_INVALID_TIME, + ASL_MSG_INVALID_TYPE, + ASL_MSG_INVALID_UUID, + ASL_MSG_LIST_LENGTH_LONG, + ASL_MSG_LIST_LENGTH_SHORT, + ASL_MSG_LISTING_FILE_OPEN, + ASL_MSG_LISTING_FILENAME, + ASL_MSG_LOCAL_INIT, + ASL_MSG_LONG_LINE, + ASL_MSG_MEMORY_ALLOCATION, + ASL_MSG_MISSING_ENDDEPENDENT, + ASL_MSG_MISSING_STARTDEPENDENT, + ASL_MSG_MULTIPLE_TYPES, + ASL_MSG_NAME_EXISTS, + ASL_MSG_NAME_OPTIMIZATION, + ASL_MSG_NESTED_COMMENT, + ASL_MSG_NO_CASES, + ASL_MSG_NO_RETVAL, + ASL_MSG_NO_WHILE, + ASL_MSG_NON_ASCII, + ASL_MSG_NOT_EXIST, + ASL_MSG_NOT_FOUND, + ASL_MSG_NOT_METHOD, + ASL_MSG_NOT_PARAMETER, + ASL_MSG_NOT_REACHABLE, + ASL_MSG_OPEN, + ASL_MSG_OUTPUT_FILE_OPEN, + ASL_MSG_OUTPUT_FILENAME, + ASL_MSG_PACKAGE_LENGTH, + ASL_MSG_READ, + ASL_MSG_RECURSION, + ASL_MSG_REGION_BUFFER_ACCESS, + ASL_MSG_REGION_BYTE_ACCESS, + ASL_MSG_RESERVED_ARG_COUNT_HI, + ASL_MSG_RESERVED_ARG_COUNT_LO, + ASL_MSG_RESERVED_METHOD, + ASL_MSG_RESERVED_OPERAND_TYPE, + ASL_MSG_RESERVED_RETURN_VALUE, + ASL_MSG_RESERVED_USE, + ASL_MSG_RESERVED_WORD, + ASL_MSG_RESOURCE_FIELD, + ASL_MSG_RESOURCE_INDEX, + ASL_MSG_RESOURCE_LIST, + ASL_MSG_RESOURCE_SOURCE, + ASL_MSG_RETURN_TYPES, + ASL_MSG_SCOPE_FWD_REF, + ASL_MSG_SCOPE_TYPE, + ASL_MSG_SEEK, + ASL_MSG_SINGLE_NAME_OPTIMIZATION, + ASL_MSG_SOME_NO_RETVAL, + ASL_MSG_SWITCH_TYPE, + ASL_MSG_SYNC_LEVEL, + ASL_MSG_SYNTAX, + ASL_MSG_TABLE_SIGNATURE, + ASL_MSG_TOO_MANY_TEMPS, + ASL_MSG_UNKNOWN_RESERVED_NAME, + ASL_MSG_UNREACHABLE_CODE, + ASL_MSG_UNSUPPORTED, + ASL_MSG_VENDOR_LIST, + ASL_MSG_WRITE, + ASL_MSG_MULTIPLE_DEFAULT, + ASL_MSG_TIMEOUT, + ASL_MSG_RESULT_NOT_USED, + ASL_MSG_NOT_REFERENCED, + ASL_MSG_NON_ZERO, + ASL_MSG_STRING_LENGTH, + ASL_MSG_SERIALIZED, + ASL_MSG_COMPILER_RESERVED, + ASL_MSG_NAMED_OBJECT_IN_WHILE, + ASL_MSG_LOCAL_OUTSIDE_METHOD, + ASL_MSG_ALIGNMENT, + ASL_MSG_ISA_ADDRESS, + ASL_MSG_INVALID_MIN_MAX, + ASL_MSG_INVALID_LENGTH, + ASL_MSG_INVALID_LENGTH_FIXED, + ASL_MSG_INVALID_GRANULARITY, + ASL_MSG_INVALID_GRAN_FIXED, + ASL_MSG_INVALID_ACCESS_SIZE, + ASL_MSG_INVALID_ADDR_FLAGS, + ASL_MSG_NULL_DESCRIPTOR, + ASL_MSG_UPPER_CASE, + ASL_MSG_HID_LENGTH, + ASL_MSG_INVALID_FIELD_NAME, + ASL_MSG_INTEGER_SIZE, + ASL_MSG_INVALID_HEX_INTEGER, + ASL_MSG_BUFFER_ELEMENT, + ASL_MSG_RESERVED_VALUE, + ASL_MSG_FLAG_VALUE, + ASL_MSG_ZERO_VALUE, + ASL_MSG_UNKNOWN_TABLE, + ASL_MSG_UNKNOWN_SUBTABLE, + ASL_MSG_OEM_TABLE + +} ASL_MESSAGE_IDS; + + +#ifdef ASL_EXCEPTIONS + +/* Actual message strings for each compiler message */ + +char *AslMessages [] = { +/* The zeroth message is reserved */ "", +/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric", +/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator", +/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments", +/* ASL_MSG_ARG_COUNT_LO */ "Too few arguments", +/* ASL_MSG_ARG_INIT */ "Method argument is not initialized", +/* ASL_MSG_BACKWARDS_OFFSET */ "Invalid backwards offset", +/* ASL_MSG_BITS_TO_BYTES */ "Field offset is in bits, but a byte offset is required", +/* ASL_MSG_BUFFER_LENGTH */ "Effective AML buffer length is zero", +/* ASL_MSG_BYTES_TO_BITS */ "Field offset is in bytes, but a bit offset is required", +/* ASL_MSG_CLOSE */ "Could not close file", +/* ASL_MSG_COMPILER_INTERNAL */ "Internal compiler error", +/* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression", +/* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced", +/* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem", +/* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file", +/* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename", +/* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",\ +/* ASL_MSG_DMA_CHANNEL */ "Invalid DMA channel (must be 0-7)", +/* ASL_MSG_DMA_LIST */ "Too many DMA channels (8 max)", +/* ASL_MSG_DUPLICATE_CASE */ "Case value already specified", +/* ASL_MSG_DUPLICATE_ITEM */ "Duplicate value in list", +/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached", +/* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode", +/* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)", +/* ASL_MSG_EX_INTERRUPT_LIST_MIN */ "Too few interrupts (1 minimum required)", +/* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)", +/* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size", +/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit", +/* ASL_MSG_FIELD_UNIT_OFFSET */ "Field Unit extends beyond region limit", +/* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file", +/* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file", +/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating", +/* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode", +/* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)", +/* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)", +/* ASL_MSG_INVALID_CONSTANT_OP */ "Invalid operator in constant expression (not type 3/4/5)", +/* ASL_MSG_INVALID_EISAID */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)", +/* ASL_MSG_INVALID_ESCAPE */ "Invalid or unknown escape sequence", +/* ASL_MSG_INVALID_OPERAND */ "Invalid operand", +/* ASL_MSG_INVALID_PERFORMANCE */ "Invalid performance/robustness value", +/* ASL_MSG_INVALID_PRIORITY */ "Invalid priority value", +/* ASL_MSG_INVALID_STRING */ "Invalid Hex/Octal Escape - Non-ASCII or NULL", +/* ASL_MSG_INVALID_TARGET */ "Target operand not allowed in constant expression", +/* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)", +/* ASL_MSG_INVALID_TYPE */ "Invalid type", +/* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"", +/* ASL_MSG_LIST_LENGTH_LONG */ "Initializer list longer than declared package length", +/* ASL_MSG_LIST_LENGTH_SHORT */ "Initializer list shorter than declared package length", +/* ASL_MSG_LISTING_FILE_OPEN */ "Could not open listing file", +/* ASL_MSG_LISTING_FILENAME */ "Could not create listing filename", +/* ASL_MSG_LOCAL_INIT */ "Method local variable is not initialized", +/* ASL_MSG_LONG_LINE */ "Splitting long input line", +/* ASL_MSG_MEMORY_ALLOCATION */ "Memory allocation failure", +/* ASL_MSG_MISSING_ENDDEPENDENT */ "Missing EndDependentFn() macro in dependent resource list", +/* ASL_MSG_MISSING_STARTDEPENDENT */ "Missing StartDependentFn() macro in dependent resource list", +/* ASL_MSG_MULTIPLE_TYPES */ "Multiple types", +/* ASL_MSG_NAME_EXISTS */ "Name already exists in scope", +/* ASL_MSG_NAME_OPTIMIZATION */ "NamePath optimized", +/* ASL_MSG_NESTED_COMMENT */ "Nested comment found", +/* ASL_MSG_NO_CASES */ "No Case statements under Switch", +/* ASL_MSG_NO_RETVAL */ "Called method returns no value", +/* ASL_MSG_NO_WHILE */ "No enclosing While statement", +/* ASL_MSG_NON_ASCII */ "Invalid characters found in file", +/* ASL_MSG_NOT_EXIST */ "Object does not exist", +/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from scope", +/* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke", +/* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only", +/* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope", +/* ASL_MSG_OPEN */ "Could not open file", +/* ASL_MSG_OUTPUT_FILE_OPEN */ "Could not open output AML file", +/* ASL_MSG_OUTPUT_FILENAME */ "Could not create output filename", +/* ASL_MSG_PACKAGE_LENGTH */ "Effective AML package length is zero", +/* ASL_MSG_READ */ "Could not read file", +/* ASL_MSG_RECURSION */ "Recursive method call", +/* ASL_MSG_REGION_BUFFER_ACCESS */ "Host Operation Region requires BufferAcc access", +/* ASL_MSG_REGION_BYTE_ACCESS */ "Host Operation Region requires ByteAcc access", +/* 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_METHOD */ "Reserved name must be a control method", +/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name", +/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value", +/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name", +/* ASL_MSG_RESERVED_WORD */ "Use of reserved name", +/* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target", +/* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)", +/* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)", +/* ASL_MSG_RESOURCE_SOURCE */ "Missing ResourceSource string (required)", +/* ASL_MSG_RETURN_TYPES */ "Not all control paths return a value", +/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope operator not allowed", +/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator", +/* ASL_MSG_SEEK */ "Could not seek file", +/* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)", +/* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value", +/* ASL_MSG_SWITCH_TYPE */ "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer", +/* ASL_MSG_SYNC_LEVEL */ "SyncLevel must be in the range 0-15", +/* ASL_MSG_SYNTAX */ "", +/* ASL_MSG_TABLE_SIGNATURE */ "Invalid Table Signature", +/* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)", +/* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name", +/* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable", +/* ASL_MSG_UNSUPPORTED */ "Unsupported feature", +/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)", +/* ASL_MSG_WRITE */ "Could not write file", +/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct", +/* ASL_MSG_TIMEOUT */ "Possible operator timeout is ignored", +/* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect", +/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced", +/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero", +/* ASL_MSG_STRING_LENGTH */ "String literal too long", +/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized", +/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name", +/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop", +/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method", +/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value", +/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)", +/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max", +/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window", +/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window", +/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one", +/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max", +/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)", +/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags", +/* ASL_MSG_NULL_DESCRIPTOR */ "Min/Max/Length/Gran are all zero, but no resource tag", +/* ASL_MSG_UPPER_CASE */ "Non-hex letters must be upper case", +/* ASL_MSG_HID_LENGTH */ "_HID string must be exactly 7 or 8 characters", + +/* These messages are used by the data table compiler only */ + +/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name", +/* ASL_MSG_INTEGER_SIZE */ "Integer too large for target", +/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant", +/* ASL_MSG_BUFFER_ELEMENT */ "Invalid element in buffer initializer list", +/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero", +/* ASL_MSG_FLAG_VALUE */ "Flag value is too large", +/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero", +/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", +/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", +/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents" + +}; + + +char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = { + "Warning ", + "Warning ", + "Warning ", + "Error ", + "Remark ", + "Optimize" +}; + +#define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */ + +#endif /* ASL_EXCEPTIONS */ + +#endif /* __ASLMESSAGES_H */ diff --git a/compiler/aslresource.c b/compiler/aslresource.c index 67aabcadae1b..dcee78c8f92a 100644 --- a/compiler/aslresource.c +++ b/compiler/aslresource.c @@ -139,6 +139,7 @@ * NULL, means "zero value for alignment is * OK, and means 64K alignment" (for * Memory24 descriptor) + * Op - Parent Op for entire construct * * RETURN: None. Adds error messages to error log if necessary * @@ -158,7 +159,8 @@ RsSmallAddressCheck ( ACPI_PARSE_OBJECT *MinOp, ACPI_PARSE_OBJECT *MaxOp, ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *AlignOp) + ACPI_PARSE_OBJECT *AlignOp, + ACPI_PARSE_OBJECT *Op) { if (Gbl_NoResourceChecking) @@ -166,6 +168,34 @@ RsSmallAddressCheck ( return; } + /* + * Check for a so-called "null descriptor". These are descriptors that are + * created with most fields set to zero. The intent is that the descriptor + * will be updated/completed at runtime via a BufferField. + * + * If the descriptor does NOT have a resource tag, it cannot be referenced + * by a BufferField and we will flag this as an error. Conversely, if + * the descriptor has a resource tag, we will assume that a BufferField + * will be used to dynamically update it, so no error. + * + * A possible enhancement to this check would be to verify that in fact + * a BufferField is created using the resource tag, and perhaps even + * verify that a Store is performed to the BufferField. + * + * Note: for these descriptors, Alignment is allowed to be zero + */ + if (!Minimum && !Maximum && !Length) + { + if (!Op->Asl.ExternalName) + { + /* No resource tag. Descriptor is fixed and is also illegal */ + + AslError (ASL_ERROR, ASL_MSG_NULL_DESCRIPTOR, Op, NULL); + } + + return; + } + /* Special case for Memory24, values are compressed */ if (Type == ACPI_RESOURCE_NAME_MEMORY24) @@ -230,6 +260,7 @@ RsSmallAddressCheck ( * MaxOp - Original Op for Address Max * LengthOp - Original Op for address range * GranOp - Original Op for address granularity + * Op - Parent Op for entire construct * * RETURN: None. Adds error messages to error log if necessary * @@ -259,7 +290,8 @@ RsLargeAddressCheck ( ACPI_PARSE_OBJECT *MinOp, ACPI_PARSE_OBJECT *MaxOp, ACPI_PARSE_OBJECT *LengthOp, - ACPI_PARSE_OBJECT *GranOp) + ACPI_PARSE_OBJECT *GranOp, + ACPI_PARSE_OBJECT *Op) { if (Gbl_NoResourceChecking) @@ -267,6 +299,32 @@ RsLargeAddressCheck ( return; } + /* + * Check for a so-called "null descriptor". These are descriptors that are + * created with most fields set to zero. The intent is that the descriptor + * will be updated/completed at runtime via a BufferField. + * + * If the descriptor does NOT have a resource tag, it cannot be referenced + * by a BufferField and we will flag this as an error. Conversely, if + * the descriptor has a resource tag, we will assume that a BufferField + * will be used to dynamically update it, so no error. + * + * A possible enhancement to this check would be to verify that in fact + * a BufferField is created using the resource tag, and perhaps even + * verify that a Store is performed to the BufferField. + */ + if (!Minimum && !Maximum && !Length && !Granularity) + { + if (!Op->Asl.ExternalName) + { + /* No resource tag. Descriptor is fixed and is also illegal */ + + AslError (ASL_ERROR, ASL_MSG_NULL_DESCRIPTOR, Op, NULL); + } + + return; + } + /* Basic checks on Min/Max/Length */ if (Minimum > Maximum) diff --git a/compiler/aslrestype1.c b/compiler/aslrestype1.c index 5c1bd0ed1ac2..b68868efa483 100644 --- a/compiler/aslrestype1.c +++ b/compiler/aslrestype1.c @@ -300,7 +300,7 @@ RsDoMemory24Descriptor ( Descriptor->Memory24.Maximum, Descriptor->Memory24.AddressLength, Descriptor->Memory24.Alignment, - MinOp, MaxOp, LengthOp, NULL); + MinOp, MaxOp, LengthOp, NULL, Op); return (Rnode); } @@ -408,7 +408,7 @@ RsDoMemory32Descriptor ( Descriptor->Memory32.Maximum, Descriptor->Memory32.AddressLength, Descriptor->Memory32.Alignment, - MinOp, MaxOp, LengthOp, AlignOp); + MinOp, MaxOp, LengthOp, AlignOp, Op); return (Rnode); } diff --git a/compiler/aslrestype1i.c b/compiler/aslrestype1i.c index 239c500cb6fc..3f275cec99a2 100644 --- a/compiler/aslrestype1i.c +++ b/compiler/aslrestype1i.c @@ -439,7 +439,7 @@ RsDoIoDescriptor ( Descriptor->Io.Maximum, Descriptor->Io.AddressLength, Descriptor->Io.Alignment, - MinOp, MaxOp, LengthOp, AlignOp); + MinOp, MaxOp, LengthOp, AlignOp, Op); return (Rnode); } diff --git a/compiler/aslrestype2d.c b/compiler/aslrestype2d.c index 17ce2703981c..9008545d8d5b 100644 --- a/compiler/aslrestype2d.c +++ b/compiler/aslrestype2d.c @@ -352,7 +352,7 @@ RsDoDwordIoDescriptor ( (UINT64) Descriptor->Address32.AddressLength, (UINT64) Descriptor->Address32.Granularity, Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + OptionIndex + StringLength; @@ -588,7 +588,7 @@ RsDoDwordMemoryDescriptor ( (UINT64) Descriptor->Address32.AddressLength, (UINT64) Descriptor->Address32.Granularity, Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + OptionIndex + StringLength; @@ -806,7 +806,7 @@ RsDoDwordSpaceDescriptor ( (UINT64) Descriptor->Address32.AddressLength, (UINT64) Descriptor->Address32.Granularity, Descriptor->Address32.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) + OptionIndex + StringLength; diff --git a/compiler/aslrestype2e.c b/compiler/aslrestype2e.c index e5b2bd9054b5..c7fe0bd8f8dc 100644 --- a/compiler/aslrestype2e.c +++ b/compiler/aslrestype2e.c @@ -294,7 +294,7 @@ RsDoExtendedIoDescriptor ( Descriptor->ExtAddress64.AddressLength, Descriptor->ExtAddress64.Granularity, Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; return (Rnode); @@ -475,7 +475,7 @@ RsDoExtendedMemoryDescriptor ( Descriptor->ExtAddress64.AddressLength, Descriptor->ExtAddress64.Granularity, Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; return (Rnode); @@ -638,7 +638,7 @@ RsDoExtendedSpaceDescriptor ( Descriptor->ExtAddress64.AddressLength, Descriptor->ExtAddress64.Granularity, Descriptor->ExtAddress64.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength; return (Rnode); diff --git a/compiler/aslrestype2q.c b/compiler/aslrestype2q.c index 591ac25c42b9..6334f77d892f 100644 --- a/compiler/aslrestype2q.c +++ b/compiler/aslrestype2q.c @@ -343,7 +343,7 @@ RsDoQwordIoDescriptor ( Descriptor->Address64.AddressLength, Descriptor->Address64.Granularity, Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + OptionIndex + StringLength; @@ -573,7 +573,7 @@ RsDoQwordMemoryDescriptor ( Descriptor->Address64.AddressLength, Descriptor->Address64.Granularity, Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + OptionIndex + StringLength; @@ -785,7 +785,7 @@ RsDoQwordSpaceDescriptor ( Descriptor->Address64.AddressLength, Descriptor->Address64.Granularity, Descriptor->Address64.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) + OptionIndex + StringLength; diff --git a/compiler/aslrestype2w.c b/compiler/aslrestype2w.c index a6e6774c028e..49fee9cec8ea 100644 --- a/compiler/aslrestype2w.c +++ b/compiler/aslrestype2w.c @@ -343,7 +343,7 @@ RsDoWordIoDescriptor ( (UINT64) Descriptor->Address16.AddressLength, (UINT64) Descriptor->Address16.Granularity, Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + OptionIndex + StringLength; @@ -549,7 +549,7 @@ RsDoWordBusNumberDescriptor ( (UINT64) Descriptor->Address16.AddressLength, (UINT64) Descriptor->Address16.Granularity, Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + OptionIndex + StringLength; @@ -766,7 +766,7 @@ RsDoWordSpaceDescriptor ( (UINT64) Descriptor->Address16.AddressLength, (UINT64) Descriptor->Address16.Granularity, Descriptor->Address16.Flags, - MinOp, MaxOp, LengthOp, GranOp); + MinOp, MaxOp, LengthOp, GranOp, Op); Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) + OptionIndex + StringLength; diff --git a/compiler/asltypes.h b/compiler/asltypes.h index f4e5f4625258..ea042104e0c6 100644 --- a/compiler/asltypes.h +++ b/compiler/asltypes.h @@ -302,307 +302,4 @@ typedef struct asl_event_info } ASL_EVENT_INFO; -#define ASL_WARNING 0 -#define ASL_WARNING2 1 -#define ASL_WARNING3 2 -#define ASL_ERROR 3 -#define ASL_REMARK 4 -#define ASL_OPTIMIZATION 5 -#define ASL_NUM_REPORT_LEVELS 6 - - -typedef enum -{ - ASL_MSG_RESERVED = 0, - ASL_MSG_ALPHANUMERIC_STRING, - ASL_MSG_AML_NOT_IMPLEMENTED, - ASL_MSG_ARG_COUNT_HI, - ASL_MSG_ARG_COUNT_LO, - ASL_MSG_ARG_INIT, - ASL_MSG_BACKWARDS_OFFSET, - ASL_MSG_BITS_TO_BYTES, - ASL_MSG_BUFFER_LENGTH, - ASL_MSG_BYTES_TO_BITS, - ASL_MSG_CLOSE, - ASL_MSG_COMPILER_INTERNAL, - ASL_MSG_CONSTANT_EVALUATION, - ASL_MSG_CONSTANT_FOLDED, - ASL_MSG_CORE_EXCEPTION, - ASL_MSG_DEBUG_FILE_OPEN, - ASL_MSG_DEBUG_FILENAME, - ASL_MSG_DEPENDENT_NESTING, - ASL_MSG_DMA_CHANNEL, - ASL_MSG_DMA_LIST, - ASL_MSG_DUPLICATE_CASE, - ASL_MSG_DUPLICATE_ITEM, - ASL_MSG_EARLY_EOF, - ASL_MSG_ENCODING_LENGTH, - ASL_MSG_EX_INTERRUPT_LIST, - ASL_MSG_EX_INTERRUPT_LIST_MIN, - ASL_MSG_EX_INTERRUPT_NUMBER, - ASL_MSG_FIELD_ACCESS_WIDTH, - ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, - ASL_MSG_FIELD_UNIT_OFFSET, - ASL_MSG_INCLUDE_FILE_OPEN, - ASL_MSG_INPUT_FILE_OPEN, - ASL_MSG_INTEGER_LENGTH, - ASL_MSG_INTEGER_OPTIMIZATION, - ASL_MSG_INTERRUPT_LIST, - ASL_MSG_INTERRUPT_NUMBER, - ASL_MSG_INVALID_CONSTANT_OP, - ASL_MSG_INVALID_EISAID, - ASL_MSG_INVALID_ESCAPE, - ASL_MSG_INVALID_OPERAND, - ASL_MSG_INVALID_PERFORMANCE, - ASL_MSG_INVALID_PRIORITY, - ASL_MSG_INVALID_STRING, - ASL_MSG_INVALID_TARGET, - ASL_MSG_INVALID_TIME, - ASL_MSG_INVALID_TYPE, - ASL_MSG_INVALID_UUID, - ASL_MSG_LIST_LENGTH_LONG, - ASL_MSG_LIST_LENGTH_SHORT, - ASL_MSG_LISTING_FILE_OPEN, - ASL_MSG_LISTING_FILENAME, - ASL_MSG_LOCAL_INIT, - ASL_MSG_LONG_LINE, - ASL_MSG_MEMORY_ALLOCATION, - ASL_MSG_MISSING_ENDDEPENDENT, - ASL_MSG_MISSING_STARTDEPENDENT, - ASL_MSG_MULTIPLE_TYPES, - ASL_MSG_NAME_EXISTS, - ASL_MSG_NAME_OPTIMIZATION, - ASL_MSG_NESTED_COMMENT, - ASL_MSG_NO_CASES, - ASL_MSG_NO_RETVAL, - ASL_MSG_NO_WHILE, - ASL_MSG_NON_ASCII, - ASL_MSG_NOT_EXIST, - ASL_MSG_NOT_FOUND, - ASL_MSG_NOT_METHOD, - ASL_MSG_NOT_PARAMETER, - ASL_MSG_NOT_REACHABLE, - ASL_MSG_OPEN, - ASL_MSG_OUTPUT_FILE_OPEN, - ASL_MSG_OUTPUT_FILENAME, - ASL_MSG_PACKAGE_LENGTH, - ASL_MSG_READ, - ASL_MSG_RECURSION, - ASL_MSG_REGION_BUFFER_ACCESS, - ASL_MSG_REGION_BYTE_ACCESS, - ASL_MSG_RESERVED_ARG_COUNT_HI, - ASL_MSG_RESERVED_ARG_COUNT_LO, - ASL_MSG_RESERVED_METHOD, - ASL_MSG_RESERVED_OPERAND_TYPE, - ASL_MSG_RESERVED_RETURN_VALUE, - ASL_MSG_RESERVED_USE, - ASL_MSG_RESERVED_WORD, - ASL_MSG_RESOURCE_FIELD, - ASL_MSG_RESOURCE_INDEX, - ASL_MSG_RESOURCE_LIST, - ASL_MSG_RESOURCE_SOURCE, - ASL_MSG_RETURN_TYPES, - ASL_MSG_SCOPE_FWD_REF, - ASL_MSG_SCOPE_TYPE, - ASL_MSG_SEEK, - ASL_MSG_SINGLE_NAME_OPTIMIZATION, - ASL_MSG_SOME_NO_RETVAL, - ASL_MSG_SWITCH_TYPE, - ASL_MSG_SYNC_LEVEL, - ASL_MSG_SYNTAX, - ASL_MSG_TABLE_SIGNATURE, - ASL_MSG_TOO_MANY_TEMPS, - ASL_MSG_UNKNOWN_RESERVED_NAME, - ASL_MSG_UNREACHABLE_CODE, - ASL_MSG_UNSUPPORTED, - ASL_MSG_VENDOR_LIST, - ASL_MSG_WRITE, - ASL_MSG_MULTIPLE_DEFAULT, - ASL_MSG_TIMEOUT, - ASL_MSG_RESULT_NOT_USED, - ASL_MSG_NOT_REFERENCED, - ASL_MSG_NON_ZERO, - ASL_MSG_STRING_LENGTH, - ASL_MSG_SERIALIZED, - ASL_MSG_COMPILER_RESERVED, - ASL_MSG_NAMED_OBJECT_IN_WHILE, - ASL_MSG_LOCAL_OUTSIDE_METHOD, - ASL_MSG_ALIGNMENT, - ASL_MSG_ISA_ADDRESS, - ASL_MSG_INVALID_MIN_MAX, - ASL_MSG_INVALID_LENGTH, - ASL_MSG_INVALID_LENGTH_FIXED, - ASL_MSG_INVALID_GRANULARITY, - ASL_MSG_INVALID_GRAN_FIXED, - ASL_MSG_INVALID_ACCESS_SIZE, - ASL_MSG_INVALID_ADDR_FLAGS, - ASL_MSG_INVALID_FIELD_NAME, - ASL_MSG_INTEGER_SIZE, - ASL_MSG_INVALID_HEX_INTEGER, - ASL_MSG_BUFFER_ELEMENT, - ASL_MSG_RESERVED_VALUE, - ASL_MSG_FLAG_VALUE, - ASL_MSG_ZERO_VALUE, - ASL_MSG_UNKNOWN_TABLE, - ASL_MSG_UNKNOWN_SUBTABLE, - ASL_MSG_OEM_TABLE - -} ASL_MESSAGE_IDS; - -#ifdef ASL_EXCEPTIONS - -char *AslMessages [] = { -/* The zeroth message is reserved */ "", -/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric", -/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator", -/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments", -/* ASL_MSG_ARG_COUNT_LO */ "Too few arguments", -/* ASL_MSG_ARG_INIT */ "Method argument is not initialized", -/* ASL_MSG_BACKWARDS_OFFSET */ "Invalid backwards offset", -/* ASL_MSG_BITS_TO_BYTES */ "Field offset is in bits, but a byte offset is required", -/* ASL_MSG_BUFFER_LENGTH */ "Effective AML buffer length is zero", -/* ASL_MSG_BYTES_TO_BITS */ "Field offset is in bytes, but a bit offset is required", -/* ASL_MSG_CLOSE */ "Could not close file", -/* ASL_MSG_COMPILER_INTERNAL */ "Internal compiler error", -/* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression", -/* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced", -/* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem", -/* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file", -/* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename", -/* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",\ -/* ASL_MSG_DMA_CHANNEL */ "Invalid DMA channel (must be 0-7)", -/* ASL_MSG_DMA_LIST */ "Too many DMA channels (8 max)", -/* ASL_MSG_DUPLICATE_CASE */ "Case value already specified", -/* ASL_MSG_DUPLICATE_ITEM */ "Duplicate value in list", -/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached", -/* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode", -/* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)", -/* ASL_MSG_EX_INTERRUPT_LIST_MIN */ "Too few interrupts (1 minimum required)", -/* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)", -/* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size", -/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit", -/* ASL_MSG_FIELD_UNIT_OFFSET */ "Field Unit extends beyond region limit", -/* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file", -/* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file", -/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating", -/* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode", -/* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)", -/* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)", -/* ASL_MSG_INVALID_CONSTANT_OP */ "Invalid operator in constant expression (not type 3/4/5)", -/* ASL_MSG_INVALID_EISAID */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)", -/* ASL_MSG_INVALID_ESCAPE */ "Invalid or unknown escape sequence", -/* ASL_MSG_INVALID_OPERAND */ "Invalid operand", -/* ASL_MSG_INVALID_PERFORMANCE */ "Invalid performance/robustness value", -/* ASL_MSG_INVALID_PRIORITY */ "Invalid priority value", -/* ASL_MSG_INVALID_STRING */ "Invalid Hex/Octal Escape - Non-ASCII or NULL", -/* ASL_MSG_INVALID_TARGET */ "Target operand not allowed in constant expression", -/* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)", -/* ASL_MSG_INVALID_TYPE */ "Invalid type", -/* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"", -/* ASL_MSG_LIST_LENGTH_LONG */ "Initializer list longer than declared package length", -/* ASL_MSG_LIST_LENGTH_SHORT */ "Initializer list shorter than declared package length", -/* ASL_MSG_LISTING_FILE_OPEN */ "Could not open listing file", -/* ASL_MSG_LISTING_FILENAME */ "Could not create listing filename", -/* ASL_MSG_LOCAL_INIT */ "Method local variable is not initialized", -/* ASL_MSG_LONG_LINE */ "Splitting long input line", -/* ASL_MSG_MEMORY_ALLOCATION */ "Memory allocation failure", -/* ASL_MSG_MISSING_ENDDEPENDENT */ "Missing EndDependentFn() macro in dependent resource list", -/* ASL_MSG_MISSING_STARTDEPENDENT */ "Missing StartDependentFn() macro in dependent resource list", -/* ASL_MSG_MULTIPLE_TYPES */ "Multiple types", -/* ASL_MSG_NAME_EXISTS */ "Name already exists in scope", -/* ASL_MSG_NAME_OPTIMIZATION */ "NamePath optimized", -/* ASL_MSG_NESTED_COMMENT */ "Nested comment found", -/* ASL_MSG_NO_CASES */ "No Case statements under Switch", -/* ASL_MSG_NO_RETVAL */ "Called method returns no value", -/* ASL_MSG_NO_WHILE */ "No enclosing While statement", -/* ASL_MSG_NON_ASCII */ "Invalid characters found in file", -/* ASL_MSG_NOT_EXIST */ "Object does not exist", -/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from scope", -/* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke", -/* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only", -/* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope", -/* ASL_MSG_OPEN */ "Could not open file", -/* ASL_MSG_OUTPUT_FILE_OPEN */ "Could not open output AML file", -/* ASL_MSG_OUTPUT_FILENAME */ "Could not create output filename", -/* ASL_MSG_PACKAGE_LENGTH */ "Effective AML package length is zero", -/* ASL_MSG_READ */ "Could not read file", -/* ASL_MSG_RECURSION */ "Recursive method call", -/* ASL_MSG_REGION_BUFFER_ACCESS */ "Host Operation Region requires BufferAcc access", -/* ASL_MSG_REGION_BYTE_ACCESS */ "Host Operation Region requires ByteAcc access", -/* 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_METHOD */ "Reserved name must be a control method", -/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid object type for reserved name", -/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value", -/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name", -/* ASL_MSG_RESERVED_WORD */ "Use of reserved name", -/* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target", -/* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)", -/* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)", -/* ASL_MSG_RESOURCE_SOURCE */ "Missing ResourceSource string (required)", -/* ASL_MSG_RETURN_TYPES */ "Not all control paths return a value", -/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope operator not allowed", -/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator", -/* ASL_MSG_SEEK */ "Could not seek file", -/* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)", -/* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value", -/* ASL_MSG_SWITCH_TYPE */ "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer", -/* ASL_MSG_SYNC_LEVEL */ "SyncLevel must be in the range 0-15", -/* ASL_MSG_SYNTAX */ "", -/* ASL_MSG_TABLE_SIGNATURE */ "Invalid Table Signature", -/* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)", -/* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name", -/* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable", -/* ASL_MSG_UNSUPPORTED */ "Unsupported feature", -/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)", -/* ASL_MSG_WRITE */ "Could not write file", -/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct", -/* ASL_MSG_TIMEOUT */ "Possible operator timeout is ignored", -/* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect", -/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced", -/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero", -/* ASL_MSG_STRING_LENGTH */ "String literal too long", -/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized", -/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name", -/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop", -/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method", -/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value", -/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)", -/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max", -/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window", -/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window", -/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one", -/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max", -/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)", -/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags", - -/* These messages are used by the data table compiler only */ - -/* ASL_MSG_INVALID_FIELD_NAME */ "Invalid Field Name", -/* ASL_MSG_INTEGER_SIZE */ "Integer too large for target", -/* ASL_MSG_INVALID_HEX_INTEGER */ "Invalid hex integer constant", -/* ASL_MSG_BUFFER_ELEMENT */ "Invalid element in buffer initializer list", -/* ASL_MSG_RESERVED_VALUE */ "Reserved field must be zero", -/* ASL_MSG_FLAG_VALUE */ "Flag value is too large", -/* ASL_MSG_ZERO_VALUE */ "Value must be non-zero", -/* ASL_MSG_UNKNOWN_TABLE */ "Unknown ACPI table signature", -/* ASL_MSG_UNKNOWN_SUBTABLE */ "Unknown subtable type", -/* ASL_MSG_OEM_TABLE */ "OEM table - unknown contents" - -}; - - -char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = { - "Warning ", - "Warning ", - "Warning ", - "Error ", - "Remark ", - "Optimize" -}; - -#define ASL_ERROR_LEVEL_LENGTH 8 /* Length of strings above */ - -#endif /* ASL_EXCEPTIONS */ - #endif /* __ASLTYPES_H */ diff --git a/compiler/aslutils.c b/compiler/aslutils.c index 23e58e5eb99f..37a15e99536a 100644 --- a/compiler/aslutils.c +++ b/compiler/aslutils.c @@ -120,6 +120,7 @@ #include "acdisasm.h" #include "acnamesp.h" #include "amlcode.h" +#include <acapps.h> #define _COMPONENT ACPI_COMPILER ACPI_MODULE_NAME ("aslutils") @@ -566,8 +567,8 @@ UtDisplaySummary ( { /* Compiler name and version number */ - FlPrintFile (FileId, "%s version %X [%s]\n", - CompilerId, (UINT32) ACPI_CA_VERSION, __DATE__); + FlPrintFile (FileId, "%s version %X%s [%s]\n", + ASL_COMPILER_NAME, (UINT32) ACPI_CA_VERSION, ACPI_WIDTH, __DATE__); } if (Gbl_FileType == ASL_INPUT_TYPE_ASCII_DATA) diff --git a/compiler/dtcompile.c b/compiler/dtcompile.c index c287c5b7af32..7596ba781c5d 100644 --- a/compiler/dtcompile.c +++ b/compiler/dtcompile.c @@ -314,7 +314,7 @@ DtInsertCompilerIds ( Next = Next->Next; } - Next->Value = CompilerCreatorId; + Next->Value = ASL_CREATOR_ID; Next->Flags = DT_FIELD_NOT_ALLOCATED; Next = Next->Next; diff --git a/compiler/dttemplate.c b/compiler/dttemplate.c index ad69a14c2799..e6a3cd5466d9 100644 --- a/compiler/dttemplate.c +++ b/compiler/dttemplate.c @@ -377,9 +377,9 @@ DtCreateOneTemplate ( AcpiOsRedirectOutput (File); - AcpiOsPrintf ("/*\n * %s\n", IntelAcpiCA); - AcpiOsPrintf (" * iASL Compiler/Disassembler version %8.8X\n *\n", - ACPI_CA_VERSION); + AcpiOsPrintf ("/*\n"); + AcpiOsPrintf (ACPI_COMMON_HEADER ("iASL Compiler/Disassembler", " * ")); + AcpiOsPrintf (" * Template for [%4.4s] ACPI Table\n", Signature); diff --git a/events/evxfregn.c b/events/evxfregn.c index 365174fb68bc..9803861cd13c 100644 --- a/events/evxfregn.c +++ b/events/evxfregn.c @@ -139,6 +139,12 @@ * * DESCRIPTION: Install a handler for all OpRegions of a given SpaceId. * + * NOTE: This function should only be called after AcpiEnableSubsystem has + * been called. This is because any _REG methods associated with the Space ID + * are executed here, and these methods can only be safely executed after + * the default handlers have been installed and the hardware has been + * initialized (via AcpiEnableSubsystem.) + * ******************************************************************************/ ACPI_STATUS diff --git a/include/acapps.h b/include/acapps.h index 418e20fb0840..9670547fdca5 100644 --- a/include/acapps.h +++ b/include/acapps.h @@ -121,6 +121,38 @@ #pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */ #endif +/* Common info for tool signons */ + +#define ACPICA_NAME "Intel ACPI Component Architecture" +#define ACPICA_COPYRIGHT "Copyright (c) 2000 - 2010 Intel Corporation" + +#if ACPI_MACHINE_WIDTH == 64 +#define ACPI_WIDTH "-64" + +#elif ACPI_MACHINE_WIDTH == 32 +#define ACPI_WIDTH "-32" + +#else +#error unknown ACPI_MACHINE_WIDTH +#define ACPI_WIDTH "-??" + +#endif + +/* Macros for signons and file headers */ + +#define ACPI_COMMON_SIGNON(UtilityName) \ + "\n%s\n%s version %8.8X%s [%s]\n%s\n\n", \ + ACPICA_NAME, \ + UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \ + ACPICA_COPYRIGHT + +#define ACPI_COMMON_HEADER(UtilityName, Prefix) \ + "%s%s\n%s%s version %8.8X%s [%s]\n%s%s\n%s\n", \ + Prefix, ACPICA_NAME, \ + Prefix, UtilityName, ((UINT32) ACPI_CA_VERSION), ACPI_WIDTH, __DATE__, \ + Prefix, ACPICA_COPYRIGHT, \ + Prefix + #define FILE_SUFFIX_DISASSEMBLY "dsl" #define ACPI_TABLE_FILE_SUFFIX ".dat" diff --git a/include/aclocal.h b/include/aclocal.h index eec3ffcb4732..062972f8e1c1 100644 --- a/include/aclocal.h +++ b/include/aclocal.h @@ -1080,6 +1080,7 @@ typedef struct acpi_bit_register_info ACPI_BITMASK_POWER_BUTTON_STATUS | \ ACPI_BITMASK_SLEEP_BUTTON_STATUS | \ ACPI_BITMASK_RT_CLOCK_STATUS | \ + ACPI_BITMASK_PCIEXP_WAKE_STATUS | \ ACPI_BITMASK_WAKE_STATUS) #define ACPI_BITMASK_TIMER_ENABLE 0x0001 @@ -1136,7 +1137,8 @@ typedef struct acpi_bit_register_info #define ACPI_OSI_WIN_VISTA 0x07 #define ACPI_OSI_WINSRV_2008 0x08 #define ACPI_OSI_WIN_VISTA_SP1 0x09 -#define ACPI_OSI_WIN_7 0x0A +#define ACPI_OSI_WIN_VISTA_SP2 0x0A +#define ACPI_OSI_WIN_7 0x0B #define ACPI_ALWAYS_ILLEGAL 0x00 diff --git a/include/acpixf.h b/include/acpixf.h index 7fac29fab557..e2f310d3ee5e 100644 --- a/include/acpixf.h +++ b/include/acpixf.h @@ -120,7 +120,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20100915 +#define ACPI_CA_VERSION 0x20101013 #include "actypes.h" #include "actbl.h" diff --git a/include/platform/acenv.h b/include/platform/acenv.h index c709f4423ebf..b167c706f8fe 100644 --- a/include/platform/acenv.h +++ b/include/platform/acenv.h @@ -148,9 +148,10 @@ #define ACPI_CONSTANT_EVAL_ONLY #define ACPI_LARGE_NAMESPACE_NODE #define ACPI_DATA_TABLE_DISASSEMBLY +#define ACPI_SINGLE_THREADED #endif -/* AcpiExec configuration */ +/* AcpiExec and AcpiBin configuration */ #ifdef ACPI_EXEC_APP #define ACPI_APPLICATION @@ -159,6 +160,11 @@ #define ACPI_DBG_TRACK_ALLOCATIONS #endif +#ifdef ACPI_BIN_APP +#define ACPI_APPLICATION +#define ACPI_SINGLE_THREADED +#endif + /* Linkable ACPICA library */ #ifdef ACPI_LIBRARY diff --git a/os_specific/service_layers/osunixdir.c b/os_specific/service_layers/osunixdir.c index 897d17340b9f..c3735a6d600e 100644 --- a/os_specific/service_layers/osunixdir.c +++ b/os_specific/service_layers/osunixdir.c @@ -125,6 +125,9 @@ #include "acpisrc.h" +/* + * Allocated structure returned from OsOpenDirectory + */ typedef struct ExternalFindInfo { char *DirPathname; @@ -193,7 +196,7 @@ AcpiOsOpenDirectory ( * * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory * - * RETURN: Next filename matched. NULL if no more matches. + * RETURN: Next filename matched. NULL if no more matches. * * DESCRIPTION: Get the next file in the directory that matches the wildcard * specification. @@ -217,7 +220,9 @@ AcpiOsGetNextFilename ( if (!fnmatch (ExternalInfo->WildcardSpec, dir_entry->d_name, 0)) { if (dir_entry->d_name[0] == '.') + { continue; + } str_len = strlen (dir_entry->d_name) + strlen (ExternalInfo->DirPathname) + 2; @@ -226,7 +231,7 @@ AcpiOsGetNextFilename ( if (!temp_str) { printf ("Could not allocate buffer for temporary string\n"); - return NULL; + return (NULL); } strcpy (temp_str, ExternalInfo->DirPathname); @@ -238,7 +243,7 @@ AcpiOsGetNextFilename ( if (err == -1) { printf ("stat() error - should not happen\n"); - return NULL; + return (NULL); } if ((S_ISDIR (temp_stat.st_mode) @@ -255,7 +260,7 @@ AcpiOsGetNextFilename ( } } - return NULL; + return (NULL); } @@ -284,10 +289,22 @@ AcpiOsCloseDirectory ( free (DirHandle); } + /* Other functions acpisrc uses but that aren't standard on Unix */ -/* lowercase a string */ -char* +/******************************************************************************* + * + * FUNCTION: strlwr + * + * PARAMETERS: str - String to be lowercased. + * + * RETURN: str. + * + * DESCRIPTION: Lowercase a string in-place. + * + ******************************************************************************/ + +char * strlwr ( char *str) { diff --git a/os_specific/service_layers/osunixxf.c b/os_specific/service_layers/osunixxf.c index 78fa435fec32..4a3be6b8e126 100644 --- a/os_specific/service_layers/osunixxf.c +++ b/os_specific/service_layers/osunixxf.c @@ -115,12 +115,11 @@ /* - * These interfaces are required in order to compile the ASL compiler under - * Linux or other Unix-like system. + * These interfaces are required in order to compile the ASL compiler and the + * various ACPICA tools under Linux or other Unix-like system. * * Note: Use #define __APPLE__ for OS X generation. */ - #include <stdio.h> #include <stdlib.h> #include <stdarg.h> @@ -157,6 +156,12 @@ AeTableOverride ( typedef void* (*PTHREAD_CALLBACK) (void *); +/* Apple-specific */ + +#ifdef __APPLE__ +#define sem_destroy sem_close +#endif + /****************************************************************************** * @@ -166,12 +171,13 @@ typedef void* (*PTHREAD_CALLBACK) (void *); * * RETURN: Status * - * DESCRIPTION: Init and terminate. Nothing to do. + * DESCRIPTION: Init and terminate. Nothing to do. * *****************************************************************************/ ACPI_STATUS -AcpiOsInitialize (void) +AcpiOsInitialize ( + void) { AcpiGbl_OutputFile = stdout; @@ -180,7 +186,8 @@ AcpiOsInitialize (void) ACPI_STATUS -AcpiOsTerminate (void) +AcpiOsTerminate ( + void) { return (AE_OK); @@ -195,7 +202,7 @@ AcpiOsTerminate (void) * * RETURN: RSDP physical address * - * DESCRIPTION: Gets the root pointer (RSDP) + * DESCRIPTION: Gets the ACPI root pointer (RSDP) * *****************************************************************************/ @@ -212,10 +219,10 @@ AcpiOsGetRootPointer ( * * FUNCTION: AcpiOsPredefinedOverride * - * PARAMETERS: InitVal - Initial value of the predefined object - * NewVal - The new value for the object + * PARAMETERS: InitVal - Initial value of the predefined object + * NewVal - The new value for the object * - * RETURN: Status, pointer to value. Null pointer returned if not + * RETURN: Status, pointer to value. Null pointer returned if not * overriding. * * DESCRIPTION: Allow the OS to override predefined names @@ -242,10 +249,11 @@ AcpiOsPredefinedOverride ( * * FUNCTION: AcpiOsTableOverride * - * PARAMETERS: ExistingTable - Header of current table (probably firmware) - * NewTable - Where an entire new table is returned. + * 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 + * 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 @@ -301,7 +309,7 @@ AcpiOsRedirectOutput ( * * FUNCTION: AcpiOsPrintf * - * PARAMETERS: fmt, ... Standard printf format + * PARAMETERS: fmt, ... - Standard printf format * * RETURN: None * @@ -327,8 +335,8 @@ AcpiOsPrintf ( * * FUNCTION: AcpiOsVprintf * - * PARAMETERS: fmt Standard printf format - * args Argument list + * PARAMETERS: fmt - Standard printf format + * args - Argument list * * RETURN: None * @@ -375,8 +383,8 @@ AcpiOsVprintf ( * * FUNCTION: AcpiOsGetLine * - * PARAMETERS: fmt Standard printf format - * args Argument list + * PARAMETERS: fmt - Standard printf format + * args - Argument list * * RETURN: Actual bytes read * @@ -412,14 +420,15 @@ AcpiOsGetLine ( return (i); } + /****************************************************************************** * * FUNCTION: AcpiOsMapMemory * - * PARAMETERS: where Physical address of memory to be mapped - * length How much memory to map + * PARAMETERS: where - Physical address of memory to be mapped + * length - How much memory to map * - * RETURN: Pointer to mapped memory. Null on error. + * RETURN: Pointer to mapped memory. Null on error. * * DESCRIPTION: Map physical memory into caller's address space * @@ -439,12 +448,12 @@ AcpiOsMapMemory ( * * FUNCTION: AcpiOsUnmapMemory * - * PARAMETERS: where Logical address of memory to be unmapped - * length How much memory to unmap + * 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 + * DESCRIPTION: Delete a previously created mapping. Where and Length must * correspond to a previous mapping exactly. * *****************************************************************************/ @@ -463,11 +472,11 @@ AcpiOsUnmapMemory ( * * FUNCTION: AcpiOsAllocate * - * PARAMETERS: Size Amount to allocate, in bytes + * PARAMETERS: Size - Amount to allocate, in bytes * - * RETURN: Pointer to the new allocation. Null on error. + * RETURN: Pointer to the new allocation. Null on error. * - * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. + * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. * *****************************************************************************/ @@ -487,7 +496,7 @@ AcpiOsAllocate ( * * FUNCTION: AcpiOsFree * - * PARAMETERS: mem Pointer to previously allocated memory + * PARAMETERS: mem - Pointer to previously allocated memory * * RETURN: None. * @@ -504,6 +513,52 @@ AcpiOsFree ( } +#ifdef ACPI_SINGLE_THREADED +/****************************************************************************** + * + * FUNCTION: Semaphore stub functions + * + * DESCRIPTION: Stub functions used for single-thread applications that do + * not require semaphore synchronization. Full implementations + * of these functions appear after the stubs. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsCreateSemaphore ( + UINT32 MaxUnits, + UINT32 InitialUnits, + ACPI_HANDLE *OutHandle) +{ + *OutHandle = (ACPI_HANDLE) 1; + return (AE_OK); +} + +ACPI_STATUS +AcpiOsDeleteSemaphore ( + ACPI_HANDLE Handle) +{ + return (AE_OK); +} + +ACPI_STATUS +AcpiOsWaitSemaphore ( + ACPI_HANDLE Handle, + UINT32 Units, + UINT16 Timeout) +{ + return (AE_OK); +} + +ACPI_STATUS +AcpiOsSignalSemaphore ( + ACPI_HANDLE Handle, + UINT32 Units) +{ + return (AE_OK); +} + +#else /****************************************************************************** * * FUNCTION: AcpiOsCreateSemaphore @@ -532,10 +587,15 @@ AcpiOsCreateSemaphore ( } #ifdef __APPLE__ - Sem = sem_open (tmpnam (NULL), O_EXCL|O_CREAT, 0755, InitialUnits); - if (!Sem) { - return (AE_NO_MEMORY); + char *SemaphoreName = tmpnam (NULL); + + Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits); + if (!Sem) + { + return (AE_NO_MEMORY); + } + sem_unlink (SemaphoreName); /* This just deletes the name */ } #else @@ -719,6 +779,8 @@ AcpiOsSignalSemaphore ( return (AE_OK); } +#endif /* ACPI_SINGLE_THREADED */ + /****************************************************************************** * @@ -767,13 +829,13 @@ AcpiOsReleaseLock ( * * FUNCTION: AcpiOsInstallInterruptHandler * - * PARAMETERS: InterruptNumber Level handler should respond to. - * Isr Address of the ACPI interrupt handler - * ExceptPtr Where status is returned + * 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 + * DESCRIPTION: Install an interrupt handler. Used to install the ACPI * OS-independent handler. * *****************************************************************************/ @@ -793,7 +855,7 @@ AcpiOsInstallInterruptHandler ( * * FUNCTION: AcpiOsRemoveInterruptHandler * - * PARAMETERS: Handle Returned when handler was installed + * PARAMETERS: Handle - Returned when handler was installed * * RETURN: Status * @@ -815,9 +877,9 @@ AcpiOsRemoveInterruptHandler ( * * FUNCTION: AcpiOsExecute * - * PARAMETERS: Type - Type of execution - * Function - Address of the function to execute - * Context - Passed as a parameter to the function + * PARAMETERS: Type - Type of execution + * Function - Address of the function to execute + * Context - Passed as a parameter to the function * * RETURN: Status. * @@ -848,7 +910,7 @@ AcpiOsExecute ( * * FUNCTION: AcpiOsStall * - * PARAMETERS: microseconds To sleep + * PARAMETERS: microseconds - Time to sleep * * RETURN: Blocks until sleep is completed. * @@ -872,7 +934,7 @@ AcpiOsStall ( * * FUNCTION: AcpiOsSleep * - * PARAMETERS: milliseconds To sleep + * PARAMETERS: milliseconds - Time to sleep * * RETURN: Blocks until sleep is completed. * @@ -893,6 +955,7 @@ AcpiOsSleep ( usleep ((milliseconds % 1000) * 1000); /* Sleep for remaining usecs */ } + /****************************************************************************** * * FUNCTION: AcpiOsGetTimer @@ -906,7 +969,8 @@ AcpiOsSleep ( *****************************************************************************/ UINT64 -AcpiOsGetTimer (void) +AcpiOsGetTimer ( + void) { struct timeval time; @@ -923,10 +987,10 @@ AcpiOsGetTimer (void) * * FUNCTION: AcpiOsReadPciConfiguration * - * PARAMETERS: PciId Seg/Bus/Dev - * Register Device Register - * Value Buffer where value is placed - * Width Number of bits + * PARAMETERS: PciId - Seg/Bus/Dev + * Register - Device Register + * Value - Buffer where value is placed + * Width - Number of bits * * RETURN: Status * @@ -950,10 +1014,10 @@ AcpiOsReadPciConfiguration ( * * FUNCTION: AcpiOsWritePciConfiguration * - * PARAMETERS: PciId Seg/Bus/Dev - * Register Device Register - * Value Value to be written - * Width Number of bits + * PARAMETERS: PciId - Seg/Bus/Dev + * Register - Device Register + * Value - Value to be written + * Width - Number of bits * * RETURN: Status. * @@ -977,9 +1041,9 @@ AcpiOsWritePciConfiguration ( * * FUNCTION: AcpiOsReadPort * - * PARAMETERS: Address Address of I/O port/register to read - * Value Where value is placed - * Width Number of bits + * PARAMETERS: Address - Address of I/O port/register to read + * Value - Where value is placed + * Width - Number of bits * * RETURN: Value read from port * @@ -1020,9 +1084,9 @@ AcpiOsReadPort ( * * FUNCTION: AcpiOsWritePort * - * PARAMETERS: Address Address of I/O port/register to write - * Value Value to write - * Width Number of bits + * PARAMETERS: Address - Address of I/O port/register to write + * Value - Value to write + * Width - Number of bits * * RETURN: None * @@ -1045,9 +1109,9 @@ AcpiOsWritePort ( * * FUNCTION: AcpiOsReadMemory * - * PARAMETERS: Address Physical Memory Address to read - * Value Where value is placed - * Width Number of bits + * PARAMETERS: Address - Physical Memory Address to read + * Value - Where value is placed + * Width - Number of bits * * RETURN: Value read from physical memory address * @@ -1081,9 +1145,9 @@ AcpiOsReadMemory ( * * FUNCTION: AcpiOsWriteMemory * - * PARAMETERS: Address Physical Memory Address to write - * Value Value to write - * Width Number of bits + * PARAMETERS: Address - Physical Memory Address to write + * Value - Value to write + * Width - Number of bits * * RETURN: None * @@ -1156,7 +1220,7 @@ AcpiOsWritable ( * * RETURN: Id of the running thread * - * DESCRIPTION: Get the Id of the current (running) thread + * DESCRIPTION: Get the ID of the current (running) thread * *****************************************************************************/ @@ -1173,8 +1237,8 @@ AcpiOsGetThreadId ( * * FUNCTION: AcpiOsSignal * - * PARAMETERS: Function ACPI CA signal function code - * Info Pointer to function-dependent structure + * PARAMETERS: Function - ACPI CA signal function code + * Info - Pointer to function-dependent structure * * RETURN: Status * @@ -1202,5 +1266,3 @@ AcpiOsSignal ( return (AE_OK); } - - diff --git a/os_specific/service_layers/oswindir.c b/os_specific/service_layers/oswindir.c index 1c7df069ffa6..16b7d32ca743 100644 --- a/os_specific/service_layers/oswindir.c +++ b/os_specific/service_layers/oswindir.c @@ -171,7 +171,7 @@ AcpiOsOpenDirectory ( SearchInfo = calloc (sizeof (EXTERNAL_FIND_INFO), 1); if (!SearchInfo) { - return NULL; + return (NULL); } /* Allocate space for the full wildcard path */ @@ -180,7 +180,7 @@ AcpiOsOpenDirectory ( if (!FullWildcardSpec) { printf ("Could not allocate buffer for wildcard pathname\n"); - return NULL; + return (NULL); } /* Create the full wildcard path */ @@ -198,7 +198,7 @@ AcpiOsOpenDirectory ( free (FullWildcardSpec); free (SearchInfo); - return NULL; + return (NULL); } /* Save the info in the return structure */ @@ -217,7 +217,7 @@ AcpiOsOpenDirectory ( * * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory * - * RETURN: Next filename matched. NULL if no more matches. + * RETURN: Next filename matched. NULL if no more matches. * * DESCRIPTION: Get the next file in the directory that matches the wildcard * specification. @@ -254,7 +254,7 @@ AcpiOsGetNextFilename ( Status = _findnext (SearchInfo->FindHandle, &SearchInfo->DosInfo); if (Status != 0) { - return NULL; + return (NULL); } } @@ -288,7 +288,7 @@ AcpiOsGetNextFilename ( break; default: - return NULL; + return (NULL); } } @@ -302,7 +302,7 @@ AcpiOsGetNextFilename ( * * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory * - * RETURN: None. + * RETURN: None * * DESCRIPTION: Close the open directory and cleanup. * diff --git a/os_specific/service_layers/oswinxf.c b/os_specific/service_layers/oswinxf.c index cf19603ec280..2ad82369414e 100644 --- a/os_specific/service_layers/oswinxf.c +++ b/os_specific/service_layers/oswinxf.c @@ -137,24 +137,17 @@ ACPI_MODULE_NAME ("oswinxf") -/* Semaphore information structure */ - -typedef struct acpi_os_semaphore_info -{ - UINT16 MaxUnits; - UINT16 CurrentUnits; - void *OsHandle; - -} ACPI_OS_SEMAPHORE_INFO; - -/* Need enough semaphores to run the large aslts suite */ +extern FILE *AcpiGbl_DebugFile; +extern BOOLEAN AcpiGbl_DebugTimeout; -#define ACPI_OS_MAX_SEMAPHORES 256 +FILE *AcpiGbl_OutputFile; +UINT64 TimerFrequency; +char TableName[ACPI_NAME_SIZE + 1]; -ACPI_OS_SEMAPHORE_INFO AcpiGbl_Semaphores[ACPI_OS_MAX_SEMAPHORES]; +#define ACPI_OS_DEBUG_TIMEOUT 30000 /* 30 seconds */ -/* Upcalls to AcpiExec */ +/* Upcalls to application */ ACPI_PHYSICAL_ADDRESS AeLocalGetRootPointer ( @@ -170,14 +163,28 @@ OsGetTable ( char *Signature); -extern FILE *AcpiGbl_DebugFile; -extern BOOLEAN AcpiGbl_DebugTimeout; +/* + * Real semaphores are only used for a multi-threaded application + */ +#ifndef ACPI_SINGLE_THREADED -FILE *AcpiGbl_OutputFile; -UINT64 TimerFrequency; -char TableName[ACPI_NAME_SIZE + 1]; +/* Semaphore information structure */ -#define ACPI_OS_DEBUG_TIMEOUT 30000 /* 30 seconds */ +typedef struct acpi_os_semaphore_info +{ + UINT16 MaxUnits; + UINT16 CurrentUnits; + void *OsHandle; + +} ACPI_OS_SEMAPHORE_INFO; + +/* Need enough semaphores to run the large aslts suite */ + +#define ACPI_OS_MAX_SEMAPHORES 256 + +ACPI_OS_SEMAPHORE_INFO AcpiGbl_Semaphores[ACPI_OS_MAX_SEMAPHORES]; + +#endif /* ACPI_SINGLE_THREADED */ /****************************************************************************** @@ -186,16 +193,17 @@ char TableName[ACPI_NAME_SIZE + 1]; * * PARAMETERS: None * - * RETURN: None + * RETURN: Status * * DESCRIPTION: Nothing to do for windows * *****************************************************************************/ ACPI_STATUS -AcpiOsTerminate (void) +AcpiOsTerminate ( + void) { - return AE_OK; + return (AE_OK); } @@ -212,16 +220,19 @@ AcpiOsTerminate (void) *****************************************************************************/ ACPI_STATUS -AcpiOsInitialize (void) +AcpiOsInitialize ( + void) { LARGE_INTEGER LocalTimerFrequency; - AcpiGbl_OutputFile = stdout; - +#ifndef ACPI_SINGLE_THREADED /* Clear the semaphore info array */ memset (AcpiGbl_Semaphores, 0x00, sizeof (AcpiGbl_Semaphores)); +#endif + + AcpiGbl_OutputFile = stdout; /* Get the timer frequency for use in AcpiOsGetTimer */ @@ -233,7 +244,7 @@ AcpiOsInitialize (void) TimerFrequency = LocalTimerFrequency.QuadPart; } - return AE_OK; + return (AE_OK); } @@ -262,10 +273,10 @@ AcpiOsGetRootPointer ( * * FUNCTION: AcpiOsPredefinedOverride * - * PARAMETERS: InitVal - Initial value of the predefined object - * NewVal - The new value for the object + * PARAMETERS: InitVal - Initial value of the predefined object + * NewVal - The new value for the object * - * RETURN: Status, pointer to value. Null pointer returned if not + * RETURN: Status, pointer to value. Null pointer returned if not * overriding. * * DESCRIPTION: Allow the OS to override predefined names @@ -292,10 +303,10 @@ AcpiOsPredefinedOverride ( * * FUNCTION: AcpiOsTableOverride * - * PARAMETERS: ExistingTable - Header of current table (probably firmware) - * NewTable - Where an entire new table is returned. + * 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 + * 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 @@ -460,7 +471,7 @@ AcpiOsRedirectOutput ( * * FUNCTION: AcpiOsPrintf * - * PARAMETERS: fmt, ... Standard printf format + * PARAMETERS: Fmt, ... - Standard printf format * * RETURN: None * @@ -489,8 +500,8 @@ AcpiOsPrintf ( * * FUNCTION: AcpiOsVprintf * - * PARAMETERS: fmt Standard printf format - * args Argument list + * PARAMETERS: Fmt - Standard printf format + * Args - Argument list * * RETURN: None * @@ -539,8 +550,7 @@ AcpiOsVprintf ( * * FUNCTION: AcpiOsGetLine * - * PARAMETERS: fmt Standard printf format - * args Argument list + * PARAMETERS: Buffer - Where to store the line * * RETURN: Actual bytes read * @@ -581,10 +591,10 @@ AcpiOsGetLine ( * * FUNCTION: AcpiOsMapMemory * - * PARAMETERS: where Physical address of memory to be mapped - * length How much memory to map + * PARAMETERS: Where - Physical address of memory to be mapped + * Length - How much memory to map * - * RETURN: Pointer to mapped memory. Null on error. + * RETURN: Pointer to mapped memory. Null on error. * * DESCRIPTION: Map physical memory into caller's address space * @@ -592,11 +602,11 @@ AcpiOsGetLine ( void * AcpiOsMapMemory ( - ACPI_PHYSICAL_ADDRESS where, - ACPI_SIZE length) + ACPI_PHYSICAL_ADDRESS Where, + ACPI_SIZE Length) { - return (ACPI_TO_POINTER ((ACPI_SIZE) where)); + return (ACPI_TO_POINTER ((ACPI_SIZE) Where)); } @@ -604,20 +614,20 @@ AcpiOsMapMemory ( * * FUNCTION: AcpiOsUnmapMemory * - * PARAMETERS: where Logical address of memory to be unmapped - * length How much memory to unmap + * 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 + * DESCRIPTION: Delete a previously created mapping. Where and Length must * correspond to a previous mapping exactly. * *****************************************************************************/ void AcpiOsUnmapMemory ( - void *where, - ACPI_SIZE length) + void *Where, + ACPI_SIZE Length) { return; @@ -628,24 +638,24 @@ AcpiOsUnmapMemory ( * * FUNCTION: AcpiOsAllocate * - * PARAMETERS: Size Amount to allocate, in bytes + * PARAMETERS: Size - Amount to allocate, in bytes * - * RETURN: Pointer to the new allocation. Null on error. + * RETURN: Pointer to the new allocation. Null on error. * - * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. + * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. * *****************************************************************************/ void * AcpiOsAllocate ( - ACPI_SIZE size) + ACPI_SIZE Size) { void *Mem; - Mem = (void *) malloc ((size_t) size); + Mem = (void *) malloc ((size_t) Size); - return Mem; + return (Mem); } @@ -653,7 +663,7 @@ AcpiOsAllocate ( * * FUNCTION: AcpiOsFree * - * PARAMETERS: mem Pointer to previously allocated memory + * PARAMETERS: Mem - Pointer to previously allocated memory * * RETURN: None. * @@ -670,6 +680,52 @@ AcpiOsFree ( } +#ifdef ACPI_SINGLE_THREADED +/****************************************************************************** + * + * FUNCTION: Semaphore stub functions + * + * DESCRIPTION: Stub functions used for single-thread applications that do + * not require semaphore synchronization. Full implementations + * of these functions appear after the stubs. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsCreateSemaphore ( + UINT32 MaxUnits, + UINT32 InitialUnits, + ACPI_HANDLE *OutHandle) +{ + *OutHandle = (ACPI_HANDLE) 1; + return (AE_OK); +} + +ACPI_STATUS +AcpiOsDeleteSemaphore ( + ACPI_HANDLE Handle) +{ + return (AE_OK); +} + +ACPI_STATUS +AcpiOsWaitSemaphore ( + ACPI_HANDLE Handle, + UINT32 Units, + UINT16 Timeout) +{ + return (AE_OK); +} + +ACPI_STATUS +AcpiOsSignalSemaphore ( + ACPI_HANDLE Handle, + UINT32 Units) +{ + return (AE_OK); +} + +#else /****************************************************************************** * * FUNCTION: AcpiOsCreateSemaphore @@ -690,12 +746,10 @@ AcpiOsCreateSemaphore ( UINT32 InitialUnits, ACPI_SEMAPHORE *OutHandle) { -#ifdef _MULTI_THREADED void *Mutex; UINT32 i; ACPI_FUNCTION_NAME (OsCreateSemaphore); -#endif if (MaxUnits == ACPI_UINT32_MAX) @@ -710,11 +764,9 @@ AcpiOsCreateSemaphore ( if (InitialUnits > MaxUnits) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } -#ifdef _MULTI_THREADED - /* Find an empty slot */ for (i = 0; i < ACPI_OS_MAX_SEMAPHORES; i++) @@ -728,7 +780,7 @@ AcpiOsCreateSemaphore ( { ACPI_EXCEPTION ((AE_INFO, AE_LIMIT, "Reached max semaphores (%u), could not create", ACPI_OS_MAX_SEMAPHORES)); - return AE_LIMIT; + return (AE_LIMIT); } /* Create an OS semaphore */ @@ -737,7 +789,7 @@ AcpiOsCreateSemaphore ( if (!Mutex) { ACPI_ERROR ((AE_INFO, "Could not create semaphore")); - return AE_NO_MEMORY; + return (AE_NO_MEMORY); } AcpiGbl_Semaphores[i].MaxUnits = (UINT16) MaxUnits; @@ -748,9 +800,7 @@ AcpiOsCreateSemaphore ( i, MaxUnits, InitialUnits, Mutex)); *OutHandle = (void *) i; -#endif - - return AE_OK; + return (AE_OK); } @@ -776,17 +826,12 @@ AcpiOsDeleteSemaphore ( if ((Index >= ACPI_OS_MAX_SEMAPHORES) || !AcpiGbl_Semaphores[Index].OsHandle) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } - -#ifdef _MULTI_THREADED - CloseHandle (AcpiGbl_Semaphores[Index].OsHandle); AcpiGbl_Semaphores[Index].OsHandle = NULL; -#endif - - return AE_OK; + return (AE_OK); } @@ -810,7 +855,6 @@ AcpiOsWaitSemaphore ( UINT32 Units, UINT16 Timeout) { -#ifdef _MULTI_THREADED UINT32 Index = (UINT32) Handle; UINT32 WaitStatus; UINT32 OsTimeout = Timeout; @@ -822,13 +866,13 @@ AcpiOsWaitSemaphore ( if ((Index >= ACPI_OS_MAX_SEMAPHORES) || !AcpiGbl_Semaphores[Index].OsHandle) { - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } if (Units > 1) { printf ("WaitSemaphore: Attempt to receive %u units\n", Units); - return AE_NOT_IMPLEMENTED; + return (AE_NOT_IMPLEMENTED); } if (Timeout == ACPI_WAIT_FOREVER) @@ -857,7 +901,7 @@ AcpiOsWaitSemaphore ( "Debug timeout on semaphore 0x%04X (%ums)\n", Index, ACPI_OS_DEBUG_TIMEOUT)); } - return AE_TIME; + return (AE_TIME); } if (AcpiGbl_Semaphores[Index].CurrentUnits == 0) @@ -865,13 +909,11 @@ AcpiOsWaitSemaphore ( ACPI_ERROR ((AE_INFO, "%s - No unit received. Timeout 0x%X, OS_Status 0x%X", AcpiUtGetMutexName (Index), Timeout, WaitStatus)); - return AE_OK; + return (AE_OK); } AcpiGbl_Semaphores[Index].CurrentUnits--; -#endif - - return AE_OK; + return (AE_OK); } @@ -893,8 +935,6 @@ AcpiOsSignalSemaphore ( ACPI_SEMAPHORE Handle, UINT32 Units) { -#ifdef _MULTI_THREADED - UINT32 Index = (UINT32) Handle; @@ -904,19 +944,19 @@ AcpiOsSignalSemaphore ( if (Index >= ACPI_OS_MAX_SEMAPHORES) { printf ("SignalSemaphore: Index/Handle out of range: %2.2X\n", Index); - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } if (!AcpiGbl_Semaphores[Index].OsHandle) { printf ("SignalSemaphore: Null OS handle, Index %2.2X\n", Index); - return AE_BAD_PARAMETER; + return (AE_BAD_PARAMETER); } if (Units > 1) { printf ("SignalSemaphore: Attempt to signal %u units, Index %2.2X\n", Units, Index); - return AE_NOT_IMPLEMENTED; + return (AE_NOT_IMPLEMENTED); } if ((AcpiGbl_Semaphores[Index].CurrentUnits + 1) > @@ -933,13 +973,19 @@ AcpiOsSignalSemaphore ( AcpiGbl_Semaphores[Index].CurrentUnits++; ReleaseSemaphore (AcpiGbl_Semaphores[Index].OsHandle, Units, NULL); -#endif - return (AE_OK); } +#endif /* ACPI_SINGLE_THREADED */ -/* Spinlock interfaces, just implement with a semaphore */ + +/****************************************************************************** + * + * FUNCTION: Spinlock interfaces + * + * DESCRIPTION: Map these interfaces to semaphore interfaces + * + *****************************************************************************/ ACPI_STATUS AcpiOsCreateLock ( @@ -1012,13 +1058,13 @@ AcpiOsReleaseMutex ( * * FUNCTION: AcpiOsInstallInterruptHandler * - * PARAMETERS: InterruptNumber Level handler should respond to. - * Isr Address of the ACPI interrupt handler - * ExceptPtr Where status is returned + * PARAMETERS: InterruptNumber - Level handler should respond to. + * ServiceRoutine - Address of the ACPI interrupt handler + * Context - User context * * RETURN: Handle to the newly installed handler. * - * DESCRIPTION: Install an interrupt handler. Used to install the ACPI + * DESCRIPTION: Install an interrupt handler. Used to install the ACPI * OS-independent handler. * *****************************************************************************/ @@ -1030,7 +1076,7 @@ AcpiOsInstallInterruptHandler ( void *Context) { - return AE_OK; + return (AE_OK); } @@ -1038,7 +1084,7 @@ AcpiOsInstallInterruptHandler ( * * FUNCTION: AcpiOsRemoveInterruptHandler * - * PARAMETERS: Handle Returned when handler was installed + * PARAMETERS: Handle - Returned when handler was installed * * RETURN: Status * @@ -1052,7 +1098,7 @@ AcpiOsRemoveInterruptHandler ( ACPI_OSD_HANDLER ServiceRoutine) { - return AE_OK; + return (AE_OK); } @@ -1085,9 +1131,9 @@ AcpiOsGetThreadId ( * * FUNCTION: AcpiOsExecute * - * PARAMETERS: Type - Type of execution - * Function - Address of the function to execute - * Context - Passed as a parameter to the function + * PARAMETERS: Type - Type of execution + * Function - Address of the function to execute + * Context - Passed as a parameter to the function * * RETURN: Status * @@ -1102,11 +1148,11 @@ AcpiOsExecute ( void *Context) { -#ifdef _MULTI_THREADED +#ifndef ACPI_SINGLE_THREADED _beginthread (Function, (unsigned) 0, Context); #endif - return 0; + return (0); } @@ -1114,9 +1160,9 @@ AcpiOsExecute ( * * FUNCTION: AcpiOsStall * - * PARAMETERS: microseconds To sleep + * PARAMETERS: Microseconds - Time to stall * - * RETURN: Blocks until sleep is completed. + * RETURN: None. Blocks until stall is completed. * * DESCRIPTION: Sleep at microsecond granularity * @@ -1124,10 +1170,10 @@ AcpiOsExecute ( void AcpiOsStall ( - UINT32 microseconds) + UINT32 Microseconds) { - Sleep ((microseconds / 1000) + 1); + Sleep ((Microseconds / 1000) + 1); return; } @@ -1136,9 +1182,9 @@ AcpiOsStall ( * * FUNCTION: AcpiOsSleep * - * PARAMETERS: milliseconds To sleep + * PARAMETERS: Milliseconds - Time to sleep * - * RETURN: Blocks until sleep is completed. + * RETURN: None. Blocks until sleep is completed. * * DESCRIPTION: Sleep at millisecond granularity * @@ -1146,12 +1192,12 @@ AcpiOsStall ( void AcpiOsSleep ( - UINT64 milliseconds) + UINT64 Milliseconds) { /* Add 10ms to account for clock tick granularity */ - Sleep (((unsigned long) milliseconds) + 10); + Sleep (((unsigned long) Milliseconds) + 10); return; } @@ -1160,10 +1206,10 @@ AcpiOsSleep ( * * FUNCTION: AcpiOsReadPciConfiguration * - * PARAMETERS: PciId Seg/Bus/Dev - * Register Device Register - * Value Buffer where value is placed - * Width Number of bits + * PARAMETERS: PciId - Seg/Bus/Dev + * Register - Device Register + * Value - Buffer where value is placed + * Width - Number of bits * * RETURN: Status * @@ -1187,12 +1233,12 @@ AcpiOsReadPciConfiguration ( * * FUNCTION: AcpiOsWritePciConfiguration * - * PARAMETERS: PciId Seg/Bus/Dev - * Register Device Register - * Value Value to be written - * Width Number of bits + * PARAMETERS: PciId - Seg/Bus/Dev + * Register - Device Register + * Value - Value to be written + * Width - Number of bits * - * RETURN: Status. + * RETURN: Status * * DESCRIPTION: Write data to PCI configuration space * @@ -1214,9 +1260,9 @@ AcpiOsWritePciConfiguration ( * * FUNCTION: AcpiOsReadPort * - * PARAMETERS: Address Address of I/O port/register to read - * Value Where value is placed - * Width Number of bits + * PARAMETERS: Address - Address of I/O port/register to read + * Value - Where value is placed + * Width - Number of bits * * RETURN: Value read from port * @@ -1257,9 +1303,9 @@ AcpiOsReadPort ( * * FUNCTION: AcpiOsWritePort * - * PARAMETERS: Address Address of I/O port/register to write - * Value Value to write - * Width Number of bits + * PARAMETERS: Address - Address of I/O port/register to write + * Value - Value to write + * Width - Number of bits * * RETURN: None * @@ -1282,11 +1328,11 @@ AcpiOsWritePort ( * * FUNCTION: AcpiOsReadMemory * - * PARAMETERS: Address Physical Memory Address to read - * Value Where value is placed - * Width Number of bits + * PARAMETERS: Address - Physical Memory Address to read + * Value - Where value is placed + * Width - Number of bits * - * RETURN: Value read from physical memory address. Always returned + * RETURN: Value read from physical memory address. Always returned * as a 32-bit integer, regardless of the read width. * * DESCRIPTION: Read data from a physical memory address @@ -1321,9 +1367,9 @@ AcpiOsReadMemory ( * * FUNCTION: AcpiOsWriteMemory * - * PARAMETERS: Address Physical Memory Address to write - * Value Value to write - * Width Number of bits + * PARAMETERS: Address - Physical Memory Address to write + * Value - Value to write + * Width - Number of bits * * RETURN: None * @@ -1346,8 +1392,8 @@ AcpiOsWriteMemory ( * * FUNCTION: AcpiOsSignal * - * PARAMETERS: Function ACPI CA signal function code - * Info Pointer to function-dependent structure + * PARAMETERS: Function - ACPI CA signal function code + * Info - Pointer to function-dependent structure * * RETURN: Status * diff --git a/osunixxf.c b/osunixxf.c index 78fa435fec32..4a3be6b8e126 100644 --- a/osunixxf.c +++ b/osunixxf.c @@ -115,12 +115,11 @@ /* - * These interfaces are required in order to compile the ASL compiler under - * Linux or other Unix-like system. + * These interfaces are required in order to compile the ASL compiler and the + * various ACPICA tools under Linux or other Unix-like system. * * Note: Use #define __APPLE__ for OS X generation. */ - #include <stdio.h> #include <stdlib.h> #include <stdarg.h> @@ -157,6 +156,12 @@ AeTableOverride ( typedef void* (*PTHREAD_CALLBACK) (void *); +/* Apple-specific */ + +#ifdef __APPLE__ +#define sem_destroy sem_close +#endif + /****************************************************************************** * @@ -166,12 +171,13 @@ typedef void* (*PTHREAD_CALLBACK) (void *); * * RETURN: Status * - * DESCRIPTION: Init and terminate. Nothing to do. + * DESCRIPTION: Init and terminate. Nothing to do. * *****************************************************************************/ ACPI_STATUS -AcpiOsInitialize (void) +AcpiOsInitialize ( + void) { AcpiGbl_OutputFile = stdout; @@ -180,7 +186,8 @@ AcpiOsInitialize (void) ACPI_STATUS -AcpiOsTerminate (void) +AcpiOsTerminate ( + void) { return (AE_OK); @@ -195,7 +202,7 @@ AcpiOsTerminate (void) * * RETURN: RSDP physical address * - * DESCRIPTION: Gets the root pointer (RSDP) + * DESCRIPTION: Gets the ACPI root pointer (RSDP) * *****************************************************************************/ @@ -212,10 +219,10 @@ AcpiOsGetRootPointer ( * * FUNCTION: AcpiOsPredefinedOverride * - * PARAMETERS: InitVal - Initial value of the predefined object - * NewVal - The new value for the object + * PARAMETERS: InitVal - Initial value of the predefined object + * NewVal - The new value for the object * - * RETURN: Status, pointer to value. Null pointer returned if not + * RETURN: Status, pointer to value. Null pointer returned if not * overriding. * * DESCRIPTION: Allow the OS to override predefined names @@ -242,10 +249,11 @@ AcpiOsPredefinedOverride ( * * FUNCTION: AcpiOsTableOverride * - * PARAMETERS: ExistingTable - Header of current table (probably firmware) - * NewTable - Where an entire new table is returned. + * 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 + * 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 @@ -301,7 +309,7 @@ AcpiOsRedirectOutput ( * * FUNCTION: AcpiOsPrintf * - * PARAMETERS: fmt, ... Standard printf format + * PARAMETERS: fmt, ... - Standard printf format * * RETURN: None * @@ -327,8 +335,8 @@ AcpiOsPrintf ( * * FUNCTION: AcpiOsVprintf * - * PARAMETERS: fmt Standard printf format - * args Argument list + * PARAMETERS: fmt - Standard printf format + * args - Argument list * * RETURN: None * @@ -375,8 +383,8 @@ AcpiOsVprintf ( * * FUNCTION: AcpiOsGetLine * - * PARAMETERS: fmt Standard printf format - * args Argument list + * PARAMETERS: fmt - Standard printf format + * args - Argument list * * RETURN: Actual bytes read * @@ -412,14 +420,15 @@ AcpiOsGetLine ( return (i); } + /****************************************************************************** * * FUNCTION: AcpiOsMapMemory * - * PARAMETERS: where Physical address of memory to be mapped - * length How much memory to map + * PARAMETERS: where - Physical address of memory to be mapped + * length - How much memory to map * - * RETURN: Pointer to mapped memory. Null on error. + * RETURN: Pointer to mapped memory. Null on error. * * DESCRIPTION: Map physical memory into caller's address space * @@ -439,12 +448,12 @@ AcpiOsMapMemory ( * * FUNCTION: AcpiOsUnmapMemory * - * PARAMETERS: where Logical address of memory to be unmapped - * length How much memory to unmap + * 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 + * DESCRIPTION: Delete a previously created mapping. Where and Length must * correspond to a previous mapping exactly. * *****************************************************************************/ @@ -463,11 +472,11 @@ AcpiOsUnmapMemory ( * * FUNCTION: AcpiOsAllocate * - * PARAMETERS: Size Amount to allocate, in bytes + * PARAMETERS: Size - Amount to allocate, in bytes * - * RETURN: Pointer to the new allocation. Null on error. + * RETURN: Pointer to the new allocation. Null on error. * - * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. + * DESCRIPTION: Allocate memory. Algorithm is dependent on the OS. * *****************************************************************************/ @@ -487,7 +496,7 @@ AcpiOsAllocate ( * * FUNCTION: AcpiOsFree * - * PARAMETERS: mem Pointer to previously allocated memory + * PARAMETERS: mem - Pointer to previously allocated memory * * RETURN: None. * @@ -504,6 +513,52 @@ AcpiOsFree ( } +#ifdef ACPI_SINGLE_THREADED +/****************************************************************************** + * + * FUNCTION: Semaphore stub functions + * + * DESCRIPTION: Stub functions used for single-thread applications that do + * not require semaphore synchronization. Full implementations + * of these functions appear after the stubs. + * + *****************************************************************************/ + +ACPI_STATUS +AcpiOsCreateSemaphore ( + UINT32 MaxUnits, + UINT32 InitialUnits, + ACPI_HANDLE *OutHandle) +{ + *OutHandle = (ACPI_HANDLE) 1; + return (AE_OK); +} + +ACPI_STATUS +AcpiOsDeleteSemaphore ( + ACPI_HANDLE Handle) +{ + return (AE_OK); +} + +ACPI_STATUS +AcpiOsWaitSemaphore ( + ACPI_HANDLE Handle, + UINT32 Units, + UINT16 Timeout) +{ + return (AE_OK); +} + +ACPI_STATUS +AcpiOsSignalSemaphore ( + ACPI_HANDLE Handle, + UINT32 Units) +{ + return (AE_OK); +} + +#else /****************************************************************************** * * FUNCTION: AcpiOsCreateSemaphore @@ -532,10 +587,15 @@ AcpiOsCreateSemaphore ( } #ifdef __APPLE__ - Sem = sem_open (tmpnam (NULL), O_EXCL|O_CREAT, 0755, InitialUnits); - if (!Sem) { - return (AE_NO_MEMORY); + char *SemaphoreName = tmpnam (NULL); + + Sem = sem_open (SemaphoreName, O_EXCL|O_CREAT, 0755, InitialUnits); + if (!Sem) + { + return (AE_NO_MEMORY); + } + sem_unlink (SemaphoreName); /* This just deletes the name */ } #else @@ -719,6 +779,8 @@ AcpiOsSignalSemaphore ( return (AE_OK); } +#endif /* ACPI_SINGLE_THREADED */ + /****************************************************************************** * @@ -767,13 +829,13 @@ AcpiOsReleaseLock ( * * FUNCTION: AcpiOsInstallInterruptHandler * - * PARAMETERS: InterruptNumber Level handler should respond to. - * Isr Address of the ACPI interrupt handler - * ExceptPtr Where status is returned + * 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 + * DESCRIPTION: Install an interrupt handler. Used to install the ACPI * OS-independent handler. * *****************************************************************************/ @@ -793,7 +855,7 @@ AcpiOsInstallInterruptHandler ( * * FUNCTION: AcpiOsRemoveInterruptHandler * - * PARAMETERS: Handle Returned when handler was installed + * PARAMETERS: Handle - Returned when handler was installed * * RETURN: Status * @@ -815,9 +877,9 @@ AcpiOsRemoveInterruptHandler ( * * FUNCTION: AcpiOsExecute * - * PARAMETERS: Type - Type of execution - * Function - Address of the function to execute - * Context - Passed as a parameter to the function + * PARAMETERS: Type - Type of execution + * Function - Address of the function to execute + * Context - Passed as a parameter to the function * * RETURN: Status. * @@ -848,7 +910,7 @@ AcpiOsExecute ( * * FUNCTION: AcpiOsStall * - * PARAMETERS: microseconds To sleep + * PARAMETERS: microseconds - Time to sleep * * RETURN: Blocks until sleep is completed. * @@ -872,7 +934,7 @@ AcpiOsStall ( * * FUNCTION: AcpiOsSleep * - * PARAMETERS: milliseconds To sleep + * PARAMETERS: milliseconds - Time to sleep * * RETURN: Blocks until sleep is completed. * @@ -893,6 +955,7 @@ AcpiOsSleep ( usleep ((milliseconds % 1000) * 1000); /* Sleep for remaining usecs */ } + /****************************************************************************** * * FUNCTION: AcpiOsGetTimer @@ -906,7 +969,8 @@ AcpiOsSleep ( *****************************************************************************/ UINT64 -AcpiOsGetTimer (void) +AcpiOsGetTimer ( + void) { struct timeval time; @@ -923,10 +987,10 @@ AcpiOsGetTimer (void) * * FUNCTION: AcpiOsReadPciConfiguration * - * PARAMETERS: PciId Seg/Bus/Dev - * Register Device Register - * Value Buffer where value is placed - * Width Number of bits + * PARAMETERS: PciId - Seg/Bus/Dev + * Register - Device Register + * Value - Buffer where value is placed + * Width - Number of bits * * RETURN: Status * @@ -950,10 +1014,10 @@ AcpiOsReadPciConfiguration ( * * FUNCTION: AcpiOsWritePciConfiguration * - * PARAMETERS: PciId Seg/Bus/Dev - * Register Device Register - * Value Value to be written - * Width Number of bits + * PARAMETERS: PciId - Seg/Bus/Dev + * Register - Device Register + * Value - Value to be written + * Width - Number of bits * * RETURN: Status. * @@ -977,9 +1041,9 @@ AcpiOsWritePciConfiguration ( * * FUNCTION: AcpiOsReadPort * - * PARAMETERS: Address Address of I/O port/register to read - * Value Where value is placed - * Width Number of bits + * PARAMETERS: Address - Address of I/O port/register to read + * Value - Where value is placed + * Width - Number of bits * * RETURN: Value read from port * @@ -1020,9 +1084,9 @@ AcpiOsReadPort ( * * FUNCTION: AcpiOsWritePort * - * PARAMETERS: Address Address of I/O port/register to write - * Value Value to write - * Width Number of bits + * PARAMETERS: Address - Address of I/O port/register to write + * Value - Value to write + * Width - Number of bits * * RETURN: None * @@ -1045,9 +1109,9 @@ AcpiOsWritePort ( * * FUNCTION: AcpiOsReadMemory * - * PARAMETERS: Address Physical Memory Address to read - * Value Where value is placed - * Width Number of bits + * PARAMETERS: Address - Physical Memory Address to read + * Value - Where value is placed + * Width - Number of bits * * RETURN: Value read from physical memory address * @@ -1081,9 +1145,9 @@ AcpiOsReadMemory ( * * FUNCTION: AcpiOsWriteMemory * - * PARAMETERS: Address Physical Memory Address to write - * Value Value to write - * Width Number of bits + * PARAMETERS: Address - Physical Memory Address to write + * Value - Value to write + * Width - Number of bits * * RETURN: None * @@ -1156,7 +1220,7 @@ AcpiOsWritable ( * * RETURN: Id of the running thread * - * DESCRIPTION: Get the Id of the current (running) thread + * DESCRIPTION: Get the ID of the current (running) thread * *****************************************************************************/ @@ -1173,8 +1237,8 @@ AcpiOsGetThreadId ( * * FUNCTION: AcpiOsSignal * - * PARAMETERS: Function ACPI CA signal function code - * Info Pointer to function-dependent structure + * PARAMETERS: Function - ACPI CA signal function code + * Info - Pointer to function-dependent structure * * RETURN: Status * @@ -1202,5 +1266,3 @@ AcpiOsSignal ( return (AE_OK); } - - diff --git a/tests/misc/badcode.asl b/tests/misc/badcode.asl index 36ca0d582f27..1230ec07ebb6 100644 --- a/tests/misc/badcode.asl +++ b/tests/misc/badcode.asl @@ -35,7 +35,7 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001) // Invalid hex escape sequence Name (ESC1, "abcdefg\x00hijklmn") - + // Field access beyond region bounds OperationRegion (OPR1, SystemMemory, 0x2000, 6) @@ -116,9 +116,24 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001) Store (MTH2 (), Local0) } - // Invalid _HID value + // Invalid _HID values - Name (_HID, "*PNP0C0A") + Device (H1) + { + Name (_HID, "*PNP0C0A") // Illegal leading asterisk + } + Device (H2) + { + Name (_HID, "PNP") // Too short, must be 7 or 8 chars + } + Device (H3) + { + Name (_HID, "MYDEVICE01") // Too long, must be 7 or 8 chars + } + Device (H4) + { + Name (_HID, "acpi0001") // non-hex chars must be uppercase + } // Predefined Name typechecking @@ -155,7 +170,7 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001) } } - // Missing EndDependentFn macro + // Missing EndDependentFn macro }) Name (RSC2, ResourceTemplate () @@ -191,7 +206,7 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001) ) // Invalid AccessSize parameter - Register (SystemIO, + Register (SystemIO, 0x08, // Bit Width 0x00, // Bit Offset 0x0000000000000100, // Address @@ -287,6 +302,16 @@ DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001) 0x00001000, // Length ,, ) + // Null descriptor (intended to be modified at runtime) must + // have a resource tag (to allow it to be modified at runtime) + DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange, + 0x00000000, // Granularity + 0x00000000, // Range Minimum + 0x00000000, // Range Maximum + 0x00000000, // Translation Offset + 0x00000000, // Length + ,, ) + // Missing StartDependentFn macro EndDependentFn () diff --git a/tools/acpiexec/Makefile b/tools/acpiexec/Makefile index 102c33d5b51c..640d992f2ac8 100644 --- a/tools/acpiexec/Makefile +++ b/tools/acpiexec/Makefile @@ -11,7 +11,7 @@ ACPICA_TOOLS = $(ACPICA_SRC)/tools ACPICA_OSL = $(ACPICA_SRC)/os_specific/service_layers NOMAN= YES -CFLAGS+= -Wall -g -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -D_MULTI_THREADED -Wstrict-prototypes -I$(ACPICA_SRC)/include +CFLAGS+= -Wall -g -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -Wstrict-prototypes -I$(ACPICA_SRC)/include COMPILE = $(CC) -c $(CFLAGS) -o$@ $? LDFLAGS += -lpthread -lrt diff --git a/tools/acpiexec/aemain.c b/tools/acpiexec/aemain.c index 5773a6917e03..a201412c57bd 100644 --- a/tools/acpiexec/aemain.c +++ b/tools/acpiexec/aemain.c @@ -455,9 +455,7 @@ main ( _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG)); #endif - printf ("\nIntel ACPI Component Architecture\nAML Execution/Debug Utility"); - printf (" version %8.8X", ((UINT32) ACPI_CA_VERSION)); - printf (" [%s]\n\n", __DATE__); + printf (ACPI_COMMON_SIGNON ("AML Execution/Debug Utility")); if (argc < 2) { diff --git a/tools/acpiexec/aetables.c b/tools/acpiexec/aetables.c index a2ccdab02ea3..cab974b03e7d 100644 --- a/tools/acpiexec/aetables.c +++ b/tools/acpiexec/aetables.c @@ -1,6 +1,6 @@ /****************************************************************************** * - * Module Name: aetables - Miscellaneous ACPI tables for acpiexec utility + * Module Name: aetables - ACPI table setup/install for acpiexec utility * *****************************************************************************/ @@ -114,6 +114,7 @@ *****************************************************************************/ #include "aecommon.h" +#include "aetables.h" #define _COMPONENT ACPI_TOOLS ACPI_MODULE_NAME ("aetables") @@ -129,149 +130,32 @@ ACPI_PHYSICAL_ADDRESS AeLocalGetRootPointer ( void); -/* - * Misc ACPI tables to be installed - */ - -/* Default DSDT. This will be replaced with the input DSDT */ - -static unsigned char DsdtCode[] = -{ - 0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */ - 0x02,0x6F,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".oIntel." */ - 0x4E,0x75,0x6C,0x6C,0x44,0x53,0x44,0x54, /* 00000010 "NullDSDT" */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x04,0x12,0x08,0x20, -}; - -static unsigned char LocalDsdtCode[] = -{ - 0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */ - 0x02,0x2C,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".,Intel." */ - 0x4C,0x6F,0x63,0x61,0x6C,0x00,0x00,0x00, /* 00000010 "Local..." */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x30,0x07,0x09,0x20, -}; - -/* Several example SSDTs */ +/* User table (DSDT) */ -static unsigned char Ssdt1Code[] = /* Has method _T98 */ -{ - 0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */ - 0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ - 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54, /* 00000020 "$.. .._T" */ - 0x39,0x38,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "98.p..`." */ -}; - -static unsigned char Ssdt2Code[] = /* Has method _T99 */ -{ - 0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */ - 0x01,0xB7,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ - 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54, /* 00000020 "$.. .._T" */ - 0x39,0x39,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "99.p..`." */ -}; - -unsigned char Ssdt3Code[] = /* Has method _T97 */ -{ - 0x54,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "TSDT0..." */ - 0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ - 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54, /* 00000020 "$.. .._T" */ - 0x39,0x37,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "97.p..`." */ -}; +static ACPI_TABLE_HEADER *DsdtToInstallOverride; -/* Example OEM table */ +/* Non-AML tables that are constructed locally and installed */ -static unsigned char Oem1Code[] = -{ - 0x4F,0x45,0x4D,0x31,0x38,0x00,0x00,0x00, /* 00000000 "OEM18..." */ - 0x01,0x4B,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".KIntel." */ - 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ - 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ - 0x18,0x09,0x03,0x20,0x08,0x5F,0x58,0x54, /* 00000020 "... ._XT" */ - 0x32,0x0A,0x04,0x14,0x0C,0x5F,0x58,0x54, /* 00000028 "2...._XT" */ - 0x31,0x00,0x70,0x01,0x5F,0x58,0x54,0x32, /* 00000030 "1.p._XT2" */ -}; - -/* ASL source for this table is at the end of this file */ - -static unsigned char OemxCode[] = -{ - 0x4F,0x45,0x4D,0x58,0xB0,0x00,0x00,0x00, /* 00000000 "OEMX...." */ - 0x02,0x54,0x4D,0x79,0x4F,0x45,0x4D,0x00, /* 00000008 ".TMyOEM." */ - 0x54,0x65,0x73,0x74,0x00,0x00,0x00,0x00, /* 00000010 "Test...." */ - 0x32,0x04,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "2...INTL" */ - 0x31,0x03,0x10,0x20,0x14,0x1D,0x5F,0x49, /* 00000020 "1.. .._I" */ - 0x4E,0x49,0x00,0x70,0x0D,0x54,0x61,0x62, /* 00000028 "NI.p.Tab" */ - 0x6C,0x65,0x20,0x4F,0x45,0x4D,0x58,0x20, /* 00000030 "le OEMX " */ - 0x72,0x75,0x6E,0x6E,0x69,0x6E,0x67,0x00, /* 00000038 "running." */ - 0x5B,0x31,0x10,0x22,0x5C,0x5F,0x47,0x50, /* 00000040 "[1."\_GP" */ - 0x45,0x14,0x06,0x5F,0x45,0x30,0x37,0x00, /* 00000048 "E.._E07." */ - 0x14,0x06,0x5F,0x45,0x32,0x32,0x00,0x14, /* 00000050 ".._E22.." */ - 0x06,0x5F,0x4C,0x33,0x31,0x00,0x14,0x06, /* 00000058 "._L31..." */ - 0x5F,0x4C,0x36,0x36,0x00,0x5B,0x82,0x10, /* 00000060 "_L66.[.." */ - 0x4F,0x45,0x4D,0x31,0x08,0x5F,0x50,0x52, /* 00000068 "OEM1._PR" */ - 0x57,0x12,0x05,0x02,0x0A,0x07,0x00,0x5B, /* 00000070 "W......[" */ - 0x82,0x10,0x4F,0x45,0x4D,0x32,0x08,0x5F, /* 00000078 "..OEM2._" */ - 0x50,0x52,0x57,0x12,0x05,0x02,0x0A,0x66, /* 00000080 "PRW....f" */ - 0x00,0x10,0x26,0x5C,0x47,0x50,0x45,0x32, /* 00000088 "..&\GPE2" */ - 0x14,0x06,0x5F,0x4C,0x30,0x31,0x00,0x14, /* 00000090 ".._L01.." */ - 0x06,0x5F,0x45,0x30,0x37,0x00,0x08,0x5F, /* 00000098 "._E07.._" */ - 0x50,0x52,0x57,0x12,0x0C,0x02,0x12,0x08, /* 000000A0 "PRW....." */ - 0x02,0x5C,0x47,0x50,0x45,0x32,0x01,0x00 /* 000000A8 ".\GPE2.." */ -}; +static ACPI_TABLE_RSDP LocalRSDP; +static ACPI_TABLE_FACS LocalFACS; +static ACPI_TABLE_HEADER LocalTEST; +static ACPI_TABLE_HEADER LocalBADTABLE; /* - * Example installable control method - * - * DefinitionBlock ("", "DSDT", 2, "Intel", "MTHDTEST", 0x20090512) - * { - * Method (\_SI_._T97, 1, Serialized) - * { - * Store ("Example installed method", Debug) - * Store (Arg0, Debug) - * Return () - * } - * } - * - * Compiled byte code below. + * We need a local FADT so that the hardware subcomponent will function, + * even though the underlying OSD HW access functions don't do anything. */ -static unsigned char MethodCode[] = -{ - 0x44,0x53,0x44,0x54,0x53,0x00,0x00,0x00, /* 00000000 "DSDTS..." */ - 0x02,0xF9,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ - 0x4D,0x54,0x48,0x44,0x54,0x45,0x53,0x54, /* 00000010 "MTHDTEST" */ - 0x12,0x05,0x09,0x20,0x49,0x4E,0x54,0x4C, /* 00000018 "... INTL" */ - 0x22,0x04,0x09,0x20,0x14,0x2E,0x2E,0x5F, /* 00000020 "".. ..._" */ - 0x54,0x49,0x5F,0x5F,0x54,0x39,0x37,0x09, /* 00000028 "SI__T97." */ - 0x70,0x0D,0x45,0x78,0x61,0x6D,0x70,0x6C, /* 00000030 "p.Exampl" */ - 0x65,0x20,0x69,0x6E,0x73,0x74,0x61,0x6C, /* 00000038 "e instal" */ - 0x6C,0x65,0x64,0x20,0x6D,0x65,0x74,0x68, /* 00000040 "led meth" */ - 0x6F,0x64,0x00,0x5B,0x31,0x70,0x68,0x5B, /* 00000048 "od.[1ph[" */ - 0x31,0xA4,0x00, -}; - +static ACPI_TABLE_FADT LocalFADT; /* - * We need a local FADT so that the hardware subcomponent will function, - * even though the underlying OSD HW access functions don't do - * anything. + * Use XSDT so that both 32- and 64-bit versions of this utility will + * function automatically. */ -static ACPI_TABLE_HEADER *DsdtToInstallOverride; -static ACPI_TABLE_RSDP LocalRSDP; -static ACPI_TABLE_FADT LocalFADT; -static ACPI_TABLE_FACS LocalFACS; -static ACPI_TABLE_HEADER LocalTEST; -static ACPI_TABLE_HEADER LocalBADTABLE; -static ACPI_TABLE_RSDT *LocalRSDT; +static ACPI_TABLE_XSDT *LocalXSDT; -#define BASE_RSDT_TABLES 7 -#define BASE_RSDT_SIZE (sizeof (ACPI_TABLE_RSDT) + ((BASE_RSDT_TABLES -1) * sizeof (UINT32))) +#define BASE_XSDT_TABLES 7 +#define BASE_XSDT_SIZE (sizeof (ACPI_TABLE_XSDT) + \ + ((BASE_XSDT_TABLES -1) * sizeof (UINT64))) #define ACPI_MAX_INIT_TABLES (32) static ACPI_TABLE_DESC Tables[ACPI_MAX_INIT_TABLES]; @@ -317,7 +201,7 @@ AeTableOverride ( * * RETURN: Status * - * DESCRIPTION: Build a complete ACPI table chain, with a local RSDP, RSDT, + * DESCRIPTION: Build a complete ACPI table chain, with a local RSDP, XSDT, * FADT, and several other test tables. * *****************************************************************************/ @@ -328,14 +212,14 @@ AeBuildLocalTables ( AE_TABLE_DESC *TableList) { ACPI_PHYSICAL_ADDRESS DsdtAddress = 0; - UINT32 RsdtSize; + UINT32 XsdtSize; AE_TABLE_DESC *NextTable; UINT32 NextIndex; ACPI_TABLE_FADT *ExternalFadt = NULL; /* - * Update the table count. For DSDT, it is not put into the RSDT. For + * Update the table count. For DSDT, it is not put into the XSDT. For * FADT, this is already accounted for since we usually install a * local FADT. */ @@ -350,48 +234,49 @@ AeBuildLocalTables ( NextTable = NextTable->Next; } - RsdtSize = BASE_RSDT_SIZE + (TableCount * sizeof (UINT32)); + XsdtSize = BASE_XSDT_SIZE + (TableCount * sizeof (UINT64)); - /* Build an RSDT */ + /* Build an XSDT */ - LocalRSDT = AcpiOsAllocate (RsdtSize); - if (!LocalRSDT) + LocalXSDT = AcpiOsAllocate (XsdtSize); + if (!LocalXSDT) { return (AE_NO_MEMORY); } - ACPI_MEMSET (LocalRSDT, 0, RsdtSize); - ACPI_STRNCPY (LocalRSDT->Header.Signature, ACPI_SIG_RSDT, 4); - LocalRSDT->Header.Length = RsdtSize; + ACPI_MEMSET (LocalXSDT, 0, XsdtSize); + ACPI_STRNCPY (LocalXSDT->Header.Signature, ACPI_SIG_XSDT, 4); + LocalXSDT->Header.Length = XsdtSize; + LocalXSDT->Header.Revision = 1; - LocalRSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalTEST); - LocalRSDT->TableOffsetEntry[1] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE); - LocalRSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (&LocalFADT); + LocalXSDT->TableOffsetEntry[0] = ACPI_PTR_TO_PHYSADDR (&LocalTEST); + LocalXSDT->TableOffsetEntry[1] = ACPI_PTR_TO_PHYSADDR (&LocalBADTABLE); + LocalXSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (&LocalFADT); /* Install two SSDTs to test multiple table support */ - LocalRSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (&Ssdt1Code); - LocalRSDT->TableOffsetEntry[4] = ACPI_PTR_TO_PHYSADDR (&Ssdt2Code); + LocalXSDT->TableOffsetEntry[3] = ACPI_PTR_TO_PHYSADDR (&Ssdt1Code); + LocalXSDT->TableOffsetEntry[4] = ACPI_PTR_TO_PHYSADDR (&Ssdt2Code); /* Install the OEM1 table to test LoadTable */ - LocalRSDT->TableOffsetEntry[5] = ACPI_PTR_TO_PHYSADDR (&Oem1Code); + LocalXSDT->TableOffsetEntry[5] = ACPI_PTR_TO_PHYSADDR (&Oem1Code); /* Install the OEMx table to test LoadTable */ - LocalRSDT->TableOffsetEntry[6] = ACPI_PTR_TO_PHYSADDR (&OemxCode); + LocalXSDT->TableOffsetEntry[6] = ACPI_PTR_TO_PHYSADDR (&OemxCode); /* * Install the user tables. The DSDT must be installed in the FADT. - * All other tables are installed directly into the RSDT. + * All other tables are installed directly into the XSDT. */ - NextIndex = BASE_RSDT_TABLES; + NextIndex = BASE_XSDT_TABLES; NextTable = TableList; while (NextTable) { /* * Incoming DSDT or FADT are special cases. All other tables are - * just immediately installed into the RSDT. + * just immediately installed into the XSDT. */ if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_DSDT)) { @@ -409,13 +294,13 @@ AeBuildLocalTables ( else if (ACPI_COMPARE_NAME (NextTable->Table->Signature, ACPI_SIG_FADT)) { ExternalFadt = ACPI_CAST_PTR (ACPI_TABLE_FADT, NextTable->Table); - LocalRSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); + LocalXSDT->TableOffsetEntry[2] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); } else { - /* Install the table in the RSDT */ + /* Install the table in the XSDT */ - LocalRSDT->TableOffsetEntry[NextIndex] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); + LocalXSDT->TableOffsetEntry[NextIndex] = ACPI_PTR_TO_PHYSADDR (NextTable->Table); NextIndex++; } @@ -427,14 +312,14 @@ AeBuildLocalTables ( ACPI_MEMSET (&LocalRSDP, 0, sizeof (ACPI_TABLE_RSDP)); ACPI_MEMCPY (LocalRSDP.Signature, ACPI_SIG_RSDP, 8); ACPI_MEMCPY (LocalRSDP.OemId, "I_TEST", 6); - LocalRSDP.Revision = 1; - LocalRSDP.RsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalRSDT); - LocalRSDP.Length = sizeof (ACPI_TABLE_RSDT); + LocalRSDP.Revision = 2; + LocalRSDP.XsdtPhysicalAddress = ACPI_PTR_TO_PHYSADDR (LocalXSDT); + LocalRSDP.Length = sizeof (ACPI_TABLE_XSDT); - /* Set checksums for both RSDT and RSDP */ + /* Set checksums for both XSDT and RSDP */ - LocalRSDT->Header.Checksum = (UINT8) -AcpiTbChecksum ( - (void *) LocalRSDT, LocalRSDT->Header.Length); + LocalXSDT->Header.Checksum = (UINT8) -AcpiTbChecksum ( + (void *) LocalXSDT, LocalXSDT->Header.Length); LocalRSDP.Checksum = (UINT8) -AcpiTbChecksum ( (void *) &LocalRSDP, ACPI_RSDP_CHECKSUM_LENGTH); @@ -476,8 +361,8 @@ AeBuildLocalTables ( /* Setup FADT header and DSDT/FACS addresses */ - LocalFADT.Dsdt = DsdtAddress; - LocalFADT.Facs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); + LocalFADT.Dsdt = 0; + LocalFADT.Facs = 0; LocalFADT.XDsdt = DsdtAddress; LocalFADT.XFacs = ACPI_PTR_TO_PHYSADDR (&LocalFACS); @@ -528,8 +413,10 @@ AeBuildLocalTables ( LocalFACS.Length = sizeof (ACPI_TABLE_FACS); LocalFACS.GlobalLock = 0x11AA0011; - /* Build a fake table [TEST] so that we make sure that the CA core ignores it */ - + /* + * Build a fake table [TEST] so that we make sure that the + * ACPICA core ignores it + */ ACPI_MEMSET (&LocalTEST, 0, sizeof (ACPI_TABLE_HEADER)); ACPI_STRNCPY (LocalTEST.Signature, "TEST", 4); @@ -538,8 +425,10 @@ AeBuildLocalTables ( LocalTEST.Checksum = (UINT8) -AcpiTbChecksum ( (void *) &LocalTEST, LocalTEST.Length); - /* Build a fake table with a bad signature [BAD!] so that we make sure that the CA core ignores it */ - + /* + * Build a fake table with a bad signature [BAD!] so that we make + * sure that the ACPICA core ignores it + */ ACPI_MEMSET (&LocalBADTABLE, 0, sizeof (ACPI_TABLE_HEADER)); ACPI_STRNCPY (LocalBADTABLE.Signature, "BAD!", 4); @@ -623,112 +512,3 @@ AeLocalGetRootPointer ( return ((ACPI_PHYSICAL_ADDRESS) &LocalRSDP); } - - -#if 0 -/****************************************************************************** - * - * DESCRIPTION: ASL tables that are used in RSDT/XSDT, also used to test - * Load/LoadTable operators. - * - *****************************************************************************/ - -DefinitionBlock ("", "OEMX", 2, "MyOEM", "Test", 0x00000432) -{ - External (GPE2, DeviceObj) - - Method (_INI) - { - Store ("Table OEMX running", Debug) - } - - Scope (\_GPE) - { - Method (_E07) {} - Method (_E22) {} - Method (_L31) {} - Method (_L66) {} - } - - Device (OEM1) - { - Name (_PRW, Package(){7,0}) - } - Device (OEM2) - { - Name (_PRW, Package(){0x66,0}) - } - - Scope (\GPE2) - { - Method (_L01) {} - Method (_E07) {} - - Name (_PRW, Package() {Package() {\GPE2, 1}, 0}) - } -} - -/* Parent gr.asl file */ - -DefinitionBlock ("", "DSDT", 2, "Intel", "Many", 0x00000001) -{ - Name (BUF1, Buffer() - { - 0x4F,0x45,0x4D,0x58,0xB0,0x00,0x00,0x00, /* 00000000 "OEMX...." */ - 0x02,0x54,0x4D,0x79,0x4F,0x45,0x4D,0x00, /* 00000008 ".TMyOEM." */ - 0x54,0x65,0x73,0x74,0x00,0x00,0x00,0x00, /* 00000010 "Test...." */ - 0x32,0x04,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "2...INTL" */ - 0x31,0x03,0x10,0x20,0x14,0x1D,0x5F,0x49, /* 00000020 "1.. .._I" */ - 0x4E,0x49,0x00,0x70,0x0D,0x54,0x61,0x62, /* 00000028 "NI.p.Tab" */ - 0x6C,0x65,0x20,0x4F,0x45,0x4D,0x58,0x20, /* 00000030 "le OEMX " */ - 0x72,0x75,0x6E,0x6E,0x69,0x6E,0x67,0x00, /* 00000038 "running." */ - 0x5B,0x31,0x10,0x22,0x5C,0x5F,0x47,0x50, /* 00000040 "[1."\_GP" */ - 0x45,0x14,0x06,0x5F,0x45,0x30,0x37,0x00, /* 00000048 "E.._E07." */ - 0x14,0x06,0x5F,0x45,0x32,0x32,0x00,0x14, /* 00000050 ".._E22.." */ - 0x06,0x5F,0x4C,0x33,0x31,0x00,0x14,0x06, /* 00000058 "._L31..." */ - 0x5F,0x4C,0x36,0x36,0x00,0x5B,0x82,0x10, /* 00000060 "_L66.[.." */ - 0x4F,0x45,0x4D,0x31,0x08,0x5F,0x50,0x52, /* 00000068 "OEM1._PR" */ - 0x57,0x12,0x05,0x02,0x0A,0x07,0x00,0x5B, /* 00000070 "W......[" */ - 0x82,0x10,0x4F,0x45,0x4D,0x32,0x08,0x5F, /* 00000078 "..OEM2._" */ - 0x50,0x52,0x57,0x12,0x05,0x02,0x0A,0x66, /* 00000080 "PRW....f" */ - 0x00,0x10,0x26,0x5C,0x47,0x50,0x45,0x32, /* 00000088 "..&\GPE2" */ - 0x14,0x06,0x5F,0x4C,0x30,0x31,0x00,0x14, /* 00000090 ".._L01.." */ - 0x06,0x5F,0x45,0x30,0x37,0x00,0x08,0x5F, /* 00000098 "._E07.._" */ - 0x50,0x52,0x57,0x12,0x0C,0x02,0x12,0x08, /* 000000A0 "PRW....." */ - 0x02,0x5C,0x47,0x50,0x45,0x32,0x01,0x00 /* 000000A8 ".\GPE2.." */ - }) - - Name (HNDL, 0) - Method (LD) - { - Load (BUF1, HNDL) - Store ("Load operator, handle:", Debug) - Store (HNDL, Debug) - } - - Method (MAIN, 0, NotSerialized) - { - Store ("Loading OEMX table", Debug) - Store (LoadTable ("OEMX", "MyOEM", "Test"), Debug) - } - - Scope (\_GPE) - { - Method (_L08) {} - Method (_E08) {} - Method (_L0B) {} - } - - Device (DEV0) - { - Name (_PRW, Package() {0x11, 0}) - } - - Device (\GPE2) - { - Method (_L00) {} - } -} - -#endif - diff --git a/tools/acpiexec/aetables.h b/tools/acpiexec/aetables.h new file mode 100644 index 000000000000..6ccb0343b4d3 --- /dev/null +++ b/tools/acpiexec/aetables.h @@ -0,0 +1,355 @@ +/****************************************************************************** + * + * Module Name: aetables.h - Precompiled AML ACPI tables for acpiexec + * + *****************************************************************************/ + +/****************************************************************************** + * + * 1. Copyright Notice + * + * Some or all of this work - Copyright (c) 1999 - 2010, 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 __AETABLES_H__ +#define __AETABLES_H__ + + +/* + * Miscellaneous pre-compiled AML ACPI tables to be installed + */ + +/* Default DSDT. This will be replaced with the input DSDT */ + +static unsigned char DsdtCode[] = +{ + 0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */ + 0x02,0x6F,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".oIntel." */ + 0x4E,0x75,0x6C,0x6C,0x44,0x53,0x44,0x54, /* 00000010 "NullDSDT" */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x04,0x12,0x08,0x20, +}; + +static unsigned char LocalDsdtCode[] = +{ + 0x44,0x53,0x44,0x54,0x24,0x00,0x00,0x00, /* 00000000 "DSDT$..." */ + 0x02,0x2C,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".,Intel." */ + 0x4C,0x6F,0x63,0x61,0x6C,0x00,0x00,0x00, /* 00000010 "Local..." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x30,0x07,0x09,0x20, +}; + +/* Several example SSDTs */ + +static unsigned char Ssdt1Code[] = /* Has method _T98 */ +{ + 0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */ + 0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ + 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54, /* 00000020 "$.. .._T" */ + 0x39,0x38,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "98.p..`." */ +}; + +static unsigned char Ssdt2Code[] = /* Has method _T99 */ +{ + 0x53,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "SSDT0..." */ + 0x01,0xB7,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ + 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54, /* 00000020 "$.. .._T" */ + 0x39,0x39,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "99.p..`." */ +}; + +unsigned char Ssdt3Code[] = /* Has method _T97 */ +{ + 0x54,0x53,0x44,0x54,0x30,0x00,0x00,0x00, /* 00000000 "TSDT0..." */ + 0x01,0xB8,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ + 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x24,0x04,0x03,0x20,0x14,0x0B,0x5F,0x54, /* 00000020 "$.. .._T" */ + 0x39,0x37,0x00,0x70,0x0A,0x04,0x60,0xA4, /* 00000028 "97.p..`." */ +}; + +/* Example OEM table */ + +static unsigned char Oem1Code[] = +{ + 0x4F,0x45,0x4D,0x31,0x38,0x00,0x00,0x00, /* 00000000 "OEM18..." */ + 0x01,0x4B,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 ".KIntel." */ + 0x4D,0x61,0x6E,0x79,0x00,0x00,0x00,0x00, /* 00000010 "Many...." */ + 0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */ + 0x18,0x09,0x03,0x20,0x08,0x5F,0x58,0x54, /* 00000020 "... ._XT" */ + 0x32,0x0A,0x04,0x14,0x0C,0x5F,0x58,0x54, /* 00000028 "2...._XT" */ + 0x31,0x00,0x70,0x01,0x5F,0x58,0x54,0x32, /* 00000030 "1.p._XT2" */ +}; + +/* ASL source for this table is at the end of this file */ + +static unsigned char OemxCode[] = +{ + 0x4F,0x45,0x4D,0x58,0xB0,0x00,0x00,0x00, /* 00000000 "OEMX...." */ + 0x02,0x54,0x4D,0x79,0x4F,0x45,0x4D,0x00, /* 00000008 ".TMyOEM." */ + 0x54,0x65,0x73,0x74,0x00,0x00,0x00,0x00, /* 00000010 "Test...." */ + 0x32,0x04,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "2...INTL" */ + 0x31,0x03,0x10,0x20,0x14,0x1D,0x5F,0x49, /* 00000020 "1.. .._I" */ + 0x4E,0x49,0x00,0x70,0x0D,0x54,0x61,0x62, /* 00000028 "NI.p.Tab" */ + 0x6C,0x65,0x20,0x4F,0x45,0x4D,0x58,0x20, /* 00000030 "le OEMX " */ + 0x72,0x75,0x6E,0x6E,0x69,0x6E,0x67,0x00, /* 00000038 "running." */ + 0x5B,0x31,0x10,0x22,0x5C,0x5F,0x47,0x50, /* 00000040 "[1."\_GP" */ + 0x45,0x14,0x06,0x5F,0x45,0x30,0x37,0x00, /* 00000048 "E.._E07." */ + 0x14,0x06,0x5F,0x45,0x32,0x32,0x00,0x14, /* 00000050 ".._E22.." */ + 0x06,0x5F,0x4C,0x33,0x31,0x00,0x14,0x06, /* 00000058 "._L31..." */ + 0x5F,0x4C,0x36,0x36,0x00,0x5B,0x82,0x10, /* 00000060 "_L66.[.." */ + 0x4F,0x45,0x4D,0x31,0x08,0x5F,0x50,0x52, /* 00000068 "OEM1._PR" */ + 0x57,0x12,0x05,0x02,0x0A,0x07,0x00,0x5B, /* 00000070 "W......[" */ + 0x82,0x10,0x4F,0x45,0x4D,0x32,0x08,0x5F, /* 00000078 "..OEM2._" */ + 0x50,0x52,0x57,0x12,0x05,0x02,0x0A,0x66, /* 00000080 "PRW....f" */ + 0x00,0x10,0x26,0x5C,0x47,0x50,0x45,0x32, /* 00000088 "..&\GPE2" */ + 0x14,0x06,0x5F,0x4C,0x30,0x31,0x00,0x14, /* 00000090 ".._L01.." */ + 0x06,0x5F,0x45,0x30,0x37,0x00,0x08,0x5F, /* 00000098 "._E07.._" */ + 0x50,0x52,0x57,0x12,0x0C,0x02,0x12,0x08, /* 000000A0 "PRW....." */ + 0x02,0x5C,0x47,0x50,0x45,0x32,0x01,0x00 /* 000000A8 ".\GPE2.." */ +}; + +/* + * Example installable control method + * + * DefinitionBlock ("", "DSDT", 2, "Intel", "MTHDTEST", 0x20090512) + * { + * Method (\_SI_._T97, 1, Serialized) + * { + * Store ("Example installed method", Debug) + * Store (Arg0, Debug) + * Return () + * } + * } + * + * Compiled byte code below. + */ +static unsigned char MethodCode[] = +{ + 0x44,0x53,0x44,0x54,0x53,0x00,0x00,0x00, /* 00000000 "DSDTS..." */ + 0x02,0xF9,0x49,0x6E,0x74,0x65,0x6C,0x00, /* 00000008 "..Intel." */ + 0x4D,0x54,0x48,0x44,0x54,0x45,0x53,0x54, /* 00000010 "MTHDTEST" */ + 0x12,0x05,0x09,0x20,0x49,0x4E,0x54,0x4C, /* 00000018 "... INTL" */ + 0x22,0x04,0x09,0x20,0x14,0x2E,0x2E,0x5F, /* 00000020 "".. ..._" */ + 0x54,0x49,0x5F,0x5F,0x54,0x39,0x37,0x09, /* 00000028 "SI__T97." */ + 0x70,0x0D,0x45,0x78,0x61,0x6D,0x70,0x6C, /* 00000030 "p.Exampl" */ + 0x65,0x20,0x69,0x6E,0x73,0x74,0x61,0x6C, /* 00000038 "e instal" */ + 0x6C,0x65,0x64,0x20,0x6D,0x65,0x74,0x68, /* 00000040 "led meth" */ + 0x6F,0x64,0x00,0x5B,0x31,0x70,0x68,0x5B, /* 00000048 "od.[1ph[" */ + 0x31,0xA4,0x00, +}; + + +#if 0 +/****************************************************************************** + * + * DESCRIPTION: ASL tables that are used in RSDT/XSDT, also used to test + * Load/LoadTable operators. + * + *****************************************************************************/ + +DefinitionBlock ("", "OEMX", 2, "MyOEM", "Test", 0x00000432) +{ + External (GPE2, DeviceObj) + + Method (_INI) + { + Store ("Table OEMX running", Debug) + } + + Scope (\_GPE) + { + Method (_E07) {} + Method (_E22) {} + Method (_L31) {} + Method (_L66) {} + } + + Device (OEM1) + { + Name (_PRW, Package(){7,0}) + } + Device (OEM2) + { + Name (_PRW, Package(){0x66,0}) + } + + Scope (\GPE2) + { + Method (_L01) {} + Method (_E07) {} + + Name (_PRW, Package() {Package() {\GPE2, 1}, 0}) + } +} + +/* Parent gr.asl file */ + +DefinitionBlock ("", "DSDT", 2, "Intel", "Many", 0x00000001) +{ + Name (BUF1, Buffer() + { + 0x4F,0x45,0x4D,0x58,0xB0,0x00,0x00,0x00, /* 00000000 "OEMX...." */ + 0x02,0x54,0x4D,0x79,0x4F,0x45,0x4D,0x00, /* 00000008 ".TMyOEM." */ + 0x54,0x65,0x73,0x74,0x00,0x00,0x00,0x00, /* 00000010 "Test...." */ + 0x32,0x04,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "2...INTL" */ + 0x31,0x03,0x10,0x20,0x14,0x1D,0x5F,0x49, /* 00000020 "1.. .._I" */ + 0x4E,0x49,0x00,0x70,0x0D,0x54,0x61,0x62, /* 00000028 "NI.p.Tab" */ + 0x6C,0x65,0x20,0x4F,0x45,0x4D,0x58,0x20, /* 00000030 "le OEMX " */ + 0x72,0x75,0x6E,0x6E,0x69,0x6E,0x67,0x00, /* 00000038 "running." */ + 0x5B,0x31,0x10,0x22,0x5C,0x5F,0x47,0x50, /* 00000040 "[1."\_GP" */ + 0x45,0x14,0x06,0x5F,0x45,0x30,0x37,0x00, /* 00000048 "E.._E07." */ + 0x14,0x06,0x5F,0x45,0x32,0x32,0x00,0x14, /* 00000050 ".._E22.." */ + 0x06,0x5F,0x4C,0x33,0x31,0x00,0x14,0x06, /* 00000058 "._L31..." */ + 0x5F,0x4C,0x36,0x36,0x00,0x5B,0x82,0x10, /* 00000060 "_L66.[.." */ + 0x4F,0x45,0x4D,0x31,0x08,0x5F,0x50,0x52, /* 00000068 "OEM1._PR" */ + 0x57,0x12,0x05,0x02,0x0A,0x07,0x00,0x5B, /* 00000070 "W......[" */ + 0x82,0x10,0x4F,0x45,0x4D,0x32,0x08,0x5F, /* 00000078 "..OEM2._" */ + 0x50,0x52,0x57,0x12,0x05,0x02,0x0A,0x66, /* 00000080 "PRW....f" */ + 0x00,0x10,0x26,0x5C,0x47,0x50,0x45,0x32, /* 00000088 "..&\GPE2" */ + 0x14,0x06,0x5F,0x4C,0x30,0x31,0x00,0x14, /* 00000090 ".._L01.." */ + 0x06,0x5F,0x45,0x30,0x37,0x00,0x08,0x5F, /* 00000098 "._E07.._" */ + 0x50,0x52,0x57,0x12,0x0C,0x02,0x12,0x08, /* 000000A0 "PRW....." */ + 0x02,0x5C,0x47,0x50,0x45,0x32,0x01,0x00 /* 000000A8 ".\GPE2.." */ + }) + + Name (HNDL, 0) + Method (LD) + { + Load (BUF1, HNDL) + Store ("Load operator, handle:", Debug) + Store (HNDL, Debug) + } + + Method (MAIN, 0, NotSerialized) + { + Store ("Loading OEMX table", Debug) + Store (LoadTable ("OEMX", "MyOEM", "Test"), Debug) + } + + Scope (\_GPE) + { + Method (_L08) {} + Method (_E08) {} + Method (_L0B) {} + } + + Device (DEV0) + { + Name (_PRW, Package() {0x11, 0}) + } + + Device (\GPE2) + { + Method (_L00) {} + } +} + +#endif + +#endif /* __AETABLES_H__ */ diff --git a/tools/acpiexec/osunixdir.c b/tools/acpiexec/osunixdir.c index 897d17340b9f..c3735a6d600e 100644 --- a/tools/acpiexec/osunixdir.c +++ b/tools/acpiexec/osunixdir.c @@ -125,6 +125,9 @@ #include "acpisrc.h" +/* + * Allocated structure returned from OsOpenDirectory + */ typedef struct ExternalFindInfo { char *DirPathname; @@ -193,7 +196,7 @@ AcpiOsOpenDirectory ( * * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory * - * RETURN: Next filename matched. NULL if no more matches. + * RETURN: Next filename matched. NULL if no more matches. * * DESCRIPTION: Get the next file in the directory that matches the wildcard * specification. @@ -217,7 +220,9 @@ AcpiOsGetNextFilename ( if (!fnmatch (ExternalInfo->WildcardSpec, dir_entry->d_name, 0)) { if (dir_entry->d_name[0] == '.') + { continue; + } str_len = strlen (dir_entry->d_name) + strlen (ExternalInfo->DirPathname) + 2; @@ -226,7 +231,7 @@ AcpiOsGetNextFilename ( if (!temp_str) { printf ("Could not allocate buffer for temporary string\n"); - return NULL; + return (NULL); } strcpy (temp_str, ExternalInfo->DirPathname); @@ -238,7 +243,7 @@ AcpiOsGetNextFilename ( if (err == -1) { printf ("stat() error - should not happen\n"); - return NULL; + return (NULL); } if ((S_ISDIR (temp_stat.st_mode) @@ -255,7 +260,7 @@ AcpiOsGetNextFilename ( } } - return NULL; + return (NULL); } @@ -284,10 +289,22 @@ AcpiOsCloseDirectory ( free (DirHandle); } + /* Other functions acpisrc uses but that aren't standard on Unix */ -/* lowercase a string */ -char* +/******************************************************************************* + * + * FUNCTION: strlwr + * + * PARAMETERS: str - String to be lowercased. + * + * RETURN: str. + * + * DESCRIPTION: Lowercase a string in-place. + * + ******************************************************************************/ + +char * strlwr ( char *str) { diff --git a/tools/acpisrc/asmain.c b/tools/acpisrc/asmain.c index 4eaf94b3259b..2d9f97915884 100644 --- a/tools/acpisrc/asmain.c +++ b/tools/acpisrc/asmain.c @@ -372,9 +372,7 @@ main ( UINT32 FileType; - printf ("ACPI Source Code Conversion Utility"); - printf (" version %8.8X", ((UINT32) ACPI_CA_VERSION)); - printf (" [%s]\n\n", __DATE__); + printf (ACPI_COMMON_SIGNON ("ACPI Source Code Conversion Utility")); if (argc < 2) { diff --git a/tools/acpisrc/osunixdir.c b/tools/acpisrc/osunixdir.c index 897d17340b9f..c3735a6d600e 100644 --- a/tools/acpisrc/osunixdir.c +++ b/tools/acpisrc/osunixdir.c @@ -125,6 +125,9 @@ #include "acpisrc.h" +/* + * Allocated structure returned from OsOpenDirectory + */ typedef struct ExternalFindInfo { char *DirPathname; @@ -193,7 +196,7 @@ AcpiOsOpenDirectory ( * * PARAMETERS: DirHandle - Created via AcpiOsOpenDirectory * - * RETURN: Next filename matched. NULL if no more matches. + * RETURN: Next filename matched. NULL if no more matches. * * DESCRIPTION: Get the next file in the directory that matches the wildcard * specification. @@ -217,7 +220,9 @@ AcpiOsGetNextFilename ( if (!fnmatch (ExternalInfo->WildcardSpec, dir_entry->d_name, 0)) { if (dir_entry->d_name[0] == '.') + { continue; + } str_len = strlen (dir_entry->d_name) + strlen (ExternalInfo->DirPathname) + 2; @@ -226,7 +231,7 @@ AcpiOsGetNextFilename ( if (!temp_str) { printf ("Could not allocate buffer for temporary string\n"); - return NULL; + return (NULL); } strcpy (temp_str, ExternalInfo->DirPathname); @@ -238,7 +243,7 @@ AcpiOsGetNextFilename ( if (err == -1) { printf ("stat() error - should not happen\n"); - return NULL; + return (NULL); } if ((S_ISDIR (temp_stat.st_mode) @@ -255,7 +260,7 @@ AcpiOsGetNextFilename ( } } - return NULL; + return (NULL); } @@ -284,10 +289,22 @@ AcpiOsCloseDirectory ( free (DirHandle); } + /* Other functions acpisrc uses but that aren't standard on Unix */ -/* lowercase a string */ -char* +/******************************************************************************* + * + * FUNCTION: strlwr + * + * PARAMETERS: str - String to be lowercased. + * + * RETURN: str. + * + * DESCRIPTION: Lowercase a string in-place. + * + ******************************************************************************/ + +char * strlwr ( char *str) { diff --git a/utilities/utglobal.c b/utilities/utglobal.c index 3f82115bf97e..a7e1baa2e842 100644 --- a/utilities/utglobal.c +++ b/utilities/utglobal.c @@ -244,7 +244,9 @@ ACPI_EXPORT_SYMBOL (AcpiFormatException) * 1) _SB_ is defined to be a device to allow \_SB_._INI to be run * during the initialization sequence. * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to - * perform a Notify() operation on it. + * perform a Notify() operation on it. 09/2010: Changed to type Device. + * This still allows notifies, but does not confuse host code that + * searches for valid ThermalZone objects. */ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = { @@ -252,7 +254,7 @@ const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] = {"_PR_", ACPI_TYPE_LOCAL_SCOPE, NULL}, {"_SB_", ACPI_TYPE_DEVICE, NULL}, {"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL}, - {"_TZ_", ACPI_TYPE_THERMAL, NULL}, + {"_TZ_", ACPI_TYPE_DEVICE, NULL}, {"_REV", ACPI_TYPE_INTEGER, (char *) ACPI_CA_SUPPORT_LEVEL}, {"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME}, {"_GL_", ACPI_TYPE_MUTEX, (char *) 1}, diff --git a/utilities/utids.c b/utilities/utids.c index ee7b19d885c3..4b52fe4341de 100644 --- a/utilities/utids.c +++ b/utilities/utids.c @@ -123,51 +123,6 @@ #define _COMPONENT ACPI_UTILITIES ACPI_MODULE_NAME ("utids") -/* Local prototypes */ - -static void -AcpiUtCopyIdString ( - char *Destination, - char *Source); - - -/******************************************************************************* - * - * FUNCTION: AcpiUtCopyIdString - * - * PARAMETERS: Destination - Where to copy the string - * Source - Source string - * - * RETURN: None - * - * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods. - * Performs removal of a leading asterisk if present -- workaround - * for a known issue on a bunch of machines. - * - ******************************************************************************/ - -static void -AcpiUtCopyIdString ( - char *Destination, - char *Source) -{ - - /* - * Workaround for ID strings that have a leading asterisk. This construct - * is not allowed by the ACPI specification (ID strings must be - * alphanumeric), but enough existing machines have this embedded in their - * ID strings that the following code is useful. - */ - if (*Source == '*') - { - Source++; - } - - /* Do the actual copy */ - - ACPI_STRCPY (Destination, Source); -} - /******************************************************************************* * @@ -240,7 +195,7 @@ AcpiUtExecute_HID ( } else { - AcpiUtCopyIdString (Hid->String, ObjDesc->String.Pointer); + ACPI_STRCPY (Hid->String, ObjDesc->String.Pointer); } Hid->Length = Length; @@ -327,7 +282,7 @@ AcpiUtExecute_UID ( } else { - AcpiUtCopyIdString (Uid->String, ObjDesc->String.Pointer); + ACPI_STRCPY (Uid->String, ObjDesc->String.Pointer); } Uid->Length = Length; @@ -471,7 +426,7 @@ AcpiUtExecute_CID ( { /* Copy the String CID from the returned object */ - AcpiUtCopyIdString (NextIdString, CidObjects[i]->String.Pointer); + ACPI_STRCPY (NextIdString, CidObjects[i]->String.Pointer); Length = CidObjects[i]->String.Length + 1; } diff --git a/utilities/utosi.c b/utilities/utosi.c index 4e694608a6e1..26d143260a65 100644 --- a/utilities/utosi.c +++ b/utilities/utosi.c @@ -147,6 +147,7 @@ static ACPI_INTERFACE_INFO AcpiDefaultSupportedInterfaces[] = {"Windows 2006", NULL, 0, ACPI_OSI_WIN_VISTA}, /* Windows Vista - Added 03/2006 */ {"Windows 2006.1", NULL, 0, ACPI_OSI_WINSRV_2008}, /* Windows Server 2008 - Added 09/2009 */ {"Windows 2006 SP1", NULL, 0, ACPI_OSI_WIN_VISTA_SP1}, /* Windows Vista SP1 - Added 09/2009 */ + {"Windows 2006 SP2", NULL, 0, ACPI_OSI_WIN_VISTA_SP2}, /* Windows Vista SP2 - Added 09/2010 */ {"Windows 2009", NULL, 0, ACPI_OSI_WIN_7}, /* Windows 7 and Server 2008 R2 - Added 09/2009 */ /* Feature Group Strings */ |