diff options
author | Robert Moore <Robert.Moore@intel.com> | 2022-01-27 13:36:40 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-27 13:36:40 -0800 |
commit | 3d944bdff041ce338da25573b27630fd79fad0fb (patch) | |
tree | dfdf05c1320aec46d1b8c41471b37aef4ff4bfaa | |
parent | 8dc9493cad9993440a7b0897a44489896693587a (diff) | |
parent | 339f99538713c4e7c9676fa9f59e9235b973e037 (diff) | |
download | acpica-3d944bdff041ce338da25573b27630fd79fad0fb.tar.gz |
Merge pull request #743 from pmaziarz/master
Improvements for NHLT
-rw-r--r-- | source/common/dmtbdump2.c | 107 | ||||
-rw-r--r-- | source/common/dmtbinfo2.c | 19 | ||||
-rw-r--r-- | source/compiler/dttable2.c | 60 | ||||
-rw-r--r-- | source/include/acdisasm.h | 1 | ||||
-rw-r--r-- | source/include/actbinfo.h | 6 | ||||
-rw-r--r-- | source/include/actbl2.h | 23 | ||||
-rw-r--r-- | source/tools/acpisrc/astable.c | 5 |
7 files changed, 97 insertions, 124 deletions
diff --git a/source/common/dmtbdump2.c b/source/common/dmtbdump2.c index 04f7139fe..b7f619fe6 100644 --- a/source/common/dmtbdump2.c +++ b/source/common/dmtbdump2.c @@ -1501,9 +1501,9 @@ AcpiDmDumpNhlt ( ACPI_NHLT_VENDOR_MIC_COUNT *MicCount; ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_A *DevSpecific; 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_INFO_COUNT *Count; + ACPI_NHLT_DEVICE_INFO *DeviceInfo; + ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B *Capabilities; /* Main table */ @@ -1757,12 +1757,12 @@ AcpiDmDumpNhlt ( if (CapabilitiesSize > 0) { - FormatSubtable = ACPI_ADD_PTR (ACPI_NHLT_FORMAT_CONFIG, Table, Offset); + UINT8* Capabilities = ACPI_ADD_PTR (UINT8, Table, Offset); /* Do the Capabilities array (of bytes) */ AcpiOsPrintf ("\n /* Specific_Config table #%u */\n", j+1); - FormatSubtable = ACPI_ADD_PTR (ACPI_NHLT_FORMAT_CONFIG, Table, Offset); - Status = AcpiDmDumpTable (TableLength, Offset, FormatSubtable, + + Status = AcpiDmDumpTable (TableLength, Offset, Capabilities, CapabilitiesSize, AcpiDmTableInfoNhlt3a); if (ACPI_FAILURE (Status)) { @@ -1776,76 +1776,58 @@ AcpiDmDumpNhlt ( /* * If we are not done with the current Endpoint yet, then there must be - * some Linux-specific structure(s) yet to be processed. First, get + * some non documented structure(s) yet to be processed. First, get * the count of such structure(s). */ if (Offset < EndpointEndOffset) { - AcpiOsPrintf ("\n /* Linux-specific structures (not part of NHLT spec) */\n"); - Count = ACPI_ADD_PTR (ACPI_NHLT_LINUX_SPECIFIC_COUNT, Table, Offset); + AcpiOsPrintf ("\n /* Structures that are not part of NHLT spec */\n"); + Count = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_INFO_COUNT, Table, Offset); Status = AcpiDmDumpTable (TableLength, Offset, Count, - sizeof (ACPI_NHLT_LINUX_SPECIFIC_COUNT), AcpiDmTableInfoNhlt7); + sizeof (ACPI_NHLT_DEVICE_INFO_COUNT), AcpiDmTableInfoNhlt7); if (ACPI_FAILURE (Status)) { return; } - 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; - } + Offset += sizeof (ACPI_NHLT_DEVICE_INFO_COUNT); - /* Variable number of linux-specific structures */ + /* Variable number of device 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); + DeviceInfo = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_INFO, Table, Offset); + AcpiOsPrintf ("\n /* Device Info structure #%u (not part of NHLT spec) */\n", j+1); /* - * Dump the following Linux-specific fields: + * Dump the following Device Info fields: * 1) Device ID * 2) Device Instance ID * 3) Device Port ID */ - Status = AcpiDmDumpTable (TableLength, Offset, LinuxData, - sizeof (ACPI_NHLT_LINUX_SPECIFIC_DATA), AcpiDmTableInfoNhlt7a); + Status = AcpiDmDumpTable (TableLength, Offset, DeviceInfo, + sizeof (ACPI_NHLT_DEVICE_INFO), AcpiDmTableInfoNhlt7a); if (ACPI_FAILURE (Status)) { return; } - 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_DEVICE_INFO); + } - 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. */ @@ -1858,17 +1840,30 @@ AcpiDmDumpNhlt ( * Done with all of the Endpoint Descriptors, Emit the table terminator * (if such a legacy structure is present -- not in NHLT specification) */ - if (Offset == TableLength - sizeof (ACPI_NHLT_TABLE_TERMINATOR)) + if (Offset < TableLength) { - LinuxData = ACPI_ADD_PTR (ACPI_NHLT_LINUX_SPECIFIC_DATA, Table, Offset); - AcpiOsPrintf ("\n /* Table terminator structure (not part of NHLT spec) */\n"); + Capabilities = ACPI_ADD_PTR (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B, Table, Offset); + AcpiOsPrintf ("\n/* Terminating specific config (not part of NHLT spec) */\n"); - Status = AcpiDmDumpTable (TableLength, Offset, LinuxData, - sizeof (ACPI_NHLT_TABLE_TERMINATOR), AcpiDmTableInfoNhlt8); + Status = AcpiDmDumpTable (TableLength, Offset, Capabilities, + sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B), AcpiDmTableInfoNhlt5b); if (ACPI_FAILURE (Status)) { return; } + Offset += sizeof (ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_B); + + if (Capabilities->CapabilitiesSize > 0) + { + UINT32 remainingBytes = TableLength - Offset; + UINT8* buffer = ACPI_ADD_PTR (UINT8, Table, Offset); + + if (remainingBytes != Capabilities->CapabilitiesSize) + AcpiOsPrintf ("\n/* Incorrect config size, should be %X, is %X */\n", + Capabilities->CapabilitiesSize, remainingBytes); + Status = AcpiDmDumpTable (TableLength, Offset, buffer, + remainingBytes, AcpiDmTableInfoNhlt3a); + } } return; diff --git a/source/common/dmtbinfo2.c b/source/common/dmtbinfo2.c index ab1b2634c..88ab9df44 100644 --- a/source/common/dmtbinfo2.c +++ b/source/common/dmtbinfo2.c @@ -1379,19 +1379,19 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt6[] = ACPI_DMT_TERMINATOR }; -/* Number of Linux-specific structures */ +/* Number of DeviceInfo structures */ ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7[] = { - {ACPI_DMT_UINT8, ACPI_NHLT7_OFFSET (StructureCount), "Linux-specific Count", 0}, + {ACPI_DMT_UINT8, ACPI_NHLT7_OFFSET (StructureCount), "Device Info struct count", 0}, ACPI_DMT_TERMINATOR }; -/* The Linux-specific structure */ +/* The DeviceInfo structure */ ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7a[] = { - {ACPI_DMT_BUF16, ACPI_NHLT7A_OFFSET (DeviceId), "Device ID", 0}, + {ACPI_DMT_UUID, ACPI_NHLT7A_OFFSET (DeviceId), "Device ID GUID", 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_TERMINATOR @@ -1399,16 +1399,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7a[] = ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt7b[] = { - {ACPI_DMT_BUF18, ACPI_NHLT7B_OFFSET (SpecificData), "Specific Data", 0}, - ACPI_DMT_TERMINATOR -}; - -/* Table terminator (may or may not be present) */ - -ACPI_DMTABLE_INFO AcpiDmTableInfoNhlt8[] = -{ - {ACPI_DMT_UINT32, ACPI_NHLT8_OFFSET (TerminatorValue), "Terminator Value", 0}, - {ACPI_DMT_UINT32, ACPI_NHLT8_OFFSET (TerminatorSignature), "Terminator Signature", 0}, + {ACPI_DMT_RAW_BUFFER, 0, "Bytes", 0}, ACPI_DMT_TERMINATOR }; diff --git a/source/compiler/dttable2.c b/source/compiler/dttable2.c index 854063611..33a246dfb 100644 --- a/source/compiler/dttable2.c +++ b/source/compiler/dttable2.c @@ -807,7 +807,7 @@ DtCompileNhlt ( UINT32 CapabilitiesSize; UINT8 ArrayType; UINT8 ConfigType; - UINT8 LinuxSpecificCount; + UINT8 DeviceInfoCount; UINT32 i; UINT32 j; ACPI_TABLE_NHLT_ENDPOINT_COUNT *MainTable; @@ -815,7 +815,7 @@ DtCompileNhlt ( ACPI_NHLT_VENDOR_MIC_COUNT *MicCount; ACPI_NHLT_FORMATS_CONFIG *FormatsConfig; ACPI_NHLT_DEVICE_SPECIFIC_CONFIG_D *ConfigSpecific; - ACPI_NHLT_LINUX_SPECIFIC_COUNT *LinuxSpecific; + ACPI_NHLT_DEVICE_INFO_COUNT *DeviceInfo; /* Main table */ @@ -1076,12 +1076,12 @@ DtCompileNhlt ( /* * If we are not done with the current Endpoint yet, then there must be - * some Linux-specific structure(s) yet to be processed. First, get + * 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"))) { - /* Get the count of Linux-specific structures */ + /* Get the count of non documented structures */ Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt7, &Subtable); @@ -1093,13 +1093,13 @@ DtCompileNhlt ( ParentTable = DtPeekSubtable (); DtInsertSubtable (ParentTable, Subtable); - LinuxSpecific = ACPI_CAST_PTR (ACPI_NHLT_LINUX_SPECIFIC_COUNT, Subtable->Buffer); - LinuxSpecificCount = LinuxSpecific->StructureCount; + DeviceInfo = ACPI_CAST_PTR (ACPI_NHLT_DEVICE_INFO_COUNT, Subtable->Buffer); + DeviceInfoCount = DeviceInfo->StructureCount; - for (j = 0; j < LinuxSpecificCount; j++) + for (j = 0; j < DeviceInfoCount; j++) { /* - * Compile the following Linux-specific fields: + * Compile the following Device Info fields: * 1) Device ID * 2) Device Instance ID * 3) Device Port ID @@ -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 (); @@ -1143,11 +1137,21 @@ DtCompileNhlt ( /* * All Endpoint Descriptors are completed. - * Do the table terminator structure (not in NHLT spec, optional) + * Do the table terminator specific config (not in NHLT spec, optional) */ if (*PFieldList && (strcmp ((const char *) (*PFieldList)->Name, "Descriptor Length"))) { - Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt8, + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt5b, + &Subtable); + if (ACPI_FAILURE (Status)) + { + return (Status); + } + + ParentTable = DtPeekSubtable (); + DtInsertSubtable (ParentTable, Subtable); + + Status = DtCompileTable (PFieldList, AcpiDmTableInfoNhlt3a, &Subtable); if (ACPI_FAILURE (Status)) { diff --git a/source/include/acdisasm.h b/source/include/acdisasm.h index 17d70d4e7..c3d429152 100644 --- a/source/include/acdisasm.h +++ b/source/include/acdisasm.h @@ -571,7 +571,6 @@ 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[]; extern ACPI_DMTABLE_INFO AcpiDmTableInfoPhat0[]; diff --git a/source/include/actbinfo.h b/source/include/actbinfo.h index 7402d97b1..ff7c0c15e 100644 --- a/source/include/actbinfo.h +++ b/source/include/actbinfo.h @@ -343,10 +343,8 @@ #define ACPI_NHLT6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NHLT_VENDOR_MIC_CONFIG,f) #define ACPI_NHLT6A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NHLT_VENDOR_MIC_COUNT,f) #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_NHLT7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NHLT_DEVICE_INFO_COUNT,f) +#define ACPI_NHLT7A_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NHLT_DEVICE_INFO,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 eaa2e243e..923c814ca 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -2102,34 +2102,21 @@ typedef struct acpi_nhlt_render_feedback_device_specific_config } ACPI_NHLT_RENDER_FEEDBACK_DEVICE_SPECIFIC_CONFIG; -/* Linux-specific structures */ +/* Non documented structures */ -typedef struct acpi_nhlt_linux_specific_count +typedef struct acpi_nhlt_device_info_count { UINT8 StructureCount; -} ACPI_NHLT_LINUX_SPECIFIC_COUNT; +} ACPI_NHLT_DEVICE_INFO_COUNT; -typedef struct acpi_nhlt_linux_specific_data +typedef struct acpi_nhlt_device_info { UINT8 DeviceId[16]; UINT8 DeviceInstanceId; UINT8 DevicePortId; -} 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; - UINT32 TerminatorSignature; - -} ACPI_NHLT_TABLE_TERMINATOR; +} ACPI_NHLT_DEVICE_INFO; /******************************************************************************* diff --git a/source/tools/acpisrc/astable.c b/source/tools/acpisrc/astable.c index 6cad24d0c..9bf1aa726 100644 --- a/source/tools/acpisrc/astable.c +++ b/source/tools/acpisrc/astable.c @@ -856,9 +856,8 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = { {"ACPI_NHLT_ENDPOINT_COUNT", SRC_TYPE_STRUCT}, {"ACPI_NHLT_FORMAT_CONFIG", SRC_TYPE_STRUCT}, {"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_DEVICE_INFO_COUNT", SRC_TYPE_STRUCT}, + {"ACPI_NHLT_DEVICE_INFO", 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}, |