[Pdbg] [PATCH 1/2] libpdbg: Check if scom controllers are exposed

Rashmica Gupta rashmica.g at gmail.com
Tue May 8 13:53:10 AEST 2018


On Tue, May 8, 2018 at 12:44 PM, Alistair Popple <alistair at popple.id.au> wrote:
> Thanks Rashmica!
>
> On Tuesday, 8 May 2018 10:11:25 AM AEST Rashmica Gupta wrote:
>> If CONFIG_SCOM_DEBUGFS is not set in the running kernel then
>> the scom controllers are not exposed and so using getscom
>> won't work. Add check for /sys/kernel/debug/powerpc/scom to
>> give a more useful error message.
>>
>> Signed-off-by: Rashmica Gupta <rashmica.g at gmail.com>
>> ---
>>  libpdbg/host.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/libpdbg/host.c b/libpdbg/host.c
>> index f43b355..cf71e5c 100644
>> --- a/libpdbg/host.c
>> +++ b/libpdbg/host.c
>> @@ -95,6 +95,13 @@ static int host_pib_probe(struct pdbg_target *target)
>>       if (chip_id == -1)
>>               goto out;
>>
>> +     /* This check should probably be done earlier */
>> +     if (access(XSCOM_BASE_PATH, F_OK) == -1)
>> +     {
>> +             fprintf(stderr, "Can not access %s. ", XSCOM_BASE_PATH);
>> +             fprintf(stderr, "Is CONFIG_SCOM_DEBUGFS set?\n");
>
> Looks good but we should add a `goto out;` here so that the probing fails.
> Ideally I'd like not to print anything in the probe/library functions but this
> makes error reporting hard so I am ok with it for the moment.

Could put it in handle_scoms()?

>I know Amitay was
> looking at improving the way we handle output/error reporting so we can figure
> it out then.
>
> - Alistair
>
>> +     }
>> +
>>       if (asprintf(&access_fn, "%s/%08d/access", XSCOM_BASE_PATH, chip_id) < 0)
>>               goto out;
>>
>>
>
>


More information about the Pdbg mailing list