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

ville.syrjala at linux.intel.com ville.syrjala at linux.intel.com
Wed Sep 9 12:56:34 PDT 2015


From: Ville Syrjälä <ville.syrjala at linux.intel.com>

Signed-off-by: Ville Syrjälä <ville.syrjala at 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(+)

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__ */
-- 
2.4.6



More information about the Intel-gfx mailing list