Message ID | 20200430023440.225504-6-amitay@ozlabs.org |
---|---|
State | Accepted |
Headers | show |
Series | Add sbefifo backend | expand |
Thanks. Reviewed-by: Alistair Popple <alistair@popple.id.au> On Thursday, 30 April 2020 12:34:26 PM AEST Amitay Isaacs wrote: > When PDBG_BACKEND_DTB is specified, backend may not be set. This means > only the drivers registered with PDBG_DEFAULT_BACKEND will be loaded. > To be able to match backend specific drivers for targets in system tree, > use the backend specified in PDBG_BACKEND_DRIVER environment variable. > > Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> > --- > libpdbg/dtb.c | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) > > diff --git a/libpdbg/dtb.c b/libpdbg/dtb.c > index 70b7962..3b7a597 100644 > --- a/libpdbg/dtb.c > +++ b/libpdbg/dtb.c > @@ -76,8 +76,25 @@ static struct pdbg_dtb pdbg_dtb = { > * running on. */ > static enum pdbg_backend default_backend(void) > { > + const char *tmp; > int rc; > > + tmp = getenv("PDBG_BACKEND_DRIVER"); > + if (tmp) { > + if (!strcmp(tmp, "fsi")) > + return PDBG_BACKEND_FSI; > + else if (!strcmp(tmp, "i2c")) > + return PDBG_BACKEND_I2C; > + else if (!strcmp(tmp, "kernel")) > + return PDBG_BACKEND_KERNEL; > + else if (!strcmp(tmp, "fake")) > + return PDBG_BACKEND_FAKE; > + else if (!strcmp(tmp, "host")) > + return PDBG_BACKEND_HOST; > + else if (!strcmp(tmp, "cronus")) > + return PDBG_BACKEND_CRONUS; > + } > + > rc = access(XSCOM_BASE_PATH, F_OK); > if (rc == 0) /* PowerPC Host System */ > return PDBG_BACKEND_HOST; > @@ -313,6 +330,9 @@ struct pdbg_dtb *pdbg_default_dtb(void *system_fdt) > dtb->backend.fdt = NULL; > dtb->system.fdt = system_fdt; > > + if (!pdbg_backend) > + pdbg_backend = default_backend(); > + > fdt = getenv("PDBG_BACKEND_DTB"); > if (fdt) > mmap_dtb(fdt, false, &dtb->backend); > @@ -324,9 +344,6 @@ struct pdbg_dtb *pdbg_default_dtb(void *system_fdt) > if (dtb->backend.fdt && dtb->system.fdt) > goto done; > > - if (!pdbg_backend) > - pdbg_backend = default_backend(); > - > switch(pdbg_backend) { > case PDBG_BACKEND_HOST: > ppc_target(dtb);
diff --git a/libpdbg/dtb.c b/libpdbg/dtb.c index 70b7962..3b7a597 100644 --- a/libpdbg/dtb.c +++ b/libpdbg/dtb.c @@ -76,8 +76,25 @@ static struct pdbg_dtb pdbg_dtb = { * running on. */ static enum pdbg_backend default_backend(void) { + const char *tmp; int rc; + tmp = getenv("PDBG_BACKEND_DRIVER"); + if (tmp) { + if (!strcmp(tmp, "fsi")) + return PDBG_BACKEND_FSI; + else if (!strcmp(tmp, "i2c")) + return PDBG_BACKEND_I2C; + else if (!strcmp(tmp, "kernel")) + return PDBG_BACKEND_KERNEL; + else if (!strcmp(tmp, "fake")) + return PDBG_BACKEND_FAKE; + else if (!strcmp(tmp, "host")) + return PDBG_BACKEND_HOST; + else if (!strcmp(tmp, "cronus")) + return PDBG_BACKEND_CRONUS; + } + rc = access(XSCOM_BASE_PATH, F_OK); if (rc == 0) /* PowerPC Host System */ return PDBG_BACKEND_HOST; @@ -313,6 +330,9 @@ struct pdbg_dtb *pdbg_default_dtb(void *system_fdt) dtb->backend.fdt = NULL; dtb->system.fdt = system_fdt; + if (!pdbg_backend) + pdbg_backend = default_backend(); + fdt = getenv("PDBG_BACKEND_DTB"); if (fdt) mmap_dtb(fdt, false, &dtb->backend); @@ -324,9 +344,6 @@ struct pdbg_dtb *pdbg_default_dtb(void *system_fdt) if (dtb->backend.fdt && dtb->system.fdt) goto done; - if (!pdbg_backend) - pdbg_backend = default_backend(); - switch(pdbg_backend) { case PDBG_BACKEND_HOST: ppc_target(dtb);
When PDBG_BACKEND_DTB is specified, backend may not be set. This means only the drivers registered with PDBG_DEFAULT_BACKEND will be loaded. To be able to match backend specific drivers for targets in system tree, use the backend specified in PDBG_BACKEND_DRIVER environment variable. Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- libpdbg/dtb.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-)