diff mbox series

[1/2] acpi: mpam: test with resource specific data for interconnect location type

Message ID 20230626032958.64947-1-ivan.hu@canonical.com
State Accepted
Headers show
Series [1/2] acpi: mpam: test with resource specific data for interconnect location type | expand

Commit Message

ivanhu June 26, 2023, 3:29 a.m. UTC
BugLink: https://bugs.launchpad.net/fwts/+bug/2024551

The MPAM specification version 2.0 has a valid field Resource-specific data.
And the Interconnect Location type uses this field.
Therefore, it should be checked as well.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/acpi/mpam/mpam.c        | 10 ++++++++++
 src/lib/include/fwts_acpi.h | 13 +++++++++++++
 2 files changed, 23 insertions(+)
diff mbox series

Patch

diff --git a/src/acpi/mpam/mpam.c b/src/acpi/mpam/mpam.c
index 3c927602..caade74e 100644
--- a/src/acpi/mpam/mpam.c
+++ b/src/acpi/mpam/mpam.c
@@ -115,9 +115,19 @@  static int mpam_test1(fwts_framework *fw)
 					fwts_hexdump_data_prefix_all(fw, res_node->locator, "        ", sizeof(res_node->locator));
 					break;
 				case FWTS_MPAM_INTERCONNECT:
+					fwts_interconnect_locator_descriptor *intc_loc_des =
+							(fwts_interconnect_locator_descriptor *)res_node->locator;
+					fwts_interconnect_descriptor_table *intc_des_table = (table->data + intc_loc_des->intc_des_tbl_offset);
 					fwts_log_info_verbatim(fw, "      Interconnect locator:");
 					fwts_hexdump_data_prefix_all(fw, res_node->locator, "        ", sizeof(res_node->locator));
 					fwts_acpi_reserved_zero_array(fw, "MPAM", "Locator", res_node->locator + 8, 4, &passed);
+					fwts_log_info_verbatim(fw, "      Interconnect descriptor table:");
+					fwts_log_info_verbatim(fw, "        Signature:");
+					fwts_hexdump_data_prefix_all(fw, intc_des_table->signature, "          ", sizeof(intc_des_table->signature));
+					fwts_log_info_simp_int(fw, "        Number of descriptors:         ", intc_des_table->num_of_descriptors);
+					fwts_acpi_reserved_zero_array(fw, "MPAM", "reserved",
+						(uint8_t *)intc_des_table + sizeof(fwts_interconnect_descriptor_table) + 9,
+						3, &passed);
 					break;
 				case FWTS_MPAM_UNKNOWN:
 					fwts_log_info_verbatim(fw, "      Unknown locator:");
diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
index 297673a6..9c3aa9fd 100644
--- a/src/lib/include/fwts_acpi.h
+++ b/src/lib/include/fwts_acpi.h
@@ -2536,6 +2536,19 @@  typedef enum {
     FWTS_MPAM_UNKNOWN            = 0xFF
 } fwts_mpam_location_types;
 
+typedef struct
+{
+	uint8_t		signature[16];
+	uint32_t 	num_of_descriptors;
+} __attribute__ ((packed)) fwts_interconnect_descriptor_table;
+
+
+typedef struct
+{
+	uint64_t	intc_des_tbl_offset;
+	uint32_t 	reserved;
+} __attribute__ ((packed)) fwts_interconnect_locator_descriptor;
+
 typedef struct
 {
 	uint32_t	producer;