int remoteproc_resource_deinit(struct remote_proc *rproc) { int i = 0; struct proc_vring *vring_hw = 0; if (rproc) { if (rproc->rdev) { /* disable IPC interrupts */ if (rproc->proc->ops->reg_ipi_after_deinit) { for(i = 0; i < 2; i++) { vring_hw = &rproc->proc->vdev.vring_info[i]; rproc->proc->ops->reg_ipi_after_deinit(vring_hw); } } rpmsg_deinit(rproc->rdev); } if (rproc->proc) { hil_delete_proc(rproc->proc); } env_free_memory(rproc); } env_deinit(); /* Disable the caches - This is required if master boots firmwares * multiple times without hard reset on same core. If caches are * not invalidated at this point in time then subsequent firmware * boots on the same core may experience cache inconsistencies. * */ env_disable_cache(); return RPROC_SUCCESS; }
int rpmsg_init(int dev_id, struct remote_device **rdev, rpmsg_chnl_cb_t channel_created, rpmsg_chnl_cb_t channel_destroyed, rpmsg_rx_cb_t default_cb, int role) { int status; /* Initialize IPC environment */ status = env_init(); if (status == RPMSG_SUCCESS) { /* Initialize the remote device for given cpu id */ status = rpmsg_rdev_init(rdev, dev_id, role, channel_created, channel_destroyed, default_cb); if (status == RPMSG_SUCCESS) { /* Kick off IPC with the remote device */ status = rpmsg_start_ipc(*rdev); } } /* Deinit system in case of error */ if (status != RPMSG_SUCCESS) { rpmsg_deinit(*rdev); } return status; }
/** * remoteproc_shutdown * * This function shutdowns the remote execution context * * @param rproc - pointer to remote proc instance to shutdown * * @param returns - status of function execution */ int remoteproc_shutdown(struct remote_proc *rproc) { if (rproc) { if (rproc->rdev) { rpmsg_deinit(rproc->rdev); rproc->rdev = RPROC_NULL; } if (rproc->proc) { hil_shutdown_cpu(rproc->proc); } } return RPROC_SUCCESS; }