mirror of
https://github.com/acpica/acpica/
synced 2025-01-23 18:02:17 +03:00
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.
This commit is contained in:
parent
23a659e190
commit
961221a768
@ -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. */
|
||||
|
@ -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
|
||||
};
|
||||
|
||||
|
@ -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"))
|
||||
|
||||
/* 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))
|
||||
{
|
||||
/* Compile the "Specific Data" field */
|
||||
|
||||
Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt7b,
|
||||
&Subtable);
|
||||
if (ACPI_FAILURE (Status))
|
||||
{
|
||||
return (Status);
|
||||
}
|
||||
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
return (Status);
|
||||
}
|
||||
|
||||
} /* for (j = 0; j < LinuxSpecificCount; j++) */
|
||||
ParentTable = DtPeekSubtable ();
|
||||
DtInsertSubtable (ParentTable, Subtable);
|
||||
}
|
||||
}
|
||||
|
||||
DtPopSubtable ();
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
|
@ -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},
|
||||
|
Loading…
Reference in New Issue
Block a user