diff mbox

[i-g-t,5/5] intel_bios_reader: add dumping of i2c element in mipi sequence

Message ID 1450710356-9594-5-git-send-email-jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Dec. 21, 2015, 3:05 p.m. UTC
Due to the clever way the whole sequence block is specified without
forward compatibility, it's not possible to dump most blocks without
this.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 tools/intel_bios_reader.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
diff mbox

Patch

diff --git a/tools/intel_bios_reader.c b/tools/intel_bios_reader.c
index 7c3e1bcaa387..b31f648f0607 100644
--- a/tools/intel_bios_reader.c
+++ b/tools/intel_bios_reader.c
@@ -894,12 +894,35 @@  static const uint8_t *mipi_dump_gpio(const uint8_t *data)
 	return data;
 }
 
+static const uint8_t *mipi_dump_i2c(const uint8_t *data)
+{
+	uint8_t flags, index, bus, offset, len, i;
+	uint16_t address;
+
+	flags = *data++;
+	index = *data++;
+	bus = *data++;
+	address = *((uint16_t *) data);
+	data += 2;
+	offset = *data++;
+	len = *data++;
+
+	printf("\t\tSend I2C: Flags %02x, Index %02x, Bus %02x, Address %04x, Offset %02x, Length %u, Data",
+	       flags, index, bus, address, offset, len);
+	for (i = 0; i < len; i++)
+		printf(" %02x", *data++);
+	printf("\n");
+
+	return data;
+}
+
 typedef const uint8_t * (*fn_mipi_elem_dump)(const uint8_t *data);
 
 static const fn_mipi_elem_dump dump_elem[] = {
 	[MIPI_SEQ_ELEM_SEND_PKT] = mipi_dump_send_packet,
 	[MIPI_SEQ_ELEM_DELAY] = mipi_dump_delay,
 	[MIPI_SEQ_ELEM_GPIO] = mipi_dump_gpio,
+	[MIPI_SEQ_ELEM_I2C] = mipi_dump_i2c,
 };
 
 static const char * const seq_name[] = {