diff --git a/Kbuild b/Kbuild index b9e44f270a..ee0fb4e53e 100755 --- a/Kbuild +++ b/Kbuild @@ -624,7 +624,6 @@ BMI_DIR := core/bmi BMI_INC := -I$(WLAN_ROOT)/$(BMI_DIR)/inc -ifneq ($(CONFIG_ICNSS), y) BMI_OBJS := $(BMI_DIR)/src/bmi.o \ $(BMI_DIR)/src/ol_fw.o ifeq ($(CONFIG_FEATURE_BMI_2), y) @@ -632,7 +631,6 @@ BMI_OBJS += $(BMI_DIR)/src/bmi_2.o else BMI_OBJS += $(BMI_DIR)/src/bmi_1.o endif -endif ########### WMI ########### WMI_DIR := core/wmi diff --git a/core/bmi/inc/bmi.h b/core/bmi/inc/bmi.h index 1c79317385..bf26ffba40 100644 --- a/core/bmi/inc/bmi.h +++ b/core/bmi/inc/bmi.h @@ -62,24 +62,7 @@ struct ol_config_info { void ol_init_ini_config(struct ol_context *ol_ctx, struct ol_config_info *cfg); -#ifdef HIF_PCI void bmi_cleanup(struct ol_context *scn); QDF_STATUS bmi_done(struct ol_context *ol_ctx); QDF_STATUS bmi_download_firmware(struct ol_context *ol_ctx); -#else -static inline void bmi_cleanup(struct ol_context *scn) -{ - return; -} - -static inline QDF_STATUS bmi_done(struct ol_context *ol_ctx) -{ - return QDF_STATUS_SUCCESS; -} - -static inline QDF_STATUS bmi_download_firmware(struct ol_context *ol_ctx) -{ - return QDF_STATUS_SUCCESS; -} -#endif #endif /* _BMI_H_ */ diff --git a/core/bmi/inc/ol_fw.h b/core/bmi/inc/ol_fw.h index d417bb3fe0..963cacc6b7 100644 --- a/core/bmi/inc/ol_fw.h +++ b/core/bmi/inc/ol_fw.h @@ -47,12 +47,5 @@ #define AR6320_REV4_VERSION AR6320_REV2_1_VERSION #define AR6320_DEV_VERSION 0x1000000 -#ifdef HIF_PCI void ol_target_failure(void *instance, QDF_STATUS status); -#else -static inline void ol_target_failure(void *instance, QDF_STATUS status) -{ - return; -} -#endif #endif /* _OL_FW_H_ */ diff --git a/core/bmi/src/bmi.c b/core/bmi/src/bmi.c index d9de534cd0..0a15dd4126 100644 --- a/core/bmi/src/bmi.c +++ b/core/bmi/src/bmi.c @@ -105,9 +105,15 @@ end: void bmi_cleanup(struct ol_context *ol_ctx) { struct bmi_info *info = GET_BMI_CONTEXT(ol_ctx); - qdf_device_t qdf_dev = ol_ctx->qdf_dev; + qdf_device_t qdf_dev; - if (!qdf_dev->dev) { + if (!info || !ol_ctx) { + BMI_WARN("%s: no bmi to cleanup", __func__); + return; + } + + qdf_dev = ol_ctx->qdf_dev; + if (!qdf_dev || !qdf_dev->dev) { BMI_ERR("%s: Invalid Device Pointer", __func__); return; } @@ -129,16 +135,34 @@ void bmi_cleanup(struct ol_context *ol_ctx) } } - +/** + * bmi_done() - finish the bmi opperation + * @ol_ctx: the bmi context + * + * does some sanity checking. + * exchanges one last message with firmware. + * frees some buffers. + * + * Return: QDF_STATUS_SUCCESS if bmi isn't needed. + * QDF_STATUS_SUCCESS if bmi finishes. + * otherwise returns failure. + */ QDF_STATUS bmi_done(struct ol_context *ol_ctx) { QDF_STATUS status = QDF_STATUS_SUCCESS; if (NO_BMI) - return status; + return QDF_STATUS_SUCCESS; + + if (!ol_ctx) { + BMI_ERR("%s: null context", __func__); + return QDF_STATUS_E_NOMEM; + } + + if (!hif_needs_bmi(ol_ctx->scn)) + return QDF_STATUS_SUCCESS; status = bmi_done_local(ol_ctx); - if (status != QDF_STATUS_SUCCESS) BMI_ERR("BMI_DONE Failed status:%d", status); @@ -203,8 +227,8 @@ QDF_STATUS bmi_download_firmware(struct ol_context *ol_ctx) int32_t ret; struct hif_opaque_softc *scn = ol_ctx->scn; - if (NO_BMI) - return QDF_STATUS_SUCCESS; /* no BMI for Q6 bring up */ + if (NO_BMI || !hif_needs_bmi(scn)) + return QDF_STATUS_SUCCESS; if (!scn) { BMI_ERR("Invalid scn context"); diff --git a/core/bmi/src/ol_fw.c b/core/bmi/src/ol_fw.c index d1980f47ba..effd599f63 100644 --- a/core/bmi/src/ol_fw.c +++ b/core/bmi/src/ol_fw.c @@ -617,6 +617,11 @@ void ol_target_failure(void *instance, QDF_STATUS status) ol_target_status target_status = hif_get_target_status(scn); + if (hif_get_bus_type(scn) == QDF_BUS_TYPE_SNOC) { + BMI_ERR("SNOC doesn't suppor this code path!"); + return; + } + qdf_event_set(&wma->recovery_event); if (OL_TRGET_STATUS_RESET == target_status) { @@ -1422,6 +1427,7 @@ int ol_diag_read(struct hif_opaque_softc *scn, uint8_t *buffer, return -EIO; } +#ifdef HIF_PCI static int ol_ath_get_reg_table(uint32_t target_version, tgt_reg_table *reg_table) { @@ -1522,6 +1528,13 @@ static int ol_diag_read_reg_loc(struct hif_opaque_softc *scn, uint8_t *buffer, out: return result; } +#else +static int ol_diag_read_reg_loc(struct hif_opaque_softc *scn, uint8_t *buffer, + uint32_t buffer_len) +{ + return -EINVAL; +} +#endif void ol_dump_target_memory(struct hif_opaque_softc *scn, void *memory_block) {