int pdsc_err_to_errno(enum pds_core_status_code code)
{ switch (code) { case PDS_RC_SUCCESS: return 0; case PDS_RC_EVERSION: case PDS_RC_EQTYPE: case PDS_RC_EQID: case PDS_RC_EINVAL: case PDS_RC_ENOSUPP: return -EINVAL; case PDS_RC_EPERM: return -EPERM; case PDS_RC_ENOENT: return -ENOENT; case PDS_RC_EAGAIN: return -EAGAIN; case PDS_RC_ENOMEM: return -ENOMEM; case PDS_RC_EFAULT: return -EFAULT; case PDS_RC_EBUSY: return -EBUSY; case PDS_RC_EEXIST: return -EEXIST; case PDS_RC_EVFID: return -ENODEV; case PDS_RC_ECLIENT: return -ECHILD; case PDS_RC_ENOSPC: return -ENOSPC; case PDS_RC_ERANGE: return -ERANGE; case PDS_RC_BAD_ADDR: return -EFAULT; case PDS_RC_BAD_PCI: return -ENXIO; case PDS_RC_EOPCODE: case PDS_RC_EINTR: case PDS_RC_DEV_CMD: case PDS_RC_ERROR: case PDS_RC_ERDMA: case PDS_RC_EIO: default: return -EIO;
}
}
bool pdsc_is_fw_running(struct pdsc *pdsc)
{ if (!pdsc->info_regs) returnfalse;
/* Firmware is useful only if the running bit is set and * fw_status != 0xff (bad PCI read)
*/ return (pdsc->fw_status != PDS_RC_BAD_PCI) &&
(pdsc->fw_status & PDS_CORE_FW_STS_F_RUNNING);
}
/* Make sure to update the cached fw_status by calling * pdsc_is_fw_running() before getting the generation
*/
gen = pdsc->fw_status & PDS_CORE_FW_STS_F_GENERATION;
return fw_running && gen == pdsc->fw_generation;
}
staticconstchar *pdsc_devcmd_str(int opcode)
{ switch (opcode) { case PDS_CORE_CMD_NOP: return"PDS_CORE_CMD_NOP"; case PDS_CORE_CMD_IDENTIFY: return"PDS_CORE_CMD_IDENTIFY"; case PDS_CORE_CMD_RESET: return"PDS_CORE_CMD_RESET"; case PDS_CORE_CMD_INIT: return"PDS_CORE_CMD_INIT"; case PDS_CORE_CMD_FW_DOWNLOAD: return"PDS_CORE_CMD_FW_DOWNLOAD"; case PDS_CORE_CMD_FW_CONTROL: return"PDS_CORE_CMD_FW_CONTROL"; default: return"PDS_CORE_CMD_UNKNOWN";
}
}
staticint pdsc_devcmd_wait(struct pdsc *pdsc, u8 opcode, int max_seconds)
{ struct device *dev = pdsc->dev; unsignedlong start_time; unsignedlong max_wait; unsignedlong duration; int timeout = 0; bool running; int done = 0; int err = 0; int status;
staticint pdsc_identify(struct pdsc *pdsc)
{ struct pds_core_drv_identity drv = {};
size_t sz; int err; int n;
drv.drv_type = cpu_to_le32(PDS_DRIVER_LINUX); /* Catching the return quiets a Wformat-truncation complaint */
n = snprintf(drv.driver_ver_str, sizeof(drv.driver_ver_str), "%s %s", PDS_CORE_DRV_NAME, utsname()->release); if (n > sizeof(drv.driver_ver_str))
dev_dbg(pdsc->dev, "release name truncated, don't care\n");
/* Next let's get some info about the device * We use the devcmd_lock at this level in order to * get safe access to the cmd_regs->data before anyone * else can mess it up
*/
mutex_lock(&pdsc->devcmd_lock);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.