diff --git a/changes.txt b/changes.txt index a0a5931dfafd..4a8bb6b25be3 100644 --- a/changes.txt +++ b/changes.txt @@ -1,3 +1,78 @@ +---------------------------------------- +15 November 2013. Summary of changes for version 20131115: + +This release is available at https://acpica.org/downloads + + +1) ACPICA kernel-resident subsystem: + +Resource Manager: Fixed loop termination for the "get AML length" +function. The loop previously had an error termination on a NULL resource +pointer, which can never happen since the loop simply increments a valid +resource pointer. This fix changes the loop to terminate with an error on +an invalid end-of-buffer condition. The problem can be seen as an +infinite loop by callers to AcpiSetCurrentResources with an invalid or +corrupted resource descriptor, or a resource descriptor that is missing +an END_TAG descriptor. Reported by Dan Carpenter +. Lv Zheng, Bob Moore. + +Table unload and ACPICA termination: Delete all attached data objects +during namespace node deletion. This fix updates namespace node deletion +to delete the entire list of attached objects (attached via +AcpiAttachObject) instead of just one of the attached items. ACPICA BZ +1024. Tomasz Nowicki (tomasz.nowicki@linaro.org). + +ACPICA termination: Added support to delete all objects attached to the +root namespace node. This fix deletes any and all objects that have been +attached to the root node via AcpiAttachData. Previously, none of these +objects were deleted. Reported by Tomasz Nowicki. ACPICA BZ 1026. + +Debug output: Do not emit the function nesting level for the in-kernel +build. The nesting level is really only useful during a single-thread +execution. Therefore, only enable this output for the AcpiExec utility. +Also, only emit the thread ID when executing under AcpiExec (Context +switches are still always detected and a message is emitted). ACPICA BZ +972. + +Example Code and Data Size: These are the sizes for the OS-independent +acpica.lib produced by the Microsoft Visual C++ 9.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. + + Current Release: + Non-Debug Version: 95.9K Code, 27.0K Data, 122.9K Total + Debug Version: 185.1K Code, 77.2K Data, 262.3K Total + Previous Release: + Non-Debug Version: 95.8K Code, 27.0K Data, 122.8K Total + Debug Version: 185.2K Code, 77.2K Data, 262.4K Total + + +2) iASL Compiler/Disassembler and Tools: + +AcpiExec/Unix-OSL: Use instead of . This is the +correct portable POSIX header for terminal control functions. + +Disassembler: Fixed control method invocation issues related to the use +of the CondRefOf() operator. The problem is seen in the disassembly where +control method invocations may not be disassembled properly if the +control method name has been used previously as an argument to CondRefOf. +The solution is to not attempt to emit an external declaration for the +CondRefOf target (it is not necessary in the first place). This prevents +disassembler object type confusion. ACPICA BZ 988. + +Unix Makefiles: Added an option to disable compiler optimizations and the +_FORTIFY_SOURCE flag. Some older compilers have problems compiling ACPICA +with optimizations (reportedly, gcc 4.4 for example). This change adds a +command line option for make (NOOPT) that disables all compiler +optimizations and the _FORTIFY_SOURCE compiler flag. The default +optimization is -O2 with the _FORTIFY_SOURCE flag specified. ACPICA BZ +1034. Lv Zheng, Bob Moore. + +Tests/ASLTS: Added options to specify individual test cases and modes. +This allows testers running aslts.sh to optionally specify individual +test modes and test cases. Also added an option to disable the forced +generation of the ACPICA tools from source if desired. Lv Zheng. + ---------------------------------------- 27 September 2013. Summary of changes for version 20130927: @@ -7,8 +82,10 @@ This release is available at https://acpica.org/downloads 1) ACPICA kernel-resident subsystem: Fixed a problem with store operations to reference objects. This change -fixes a problem where a Store operation to an ArgX object that contained a -reference to a field object did not complete the automatic dereference and +fixes a problem where a Store operation to an ArgX object that contained +a +reference to a field object did not complete the automatic dereference +and then write to the actual field object. Instead, the object type of the field object was inadvertently changed to match the type of the source operand. The new behavior will actually write to the field object (buffer @@ -26,10 +103,12 @@ Hardcoded the access width for the FADT-defined reset register. The ACPI specification requires the reset register width to be 8 bits. ACPICA now hardcodes the width to 8 and ignores the FADT width value. This provides compatibility with other ACPI implementations that have allowed BIOS code -with bad register width values to go unnoticed. Matthew Garett, Bob Moore, +with bad register width values to go unnoticed. Matthew Garett, Bob +Moore, Lv Zheng. -Changed the position/use of the ACPI_PRINTF_LIKE macro. This macro is used +Changed the position/use of the ACPI_PRINTF_LIKE macro. This macro is +used in the OSL header (acpiosxf). The change modifies the position of this macro in each instance where it is used (AcpiDebugPrint, etc.) to avoid build issues if the OSL defines the implementation of the interface to be @@ -42,12 +121,14 @@ additional or different processing for these functions. Changed from ACPI_EXPORT_SYMBOL to ACPI_EXPORT_SYMBOL_INIT for these functions. Lv Zheng, Bob Moore. -Cleaned up the memory allocation macros for configurability. In the common +Cleaned up the memory allocation macros for configurability. In the +common case, the ACPI_ALLOCATE and related macros now resolve directly to their respective AcpiOs* OSL interfaces. Two options: 1) The ACPI_ALLOCATE_ZEROED macro uses a simple local implementation by default, unless overridden by the USE_NATIVE_ALLOCATE_ZEROED define. -2) For AcpiExec (and for debugging), the macros can optionally be resolved +2) For AcpiExec (and for debugging), the macros can optionally be +resolved to the local ACPICA interfaces that track each allocation (local tracking is used to immediately detect memory leaks). Lv Zheng. @@ -73,7 +154,8 @@ has a much larger code and data size. 2) iASL Compiler/Disassembler and Tools: iASL: Implemented wildcard support for the -e option. This simplifies use -when there are many SSDTs that must be included to resolve external method +when there are many SSDTs that must be included to resolve external +method declarations. ACPICA BZ 1041. Example: iasl -e ssdt*.dat -d dsdt.dat @@ -81,7 +163,8 @@ AcpiExec: Add history/line-editing for Unix/Linux systems. This change adds a portable module that implements full history and limited line editing for Unix and Linux systems. It does not use readline() due to portability issues. Instead it uses the POSIX termio interface to put the -terminal in raw input mode so that the various special keys can be trapped +terminal in raw input mode so that the various special keys can be +trapped (such as up/down-arrow for history support and left/right-arrow for line editing). Uses the existing debugger history mechanism. ACPICA BZ 1036. diff --git a/generate/unix/Makefile.config b/generate/unix/Makefile.config index dc9fcaea91d6..3a5273561128 100644 --- a/generate/unix/Makefile.config +++ b/generate/unix/Makefile.config @@ -118,15 +118,17 @@ ACPICA_HEADERS = \ # # Common compiler flags +# The _GNU_SOURCE symbol is required for many hosts. # -# Flags/option notes: -# Global optimization flags (such as -O2, -Os) are not used, -# since they cause issues on some compilers (such as gcc 4.4) -# The _GNU_SOURCE symbol is required for many hosts. +OPT_CFLAGS ?= $(CWARNINGFLAGS) + # -OPT_CFLAGS ?= \ - -D_FORTIFY_SOURCE=2\ - $(CWARNINGFLAGS) +# Optionally disable optimizations. Optimization causes problems on +# some compilers such as gcc 4.4 +# +ifneq ($(NOOPT),TRUE) +OPT_CFLAGS += -O2 -D_FORTIFY_SOURCE=2 +endif CFLAGS += \ -D$(HOST)\ diff --git a/generate/unix/acpiexec/Makefile b/generate/unix/acpiexec/Makefile index 278287b286a1..1625978bf83e 100644 --- a/generate/unix/acpiexec/Makefile +++ b/generate/unix/acpiexec/Makefile @@ -224,6 +224,11 @@ CFLAGS += \ -DACPI_EXEC_APP\ -I$(ACPIEXEC) +ifeq ($(ASLTS),TRUE) +CFLAGS += \ + -DACPI_CHECKSUM_ABORT=TRUE +endif + LDFLAGS += -lpthread ifneq ($(HOST),_APPLE) diff --git a/source/common/adfile.c b/source/common/adfile.c index 48ff89fc841e..dd5abee39849 100644 --- a/source/common/adfile.c +++ b/source/common/adfile.c @@ -329,6 +329,7 @@ FlSplitInputPathname ( if (!Filename) { + ACPI_FREE (DirectoryPath); return (AE_NO_MEMORY); } @@ -337,6 +338,9 @@ FlSplitInputPathname ( if (OutFilename) { *OutFilename = Filename; + return (AE_OK); } + + ACPI_FREE (Filename); return (AE_OK); } diff --git a/source/common/adwalk.c b/source/common/adwalk.c index 2fb42fdadc0c..5b048599ec7b 100644 --- a/source/common/adwalk.c +++ b/source/common/adwalk.c @@ -820,17 +820,18 @@ AcpiDmXrefDescendingOp ( { if (Status == AE_NOT_FOUND) { - AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType, 0); - /* - * We could install this into the namespace, but we catch duplicate - * externals when they are added to the list. + * Add this symbol as an external declaration, except if the + * parent is a CondRefOf operator. For this operator, we do not + * need an external, nor do we want one, since this can cause + * disassembly problems if the symbol is actually a control + * method. */ -#if 0 - Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY, - ACPI_IMODE_LOAD_PASS1, ACPI_NS_DONT_OPEN_SCOPE, - WalkState, &Node); -#endif + if (!(Op->Asl.Parent && + (Op->Asl.Parent->Asl.AmlOpcode == AML_COND_REF_OF_OP))) + { + AcpiDmAddToExternalList (Op, Path, (UINT8) ObjectType, 0); + } } } diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index be35763cd469..7a417155f09a 100644 --- a/source/components/debugger/dbcmds.c +++ b/source/components/debugger/dbcmds.c @@ -830,7 +830,7 @@ AcpiDmTestResourceConversion ( /* Convert internal resource list to external AML resource template */ - Status = AcpiRsCreateAmlResources (ResourceBuffer.Pointer, &NewAml); + Status = AcpiRsCreateAmlResources (&ResourceBuffer, &NewAml); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n", @@ -842,8 +842,8 @@ AcpiDmTestResourceConversion ( OriginalAml = ReturnBuffer.Pointer; - AcpiDmCompareAmlResources ( - OriginalAml->Buffer.Pointer, (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length, + AcpiDmCompareAmlResources (OriginalAml->Buffer.Pointer, + (ACPI_RSDESC_SIZE) OriginalAml->Buffer.Length, NewAml.Pointer, (ACPI_RSDESC_SIZE) NewAml.Length); /* Cleanup and exit */ @@ -1042,7 +1042,7 @@ AcpiDbDeviceResources ( } EndCrs: - ACPI_FREE_BUFFER (ReturnBuffer); + ACPI_FREE (ReturnBuffer.Pointer); } diff --git a/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c index 09b42f5604aa..38ce8fce6095 100644 --- a/source/components/namespace/nsalloc.c +++ b/source/components/namespace/nsalloc.c @@ -121,6 +121,7 @@ AcpiNsDeleteNode ( ACPI_NAMESPACE_NODE *Node) { ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_OPERAND_OBJECT *NextDesc; ACPI_FUNCTION_NAME (NsDeleteNode); @@ -131,12 +132,13 @@ AcpiNsDeleteNode ( AcpiNsDetachObject (Node); /* - * Delete an attached data object if present (an object that was created - * and attached via AcpiAttachData). Note: After any normal object is - * detached above, the only possible remaining object is a data object. + * Delete an attached data object list if present (objects that were + * attached via AcpiAttachData). Note: After any normal object is + * detached above, the only possible remaining object(s) are data + * objects, in a linked list. */ ObjDesc = Node->Object; - if (ObjDesc && + while (ObjDesc && (ObjDesc->Common.Type == ACPI_TYPE_LOCAL_DATA)) { /* Invoke the attached data deletion handler if present */ @@ -146,7 +148,16 @@ AcpiNsDeleteNode ( ObjDesc->Data.Handler (Node, ObjDesc->Data.Pointer); } + NextDesc = ObjDesc->Common.NextObject; AcpiUtRemoveReference (ObjDesc); + ObjDesc = NextDesc; + } + + /* Special case for the statically allocated root node */ + + if (Node == AcpiGbl_RootNode) + { + return; } /* Now we can delete the node */ diff --git a/source/components/namespace/nsutils.c b/source/components/namespace/nsutils.c index f2cf74f651ff..ccecd6d5e07b 100644 --- a/source/components/namespace/nsutils.c +++ b/source/components/namespace/nsutils.c @@ -693,27 +693,29 @@ void AcpiNsTerminate ( void) { - ACPI_OPERAND_OBJECT *ObjDesc; + ACPI_STATUS Status; ACPI_FUNCTION_TRACE (NsTerminate); /* - * 1) Free the entire namespace -- all nodes and objects - * - * Delete all object descriptors attached to namepsace nodes + * Free the entire namespace -- all nodes and all objects + * attached to the nodes */ AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode); - /* Detach any objects attached to the root */ + /* Delete any objects attached to the root node */ - ObjDesc = AcpiNsGetAttachedObject (AcpiGbl_RootNode); - if (ObjDesc) + Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE (Status)) { - AcpiNsDetachObject (AcpiGbl_RootNode); + return_VOID; } + AcpiNsDeleteNode (AcpiGbl_RootNode); + (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n")); return_VOID; } diff --git a/source/components/resources/rscalc.c b/source/components/resources/rscalc.c index a6e8b3854c73..a5a8e5a67cc7 100644 --- a/source/components/resources/rscalc.c +++ b/source/components/resources/rscalc.c @@ -197,6 +197,7 @@ AcpiRsStreamOptionLength ( * FUNCTION: AcpiRsGetAmlLength * * PARAMETERS: Resource - Pointer to the resource linked list + * ResourceListSize - Size of the resource linked list * SizeNeeded - Where the required size is returned * * RETURN: Status @@ -210,9 +211,11 @@ AcpiRsStreamOptionLength ( ACPI_STATUS AcpiRsGetAmlLength ( ACPI_RESOURCE *Resource, + ACPI_SIZE ResourceListSize, ACPI_SIZE *SizeNeeded) { ACPI_SIZE AmlSizeNeeded = 0; + ACPI_RESOURCE *ResourceEnd; ACPI_RS_LENGTH TotalSize; @@ -221,7 +224,8 @@ AcpiRsGetAmlLength ( /* Traverse entire list of internal resource descriptors */ - while (Resource) + ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, ResourceListSize); + while (Resource < ResourceEnd) { /* Validate the descriptor type */ diff --git a/source/components/resources/rscreate.c b/source/components/resources/rscreate.c index 209b50312f32..fa6b4aa0a2ab 100644 --- a/source/components/resources/rscreate.c +++ b/source/components/resources/rscreate.c @@ -435,23 +435,22 @@ AcpiRsCreatePciRoutingTable ( * * FUNCTION: AcpiRsCreateAmlResources * - * PARAMETERS: LinkedListBuffer - Pointer to the resource linked list - * OutputBuffer - Pointer to the user's buffer + * PARAMETERS: ResourceList - Pointer to the resource list buffer + * OutputBuffer - Where the AML buffer is returned * * RETURN: Status AE_OK if okay, else a valid ACPI_STATUS code. * If the OutputBuffer is too small, the error will be * AE_BUFFER_OVERFLOW and OutputBuffer->Length will point * to the size buffer needed. * - * DESCRIPTION: Takes the linked list of device resources and - * creates a bytestream to be used as input for the - * _SRS control method. + * DESCRIPTION: Converts a list of device resources to an AML bytestream + * to be used as input for the _SRS control method. * ******************************************************************************/ ACPI_STATUS AcpiRsCreateAmlResources ( - ACPI_RESOURCE *LinkedListBuffer, + ACPI_BUFFER *ResourceList, ACPI_BUFFER *OutputBuffer) { ACPI_STATUS Status; @@ -461,17 +460,15 @@ AcpiRsCreateAmlResources ( ACPI_FUNCTION_TRACE (RsCreateAmlResources); - ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n", - LinkedListBuffer)); + /* Params already validated, no need to re-validate here */ - /* - * Params already validated, so we don't re-validate here - * - * Pass the LinkedListBuffer into a module that calculates - * the buffer size needed for the byte stream. - */ - Status = AcpiRsGetAmlLength (LinkedListBuffer, - &AmlSizeNeeded); + ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ResourceList Buffer = %p\n", + ResourceList->Pointer)); + + /* Get the buffer size needed for the AML byte stream */ + + Status = AcpiRsGetAmlLength (ResourceList->Pointer, + ResourceList->Length, &AmlSizeNeeded); ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n", (UINT32) AmlSizeNeeded, AcpiFormatException (Status))); @@ -490,14 +487,14 @@ AcpiRsCreateAmlResources ( /* Do the conversion */ - Status = AcpiRsConvertResourcesToAml (LinkedListBuffer, AmlSizeNeeded, - OutputBuffer->Pointer); + Status = AcpiRsConvertResourcesToAml (ResourceList->Pointer, + AmlSizeNeeded, OutputBuffer->Pointer); if (ACPI_FAILURE (Status)) { return_ACPI_STATUS (Status); } ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "OutputBuffer %p Length %X\n", - OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); + OutputBuffer->Pointer, (UINT32) OutputBuffer->Length)); return_ACPI_STATUS (AE_OK); } diff --git a/source/components/resources/rsutils.c b/source/components/resources/rsutils.c index 04591d929e8d..eb0d93cb97ec 100644 --- a/source/components/resources/rsutils.c +++ b/source/components/resources/rsutils.c @@ -827,7 +827,7 @@ AcpiRsSetSrsMethodData ( * Convert the linked list into a byte stream */ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER; - Status = AcpiRsCreateAmlResources (InBuffer->Pointer, &Buffer); + Status = AcpiRsCreateAmlResources (InBuffer, &Buffer); if (ACPI_FAILURE (Status)) { goto Cleanup; diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c index ab162360adf7..87dbf5386685 100644 --- a/source/components/utilities/utdebug.c +++ b/source/components/utilities/utdebug.c @@ -211,6 +211,7 @@ AcpiDebugPrint ( } AcpiGbl_PrevThreadId = ThreadId; + AcpiGbl_NestingLevel = 0; } /* @@ -219,13 +220,22 @@ AcpiDebugPrint ( */ AcpiOsPrintf ("%9s-%04ld ", ModuleName, LineNumber); +#ifdef ACPI_EXEC_APP + /* + * For AcpiExec only, emit the thread ID and nesting level. + * Note: nesting level is really only useful during a single-thread + * execution. Otherwise, multiple threads will keep resetting the + * level. + */ if (ACPI_LV_THREADS & AcpiDbgLevel) { AcpiOsPrintf ("[%u] ", (UINT32) ThreadId); } - AcpiOsPrintf ("[%02ld] %-22.22s: ", - AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName)); + AcpiOsPrintf ("[%02ld] ", AcpiGbl_NestingLevel); +#endif + + AcpiOsPrintf ("%-22.22s: ", AcpiUtTrimFunctionName (FunctionName)); va_start (args, Format); AcpiOsVprintf (Format, args); @@ -475,7 +485,10 @@ AcpiUtExit ( "%s\n", AcpiGbl_FnExitStr); } - AcpiGbl_NestingLevel--; + if (AcpiGbl_NestingLevel) + { + AcpiGbl_NestingLevel--; + } } ACPI_EXPORT_SYMBOL (AcpiUtExit) @@ -527,7 +540,10 @@ AcpiUtStatusExit ( } } - AcpiGbl_NestingLevel--; + if (AcpiGbl_NestingLevel) + { + AcpiGbl_NestingLevel--; + } } ACPI_EXPORT_SYMBOL (AcpiUtStatusExit) @@ -569,7 +585,10 @@ AcpiUtValueExit ( ACPI_FORMAT_UINT64 (Value)); } - AcpiGbl_NestingLevel--; + if (AcpiGbl_NestingLevel) + { + AcpiGbl_NestingLevel--; + } } ACPI_EXPORT_SYMBOL (AcpiUtValueExit) @@ -610,7 +629,10 @@ AcpiUtPtrExit ( "%s %p\n", AcpiGbl_FnExitStr, Ptr); } - AcpiGbl_NestingLevel--; + if (AcpiGbl_NestingLevel) + { + AcpiGbl_NestingLevel--; + } } #endif diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c index 3087d671bf67..a093ec69df47 100644 --- a/source/components/utilities/utxface.c +++ b/source/components/utilities/utxface.c @@ -43,6 +43,7 @@ #define __UTXFACE_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" diff --git a/source/components/utilities/utxfinit.c b/source/components/utilities/utxfinit.c index a9d9251ae9b6..b395c15135f5 100644 --- a/source/components/utilities/utxfinit.c +++ b/source/components/utilities/utxfinit.c @@ -43,6 +43,7 @@ #define __UTXFINIT_C__ +#define EXPORT_ACPI_INTERFACES #include "acpi.h" #include "accommon.h" diff --git a/source/include/acconfig.h b/source/include/acconfig.h index 48f220b51391..48464457450f 100644 --- a/source/include/acconfig.h +++ b/source/include/acconfig.h @@ -84,7 +84,9 @@ * Should the subsystem abort the loading of an ACPI table if the * table checksum is incorrect? */ +#ifndef ACPI_CHECKSUM_ABORT #define ACPI_CHECKSUM_ABORT FALSE +#endif /* * Generate a version of ACPICA that only supports "reduced hardware" diff --git a/source/include/acpixf.h b/source/include/acpixf.h index cba3e569f4a8..15273ad45d98 100644 --- a/source/include/acpixf.h +++ b/source/include/acpixf.h @@ -47,7 +47,7 @@ /* Current ACPICA subsystem version in YYYYMMDD format */ -#define ACPI_CA_VERSION 0x20130927 +#define ACPI_CA_VERSION 0x20131115 #include "acconfig.h" #include "actypes.h" diff --git a/source/include/acresrc.h b/source/include/acresrc.h index dbe90df56e1f..98f650b7b92c 100644 --- a/source/include/acresrc.h +++ b/source/include/acresrc.h @@ -197,7 +197,7 @@ AcpiRsCreateResourceList ( ACPI_STATUS AcpiRsCreateAmlResources ( - ACPI_RESOURCE *LinkedListBuffer, + ACPI_BUFFER *ResourceList, ACPI_BUFFER *OutputBuffer); ACPI_STATUS @@ -251,7 +251,8 @@ AcpiRsGetListLength ( ACPI_STATUS AcpiRsGetAmlLength ( - ACPI_RESOURCE *LinkedListBuffer, + ACPI_RESOURCE *ResourceList, + ACPI_SIZE ResourceListSize, ACPI_SIZE *SizeNeeded); ACPI_STATUS diff --git a/source/include/platform/aclinux.h b/source/include/platform/aclinux.h index b6a7e1791f38..f56aff1e4ed5 100644 --- a/source/include/platform/aclinux.h +++ b/source/include/platform/aclinux.h @@ -58,11 +58,13 @@ #include #include #include -#include -#include +#include #include #include -#include +#ifdef EXPORT_ACPI_INTERFACES +#include +#endif +#include /* Host-dependent types and defines for in-kernel ACPICA */ @@ -85,7 +87,7 @@ /* Host-dependent types and defines for user-space ACPICA */ #define ACPI_FLUSH_CPU_CACHE() -#define ACPI_CAST_PTHREAD_T(pthread) ((ACPI_THREAD_ID) (pthread)) +#define ACPI_CAST_PTHREAD_T(Pthread) ((ACPI_THREAD_ID) (Pthread)) #if defined(__ia64__) || defined(__x86_64__) || defined(__aarch64__) #define ACPI_MACHINE_WIDTH 64 @@ -110,24 +112,31 @@ #ifdef __KERNEL__ + +/* + * FIXME: Inclusion of actypes.h + * Linux kernel need this before defining inline OSL interfaces as + * actypes.h need to be included to find ACPICA type definitions. + * Since from ACPICA's perspective, the actypes.h should be included after + * acenv.h (aclinux.h), this leads to a inclusion mis-ordering issue. + */ #include +/* + * Overrides for in-kernel ACPICA + */ ACPI_STATUS __init AcpiOsInitialize ( void); -#define ACPI_USE_NATIVE_DECLARED_AcpiOsInitialize +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsInitialize -ACPI_STATUS __exit AcpiOsTerminate ( +ACPI_STATUS AcpiOsTerminate ( void); -#define ACPI_USE_NATIVE_DECLARED_AcpiOsTerminate +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsTerminate /* * Memory allocation/deallocation */ -/* Use native linux version of acpi_os_allocate_zeroed */ - -#define USE_NATIVE_ALLOCATE_ZEROED - /* * The irqs_disabled() check is for resume from RAM. * Interrupts are off during resume, just like they are for boot. @@ -140,7 +149,9 @@ AcpiOsAllocate ( { return kmalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); } -#define ACPI_USE_NATIVE_DECLARED_AcpiOsAllocate +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocate + +/* Use native linux version of AcpiOsAllocateZeroed */ static inline void * AcpiOsAllocateZeroed ( @@ -148,7 +159,8 @@ AcpiOsAllocateZeroed ( { return kzalloc (Size, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); } -#define ACPI_USE_NATIVE_DECLARED_AcpiOsAllocateZeroed +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAllocateZeroed +#define USE_NATIVE_ALLOCATE_ZEROED static inline void AcpiOsFree ( @@ -156,7 +168,7 @@ AcpiOsFree ( { kfree (Memory); } -#define ACPI_USE_NATIVE_DECLARED_AcpiOsFree +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsFree static inline void * AcpiOsAcquireObject ( @@ -165,20 +177,18 @@ AcpiOsAcquireObject ( return kmem_cache_zalloc (Cache, irqs_disabled () ? GFP_ATOMIC : GFP_KERNEL); } -#define ACPI_USE_NATIVE_DECLARED_AcpiOsAcquireObject +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsAcquireObject -/* - * Overrides for in-kernel ACPICA - */ static inline ACPI_THREAD_ID AcpiOsGetThreadId ( void) { return (ACPI_THREAD_ID) (unsigned long) current; } -#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetThreadId +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetThreadId #ifndef CONFIG_PREEMPT + /* * Used within ACPICA to show where it is safe to preempt execution * when CONFIG_PREEMPT=n @@ -188,6 +198,7 @@ AcpiOsGetThreadId ( if (!irqs_disabled()) \ cond_resched(); \ } while (0) + #endif /* @@ -198,47 +209,66 @@ AcpiOsGetThreadId ( * prevents lockdep from reporting false positives for ACPICA locks. */ #define AcpiOsCreateLock(__Handle) \ -({ \ - spinlock_t *Lock = ACPI_ALLOCATE(sizeof(*Lock)); \ - if (Lock) { \ - *(__Handle) = Lock; \ - spin_lock_init(*(__Handle)); \ - } \ - Lock ? AE_OK : AE_NO_MEMORY; \ -}) -#define ACPI_USE_NATIVE_DECLARED_AcpiOsCreateLock + ({ \ + spinlock_t *Lock = ACPI_ALLOCATE(sizeof(*Lock)); \ + if (Lock) { \ + *(__Handle) = Lock; \ + spin_lock_init(*(__Handle)); \ + } \ + Lock ? AE_OK : AE_NO_MEMORY; \ + }) +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCreateLock void __iomem * AcpiOsMapMemory ( ACPI_PHYSICAL_ADDRESS Where, ACPI_SIZE Length); -#define ACPI_USE_NATIVE_DECLARED_AcpiOsMapMemory +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsMapMemory void AcpiOsUnmapMemory ( void __iomem *LogicalAddress, ACPI_SIZE Size); -#define ACPI_USE_NATIVE_DECLARED_AcpiOsUnmapMemory +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsUnmapMemory -/* OSL interfaces used by debugger/disassembler */ -#define ACPI_USE_NATIVE_DECLARED_AcpiOsReadable -#define ACPI_USE_NATIVE_DECLARED_AcpiOsWritable +/* + * OSL interfaces used by debugger/disassembler + */ +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsReadable +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsWritable -/* OSL interfaces used by utilities */ -#define ACPI_USE_NATIVE_DECLARED_AcpiOsRedirectOutput -#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetLine -#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetTableByName -#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetTableByIndex -#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetTableByAddress -#define ACPI_USE_NATIVE_DECLARED_AcpiOsOpenDirectory -#define ACPI_USE_NATIVE_DECLARED_AcpiOsGetNextFilename -#define ACPI_USE_NATIVE_DECLARED_AcpiOsCloseDirectory +/* + * OSL interfaces used by utilities + */ +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsRedirectOutput +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetLine +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByName +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByIndex +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetTableByAddress +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsOpenDirectory +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsGetNextFilename +#define ACPI_USE_ALTERNATE_PROTOTYPE_AcpiOsCloseDirectory -/* OSL interfaces added by Linux */ +/* + * OSL interfaces added by Linux + */ +void +EarlyAcpiOsUnmapMemory ( + void __iomem *Virt, + ACPI_SIZE Size); -#ifdef EXPORT_ACPI_INTERFACES -#include -#endif +void +AcpiOsGpeCount ( + UINT32 GpeNumber); + +void +AcpiOsFixedEventCount ( + UINT32 FixedEventNumber); + +ACPI_STATUS +AcpiOsHotplugExecute ( + ACPI_OSD_EXEC_CALLBACK Function, + void *Context); #endif /* __KERNEL__ */ diff --git a/source/os_specific/service_layers/osunixxf.c b/source/os_specific/service_layers/osunixxf.c index fee51a610726..74c4c242395a 100644 --- a/source/os_specific/service_layers/osunixxf.c +++ b/source/os_specific/service_layers/osunixxf.c @@ -91,7 +91,7 @@ typedef void* (*PTHREAD_CALLBACK) (void *); /* Terminal support for AcpiExec only */ #ifdef ACPI_EXEC_APP -#include +#include struct termios OriginalTermAttributes; diff --git a/source/tools/acpiexec/aehandlers.c b/source/tools/acpiexec/aehandlers.c index aad27056a301..24474140f528 100644 --- a/source/tools/acpiexec/aehandlers.c +++ b/source/tools/acpiexec/aehandlers.c @@ -98,6 +98,11 @@ AeAttachedDataHandler ( ACPI_HANDLE Object, void *Data); +static void +AeAttachedDataHandler2 ( + ACPI_HANDLE Object, + void *Data); + static UINT32 AeInterfaceHandler ( ACPI_STRING InterfaceName, @@ -605,7 +610,29 @@ AeAttachedDataHandler ( ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data); - AcpiOsPrintf ("Received an attached data deletion on %4.4s\n", + AcpiOsPrintf ("Received an attached data deletion (1) on %4.4s\n", + Node->Name.Ascii); +} + + +/****************************************************************************** + * + * FUNCTION: AeAttachedDataHandler2 + * + * DESCRIPTION: Handler for deletion of nodes with attached data (attached via + * AcpiAttachData) + * + *****************************************************************************/ + +static void +AeAttachedDataHandler2 ( + ACPI_HANDLE Object, + void *Data) +{ + ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Data); + + + AcpiOsPrintf ("Received an attached data deletion (2) on %4.4s\n", Node->Name.Ascii); } @@ -1022,8 +1049,23 @@ AeInstallEarlyHandlers ( Status = AcpiDetachData (Handle, AeAttachedDataHandler); AE_CHECK_OK (AcpiDetachData, Status); + /* Test attach data at the root object */ + + Status = AcpiAttachData (ACPI_ROOT_OBJECT, AeAttachedDataHandler, + AcpiGbl_RootNode); + AE_CHECK_OK (AcpiAttachData, Status); + + Status = AcpiAttachData (ACPI_ROOT_OBJECT, AeAttachedDataHandler2, + AcpiGbl_RootNode); + AE_CHECK_OK (AcpiAttachData, Status); + + /* Test support for multiple attaches */ + Status = AcpiAttachData (Handle, AeAttachedDataHandler, Handle); AE_CHECK_OK (AcpiAttachData, Status); + + Status = AcpiAttachData (Handle, AeAttachedDataHandler2, Handle); + AE_CHECK_OK (AcpiAttachData, Status); } else {