Skip to contentSkip to conversation

tools/intel_reg: enable quiet option for mmio

PATCH In review [email protected] 2 participants 2 messages Jul 19, 2016 – Aug 1, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/intel_reg: enable quiet option for mmio

From: Clint Taylor <[email protected]>

Skip decode options and formatting when the quiet option is used during mmio reads. Makes intel_reg usable by scripts to return MMIO values.

---
 tools/intel_reg.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/intel_reg.c +6 -1
index 73fbd6d..e869292 100644
@@ -202,7 +202,9 @@ static void dump_decode(struct config *config, struct reg *reg, uint32_t val)
 
 	if (reg->port_desc.port == PORT_MMIO) {
 		/* Omit port name for MMIO, optionally include MMIO offset. */
-		if (reg->mmio_offset)
+		if (config->verbosity < 0)
+			printf("0x%08x\n", val);
+		else if (reg->mmio_offset)
 			printf("%24s (0x%08x:0x%08x): 0x%08x%s",
 			       reg->name ?: "",
 			       reg->mmio_offset, reg->addr,
@@ -706,6 +708,9 @@ static int read_reg_spec(struct config *config)
 	struct stat st;
 	int r;
 
+	if (config->verbosity < 0)
+		goto builtin;
+
 	path = config->specfile;
 	if (!path)
 		path = getenv("INTEL_REG_SPEC");
Signature · 6 lines
2.1.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 15 lines · On Wed, 20 Jul 2016, [email protected] wrote:

From: Clint Taylor <[email protected]>

Skip decode options and formatting when the quiet option is used during mmio reads. Makes intel_reg usable by scripts to return MMIO values.

---
 tools/intel_reg.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tools/intel_reg.c +0 -0
index 73fbd6d..e869292 100644

tools/intel_reg.c static void dump_decode(struct config *config, struct reg *reg, uint32_t val) · line 206

Quoted 6 lines
tools/intel_reg.c +2 -1
@@ -202,7 +202,9 @@ static void dump_decode(struct config *config, struct reg *reg, uint32_t val)
 
 	if (reg->port_desc.port == PORT_MMIO) {
 		/* Omit port name for MMIO, optionally include MMIO offset. */
-		if (reg->mmio_offset)
+		if (config->verbosity < 0)
+			printf("0x%08x\n", val);

Please do not conflate verbosity with output format. Please add, say, --raw or --output=raw option instead.

tools/intel_reg.c static int read_reg_spec(struct config *config) · line 713

Quoted 11 lines
tools/intel_reg.c +4 -0
+		else if (reg->mmio_offset)
 			printf("%24s (0x%08x:0x%08x): 0x%08x%s",
 			       reg->name ?: "",
 			       reg->mmio_offset, reg->addr,
@@ -706,6 +708,9 @@ static int read_reg_spec(struct config *config)
 	struct stat st;
 	int r;
 
+	if (config->verbosity < 0)
+		goto builtin;
+

This is just wrong. Why should *verbosity* matter in the selection of spec file? Why should verbosity potentially *change* the interpretation of a register name?

BR,
Jani.

Quoted 3 lines
tools/intel_reg.c +0 -0
 	path = config->specfile;
 	if (!path)
 		path = getenv("INTEL_REG_SPEC");
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx