summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Maziarz <piotrx.maziarz@linux.intel.com>2022-01-12 19:37:42 +0100
committerPiotr Maziarz <piotrx.maziarz@linux.intel.com>2022-01-13 19:25:39 +0100
commit961221a76814ffa0ecc92219ddf857579b0f7d54 (patch)
treece7a272aa1893a11a2c8a4e270e0bfd86d101cde
parent23a659e190cf3ed0edd46cddf12bbbcfeaa09396 (diff)
downloadacpica-961221a76814ffa0ecc92219ddf857579b0f7d54.tar.gz
iASL: NHLT: Fix parsing undocumented bytes at the end of Endpoint
Descriptor Undocumented bytes at the end of Endpoint Descriptor can be present independently of Linux-specific structures. Their size can also vary.
-rw-r--r--source/common/dmtbdump2.c49
-rw-r--r--source/common/dmtbinfo2.c2
-rw-r--r--source/compiler/dttable2.c30
-rw-r--r--source/include/actbinfo.h1
-rw-r--r--source/include/actbl2.h6
-rw-r--r--source/tools/acpisrc/astable.c1
6 files changed, 28 insertions, 61 deletions
diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c
index cc9003de8..9c3e5700a 100644
--- a/source/common/dmtbdump2.c
+++ b/source/common/dmtbdump2.c
@@ -1503,7 +1503,6 @@ 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;
ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B *Capabilities;
@@ -1793,19 +1792,6 @@ 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++)
@@ -1827,27 +1813,22 @@ 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);
- }
+ /*
+ * Check that the current offset is not beyond the end of
+ * this endpoint descriptor. If it is not, print those
+ * undocumented bytes.
+ */
+ if (Offset < EndpointEndOffset)
+ {
+ /* Unknown data at the end of the Endpoint */
+ UINT32 size = EndpointEndOffset - Offset;
+ UINT8* buffer = ACPI_ADD_PTR (UINT8, Table, Offset);
+ AcpiOsPrintf ("\n /* Unknown data at the end of the Endpoint, size: %X */\n", size);
+ Status = AcpiDmDumpTable (TableLength, Offset, buffer,
+ size, AcpiDmTableInfoNhlt7b);
+ Offset = EndpointEndOffset;
}
/* Should be at the end of the Endpoint structure. */
diff --git a/source/common/dmtbinfo2.c b/source/common/dmtbinfo2.c
index 23285910a..da6151f0c 100644
--- a/source/common/dmtbinfo2.c
+++ b/source/common/dmtbinfo2.c
@@ -1399,7 +1399,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7a[] =
ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7b[] =
{
- {ACPI_DMT_BUF18, ACPI_NHLT7B_OFFSET (SpecificData), "Specific Data", 0},
+ {ACPI_DMT_RAW_BUFFER, 0, "Bytes", 0},
ACPI_DMT_TERMINATOR
};
diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c
index f0481928d..81b2ed885 100644
--- a/source/compiler/dttable2.c
+++ b/source/compiler/dttable2.c
@@ -1113,28 +1113,22 @@ DtCompileNhlt (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
+ } /* for (j = 0; j < LinuxSpecificCount; j++) */
- /*
- * 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);
+ /* Undocumented data at the end of endpoint */
+ if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length")))
+ {
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt7b,
+ &Subtable);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
}
- } /* for (j = 0; j < LinuxSpecificCount; j++) */
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ }
}
DtPopSubtable ();
diff --git a/source/include/actbinfo.h b/source/include/actbinfo.h
index 23f49221b..f25d8cc44 100644
--- a/source/include/actbinfo.h
+++ b/source/include/actbinfo.h
@@ -345,7 +345,6 @@
#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_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)
#define ACPI_PCCT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED,f)
diff --git a/source/include/actbl2.h b/source/include/actbl2.h
index a43077cd9..7bbd39a44 100644
--- a/source/include/actbl2.h
+++ b/source/include/actbl2.h
@@ -2118,12 +2118,6 @@ typedef struct acpi_nhlt_linux_specific_data
} ACPI_NHLT_LINUX_SPECIFIC_DATA;
-typedef struct acpi_nhlt_linux_specific_data_b
-{
- UINT8 SpecificData[18];
-
-} ACPI_NHLT_LINUX_SPECIFIC_DATA_B;
-
/*******************************************************************************
*
diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c
index 6cad24d0c..51e3de726 100644
--- a/source/tools/acpisrc/astable.c
+++ b/source/tools/acpisrc/astable.c
@@ -858,7 +858,6 @@ 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},