summaryrefslogtreecommitdiffstats
path: root/source/components
diff options
context:
space:
mode:
Diffstat (limited to 'source/components')
-rw-r--r--source/components/debugger/dbexec.c44
-rw-r--r--source/components/debugger/dbfileio.c2
-rw-r--r--source/components/debugger/dbhistry.c35
-rw-r--r--source/components/debugger/dbinput.c18
-rw-r--r--source/components/debugger/dbnames.c20
-rw-r--r--source/components/debugger/dbxface.c4
-rw-r--r--source/components/events/evgpe.c3
-rw-r--r--source/components/events/evxface.c1
-rw-r--r--source/components/events/evxfevnt.c1
-rw-r--r--source/components/events/evxfgpe.c1
-rw-r--r--source/components/events/evxfregn.c1
-rw-r--r--source/components/executer/exstore.c168
-rw-r--r--source/components/hardware/hwtimer.c2
-rw-r--r--source/components/hardware/hwxface.c10
-rw-r--r--source/components/hardware/hwxfsleep.c2
-rw-r--r--source/components/namespace/nsdump.c7
-rw-r--r--source/components/namespace/nsxfeval.c9
-rw-r--r--source/components/namespace/nsxfname.c1
-rw-r--r--source/components/namespace/nsxfobj.c1
-rw-r--r--source/components/resources/rsxface.c1
-rw-r--r--source/components/tables/tbprint.c6
-rw-r--r--source/components/tables/tbxface.c5
-rw-r--r--source/components/tables/tbxfload.c3
-rw-r--r--source/components/utilities/utalloc.c131
-rw-r--r--source/components/utilities/utdebug.c1
-rw-r--r--source/components/utilities/utexcep.c1
-rw-r--r--source/components/utilities/utglobal.c1
-rw-r--r--source/components/utilities/utstring.c75
-rw-r--r--source/components/utilities/uttrack.c29
-rw-r--r--source/components/utilities/utxface.c2
-rw-r--r--source/components/utilities/utxferror.c1
-rw-r--r--source/components/utilities/utxfinit.c6
32 files changed, 405 insertions, 187 deletions
diff --git a/source/components/debugger/dbexec.c b/source/components/debugger/dbexec.c
index dff3c79..668dcdd 100644
--- a/source/components/debugger/dbexec.c
+++ b/source/components/debugger/dbexec.c
@@ -62,7 +62,7 @@ AcpiDbExecuteMethod (
ACPI_DB_METHOD_INFO *Info,
ACPI_BUFFER *ReturnObj);
-static void
+static ACPI_STATUS
AcpiDbExecuteSetup (
ACPI_DB_METHOD_INFO *Info);
@@ -237,10 +237,15 @@ Cleanup:
*
******************************************************************************/
-static void
+static ACPI_STATUS
AcpiDbExecuteSetup (
ACPI_DB_METHOD_INFO *Info)
{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_NAME (DbExecuteSetup);
+
/* Catenate the current scope to the supplied name */
@@ -248,10 +253,21 @@ AcpiDbExecuteSetup (
if ((Info->Name[0] != '\\') &&
(Info->Name[0] != '/'))
{
- ACPI_STRCAT (Info->Pathname, AcpiGbl_DbScopeBuf);
+ if (AcpiUtSafeStrcat (Info->Pathname, sizeof (Info->Pathname),
+ AcpiGbl_DbScopeBuf))
+ {
+ Status = AE_BUFFER_OVERFLOW;
+ goto ErrorExit;
+ }
+ }
+
+ if (AcpiUtSafeStrcat (Info->Pathname, sizeof (Info->Pathname),
+ Info->Name))
+ {
+ Status = AE_BUFFER_OVERFLOW;
+ goto ErrorExit;
}
- ACPI_STRCAT (Info->Pathname, Info->Name);
AcpiDbPrepNamestring (Info->Pathname);
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
@@ -269,6 +285,13 @@ AcpiDbExecuteSetup (
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
}
+
+ return (AE_OK);
+
+ErrorExit:
+
+ ACPI_EXCEPTION ((AE_INFO, Status, "During setup for method execution"));
+ return (Status);
}
@@ -429,7 +452,12 @@ AcpiDbExecute (
ReturnObj.Pointer = NULL;
ReturnObj.Length = ACPI_ALLOCATE_BUFFER;
- AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+ Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_FREE (NameString);
+ return;
+ }
/* Get the NS node, determines existence also */
@@ -729,7 +757,11 @@ AcpiDbCreateExecutionThreads (
AcpiDbUint32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr);
- AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+ Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
+ if (ACPI_FAILURE (Status))
+ {
+ goto CleanupAndExit;
+ }
/* Get the NS node, determines existence also */
diff --git a/source/components/debugger/dbfileio.c b/source/components/debugger/dbfileio.c
index 3ba9653..373e7ad 100644
--- a/source/components/debugger/dbfileio.c
+++ b/source/components/debugger/dbfileio.c
@@ -492,7 +492,7 @@ AcpiDbReadTableFromFile (
File = fopen (Filename, "rb");
if (!File)
{
- AcpiOsPrintf ("Could not open input file %s\n", Filename);
+ perror ("Could not open input file");
return (AE_ERROR);
}
diff --git a/source/components/debugger/dbhistry.c b/source/components/debugger/dbhistry.c
index ff11604..2daa01f 100644
--- a/source/components/debugger/dbhistry.c
+++ b/source/components/debugger/dbhistry.c
@@ -69,7 +69,7 @@ static HISTORY_INFO AcpiGbl_HistoryBuffer[HISTORY_SIZE];
static UINT16 AcpiGbl_LoHistory = 0;
static UINT16 AcpiGbl_NumHistory = 0;
static UINT16 AcpiGbl_NextHistoryIndex = 0;
-static UINT32 AcpiGbl_NextCmdNum = 1;
+UINT32 AcpiGbl_NextCmdNum = 1;
/*******************************************************************************
@@ -94,6 +94,11 @@ AcpiDbAddToHistory (
/* Put command into the next available slot */
CmdLen = (UINT16) ACPI_STRLEN (CommandLine);
+ if (!CmdLen)
+ {
+ return;
+ }
+
if (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command != NULL)
{
BufferLen = (UINT16) ACPI_STRLEN (
@@ -203,8 +208,6 @@ char *
AcpiDbGetFromHistory (
char *CommandNumArg)
{
- UINT32 i;
- UINT16 HistoryIndex;
UINT32 CmdNum;
@@ -218,6 +221,31 @@ AcpiDbGetFromHistory (
CmdNum = ACPI_STRTOUL (CommandNumArg, NULL, 0);
}
+ return (AcpiDbGetHistoryByIndex (CmdNum));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetHistoryByIndex
+ *
+ * PARAMETERS: CmdNum - Index of the desired history entry.
+ * Values are 0...(AcpiGbl_NextCmdNum - 1)
+ *
+ * RETURN: Pointer to the retrieved command. Null on error.
+ *
+ * DESCRIPTION: Get a command from the history buffer
+ *
+ ******************************************************************************/
+
+char *
+AcpiDbGetHistoryByIndex (
+ UINT32 CmdNum)
+{
+ UINT32 i;
+ UINT16 HistoryIndex;
+
+
/* Search history buffer */
HistoryIndex = AcpiGbl_LoHistory;
@@ -230,6 +258,7 @@ AcpiDbGetFromHistory (
return (AcpiGbl_HistoryBuffer[HistoryIndex].Command);
}
+ /* History buffer is circular */
HistoryIndex++;
if (HistoryIndex >= HISTORY_SIZE)
diff --git a/source/components/debugger/dbinput.c b/source/components/debugger/dbinput.c
index 511e585..147a023 100644
--- a/source/components/debugger/dbinput.c
+++ b/source/components/debugger/dbinput.c
@@ -635,7 +635,13 @@ AcpiDbGetLine (
char *This;
- ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
+ if (AcpiUtSafeStrcpy (AcpiGbl_DbParsedBuf, sizeof (AcpiGbl_DbParsedBuf),
+ InputBuffer))
+ {
+ AcpiOsPrintf ("Buffer overflow while parsing input line (max %u characters)\n",
+ sizeof (AcpiGbl_DbParsedBuf));
+ return (0);
+ }
This = AcpiGbl_DbParsedBuf;
for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
@@ -740,6 +746,11 @@ AcpiDbCommandDispatch (
return (AE_CTRL_TERMINATE);
}
+
+ /* Add all commands that come here to the history buffer */
+
+ AcpiDbAddToHistory (InputBuffer);
+
ParamCount = AcpiDbGetLine (InputBuffer);
CommandIndex = AcpiDbMatchCommand (AcpiGbl_DbArgs[0]);
Temp = 0;
@@ -1135,7 +1146,7 @@ AcpiDbCommandDispatch (
case CMD_NOT_FOUND:
default:
- AcpiOsPrintf ("Unknown Command\n");
+ AcpiOsPrintf ("%s: unknown command\n", AcpiGbl_DbArgs[0]);
return (AE_CTRL_TRUE);
}
@@ -1144,9 +1155,6 @@ AcpiDbCommandDispatch (
Status = AE_CTRL_TRUE;
}
- /* Add all commands that come here to the history buffer */
-
- AcpiDbAddToHistory (InputBuffer);
return (Status);
}
diff --git a/source/components/debugger/dbnames.c b/source/components/debugger/dbnames.c
index e3c6d71..c071289 100644
--- a/source/components/debugger/dbnames.c
+++ b/source/components/debugger/dbnames.c
@@ -171,8 +171,7 @@ AcpiDbSetScope (
goto ErrorExit;
}
- ACPI_STRCPY (AcpiGbl_DbScopeBuf, Name);
- ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ AcpiGbl_DbScopeBuf[0] = 0;
}
else
{
@@ -184,9 +183,22 @@ AcpiDbSetScope (
{
goto ErrorExit;
}
+ }
+
+ /* Build the final pathname */
+
+ if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf),
+ Name))
+ {
+ Status = AE_BUFFER_OVERFLOW;
+ goto ErrorExit;
+ }
- ACPI_STRCAT (AcpiGbl_DbScopeBuf, Name);
- ACPI_STRCAT (AcpiGbl_DbScopeBuf, "\\");
+ if (AcpiUtSafeStrcat (AcpiGbl_DbScopeBuf, sizeof (AcpiGbl_DbScopeBuf),
+ "\\"))
+ {
+ Status = AE_BUFFER_OVERFLOW;
+ goto ErrorExit;
}
AcpiGbl_DbScopeNode = Node;
diff --git a/source/components/debugger/dbxface.c b/source/components/debugger/dbxface.c
index 3c1df5b..eedff1f 100644
--- a/source/components/debugger/dbxface.c
+++ b/source/components/debugger/dbxface.c
@@ -507,6 +507,10 @@ AcpiDbTerminate (
AcpiOsFree (AcpiGbl_DbBuffer);
AcpiGbl_DbBuffer = NULL;
}
+
+ /* Ensure that debug output is now disabled */
+
+ AcpiGbl_DbOutputFlags = ACPI_DB_DISABLE_OUTPUT;
}
diff --git a/source/components/events/evgpe.c b/source/components/events/evgpe.c
index 9b80f08..0828606 100644
--- a/source/components/events/evgpe.c
+++ b/source/components/events/evgpe.c
@@ -549,6 +549,7 @@ AcpiEvAsynchExecuteGpeMethod (
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
+ ACPI_FREE (LocalGpeEventInfo);
return_VOID;
}
@@ -557,6 +558,7 @@ AcpiEvAsynchExecuteGpeMethod (
if (!AcpiEvValidGpeEvent (GpeEventInfo))
{
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ ACPI_FREE (LocalGpeEventInfo);
return_VOID;
}
@@ -570,6 +572,7 @@ AcpiEvAsynchExecuteGpeMethod (
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
{
+ ACPI_FREE (LocalGpeEventInfo);
return_VOID;
}
diff --git a/source/components/events/evxface.c b/source/components/events/evxface.c
index 0e83930..9bce524 100644
--- a/source/components/events/evxface.c
+++ b/source/components/events/evxface.c
@@ -43,6 +43,7 @@
#define __EVXFACE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/events/evxfevnt.c b/source/components/events/evxfevnt.c
index ae3378e..ce1ce4d 100644
--- a/source/components/events/evxfevnt.c
+++ b/source/components/events/evxfevnt.c
@@ -43,6 +43,7 @@
#define __EVXFEVNT_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/events/evxfgpe.c b/source/components/events/evxfgpe.c
index 1deff5b..e76b7f1 100644
--- a/source/components/events/evxfgpe.c
+++ b/source/components/events/evxfgpe.c
@@ -43,6 +43,7 @@
#define __EVXFGPE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/events/evxfregn.c b/source/components/events/evxfregn.c
index 4b5b3d0..5879da6 100644
--- a/source/components/events/evxfregn.c
+++ b/source/components/events/evxfregn.c
@@ -43,6 +43,7 @@
*/
#define __EVXFREGN_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/executer/exstore.c b/source/components/executer/exstore.c
index 2ec392e..f54428b 100644
--- a/source/components/executer/exstore.c
+++ b/source/components/executer/exstore.c
@@ -62,6 +62,12 @@ AcpiExStoreObjectToIndex (
ACPI_OPERAND_OBJECT *DestDesc,
ACPI_WALK_STATE *WalkState);
+static ACPI_STATUS
+AcpiExStoreDirectToNode (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_WALK_STATE *WalkState);
+
/*******************************************************************************
*
@@ -393,7 +399,11 @@ AcpiExStoreObjectToIndex (
* When storing into an object the data is converted to the
* target object type then stored in the object. This means
* that the target object type (for an initialized target) will
- * not be changed by a store operation.
+ * not be changed by a store operation. A CopyObject can change
+ * the target type, however.
+ *
+ * The ImplicitConversion flag is set to NO/FALSE only when
+ * storing to an ArgX -- as per the rules of the ACPI spec.
*
* Assumes parameters are already validated.
*
@@ -420,7 +430,7 @@ AcpiExStoreObjectToNode (
TargetType = AcpiNsGetType (Node);
TargetDesc = AcpiNsGetAttachedObject (Node);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p(%s) into node %p(%s)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Storing %p (%s) to node %p (%s)\n",
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc),
Node, AcpiUtGetTypeName (TargetType)));
@@ -434,49 +444,35 @@ AcpiExStoreObjectToNode (
return_ACPI_STATUS (Status);
}
- /* If no implicit conversion, drop into the default case below */
-
- if ((!ImplicitConversion) ||
- ((WalkState->Opcode == AML_COPY_OP) &&
- (TargetType != ACPI_TYPE_LOCAL_REGION_FIELD) &&
- (TargetType != ACPI_TYPE_LOCAL_BANK_FIELD) &&
- (TargetType != ACPI_TYPE_LOCAL_INDEX_FIELD)))
- {
- /*
- * Force execution of default (no implicit conversion). Note:
- * CopyObject does not perform an implicit conversion, as per the ACPI
- * spec -- except in case of region/bank/index fields -- because these
- * objects must retain their original type permanently.
- */
- TargetType = ACPI_TYPE_ANY;
- }
-
/* Do the actual store operation */
switch (TargetType)
{
- case ACPI_TYPE_BUFFER_FIELD:
- case ACPI_TYPE_LOCAL_REGION_FIELD:
- case ACPI_TYPE_LOCAL_BANK_FIELD:
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
-
- /* For fields, copy the source data to the target field. */
-
- Status = AcpiExWriteDataToField (SourceDesc, TargetDesc,
- &WalkState->ResultObj);
- break;
-
case ACPI_TYPE_INTEGER:
case ACPI_TYPE_STRING:
case ACPI_TYPE_BUFFER:
/*
- * These target types are all of type Integer/String/Buffer, and
- * therefore support implicit conversion before the store.
- *
- * Copy and/or convert the source object to a new target object
+ * The simple data types all support implicit source operand
+ * conversion before the store.
*/
+
+ if ((WalkState->Opcode == AML_COPY_OP) ||
+ !ImplicitConversion)
+ {
+ /*
+ * However, CopyObject and Stores to ArgX do not perform
+ * an implicit conversion, as per the ACPI specification.
+ * A direct store is performed instead.
+ */
+ Status = AcpiExStoreDirectToNode (SourceDesc, Node,
+ WalkState);
+ break;
+ }
+
+ /* Store with implicit source operand conversion support */
+
Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc,
- &NewDesc, WalkState);
+ &NewDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -489,11 +485,12 @@ AcpiExStoreObjectToNode (
* the Name's type to that of the value being stored in it.
* SourceDesc reference count is incremented by AttachObject.
*
- * Note: This may change the type of the node if an explicit store
- * has been performed such that the node/object type has been
- * changed.
+ * Note: This may change the type of the node if an explicit
+ * store has been performed such that the node/object type
+ * has been changed.
*/
- Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type);
+ Status = AcpiNsAttachObject (Node, NewDesc,
+ NewDesc->Common.Type);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Store %s into %s via Convert/Attach\n",
@@ -502,33 +499,86 @@ AcpiExStoreObjectToNode (
}
break;
- default:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Storing [%s] (%p) directly into node [%s] (%p)"
- " with no implicit conversion\n",
- AcpiUtGetObjectTypeName (SourceDesc), SourceDesc,
- AcpiUtGetObjectTypeName (TargetDesc), Node));
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_LOCAL_BANK_FIELD:
+ case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ /*
+ * For all fields, always write the source data to the target
+ * field. Any required implicit source operand conversion is
+ * performed in the function below as necessary. Note, field
+ * objects must retain their original type permanently.
+ */
+ Status = AcpiExWriteDataToField (SourceDesc, TargetDesc,
+ &WalkState->ResultObj);
+ break;
+ default:
/*
* No conversions for all other types. Directly store a copy of
- * the source object. NOTE: This is a departure from the ACPI
- * spec, which states "If conversion is impossible, abort the
- * running control method".
+ * the source object. This is the ACPI spec-defined behavior for
+ * the CopyObject operator.
*
- * This code implements "If conversion is impossible, treat the
- * Store operation as a CopyObject".
+ * NOTE: For the Store operator, this is a departure from the
+ * ACPI spec, which states "If conversion is impossible, abort
+ * the running control method". Instead, this code implements
+ * "If conversion is impossible, treat the Store operation as
+ * a CopyObject".
*/
- Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type);
- AcpiUtRemoveReference (NewDesc);
+ Status = AcpiExStoreDirectToNode (SourceDesc, Node,
+ WalkState);
break;
}
return_ACPI_STATUS (Status);
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExStoreDirectToNode
+ *
+ * PARAMETERS: SourceDesc - Value to be stored
+ * Node - Named object to receive the value
+ * WalkState - Current walk state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: "Store" an object directly to a node. This involves a copy
+ * and an attach.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiExStoreDirectToNode (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *NewDesc;
+
+
+ ACPI_FUNCTION_TRACE (ExStoreDirectToNode);
+
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Storing [%s] (%p) directly into node [%s] (%p)"
+ " with no implicit conversion\n",
+ AcpiUtGetObjectTypeName (SourceDesc), SourceDesc,
+ AcpiUtGetTypeName (Node->Type), Node));
+
+ /* Copy the source object to a new object */
+
+ Status = AcpiUtCopyIobjectToIobject (SourceDesc, &NewDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Attach the new object to the node */
+
+ Status = AcpiNsAttachObject (Node, NewDesc, NewDesc->Common.Type);
+ AcpiUtRemoveReference (NewDesc);
+ return_ACPI_STATUS (Status);
+}
diff --git a/source/components/hardware/hwtimer.c b/source/components/hardware/hwtimer.c
index cbfa96b..c42576e 100644
--- a/source/components/hardware/hwtimer.c
+++ b/source/components/hardware/hwtimer.c
@@ -41,6 +41,8 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
+#define EXPORT_ACPI_INTERFACES
+
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/hardware/hwxface.c b/source/components/hardware/hwxface.c
index 45d5654..a1d5a04 100644
--- a/source/components/hardware/hwxface.c
+++ b/source/components/hardware/hwxface.c
@@ -41,6 +41,8 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
+#define EXPORT_ACPI_INTERFACES
+
#include "acpi.h"
#include "accommon.h"
#include "acnamesp.h"
@@ -90,9 +92,15 @@ AcpiReset (
* For I/O space, write directly to the OSL. This bypasses the port
* validation mechanism, which may block a valid write to the reset
* register.
+ *
+ * NOTE:
+ * The ACPI spec requires the reset register width to be 8, so we
+ * hardcode it here and ignore the FADT value. This maintains
+ * compatibility with other ACPI implementations that have allowed
+ * BIOS code with bad register width values to go unnoticed.
*/
Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ResetReg->Address,
- AcpiGbl_FADT.ResetValue, ResetReg->BitWidth);
+ AcpiGbl_FADT.ResetValue, ACPI_RESET_REGISTER_WIDTH);
}
else
{
diff --git a/source/components/hardware/hwxfsleep.c b/source/components/hardware/hwxfsleep.c
index 8259f01..9131f95 100644
--- a/source/components/hardware/hwxfsleep.c
+++ b/source/components/hardware/hwxfsleep.c
@@ -41,6 +41,8 @@
* POSSIBILITY OF SUCH DAMAGES.
*/
+#define EXPORT_ACPI_INTERFACES
+
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/namespace/nsdump.c b/source/components/namespace/nsdump.c
index 5559d9a..4f6a7f9 100644
--- a/source/components/namespace/nsdump.c
+++ b/source/components/namespace/nsdump.c
@@ -748,6 +748,13 @@ AcpiNsDumpOneObjectPath (
}
Node = AcpiNsValidateHandle (ObjHandle);
+ if (!Node)
+ {
+ /* Ignore bad node during namespace walk */
+
+ return (AE_OK);
+ }
+
Pathname = AcpiNsGetExternalPathname (Node);
PathIndent = 1;
diff --git a/source/components/namespace/nsxfeval.c b/source/components/namespace/nsxfeval.c
index 007ade3..a1af583 100644
--- a/source/components/namespace/nsxfeval.c
+++ b/source/components/namespace/nsxfeval.c
@@ -44,6 +44,7 @@
#define __NSXFEVAL_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -148,8 +149,12 @@ AcpiEvaluateObjectTyped (
if (MustFree)
{
- /* Caller used ACPI_ALLOCATE_BUFFER, free the return buffer */
-
+ /*
+ * Caller used ACPI_ALLOCATE_BUFFER, free the return buffer.
+ * Note: We use AcpiOsFree here because AcpiOsAllocate was used
+ * to allocate the buffer. This purposefully bypasses the internal
+ * allocation tracking mechanism (if it is enabled).
+ */
AcpiOsFree (ReturnBuffer->Pointer);
ReturnBuffer->Pointer = NULL;
}
diff --git a/source/components/namespace/nsxfname.c b/source/components/namespace/nsxfname.c
index 289ecd8..5ef49c4 100644
--- a/source/components/namespace/nsxfname.c
+++ b/source/components/namespace/nsxfname.c
@@ -43,6 +43,7 @@
*/
#define __NSXFNAME_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/namespace/nsxfobj.c b/source/components/namespace/nsxfobj.c
index 96c5111..d3adfdb 100644
--- a/source/components/namespace/nsxfobj.c
+++ b/source/components/namespace/nsxfobj.c
@@ -44,6 +44,7 @@
#define __NSXFOBJ_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/resources/rsxface.c b/source/components/resources/rsxface.c
index 0523f5b..67049e0 100644
--- a/source/components/resources/rsxface.c
+++ b/source/components/resources/rsxface.c
@@ -43,6 +43,7 @@
#define __RSXFACE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/tables/tbprint.c b/source/components/tables/tbprint.c
index f24de49..719ade6 100644
--- a/source/components/tables/tbprint.c
+++ b/source/components/tables/tbprint.c
@@ -154,7 +154,7 @@ AcpiTbPrintTableHeader (
{
/* FACS only has signature and length fields */
- ACPI_INFO ((AE_INFO, "%4.4s %p %05X",
+ ACPI_INFO ((AE_INFO, "%4.4s %p %06X",
Header->Signature, ACPI_CAST_PTR (void, Address),
Header->Length));
}
@@ -166,7 +166,7 @@ AcpiTbPrintTableHeader (
ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId, ACPI_OEM_ID_SIZE);
AcpiTbFixString (LocalHeader.OemId, ACPI_OEM_ID_SIZE);
- ACPI_INFO ((AE_INFO, "RSDP %p %05X (v%.2d %6.6s)",
+ ACPI_INFO ((AE_INFO, "RSDP %p %06X (v%.2d %6.6s)",
ACPI_CAST_PTR (void, Address),
(ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ?
ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20,
@@ -180,7 +180,7 @@ AcpiTbPrintTableHeader (
AcpiTbCleanupTableHeader (&LocalHeader, Header);
ACPI_INFO ((AE_INFO,
- "%4.4s %p %05X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
+ "%4.4s %p %06X (v%.2d %6.6s %8.8s %08X %4.4s %08X)",
LocalHeader.Signature, ACPI_CAST_PTR (void, Address),
LocalHeader.Length, LocalHeader.Revision, LocalHeader.OemId,
LocalHeader.OemTableId, LocalHeader.OemRevision,
diff --git a/source/components/tables/tbxface.c b/source/components/tables/tbxface.c
index 5308162..1644926 100644
--- a/source/components/tables/tbxface.c
+++ b/source/components/tables/tbxface.c
@@ -42,6 +42,7 @@
*/
#define __TBXFACE_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -161,7 +162,7 @@ AcpiInitializeTables (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeTables)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeTables)
/*******************************************************************************
@@ -204,7 +205,7 @@ AcpiReallocateRootTable (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable)
+ACPI_EXPORT_SYMBOL_INIT (AcpiReallocateRootTable)
/*******************************************************************************
diff --git a/source/components/tables/tbxfload.c b/source/components/tables/tbxfload.c
index 2ebaab9..6b2d5fa 100644
--- a/source/components/tables/tbxfload.c
+++ b/source/components/tables/tbxfload.c
@@ -42,6 +42,7 @@
*/
#define __TBXFLOAD_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
@@ -92,7 +93,7 @@ AcpiLoadTables (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiLoadTables)
+ACPI_EXPORT_SYMBOL_INIT (AcpiLoadTables)
/*******************************************************************************
diff --git a/source/components/utilities/utalloc.c b/source/components/utilities/utalloc.c
index 2169fe8..51eee97 100644
--- a/source/components/utilities/utalloc.c
+++ b/source/components/utilities/utalloc.c
@@ -51,6 +51,45 @@
ACPI_MODULE_NAME ("utalloc")
+#if !defined (USE_NATIVE_ALLOCATE_ZEROED)
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiOsAllocateZeroed
+ *
+ * PARAMETERS: Size - Size of the allocation
+ *
+ * RETURN: Address of the allocated memory on success, NULL on failure.
+ *
+ * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
+ * This is the default implementation. Can be overridden via the
+ * USE_NATIVE_ALLOCATE_ZEROED flag.
+ *
+ ******************************************************************************/
+
+void *
+AcpiOsAllocateZeroed (
+ ACPI_SIZE Size)
+{
+ void *Allocation;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Allocation = AcpiOsAllocate (Size);
+ if (Allocation)
+ {
+ /* Clear the memory block */
+
+ ACPI_MEMSET (Allocation, 0, Size);
+ }
+
+ return (Allocation);
+}
+
+#endif /* !USE_NATIVE_ALLOCATE_ZEROED */
+
+
/*******************************************************************************
*
* FUNCTION: AcpiUtCreateCaches
@@ -321,95 +360,3 @@ AcpiUtInitializeBuffer (
ACPI_MEMSET (Buffer->Pointer, 0, RequiredLength);
return (AE_OK);
}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAllocate
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of malloc.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAllocate (
- ACPI_SIZE Size,
- UINT32 Component,
- const char *Module,
- UINT32 Line)
-{
- void *Allocation;
-
-
- ACPI_FUNCTION_TRACE_U32 (UtAllocate, Size);
-
-
- /* Check for an inadvertent size of zero bytes */
-
- if (!Size)
- {
- ACPI_WARNING ((Module, Line,
- "Attempt to allocate zero bytes, allocating 1 byte"));
- Size = 1;
- }
-
- Allocation = AcpiOsAllocate (Size);
- if (!Allocation)
- {
- /* Report allocation error */
-
- ACPI_WARNING ((Module, Line,
- "Could not allocate size %u", (UINT32) Size));
-
- return_PTR (NULL);
- }
-
- return_PTR (Allocation);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAllocateZeroed
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAllocateZeroed (
- ACPI_SIZE Size,
- UINT32 Component,
- const char *Module,
- UINT32 Line)
-{
- void *Allocation;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- Allocation = AcpiUtAllocate (Size, Component, Module, Line);
- if (Allocation)
- {
- /* Clear the memory block */
-
- ACPI_MEMSET (Allocation, 0, Size);
- }
-
- return (Allocation);
-}
diff --git a/source/components/utilities/utdebug.c b/source/components/utilities/utdebug.c
index 712c188..ab16236 100644
--- a/source/components/utilities/utdebug.c
+++ b/source/components/utilities/utdebug.c
@@ -42,6 +42,7 @@
*/
#define __UTDEBUG_C__
+#define EXPORT_ACPI_INTERFACES
#include "acpi.h"
#include "accommon.h"
diff --git a/source/components/utilities/utexcep.c b/source/components/utilities/utexcep.c
index 75258d9..2c35386 100644
--- a/source/components/utilities/utexcep.c
+++ b/source/components/utilities/utexcep.c
@@ -43,6 +43,7 @@
#define __UTEXCEP_C__
+#define EXPORT_ACPI_INTERFACES
#define ACPI_DEFINE_EXCEPTION_TABLE
#include "acpi.h"
diff --git a/source/components/utilities/utglobal.c b/source/components/utilities/utglobal.c
index ff24515..70ad3f4 100644
--- a/source/components/utilities/utglobal.c
+++ b/source/components/utilities/utglobal.c
@@ -42,6 +42,7 @@
*/
#define __UTGLOBAL_C__
+#define EXPORT_ACPI_INTERFACES
#define DEFINE_ACPI_GLOBALS
#include "acpi.h"
diff --git a/source/components/utilities/utstring.c b/source/components/utilities/utstring.c
index 9798700..282869c 100644
--- a/source/components/utilities/utstring.c
+++ b/source/components/utilities/utstring.c
@@ -685,3 +685,78 @@ UtConvertBackslashes (
}
}
#endif
+
+#if defined (ACPI_DEBUGGER) || defined (ACPI_APPLICATION)
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtSafeStrcpy, AcpiUtSafeStrcat, AcpiUtSafeStrncat
+ *
+ * PARAMETERS: Adds a "DestSize" parameter to each of the standard string
+ * functions. This is the size of the Destination buffer.
+ *
+ * RETURN: TRUE if the operation would overflow the destination buffer.
+ *
+ * DESCRIPTION: Safe versions of standard Clib string functions. Ensure that
+ * the result of the operation will not overflow the output string
+ * buffer.
+ *
+ * NOTE: These functions are typically only helpful for processing
+ * user input and command lines. For most ACPICA code, the
+ * required buffer length is precisely calculated before buffer
+ * allocation, so the use of these functions is unnecessary.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtSafeStrcpy (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source)
+{
+
+ if (ACPI_STRLEN (Source) >= DestSize)
+ {
+ return (TRUE);
+ }
+
+ ACPI_STRCPY (Dest, Source);
+ return (FALSE);
+}
+
+BOOLEAN
+AcpiUtSafeStrcat (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source)
+{
+
+ if ((ACPI_STRLEN (Dest) + ACPI_STRLEN (Source)) >= DestSize)
+ {
+ return (TRUE);
+ }
+
+ ACPI_STRCAT (Dest, Source);
+ return (FALSE);
+}
+
+BOOLEAN
+AcpiUtSafeStrncat (
+ char *Dest,
+ ACPI_SIZE DestSize,
+ char *Source,
+ ACPI_SIZE MaxTransferLength)
+{
+ ACPI_SIZE ActualTransferLength;
+
+
+ ActualTransferLength = ACPI_MIN (MaxTransferLength, ACPI_STRLEN (Source));
+
+ if ((ACPI_STRLEN (Dest) + ActualTransferLength) >= DestSize)
+ {
+ return (TRUE);
+ }
+
+ ACPI_STRNCAT (Dest, Source, MaxTransferLength);
+ return (FALSE);
+}
+#endif
diff --git a/source/components/utilities/uttrack.c b/source/components/utilities/uttrack.c
index 6cf9bdf..70d4585 100644
--- a/source/components/utilities/uttrack.c
+++ b/source/components/utilities/uttrack.c
@@ -151,10 +151,23 @@ AcpiUtAllocateAndTrack (
ACPI_STATUS Status;
- Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
- Component, Module, Line);
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!Size)
+ {
+ ACPI_WARNING ((Module, Line,
+ "Attempt to allocate zero bytes, allocating 1 byte"));
+ Size = 1;
+ }
+
+ Allocation = AcpiOsAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER));
if (!Allocation)
{
+ /* Report allocation error */
+
+ ACPI_WARNING ((Module, Line,
+ "Could not allocate size %u", (UINT32) Size));
+
return (NULL);
}
@@ -204,8 +217,16 @@ AcpiUtAllocateZeroedAndTrack (
ACPI_STATUS Status;
- Allocation = AcpiUtAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER),
- Component, Module, Line);
+ /* Check for an inadvertent size of zero bytes */
+
+ if (!Size)
+ {
+ ACPI_WARNING ((Module, Line,
+ "Attempt to allocate zero bytes, allocating 1 byte"));
+ Size = 1;
+ }
+
+ Allocation = AcpiOsAllocateZeroed (Size + sizeof (ACPI_DEBUG_MEM_HEADER));
if (!Allocation)
{
/* Report allocation error */
diff --git a/source/components/utilities/utxface.c b/source/components/utilities/utxface.c
index 021a462..3087d67 100644
--- a/source/components/utilities/utxface.c
+++ b/source/components/utilities/utxface.c
@@ -114,7 +114,7 @@ AcpiTerminate (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiTerminate)
+ACPI_EXPORT_SYMBOL_INIT (AcpiTerminate)
#ifndef ACPI_ASL_COMPILER
diff --git a/source/components/utilities/utxferror.c b/source/components/utilities/utxferror.c
index a01b5b0..366eae1 100644
--- a/source/components/utilities/utxferror.c
+++ b/source/components/utilities/utxferror.c
@@ -42,6 +42,7 @@
*/
#define __UTXFERROR_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 5312681..a9d9251 100644
--- a/source/components/utilities/utxfinit.c
+++ b/source/components/utilities/utxfinit.c
@@ -134,7 +134,7 @@ AcpiInitializeSubsystem (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeSubsystem)
/*******************************************************************************
@@ -256,7 +256,7 @@ AcpiEnableSubsystem (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem)
+ACPI_EXPORT_SYMBOL_INIT (AcpiEnableSubsystem)
/*******************************************************************************
@@ -355,4 +355,4 @@ AcpiInitializeObjects (
return_ACPI_STATUS (Status);
}
-ACPI_EXPORT_SYMBOL (AcpiInitializeObjects)
+ACPI_EXPORT_SYMBOL_INIT (AcpiInitializeObjects)
OpenPOWER on IntegriCloud