Loading drivers/bus/mhi/core/mhi_boot.c +14 −7 Original line number Diff line number Diff line Loading @@ -428,17 +428,22 @@ static int mhi_fw_load_sbl(struct mhi_controller *mhi_cntrl, } void mhi_free_bhie_table(struct mhi_controller *mhi_cntrl, struct image_info *image_info) struct image_info **image_info) { int i; struct mhi_buf *mhi_buf = image_info->mhi_buf; struct mhi_buf *mhi_buf = (*image_info)->mhi_buf; for (i = 0; i < image_info->entries; i++, mhi_buf++) if (mhi_cntrl->img_pre_alloc) return; for (i = 0; i < (*image_info)->entries; i++, mhi_buf++) mhi_free_contig_coherent(mhi_cntrl, mhi_buf->len, mhi_buf->buf, mhi_buf->dma_addr); kfree(image_info->mhi_buf); kfree(image_info); kfree((*image_info)->mhi_buf); kfree(*image_info); *image_info = NULL; } int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, Loading @@ -452,6 +457,9 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, struct image_info *img_info; struct mhi_buf *mhi_buf; if (mhi_cntrl->img_pre_alloc) return 0; MHI_CNTRL_LOG("Allocating bytes:%zu seg_size:%zu total_seg:%u\n", alloc_size, seg_size, segments); Loading Loading @@ -670,8 +678,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) return; error_read: mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image); mhi_cntrl->fbc_image = NULL; mhi_free_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image); error_alloc_fw_table: release_firmware(firmware); Loading drivers/bus/mhi/core/mhi_init.c +6 −12 Original line number Diff line number Diff line Loading @@ -1793,10 +1793,8 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl) return 0; bhie_error: if (mhi_cntrl->rddm_image) { mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->rddm_image); mhi_cntrl->rddm_image = NULL; } if (mhi_cntrl->rddm_image) mhi_free_bhie_table(mhi_cntrl, &mhi_cntrl->rddm_image); error_dev_ctxt: mutex_unlock(&mhi_cntrl->pm_mutex); Loading @@ -1807,15 +1805,11 @@ EXPORT_SYMBOL(mhi_prepare_for_power_up); void mhi_unprepare_after_power_down(struct mhi_controller *mhi_cntrl) { if (mhi_cntrl->fbc_image) { mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image); mhi_cntrl->fbc_image = NULL; } if (mhi_cntrl->fbc_image) mhi_free_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image); if (mhi_cntrl->rddm_image) { mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->rddm_image); mhi_cntrl->rddm_image = NULL; } if (mhi_cntrl->rddm_image) mhi_free_bhie_table(mhi_cntrl, &mhi_cntrl->rddm_image); mhi_deinit_dev_ctxt(mhi_cntrl); mhi_cntrl->pre_init = false; Loading drivers/bus/mhi/core/mhi_internal.h +1 −1 Original line number Diff line number Diff line Loading @@ -940,7 +940,7 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl); int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, struct image_info **image_info, size_t alloc_size); void mhi_free_bhie_table(struct mhi_controller *mhi_cntrl, struct image_info *image_info); struct image_info **image_info); int mhi_map_single_no_bb(struct mhi_controller *mhi_cntrl, struct mhi_buf_info *buf_info); Loading drivers/bus/mhi/core/mhi_pm.c +3 −4 Original line number Diff line number Diff line Loading @@ -1110,10 +1110,9 @@ void mhi_power_down(struct mhi_controller *mhi_cntrl, bool graceful) if (!mhi_cntrl->pre_init) { /* free all allocated resources */ if (mhi_cntrl->fbc_image) { mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image); mhi_cntrl->fbc_image = NULL; } if (mhi_cntrl->fbc_image) mhi_free_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image); mhi_deinit_dev_ctxt(mhi_cntrl); } } Loading include/linux/mhi.h +3 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,7 @@ struct reg_write_info { * @rddm_size: RAM dump size that host should allocate for debugging purpose * @sbl_size: SBL image size * @seg_len: BHIe vector size * @img_pre_alloc: allocate rddm and fbc image buffers one time * @fbc_image: Points to firmware image buffer * @rddm_image: Points to RAM dump buffer * @max_chan: Maximum number of channels controller support Loading Loading @@ -294,6 +295,8 @@ struct mhi_controller { size_t seg_len; u32 session_id; u32 sequence_id; bool img_pre_alloc; struct image_info *fbc_image; struct image_info *rddm_image; Loading Loading
drivers/bus/mhi/core/mhi_boot.c +14 −7 Original line number Diff line number Diff line Loading @@ -428,17 +428,22 @@ static int mhi_fw_load_sbl(struct mhi_controller *mhi_cntrl, } void mhi_free_bhie_table(struct mhi_controller *mhi_cntrl, struct image_info *image_info) struct image_info **image_info) { int i; struct mhi_buf *mhi_buf = image_info->mhi_buf; struct mhi_buf *mhi_buf = (*image_info)->mhi_buf; for (i = 0; i < image_info->entries; i++, mhi_buf++) if (mhi_cntrl->img_pre_alloc) return; for (i = 0; i < (*image_info)->entries; i++, mhi_buf++) mhi_free_contig_coherent(mhi_cntrl, mhi_buf->len, mhi_buf->buf, mhi_buf->dma_addr); kfree(image_info->mhi_buf); kfree(image_info); kfree((*image_info)->mhi_buf); kfree(*image_info); *image_info = NULL; } int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, Loading @@ -452,6 +457,9 @@ int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, struct image_info *img_info; struct mhi_buf *mhi_buf; if (mhi_cntrl->img_pre_alloc) return 0; MHI_CNTRL_LOG("Allocating bytes:%zu seg_size:%zu total_seg:%u\n", alloc_size, seg_size, segments); Loading Loading @@ -670,8 +678,7 @@ void mhi_fw_load_handler(struct mhi_controller *mhi_cntrl) return; error_read: mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image); mhi_cntrl->fbc_image = NULL; mhi_free_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image); error_alloc_fw_table: release_firmware(firmware); Loading
drivers/bus/mhi/core/mhi_init.c +6 −12 Original line number Diff line number Diff line Loading @@ -1793,10 +1793,8 @@ int mhi_prepare_for_power_up(struct mhi_controller *mhi_cntrl) return 0; bhie_error: if (mhi_cntrl->rddm_image) { mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->rddm_image); mhi_cntrl->rddm_image = NULL; } if (mhi_cntrl->rddm_image) mhi_free_bhie_table(mhi_cntrl, &mhi_cntrl->rddm_image); error_dev_ctxt: mutex_unlock(&mhi_cntrl->pm_mutex); Loading @@ -1807,15 +1805,11 @@ EXPORT_SYMBOL(mhi_prepare_for_power_up); void mhi_unprepare_after_power_down(struct mhi_controller *mhi_cntrl) { if (mhi_cntrl->fbc_image) { mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image); mhi_cntrl->fbc_image = NULL; } if (mhi_cntrl->fbc_image) mhi_free_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image); if (mhi_cntrl->rddm_image) { mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->rddm_image); mhi_cntrl->rddm_image = NULL; } if (mhi_cntrl->rddm_image) mhi_free_bhie_table(mhi_cntrl, &mhi_cntrl->rddm_image); mhi_deinit_dev_ctxt(mhi_cntrl); mhi_cntrl->pre_init = false; Loading
drivers/bus/mhi/core/mhi_internal.h +1 −1 Original line number Diff line number Diff line Loading @@ -940,7 +940,7 @@ void mhi_create_devices(struct mhi_controller *mhi_cntrl); int mhi_alloc_bhie_table(struct mhi_controller *mhi_cntrl, struct image_info **image_info, size_t alloc_size); void mhi_free_bhie_table(struct mhi_controller *mhi_cntrl, struct image_info *image_info); struct image_info **image_info); int mhi_map_single_no_bb(struct mhi_controller *mhi_cntrl, struct mhi_buf_info *buf_info); Loading
drivers/bus/mhi/core/mhi_pm.c +3 −4 Original line number Diff line number Diff line Loading @@ -1110,10 +1110,9 @@ void mhi_power_down(struct mhi_controller *mhi_cntrl, bool graceful) if (!mhi_cntrl->pre_init) { /* free all allocated resources */ if (mhi_cntrl->fbc_image) { mhi_free_bhie_table(mhi_cntrl, mhi_cntrl->fbc_image); mhi_cntrl->fbc_image = NULL; } if (mhi_cntrl->fbc_image) mhi_free_bhie_table(mhi_cntrl, &mhi_cntrl->fbc_image); mhi_deinit_dev_ctxt(mhi_cntrl); } } Loading
include/linux/mhi.h +3 −0 Original line number Diff line number Diff line Loading @@ -222,6 +222,7 @@ struct reg_write_info { * @rddm_size: RAM dump size that host should allocate for debugging purpose * @sbl_size: SBL image size * @seg_len: BHIe vector size * @img_pre_alloc: allocate rddm and fbc image buffers one time * @fbc_image: Points to firmware image buffer * @rddm_image: Points to RAM dump buffer * @max_chan: Maximum number of channels controller support Loading Loading @@ -294,6 +295,8 @@ struct mhi_controller { size_t seg_len; u32 session_id; u32 sequence_id; bool img_pre_alloc; struct image_info *fbc_image; struct image_info *rddm_image; Loading