Commit a36726d1 authored by Federico Vaga's avatar Federico Vaga

Merge branch 'release/v1.4.2'

parents 9837af6b 658e63ef
......@@ -2,6 +2,12 @@
Change Log
==========
[1.4.2] 2019-10-17
==================
Changed
-----
- [sw] show application metadata in debugfs
[1.4.1] 2019-10-15
==================
Fixed
......
......@@ -42,6 +42,16 @@ enum svec_fpga_meta_cap_mask {
SVEC_META_CAP_BLD = BIT(4),
};
static void svec_fpga_metadata_get(struct svec_meta_id *meta,
void __iomem *fpga)
{
uint32_t *meta_tmp = (uint32_t *)meta;
int i;
for (i = 0; i < sizeof(*meta) / 4; ++i)
meta_tmp[i] = ioread32be(fpga + (i * 4));
}
static const struct debugfs_reg32 svec_fpga_debugfs_reg32[] = {
{
.name = "Application offset",
......@@ -649,6 +659,9 @@ static int svec_fpga_app_init(struct svec_fpga *svec_fpga)
return 0;
}
svec_fpga_metadata_get(&svec_fpga->meta_app,
svec_fpga->fpga + app_offset);
res[0].start = vme_resource_start(vdev, fn) + app_offset;
res[0].end = vme_resource_end(vdev, fn);
......@@ -697,16 +710,6 @@ static void svec_fpga_app_exit(struct svec_fpga *svec_fpga)
}
}
static void svec_fpga_metadata_get(struct svec_meta_id *meta,
void __iomem *fpga)
{
uint32_t *meta_tmp = (uint32_t *)meta;
int i;
for (i = 0; i < sizeof(*meta) / 4; ++i)
meta_tmp[i] = ioread32be(fpga + SVEC_META_BASE + (i * 4));
}
static bool svec_fpga_is_valid(struct svec_dev *svec_dev,
struct svec_meta_id *meta)
{
......@@ -781,7 +784,8 @@ int svec_fpga_init(struct svec_dev *svec_dev, unsigned int function_nr)
goto err_map;
}
svec_fpga_metadata_get(&svec_dev->meta, svec_fpga->fpga);
svec_fpga_metadata_get(&svec_dev->meta,
svec_fpga->fpga + SVEC_META_BASE);
if (!svec_fpga_is_valid(svec_dev, &svec_dev->meta)) {
err = -EINVAL;
goto err_valid;
......
......@@ -108,31 +108,40 @@ static const struct file_operations svec_dbg_fw_ops = {
.write = svec_dbg_fw_write,
};
static int svec_dbg_meta(struct seq_file *s, void *offset)
static void seq_printf_meta(struct seq_file *s, const char *indent,
struct svec_meta_id *meta)
{
struct svec_dev *svec_dev = s->private;
struct svec_meta_id *meta;
meta = &svec_dev->meta;
seq_printf(s, "'%s':\n", dev_name(&svec_dev->vdev->dev));
seq_puts(s, "Metadata:\n");
seq_printf(s, " - Vendor: 0x%08x\n", meta->vendor);
seq_printf(s, " - Device: 0x%08x\n", meta->device);
seq_printf(s, " - Version: 0x%08x\n", meta->version);
seq_printf(s, " - BOM: 0x%08x\n", meta->bom);
seq_printf(s, " - SourceID: 0x%08x%08x%08x%08x\n",
seq_printf(s, "%sMetadata:\n", indent);
seq_printf(s, "%s - Vendor: 0x%08x\n", indent, meta->vendor);
seq_printf(s, "%s - Device: 0x%08x\n", indent, meta->device);
seq_printf(s, "%s - Version: 0x%08x\n", indent, meta->version);
seq_printf(s, "%s - BOM: 0x%08x\n", indent, meta->bom);
seq_printf(s, "%s - SourceID: 0x%08x%08x%08x%08x\n",
indent,
meta->src[0],
meta->src[1],
meta->src[2],
meta->src[3]);
seq_printf(s, " - CapabilityMask: 0x%08x\n", meta->cap);
seq_printf(s, " - VendorUUID: 0x%08x%08x%08x%08x\n",
seq_printf(s, "%s - CapabilityMask: 0x%08x\n", indent, meta->cap);
seq_printf(s, "%s - VendorUUID: 0x%08x%08x%08x%08x\n",
indent,
meta->uuid[0],
meta->uuid[1],
meta->uuid[2],
meta->uuid[3]);
}
static int svec_dbg_meta(struct seq_file *s, void *offset)
{
struct svec_dev *svec_dev = s->private;
seq_printf_meta(s, "", &svec_dev->meta);
if (!svec_dev->svec_fpga || !svec_dev->svec_fpga->app_pdev)
goto out;
seq_puts(s, "Application:\n");
seq_printf_meta(s, " ", &svec_dev->svec_fpga->meta_app);
out:
return 0;
}
......
......@@ -86,6 +86,7 @@ struct svec_meta_id {
struct svec_fpga {
struct device dev;
struct svec_meta_id meta_app;
unsigned int function_nr;
void __iomem *fpga;
struct platform_device *vic_pdev;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment