10 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13 #include <linux/slab.h>
14 #include <linux/export.h>
53 memcpy(buf, resp, copy_len);
58 #define CHAN_TO_IDX(chan) ((chan) - 1)
66 for (i = 0; i <
ARRAY_SIZE(channel_ranges); i++)
68 range = &channel_ranges[
i];
72 for (ch = priv->
range.start; ch < priv->range.
end; ch++)
91 memset(&cmd, 0,
sizeof(cmd));
113 lbtf_deb_cmd(
"GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n",
124 if (priv->
regioncode == lbtf_region_code_to_index[i])
129 if (i >= MRVDRV_MAX_REGION_CODE) {
131 pr_info(
"unidentified region code; using the default (USA)\n");
219 if (!cmdnode->
cmdbuf->size) {
229 lbtf_deb_host(
"QUEUE_CMD: inserted command 0x%04x into cmdpendingq\n",
236 static void lbtf_submit_command(
struct lbtf_private *priv,
255 lbtf_deb_cmd(
"DNLD_CMD: command 0x%04x, seq %d, size %d\n",
263 pr_info(
"DNLD_CMD: hw_host_to_card failed: %d\n", ret);
279 static void __lbtf_cleanup_and_insert_cmd(
struct lbtf_private *priv,
298 static void lbtf_cleanup_and_insert_cmd(
struct lbtf_private *priv,
304 __lbtf_cleanup_and_insert_cmd(priv, ptempcmd);
316 __lbtf_cleanup_and_insert_cmd(priv, cmd);
433 &cmd.
hdr,
sizeof(cmd));
467 if (!cmdarray[i].
cmdbuf) {
476 lbtf_cleanup_and_insert_cmd(priv, &cmdarray[i]);
547 lbtf_deb_host(
"GET_CMD_NODE: cmd_ctrl_node is not available\n");
579 pr_alert(
"EXEC_NEXT_CMD: already processing command!\n");
597 lbtf_submit_command(priv, cmdnode);
619 cmdnode = ERR_PTR(-
ENOENT);
623 cmdnode = lbtf_get_cmd_ctrl_node(priv);
624 if (cmdnode ==
NULL) {
644 cmdnode->
cmdbuf->result = 0;
649 lbtf_queue_cmd(priv, cmdnode);
661 __lbtf_cmd_async(priv, command, in_cmd, in_cmd_size,
NULL, 0);
669 unsigned long callback_arg)
677 cmdnode = __lbtf_cmd_async(priv, command, in_cmd, in_cmd_size,
679 if (IS_ERR(cmdnode)) {
680 ret = PTR_ERR(cmdnode);
688 pr_info(
"PREP_CMD: command 0x%04x interrupted by signal: %d\n",
696 pr_info(
"PREP_CMD: command 0x%04x failed: %d\n",
699 __lbtf_cleanup_and_insert_cmd(priv, cmdnode);
741 pr_info(
"libertastf: cmd response 0x%04x, seq %d, size %d\n",
750 if (respcmd !=
CMD_RET(curcmd)) {
771 if ((result != 0 || !(respcmd & 0x8000))) {
778 pr_info(
"libertastf: reset failed\n");