Loading drivers/soc/qcom/pil_bg_intf.h +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ enum bg_tz_commands { BGPIL_IMAGE_LOAD, BGPIL_AUTH_MDT, BGPIL_DLOAD_CONT, BGPIL_GET_BG_VERSION, }; /* tzapp bg request.*/ Loading drivers/soc/qcom/subsys-pil-bg.c +37 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ #define desc_to_data(d) container_of(d, struct pil_bg_data, desc) #define subsys_to_data(d) container_of(d, struct pil_bg_data, subsys_desc) #define BG_RAMDUMP_SZ 0x00102000 #define BG_VERSION_SZ 32 #define BG_CRASH_IN_TWM -2 /** * struct pil_bg_data Loading Loading @@ -213,6 +214,15 @@ static long bgpil_tzapp_comm(struct pil_bg_data *pbd, pbd->cmd_status = bg_tz_rsp->status; else pbd->cmd_status = 0; /* if last command sent was BG_VERSION print the version*/ if (req->tzapp_bg_cmd == BGPIL_GET_BG_VERSION) { int i; pr_info("BG FW ver "); for (i = 0; i < bg_tz_rsp->bg_info_len; i++) pr_info("0x%08x ", bg_tz_rsp->bg_info[i]); pr_info("\n"); } end: return rc; } Loading Loading @@ -392,6 +402,32 @@ static int bg_get_firmware_addr(struct pil_desc *pil, return 0; } static int bg_get_version(const struct subsys_desc *subsys) { struct pil_bg_data *bg_data = subsys_to_data(subsys); struct pil_desc desc = bg_data->desc; struct tzapp_bg_req bg_tz_req; int ret; struct device dev = {NULL}; arch_setup_dma_ops(&dev, 0, 0, NULL, 0); desc.attrs = 0; desc.attrs |= DMA_ATTR_SKIP_ZEROING; desc.attrs |= DMA_ATTR_STRONGLY_ORDERED; bg_tz_req.tzapp_bg_cmd = BGPIL_GET_BG_VERSION; ret = bgpil_tzapp_comm(bg_data, &bg_tz_req); if (ret || bg_data->cmd_status) { dev_dbg(desc.dev, "%s: BG PIL get BG version failed error %d\n", __func__, bg_data->cmd_status); return bg_data->cmd_status; } return 0; } /** * bg_auth_and_xfer() - Called by Peripheral loader framework Loading Loading @@ -426,6 +462,7 @@ static int bg_auth_and_xfer(struct pil_desc *pil) pil_free_memory(&bg_data->desc); return bg_data->cmd_status; } ret = bg_get_version(&bg_data->subsys_desc); /* BG Transfer of image is complete, free up the memory */ pr_debug("BG Firmware authentication and transfer done\n"); pil_free_memory(&bg_data->desc); Loading Loading
drivers/soc/qcom/pil_bg_intf.h +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ enum bg_tz_commands { BGPIL_IMAGE_LOAD, BGPIL_AUTH_MDT, BGPIL_DLOAD_CONT, BGPIL_GET_BG_VERSION, }; /* tzapp bg request.*/ Loading
drivers/soc/qcom/subsys-pil-bg.c +37 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ #define desc_to_data(d) container_of(d, struct pil_bg_data, desc) #define subsys_to_data(d) container_of(d, struct pil_bg_data, subsys_desc) #define BG_RAMDUMP_SZ 0x00102000 #define BG_VERSION_SZ 32 #define BG_CRASH_IN_TWM -2 /** * struct pil_bg_data Loading Loading @@ -213,6 +214,15 @@ static long bgpil_tzapp_comm(struct pil_bg_data *pbd, pbd->cmd_status = bg_tz_rsp->status; else pbd->cmd_status = 0; /* if last command sent was BG_VERSION print the version*/ if (req->tzapp_bg_cmd == BGPIL_GET_BG_VERSION) { int i; pr_info("BG FW ver "); for (i = 0; i < bg_tz_rsp->bg_info_len; i++) pr_info("0x%08x ", bg_tz_rsp->bg_info[i]); pr_info("\n"); } end: return rc; } Loading Loading @@ -392,6 +402,32 @@ static int bg_get_firmware_addr(struct pil_desc *pil, return 0; } static int bg_get_version(const struct subsys_desc *subsys) { struct pil_bg_data *bg_data = subsys_to_data(subsys); struct pil_desc desc = bg_data->desc; struct tzapp_bg_req bg_tz_req; int ret; struct device dev = {NULL}; arch_setup_dma_ops(&dev, 0, 0, NULL, 0); desc.attrs = 0; desc.attrs |= DMA_ATTR_SKIP_ZEROING; desc.attrs |= DMA_ATTR_STRONGLY_ORDERED; bg_tz_req.tzapp_bg_cmd = BGPIL_GET_BG_VERSION; ret = bgpil_tzapp_comm(bg_data, &bg_tz_req); if (ret || bg_data->cmd_status) { dev_dbg(desc.dev, "%s: BG PIL get BG version failed error %d\n", __func__, bg_data->cmd_status); return bg_data->cmd_status; } return 0; } /** * bg_auth_and_xfer() - Called by Peripheral loader framework Loading Loading @@ -426,6 +462,7 @@ static int bg_auth_and_xfer(struct pil_desc *pil) pil_free_memory(&bg_data->desc); return bg_data->cmd_status; } ret = bg_get_version(&bg_data->subsys_desc); /* BG Transfer of image is complete, free up the memory */ pr_debug("BG Firmware authentication and transfer done\n"); pil_free_memory(&bg_data->desc); Loading