Beispiel #1
0
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;
}
Beispiel #2
0
/**
 * rpmsg_rdev_deinit
 *
 * This function un-initializes the remote device.
 *
 * @param rdev - pointer to remote device to deinit.
 *
 * @return - none
 *
 */
void rpmsg_rdev_deinit(struct remote_device *rdev)
{
	struct llist *rp_chnl_head, *rp_chnl_temp, *node;
	struct rpmsg_channel *rp_chnl;

	rp_chnl_head = rdev->rp_channels;

	while (rp_chnl_head != RPMSG_NULL) {

		rp_chnl_temp = rp_chnl_head->next;
		rp_chnl = (struct rpmsg_channel *)rp_chnl_head->data;

		if (rdev->channel_destroyed) {
			rdev->channel_destroyed(rp_chnl);
		}

		if ((rdev->support_ns) && (rdev->role == RPMSG_MASTER)) {
			rpmsg_send_ns_message(rdev, rp_chnl, RPMSG_NS_DESTROY);
		}

		/* Delete default endpoint for channel */
		if (rp_chnl->rp_ept) {
			rpmsg_destroy_ept(rp_chnl->rp_ept);
		}

		_rpmsg_delete_channel(rp_chnl);
		rp_chnl_head = rp_chnl_temp;
	}

	/* Delete name service endpoint */
	node = rpmsg_rdev_get_endpoint_from_addr(rdev, RPMSG_NS_EPT_ADDR);
	if (node) {
		_destroy_endpoint(rdev, (struct rpmsg_endpoint *)node->data);
	}

	if (rdev->rvq) {
		virtqueue_free(rdev->rvq);
	}
	if (rdev->tvq) {
		virtqueue_free(rdev->tvq);
	}
	if (rdev->mem_pool) {
		sh_mem_delete_pool(rdev->mem_pool);
	}
	if (rdev->lock) {
		env_delete_mutex(rdev->lock);
	}
	if (rdev->proc) {
		hil_delete_proc(rdev->proc);
		rdev->proc = 0;
	}

	env_free_memory(rdev);
}
Beispiel #3
0
/**
 * remoteproc_deinit
 *
 * Uninitializes resources for remoteproc "master" configuration.
 *
 * @param rproc - pointer to remote proc instance
 *
 * @param returns - status of function execution
 *
 */
int remoteproc_deinit(struct remote_proc *rproc) {

    if (rproc) {
        if (rproc->loader) {
            (void) remoteproc_loader_delete(rproc->loader);
            rproc->loader = RPROC_NULL;
        }
        if (rproc->proc) {
            hil_delete_proc(rproc->proc);
            rproc->proc = RPROC_NULL;
        }
        env_free_memory(rproc);
    }

    env_deinit();

    return RPROC_SUCCESS;
}