
ectool: Support for dumping EC "index ram"

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>


Index: util/ectool/ectool.c
===================================================================
--- util/ectool/ectool.c	(revision 5009)
+++ util/ectool/ectool.c	(working copy)
@@ -99,5 +99,14 @@
 	}
 	printf("\n\n");
 
+	printf("EC IDX RAM:\n");
+	for (i = 0; i < 0x10000; i++) {
+		if ((i % 0x10) == 0)
+			printf("\n%04x: ", i);
+		printf("%02x ", ec_idx_read(i));
+	}
+	printf("\n\n");
+
+
 	return 0;
 }
Index: util/ectool/ec.c
===================================================================
--- util/ectool/ec.c	(revision 5009)
+++ util/ectool/ec.c	(working copy)
@@ -114,3 +114,13 @@
 
 	return send_ec_data(data);
 }
+
+uint8_t ec_idx_read(uint16_t addr)
+{
+	uint16_t lpc_idx = 0x380;
+
+	outb(addr & 0xff, lpc_idx + 2);
+	outb(addr >> 8, lpc_idx + 1);
+	
+	return inb(lpc_idx + 3);
+}
Index: util/ectool/ec.h
===================================================================
--- util/ectool/ec.h	(revision 5009)
+++ util/ectool/ec.h	(working copy)
@@ -47,4 +47,5 @@
 uint8_t recv_ec_data(void);
 uint8_t ec_read(uint8_t addr);
 
+uint8_t ec_idx_read(uint16_t addr);
 #endif
