[Pdbg] [PATCH v2 14/15] main: Convert getscom/putscom to use path based targeting

Alistair Popple alistair at popple.id.au
Tue Nov 13 16:09:49 AEDT 2018


On Friday, 9 November 2018 6:10:10 PM AEDT Amitay Isaacs wrote:
> +static bool scommable(struct pdbg_target *target)
>  {
> -	uint64_t value;
> -
> -	if (pib_read(target, *addr, &value))
> -		return 0;
> +	char *classname;
> 
> -	printf("p%d:0x%" PRIx64 " = 0x%016" PRIx64 "\n", index, *addr, value);
> +	classname = pdbg_target_class_name(target);
> +	if (!strcmp(classname, "pib") ||
> +	    !strcmp(classname, "core") ||
> +	    !strcmp(classname, "thread"))
> +		return true;

As we've discussed/agreed this is suboptimal but will work for the time being 
until we come up with a better solution.

> 
> -	return 1;
> +	return false;
>  }

<snip>

> +		/* TODO: Restore the <mask> functionality */

We really should fix that at some point :-) I will take a look at it once this 
series is done.

> +		if (pib_write(target, addr, data)) {
> +			printf("%s: failed\n", path);
> +			free(path);
> +			continue;
> +		}
> +
> +		count++;
> +	}
> +
> +	return count;
>  }
>  OPTCMD_DEFINE_CMD_WITH_ARGS(putscom, putscom, (ADDRESS, DATA,
> DEFAULT_DATA("0xffffffffffffffff"))); diff --git a/tests/test_hw_bmc.sh
> b/tests/test_hw_bmc.sh
> index 9bc1deb..d656a3f 100755
> --- a/tests/test_hw_bmc.sh
> +++ b/tests/test_hw_bmc.sh
> @@ -91,7 +91,7 @@ do_skip
>  test_run $PDBG -P fsi getcfam 0xc09
> 
>  test_result 0 <<EOF
> -p0:0xf000f = HEX16
> +/kernelfsi at 0/pib at 1000: 0xf000f = HEX16

As mentioned in the previous patch I think for the time being we should try 
and maintain the same output if possible. I suspect printing the full path 
will just be confusing so perhaps we could add it as an option?

Also I think we should print the complete translated SCOM address rather than 
the offset pdbg was called with. Thanks!

- Alistair

>  EOF
> 
>  do_skip




More information about the Pdbg mailing list