#include "mifintrbit.h"
#include "mxmgmt_transport.h"
-static bool mxlogger_forced_disabled = true;
+static bool mxlogger_disabled;
+module_param(mxlogger_disabled, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(mxlogger_disabled, "Disable MXLOGGER Configuration. Effective only at next WLBT boot.");
+
+bool mxlogger_set_enabled_status(bool enable)
+{
+ mxlogger_disabled = !enable;
+
+ SCSC_TAG_INFO(MXMAN, "MXLOGGER has been NOW %sABLED. Effective at next WLBT boot.\n",
+ mxlogger_disabled ? "DIS" : "EN");
+
+ return mxlogger_disabled;
+}
+EXPORT_SYMBOL(mxlogger_set_enabled_status);
+
+static bool mxlogger_forced_to_host = true;
static void update_fake_observer(void)
{
- SCSC_TAG_INFO(MXMAN, "MXLOGGER will now be %sABLED.\n",
- mxlogger_forced_disabled ? "DIS" : "EN");
- if (mxlogger_forced_disabled)
+ if (mxlogger_forced_to_host) {
mxlogger_register_global_observer("FAKE_OBSERVER");
- else
+ SCSC_TAG_INFO(MXMAN, "MXLOGGER is now FORCED TO HOST.\n");
+ } else {
mxlogger_unregister_global_observer("FAKE_OBSERVER");
+ SCSC_TAG_INFO(MXMAN, "MXLOGGER is now operating NORMALLY.\n");
+ }
}
-static int force_disable_mxlogger_set_param_cb(const char *val,
+static int mxlogger_force_to_host_set_param_cb(const char *val,
const struct kernel_param *kp)
{
bool nval;
if (!val || strtobool(val, &nval))
return -EINVAL;
- if (mxlogger_forced_disabled ^ nval) {
- mxlogger_forced_disabled = nval;
+ if (mxlogger_forced_to_host ^ nval) {
+ mxlogger_forced_to_host = nval;
update_fake_observer();
}
return 0;
* As described in struct kernel_param+ops the _get method:
* -> returns length written or -errno. Buffer is 4k (ie. be short!)
*/
-static int force_disable_mxlogger_get_param_cb(char *buffer,
+static int mxlogger_force_to_host_get_param_cb(char *buffer,
const struct kernel_param *kp)
{
- return sprintf(buffer, "%c", mxlogger_forced_disabled ? 'Y' : 'N');
+ return sprintf(buffer, "%c", mxlogger_forced_to_host ? 'Y' : 'N');
}
-static struct kernel_param_ops force_disable_mxlogger_ops = {
- .set = force_disable_mxlogger_set_param_cb,
- .get = force_disable_mxlogger_get_param_cb,
+static struct kernel_param_ops mxlogger_force_to_host_ops = {
+ .set = mxlogger_force_to_host_set_param_cb,
+ .get = mxlogger_force_to_host_get_param_cb,
};
-module_param_cb(force_disable_mxlogger, &force_disable_mxlogger_ops, NULL, 0644);
-MODULE_PARM_DESC(force_disable_mxlogger, "Force mxlogger to be disabled, using a fake observer.");
+module_param_cb(mxlogger_force_to_host, &mxlogger_force_to_host_ops, NULL, 0644);
+MODULE_PARM_DESC(mxlogger_force_to_host, "Force mxlogger to redirect to Host all the time, using a fake observer.");
/**
* Observers of log material could come and go before mxman and mxlogger
return -EIO;
}
- //XXX ???
if (mem_sz <= (sizeof(struct mxlogger_config_area) + MXLOGGER_IMP_SIZE)) {
SCSC_TAG_ERR(MXMAN, "Insufficient memory allocation\n");
return -EIO;
/* Initialize configuration structure */
SCSC_TAG_INFO(MXMAN, "MXLOGGER Configuration: 0x%x\n", (u32)mxlogger->mifram_ref);
cfg = (struct mxlogger_config_area *)mxlogger->mem;
- //memset(cfg, 0, sizeof(struct mxlogger_config_area));
cfg->config.magic_number = MXLOGGER_MAGIG_NUMBER;
cfg->config.config_major = MXLOGGER_MAJOR;
/**
* Update observers status considering
- * current value of mxlogger_forced_disabled
+ * current value of mxlogger_forced_to_host
*/
update_fake_observer();
int mxlogger_start(struct mxlogger *mxlogger)
{
+ if (mxlogger_disabled) {
+ SCSC_TAG_WARNING(MXMAN, "MXLOGGER is disabled. Not Starting.\n");
+ return -1;
+ }
+
SCSC_TAG_INFO(MXMAN, "Starting mxlogger with %d observer[s]\n", mxlogger->observers);
mutex_lock(&mxlogger->lock);
#include <scsc/scsc_log_collector.h>
#include "scsc_log_collector_proc.h"
#include <scsc/scsc_mx.h>
+#include "mxlogger.h"
+
#ifdef CONFIG_SCSC_WLBTD
#include "scsc_wlbtd.h"
#endif
module_param_string(collection_target_directory, collection_dir_buf, sizeof(collection_dir_buf), S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(collection_target_directory, "Specify collection target directory");
+static bool sable_collection_off;
+static int sable_collection_off_set_param_cb(const char *val,
+ const struct kernel_param *kp)
+{
+ bool nval;
+
+ if (!val || strtobool(val, &nval))
+ return -EINVAL;
+
+ if (sable_collection_off ^ nval) {
+ sable_collection_off = nval;
+ mxlogger_set_enabled_status(!sable_collection_off);
+ pr_info("Sable Log Collection is now %sABLED.\n",
+ sable_collection_off ? "DIS" : "EN");
+ }
+ return 0;
+}
+
+/**
+ * As described in struct kernel_param+ops the _get method:
+ * -> returns length written or -errno. Buffer is 4k (ie. be short!)
+ */
+static int sable_collection_off_get_param_cb(char *buffer,
+ const struct kernel_param *kp)
+{
+ return sprintf(buffer, "%c", sable_collection_off ? 'Y' : 'N');
+}
+
+static struct kernel_param_ops sable_collection_off_ops = {
+ .set = sable_collection_off_set_param_cb,
+ .get = sable_collection_off_get_param_cb,
+};
+module_param_cb(sable_collection_off, &sable_collection_off_ops, NULL, 0644);
+MODULE_PARM_DESC(sable_collection_off, "Disable SABLE Log Collection. This will inhibit also MXLOGGER");
+
struct scsc_log_client {
struct list_head list;
struct scsc_log_collector_client *collect_client;
log_status.collection_workq = create_workqueue("log_collector");
if (log_status.collection_workq)
INIT_WORK(&log_status.collect_work, collection_worker);
+ /* Update mxlogger status on init.*/
+ pr_info("Sable Log Collection is now %sABLED.\n",
+ sable_collection_off ? "DIS" : "EN");
+ mxlogger_set_enabled_status(!sable_collection_off);
scsc_log_collect_proc_create();
return 0;
}
int scsc_log_collector_collect(enum scsc_log_reason reason)
{
- int ret;
+ int ret = -1;
+
+ if (sable_collection_off) {
+ pr_info("Sable Log Collection is currently DISABLED (sable_collection_off=Y).\n");
+ pr_info("Ignoring incoming Sable Collection request with Reason=%d.\n", reason);
+ return ret;
+ }
if (collect_to_ram)
ret = __scsc_log_collector_collect_to_ram(reason);