[PATCH] acpidump: update mchi to latest revision of MCHI specification

Colin King colin.king at canonical.com
Mon Jul 27 13:51:21 UTC 2015


From: Colin Ian King <colin.king at canonical.com>

This caters for the UID and PCI Device Number fields being aliased
into the same 4 bytes.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/acpi/acpidump/acpidump.c | 31 ++++++++++++++++++++++++-------
 src/lib/include/fwts_acpi.h  | 11 +++++------
 2 files changed, 29 insertions(+), 13 deletions(-)

diff --git a/src/acpi/acpidump/acpidump.c b/src/acpi/acpidump/acpidump.c
index 2bd2ce5..3dae3cd 100644
--- a/src/acpi/acpidump/acpidump.c
+++ b/src/acpi/acpidump/acpidump.c
@@ -2049,23 +2049,40 @@ static void acpidump_dbg2(fwts_framework *fw, const fwts_acpi_table_info *table)
  */
 static void acpidump_mchi(fwts_framework *fw, const fwts_acpi_table_info *table)
 {
-	static const fwts_acpidump_field mchi_fields[] = {
+	static const fwts_acpidump_field mchi_fields_pci_dev_flag0[] = {
 		FIELD_UINT("Interface Type", 		fwts_acpi_table_mchi, interface_type),
 		FIELD_UINT("Protocol Identifier", 	fwts_acpi_table_mchi, protocol_identifier),
-		FIELD_UINT("Protocol Data", 		fwts_acpi_table_mchi, protocol_data),
+		FIELD_UINTS("Protocol Data", 		fwts_acpi_table_mchi, protocol_data),
 		FIELD_UINT("Interrupt Type", 		fwts_acpi_table_mchi, interrupt_type),
 		FIELD_UINT("GPE", 			fwts_acpi_table_mchi, gpe),
 		FIELD_UINT("PCI Device Flag", 		fwts_acpi_table_mchi, pci_device_flag),
 		FIELD_UINT("Global System Interrupt",	fwts_acpi_table_mchi, global_system_interrupt),
 		FIELD_GAS ("Base Address", 		fwts_acpi_table_mchi, base_address),
-		FIELD_UINT("PCI Segment Group Number",	fwts_acpi_table_mchi, pci_segment_group_number),
-		FIELD_UINT("PCI Bus Number", 		fwts_acpi_table_mchi, pci_bus_number),
-		FIELD_UINT("PCI Device Number",  	fwts_acpi_table_mchi, pci_device_number),
-		FIELD_UINT("PCI Function Number", 	fwts_acpi_table_mchi, pci_function_number),
+		FIELD_UINTS("UID Bytes 1-4",		fwts_acpi_table_mchi, bytes),
 		FIELD_END
 	};
 
-	acpi_dump_table_fields(fw, table->data, mchi_fields, 0, table->length);
+	static const fwts_acpidump_field mchi_fields_pci_dev_flag1[] = {
+		FIELD_UINT("Interface Type", 		fwts_acpi_table_mchi, interface_type),
+		FIELD_UINT("Protocol Identifier", 	fwts_acpi_table_mchi, protocol_identifier),
+		FIELD_UINTS("Protocol Data", 		fwts_acpi_table_mchi, protocol_data),
+		FIELD_UINT("Interrupt Type", 		fwts_acpi_table_mchi, interrupt_type),
+		FIELD_UINT("GPE", 			fwts_acpi_table_mchi, gpe),
+		FIELD_UINT("PCI Device Flag", 		fwts_acpi_table_mchi, pci_device_flag),
+		FIELD_UINT("Global System Interrupt",	fwts_acpi_table_mchi, global_system_interrupt),
+		FIELD_GAS ("Base Address", 		fwts_acpi_table_mchi, base_address),
+		FIELD_UINT("PCI Segment Group Number",	fwts_acpi_table_mchi, bytes[0]),
+		FIELD_UINT("PCI Bus Number", 		fwts_acpi_table_mchi, bytes[1]),
+		FIELD_UINT("PCI Device Number",  	fwts_acpi_table_mchi, bytes[2]),
+		FIELD_UINT("PCI Function Number", 	fwts_acpi_table_mchi, bytes[3]),
+		FIELD_END
+	};
+
+	const fwts_acpi_table_mchi *mchi = (fwts_acpi_table_mchi *)table->data;
+	const fwts_acpidump_field *fields = (mchi->pci_device_flag & 1) ? 
+		mchi_fields_pci_dev_flag1 : mchi_fields_pci_dev_flag0;
+
+	acpi_dump_table_fields(fw, table->data, fields, 0, table->length);
 }
 
 
diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h
index 37cc879..b4a4ba2 100644
--- a/src/lib/include/fwts_acpi.h
+++ b/src/lib/include/fwts_acpi.h
@@ -900,22 +900,21 @@ typedef struct {
 } __attribute__ ((packed)) fwts_acpi_table_dbg2_info;
 
 /*
- *  http://www.dmtf.org/standards/published_documents/DSP0256_1.0.0.pdf
+ *  MCHI Management Controller Host Interface Table
+ *    http://www.dmtf.org/sites/default/files/standards/documents/DSP0256_1.0.0.pdf
  */
 typedef struct {
 	fwts_acpi_table_header	header;
 	uint8_t		interface_type;
 	uint8_t		protocol_identifier;
-	uint64_t	protocol_data;
+	uint8_t		protocol_data[8];
 	uint8_t		interrupt_type;
 	uint8_t		gpe;
 	uint8_t		pci_device_flag;
 	uint32_t	global_system_interrupt;
 	fwts_acpi_gas	base_address;
-	uint8_t		pci_segment_group_number;
-	uint8_t		pci_bus_number;
-	uint8_t		pci_device_number;
-	uint8_t		pci_function_number;
+	/* PCI Segment Group or  UID bytes */
+	uint8_t		bytes[4];
 } __attribute__ ((packed)) fwts_acpi_table_mchi;
 
 /*
-- 
2.4.6




More information about the fwts-devel mailing list