summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/components/executer/exdebug.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2016-09-30 22:40:58 +0000
committerjkim <jkim@FreeBSD.org>2016-09-30 22:40:58 +0000
commitdba8c0a565199df70a86f6a036d00c92f0c7675f (patch)
treecf4924274c6e92898c01efb3c8ba31b34f0630f2 /sys/contrib/dev/acpica/components/executer/exdebug.c
parent0f41551ef9dde560d9d191d7190af02904dbf611 (diff)
downloadFreeBSD-src-dba8c0a565199df70a86f6a036d00c92f0c7675f.zip
FreeBSD-src-dba8c0a565199df70a86f6a036d00c92f0c7675f.tar.gz
MFC: r284583, r285797, r285799, r287168, r298714, r298720, r298838,
r300879 Merge ACPICA up to 20160527. Requested by: mav
Diffstat (limited to 'sys/contrib/dev/acpica/components/executer/exdebug.c')
-rw-r--r--sys/contrib/dev/acpica/components/executer/exdebug.c121
1 files changed, 95 insertions, 26 deletions
diff --git a/sys/contrib/dev/acpica/components/executer/exdebug.c b/sys/contrib/dev/acpica/components/executer/exdebug.c
index 5e98fd5..24273f8 100644
--- a/sys/contrib/dev/acpica/components/executer/exdebug.c
+++ b/sys/contrib/dev/acpica/components/executer/exdebug.c
@@ -5,7 +5,7 @@
*****************************************************************************/
/*
- * Copyright (C) 2000 - 2015, Intel Corp.
+ * Copyright (C) 2000 - 2016, Intel Corp.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -81,6 +81,8 @@ AcpiExDoDebugObject (
{
UINT32 i;
UINT32 Timer;
+ ACPI_OPERAND_OBJECT *ObjectDesc;
+ UINT32 Value;
ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
@@ -94,13 +96,20 @@ AcpiExDoDebugObject (
return_VOID;
}
- /*
- * We will emit the current timer value (in microseconds) with each
- * debug output. Only need the lower 26 bits. This allows for 67
- * million microseconds or 67 seconds before rollover.
- */
- Timer = ((UINT32) AcpiOsGetTimer () / 10); /* (100 nanoseconds to microseconds) */
- Timer &= 0x03FFFFFF;
+ /* Null string or newline -- don't emit the line header */
+
+ if (SourceDesc &&
+ (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND) &&
+ (SourceDesc->Common.Type == ACPI_TYPE_STRING))
+ {
+ if ((SourceDesc->String.Length == 0) ||
+ ((SourceDesc->String.Length == 1) &&
+ (*SourceDesc->String.Pointer == '\n')))
+ {
+ AcpiOsPrintf ("\n");
+ return_VOID;
+ }
+ }
/*
* Print line header as long as we are not in the middle of an
@@ -108,14 +117,31 @@ AcpiExDoDebugObject (
*/
if (!((Level > 0) && Index == 0))
{
- AcpiOsPrintf ("[ACPI Debug %.8u] %*s", Timer, Level, " ");
+ if (AcpiGbl_DisplayDebugTimer)
+ {
+ /*
+ * We will emit the current timer value (in microseconds) with each
+ * debug output. Only need the lower 26 bits. This allows for 67
+ * million microseconds or 67 seconds before rollover.
+ *
+ * Convert 100 nanosecond units to microseconds
+ */
+ Timer = ((UINT32) AcpiOsGetTimer () / 10);
+ Timer &= 0x03FFFFFF;
+
+ AcpiOsPrintf ("[ACPI Debug T=0x%8.8X] %*s", Timer, Level, " ");
+ }
+ else
+ {
+ AcpiOsPrintf ("[ACPI Debug] %*s", Level, " ");
+ }
}
/* Display the index for package output only */
if (Index > 0)
{
- AcpiOsPrintf ("(%.2u) ", Index-1);
+ AcpiOsPrintf ("(%.2u) ", Index - 1);
}
if (!SourceDesc)
@@ -126,7 +152,13 @@ AcpiExDoDebugObject (
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND)
{
- AcpiOsPrintf ("%s ", AcpiUtGetObjectTypeName (SourceDesc));
+ /* No object type prefix needed for integers and strings */
+
+ if ((SourceDesc->Common.Type != ACPI_TYPE_INTEGER) &&
+ (SourceDesc->Common.Type != ACPI_TYPE_STRING))
+ {
+ AcpiOsPrintf ("%s ", AcpiUtGetObjectTypeName (SourceDesc));
+ }
if (!AcpiUtValidInternalObject (SourceDesc))
{
@@ -136,9 +168,9 @@ AcpiExDoDebugObject (
}
else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED)
{
- AcpiOsPrintf ("%s: %p\n",
+ AcpiOsPrintf ("%s (Node %p)\n",
AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type),
- SourceDesc);
+ SourceDesc);
return_VOID;
}
else
@@ -176,13 +208,12 @@ AcpiExDoDebugObject (
case ACPI_TYPE_STRING:
- AcpiOsPrintf ("[0x%.2X] \"%s\"\n",
- SourceDesc->String.Length, SourceDesc->String.Pointer);
+ AcpiOsPrintf ("\"%s\"\n", SourceDesc->String.Pointer);
break;
case ACPI_TYPE_PACKAGE:
- AcpiOsPrintf ("[Contains 0x%.2X Elements]\n",
+ AcpiOsPrintf ("(Contains 0x%.2X Elements):\n",
SourceDesc->Package.Count);
/* Output the entire contents of the package */
@@ -190,7 +221,7 @@ AcpiExDoDebugObject (
for (i = 0; i < SourceDesc->Package.Count; i++)
{
AcpiExDoDebugObject (SourceDesc->Package.Elements[i],
- Level+4, i+1);
+ Level + 4, i + 1);
}
break;
@@ -226,7 +257,7 @@ AcpiExDoDebugObject (
if (SourceDesc->Reference.Node)
{
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Node) !=
- ACPI_DESC_TYPE_NAMED)
+ ACPI_DESC_TYPE_NAMED)
{
AcpiOsPrintf (" %p - Not a valid namespace node\n",
SourceDesc->Reference.Node);
@@ -251,7 +282,7 @@ AcpiExDoDebugObject (
default:
AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
- Level+4, 0);
+ Level + 4, 0);
break;
}
}
@@ -259,23 +290,61 @@ AcpiExDoDebugObject (
else if (SourceDesc->Reference.Object)
{
if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) ==
- ACPI_DESC_TYPE_NAMED)
+ ACPI_DESC_TYPE_NAMED)
{
- AcpiExDoDebugObject (((ACPI_NAMESPACE_NODE *)
- SourceDesc->Reference.Object)->Object,
- Level+4, 0);
+ /* Reference object is a namespace node */
+
+ AcpiExDoDebugObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT,
+ SourceDesc->Reference.Object),
+ Level + 4, 0);
}
else
{
- AcpiExDoDebugObject (SourceDesc->Reference.Object,
- Level+4, 0);
+ ObjectDesc = SourceDesc->Reference.Object;
+ Value = SourceDesc->Reference.Value;
+
+ switch (ObjectDesc->Common.Type)
+ {
+ case ACPI_TYPE_BUFFER:
+
+ AcpiOsPrintf ("Buffer[%u] = 0x%2.2X\n",
+ Value, *SourceDesc->Reference.IndexPointer);
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ AcpiOsPrintf ("String[%u] = \"%c\" (0x%2.2X)\n",
+ Value, *SourceDesc->Reference.IndexPointer,
+ *SourceDesc->Reference.IndexPointer);
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+
+ AcpiOsPrintf ("Package[%u] = ", Value);
+ if (!(*SourceDesc->Reference.Where))
+ {
+ AcpiOsPrintf ("[Uninitialized Package Element]\n");
+ }
+ else
+ {
+ AcpiExDoDebugObject (*SourceDesc->Reference.Where,
+ Level+4, 0);
+ }
+ break;
+
+ default:
+
+ AcpiOsPrintf ("Unknown Reference object type %X\n",
+ ObjectDesc->Common.Type);
+ break;
+ }
}
}
break;
default:
- AcpiOsPrintf ("%p\n", SourceDesc);
+ AcpiOsPrintf ("(Descriptor %p)\n", SourceDesc);
break;
}
OpenPOWER on IntegriCloud