From: meghanelogal <[email protected]>

Calling the library functions for reg read and write

Signed-off-by: meghanelogal <[email protected]>
---
 tools/intel_reg_read.c |   17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

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));
                        }
                }
        }
-- 
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to