/* module parameter controlling recovery handling */
extern int disable_recovery_handling;
+const char *response_code_to_str(int response_code)
+{
+ switch (response_code) {
+ case SCSC_WLBTD_ERR_PARSE_FAILED:
+ return "SCSC_WLBTD_ERR_PARSE_FAILED";
+ case SCSC_WLBTD_FW_PANIC_TAR_GENERATED:
+ return "SCSC_WLBTD_FW_PANIC_TAR_GENERATED";
+ case SCSC_WLBTD_FW_PANIC_ERR_SCRIPT_FILE_NOT_FOUND:
+ return "SCSC_WLBTD_FW_PANIC_ERR_SCRIPT_FILE_NOT_FOUND";
+ case SCSC_WLBTD_FW_PANIC_ERR_NO_DEV:
+ return "SCSC_WLBTD_FW_PANIC_ERR_NO_DEV";
+ case SCSC_WLBTD_FW_PANIC_ERR_MMAP:
+ return "SCSC_WLBTD_FW_PANIC_ERR_MMAP";
+ case SCSC_WLBTD_FW_PANIC_ERR_SABLE_FILE:
+ return "SCSC_WLBTD_FW_PANIC_ERR_SABLE_FILE";
+ case SCSC_WLBTD_FW_PANIC_ERR_TAR:
+ return "SCSC_WLBTD_FW_PANIC_ERR_TAR";
+ case SCSC_WLBTD_OTHER_SBL_GENERATED:
+ return "SCSC_WLBTD_OTHER_SBL_GENERATED";
+ case SCSC_WLBTD_OTHER_TAR_GENERATED:
+ return "SCSC_WLBTD_OTHER_TAR_GENERATED";
+ case SCSC_WLBTD_OTHER_ERR_SCRIPT_FILE_NOT_FOUND:
+ return "SCSC_WLBTD_OTHER_ERR_SCRIPT_FILE_NOT_FOUND";
+ case SCSC_WLBTD_OTHER_ERR_NO_DEV:
+ return "SCSC_WLBTD_OTHER_ERR_NO_DEV";
+ case SCSC_WLBTD_OTHER_ERR_MMAP:
+ return "SCSC_WLBTD_OTHER_ERR_MMAP";
+ case SCSC_WLBTD_OTHER_ERR_SABLE_FILE:
+ return "SCSC_WLBTD_OTHER_ERR_SABLE_FILE";
+ case SCSC_WLBTD_OTHER_ERR_TAR:
+ return "SCSC_WLBTD_OTHER_ERR_TAR";
+ case SCSC_WLBTD_OTHER_IGNORE_TRIGGER:
+ return "SCSC_WLBTD_OTHER_IGNORE_TRIGGER";
+ default:
+ SCSC_TAG_ERR(WLBTD, "UNKNOWN response_code %d", response_code);
+ return "UNKNOWN response_code";
+ }
+}
+
/**
* This callback runs whenever the socket receives messages.
*/
if (info->attrs[2]) {
status = nla_get_u16(info->attrs[2]);
- if (status)
- SCSC_TAG_ERR(WLBTD, "%u\n", status);
+ SCSC_TAG_ERR(WLBTD, "%s\n", response_code_to_str(status));
}
if (disable_recovery_handling == MEMDUMP_FILE_FOR_RECOVERY) {
}
/* completion cases :
- * 1) for trigger scsc_log_fw_panic only one response from wlbtd when tar done
+ * 1) FW_PANIC_TAR_GENERATED
+ * for trigger scsc_log_fw_panic only one response from wlbtd when
+ * tar done
* ---> complete fw_panic_done
* 2) for all other triggers, we get 2 responses
- * a) Once .sbl is written
+ * a) OTHER_SBL_GENERATED
+ * Once .sbl is written
* ---> complete event_done
- * b) 2nd time when sable tar is done
- * ignore this response and Don't complete
- * 3) When we get rapid requests for SABLE generation,
+ * b) OTHER_TAR_GENERATED
+ * 2nd time when sable tar is done
+ * IGNORE this response and Don't complete
+ * 3) OTHER_IGNORE_TRIGGER
+ * When we get rapid requests for SABLE generation,
* to serialise while processing current request,
* we ignore requests other than "fw_panic" in wlbtd and
* send a msg "ignoring" back to kernel.
* ---> complete event_done
- * 4) when something failed, file not found
+ * 4) FW_PANIC_ERR_* and OTHER_ERR_*
+ * when something failed, file not found, mmap failed, etc.
+ * ---> complete the completion with waiter(s) based on if it was
+ * a fw_panic trigger or other trigger
+ * 5) ERR_PARSE_FAILED
+ * When msg parsing fails, wlbtd doesn't know the trigger type
* ---> complete the completion with waiter(s)
*/
- if ((strstr(data, "scsc_log_fw_panic") != NULL) ||
- (strstr(data, "not found.") != NULL) ||
- (strstr(data, "failed"))) {
+ switch (status) {
+ case SCSC_WLBTD_ERR_PARSE_FAILED:
if (!completion_done(&fw_panic_done)) {
SCSC_TAG_INFO(WLBTD, "completing fw_panic_done\n");
complete(&fw_panic_done);
- return 0;
}
- }
-
- if ((strstr(data, ".sbl") != NULL) ||
- (strstr(data, "ignoring") != NULL) ||
- (strstr(data, "not found.") != NULL) ||
- (strstr(data, "failed"))) {
if (!completion_done(&event_done)) {
SCSC_TAG_INFO(WLBTD, "completing event_done\n");
complete(&event_done);
}
+ break;
+ case SCSC_WLBTD_FW_PANIC_TAR_GENERATED:
+ case SCSC_WLBTD_FW_PANIC_ERR_TAR:
+ case SCSC_WLBTD_FW_PANIC_ERR_SCRIPT_FILE_NOT_FOUND:
+ case SCSC_WLBTD_FW_PANIC_ERR_NO_DEV:
+ case SCSC_WLBTD_FW_PANIC_ERR_MMAP:
+ case SCSC_WLBTD_FW_PANIC_ERR_SABLE_FILE:
+ if (!completion_done(&fw_panic_done)) {
+ SCSC_TAG_INFO(WLBTD, "completing fw_panic_done\n");
+ complete(&fw_panic_done);
+ }
+ break;
+ case SCSC_WLBTD_OTHER_TAR_GENERATED:
+ /* ignore */
+ break;
+ case SCSC_WLBTD_OTHER_SBL_GENERATED:
+ case SCSC_WLBTD_OTHER_ERR_TAR:
+ case SCSC_WLBTD_OTHER_ERR_SCRIPT_FILE_NOT_FOUND:
+ case SCSC_WLBTD_OTHER_ERR_NO_DEV:
+ case SCSC_WLBTD_OTHER_ERR_MMAP:
+ case SCSC_WLBTD_OTHER_ERR_SABLE_FILE:
+ case SCSC_WLBTD_OTHER_IGNORE_TRIGGER:
+ if (!completion_done(&event_done)) {
+ SCSC_TAG_INFO(WLBTD, "completing event_done\n");
+ complete(&event_done);
+ }
+ break;
+ default:
+ SCSC_TAG_ERR(WLBTD, "UNKNOWN reponse from WLBTD\n");
}
return 0;
__EVENT_MAX,
};
+enum scsc_wlbtd_response_codes {
+ /* NOTE: keep the enum in sync with userspace wlbtd */
+ /* parse failed */
+ SCSC_WLBTD_ERR_PARSE_FAILED,
+
+ /* fw_panic trigger */
+ SCSC_WLBTD_FW_PANIC_TAR_GENERATED,
+ SCSC_WLBTD_FW_PANIC_ERR_SCRIPT_FILE_NOT_FOUND,
+ SCSC_WLBTD_FW_PANIC_ERR_NO_DEV,
+ SCSC_WLBTD_FW_PANIC_ERR_MMAP,
+ SCSC_WLBTD_FW_PANIC_ERR_SABLE_FILE,
+ SCSC_WLBTD_FW_PANIC_ERR_TAR,
+
+ /* other triggers */
+ SCSC_WLBTD_OTHER_SBL_GENERATED,
+ SCSC_WLBTD_OTHER_TAR_GENERATED,
+ SCSC_WLBTD_OTHER_ERR_SCRIPT_FILE_NOT_FOUND,
+ SCSC_WLBTD_OTHER_ERR_NO_DEV,
+ SCSC_WLBTD_OTHER_ERR_MMAP,
+ SCSC_WLBTD_OTHER_ERR_SABLE_FILE,
+ SCSC_WLBTD_OTHER_ERR_TAR,
+ SCSC_WLBTD_OTHER_IGNORE_TRIGGER,
+};
+
static const struct genl_multicast_group scsc_mcgrp[] = {
{ .name = "scsc_mdp_grp", },
};