qcacmn: Converge dbglog and diag_event_log

Converge dbglog and diag_event_log component through fwlog api
interface. It abstracts dbglog and diag_event_log from other
components.

Change-Id: I8f86a4381fbb9af8386320906337638113c8f189
CRs-Fixed: 2217556
This commit is contained in:
Pratik Gandhi
2018-04-04 18:07:57 +05:30
committed by Gerrit - the friendly Code Review server
parent e5515b01bf
commit b002f889e7
5 changed files with 402 additions and 0 deletions

View File

@@ -106,6 +106,7 @@ struct host_fw_ver {
uint32_t abi_ver;
};
struct common_dbglog_handle;
/**
* struct comp_hdls - Non-umac/lower layer components handles, it is a sub
@@ -114,12 +115,14 @@ struct host_fw_ver {
* @htc_hdl: HTC handle
* @wmi_hdl: WMI handle
* @accelerator_hdl: NSS offload/IPA handle
* @dbglog_hdl: Debug log handle
*/
struct comp_hdls {
void *hif_hdl;
void *htc_hdl;
void *wmi_hdl;
void *accelerator_hdl;
struct common_dbglog_handle *dbglog_hdl;
};
/**
@@ -1104,6 +1107,42 @@ static inline uint32_t target_psoc_get_target_rev
return psoc_info->info.version.target_rev;
}
/**
* target_psoc_set_dbglog_hdl - set dbglog_hdl
* @psoc_info: pointer to structure target_psoc_info
* @dbglog_hdl: dbglog handle
*
* API to set dbglog_hdl
*
* Return: void
*/
static inline void target_psoc_set_dbglog_hdl
(struct target_psoc_info *psoc_info,
struct common_dbglog_handle *dbglog_hdl)
{
if (psoc_info == NULL)
return;
psoc_info->hdls.dbglog_hdl = dbglog_hdl;
}
/**
* target_psoc_get_dbglog_hdl() - get dbglog_hdl
* @psoc_info: pointer to structure target_psoc_info
*
* API to get dbglog_hdl
*
* Return: dbglog_hdl
*/
static inline struct common_dbglog_handle *target_psoc_get_dbglog_hdl
(struct target_psoc_info *psoc_info)
{
if (psoc_info == NULL)
return NULL;
return psoc_info->hdls.dbglog_hdl;
}
/**
* target_psoc_get_wlan_res_cfg() - get wlan_res_cfg
* @psoc_info: pointer to structure target_psoc_info

View File

@@ -334,6 +334,7 @@ void *ucfg_get_pdev_wmi_handle(struct wlan_objmgr_pdev *pdev)
return target_pdev_get_wmi_handle(tgt_hdl);
}
qdf_export_symbol(ucfg_get_pdev_wmi_handle);
uint32_t ucfg_get_num_radios(struct wlan_objmgr_psoc *psoc)
{

140
utils/fwlog/fw_dbglog_api.c Normal file
View File

@@ -0,0 +1,140 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#include "fw_dbglog_api.h"
#include "fw_dbglog_priv.h"
static inline struct dbglog_info *handle2info(
struct common_dbglog_handle *dbg_handle)
{
return (struct dbglog_info *)dbg_handle;
}
void fwdbg_set_log_lvl(struct common_dbglog_handle *dbg_handle, ol_scn_t scn,
uint32_t log_lvl)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_set_log_lvl)
dbg_info->ops->dbglog_set_log_lvl(scn, log_lvl);
}
int fwdbg_fw_handler(struct common_dbglog_handle *dbg_handle, ol_scn_t soc,
uint8_t *data, uint32_t datalen)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_fw_handler)
return dbg_info->ops->dbglog_fw_handler(soc, data, datalen);
return 0;
}
int fwdbg_parse_debug_logs(struct common_dbglog_handle *dbg_handle,
const char *name, uint8_t *datap, uint16_t len, void *context)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_parse_debug_logs)
return dbg_info->ops->dbglog_parse_debug_logs(name,
datap, len, context);
return 0;
}
void fwdbg_ratelimit_set(struct common_dbglog_handle *dbg_handle,
uint32_t burst_limit)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_ratelimit_set)
dbg_info->ops->dbglog_ratelimit_set(burst_limit);
}
void fwdbg_vap_log_enable(struct common_dbglog_handle *dbg_handle, ol_scn_t scn,
uint16_t vap_id, bool isenable)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_vap_log_enable)
dbg_info->ops->dbglog_vap_log_enable(scn, vap_id,
isenable);
}
void fwdbg_set_timestamp_resolution(struct common_dbglog_handle *dbg_handle,
ol_scn_t scn, uint16_t tsr)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_set_timestamp_resolution)
dbg_info->ops->dbglog_set_timestamp_resolution(scn, tsr);
}
void fwdbg_reporting_enable(struct common_dbglog_handle *dbg_handle,
ol_scn_t scn, bool isenable)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_reporting_enable)
dbg_info->ops->dbglog_reporting_enable(scn, isenable);
}
void fwdbg_module_log_enable(struct common_dbglog_handle *dbg_handle,
ol_scn_t scn, uint32_t mod_id, bool isenable)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_module_log_enable)
dbg_info->ops->dbglog_module_log_enable(scn, mod_id,
isenable);
}
void fwdbg_init(struct common_dbglog_handle *dbg_handle, void *soc)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_init)
dbg_info->ops->dbglog_init(soc);
}
void fwdbg_free(struct common_dbglog_handle *dbg_handle, void *soc)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_free)
dbg_info->ops->dbglog_free(soc);
}
void fwdbg_set_report_size(struct common_dbglog_handle *dbg_handle,
ol_scn_t scn, uint16_t size)
{
struct dbglog_info *dbg_info = handle2info(dbg_handle);
if (dbg_info->ops->dbglog_set_report_size)
dbg_info->ops->dbglog_set_report_size(scn, size);
}

View File

@@ -0,0 +1,172 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef _FW_DBGLOG_API_H_
#define _FW_DBGLOG_API_H_
#include "target_if.h"
/**
* fwdbg_set_log_lvl() - API to set debug log level
* @dbg_handle: Debug module handle
* @scn: scn handle
* @log_lvl: value of log level
*
* Send wmi configuration command to set debug log level.
*
* Return: None
*/
void fwdbg_set_log_lvl(struct common_dbglog_handle *dbg_handle, ol_scn_t scn,
uint32_t log_lvl);
/**
* fwdbg_fw_handler() - Firmware handler interface
* @dbg_handle: Debug module handle
* @sc: soc handle
* @data: Reference to command data
* @datalen: length of data
*
* Return: 0 success
*/
int fwdbg_fw_handler(struct common_dbglog_handle *dbg_handle, ol_scn_t sc,
uint8_t *data, uint32_t datalen);
/**
* fwdbg_parse_debug_logs() - API to parse firmware debug logs
* @dbg_handle: Debug module handle
* @name: device name
* @datap: Reference to log data
* @len: length of data
* @context: log context
*
* API parse firmware debug log messages and prints to console.
*
* Return: 0 success
*/
int fwdbg_parse_debug_logs(struct common_dbglog_handle *dbg_handle,
const char *name, uint8_t *datap,
uint16_t len, void *context);
/**
* fwdbg_ratelimit_set() - API to set rate limit
* @dbg_handle: Debug module handle
* @burst_limit: burst limit
*
* Return: None
*/
void fwdbg_ratelimit_set(struct common_dbglog_handle *dbg_handle,
uint32_t burst_limit);
/**
* fwdbg_vap_log_enable() - API to Enable/Disable the logging for VAP
* @dbg_handle: Debug module handle
* @scn: scn handle
* @vap_id: VAP id
* @isenable: Enable/disable
*
* API allows to enable or disable debuglogs at VAP level. It encodes wmi
* config command based on VAP id and sends wmi command to firmware to
* enable/disable debuglog.
*
* Return: None
*/
void fwdbg_vap_log_enable(struct common_dbglog_handle *dbg_handle, ol_scn_t scn,
uint16_t vap_id, bool isenable);
/**
* fwdbg_set_timestamp_resolution - Set the resolution for time stamp
* @dbg_handle: Debug module handle
* @scn: scn handle
* @tsr: time stamp resolution
*
* Set the resolution for time stamp in debug logs. It encodes wmi
* config command to desired timestamp resolution and sends wmi command to
* firmware.
*
* Return: None
*/
void fwdbg_set_timestamp_resolution(struct common_dbglog_handle *dbg_handle,
ol_scn_t scn, uint16_t tsr);
/**
* fwdbg_reporting_enable() - Enable reporting.
* @dbg_handle: Debug module handle
* @scn: scn handle
* @isenable: Enable/disable
*
* API to enable debug information reporting. It encodes wmi config command
* to enable reporting. If set to false then Target wont deliver any debug
* information.
*
* Return: None
*/
void fwdbg_reporting_enable(struct common_dbglog_handle *dbg_handle,
ol_scn_t scn, bool isenable);
/**
* fwdbg_module_log_enable() - Enable/Disable logging for Module.
* @dbg_handle: Debug module handle
* @scn: scn handle
* @mod_id: Module id
* @isenable: Enable/disable
*
* API allows to enable or disable debuglogs per module. It encodes wmi
* config command based on module id and sends wmi command to firmware to
* enable/disable debuglog for that module.
*
* Return: None
*/
void fwdbg_module_log_enable(struct common_dbglog_handle *dbg_handle,
ol_scn_t scn, uint32_t mod_id, bool isenable);
/**
* fwdbg_init() - Initialize debuglog.
* @dbg_handle: Debug module handle
* @soc: soc handle
*
* It initializes debuglog print function for set of modules and
* initializes WMI event handler for debuglog message event.
*
* Return: None
*/
void fwdbg_init(struct common_dbglog_handle *dbg_handle, void *soc);
/**
* fwdbg_free() - Free debug handler.
* @dbg_handle: Debug module handle
* @soc: soc handle
*
* Return: None
*/
void fwdbg_free(struct common_dbglog_handle *dbg_handle, void *soc);
/**
* fwdbg_set_report_size() - set the size of the report size
* @dbg_handle: Debug module handle
* @scn: soc handler
* @size: Report size
*
* Set the debug log report size. It encodes wmi config command to
* desired report size and sends wmi command to firmware.
*
* Return: None
*/
void fwdbg_set_report_size(struct common_dbglog_handle *dbg_handle,
ol_scn_t scn, uint16_t size);
#endif /* _FW_DBGLOG_API_H_ */

View File

@@ -0,0 +1,50 @@
/*
* Copyright (c) 2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/*
* This file contains the API definitions for the Unified Wireless
* Module Interface (WMI).
*/
#ifndef _FW_DBGLOG_PRIV_H_
#define _FW_DBGLOG_PRIV_H_
#include <wmi_unified_api.h>
struct dbglog_ops {
void (*dbglog_set_log_lvl)(ol_scn_t scn, uint32_t log_lvl);
int (*dbglog_fw_handler)(ol_scn_t soc, uint8_t *data, uint32_t datalen);
int (*dbglog_parse_debug_logs)(const char *name,
u_int8_t *datap, uint16_t len, void *context);
void (*dbglog_ratelimit_set)(uint32_t burst_limit);
void (*dbglog_vap_log_enable)(ol_scn_t soc, uint16_t vap_id,
bool isenable);
void (*dbglog_set_timestamp_resolution)(ol_scn_t soc, uint16_t tsr);
void (*dbglog_reporting_enable)(ol_scn_t soc, bool isenable);
void (*dbglog_module_log_enable)(ol_scn_t scn,
uint32_t mod_id, bool isenable);
void (*dbglog_init)(void *scn);
void (*dbglog_set_report_size)(ol_scn_t scn, uint16_t size);
void (*dbglog_free)(void *soc);
};
struct dbglog_info {
struct dbglog_ops *ops;
};
#endif /*_FW_DBGLOG_PRIV_H_ */