#include <sys/1394/t1394.h>
#include <sys/1394/s1394.h>
#include <sys/1394/cmd1394.h>
#include <sys/1394/ixl1394.h>
static const char *error_string[] = {
"CMD1394_CMDSUCCESS: Command Success",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"CMD1394_ENULL_MBLK: NULL mblk pointer",
"CMD1394_EMBLK_TOO_SMALL: Mblk too small",
"CMD1394_ESTALE_GENERATION: Stale generation",
"CMD1394_EDEVICE_REMOVED: Device removed",
"CMD1394_EINVALID_CONTEXT: Invalid context",
"CMD1394_EINVALID_COMMAND: Invalid command",
"CMD1394_EUNKNOWN_ERROR: Unknown error",
"CMD1394_NOSTATUS: No status",
"CMD1394_EFATAL_ERROR: Fatal error",
"CMD1394_ENO_ATREQ: Unable to send ATREQ",
"CMD1394_EDEVICE_ERROR: Device error",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"CMD1394_EDEVICE_BUSY: Device busy",
"CMD1394_ERETRIES_EXCEEDED: Too many retries",
"CMD1394_ETYPE_ERROR: Resp/ack type error",
"CMD1394_EDATA_ERROR: Resp/ack data error",
"CMD1394_EBUSRESET: Bus reset",
"CMD1394_EADDRESS_ERROR: Address error",
"CMD1394_ETIMEOUT: Command timed out",
"CMD1394_ERSRC_CONFLICT: Resource conflict"
};
static const char *ixl_compilation_error_string[] = {
"IXL1394_EMEM_ALLOC_FAIL: Memory allocation failed",
"IXL1394_EBAD_IXL_OPCODE: Bad opcode",
"IXL1394_EFRAGMENT_OFLO: Descriptor block overflow",
"IXL1394_ENO_DATA_PKTS: No descriptor blocks",
"IXL1394_EMISPLACED_RECV: Misplaced receive",
"IXL1394_EMISPLACED_SEND: Misplaced send",
"IXL1394_EPKT_HDR_MISSING: Packet header missing",
"IXL1394_ENULL_BUFFER_ADDR: NULL buffer address",
"IXL1394_EPKTSIZE_MAX_OFLO: Packet > 0xFFFF bytes",
"IXL1394_EPKTSIZE_RATIO: Improper packet length/count",
"IXL1394_EUNAPPLIED_SET_CMD: Unused set command",
"IXL1394_EDUPLICATE_SET_CMD: Multiple set commands",
"IXL1394_EJUMP_NOT_TO_LABEL: Jump destination not a label",
"IXL1394_EUPDATE_DISALLOWED: Update not allowed ",
"IXL1394_EBAD_SKIPMODE: Invalid skip mode",
"IXL1394_EWRONG_XR_CMD_MODE: Inapproriate xmit/recv mode",
"IXL1394_EINTERNAL_ERROR: Internal error",
"IXL1394_ENOT_IMPLEMENTED: Unimplemented error",
"IXL1394_EOPCODE_MISMATCH: Opcode mismatch",
"IXL1394_EOPCODE_DISALLOWED: Opcode disallowed for update",
"IXL1394_EBAD_SKIP_LABEL: Skip label destination not a label",
"IXL1394_EXFER_BUF_MISSING: Missing buffer in transfer command",
"IXL1394_EXFER_BUF_CNT_DIFF: Packet count differs in new buffer",
"IXL1394_EORIG_IXL_CORRUPTED: Original IXL program corrupted",
"IXL1394_ECOUNT_MISMATCH: IXL command count difference",
"IXL1394_EPRE_UPD_DMALOST: DMA path lost before update",
"IXL1394_EPOST_UPD_DMALOST: DMA path lost after update",
"IXL1394_ERISK_PROHIBITS_UPD: Risk prohibits update"
};
static const char *addr_error_string[] = {
"T1394_EALLOC_ADDR: Unable to alloc 1394 address block",
};
static const char *cec_error_string[] = {
"T1394_ENO_BANDWIDTH: Bandwidth allocation failed",
"T1394_ENO_CHANNEL: Channel allocation failed",
"T1394_ETARGET: One or more callbacks failed in isoch setup"
};
static const char *idma_error_string[] = {
"T1394_EIDMA_NO_RESRCS: No DMA resources",
"T1394_EIDMA_CONFLICT: Conflicting arguments"
};
static const char *cfgrom_error_string[] = {
"T1394_ECFGROM_FULL: Config ROM is full",
"T1394_EINVALID_PARAM: Invalid parameter in call",
"T1394_EINVALID_CONTEXT: Invalid context for call",
"T1394_NOERROR: No error"
};
#define T1394_ERRMSG_EMPTY_STRING ""
const char *
t1394_errmsg(int result, uint_t flags)
{
int err;
const char *msg = T1394_ERRMSG_EMPTY_STRING;
if (result > 0) {
return (T1394_ERRMSG_EMPTY_STRING);
}
result = -result;
if ((result >= -CMD1394_ERR_FIRST) && (result <= -CMD1394_ERR_LAST)) {
err = result - (-CMD1394_ERR_FIRST);
msg = error_string[err];
} else if ((result >= -IXL1394_COMP_ERR_FIRST) &&
(result <= -IXL1394_COMP_ERR_LAST)) {
err = result - (-IXL1394_COMP_ERR_FIRST);
msg = ixl_compilation_error_string[err];
} else if ((result >= -T1394_EADDR_FIRST) &&
(result <= -T1394_EADDR_LAST)) {
err = result - (-T1394_EADDR_FIRST);
msg = addr_error_string[err];
} else if ((result >= -T1394_CEC_ERR_FIRST) &&
(result <= -T1394_CEC_ERR_LAST)) {
err = result - (-T1394_CEC_ERR_FIRST);
msg = cec_error_string[err];
} else if ((result >= -T1394_IDMA_ERR_FIRST) &&
(result <= -T1394_IDMA_ERR_LAST)) {
err = result - (-T1394_IDMA_ERR_FIRST);
msg = idma_error_string[err];
} else if ((result >= -T1394_ECFG_FIRST) &&
(result <= -T1394_ECFG_LAST)) {
err = result - (-T1394_ECFG_FIRST);
msg = cfgrom_error_string[err];
}
return (msg);
}