diff options
-rw-r--r-- | drivers/fmc/fmc-sdb.c | 34 | ||||
-rw-r--r-- | include/linux/fmc-sdb.h | 2 |
2 files changed, 32 insertions, 4 deletions
diff --git a/drivers/fmc/fmc-sdb.c b/drivers/fmc/fmc-sdb.c index 69f42d70bc74..4603fdb74465 100644 --- a/drivers/fmc/fmc-sdb.c +++ b/drivers/fmc/fmc-sdb.c @@ -150,11 +150,27 @@ int fmc_reprogram(struct fmc_device *fmc, struct fmc_driver *d, char *gw, } EXPORT_SYMBOL(fmc_reprogram); +static char *__strip_trailing_space(char *buf, char *str, int len) +{ + int i = len - 1; + + memcpy(buf, str, len); + while(i >= 0 && buf[i] == ' ') + buf[i--] = '\0'; + return buf; +} + +#define __sdb_string(buf, field) ({ \ + BUILD_BUG_ON(sizeof(buf) < sizeof(field)); \ + __strip_trailing_space(buf, (void *)(field), sizeof(field)); \ + }) + static void __fmc_show_sdb_tree(const struct fmc_device *fmc, const struct sdb_array *arr) { unsigned long base = arr->baseaddr; int i, j, n = arr->len, level = arr->level; + char buf[64]; for (i = 0; i < n; i++) { union sdb_record *r; @@ -190,8 +206,8 @@ static void __fmc_show_sdb_tree(const struct fmc_device *fmc, p->name, __be64_to_cpu(c->addr_first) + base); if (IS_ERR(arr->subtree[i])) { - printk(KERN_CONT "(bridge error %li)\n", - PTR_ERR(arr->subtree[i])); + dev_info(&fmc->dev, "SDB: (bridge error %li)\n", + PTR_ERR(arr->subtree[i])); break; } __fmc_show_sdb_tree(fmc, arr->subtree[i]); @@ -200,10 +216,20 @@ static void __fmc_show_sdb_tree(const struct fmc_device *fmc, printk(KERN_CONT "integration\n"); break; case sdb_type_repo_url: - printk(KERN_CONT "repo-url\n"); + printk(KERN_CONT "Synthesis repository: %s\n", + __sdb_string(buf, r->repo_url.repo_url)); break; case sdb_type_synthesis: - printk(KERN_CONT "synthesis-info\n"); + printk(KERN_CONT "Bitstream '%s' ", + __sdb_string(buf, r->synthesis.syn_name)); + printk(KERN_CONT "synthesized %08x by %s ", + __be32_to_cpu(r->synthesis.date), + __sdb_string(buf, r->synthesis.user_name)); + printk(KERN_CONT "(%s version %x), ", + __sdb_string(buf, r->synthesis.tool_name), + __be32_to_cpu(r->synthesis.tool_version)); + printk(KERN_CONT "commit %pm\n", + r->synthesis.commit_id); break; case sdb_type_empty: printk(KERN_CONT "empty\n"); diff --git a/include/linux/fmc-sdb.h b/include/linux/fmc-sdb.h index 1974317a9b3d..599bd6bab56d 100644 --- a/include/linux/fmc-sdb.h +++ b/include/linux/fmc-sdb.h @@ -14,6 +14,8 @@ union sdb_record { struct sdb_bridge bridge; struct sdb_integration integr; struct sdb_empty empty; + struct sdb_synthesis synthesis; + struct sdb_repo_url repo_url; }; struct fmc_device; |