222
226
{"disable-irq", optional_argument, 0, OPT_DISABLE_IRQ },
223
227
{"acknowledge-irq", optional_argument, 0, OPT_ACK_IRQ },
224
228
{"wait-irq", optional_argument, 0, OPT_WAIT_IRQ },
229
{"set-dma-mask", required_argument, 0, OPT_SET_DMASK },
225
230
{"list-kernel-memory", optional_argument, 0, OPT_LIST_KMEM },
226
231
{"read-kernel-memory", required_argument, 0, OPT_READ_KMEM },
227
232
{"alloc-kernel-memory", required_argument, 0, OPT_ALLOC_KMEM },
239
244
{"verify", no_argument, 0, OPT_VERIFY },
240
245
{"multipacket", no_argument, 0, OPT_MULTIPACKET },
241
246
{"wait", no_argument, 0, OPT_WAIT },
247
{"version", no_argument, 0, OPT_VERSION },
242
248
{"help", no_argument, 0, OPT_HELP },
268
274
" -w <addr|dmaX|reg|prop> - Write Data/Register/Property\n"
269
275
" --benchmark <barX|dmaX> - Performance Evaluation\n"
270
276
" --reset - Reset board\n"
277
" --version - Version information\n"
271
278
" --help - Help message\n"
273
280
" Property/Register Modes:\n"
297
304
" --read-dma-buffer <dma:buf> - Read the specified buffer\n"
299
306
" Kernel Modes:\n"
307
" --set-dma-mask [bits] - Set DMA address width (DANGEROUS)\n"
300
308
" --list-kernel-memory [use] - List kernel buffers\n"
301
309
" --read-kernel-memory <blk> - Read the specified block of the kernel memory\n"
302
310
" block is specified as: use:block_number\n"
840
848
pcilib_free_register_info(handle, info);
851
void Version(pcilib_t *handle, const pcilib_model_description_t *model_info) {
852
const pcilib_driver_version_t *driver_version;
854
driver_version = pcilib_get_driver_version(handle);
856
printf("pcilib version: %u.%u.%u\n",
857
PCILIB_VERSION_GET_MAJOR(PCILIB_VERSION),
858
PCILIB_VERSION_GET_MINOR(PCILIB_VERSION),
859
PCILIB_VERSION_GET_MICRO(PCILIB_VERSION)
862
printf("driver version: %lu.%lu.%lu, interface: 0x%lx, registered ioctls: %lu\n",
863
PCILIB_VERSION_GET_MAJOR(driver_version->version),
864
PCILIB_VERSION_GET_MINOR(driver_version->version),
865
PCILIB_VERSION_GET_MICRO(driver_version->version),
866
driver_version->interface,
867
driver_version->ioctls
871
pcilib_version_t version = model_info->interface_version;
872
printf("Model: %s", handle->model);
874
printf(", version: %u.%u.%u\n",
875
PCILIB_VERSION_GET_MAJOR(version),
876
PCILIB_VERSION_GET_MINOR(version),
877
PCILIB_VERSION_GET_MICRO(version)
880
printf(" (embedded)\n");
884
if (model_info->dma) {
885
pcilib_version_t version = model_info->dma->api->version;
886
printf("DMA Engine: %s, version: %u.%u.%u\n", model_info->dma->name,
887
PCILIB_VERSION_GET_MAJOR(version),
888
PCILIB_VERSION_GET_MINOR(version),
889
PCILIB_VERSION_GET_MICRO(version)
843
894
void Info(pcilib_t *handle, const pcilib_model_description_t *model_info, const char *target) {
850
901
const pcilib_board_info_t *board_info = pcilib_get_board_info(handle);
851
902
const pcilib_pcie_link_info_t *link_info = pcilib_get_pcie_link_info(handle);
905
pcilib_device_state_t state;
853
907
path = getenv("PCILIB_PLUGIN_DIR");
854
908
if (!path) path = PCILIB_PLUGIN_DIR;
910
have_state = !pcilib_get_device_state(handle, &state);
857
913
printf("Vendor: %x, Device: %x, Bus: %x, Slot: %x, Function: %x, Model: %s\n", board_info->vendor_id, board_info->device_id, board_info->bus, board_info->slot, board_info->func, handle->model);
860
printf(" PCIe x%u (gen%u), DMA Payload: %u (of %u)\n", link_info->link_width, link_info->link_speed, 1<<link_info->payload, 1<<link_info->max_payload);
916
printf(" PCIe x%u (gen%u), DMA Payload: %u (of %u)", link_info->link_width, link_info->link_speed, 1<<link_info->payload, 1<<link_info->max_payload);
921
for (mask = state.dma_mask; mask&1; mask>>=1) bits++;
923
printf(", DMA Mask: ");
925
if (mask) printf("0x%lx", state.dma_mask);
926
else printf("%u bits", bits);
928
printf(", IOMMU: %s", state.iommu?"on":"off");
3207
3283
irq_source = itmp;
3287
if (mode != MODE_INVALID) Usage(argc, argv, "Multiple operations are not supported");
3288
mode = MODE_SET_DMASK;
3290
if ((!isnumber(optarg))||(sscanf(optarg, "%lu", &dma_mask) != 1)||(dma_mask<24)||(dma_mask>64))
3291
Usage(argc, argv, "Invalid DMA mask is specified (%s)", optarg);
3210
3293
case OPT_LIST_KMEM:
3211
3294
if (mode != MODE_INVALID) Usage(argc, argv, "Multiple operations are not supported");
3212
3295
mode = MODE_LIST_KMEM;
3799
3885
case MODE_WAIT_IRQ:
3800
3886
WaitIRQ(handle, model_info, irq_source, timeout);
3888
case MODE_SET_DMASK:
3889
pcilib_set_dma_mask(handle, dma_mask);
3802
3891
case MODE_LIST_KMEM:
3803
3892
if (use) DetailKMEM(handle, fpga_device, use, block);
3804
3893
else ListKMEM(handle, fpga_device);