Commit 084d7d25 authored by Lucas Russo's avatar Lucas Russo

dev_io/dev_io_core.c: add PCIe SDB print information

For now, only LLIO with PCIe endpoints are
supported.
parent 61a40a63
...@@ -410,28 +410,28 @@ devio_err_e devio_destroy (devio_t **self_p) ...@@ -410,28 +410,28 @@ devio_err_e devio_destroy (devio_t **self_p)
} }
/* FIXME: Only valid for PCIe devices */ /* FIXME: Only valid for PCIe devices */
#if 0
static int _devio_read_llio_block (struct sdbfs *fs, int offset, void *buf, static int _devio_read_llio_block (struct sdbfs *fs, int offset, void *buf,
int count) int count)
{ {
return llio_read_block (((devio_t *)fs->drvdata)->llio, return llio_read_block (((devio_t *)fs->drvdata)->llio,
BAR4_ADDR | (offset), count, (uint32_t *) buf); BAR4_ADDR | (offset), count, (uint32_t *) buf);
} }
#endif
/* Read specific information about the device. Typically, /* Read specific information about the device. Typically,
* this is stored in the SDB structure inside the device */ * this is stored in the SDB structure inside the device */
devio_err_e devio_print_info (devio_t *self) devio_err_e devio_print_info (devio_t *self)
{ {
(void) self; assert (self);
devio_err_e err = DEVIO_SUCCESS; devio_err_e err = DEVIO_SUCCESS;
/* FIXME: Only valid for PCIe devices */
#if 0 /* FIXME: Only valid for PCIe devices */
/* FIXME: Hardcoded non-default SDB address */ ASSERT_TEST (llio_get_type (self->llio) != PCIE_DEV,
#define SDB_ADDRESS 0x00300000UL "SDB is only supported for PCIe devices",
err_sdb_not_supp, DEVIO_ERR_FUNC_NOT_IMPL);
/* The sdb filesystem itself */ /* The sdb filesystem itself */
struct sdbfs bpm_fpga_sdb = { struct sdbfs devio_sdb = {
.name = "fpga-area", .name = "sdb-area",
.drvdata = (void *) self, .drvdata = (void *) self,
.blocksize = 1, /* Not currently used */ .blocksize = 1, /* Not currently used */
.entrypoint = SDB_ADDRESS, .entrypoint = SDB_ADDRESS,
...@@ -439,33 +439,20 @@ devio_err_e devio_print_info (devio_t *self) ...@@ -439,33 +439,20 @@ devio_err_e devio_print_info (devio_t *self)
.flags = 0, .flags = 0,
.read = _devio_read_llio_block .read = _devio_read_llio_block
}; };
struct sdb_device *d;
int new = 1;
int serr = sdbfs_dev_create(&bpm_fpga_sdb); int serr = sdbfs_dev_create (&devio_sdb);
ASSERT_TEST (serr == 0, "Could not create SDBFS", ASSERT_TEST (serr == 0, "Could not create SDBFS",
err_sdbfs_create, DEVIO_ERR_SMIO_DO_OP /* FIXME: temporary*/); err_sdbfs_create, DEVIO_ERR_SMIO_DO_OP);
while ( (d = sdbfs_scan(&bpm_fpga_sdb, new)) != NULL) { /* Print SDB */
/* sdbutils_do_list (&devio_sdb, 1);
* "%.19s" is not working for XINT printf, and zeroing
* d->sdb_component.product.record_type won't work, as /* Cleanup */
* the device is read straight from fpga ROM registers sdbfs_dev_destroy (&devio_sdb);
*/ return err;
const int namesize = sizeof(d->sdb_component.product.name);
char name[namesize + 1];
memcpy(name, d->sdb_component.product.name, sizeof(name));
name[namesize] = '\0';
DBE_DEBUG (DBG_DEV_IO | DBG_LVL_INFO, "dev 0x%08lx @ %06lx, %s\n",
(long)(d->sdb_component.product.device_id),
bpm_fpga_sdb.f_offset, name);
new = 0;
}
sdbfs_dev_destroy(&bpm_fpga_sdb);
err_sdbfs_create: err_sdbfs_create:
#endif err_sdb_not_supp:
return err; return err;
} }
......
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