[PATCH i-g-t 05/10] intel_reg_{read, write}: switch to INREG and OUTREG

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use INREG and OUTREG instead of using mmio directly.

Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
 tools/intel_reg_read.c  | 5 ++---
 tools/intel_reg_write.c | 8 +++-----
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/tools/intel_reg_read.c b/tools/intel_reg_read.c
index 3b9129148878..46fa664b9085 100644
--- a/tools/intel_reg_read.c
+++ b/tools/intel_reg_read.c
@@ -51,8 +51,7 @@ static void dump_range(uint32_t start, uint32_t end)
 	int i;
 
 	for (i = start; i < end; i += 4)
-		printf("0x%X : 0x%X\n", i,
-		       *(volatile uint32_t *)((volatile char*)mmio + i));
+		printf("0x%X : 0x%X\n", i, INREG(i));
 }
 
 static void usage(char *cmdname)
@@ -130,7 +129,7 @@ int main(int argc, char** argv)
 			dump_range(reg, reg + (dwords * 4));
 
 			if (decode_bits)
-				bit_decode(*(volatile uint32_t *)((volatile char*)mmio + reg));
+				bit_decode(INREG(reg));
 		}
 	}
 
diff --git a/tools/intel_reg_write.c b/tools/intel_reg_write.c
index ff4e561ee4ab..b0ddffeb6593 100644
--- a/tools/intel_reg_write.c
+++ b/tools/intel_reg_write.c
@@ -35,7 +35,6 @@
 int main(int argc, char** argv)
 {
 	uint32_t reg, value;
-	volatile uint32_t *ptr;
 
 	if (argc < 3) {
 		printf("Usage: %s addr value\n", argv[0]);
@@ -47,11 +46,10 @@ int main(int argc, char** argv)
 	intel_register_access_init(intel_get_pci_device(), 0);
 	sscanf(argv[1], "0x%x", &reg);
 	sscanf(argv[2], "0x%x", &value);
-	ptr = (volatile uint32_t *)((volatile char *)mmio + reg);
 
-	printf("Value before: 0x%X\n", *ptr);
-	*ptr = value;
-	printf("Value after: 0x%X\n", *ptr);
+	printf("Value before: 0x%X\n", INREG(reg));
+	OUTREG(reg, value);
+	printf("Value after: 0x%X\n", INREG(reg));
 
 	intel_register_access_fini();
 	return 0;
-- 
2.1.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx





[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux