summaryrefslogtreecommitdiffstats
path: root/source/components/disassembler/dmbuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/components/disassembler/dmbuffer.c')
-rw-r--r--source/components/disassembler/dmbuffer.c203
1 files changed, 171 insertions, 32 deletions
diff --git a/source/components/disassembler/dmbuffer.c b/source/components/disassembler/dmbuffer.c
index 973e269..afb0842 100644
--- a/source/components/disassembler/dmbuffer.c
+++ b/source/components/disassembler/dmbuffer.c
@@ -79,6 +79,51 @@ AcpiDmPldBuffer (
#define ACPI_BUFFER_BYTES_PER_LINE 8
+/* Strings for ToPld */
+
+static char *DmPanelList[] =
+{
+ "TOP",
+ "BOTTOM",
+ "LEFT",
+ "RIGHT",
+ "FRONT",
+ "BACK",
+ "UNKNOWN",
+ NULL
+};
+
+static char *DmVerticalPositionList[] =
+{
+ "UPPER",
+ "CENTER",
+ "LOWER",
+ NULL
+};
+
+static char *DmHorizontalPositionList[] =
+{
+ "LEFT",
+ "CENTER",
+ "RIGHT",
+ NULL
+};
+
+static char *DmShapeList[] =
+{
+ "ROUND",
+ "OVAL",
+ "SQUARE",
+ "VERTICALRECTANGLE",
+ "HORIZONTALRECTANGLE",
+ "VERTICALTRAPEZOID",
+ "HORIZONTALTRAPEZOID",
+ "UNKNOWN",
+ "CHAMFERED",
+ NULL
+};
+
+
/*******************************************************************************
*
* FUNCTION: AcpiDmDisasmByteList
@@ -232,8 +277,9 @@ AcpiDmByteList (
break;
case ACPI_DASM_PLD_METHOD:
-
+#if 0
AcpiDmDisasmByteList (Info->Level, ByteData, ByteCount);
+#endif
AcpiDmPldBuffer (Info->Level, ByteData, ByteCount);
break;
@@ -434,11 +480,12 @@ AcpiDmIsUnicodeBuffer (
return (FALSE);
}
- /* For each word, 1st byte must be ascii, 2nd byte must be zero */
+ /* For each word, 1st byte must be ascii (1-0x7F), 2nd byte must be zero */
for (i = 0; i < (ByteCount - 2); i += 2)
{
- if ((!ACPI_IS_PRINT (ByteData[i])) ||
+ if ((ByteData[i] == 0) ||
+ (ByteData[i] > 0x7F) ||
(ByteData[(ACPI_SIZE) i + 1] != 0))
{
return (FALSE);
@@ -534,9 +581,14 @@ AcpiDmIsPldBuffer (
ACPI_PARSE_OBJECT *Op)
{
ACPI_NAMESPACE_NODE *Node;
+ ACPI_PARSE_OBJECT *SizeOp;
ACPI_PARSE_OBJECT *ParentOp;
+ /* Buffer size is the buffer argument */
+
+ SizeOp = Op->Common.Value.Arg;
+
ParentOp = Op->Common.Parent;
if (!ParentOp)
{
@@ -551,6 +603,9 @@ AcpiDmIsPldBuffer (
if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))
{
+ /* Ignore the Size argument in the disassembly of this buffer op */
+
+ SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
return (TRUE);
}
@@ -573,6 +628,9 @@ AcpiDmIsPldBuffer (
if (ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__PLD))
{
+ /* Ignore the Size argument in the disassembly of this buffer op */
+
+ SizeOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
return (TRUE);
}
}
@@ -584,6 +642,51 @@ AcpiDmIsPldBuffer (
/*******************************************************************************
*
+ * FUNCTION: AcpiDmFindNameByIndex
+ *
+ * PARAMETERS: Index - Index of array to check
+ * List - Array to reference
+ *
+ * RETURN: String from List or empty string
+ *
+ * DESCRIPTION: Finds and returns the char string located at the given index
+ * position in List.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiDmFindNameByIndex (
+ UINT64 Index,
+ char **List)
+{
+ char *Str;
+ UINT32 i;
+
+
+ /* Bounds check */
+
+ Str = List[0];
+ i = 0;
+
+ while(Str)
+ {
+ i++;
+ Str = List[i];
+ }
+
+ if (Index >= i)
+ {
+ /* TBD: Add error msg */
+
+ return ("");
+ }
+
+ return (List[Index]);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDmPldBuffer
*
* PARAMETERS: Level - Current source code indentation level
@@ -596,9 +699,12 @@ AcpiDmIsPldBuffer (
*
******************************************************************************/
-#define ACPI_PLD_OUTPUT08 "%*.s/* %18s : %-6.2X */\n", ACPI_MUL_4 (Level), " "
-#define ACPI_PLD_OUTPUT16 "%*.s/* %18s : %-6.4X */\n", ACPI_MUL_4 (Level), " "
-#define ACPI_PLD_OUTPUT24 "%*.s/* %18s : %-6.6X */\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUT08 "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUT08P "%*.s%-18s = 0x%X)\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUT16 "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUT16P "%*.s%-18s = 0x%X)\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUT24 "%*.s%-18s = 0x%X,\n", ACPI_MUL_4 (Level), " "
+#define ACPI_PLD_OUTPUTSTR "%*.s%-18s = \"%s\",\n", ACPI_MUL_4 (Level), " "
static void
AcpiDmPldBuffer (
@@ -625,47 +731,63 @@ AcpiDmPldBuffer (
return;
}
+ AcpiOsPrintf ("\n");
+
/* First 32-bit dword */
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Revision", PldInfo->Revision);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "IgnoreColor", PldInfo->IgnoreColor);
- AcpiOsPrintf (ACPI_PLD_OUTPUT24,"Color", PldInfo->Color);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Revision", PldInfo->Revision);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_IgnoreColor", PldInfo->IgnoreColor);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Red", PldInfo->Red);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Green", PldInfo->Green);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Blue", PldInfo->Blue);
/* Second 32-bit dword */
- AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Width", PldInfo->Width);
- AcpiOsPrintf (ACPI_PLD_OUTPUT16,"Height", PldInfo->Height);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_Width", PldInfo->Width);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_Height", PldInfo->Height);
/* Third 32-bit dword */
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "UserVisible", PldInfo->UserVisible);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Dock", PldInfo->Dock);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Lid", PldInfo->Lid);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Panel", PldInfo->Panel);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "VerticalPosition", PldInfo->VerticalPosition);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "HorizontalPosition", PldInfo->HorizontalPosition);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Shape", PldInfo->Shape);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "GroupOrientation", PldInfo->GroupOrientation);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "GroupToken", PldInfo->GroupToken);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "GroupPosition", PldInfo->GroupPosition);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Bay", PldInfo->Bay);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_UserVisible", PldInfo->UserVisible);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Dock", PldInfo->Dock);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Lid", PldInfo->Lid);
+ AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Panel",
+ AcpiDmFindNameByIndex(PldInfo->Panel, DmPanelList));
+ AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_VerticalPosition",
+ AcpiDmFindNameByIndex(PldInfo->VerticalPosition, DmVerticalPositionList));
+ AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_HorizontalPosition",
+ AcpiDmFindNameByIndex(PldInfo->HorizontalPosition, DmHorizontalPositionList));
+ AcpiOsPrintf (ACPI_PLD_OUTPUTSTR, "PLD_Shape",
+ AcpiDmFindNameByIndex(PldInfo->Shape, DmShapeList));
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupOrientation", PldInfo->GroupOrientation);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupToken", PldInfo->GroupToken);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_GroupPosition", PldInfo->GroupPosition);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Bay", PldInfo->Bay);
/* Fourth 32-bit dword */
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Ejectable", PldInfo->Ejectable);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "OspmEjectRequired", PldInfo->OspmEjectRequired);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "CabinetNumber", PldInfo->CabinetNumber);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "CardCageNumber", PldInfo->CardCageNumber);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Reference", PldInfo->Reference);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Rotation", PldInfo->Rotation);
- AcpiOsPrintf (ACPI_PLD_OUTPUT08, "Order", PldInfo->Order);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Ejectable", PldInfo->Ejectable);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_EjectRequired", PldInfo->OspmEjectRequired);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_CabinetNumber", PldInfo->CabinetNumber);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_CardCageNumber", PldInfo->CardCageNumber);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Reference", PldInfo->Reference);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Rotation", PldInfo->Rotation);
+
+ if (ByteCount < ACPI_PLD_REV1_BUFFER_SIZE)
+ {
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08P, "PLD_Order", PldInfo->Order);
+ }
+ else
+ {
+ AcpiOsPrintf (ACPI_PLD_OUTPUT08, "PLD_Order", PldInfo->Order);
+ }
/* Fifth 32-bit dword */
if (ByteCount >= ACPI_PLD_REV1_BUFFER_SIZE)
{
- AcpiOsPrintf (ACPI_PLD_OUTPUT16,"VerticalOffset", PldInfo->VerticalOffset);
- AcpiOsPrintf (ACPI_PLD_OUTPUT16,"HorizontalOffset", PldInfo->HorizontalOffset);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT16, "PLD_VerticalOffset", PldInfo->VerticalOffset);
+ AcpiOsPrintf (ACPI_PLD_OUTPUT16P, "PLD_HorizontalOffset", PldInfo->HorizontalOffset);
}
ACPI_FREE (PldInfo);
@@ -692,6 +814,7 @@ AcpiDmUnicode (
UINT16 *WordData;
UINT32 WordCount;
UINT32 i;
+ int OutputValue;
/* Extract the buffer info as a WORD buffer */
@@ -704,7 +827,23 @@ AcpiDmUnicode (
AcpiOsPrintf ("\"");
for (i = 0; i < (WordCount - 1); i++)
{
- AcpiOsPrintf ("%c", (int) WordData[i]);
+ OutputValue = (int) WordData[i];
+
+ /* Handle values that must be escaped */
+
+ if ((OutputValue == '\"') ||
+ (OutputValue == '\\'))
+ {
+ AcpiOsPrintf ("\\%c", OutputValue);
+ }
+ else if (!ACPI_IS_PRINT (OutputValue))
+ {
+ AcpiOsPrintf ("\\x%2.2X", OutputValue);
+ }
+ else
+ {
+ AcpiOsPrintf ("%c", OutputValue);
+ }
}
AcpiOsPrintf ("\")");
OpenPOWER on IntegriCloud