summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2015-02-05 20:04:29 +0200
committerVille Syrjälä <ville.syrjala@linux.intel.com>2015-03-24 15:30:20 +0200
commitbd692becf70acfe0829033f8a33680d3d54fcfb2 (patch)
treecdc23d05900d9c58408cc4d2b6188aaae0de7960
parentdcb3edf2a971b2c00cace8bf2c052f76c24af56b (diff)
tools/intel_iosf_sb_read: Add -c command line option like intel_reg_read
Add a command line option '-c <count>' that can be used to read set of consecutive registers without having to specify the offset for each of them. Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
-rw-r--r--tools/intel_iosf_sb_read.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/tools/intel_iosf_sb_read.c b/tools/intel_iosf_sb_read.c
index 48a22be7..2b0704ad 100644
--- a/tools/intel_iosf_sb_read.c
+++ b/tools/intel_iosf_sb_read.c
@@ -73,8 +73,9 @@ static void usage(const char *name)
int i;
printf("Warning : This program will work only on Valleyview/Cherryview\n"
- "Usage: %s [-h] [--] <port> <reg> [<reg> ...]\n"
+ "Usage: %s [-h] [-c <count>] [--] <port> <reg> [<reg> ...]\n"
"\t -h : Show this help text\n"
+ "\t -c <count> : how many consecutive registers to read\n"
"\t <port> : ", name);
for (i = 0; i < ARRAY_SIZE(iosf_sb_ports); i++)
printf("%s,", iosf_sb_ports[i].name);
@@ -86,7 +87,7 @@ int main(int argc, char *argv[])
{
uint32_t port, reg, val;
struct pci_device *dev = intel_get_pci_device();
- int i, nregs;
+ int i, nregs, count = 1;
const char *name;
if (!IS_VALLEYVIEW(dev->device_id) &&
@@ -105,6 +106,13 @@ int main(int argc, char *argv[])
case 'h':
usage(argv[0]);
return 0;
+ case 'c':
+ count = strtol(optarg, NULL, 0);
+ if (count < 1) {
+ usage(argv[0]);
+ return 3;
+ }
+ break;
}
}
@@ -121,10 +129,15 @@ int main(int argc, char *argv[])
intel_register_access_init(dev, 0);
for (; i < argc; i++) {
+ int j;
+
reg = strtoul(argv[i], NULL, 16);
- val = intel_iosf_sb_read(port, reg);
- printf("0x%02x(%s)/0x%04x : 0x%08x\n", port, name, reg, val);
+ for (j = 0; j < count; j++) {
+ val = intel_iosf_sb_read(port, reg);
+ printf("0x%02x(%s)/0x%04x : 0x%08x\n", port, name, reg, val);
+ reg += 4;
+ }
}
intel_register_access_fini();