Skip to content

Commit 2e70efd

Browse files
rubinigregkh
authored andcommitted
FMC: show_sdb_tree: dump synthesis/commit ID info
This completes the show_sdb_tree functionality, with the new informative fields. The output for a verbose module is now like this (long lines are unavoidable): SDB: 00000651:e6a542c9 WB4-Crossbar-GSI SDB: 0000ce42:00000601 WB-DMA.Control (00001000-0000103f) SDB: 0000ce42:779c5443 WB-OneWire-Master (00001100-000011ff) SDB: 0000ce42:00000603 WB-SPEC-CSR (00001200-0000121f) SDB: 0000ce42:00000013 WB-VIC-Int.Control (00001300-000013ff) SDB: 0000ce42:d5735ab4 WB-DMA.EIC (00001400-0000140f) SDB: 00000651:eef0b198 WB4-Bridge-GSI (bridge: 00002000) SDB: 00000651:e6a542c9 WB4-Crossbar-GSI SDB: 0000ce42:123c5443 WB-I2C-Master (00003000-000030ff) SDB: 0000ce42:e503947e WB-SPI.Control (00003100-0000311f) SDB: 0000ce42:123c5443 WB-I2C-Master (00003200-000032ff) SDB: 0000ce42:00000608 WB-FMC-ADC-Core (00003300-0000337f) SDB: 0000ce42:779c5443 WB-OneWire-Master (00003400-000034ff) SDB: 0000ce42:26ec6086 WB-FMC-ADC.EIC (00003500-0000350f) SDB: 0000ce42:00000604 WB-Timetag-Core (00003600-0000367f) SDB: Synthesis repository: git://ohwr.org/fmc-projects/fmc-adc-100m14b4cha.git SDB: Bitstream 'spec_top_fmc_adcmc-projects/fmc-adc-100m14b4cha.git' \ synthesized 20140116 by mcattin (ISE version 133), commit f0a539dffe6d Signed-off-by: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> Acked-by: Alessandro Rubini <rubini@gnudd.com> Acked-by: Juan David Gonzalez Cobas <dcobas@cern.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5c9a873 commit 2e70efd

2 files changed

Lines changed: 32 additions & 4 deletions

File tree

‎drivers/fmc/fmc-sdb.c‎

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,27 @@ int fmc_reprogram(struct fmc_device *fmc, struct fmc_driver *d, char *gw,
150150
}
151151
EXPORT_SYMBOL(fmc_reprogram);
152152

153+
static char *__strip_trailing_space(char *buf, char *str, int len)
154+
{
155+
int i = len - 1;
156+
157+
memcpy(buf, str, len);
158+
while(i >= 0 && buf[i] == ' ')
159+
buf[i--] = '\0';
160+
return buf;
161+
}
162+
163+
#define __sdb_string(buf, field) ({ \
164+
BUILD_BUG_ON(sizeof(buf) < sizeof(field)); \
165+
__strip_trailing_space(buf, (void *)(field), sizeof(field)); \
166+
})
167+
153168
static void __fmc_show_sdb_tree(const struct fmc_device *fmc,
154169
const struct sdb_array *arr)
155170
{
156171
unsigned long base = arr->baseaddr;
157172
int i, j, n = arr->len, level = arr->level;
173+
char buf[64];
158174

159175
for (i = 0; i < n; i++) {
160176
union sdb_record *r;
@@ -190,8 +206,8 @@ static void __fmc_show_sdb_tree(const struct fmc_device *fmc,
190206
p->name,
191207
__be64_to_cpu(c->addr_first) + base);
192208
if (IS_ERR(arr->subtree[i])) {
193-
printk(KERN_CONT "(bridge error %li)\n",
194-
PTR_ERR(arr->subtree[i]));
209+
dev_info(&fmc->dev, "SDB: (bridge error %li)\n",
210+
PTR_ERR(arr->subtree[i]));
195211
break;
196212
}
197213
__fmc_show_sdb_tree(fmc, arr->subtree[i]);
@@ -200,10 +216,20 @@ static void __fmc_show_sdb_tree(const struct fmc_device *fmc,
200216
printk(KERN_CONT "integration\n");
201217
break;
202218
case sdb_type_repo_url:
203-
printk(KERN_CONT "repo-url\n");
219+
printk(KERN_CONT "Synthesis repository: %s\n",
220+
__sdb_string(buf, r->repo_url.repo_url));
204221
break;
205222
case sdb_type_synthesis:
206-
printk(KERN_CONT "synthesis-info\n");
223+
printk(KERN_CONT "Bitstream '%s' ",
224+
__sdb_string(buf, r->synthesis.syn_name));
225+
printk(KERN_CONT "synthesized %08x by %s ",
226+
__be32_to_cpu(r->synthesis.date),
227+
__sdb_string(buf, r->synthesis.user_name));
228+
printk(KERN_CONT "(%s version %x), ",
229+
__sdb_string(buf, r->synthesis.tool_name),
230+
__be32_to_cpu(r->synthesis.tool_version));
231+
printk(KERN_CONT "commit %pm\n",
232+
r->synthesis.commit_id);
207233
break;
208234
case sdb_type_empty:
209235
printk(KERN_CONT "empty\n");

‎include/linux/fmc-sdb.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ union sdb_record {
1414
struct sdb_bridge bridge;
1515
struct sdb_integration integr;
1616
struct sdb_empty empty;
17+
struct sdb_synthesis synthesis;
18+
struct sdb_repo_url repo_url;
1719
};
1820

1921
struct fmc_device;

0 commit comments

Comments
 (0)