diff options
author | jkim <jkim@FreeBSD.org> | 2013-11-15 20:40:27 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2013-11-15 20:40:27 +0000 |
commit | a1672476f94b0c9ac84a682574aeb1eb481c484c (patch) | |
tree | 393e1854c22739c2db6213f80e859a02e4223818 /source/components | |
parent | f4a31baa14e08b26c3b63f02571280c872cabe90 (diff) | |
download | FreeBSD-src-a1672476f94b0c9ac84a682574aeb1eb481c484c.zip FreeBSD-src-a1672476f94b0c9ac84a682574aeb1eb481c484c.tar.gz |
Import ACPICA 20131115.
Diffstat (limited to 'source/components')
-rw-r--r-- | source/components/debugger/dbcmds.c | 8 | ||||
-rw-r--r-- | source/components/namespace/nsalloc.c | 19 | ||||
-rw-r--r-- | source/components/namespace/nsutils.c | 18 | ||||
-rw-r--r-- | source/components/resources/rscalc.c | 6 | ||||
-rw-r--r-- | source/components/resources/rscreate.c | 35 | ||||
-rw-r--r-- | source/components/resources/rsutils.c | 2 | ||||
-rw-r--r-- | source/components/utilities/utdebug.c | 34 | ||||
-rw-r--r-- | source/components/utilities/utxface.c | 1 | ||||
-rw-r--r-- | source/components/utilities/utxfinit.c | 1 |
9 files changed, 81 insertions, 43 deletions
diff --git a/source/components/debugger/dbcmds.c b/source/components/debugger/dbcmds.c index be35763..7a417155 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 @@ GetCrs: } EndCrs: - ACPI_FREE_BUFFER (ReturnBuffer); + ACPI_FREE (ReturnBuffer.Pointer); } diff --git a/source/components/namespace/nsalloc.c b/source/components/namespace/nsalloc.c index 09b42f5..38ce8fc 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 f2cf74f..ccecd6d 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 a6e8b38..a5a8e5a 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 209b503..fa6b4aa 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 04591d9..eb0d93c 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 ab16236..87dbf53 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 3087d67..a093ec6 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 a9d9251..b395c15 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" |