[i-g-t,2/2] tools/intel_reg: Print the potential port names in the help text

Submitted by Ville Syrjala on Sept. 9, 2015, 7:56 p.m.

Details

Message ID 1441828594-21958-2-git-send-email-ville.syrjala@linux.intel.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Ville Syrjala Sept. 9, 2015, 7:56 p.m.
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 tools/intel_reg.c      | 2 ++
 tools/intel_reg_spec.c | 9 +++++++++
 tools/intel_reg_spec.h | 1 +
 3 files changed, 12 insertions(+)

Patch hide | download patch | download mbox

diff --git a/tools/intel_reg.c b/tools/intel_reg.c
index fb3461f..26f908f 100644
--- a/tools/intel_reg.c
+++ b/tools/intel_reg.c
@@ -629,6 +629,8 @@  static int intel_reg_help(struct config *config, int argc, char *argv[])
 	printf("\n");
 	printf("REGISTER is defined as:\n");
         printf("  [(PORTNAME|PORTNUM|MMIO-OFFSET):](REGNAME|REGADDR)\n");
+	printf("PORTNAME is one of: ");
+	intel_reg_spec_print_ports();
 
 	printf("\n");
 	printf("OPTIONS common to most COMMANDS:\n");
diff --git a/tools/intel_reg_spec.c b/tools/intel_reg_spec.c
index b49e0dc..babc13c 100644
--- a/tools/intel_reg_spec.c
+++ b/tools/intel_reg_spec.c
@@ -343,3 +343,12 @@  void intel_reg_spec_free(struct reg *regs, size_t n)
 	}
 	free(regs);
 }
+
+void intel_reg_spec_print_ports(void)
+{
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(port_descs); i++)
+		printf(" %s%c", port_descs[i].name,
+		       i == ARRAY_SIZE(port_descs) - 1 ? '\n' : ',');
+}
diff --git a/tools/intel_reg_spec.h b/tools/intel_reg_spec.h
index 26e8252..dcb3143 100644
--- a/tools/intel_reg_spec.h
+++ b/tools/intel_reg_spec.h
@@ -73,5 +73,6 @@  ssize_t intel_reg_spec_file(struct reg **regs, const char *filename);
 void intel_reg_spec_free(struct reg *regs, size_t n);
 int intel_reg_spec_decode(char *buf, size_t bufsize, const struct reg *reg,
 			  uint32_t val, uint32_t devid);
+void intel_reg_spec_print_ports(void);
 
 #endif /* __INTEL_REG_SPEC_H__ */