static void handle_prd_control_occ_reset(struct control_msg *msg) { if (!hservice_runtime->process_occ_reset) { pr_log_nocall("process_occ_reset"); return; } pr_debug("CTRL: calling process_occ_reset(0)"); call_process_occ_reset(0); msg->data_len = 0; msg->response = 0; }
static int handle_msg_occ_reset(struct opal_prd_ctx *ctx, struct opal_prd_msg *msg) { uint32_t proc; proc = be64toh(msg->occ_reset.chip); if (!hservice_runtime->process_occ_reset) { pr_log_nocall("process_occ_reset"); return -1; } call_process_occ_reset(proc); return 0; }
static int handle_msg_occ_reset(struct opal_prd_ctx *ctx, struct opal_prd_msg *msg) { uint32_t proc; proc = be64toh(msg->occ_reset.chip); pr_debug("FW: firmware requested OCC reset for proc 0x%x", proc); if (!hservice_runtime->process_occ_reset) { pr_log_nocall("process_occ_reset"); return -1; } call_process_occ_reset(proc); return 0; }
static int handle_prd_control(struct opal_prd_ctx *ctx, int fd) { struct control_msg msg; bool enabled; int rc; rc = recv(fd, &msg, sizeof(msg), MSG_TRUNC); if (rc != sizeof(msg)) { pr_log(LOG_WARNING, "CTRL: failed to receive " "control message: %m"); return -1; } enabled = false; rc = -1; switch (msg.type) { case CONTROL_MSG_ENABLE_OCCS: enabled = true; /* fall through */ case CONTROL_MSG_DISABLE_OCCS: if (!hservice_runtime->enable_occ_actuation) { pr_log_nocall("enable_occ_actuation"); } else { pr_debug("CTRL: calling enable_occ_actuation(%s)", enabled ? "true" : "false"); rc = call_enable_occ_actuation(enabled); pr_debug("CTRL: -> %d", rc); } break; case CONTROL_MSG_TEMP_OCC_RESET: if (hservice_runtime->process_occ_reset) { pr_debug("CTRL: calling process_occ_reset(0)"); call_process_occ_reset(0); rc = 0; } else { pr_log_nocall("process_occ_reset"); } break; case CONTROL_MSG_TEMP_OCC_ERROR: if (hservice_runtime->process_occ_error) { pr_debug("CTRL: calling process_occ_error(0)"); call_process_occ_error(0); rc = 0; } else { pr_log_nocall("process_occ_error"); } break; default: pr_log(LOG_WARNING, "CTRL: Unknown control message action %d", msg.type); } /* send a response */ msg.response = rc; rc = send(fd, &msg, sizeof(msg), MSG_DONTWAIT | MSG_NOSIGNAL); if (rc && (errno == EAGAIN || errno == EWOULDBLOCK || errno == EPIPE)) pr_debug("CTRL: control send() returned %d, ignoring failure", rc); else if (rc != sizeof(msg)) pr_log(LOG_NOTICE, "CTRL: Failed to send control response: %m"); return 0; }