summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/compiler/dtio.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2011-03-17 00:29:53 +0000
committerjkim <jkim@FreeBSD.org>2011-03-17 00:29:53 +0000
commit69fd3173b85e09555e751babb9f17e078aa7038c (patch)
treefe5f720ee49b8903a9521b4bfb2be2eccb814c80 /sys/contrib/dev/acpica/compiler/dtio.c
parent3929b790ffa5d9dc6f772c0b8aa93519bfd2d61a (diff)
downloadFreeBSD-src-69fd3173b85e09555e751babb9f17e078aa7038c.zip
FreeBSD-src-69fd3173b85e09555e751babb9f17e078aa7038c.tar.gz
Merge ACPICA 20110316.
Diffstat (limited to 'sys/contrib/dev/acpica/compiler/dtio.c')
-rw-r--r--sys/contrib/dev/acpica/compiler/dtio.c68
1 files changed, 67 insertions, 1 deletions
diff --git a/sys/contrib/dev/acpica/compiler/dtio.c b/sys/contrib/dev/acpica/compiler/dtio.c
index 9ba9acc..c339277 100644
--- a/sys/contrib/dev/acpica/compiler/dtio.c
+++ b/sys/contrib/dev/acpica/compiler/dtio.c
@@ -60,6 +60,10 @@ static void
DtLinkField (
DT_FIELD *Field);
+static void
+DtMergeField (
+ char *Value);
+
static ACPI_STATUS
DtParseLine (
char *LineBuffer,
@@ -222,6 +226,56 @@ DtLinkField (
/******************************************************************************
*
+ * FUNCTION: DtMergeField
+ *
+ * PARAMETERS: Value - Merge this line into previous one
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Merge a field value to the previous one,
+ * probably for a multi-line buffer definition.
+ *
+ *****************************************************************************/
+
+static void
+DtMergeField (
+ char *Value)
+{
+ DT_FIELD *Prev;
+ DT_FIELD *Next;
+ char *NewValue;
+ UINT32 PrevLength;
+ UINT32 ThisLength;
+
+
+ Prev = Next = Gbl_FieldList;
+
+ while (Next)
+ {
+ Prev = Next;
+ Next = Next->Next;
+ }
+
+ if (Prev)
+ {
+ PrevLength = ACPI_STRLEN (Prev->Value);
+ ThisLength = ACPI_STRLEN (Value);
+
+ /* Add two for: separator + NULL terminator */
+
+ NewValue = UtLocalCalloc (PrevLength + ThisLength + 2);
+ ACPI_STRNCPY (NewValue, Prev->Value, PrevLength);
+ NewValue[PrevLength] = ' ';
+
+ ACPI_STRNCPY ((NewValue + PrevLength + 1), Value, ThisLength);
+ ACPI_FREE (Prev->Value);
+ Prev->Value = NewValue;
+ }
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: DtParseLine
*
* PARAMETERS: LineBuffer - Current source code line
@@ -354,11 +408,12 @@ DtParseLine (
Length = ACPI_PTR_DIFF (End, Start);
TmpValue = UtLocalCalloc (Length + 1);
+
ACPI_STRNCPY (TmpValue, Start, Length);
Value = DtTrim (TmpValue);
ACPI_FREE (TmpValue);
- if (Name && Value)
+ if (ACPI_STRLEN (Name) && Value)
{
Field = UtLocalCalloc (sizeof (DT_FIELD));
Field->Name = Name;
@@ -370,6 +425,17 @@ DtParseLine (
DtLinkField (Field);
}
+ else if (!ACPI_STRLEN (Name))
+ {
+ /* Handle multi-line buffers (length > 16) */
+
+ DtMergeField (Value);
+ }
+ else
+ {
+ ACPI_FREE (Name);
+ ACPI_FREE (Value);
+ }
return (AE_OK);
}
OpenPOWER on IntegriCloud