Blame tools/fpgainfo/errors.c

Packit 534379
// Copyright(c) 2018-2020, Intel Corporation
Packit 534379
//
Packit 534379
// Redistribution  and  use  in source  and  binary  forms,  with  or  without
Packit 534379
// modification, are permitted provided that the following conditions are met:
Packit 534379
//
Packit 534379
// * Redistributions of  source code  must retain the  above copyright notice,
Packit 534379
//   this list of conditions and the following disclaimer.
Packit 534379
// * Redistributions in binary form must reproduce the above copyright notice,
Packit 534379
//   this list of conditions and the following disclaimer in the documentation
Packit 534379
//   and/or other materials provided with the distribution.
Packit 534379
// * Neither the name  of Intel Corporation  nor the names of its contributors
Packit 534379
//   may be used to  endorse or promote  products derived  from this  software
Packit 534379
//   without specific prior written permission.
Packit 534379
//
Packit 534379
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Packit 534379
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,  BUT NOT LIMITED TO,  THE
Packit 534379
// IMPLIED WARRANTIES OF  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
Packit 534379
// ARE DISCLAIMED.  IN NO EVENT  SHALL THE COPYRIGHT OWNER  OR CONTRIBUTORS BE
Packit 534379
// LIABLE  FOR  ANY  DIRECT,  INDIRECT,  INCIDENTAL,  SPECIAL,  EXEMPLARY,  OR
Packit 534379
// CONSEQUENTIAL  DAMAGES  (INCLUDING,  BUT  NOT LIMITED  TO,  PROCUREMENT  OF
Packit 534379
// SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE,  DATA, OR PROFITS;  OR BUSINESS
Packit 534379
// INTERRUPTION)  HOWEVER CAUSED  AND ON ANY THEORY  OF LIABILITY,  WHETHER IN
Packit 534379
// CONTRACT,  STRICT LIABILITY,  OR TORT  (INCLUDING NEGLIGENCE  OR OTHERWISE)
Packit 534379
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,  EVEN IF ADVISED OF THE
Packit 534379
// POSSIBILITY OF SUCH DAMAGE.
Packit 534379
/*
Packit 534379
 * @file errors.c
Packit 534379
 *
Packit 534379
 * @brief fpga error reporting
Packit 534379
 *
Packit 534379
 */
Packit 534379
#include <getopt.h>
Packit 534379
#include <stdbool.h>
Packit 534379
#include <stdio.h>
Packit 534379
#include <string.h>
Packit 534379
#include <stdlib.h>
Packit 534379
#include <inttypes.h>
Packit 534379
Packit 534379
#include "fpgainfo.h"
Packit 534379
#include <opae/properties.h>
Packit 534379
#include "errors.h"
Packit 534379
Packit 534379
#define FPGA_BIT_IS_SET(val, index) (((val) >> (index)) & 1)
Packit 534379
Packit 534379
const char *supported_verbs[] = {"all", "fme", "port"};
Packit 534379
enum verbs_index { VERB_ALL = 0, VERB_FME, VERB_PORT, VERB_MAX };
Packit 534379
Packit 534379
#define FME_ERROR_COUNT 7
Packit 534379
static const char *const FME_ERROR[FME_ERROR_COUNT] = {
Packit 534379
	"Fabric error detected",
Packit 534379
	"Fabric fifo under / overflow error detected",
Packit 534379
	"KTI CDC Parity Error detected",
Packit 534379
	"KTI CDC Parity Error detected",
Packit 534379
	"IOMMU Parity error detected",
Packit 534379
	"AFU PF/VF access mismatch detected",
Packit 534379
	"Indicates an MBP event error detected"};
Packit 534379
Packit 534379
#define PCIE0_ERROR_COUNT 10
Packit 534379
static const char *const PCIE0_ERROR[PCIE0_ERROR_COUNT] = {
Packit 534379
	"TLP format/type error detected",   "TTLP MW address error detected",
Packit 534379
	"TLP MW length error detected",     "TLP MR address error detected",
Packit 534379
	"TLP MR length error detected",     "TLP CPL tag error detected",
Packit 534379
	"TLP CPL status error detected",    "TLP CPL timeout error detected",
Packit 534379
	"CCI bridge parity error detected", "TLP with EP  error  detected"};
Packit 534379
Packit 534379
#define PCIE1_ERROR_COUNT 10
Packit 534379
static const char *const PCIE1_ERROR[PCIE1_ERROR_COUNT] = {
Packit 534379
	"TLP format/type error detected",   "TTLP MW address error detected",
Packit 534379
	"TLP MW length error detected",     "TLP MR address error detected",
Packit 534379
	"TLP MR length error detected",     "TLP CPL tag error detected",
Packit 534379
	"TLP CPL status error detected",    "TLP CPL timeout error detected",
Packit 534379
	"CCI bridge parity error detected", "TLP with EP  error  detected"};
Packit 534379
Packit 534379
#define NONFATAL_ERROR_COUNT 13
Packit 534379
static const char *const NONFATAL_ERROR[NONFATAL_ERROR_COUNT] = {
Packit 534379
	"Temperature threshold triggered AP1 detected",
Packit 534379
	"Temperature threshold triggered AP2 detected",
Packit 534379
	"PCIe error detected",
Packit 534379
	"AFU port Fatal error detected",
Packit 534379
	"ProcHot event error detected",
Packit 534379
	"AFU PF/VF access mismatch error detected",
Packit 534379
	"Injected Warning Error detected",
Packit 534379
	"Reserved",
Packit 534379
	"Reserved",
Packit 534379
	"Temperature threshold triggered AP6 detected",
Packit 534379
	"Power threshold triggered AP1 error detected",
Packit 534379
	"Power threshold triggered AP2 error detected",
Packit 534379
	"MBP event error detected"};
Packit 534379
Packit 534379
#define CATFATAL_ERROR_COUNT 12
Packit 534379
static const char *const CATFATAL_ERROR[CATFATAL_ERROR_COUNT] = {
Packit 534379
	"KTI link layer error detected.",
Packit 534379
	"tag-n-cache error detected.",
Packit 534379
	"CCI error detected.",
Packit 534379
	"KTI protocol error detected.",
Packit 534379
	"Fatal DRAM error detected",
Packit 534379
	"IOMMU fatal parity error detected.",
Packit 534379
	"Fabric fatal error detected",
Packit 534379
	"Poison error from any of PCIe ports detected",
Packit 534379
	"Injected Fatal Error detected",
Packit 534379
	"Catastrophic CRC error detected",
Packit 534379
	"Catastrophic thermal runaway event detected",
Packit 534379
	"Injected Catastrophic Error detected"};
Packit 534379
Packit 534379
#define INJECT_ERROR_COUNT 3
Packit 534379
static const char *const INJECT_ERROR[INJECT_ERROR_COUNT] = {
Packit 534379
	"Set Catastrophic  error .", "Set Fatal error.",
Packit 534379
	"Ser Non-fatal error ."};
Packit 534379
Packit 534379
#define PORT_ERROR_COUNT 60
Packit 534379
static const char *const PORT_ERROR[PORT_ERROR_COUNT] = {
Packit 534379
	// 0
Packit 534379
	"Tx Channel 0 overflow error detected.",
Packit 534379
	"Tx Channel 0 invalid request encoding error detected.",
Packit 534379
	"Tx Channel 0 cl_len=3 not supported error detected.",
Packit 534379
	"Tx Channel 0 request with cl_len=2 does NOT have a 2CL aligned address error detected.",
Packit 534379
	"Tx Channel 0 request with cl_len=4 does NOT have a 4CL aligned address error detected.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"AFU MMIO RD received while PORT is in reset error detected",
Packit 534379
	// 10
Packit 534379
	"AFU MMIO WR received while PORT is in reset error detected",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"Tx Channel 1 invalid request encoding error detected",
Packit 534379
	"Tx Channel 1 cl_len=3 not supported error detected.",
Packit 534379
	"Tx Channel 1 request with cl_len=2 does NOT have a 2CL aligned address error detected",
Packit 534379
	"Tx Channel 1 request with cl_len=4 does NOT have a 4CL aligned address error detected",
Packit 534379
	// 20
Packit 534379
	"Tx Channel 1 insufficient data payload Error detected",
Packit 534379
	"Tx Channel 1 data payload overrun error detected",
Packit 534379
	"Tx Channel 1 incorrect address on subsequent payloads error detected",
Packit 534379
	"Tx Channel 1 Non-zero SOP detected for requests!=WrLine_* error detected",
Packit 534379
	"Tx Channel 1 SOP expected to be 0 for req_type!=WrLine_*",
Packit 534379
	"Tx Channel 1 Illegal VC_SEL. Atomic request is only supported on VL0 error detected",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	// 30
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"MMIO TimedOut error detected",
Packit 534379
	"Tx Channel 2 fifo overflo error detected",
Packit 534379
	"MMIO Read response received, with no matching request pending error detected",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	// 40
Packit 534379
	"Number of pending requests: counter overflow error detected",
Packit 534379
	"Request with Address violating SMM range error detected",
Packit 534379
	"Request with Address violating second SMM range error detected",
Packit 534379
	"Request with Address violating ME stolen range",
Packit 534379
	"Request with Address violating Generic protected range error detected ",
Packit 534379
	"Request with Address violating Legacy Range Low error detected",
Packit 534379
	"Request with Address violating Legacy Range High error detected",
Packit 534379
	"Request with Address violating VGA memory range error detected",
Packit 534379
	"Page Fault error detected",
Packit 534379
	"PMR Erro error detected",
Packit 534379
	// 50
Packit 534379
	"AP6 event detected",
Packit 534379
	"VF FLR detected on port when PORT configured in PF access mode error detected ",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"RSVD.",
Packit 534379
	"Tx Channel 1 byte_len cannot be zero",
Packit 534379
	"Tx Channel 1 illegal operation: sum of byte_len and byte_start should be less than or equal to 64",
Packit 534379
	"Tx Channel 1 illegal operation: cl_len cannot be non-zero when mode is eMOD_BYTE",
Packit 534379
	"Tx Channel 1 byte_len and byte_start should be zero when mode is not eMOD_BYTE"
Packit 534379
};
Packit 534379
Packit 534379
/*
Packit 534379
 * errors command configuration, set during parse_args()
Packit 534379
 */
Packit 534379
static struct errors_config {
Packit 534379
	bool clear;
Packit 534379
	int force_count;
Packit 534379
	enum verbs_index which;
Packit 534379
	bool help_only;
Packit 534379
} errors_config = {.clear = false, .which = VERB_ALL, .help_only = false};
Packit 534379
Packit 534379
/*
Packit 534379
 * Print help
Packit 534379
 */
Packit 534379
void errors_help(void)
Packit 534379
{
Packit 534379
	unsigned int i;
Packit 534379
Packit 534379
	printf("\nPrint and clear errors\n"
Packit 534379
	       "        fpgainfo errors [-h] [-c] {");
Packit 534379
	printf("%s", supported_verbs[0]);
Packit 534379
	for (i = 1; i < sizeof(supported_verbs) / sizeof(supported_verbs[0]);
Packit 534379
	     i++) {
Packit 534379
		printf(",%s", supported_verbs[i]);
Packit 534379
	}
Packit 534379
	printf("}\n\n"
Packit 534379
	       "                -h,--help           Print this help\n"
Packit 534379
	       "                -c,--clear          Clear all errors\n"
Packit 534379
	       "                --force             Retry clearing errors 64 times\n"
Packit 534379
	       "                                    to clear certain error conditions\n"
Packit 534379
	       "\n");
Packit 534379
	errors_config.help_only = true;
Packit 534379
}
Packit 534379
Packit 534379
#define ERRORS_GETOPT_STRING ":chf"
Packit 534379
int parse_error_args(int argc, char *argv[])
Packit 534379
{
Packit 534379
	optind = 0;
Packit 534379
	struct option longopts[] = {
Packit 534379
		{"clear", no_argument, NULL, 'c'},
Packit 534379
		{"force", no_argument, NULL, 'f'},
Packit 534379
		{"help", no_argument, NULL, 'h'},
Packit 534379
		{0, 0, 0, 0},
Packit 534379
	};
Packit 534379
Packit 534379
	int getopt_ret;
Packit 534379
	int option_index;
Packit 534379
	errors_config.force_count = 1;
Packit 534379
Packit 534379
	while (-1
Packit 534379
	       != (getopt_ret = getopt_long(argc, argv, ERRORS_GETOPT_STRING,
Packit 534379
					    longopts, &option_index))) {
Packit 534379
		const char *tmp_optarg = optarg;
Packit 534379
Packit 534379
		if ((optarg) && ('=' == *tmp_optarg)) {
Packit 534379
			++tmp_optarg;
Packit 534379
		}
Packit 534379
Packit 534379
		switch (getopt_ret) {
Packit 534379
		case 'c': /* clear */
Packit 534379
			errors_config.clear = true;
Packit 534379
			break;
Packit 534379
Packit 534379
		case 'f': /* Force */
Packit 534379
			errors_config.clear = true;
Packit 534379
			errors_config.force_count = 64;
Packit 534379
			break;
Packit 534379
Packit 534379
		case 'h': /* help */
Packit 534379
			errors_help();
Packit 534379
			return -1;
Packit 534379
Packit 534379
		case ':': /* missing option argument */
Packit 534379
			OPAE_ERR("Missing option argument\n");
Packit 534379
			errors_help();
Packit 534379
			return -1;
Packit 534379
Packit 534379
		case '?':
Packit 534379
		default: /* invalid option */
Packit 534379
			OPAE_ERR("Invalid cmdline options\n");
Packit 534379
			errors_help();
Packit 534379
			return -1;
Packit 534379
		}
Packit 534379
	}
Packit 534379
Packit 534379
	// The word after 'errors' should be what to operate on ("all", "fme",
Packit 534379
	// or "port")
Packit 534379
	optind++;
Packit 534379
	if (argc < optind + 1) {
Packit 534379
		OPAE_ERR("Not enough parameters\n");
Packit 534379
		errors_help();
Packit 534379
		return -1;
Packit 534379
	}
Packit 534379
Packit 534379
	if ((optind < argc) &&
Packit 534379
		!strcmp(argv[optind - 1], "errors")) {
Packit 534379
		char *verb = argv[optind];
Packit 534379
		size_t idx = str_in_list(verb, supported_verbs, VERB_MAX);
Packit 534379
		if (idx < VERB_MAX) {
Packit 534379
			errors_config.which = idx;
Packit 534379
		} else {
Packit 534379
			OPAE_ERR("Not a valid errors resource spec: %s\n", verb);
Packit 534379
			errors_help();
Packit 534379
			return -1;
Packit 534379
		}
Packit 534379
	} else {
Packit 534379
		OPAE_ERR("Not a valid errors resource spec: %s\n",
Packit 534379
			argv[optind - 1]);
Packit 534379
		errors_help();
Packit 534379
		return -1;
Packit 534379
	}
Packit 534379
Packit 534379
	return 0;
Packit 534379
}
Packit 534379
Packit 534379
fpga_result errors_filter(fpga_properties *filter, int argc, char *argv[])
Packit 534379
{
Packit 534379
	fpga_result res = FPGA_OK;
Packit 534379
	if (0 == parse_error_args(argc, argv)) {
Packit 534379
		switch (errors_config.which) {
Packit 534379
		case VERB_FME:
Packit 534379
			res = fpgaPropertiesSetObjectType(*filter, FPGA_DEVICE);
Packit 534379
			ON_FPGAINFO_ERR_GOTO(res, out,
Packit 534379
					     "setting type to FPGA_DEVICE");
Packit 534379
			break;
Packit 534379
		case VERB_PORT:
Packit 534379
			res = fpgaPropertiesSetObjectType(*filter,
Packit 534379
							  FPGA_ACCELERATOR);
Packit 534379
			ON_FPGAINFO_ERR_GOTO(
Packit 534379
				res, out, "setting type to FPGA_ACCELERATOR");
Packit 534379
			break;
Packit 534379
		case VERB_ALL:
Packit 534379
		default:
Packit 534379
			break;
Packit 534379
		}
Packit 534379
	}
Packit 534379
out:
Packit 534379
	return res;
Packit 534379
}
Packit 534379
Packit 534379
static void print_errors_info(fpga_token token, fpga_properties props,
Packit 534379
			      struct fpga_error_info *errinfos,
Packit 534379
			      uint32_t num_errors)
Packit 534379
{
Packit 534379
	int i;
Packit 534379
	int j;
Packit 534379
	fpga_result res = FPGA_OK;
Packit 534379
	fpga_objtype objtype;
Packit 534379
	const char *const *error_string = NULL;
Packit 534379
	int size = 0;
Packit 534379
Packit 534379
	if ((NULL == errinfos) || (0 == num_errors)) {
Packit 534379
		return;
Packit 534379
	}
Packit 534379
Packit 534379
	if (errors_config.clear) {
Packit 534379
		for (i = 0; i < errors_config.force_count; i++) {
Packit 534379
			fpgaClearAllErrors(token);
Packit 534379
		}
Packit 534379
	}
Packit 534379
Packit 534379
	res = fpgaPropertiesGetObjectType(props, &objtype);
Packit 534379
	fpgainfo_print_err("reading objtype from properties", res);
Packit 534379
Packit 534379
	if (((VERB_ALL == errors_config.which)
Packit 534379
	     || (VERB_FME == errors_config.which))
Packit 534379
	    && (FPGA_DEVICE == objtype)) {
Packit 534379
		fpgainfo_print_common("//****** FME ERRORS ******//", props);
Packit 534379
Packit 534379
		for (i = 0; i < (int)num_errors; i++) {
Packit 534379
			uint64_t error_value = 0;
Packit 534379
Packit 534379
			res = fpgaReadError(token, i, &error_value);
Packit 534379
			fpgainfo_print_err("reading error for FME", res);
Packit 534379
Packit 534379
			printf("%-32s : 0x%" PRIX64 "\n", errinfos[i].name,
Packit 534379
			       error_value);
Packit 534379
Packit 534379
			if (!strcmp(errinfos[i].name, "Errors")) {
Packit 534379
				size = FME_ERROR_COUNT;
Packit 534379
				error_string = FME_ERROR;
Packit 534379
			} else if (!strcmp(errinfos[i].name, "Next Error")) {
Packit 534379
				size = 0;
Packit 534379
				error_string = NULL;
Packit 534379
			} else if (!strcmp(errinfos[i].name, "First Error")) {
Packit 534379
				size = 0;
Packit 534379
				error_string = NULL;
Packit 534379
			} else if (!strcmp(errinfos[i].name, "PCIe0 Errors")) {
Packit 534379
				size = PCIE0_ERROR_COUNT;
Packit 534379
				error_string = PCIE0_ERROR;
Packit 534379
			} else if (!strcmp(errinfos[i].name, "Inject Error")) {
Packit 534379
				size = INJECT_ERROR_COUNT;
Packit 534379
				error_string = INJECT_ERROR;
Packit 534379
			} else if (!strcmp(errinfos[i].name, "Catfatal Errors")) {
Packit 534379
				size = CATFATAL_ERROR_COUNT;
Packit 534379
				error_string = CATFATAL_ERROR;
Packit 534379
			} else if (!strcmp(errinfos[i].name, "Nonfatal Errors")) {
Packit 534379
				size = NONFATAL_ERROR_COUNT;
Packit 534379
				error_string = NONFATAL_ERROR;
Packit 534379
			} else if (!strcmp(errinfos[i].name, "PCIe1 Errors")) {
Packit 534379
				size = PCIE1_ERROR_COUNT;
Packit 534379
				error_string = PCIE1_ERROR;
Packit 534379
			}
Packit 534379
Packit 534379
			for (j = 0; (j < size) && (NULL != error_string); j++) {
Packit 534379
				if (FPGA_BIT_IS_SET(error_value, j)) {
Packit 534379
					printf("\t %s \n", error_string[j]);
Packit 534379
				}
Packit 534379
			}
Packit 534379
		}
Packit 534379
	} else if (((VERB_ALL == errors_config.which)
Packit 534379
		    || (VERB_PORT == errors_config.which))
Packit 534379
		   && (FPGA_ACCELERATOR == objtype)) {
Packit 534379
		fpgainfo_print_common("//****** PORT ERRORS ******//", props);
Packit 534379
Packit 534379
		for (i = 0; i < (int)num_errors; i++) {
Packit 534379
			uint64_t error_value = 0;
Packit 534379
			res = fpgaReadError(token, i, &error_value);
Packit 534379
			fpgainfo_print_err("reading error for PORT", res);
Packit 534379
Packit 534379
			printf("%-32s : 0x%" PRIX64 "\n", errinfos[i].name,
Packit 534379
			       error_value);
Packit 534379
Packit 534379
			if (!strcmp(errinfos[i].name, "Errors")) {
Packit 534379
				size = PORT_ERROR_COUNT;
Packit 534379
				error_string = PORT_ERROR;
Packit 534379
			} else if (!strcmp(errinfos[i].name, "First Malformed Req")) {
Packit 534379
				size = 0;
Packit 534379
				error_string = NULL;
Packit 534379
			} else if (!strcmp(errinfos[i].name, "First Error")) {
Packit 534379
				size = 0;
Packit 534379
				error_string = NULL;
Packit 534379
			}
Packit 534379
Packit 534379
			for (j = 0; (j < size) && (NULL != error_string); j++) {
Packit 534379
				if (FPGA_BIT_IS_SET(error_value, j)) {
Packit 534379
					printf("\t %s \n", error_string[j]);
Packit 534379
				}
Packit 534379
			}
Packit 534379
		}
Packit 534379
	}
Packit 534379
}
Packit 534379
Packit 534379
fpga_result errors_command(fpga_token *tokens, int num_tokens, int argc,
Packit 534379
			   char *argv[])
Packit 534379
{
Packit 534379
	(void)argc;
Packit 534379
	(void)argv;
Packit 534379
	fpga_result res = FPGA_OK;
Packit 534379
	fpga_properties props;
Packit 534379
	struct fpga_error_info *errinfos = NULL;
Packit 534379
Packit 534379
	if (errors_config.help_only) {
Packit 534379
		return res;
Packit 534379
	}
Packit 534379
Packit 534379
	int i = 0;
Packit 534379
	for (i = 0; i < num_tokens; ++i) {
Packit 534379
		uint32_t num_errors;
Packit 534379
Packit 534379
		res = fpgaGetProperties(tokens[i], &props;;
Packit 534379
		if (res == FPGA_OK) {
Packit 534379
			res = fpgaPropertiesGetNumErrors(props, &num_errors);
Packit 534379
			fpgainfo_print_err("reading errors from properties", res);
Packit 534379
Packit 534379
			if (num_errors != 0) {
Packit 534379
				int j;
Packit 534379
				errinfos = (struct fpga_error_info *)calloc(
Packit 534379
					num_errors, sizeof(*errinfos));
Packit 534379
				if (!errinfos) {
Packit 534379
					res = FPGA_NO_MEMORY;
Packit 534379
					OPAE_ERR("Error allocating memory");
Packit 534379
					goto destroy_and_free;
Packit 534379
				}
Packit 534379
Packit 534379
				for (j = 0; j < (int)num_errors; j++) {
Packit 534379
					res = fpgaGetErrorInfo(tokens[i], j,
Packit 534379
							       &errinfos[j]);
Packit 534379
					fpgainfo_print_err(
Packit 534379
						"reading error info structure", res);
Packit 534379
					replace_chars(errinfos[j].name, '_', ' ');
Packit 534379
					upcase_pci(errinfos[j].name,
Packit 534379
						    strnlen(errinfos[j].name, 4096));
Packit 534379
					upcase_first(errinfos[j].name);
Packit 534379
				}
Packit 534379
			}
Packit 534379
Packit 534379
			print_errors_info(tokens[i], props, errinfos, num_errors);
Packit 534379
		destroy_and_free:
Packit 534379
			free(errinfos);
Packit 534379
			errinfos = NULL;
Packit 534379
			fpgaDestroyProperties(&props;;
Packit 534379
			if (res == FPGA_NO_MEMORY) {
Packit 534379
			    break;
Packit 534379
			}
Packit 534379
		} else {
Packit 534379
			fpgainfo_print_err("reading properties from token", res);
Packit 534379
		}
Packit 534379
	}
Packit 534379
Packit 534379
	return res;
Packit 534379
}