view rvinterf/etmsync/fserr.c @ 505:7bf0d909c87e

fc-loadtool flash ID check: change of reset after the check logic This change only affects those flash configurations that have ID checks enabled. The logic for resetting the flash after the ID check has been changed as follows: 1) If the check fails, we return without attempting to reset the flash. 2) If the check is successful, we reset the flash using the configured method (could be AMD or Intel or Intel W30) instead of always doing an AMD flash reset as the original code did.
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 27 May 2019 19:58:01 +0000
parents e7502631a0f9
children
line wrap: on
line source

/*
 * FFS error decoding
 */

#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include "etm.h"
#include "ffs.h"
#include "ffserr.h"

static struct errtab {
	int	errcode;
	char	*desc;
} errtab[] = {
	{TMFFS_ERR_NODEVICE, "EFFS_NODEVICE: flash device unknown"},
	{TMFFS_ERR_CORRUPTED, "EFFS_CORRUPTED: filesystem corrupted"},
	{TMFFS_ERR_NOPREFORMAT, "EFFS_NOPREFORMAT: ffs not preformatted"},
	{TMFFS_ERR_NOFORMAT, "EFFS_NOFORMAT: ffs not formatted"},
	{TMFFS_ERR_BADFORMAT,
		"EFFS_BADFORMAT: incompatible ffs version, reformat needed"},
	{TMFFS_ERR_MAGIC, "EFFS_MAGIC: bad magic"},
	{TMFFS_ERR_AGAIN, "EFFS_AGAIN: not ready, try again later"},
	{TMFFS_ERR_NOSYS, "EFFS_NOSYS: function not implemented"},
	{TMFFS_ERR_DRIVER, "EFFS_DRIVER: ffs device driver error"},
	{TMFFS_ERR_NOSPACE, "EFFS_NOSPACE: out of data space"},
	{TMFFS_ERR_FSFULL, "EFFS_FSFULL: file system full, no free inodes"},
	{TMFFS_ERR_BADNAME, "EFFS_BADNAME: bad filename"},
	{TMFFS_ERR_NOTFOUND, "EFFS_NOTFOUND: object not found"},
	{TMFFS_ERR_EXISTS, "EFFS_EXISTS: object exists"},
	{TMFFS_ERR_ACCESS, "EFFS_ACCESS: access permission violation"},
	{TMFFS_ERR_NAMETOOLONG, "EFFS_NAMETOOLONG"},
	{TMFFS_ERR_INVALID, "EFFS_INVALID"},
	{TMFFS_ERR_DIRNOTEMPTY, "EFFS_DIRNOTEMPTY"},
	{TMFFS_ERR_NOTADIR, "EFFS_NOTADIR"},
	{TMFFS_ERR_SPARE, "EFFS_SPARE"},
	{TMFFS_ERR_FILETOOBIG, "EFFS_FILETOOBIG"},
	{TMFFS_ERR_NOTAFILE, "EFFS_NOTAFILE"},
	{TMFFS_ERR_PATHTOODEEP, "EFFS_PATHTOODEEP"},
	{TMFFS_ERR_NUMFD, "EFFS_NUMFD: max number of open files reached"},
	{TMFFS_ERR_BADFD, "EFFS_BADFD: bad file descriptor"},
	{TMFFS_ERR_BADOP, "EFFS_BADOP: bad operation"},
	{TMFFS_ERR_LOCKED, "EFFS_LOCKED: the file is locked"},
	{TMFFS_ERR_TOOBIG, "EFFS_TOOBIG: tmffs buffer overflow"},
	{TMFFS_ERR_MEMORY, "EFFS_MEMORY: out of memory"},
	{TMFFS_ERR_MSGSEND, "EFFS_MSGSEND: message send failed"},
	{TMFFS_ERR_SIBLINGLOOP, "EFFS_SIBLINGLOOP: directory sibling loop"},
	{TMFFS_ERR_NOBLOCKS, "EFFS_NOBLOCKS: debug error?"},
	{TMFFS_ERR_DBR, "EFFS_DBR: debug error?"},
	{TMFFS_ERR_RECLAIMLOOP, "EFFS_RECLAIMLOOP: debug error?"},
	{0, 0}
};

report_ffs_err(oper, errcode)
	char *oper;
{
	struct errtab *tp;
	char *errdesc;

	for (tp = errtab; tp->errcode; tp++)
		if (tp->errcode == errcode)
			break;
	errdesc = tp->desc;
	if (!errdesc)
		errdesc = "unknown";
	printf("%s: FFS error %d (%s)\n", oper, errcode, errdesc);
}