diff mbox

tools/intel_reg_read:Adding lib calls for CHT/VLV

Message ID 1422530180-18573-1-git-send-email-megha.i.nelogal@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

meghanelogal Jan. 29, 2015, 11:16 a.m. UTC
From: meghanelogal <megha.i.nelogal@intel.com>

Calling the library functions for reg read and write

Signed-off-by: meghanelogal <megha.i.nelogal@intel.com>
---
 tools/intel_reg_read.c |   17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
diff mbox

Patch

diff --git a/tools/intel_reg_read.c b/tools/intel_reg_read.c
index c550b02..bdff92c 100644
--- a/tools/intel_reg_read.c
+++ b/tools/intel_reg_read.c
@@ -48,13 +48,9 @@  static void bit_decode(uint32_t reg)
 
 static void dump_range(uint32_t start, uint32_t end)
 {
-	int i, reg = 0;
-	struct pci_device *dev = intel_get_pci_device();
-	if (IS_CHERRYVIEW(dev->device_id) || IS_VALLEYVIEW(dev->device_id))
-		reg = 0x180000;
+	int i;
 	for (i = start; i < end; i += 4)
-		printf("0x%X : 0x%X\n", i,
-		       *(volatile uint32_t *)((volatile char*)mmio + i + reg));
+		printf("0x%X : 0x%X\n", i, intel_register_read(i+0x180000));
 }
 
 static void usage(char *cmdname)
@@ -76,7 +72,6 @@  int main(int argc, char** argv)
 	int full_dump = 0;
 	int decode_bits = 0;
 	int dwords = 1;
-
 	while ((ch = getopt(argc, argv, "dfhc:")) != -1) {
 		switch(ch) {
 		case 'd':
@@ -132,13 +127,7 @@  int main(int argc, char** argv)
 			dump_range(reg, reg + (dwords * 4));
 
 			if (decode_bits) {
-				struct pci_device *dev = intel_get_pci_device();
-				if (IS_CHERRYVIEW(dev->device_id) ||
-						IS_VALLEYVIEW(dev->device_id)) {
-					reg += 0x180000;
-					bit_decode(*(volatile uint32_t *)
-						((volatile char*)mmio + reg));
-				}
+				bit_decode(intel_register_read(0x180000));
 			}
 		}
 	}