summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Moore <Robert.Moore@intel.com>2021-12-17 09:41:35 -0800
committerRobert Moore <Robert.Moore@intel.com>2021-12-17 09:41:35 -0800
commit26f8c721fb01e4a26eec8c85dffcbe950d5e61a9 (patch)
tree4aa6e5c090ddffafa0f14548ec5b408082c5012a
parent7cbe9a680f59e39d7aaccbe6e2e75de9a877d523 (diff)
downloadacpica-26f8c721fb01e4a26eec8c85dffcbe950d5e61a9.tar.gz
iASL/NHLT table: add support for optional "Specific Data" field
for the optional Linux-specific structure that appears at the end of an Endpoint Descriptor.
-rw-r--r--source/common/dmtbdump2.c49
-rw-r--r--source/common/dmtbinfo2.c7
-rw-r--r--source/compiler/aslmessages.c2
-rw-r--r--source/compiler/dttable2.c35
-rw-r--r--source/include/acdisasm.h1
-rw-r--r--source/include/actbinfo.h1
-rw-r--r--source/include/actbl2.h7
-rw-r--r--source/tools/acpisrc/astable.c1
8 files changed, 94 insertions, 9 deletions
diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c
index a3bba16e5..04f7139fe 100644
--- a/source/common/dmtbdump2.c
+++ b/source/common/dmtbdump2.c
@@ -1503,6 +1503,7 @@ AcpiDmDumpNhlt (
ACPI_NHLT_FORMATS_CONFIG *FormatsConfig;
ACPI_NHLT_LINUX_SPECIFIC_COUNT *Count;
ACPI_NHLT_LINUX_SPECIFIC_DATA *LinuxData;
+ ACPI_NHLT_LINUX_SPECIFIC_DATA_B *LinuxDataB;
/* Main table */
@@ -1770,7 +1771,8 @@ AcpiDmDumpNhlt (
Offset += CapabilitiesSize; // + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B);
}
- }
+
+ } /* for (j = 0; j < FormatsCount; j++) */
/*
* If we are not done with the current Endpoint yet, then there must be
@@ -1789,14 +1791,32 @@ AcpiDmDumpNhlt (
}
Offset += sizeof (ACPI_NHLT_LINUX_SPECIFIC_COUNT);
+ if (Count->StructureCount > 1)
+ {
+ /*
+ * We currently cannot disassemble more than one
+ * Linux-Specific section, because we have no way of
+ * knowing whether the "Specific Data" part is present.
+ */
+ Count->StructureCount = 1;
+ fprintf (stderr, "%s %s\n", "Feature not supported:",
+ "Cannot disassemble more than one Linux-Specific structure");
+ return;
+ }
+
/* Variable number of linux-specific structures */
for (j = 0; j < Count->StructureCount; j++)
{
LinuxData = ACPI_ADD_PTR (ACPI_NHLT_LINUX_SPECIFIC_DATA, Table, Offset);
-
AcpiOsPrintf ("\n /* Linux-specific structure #%u (not part of NHLT spec) */\n", j+1);
+ /*
+ * Dump the following Linux-specific fields:
+ * 1) Device ID
+ * 2) Device Instance ID
+ * 3) Device Port ID
+ */
Status = AcpiDmDumpTable (TableLength, Offset, LinuxData,
sizeof (ACPI_NHLT_LINUX_SPECIFIC_DATA), AcpiDmTableInfoNhlt7a);
if (ACPI_FAILURE (Status))
@@ -1805,11 +1825,34 @@ AcpiDmDumpNhlt (
}
Offset += sizeof (ACPI_NHLT_LINUX_SPECIFIC_DATA);
+
+ /*
+ * Check that the current offset is not beyond the end of
+ * this endpoint descriptor. If it is not, we assume that
+ * the "Specific Data" field is present and valid. Note:
+ * This does not seem to be documented anywhere.
+ */
+ if (Offset < EndpointEndOffset)
+ {
+ /* Dump the linux-specific "Specific Data" field */
+
+ LinuxDataB = ACPI_ADD_PTR (ACPI_NHLT_LINUX_SPECIFIC_DATA_B, Table, Offset);
+ Status = AcpiDmDumpTable (TableLength, Offset, LinuxDataB,
+ sizeof (ACPI_NHLT_LINUX_SPECIFIC_DATA_B), AcpiDmTableInfoNhlt7b);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ Offset += sizeof (ACPI_NHLT_LINUX_SPECIFIC_DATA_B);
+ }
}
/* Should be at the end of the Endpoint structure. */
}
- }
+
+ } /* for (i = 0; i < EndpointCount; i++) */
+
/*
* Done with all of the Endpoint Descriptors, Emit the table terminator
diff --git a/source/common/dmtbinfo2.c b/source/common/dmtbinfo2.c
index 779a56412..ab1b2634c 100644
--- a/source/common/dmtbinfo2.c
+++ b/source/common/dmtbinfo2.c
@@ -1394,7 +1394,12 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7a[] =
{ACPI_DMT_BUF16, ACPI_NHLT7A_OFFSET (DeviceId), "Device ID", 0},
{ACPI_DMT_UINT8, ACPI_NHLT7A_OFFSET (DeviceInstanceId), "Device Instance ID", 0},
{ACPI_DMT_UINT8, ACPI_NHLT7A_OFFSET (DevicePortId), "Device Port ID", 0},
- {ACPI_DMT_BUF18, ACPI_NHLT7A_OFFSET (Filler), "Specific Data", 0},
+ ACPI_DMT_TERMINATOR
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7b[] =
+{
+ {ACPI_DMT_BUF18, ACPI_NHLT7B_OFFSET (SpecificData), "Specific Data", 0},
ACPI_DMT_TERMINATOR
};
diff --git a/source/compiler/aslmessages.c b/source/compiler/aslmessages.c
index 98c3b0ae5..ca50d2814 100644
--- a/source/compiler/aslmessages.c
+++ b/source/compiler/aslmessages.c
@@ -411,7 +411,7 @@ const char *AslTableCompilerMsgs [] =
/* ASL_MSG_UNKNOWN_FORMAT */ "Unknown format value",
/* ASL_MSG_RESERVED_VALUE */ "Value for field is reserved or unknown",
/* ASL_MSG_TWO_ZERO_VALUES */ "32-bit DSDT Address and 64-bit X_DSDT Address cannot both be zero",
-/* ASL_MSG_BAD_PARSE_TREE */ "Parse tree appears to be ill-defined",
+/* ASL_MSG_BAD_PARSE_TREE */ "Parse tree appears to be ill-defined"
};
/* Preprocessor */
diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c
index 25afbf1d0..854063611 100644
--- a/source/compiler/dttable2.c
+++ b/source/compiler/dttable2.c
@@ -967,7 +967,8 @@ DtCompileNhlt (
ArrayType = ConfigSpecific->ArrayType;
ConfigType = ConfigSpecific->ConfigType;
break;
- }
+
+ } /* switch (CapabilitiesSize) */
if (CapabilitiesSize >= 3)
{
@@ -1097,6 +1098,12 @@ DtCompileNhlt (
for (j = 0; j < LinuxSpecificCount; j++)
{
+ /*
+ * Compile the following Linux-specific fields:
+ * 1) Device ID
+ * 2) Device Instance ID
+ * 3) Device Port ID
+ */
Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt7a,
&Subtable);
if (ACPI_FAILURE (Status))
@@ -1106,14 +1113,36 @@ DtCompileNhlt (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
- }
+
+ /*
+ * To have a valid Linux-specific "Specific Data" at this
+ * point, we need:
+ * 1) The next field must be named "Specific Data"
+ */
+ if (!strcmp ((const char *) (*PFieldList)->Name, "Specific Data"))
+ {
+ /* Compile the "Specific Data" field */
+
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt7b,
+ &Subtable);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ }
+
+ } /* for (j = 0; j < LinuxSpecificCount; j++) */
}
DtPopSubtable ();
+
} /* for (i = 0; i < EndpointCount; i++) */
/*
- * All Endpoints are completed.
+ * All Endpoint Descriptors are completed.
* Do the table terminator structure (not in NHLT spec, optional)
*/
if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length")))
diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h
index ee354f36e..17d70d4e7 100644
--- a/source/include/acdisasm.h
+++ b/source/include/acdisasm.h
@@ -570,6 +570,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt6a[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt6b[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7a[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7b[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt8[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt9[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPhatHdr[];
diff --git a/source/include/actbinfo.h b/source/include/actbinfo.h
index b99da79d4..7402d97b1 100644
--- a/source/include/actbinfo.h
+++ b/source/include/actbinfo.h
@@ -345,6 +345,7 @@
#define ACPI_NHLT6B_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG,f)
#define ACPI_NHLT7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NHLT_LINUX_SPECIFIC_COUNT,f)
#define ACPI_NHLT7A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NHLT_LINUX_SPECIFIC_DATA,f)
+#define ACPI_NHLT7B_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NHLT_LINUX_SPECIFIC_DATA_B,f)
#define ACPI_NHLT8_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NHLT_TABLE_TERMINATOR,f)
#define ACPI_NHLT9_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION,f)
#define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f)
diff --git a/source/include/actbl2.h b/source/include/actbl2.h
index 4c6d64d4f..eaa2e243e 100644
--- a/source/include/actbl2.h
+++ b/source/include/actbl2.h
@@ -2115,10 +2115,15 @@ typedef struct acpi_nhlt_linux_specific_data
UINT8 DeviceId[16];
UINT8 DeviceInstanceId;
UINT8 DevicePortId;
- UINT8 Filler[18];
} ACPI_NHLT_LINUX_SPECIFIC_DATA;
+typedef struct acpi_nhlt_linux_specific_data_b
+{
+ UINT8 SpecificData[18];
+
+} ACPI_NHLT_LINUX_SPECIFIC_DATA_B;
+
typedef struct acpi_nhlt_table_terminator
{
UINT32 TerminatorValue;
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index 51e3de726..6cad24d0c 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -858,6 +858,7 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_NHLT_FORMATS_CONFIG", SRC_TYPE_STRUCT},
{"ACPI_NHLT_LINUX_SPECIFIC_COUNT", SRC_TYPE_STRUCT},
{"ACPI_NHLT_LINUX_SPECIFIC_DATA", SRC_TYPE_STRUCT},
+ {"ACPI_NHLT_LINUX_SPECIFIC_DATA_B", SRC_TYPE_STRUCT},
{"ACPI_NHLT_MIC_DEVICE_SPECIFIC_CONFIG", SRC_TYPE_STRUCT},
{"ACPI_NHLT_MIC_SNR_SENSITIVITY_EXTENSION",SRC_TYPE_STRUCT},
{"ACPI_NHLT_RENDER_DEVICE_SPECIFIC_CONFIG", SRC_TYPE_STRUCT},