summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Maziarz <piotrx.maziarz@linux.intel.com>2022-05-26 17:20:55 +0200
committerPiotr Maziarz <piotrx.maziarz@linux.intel.com>2022-05-27 10:24:55 +0200
commit6195b95a7924babe302bef4e01f533097dcbc528 (patch)
treef4a38b80be339603a3eb7019a577b53b209c18ef
parent2ebfd748ceca8e8a84eeee22782e45be998dd0e8 (diff)
downloadacpica-6195b95a7924babe302bef4e01f533097dcbc528.tar.gz
iASL: NHLT: Fix compilation of optional undocumented fields
Since those fields are optional some combinations of them were causing unpredicted flow when compiling the table.
-rw-r--r--source/compiler/dttable2.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c
index 1798a963e..dbc1735b5 100644
--- a/source/compiler/dttable2.c
+++ b/source/compiler/dttable2.c
@@ -825,6 +825,7 @@ DtCompileNhlt (
ACPI_NHLT_FORMATS_CONFIG *FormatsConfig;
ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_D *ConfigSpecific;
ACPI_NHLT_DEVICE_INFO_COUNT *DeviceInfo;
+ ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B *Terminator;
/* Main table */
@@ -1088,7 +1089,7 @@ DtCompileNhlt (
* some non documeneted structure(s) yet to be processed. First, get
* the count of such structure(s).
*/
- if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length")))
+ if (*PFieldList && !(strcmp ((const char *) (*PFieldList)->Name, "Device Info struct count")))
{
/* Get the count of non documented structures */
@@ -1124,9 +1125,8 @@ DtCompileNhlt (
DtInsertSubtable (ParentTable, Subtable);
} /* for (j = 0; j < LinuxSpecificCount; j++) */
-
/* Undocumented data at the end of endpoint */
- if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length")))
+ if (*PFieldList && !(strcmp ((const char *) (*PFieldList)->Name, "Bytes")))
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt7b,
&Subtable);
@@ -1148,7 +1148,7 @@ DtCompileNhlt (
* All Endpoint Descriptors are completed.
* Do the table terminator specific config (not in NHLT spec, optional)
*/
- if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length")))
+ if (*PFieldList && !(strcmp ((const char *) (*PFieldList)->Name, "Capabilities Size")))
{
Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt5b,
&Subtable);
@@ -1160,15 +1160,20 @@ DtCompileNhlt (
ParentTable = DtPeekSubtable ();
DtInsertSubtable (ParentTable, Subtable);
- Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt3a,
- &Subtable);
- if (ACPI_FAILURE (Status))
+ Terminator = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B, Subtable->Buffer);
+
+ if (Terminator->CapabilitiesSize)
{
- return (Status);
- }
+ Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt3a,
+ &Subtable);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
- ParentTable = DtPeekSubtable ();
- DtInsertSubtable (ParentTable, Subtable);
+ ParentTable = DtPeekSubtable ();
+ DtInsertSubtable (ParentTable, Subtable);
+ }
}
return (AE_OK);