Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ddff0c58 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "slim-msm-ngd: Create a IPC error logging file"

parents 09c459de f8fb7fb3
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1754,6 +1754,7 @@ static int ngd_slim_probe(struct platform_device *pdev)
	bool			rxreg_access = false;
	bool			slim_mdm = false;
	const char		*ext_modem_id = NULL;
	char			ipc_err_log_name[30];

	if (of_device_is_compatible(pdev->dev.of_node,
				    "qcom,iommu-slim-ctrl-cb"))
@@ -1820,6 +1821,21 @@ static int ngd_slim_probe(struct platform_device *pdev)
		SLIM_INFO(dev, "start logging for slim dev %s\n",
				dev_name(dev->dev));
	}

	/* Create Error IPC log context */
	memset(ipc_err_log_name, 0, sizeof(ipc_err_log_name));
	scnprintf(ipc_err_log_name, sizeof(ipc_err_log_name), "%s%s",
						dev_name(dev->dev), "_err");
	dev->ipc_slimbus_log_err =
		ipc_log_context_create(IPC_SLIMBUS_LOG_PAGES,
						ipc_err_log_name, 0);
	if (!dev->ipc_slimbus_log_err)
		dev_err(&pdev->dev,
			"error creating ipc_error_logging context\n");
	else
		SLIM_INFO(dev, "start error logging for slim dev %s\n",
							ipc_err_log_name);

	ret = sysfs_create_file(&dev->dev->kobj, &dev_attr_debug_mask.attr);
	if (ret) {
		dev_err(&pdev->dev, "Failed to create dev. attr\n");
+18 −4
Original line number Diff line number Diff line
@@ -314,6 +314,7 @@ struct msm_slim_ctrl {
	int			ipc_log_mask;
	bool			sysfs_created;
	void			*ipc_slimbus_log;
	void			*ipc_slimbus_log_err;
	void (*rx_slim)(struct msm_slim_ctrl *dev, u8 *buf);
	u32			current_rx_buf[10];
	int			current_count;
@@ -369,6 +370,9 @@ enum {
	if (dev->ipc_slimbus_log && dev->ipc_log_mask >= DBG_LEV) { \
		ipc_log_string(dev->ipc_slimbus_log, x); \
	} \
	if (dev->ipc_slimbus_log_err && dev->ipc_log_mask == FATAL_LEV) { \
		ipc_log_string(dev->ipc_slimbus_log_err, x); \
	} \
} while (0)

#define SLIM_INFO(dev, x...) do { \
@@ -376,26 +380,36 @@ enum {
	if (dev->ipc_slimbus_log && dev->ipc_log_mask >= INFO_LEV) {\
		ipc_log_string(dev->ipc_slimbus_log, x); \
	} \
	if (dev->ipc_slimbus_log_err && dev->ipc_log_mask == FATAL_LEV) { \
		ipc_log_string(dev->ipc_slimbus_log_err, x); \
	} \
} while (0)

/* warnings and errors show up on console always */
#define SLIM_WARN(dev, x...) do { \
	if (dev->ipc_slimbus_log && dev->ipc_log_mask >= WARN_LEV) { \
		pr_warn(x); \
	if (dev->ipc_slimbus_log && dev->ipc_log_mask >= WARN_LEV) \
		ipc_log_string(dev->ipc_slimbus_log, x); \
	} \
	if (dev->ipc_slimbus_log_err && dev->ipc_log_mask == FATAL_LEV) { \
		ipc_log_string(dev->ipc_slimbus_log_err, x); \
	} \
} while (0)

/* ERROR condition in the driver sets the hs_serial_debug_mask
 * to ERR_FATAL level, so that this message can be seen
 * in IPC logging. Further errors continue to log on the console
 * in IPC logging. Further errors continue to log on the error IPC logging.
 */
#define SLIM_ERR(dev, x...) do { \
	pr_err(x); \
	if (dev->ipc_slimbus_log && dev->ipc_log_mask >= ERR_LEV) { \
		pr_err(x); \
		ipc_log_string(dev->ipc_slimbus_log, x); \
		dev->default_ipc_log_mask = dev->ipc_log_mask; \
		dev->ipc_log_mask = FATAL_LEV; \
	} \
	if (dev->ipc_slimbus_log_err && dev->ipc_log_mask == FATAL_LEV) { \
		ipc_log_string(dev->ipc_slimbus_log_err, x); \
	} \
} while (0)

#define SLIM_RST_LOGLVL(dev) { \