summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/exstorob.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/exstorob.c')
-rw-r--r--sys/contrib/dev/acpica/exstorob.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/sys/contrib/dev/acpica/exstorob.c b/sys/contrib/dev/acpica/exstorob.c
index f9be073..360ab5c 100644
--- a/sys/contrib/dev/acpica/exstorob.c
+++ b/sys/contrib/dev/acpica/exstorob.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
- * $Revision: 46 $
+ * $Revision: 50 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2002, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2003, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -147,7 +147,7 @@ AcpiExStoreBufferToBuffer (
UINT8 *Buffer;
- ACPI_FUNCTION_NAME ("ExStoreBufferToBuffer");
+ ACPI_FUNCTION_TRACE_PTR ("ExStoreBufferToBuffer", SourceDesc);
/*
@@ -157,17 +157,19 @@ AcpiExStoreBufferToBuffer (
Length = SourceDesc->Buffer.Length;
/*
- * If target is a buffer of length zero, allocate a new
- * buffer of the proper length
+ * If target is a buffer of length zero or is a static buffer,
+ * allocate a new buffer of the proper length
*/
- if (TargetDesc->Buffer.Length == 0)
+ if ((TargetDesc->Buffer.Length == 0) ||
+ (TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER))
{
TargetDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (Length);
if (!TargetDesc->Buffer.Pointer)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
+ TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
TargetDesc->Buffer.Length = Length;
}
@@ -197,7 +199,7 @@ AcpiExStoreBufferToBuffer (
/* Copy flags */
TargetDesc->Buffer.Flags = SourceDesc->Buffer.Flags;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
@@ -223,7 +225,7 @@ AcpiExStoreStringToString (
UINT8 *Buffer;
- ACPI_FUNCTION_ENTRY ();
+ ACPI_FUNCTION_TRACE_PTR ("ExStoreStringToString", SourceDesc);
/*
@@ -233,13 +235,15 @@ AcpiExStoreStringToString (
Length = SourceDesc->String.Length;
/*
- * Setting a string value replaces the old string
+ * Replace existing string value if it will fit and the string
+ * pointer is not a static pointer (part of an ACPI table)
*/
- if (Length < TargetDesc->String.Length)
+ if ((Length < TargetDesc->String.Length) &&
+ (!(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
{
- /*
- * String will fit in existing buffer.
- * Clear old string and copy in the new one
+ /*
+ * String will fit in existing non-static buffer.
+ * Clear old string and copy in the new one
*/
ACPI_MEMSET (TargetDesc->String.Pointer, 0, (ACPI_SIZE) TargetDesc->String.Length + 1);
ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
@@ -262,16 +266,17 @@ AcpiExStoreStringToString (
TargetDesc->String.Pointer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Length + 1);
if (!TargetDesc->String.Pointer)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
+ TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
}
/* Set the new target length */
TargetDesc->String.Length = Length;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
OpenPOWER on IntegriCloud