diff --git a/lib/mqnic/mqnic.c b/lib/mqnic/mqnic.c index 2991cab58..39715deb1 100644 --- a/lib/mqnic/mqnic.c +++ b/lib/mqnic/mqnic.c @@ -485,3 +485,22 @@ void mqnic_close(struct mqnic *dev) free(dev); } + +void mqnic_print_fw_id(struct mqnic *dev) +{ + printf("FPGA ID: 0x%08x\n", dev->fpga_id); + printf("FPGA part: %s\n", dev->fpga_part); + printf("FW ID: 0x%08x\n", dev->fw_id); + printf("FW version: %d.%d.%d.%d\n", dev->fw_ver >> 24, + (dev->fw_ver >> 16) & 0xff, + (dev->fw_ver >> 8) & 0xff, + dev->fw_ver & 0xff); + printf("Board ID: 0x%08x\n", dev->board_id); + printf("Board version: %d.%d.%d.%d\n", dev->board_ver >> 24, + (dev->board_ver >> 16) & 0xff, + (dev->board_ver >> 8) & 0xff, + dev->board_ver & 0xff); + printf("Build date: %s UTC (raw 0x%08x)\n", dev->build_date_str, dev->build_date); + printf("Git hash: %08x\n", dev->git_hash); + printf("Release info: %08x\n", dev->rel_info); +} diff --git a/lib/mqnic/mqnic.h b/lib/mqnic/mqnic.h index 7c0308ad1..9b85171cf 100644 --- a/lib/mqnic/mqnic.h +++ b/lib/mqnic/mqnic.h @@ -167,6 +167,7 @@ struct mqnic { // mqnic.c struct mqnic *mqnic_open(const char *dev_name); void mqnic_close(struct mqnic *dev); +void mqnic_print_fw_id(struct mqnic *dev); // mqnic_if.c struct mqnic_if *mqnic_if_open(struct mqnic *dev, int index, volatile uint8_t *regs); diff --git a/utils/mqnic-bmc.c b/utils/mqnic-bmc.c index 93a5487da..765d2777f 100644 --- a/utils/mqnic-bmc.c +++ b/utils/mqnic-bmc.c @@ -235,20 +235,7 @@ int main(int argc, char *argv[]) printf("PCIe ID: %s\n", ptr+1); } - printf("FPGA ID: 0x%08x\n", dev->fpga_id); - printf("FW ID: 0x%08x\n", dev->fw_id); - printf("FW version: %d.%d.%d.%d\n", dev->fw_ver >> 24, - (dev->fw_ver >> 16) & 0xff, - (dev->fw_ver >> 8) & 0xff, - dev->fw_ver & 0xff); - printf("Board ID: 0x%08x\n", dev->board_id); - printf("Board version: %d.%d.%d.%d\n", dev->board_ver >> 24, - (dev->board_ver >> 16) & 0xff, - (dev->board_ver >> 8) & 0xff, - dev->board_ver & 0xff); - printf("Build date: %08x\n", dev->build_date); - printf("Git hash: %08x\n", dev->git_hash); - printf("Release info: %08x\n", dev->rel_info); + mqnic_print_fw_id(dev); if ((bmc_rb = find_reg_block(dev->rb_list, MQNIC_RB_ALVEO_BMC_TYPE, MQNIC_RB_ALVEO_BMC_VER, 0))) { diff --git a/utils/mqnic-config.c b/utils/mqnic-config.c index 835ec44b7..988bc408e 100644 --- a/utils/mqnic-config.c +++ b/utils/mqnic-config.c @@ -152,20 +152,7 @@ int main(int argc, char *argv[]) printf("PCIe ID: %s\n", ptr+1); } - printf("FPGA ID: 0x%08x\n", dev->fpga_id); - printf("FW ID: 0x%08x\n", dev->fw_id); - printf("FW version: %d.%d.%d.%d\n", dev->fw_ver >> 24, - (dev->fw_ver >> 16) & 0xff, - (dev->fw_ver >> 8) & 0xff, - dev->fw_ver & 0xff); - printf("Board ID: 0x%08x\n", dev->board_id); - printf("Board version: %d.%d.%d.%d\n", dev->board_ver >> 24, - (dev->board_ver >> 16) & 0xff, - (dev->board_ver >> 8) & 0xff, - dev->board_ver & 0xff); - printf("Build date: %s UTC (raw 0x%08x)\n", dev->build_date_str, dev->build_date); - printf("Git hash: %08x\n", dev->git_hash); - printf("Release info: %08x\n", dev->rel_info); + mqnic_print_fw_id(dev); if (!dev->phc_rb) { diff --git a/utils/mqnic-dump.c b/utils/mqnic-dump.c index 822576f01..e93221c6e 100644 --- a/utils/mqnic-dump.c +++ b/utils/mqnic-dump.c @@ -118,20 +118,7 @@ int main(int argc, char *argv[]) printf(" type 0x%08x (v %d.%d.%d.%d)\n", rb->type, rb->version >> 24, (rb->version >> 16) & 0xff, (rb->version >> 8) & 0xff, rb->version & 0xff); - printf("FPGA ID: 0x%08x\n", dev->fpga_id); - printf("FW ID: 0x%08x\n", dev->fw_id); - printf("FW version: %d.%d.%d.%d\n", dev->fw_ver >> 24, - (dev->fw_ver >> 16) & 0xff, - (dev->fw_ver >> 8) & 0xff, - dev->fw_ver & 0xff); - printf("Board ID: 0x%08x\n", dev->board_id); - printf("Board version: %d.%d.%d.%d\n", dev->board_ver >> 24, - (dev->board_ver >> 16) & 0xff, - (dev->board_ver >> 8) & 0xff, - dev->board_ver & 0xff); - printf("Build date: %s UTC (raw 0x%08x)\n", dev->build_date_str, dev->build_date); - printf("Git hash: %08x\n", dev->git_hash); - printf("Release info: %08x\n", dev->rel_info); + mqnic_print_fw_id(dev); printf("IF offset: 0x%08x\n", dev->if_offset); printf("IF count: %d\n", dev->if_count); diff --git a/utils/mqnic-fw.c b/utils/mqnic-fw.c index c6a9c927f..5e53a6b7d 100644 --- a/utils/mqnic-fw.c +++ b/utils/mqnic-fw.c @@ -653,29 +653,7 @@ int main(int argc, char *argv[]) printf("PCIe ID (device): %s\n", strrchr(pci_device_path, '/')+1); printf("PCIe ID (upstream port): %s\n", strrchr(pci_port_path, '/')+1); - uint32_t flash_format = 0; - - uint8_t flash_configuration = 0; - uint8_t flash_data_width = 0; - uint8_t flash_default_segment = 0; - uint8_t flash_fallback_segment = 0; - uint32_t flash_segment0_length = 0; - - printf("FPGA ID: 0x%08x\n", dev->fpga_id); - printf("FPGA part: %s\n", dev->fpga_part); - printf("FW ID: 0x%08x\n", dev->fw_id); - printf("FW version: %d.%d.%d.%d\n", dev->fw_ver >> 24, - (dev->fw_ver >> 16) & 0xff, - (dev->fw_ver >> 8) & 0xff, - dev->fw_ver & 0xff); - printf("Board ID: 0x%08x\n", dev->board_id); - printf("Board version: %d.%d.%d.%d\n", dev->board_ver >> 24, - (dev->board_ver >> 16) & 0xff, - (dev->board_ver >> 8) & 0xff, - dev->board_ver & 0xff); - printf("Build date: %s UTC (raw 0x%08x)\n", dev->build_date_str, dev->build_date); - printf("Git hash: %08x\n", dev->git_hash); - printf("Release info: %08x\n", dev->rel_info); + mqnic_print_fw_id(dev); if (dev->fpga_id == 0 || dev->fpga_id == 0xffffffff) { @@ -684,6 +662,14 @@ int main(int argc, char *argv[]) goto skip_flash; } + uint32_t flash_format = 0; + + uint8_t flash_configuration = 0; + uint8_t flash_data_width = 0; + uint8_t flash_default_segment = 0; + uint8_t flash_fallback_segment = 0; + uint32_t flash_segment0_length = 0; + int bitswap = 0; int word_size = 8; int dual_qspi = 0;