diff options
Diffstat (limited to 'kernel/rpmsg')
-rw-r--r-- | kernel/rpmsg/ethosu_rpmsg_cancel_inference.c | 63 | ||||
-rw-r--r-- | kernel/rpmsg/ethosu_rpmsg_capabilities.c | 43 | ||||
-rw-r--r-- | kernel/rpmsg/ethosu_rpmsg_inference.c | 152 | ||||
-rw-r--r-- | kernel/rpmsg/ethosu_rpmsg_mailbox.c | 157 | ||||
-rw-r--r-- | kernel/rpmsg/ethosu_rpmsg_network.c | 76 | ||||
-rw-r--r-- | kernel/rpmsg/ethosu_rpmsg_network_info.c | 53 | ||||
-rw-r--r-- | kernel/rpmsg/ethosu_rpmsg_version.c | 40 |
7 files changed, 297 insertions, 287 deletions
diff --git a/kernel/rpmsg/ethosu_rpmsg_cancel_inference.c b/kernel/rpmsg/ethosu_rpmsg_cancel_inference.c index 5d46434..5fa7515 100644 --- a/kernel/rpmsg/ethosu_rpmsg_cancel_inference.c +++ b/kernel/rpmsg/ethosu_rpmsg_cancel_inference.c @@ -41,18 +41,19 @@ * Functions ****************************************************************************/ -static int ethosu_cancel_inference_send( - struct ethosu_cancel_inference *cancellation, - struct ethosu_mailbox *mailbox) +static int ethosu_rpmsg_cancel_inference_send( + struct ethosu_rpmsg_cancel_inference *cancellation, + struct ethosu_rpmsg_mailbox *mailbox) { - return ethosu_mailbox_cancel_inference(mailbox, - &cancellation->msg, - cancellation->inf->msg.id); + return ethosu_rpmsg_mailbox_cancel_inference(mailbox, + &cancellation->msg, + cancellation->inf->msg.id); } -static void ethosu_cancel_inference_fail(struct ethosu_mailbox_msg *msg) +static void ethosu_rpmsg_cancel_inference_fail( + struct ethosu_rpmsg_mailbox_msg *msg) { - struct ethosu_cancel_inference *cancellation = + struct ethosu_rpmsg_cancel_inference *cancellation = container_of(msg, typeof(*cancellation), msg); if (completion_done(&cancellation->done)) @@ -63,12 +64,12 @@ static void ethosu_cancel_inference_fail(struct ethosu_mailbox_msg *msg) complete(&cancellation->done); } -int ethosu_cancel_inference_request(struct device *dev, - struct ethosu_mailbox *mailbox, - struct ethosu_inference *inf, - struct ethosu_uapi_cancel_inference_status *uapi) +int ethosu_rpmsg_cancel_inference_request(struct device *dev, + struct ethosu_rpmsg_mailbox *mailbox, + struct ethosu_rpmsg_inference *inf, + struct ethosu_uapi_cancel_inference_status *uapi) { - struct ethosu_cancel_inference *cancellation; + struct ethosu_rpmsg_cancel_inference *cancellation; int ret; int timeout; @@ -80,13 +81,13 @@ int ethosu_cancel_inference_request(struct device *dev, cancellation = devm_kzalloc(dev, - sizeof(struct ethosu_cancel_inference), + sizeof(struct ethosu_rpmsg_cancel_inference), GFP_KERNEL); if (!cancellation) return -ENOMEM; /* increase ref count on the inference we are refering to */ - ethosu_inference_get(inf); + ethosu_rpmsg_inference_get(inf); /* mark inference ABORTING to avoid resending the inference message */ inf->status = ETHOSU_UAPI_STATUS_ABORTING; @@ -94,10 +95,10 @@ int ethosu_cancel_inference_request(struct device *dev, cancellation->inf = inf; cancellation->uapi = uapi; init_completion(&cancellation->done); - cancellation->msg.fail = ethosu_cancel_inference_fail; + cancellation->msg.fail = ethosu_rpmsg_cancel_inference_fail; - ret = ethosu_mailbox_register(mailbox, - &cancellation->msg); + ret = ethosu_rpmsg_mailbox_register(mailbox, + &cancellation->msg); if (ret < 0) goto kfree; @@ -105,7 +106,7 @@ int ethosu_cancel_inference_request(struct device *dev, "Inference cancellation create. cancel=0x%pK, msg.id=%ddev", cancellation, cancellation->msg.id); - ret = ethosu_cancel_inference_send(cancellation, mailbox); + ret = ethosu_rpmsg_cancel_inference_send(cancellation, mailbox); if (0 != ret) goto deregister; @@ -140,30 +141,30 @@ int ethosu_cancel_inference_request(struct device *dev, inf->status = ETHOSU_UAPI_STATUS_ABORTED; deregister: - ethosu_mailbox_deregister(mailbox, - &cancellation->msg); + ethosu_rpmsg_mailbox_deregister(mailbox, + &cancellation->msg); kfree: dev_dbg(dev, "Cancel inference destroy. cancel=0x%pK", cancellation); /* decrease the reference on the inference we are refering to */ - ethosu_inference_put(cancellation->inf); + ethosu_rpmsg_inference_put(cancellation->inf); devm_kfree(dev, cancellation); return ret; } -void ethosu_cancel_inference_rsp(struct ethosu_mailbox *mailbox, - int msg_id, - struct ethosu_core_msg_cancel_inference_rsp *rsp) +void ethosu_rpmsg_cancel_inference_rsp(struct ethosu_rpmsg_mailbox *mailbox, + int msg_id, + struct ethosu_rpmsg_cancel_inference_rsp *rsp) { struct device *dev = mailbox->dev; - struct ethosu_mailbox_msg *msg; - struct ethosu_cancel_inference *cancellation; + struct ethosu_rpmsg_mailbox_msg *msg; + struct ethosu_rpmsg_cancel_inference *cancellation; - msg = ethosu_mailbox_find(mailbox, msg_id, - ETHOSU_CORE_MSG_CANCEL_INFERENCE_REQ); + msg = ethosu_rpmsg_mailbox_find(mailbox, msg_id, + ETHOSU_RPMSG_CANCEL_INFERENCE_REQ); if (IS_ERR(msg)) { dev_warn(dev, "Id for cancel inference msg not found. Id=0x%x: %ld", @@ -179,10 +180,10 @@ void ethosu_cancel_inference_rsp(struct ethosu_mailbox *mailbox, cancellation->errno = 0; switch (rsp->status) { - case ETHOSU_CORE_STATUS_OK: + case ETHOSU_RPMSG_STATUS_OK: cancellation->uapi->status = ETHOSU_UAPI_STATUS_OK; break; - case ETHOSU_CORE_STATUS_ERROR: + case ETHOSU_RPMSG_STATUS_ERROR: cancellation->uapi->status = ETHOSU_UAPI_STATUS_ERROR; break; } diff --git a/kernel/rpmsg/ethosu_rpmsg_capabilities.c b/kernel/rpmsg/ethosu_rpmsg_capabilities.c index 73ce2dc..3c21d3e 100644 --- a/kernel/rpmsg/ethosu_rpmsg_capabilities.c +++ b/kernel/rpmsg/ethosu_rpmsg_capabilities.c @@ -41,16 +41,17 @@ * Functions ****************************************************************************/ -static inline int ethosu_capabilities_send(struct ethosu_capabilities *cap, - struct ethosu_mailbox *mailbox) +static inline int ethosu_rpmsg_capabilities_send( + struct ethosu_rpmsg_capabilities *cap, + struct ethosu_rpmsg_mailbox *mailbox) { - return ethosu_mailbox_capabilities_request(mailbox, - &cap->msg); + return ethosu_rpmsg_mailbox_capabilities_request(mailbox, + &cap->msg); } -static void ethosu_capabilities_fail(struct ethosu_mailbox_msg *msg) +static void ethosu_rpmsg_capabilities_fail(struct ethosu_rpmsg_mailbox_msg *msg) { - struct ethosu_capabilities *cap = + struct ethosu_rpmsg_capabilities *cap = container_of(msg, typeof(*cap), msg); if (completion_done(&cap->done)) @@ -60,16 +61,16 @@ static void ethosu_capabilities_fail(struct ethosu_mailbox_msg *msg) complete(&cap->done); } -void ethosu_capability_rsp(struct ethosu_mailbox *mailbox, +void ethosu_capability_rsp(struct ethosu_rpmsg_mailbox *mailbox, int msg_id, - struct ethosu_core_msg_capabilities_rsp *rsp) + struct ethosu_rpmsg_capabilities_rsp *rsp) { struct device *dev = mailbox->dev; - struct ethosu_mailbox_msg *msg; - struct ethosu_capabilities *cap; + struct ethosu_rpmsg_mailbox_msg *msg; + struct ethosu_rpmsg_capabilities *cap; - msg = ethosu_mailbox_find(mailbox, msg_id, - ETHOSU_CORE_MSG_CAPABILITIES_REQ); + msg = ethosu_rpmsg_mailbox_find(mailbox, msg_id, + ETHOSU_RPMSG_CAPABILITIES_REQ); if (IS_ERR(msg)) { dev_warn(dev, "Id for capabilities msg not found. Id=0x%0x: %ld\n", @@ -101,15 +102,15 @@ void ethosu_capability_rsp(struct ethosu_mailbox *mailbox, complete(&cap->done); } -int ethosu_capabilities_request(struct device *dev, - struct ethosu_mailbox *mailbox, - struct ethosu_uapi_device_capabilities *uapi) +int ethosu_rpmsg_capabilities_request(struct device *dev, + struct ethosu_rpmsg_mailbox *mailbox, + struct ethosu_uapi_device_capabilities *uapi) { - struct ethosu_capabilities *cap; + struct ethosu_rpmsg_capabilities *cap; int ret; int timeout; - cap = devm_kzalloc(dev, sizeof(struct ethosu_capabilities), + cap = devm_kzalloc(dev, sizeof(struct ethosu_rpmsg_capabilities), GFP_KERNEL); if (!cap) return -ENOMEM; @@ -117,16 +118,16 @@ int ethosu_capabilities_request(struct device *dev, cap->dev = dev; cap->uapi = uapi; init_completion(&cap->done); - cap->msg.fail = ethosu_capabilities_fail; + cap->msg.fail = ethosu_rpmsg_capabilities_fail; - ret = ethosu_mailbox_register(mailbox, &cap->msg); + ret = ethosu_rpmsg_mailbox_register(mailbox, &cap->msg); if (ret < 0) goto kfree; dev_dbg(dev, "Capabilities create. Id=%d, handle=0x%p\n", cap->msg.id, cap); - ret = ethosu_capabilities_send(cap, mailbox); + ret = ethosu_rpmsg_capabilities_send(cap, mailbox); if (0 != ret) goto deregister; @@ -153,7 +154,7 @@ int ethosu_capabilities_request(struct device *dev, } deregister: - ethosu_mailbox_deregister(mailbox, &cap->msg); + ethosu_rpmsg_mailbox_deregister(mailbox, &cap->msg); kfree: dev_dbg(dev, "Capabilities destroy. Id=%d, handle=0x%p\n", diff --git a/kernel/rpmsg/ethosu_rpmsg_inference.c b/kernel/rpmsg/ethosu_rpmsg_inference.c index b721fb7..b6288ef 100644 --- a/kernel/rpmsg/ethosu_rpmsg_inference.c +++ b/kernel/rpmsg/ethosu_rpmsg_inference.c @@ -38,22 +38,22 @@ * Variables ****************************************************************************/ -static int ethosu_inference_release(struct inode *inode, - struct file *file); +static int ethosu_rpmsg_inference_release(struct inode *inode, + struct file *file); -static __poll_t ethosu_inference_poll(struct file *file, - poll_table *wait); +static __poll_t ethosu_rpmsg_inference_poll(struct file *file, + poll_table *wait); -static long ethosu_inference_ioctl(struct file *file, - unsigned int cmd, - unsigned long arg); +static long ethosu_rpmsg_inference_ioctl(struct file *file, + unsigned int cmd, + unsigned long arg); -static const struct file_operations ethosu_inference_fops = { - .release = ðosu_inference_release, - .poll = ðosu_inference_poll, - .unlocked_ioctl = ðosu_inference_ioctl, +static const struct file_operations ethosu_rpmsg_inference_fops = { + .release = ðosu_rpmsg_inference_release, + .poll = ðosu_rpmsg_inference_poll, + .unlocked_ioctl = ðosu_rpmsg_inference_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = ðosu_inference_ioctl, + .compat_ioctl = ðosu_rpmsg_inference_ioctl, #endif }; @@ -88,19 +88,19 @@ static const char *status_to_string(const enum ethosu_uapi_status status) } } -static int ethosu_inference_send(struct ethosu_inference *inf) +static int ethosu_rpmsg_inference_send(struct ethosu_rpmsg_inference *inf) { struct device *dev = inf->dev; int ret; inf->status = ETHOSU_UAPI_STATUS_ERROR; - ret = ethosu_mailbox_inference(inf->mailbox, &inf->msg, - inf->ifm_count, inf->ifm, - inf->ofm_count, inf->ofm, - inf->net, inf->pmu_event_config, - ETHOSU_PMU_EVENT_MAX, - inf->pmu_cycle_counter_enable); + ret = ethosu_rpmsg_mailbox_inference(inf->mailbox, &inf->msg, + inf->ifm_count, inf->ifm, + inf->ofm_count, inf->ofm, + inf->net, inf->pmu_event_config, + ETHOSU_PMU_EVENT_MAX, + inf->pmu_cycle_counter_enable); if (ret) { dev_warn(dev, "Failed to send inference request. inf=0x%pK, ret=%d", @@ -111,14 +111,14 @@ static int ethosu_inference_send(struct ethosu_inference *inf) inf->status = ETHOSU_UAPI_STATUS_RUNNING; - ethosu_inference_get(inf); + ethosu_rpmsg_inference_get(inf); return 0; } -static void ethosu_inference_fail(struct ethosu_mailbox_msg *msg) +static void ethosu_rpmsg_inference_fail(struct ethosu_rpmsg_mailbox_msg *msg) { - struct ethosu_inference *inf = + struct ethosu_rpmsg_inference *inf = container_of(msg, typeof(*inf), msg); int ret; @@ -126,7 +126,7 @@ static void ethosu_inference_fail(struct ethosu_mailbox_msg *msg) return; /* Decrement reference count if inference was pending reponse */ - ret = ethosu_inference_put(inf); + ret = ethosu_rpmsg_inference_put(inf); if (ret) return; @@ -139,22 +139,22 @@ static void ethosu_inference_fail(struct ethosu_mailbox_msg *msg) wake_up_interruptible(&inf->waitq); } -static bool ethosu_inference_verify(struct file *file) +static bool ethosu_rpmsg_inference_verify(struct file *file) { - return file->f_op == ðosu_inference_fops; + return file->f_op == ðosu_rpmsg_inference_fops; } -static void ethosu_inference_kref_destroy(struct kref *kref) +static void ethosu_rpmsg_inference_kref_destroy(struct kref *kref) { - struct ethosu_inference *inf = - container_of(kref, struct ethosu_inference, kref); + struct ethosu_rpmsg_inference *inf = + container_of(kref, struct ethosu_rpmsg_inference, kref); struct device *dev = inf->dev; dev_dbg(dev, "Inference destroy. inf=0x%pK, status=%d, ifm_count=%u, ofm_count=%u", inf, inf->status, inf->ifm_count, inf->ofm_count); - ethosu_mailbox_deregister(inf->mailbox, &inf->msg); + ethosu_rpmsg_mailbox_deregister(inf->mailbox, &inf->msg); while (inf->ifm_count-- > 0) ethosu_buffer_put(inf->ifm[inf->ifm_count]); @@ -162,15 +162,15 @@ static void ethosu_inference_kref_destroy(struct kref *kref) while (inf->ofm_count-- > 0) ethosu_buffer_put(inf->ofm[inf->ofm_count]); - ethosu_network_put(inf->net); + ethosu_rpmsg_network_put(inf->net); memset(inf, 0, sizeof(*inf)); devm_kfree(dev, inf); } -static int ethosu_inference_release(struct inode *inode, - struct file *file) +static int ethosu_rpmsg_inference_release(struct inode *inode, + struct file *file) { - struct ethosu_inference *inf = file->private_data; + struct ethosu_rpmsg_inference *inf = file->private_data; struct device *dev = inf->dev; dev_dbg(dev, @@ -178,16 +178,16 @@ static int ethosu_inference_release(struct inode *inode, file, inf); device_lock(dev); - ethosu_inference_put(inf); + ethosu_rpmsg_inference_put(inf); device_unlock(dev); return 0; } -static __poll_t ethosu_inference_poll(struct file *file, - poll_table *wait) +static __poll_t ethosu_rpmsg_inference_poll(struct file *file, + poll_table *wait) { - struct ethosu_inference *inf = file->private_data; + struct ethosu_rpmsg_inference *inf = file->private_data; __poll_t ret = 0; poll_wait(file, &inf->waitq, wait); @@ -198,11 +198,11 @@ static __poll_t ethosu_inference_poll(struct file *file, return ret; } -static long ethosu_inference_ioctl(struct file *file, - unsigned int cmd, - unsigned long arg) +static long ethosu_rpmsg_inference_ioctl(struct file *file, + unsigned int cmd, + unsigned long arg) { - struct ethosu_inference *inf = file->private_data; + struct ethosu_rpmsg_inference *inf = file->private_data; struct device *dev = inf->dev; void __user *udata = (void __user *)arg; int ret; @@ -243,8 +243,9 @@ static long ethosu_inference_ioctl(struct file *file, "Inference ioctl: Cancel Inference. Handle=%p\n", inf); - ret = ethosu_cancel_inference_request(dev, inf->mailbox, inf, - &uapi); + ret = ethosu_rpmsg_cancel_inference_request(dev, inf->mailbox, + inf, + &uapi); if (ret) break; @@ -265,12 +266,12 @@ static long ethosu_inference_ioctl(struct file *file, return ret; } -int ethosu_inference_create(struct device *dev, - struct ethosu_mailbox *mailbox, - struct ethosu_network *net, - struct ethosu_uapi_inference_create *uapi) +int ethosu_rpmsg_inference_create(struct device *dev, + struct ethosu_rpmsg_mailbox *mailbox, + struct ethosu_rpmsg_network *net, + struct ethosu_uapi_inference_create *uapi) { - struct ethosu_inference *inf; + struct ethosu_rpmsg_inference *inf; uint32_t i; int fd; int ret = -ENOMEM; @@ -295,10 +296,10 @@ int ethosu_inference_create(struct device *dev, inf->status = ETHOSU_UAPI_STATUS_ERROR; kref_init(&inf->kref); init_waitqueue_head(&inf->waitq); - inf->msg.fail = ethosu_inference_fail; + inf->msg.fail = ethosu_rpmsg_inference_fail; /* Add inference to pending list */ - ret = ethosu_mailbox_register(mailbox, &inf->msg); + ret = ethosu_rpmsg_mailbox_register(mailbox, &inf->msg); if (ret < 0) goto kfree; @@ -341,15 +342,16 @@ int ethosu_inference_create(struct device *dev, inf->pmu_cycle_counter_count = 0; /* Increment network reference count */ - ethosu_network_get(net); + ethosu_rpmsg_network_get(net); /* Send inference request to Arm Ethos-U subsystem */ - ret = ethosu_inference_send(inf); + ret = ethosu_rpmsg_inference_send(inf); if (ret) goto put_net; /* Create file descriptor */ - ret = fd = anon_inode_getfd("ethosu-inference", ðosu_inference_fops, + ret = fd = anon_inode_getfd("ethosu-inference", + ðosu_rpmsg_inference_fops, inf, O_RDWR | O_CLOEXEC); if (ret < 0) goto put_net; @@ -365,7 +367,7 @@ int ethosu_inference_create(struct device *dev, return fd; put_net: - ethosu_network_put(inf->net); + ethosu_rpmsg_network_put(inf->net); put_ofm: while (inf->ofm_count-- > 0) @@ -375,7 +377,7 @@ put_ifm: while (inf->ifm_count-- > 0) ethosu_buffer_put(inf->ifm[inf->ifm_count]); - ethosu_mailbox_deregister(mailbox, &inf->msg); + ethosu_rpmsg_mailbox_deregister(mailbox, &inf->msg); kfree: memset(inf, 0, sizeof(*inf)); @@ -384,49 +386,49 @@ kfree: return ret; } -struct ethosu_inference *ethosu_inference_get_from_fd(int fd) +struct ethosu_rpmsg_inference *ethosu_rpmsg_inference_get_from_fd(int fd) { - struct ethosu_inference *inf; + struct ethosu_rpmsg_inference *inf; struct file *file; file = fget(fd); if (!file) return ERR_PTR(-EINVAL); - if (!ethosu_inference_verify(file)) { + if (!ethosu_rpmsg_inference_verify(file)) { fput(file); return ERR_PTR(-EINVAL); } inf = file->private_data; - ethosu_inference_get(inf); + ethosu_rpmsg_inference_get(inf); fput(file); return inf; } -void ethosu_inference_get(struct ethosu_inference *inf) +void ethosu_rpmsg_inference_get(struct ethosu_rpmsg_inference *inf) { kref_get(&inf->kref); } -int ethosu_inference_put(struct ethosu_inference *inf) +int ethosu_rpmsg_inference_put(struct ethosu_rpmsg_inference *inf) { - return kref_put(&inf->kref, ðosu_inference_kref_destroy); + return kref_put(&inf->kref, ðosu_rpmsg_inference_kref_destroy); } -void ethosu_inference_rsp(struct ethosu_mailbox *mailbox, - int msg_id, - struct ethosu_core_msg_inference_rsp *rsp) +void ethosu_rpmsg_inference_rsp(struct ethosu_rpmsg_mailbox *mailbox, + int msg_id, + struct ethosu_rpmsg_inference_rsp *rsp) { struct device *dev = mailbox->dev; - struct ethosu_mailbox_msg *msg; - struct ethosu_inference *inf; + struct ethosu_rpmsg_mailbox_msg *msg; + struct ethosu_rpmsg_inference *inf; int i; - msg = ethosu_mailbox_find(mailbox, msg_id, - ETHOSU_CORE_MSG_INFERENCE_REQ); + msg = ethosu_rpmsg_mailbox_find(mailbox, msg_id, + ETHOSU_RPMSG_INFERENCE_REQ); if (IS_ERR(msg)) { dev_warn(dev, "Id for inference msg not found. Id=0x%x: %ld\n", @@ -447,18 +449,18 @@ void ethosu_inference_rsp(struct ethosu_mailbox *mailbox, goto done; } - if (rsp->status == ETHOSU_CORE_STATUS_OK && - inf->ofm_count <= ETHOSU_CORE_BUFFER_MAX) + if (rsp->status == ETHOSU_RPMSG_STATUS_OK && + inf->ofm_count <= ETHOSU_RPMSG_BUFFER_MAX) inf->status = ETHOSU_UAPI_STATUS_OK; - else if (rsp->status == ETHOSU_CORE_STATUS_REJECTED) + else if (rsp->status == ETHOSU_RPMSG_STATUS_REJECTED) inf->status = ETHOSU_UAPI_STATUS_REJECTED; - else if (rsp->status == ETHOSU_CORE_STATUS_ABORTED) + else if (rsp->status == ETHOSU_RPMSG_STATUS_ABORTED) inf->status = ETHOSU_UAPI_STATUS_ABORTED; else inf->status = ETHOSU_UAPI_STATUS_ERROR; if (inf->status == ETHOSU_UAPI_STATUS_OK) { - for (i = 0; i < ETHOSU_CORE_PMU_MAX; i++) { + for (i = 0; i < ETHOSU_RPMSG_PMU_MAX; i++) { inf->pmu_event_config[i] = rsp->pmu_event_config[i]; inf->pmu_event_count[i] = rsp->pmu_event_count[i]; } @@ -482,5 +484,5 @@ void ethosu_inference_rsp(struct ethosu_mailbox *mailbox, done: inf->done = true; wake_up_interruptible(&inf->waitq); - ethosu_inference_put(inf); + ethosu_rpmsg_inference_put(inf); } diff --git a/kernel/rpmsg/ethosu_rpmsg_mailbox.c b/kernel/rpmsg/ethosu_rpmsg_mailbox.c index 11ac414..e1dc2a9 100644 --- a/kernel/rpmsg/ethosu_rpmsg_mailbox.c +++ b/kernel/rpmsg/ethosu_rpmsg_mailbox.c @@ -65,7 +65,7 @@ * * Return: 0 on success, else error code. */ -static int ethosu_send_locked(struct ethosu_mailbox *mbox, +static int ethosu_send_locked(struct ethosu_rpmsg_mailbox *mbox, void *data, size_t length) { @@ -124,15 +124,15 @@ static int ethosu_send_locked(struct ethosu_mailbox *mbox, return ret; } -static void ethosu_core_buffer_dma_mem_set(struct ethosu_dma_mem *dma_mem, - struct ethosu_core_buffer *cbuf) +static void ethosu_rpmsg_buffer_dma_mem_set(struct ethosu_dma_mem *dma_mem, + struct ethosu_rpmsg_buffer *cbuf) { cbuf->ptr = (uint32_t)dma_mem->dma_addr; cbuf->size = (uint32_t)dma_mem->size; } -int ethosu_mailbox_register(struct ethosu_mailbox *mbox, - struct ethosu_mailbox_msg *msg) +int ethosu_rpmsg_mailbox_register(struct ethosu_rpmsg_mailbox *mbox, + struct ethosu_rpmsg_mailbox_msg *msg) { WARN_ON_ONCE(!mutex_is_locked(&mbox->dev->mutex)); msg->id = idr_alloc_cyclic(&mbox->msg_idr, msg, 0, INT_MAX, GFP_KERNEL); @@ -142,21 +142,24 @@ int ethosu_mailbox_register(struct ethosu_mailbox *mbox, return 0; } -void ethosu_mailbox_deregister(struct ethosu_mailbox *mbox, - struct ethosu_mailbox_msg *msg) +void ethosu_rpmsg_mailbox_deregister(struct ethosu_rpmsg_mailbox *mbox, + struct ethosu_rpmsg_mailbox_msg *msg) { WARN_ON_ONCE(!mutex_is_locked(&mbox->dev->mutex)); idr_remove(&mbox->msg_idr, msg->id); } -struct ethosu_mailbox_msg *ethosu_mailbox_find(struct ethosu_mailbox *mbox, - int msg_id, - uint32_t msg_type) +struct ethosu_rpmsg_mailbox_msg *ethosu_rpmsg_mailbox_find( + struct ethosu_rpmsg_mailbox *mbox, + int msg_id, + uint32_t msg_type) { - struct ethosu_mailbox_msg *ptr; + struct ethosu_rpmsg_mailbox_msg *ptr; WARN_ON_ONCE(!mutex_is_locked(&mbox->dev->mutex)); - ptr = (struct ethosu_mailbox_msg *)idr_find(&mbox->msg_idr, msg_id); + ptr = + (struct ethosu_rpmsg_mailbox_msg *)idr_find(&mbox->msg_idr, + msg_id); if (ptr == NULL) return ERR_PTR(-ENOENT); @@ -167,9 +170,9 @@ struct ethosu_mailbox_msg *ethosu_mailbox_find(struct ethosu_mailbox *mbox, return ptr; } -void ethosu_mailbox_fail(struct ethosu_mailbox *mbox) +void ethosu_rpmsg_mailbox_fail(struct ethosu_rpmsg_mailbox *mbox) { - struct ethosu_mailbox_msg *cur; + struct ethosu_rpmsg_mailbox_msg *cur; int id; WARN_ON_ONCE(!mutex_is_locked(&mbox->dev->mutex)); @@ -178,37 +181,37 @@ void ethosu_mailbox_fail(struct ethosu_mailbox *mbox) } } -int ethosu_mailbox_ping(struct ethosu_mailbox *mbox) +int ethosu_rpmsg_mailbox_ping(struct ethosu_rpmsg_mailbox *mbox) { - struct ethosu_core_rpmsg rpmsg = { + struct ethosu_rpmsg rpmsg = { .header = { - .magic = ETHOSU_CORE_MSG_MAGIC, - .type = ETHOSU_CORE_MSG_PING, + .magic = ETHOSU_RPMSG_MAGIC, + .type = ETHOSU_RPMSG_PING, } }; return ethosu_send_locked(mbox, &rpmsg, sizeof(rpmsg.header)); } -int ethosu_mailbox_pong(struct ethosu_mailbox *mbox) +int ethosu_rpmsg_mailbox_pong(struct ethosu_rpmsg_mailbox *mbox) { - struct ethosu_core_rpmsg rpmsg = { + struct ethosu_rpmsg rpmsg = { .header = { - .magic = ETHOSU_CORE_MSG_MAGIC, - .type = ETHOSU_CORE_MSG_PONG, + .magic = ETHOSU_RPMSG_MAGIC, + .type = ETHOSU_RPMSG_PONG, } }; return ethosu_send_locked(mbox, &rpmsg, sizeof(rpmsg.header)); } -int ethosu_mailbox_version_request(struct ethosu_mailbox *mbox, - struct ethosu_mailbox_msg *msg) +int ethosu_rpmsg_mailbox_version_request(struct ethosu_rpmsg_mailbox *mbox, + struct ethosu_rpmsg_mailbox_msg *msg) { - struct ethosu_core_rpmsg rpmsg = { + struct ethosu_rpmsg rpmsg = { .header = { - .magic = ETHOSU_CORE_MSG_MAGIC, - .type = ETHOSU_CORE_MSG_VERSION_REQ, + .magic = ETHOSU_RPMSG_MAGIC, + .type = ETHOSU_RPMSG_VERSION_REQ, .msg_id = msg->id } }; @@ -218,13 +221,13 @@ int ethosu_mailbox_version_request(struct ethosu_mailbox *mbox, return ethosu_send_locked(mbox, &rpmsg, sizeof(rpmsg.header)); } -int ethosu_mailbox_capabilities_request(struct ethosu_mailbox *mbox, - struct ethosu_mailbox_msg *msg) +int ethosu_rpmsg_mailbox_capabilities_request(struct ethosu_rpmsg_mailbox *mbox, + struct ethosu_rpmsg_mailbox_msg *msg) { - struct ethosu_core_rpmsg rpmsg = { + struct ethosu_rpmsg rpmsg = { .header = { - .magic = ETHOSU_CORE_MSG_MAGIC, - .type = ETHOSU_CORE_MSG_CAPABILITIES_REQ, + .magic = ETHOSU_RPMSG_MAGIC, + .type = ETHOSU_RPMSG_CAPABILITIES_REQ, .msg_id = msg->id } }; @@ -234,31 +237,31 @@ int ethosu_mailbox_capabilities_request(struct ethosu_mailbox *mbox, return ethosu_send_locked(mbox, &rpmsg, sizeof(rpmsg.header)); } -int ethosu_mailbox_inference(struct ethosu_mailbox *mbox, - struct ethosu_mailbox_msg *msg, - uint32_t ifm_count, - struct ethosu_buffer **ifm, - uint32_t ofm_count, - struct ethosu_buffer **ofm, - struct ethosu_network *network, - uint8_t *pmu_event_config, - uint8_t pmu_event_config_count, - uint8_t pmu_cycle_counter_enable) +int ethosu_rpmsg_mailbox_inference(struct ethosu_rpmsg_mailbox *mbox, + struct ethosu_rpmsg_mailbox_msg *msg, + uint32_t ifm_count, + struct ethosu_buffer **ifm, + uint32_t ofm_count, + struct ethosu_buffer **ofm, + struct ethosu_rpmsg_network *network, + uint8_t *pmu_event_config, + uint8_t pmu_event_config_count, + uint8_t pmu_cycle_counter_enable) { - struct ethosu_core_rpmsg rpmsg = { + struct ethosu_rpmsg rpmsg = { .header = { - .magic = ETHOSU_CORE_MSG_MAGIC, - .type = ETHOSU_CORE_MSG_INFERENCE_REQ, + .magic = ETHOSU_RPMSG_MAGIC, + .type = ETHOSU_RPMSG_INFERENCE_REQ, .msg_id = msg->id } }; - struct ethosu_core_msg_inference_req *inf_req = &rpmsg.inf_req; + struct ethosu_rpmsg_inference_req *inf_req = &rpmsg.inf_req; uint32_t i; msg->type = rpmsg.header.type; /* Verify that the uapi and core has the same number of pmus */ - if (pmu_event_config_count != ETHOSU_CORE_PMU_MAX) { + if (pmu_event_config_count != ETHOSU_RPMSG_PMU_MAX) { dev_err(mbox->dev, "PMU count misconfigured."); return -EINVAL; @@ -269,22 +272,22 @@ int ethosu_mailbox_inference(struct ethosu_mailbox *mbox, inf_req->pmu_cycle_counter_enable = pmu_cycle_counter_enable; for (i = 0; i < ifm_count; i++) - ethosu_core_buffer_dma_mem_set(ifm[i]->dma_mem, - &inf_req->ifm[i]); + ethosu_rpmsg_buffer_dma_mem_set(ifm[i]->dma_mem, + &inf_req->ifm[i]); for (i = 0; i < ofm_count; i++) - ethosu_core_buffer_dma_mem_set(ofm[i]->dma_mem, - &inf_req->ofm[i]); + ethosu_rpmsg_buffer_dma_mem_set(ofm[i]->dma_mem, + &inf_req->ofm[i]); - for (i = 0; i < ETHOSU_CORE_PMU_MAX; i++) + for (i = 0; i < ETHOSU_RPMSG_PMU_MAX; i++) inf_req->pmu_event_config[i] = pmu_event_config[i]; if (network->dma_mem != NULL) { - inf_req->network.type = ETHOSU_CORE_NETWORK_BUFFER; - ethosu_core_buffer_dma_mem_set(network->dma_mem, - &inf_req->network.buffer); + inf_req->network.type = ETHOSU_RPMSG_NETWORK_BUFFER; + ethosu_rpmsg_buffer_dma_mem_set(network->dma_mem, + &inf_req->network.buffer); } else { - inf_req->network.type = ETHOSU_CORE_NETWORK_INDEX; + inf_req->network.type = ETHOSU_RPMSG_NETWORK_INDEX; inf_req->network.index = network->index; } @@ -292,27 +295,27 @@ int ethosu_mailbox_inference(struct ethosu_mailbox *mbox, sizeof(rpmsg.header) + sizeof(rpmsg.inf_req)); } -int ethosu_mailbox_network_info_request(struct ethosu_mailbox *mbox, - struct ethosu_mailbox_msg *msg, - struct ethosu_network *network) +int ethosu_rpmsg_mailbox_network_info_request(struct ethosu_rpmsg_mailbox *mbox, + struct ethosu_rpmsg_mailbox_msg *msg, + struct ethosu_rpmsg_network *network) { - struct ethosu_core_rpmsg rpmsg = { + struct ethosu_rpmsg rpmsg = { .header = { - .magic = ETHOSU_CORE_MSG_MAGIC, - .type = ETHOSU_CORE_MSG_NETWORK_INFO_REQ, + .magic = ETHOSU_RPMSG_MAGIC, + .type = ETHOSU_RPMSG_NETWORK_INFO_REQ, .msg_id = msg->id } }; - struct ethosu_core_msg_network_info_req *info_req = &rpmsg.net_info_req; + struct ethosu_rpmsg_network_info_req *info_req = &rpmsg.net_info_req; msg->type = rpmsg.header.type; if (network->dma_mem != NULL) { - info_req->network.type = ETHOSU_CORE_NETWORK_BUFFER; - ethosu_core_buffer_dma_mem_set(network->dma_mem, - &info_req->network.buffer); + info_req->network.type = ETHOSU_RPMSG_NETWORK_BUFFER; + ethosu_rpmsg_buffer_dma_mem_set(network->dma_mem, + &info_req->network.buffer); } else { - info_req->network.type = ETHOSU_CORE_NETWORK_INDEX; + info_req->network.type = ETHOSU_RPMSG_NETWORK_INDEX; info_req->network.index = network->index; } @@ -321,15 +324,15 @@ int ethosu_mailbox_network_info_request(struct ethosu_mailbox *mbox, sizeof(rpmsg.net_info_req)); } -int ethosu_mailbox_cancel_inference(struct ethosu_mailbox *mbox, - struct ethosu_mailbox_msg *msg, - int inference_handle) +int ethosu_rpmsg_mailbox_cancel_inference(struct ethosu_rpmsg_mailbox *mbox, + struct ethosu_rpmsg_mailbox_msg *msg, + int inference_handle) { - struct ethosu_core_rpmsg rpmsg = { + struct ethosu_rpmsg rpmsg = { .header = { - .magic = ETHOSU_CORE_MSG_MAGIC, + .magic = ETHOSU_RPMSG_MAGIC, .type = - ETHOSU_CORE_MSG_CANCEL_INFERENCE_REQ, + ETHOSU_RPMSG_CANCEL_INFERENCE_REQ, .msg_id = msg->id }, .cancel_req = { @@ -344,9 +347,9 @@ int ethosu_mailbox_cancel_inference(struct ethosu_mailbox *mbox, sizeof(rpmsg.cancel_req)); } -int ethosu_mailbox_init(struct ethosu_mailbox *mbox, - struct device *dev, - struct rpmsg_endpoint *ept) +int ethosu_rpmsg_mailbox_init(struct ethosu_rpmsg_mailbox *mbox, + struct device *dev, + struct rpmsg_endpoint *ept) { mbox->dev = dev; mbox->ept = ept; @@ -356,7 +359,7 @@ int ethosu_mailbox_init(struct ethosu_mailbox *mbox, return 0; } -void ethosu_mailbox_deinit(struct ethosu_mailbox *mbox) +void ethosu_rpmsg_mailbox_deinit(struct ethosu_rpmsg_mailbox *mbox) { atomic_set(&mbox->done, 1); wake_up_all(&mbox->send_queue); diff --git a/kernel/rpmsg/ethosu_rpmsg_network.c b/kernel/rpmsg/ethosu_rpmsg_network.c index f5b8265..38d7db2 100644 --- a/kernel/rpmsg/ethosu_rpmsg_network.c +++ b/kernel/rpmsg/ethosu_rpmsg_network.c @@ -38,18 +38,18 @@ * Variables ****************************************************************************/ -static int ethosu_network_release(struct inode *inode, - struct file *file); +static int ethosu_rpmsg_network_release(struct inode *inode, + struct file *file); -static long ethosu_network_ioctl(struct file *file, - unsigned int cmd, - unsigned long arg); +static long ethosu_rpmsg_network_ioctl(struct file *file, + unsigned int cmd, + unsigned long arg); -static const struct file_operations ethosu_network_fops = { - .release = ðosu_network_release, - .unlocked_ioctl = ðosu_network_ioctl, +static const struct file_operations ethosu_rpmsg_network_fops = { + .release = ðosu_rpmsg_network_release, + .unlocked_ioctl = ðosu_rpmsg_network_ioctl, #ifdef CONFIG_COMPAT - .compat_ioctl = ðosu_network_ioctl, + .compat_ioctl = ðosu_rpmsg_network_ioctl, #endif }; @@ -57,15 +57,15 @@ static const struct file_operations ethosu_network_fops = { * Functions ****************************************************************************/ -static bool ethosu_network_verify(struct file *file) +static bool ethosu_rpmsg_network_verify(struct file *file) { - return file->f_op == ðosu_network_fops; + return file->f_op == ðosu_rpmsg_network_fops; } -static void ethosu_network_destroy(struct kref *kref) +static void ethosu_rpmsg_network_destroy(struct kref *kref) { - struct ethosu_network *net = - container_of(kref, struct ethosu_network, kref); + struct ethosu_rpmsg_network *net = + container_of(kref, struct ethosu_rpmsg_network, kref); struct device *dev = net->dev; dev_dbg(dev, "Network destroy. net=0x%pK\n", net); @@ -77,25 +77,25 @@ static void ethosu_network_destroy(struct kref *kref) devm_kfree(dev, net); } -static int ethosu_network_release(struct inode *inode, - struct file *file) +static int ethosu_rpmsg_network_release(struct inode *inode, + struct file *file) { - struct ethosu_network *net = file->private_data; + struct ethosu_rpmsg_network *net = file->private_data; struct device *dev = net->dev; dev_dbg(dev, "Network release. file=0x%pK, net=0x%pK\n", file, net); - ethosu_network_put(net); + ethosu_rpmsg_network_put(net); return 0; } -static long ethosu_network_ioctl(struct file *file, - unsigned int cmd, - unsigned long arg) +static long ethosu_rpmsg_network_ioctl(struct file *file, + unsigned int cmd, + unsigned long arg) { - struct ethosu_network *net = file->private_data; + struct ethosu_rpmsg_network *net = file->private_data; struct device *dev = net->dev; void __user *udata = (void __user *)arg; int ret; @@ -110,8 +110,8 @@ static long ethosu_network_ioctl(struct file *file, dev_dbg(dev, "Network ioctl: Network info. net=0x%pK\n", net); - ret = ethosu_network_info_request(dev, net->mailbox, net, - &uapi); + ret = ethosu_rpmsg_network_info_request(dev, net->mailbox, net, + &uapi); if (ret) break; @@ -130,7 +130,8 @@ static long ethosu_network_ioctl(struct file *file, "Network ioctl: Inference. ifm_fd=%u, ofm_fd=%u\n", uapi.ifm_fd[0], uapi.ofm_fd[0]); - ret = ethosu_inference_create(dev, net->mailbox, net, &uapi); + ret = ethosu_rpmsg_inference_create(dev, net->mailbox, net, + &uapi); break; } default: { @@ -146,11 +147,11 @@ static long ethosu_network_ioctl(struct file *file, return ret; } -int ethosu_network_create(struct device *dev, - struct ethosu_mailbox *mailbox, - struct ethosu_uapi_network_create *uapi) +int ethosu_rpmsg_network_create(struct device *dev, + struct ethosu_rpmsg_mailbox *mailbox, + struct ethosu_uapi_network_create *uapi) { - struct ethosu_network *net; + struct ethosu_rpmsg_network *net; const void __user *data; int ret; @@ -197,7 +198,8 @@ int ethosu_network_create(struct device *dev, goto free_net; } - ret = anon_inode_getfd("ethosu-network", ðosu_network_fops, net, + ret = anon_inode_getfd("ethosu-network", ðosu_rpmsg_network_fops, + net, O_RDWR | O_CLOEXEC); if (ret < 0) goto free_dma_mem; @@ -222,34 +224,34 @@ free_net: return ret; } -struct ethosu_network *ethosu_network_get_from_fd(int fd) +struct ethosu_rpmsg_network *ethosu_rpmsg_network_get_from_fd(int fd) { - struct ethosu_network *net; + struct ethosu_rpmsg_network *net; struct file *file; file = fget(fd); if (!file) return ERR_PTR(-EINVAL); - if (!ethosu_network_verify(file)) { + if (!ethosu_rpmsg_network_verify(file)) { fput(file); return ERR_PTR(-EINVAL); } net = file->private_data; - ethosu_network_get(net); + ethosu_rpmsg_network_get(net); fput(file); return net; } -void ethosu_network_get(struct ethosu_network *net) +void ethosu_rpmsg_network_get(struct ethosu_rpmsg_network *net) { kref_get(&net->kref); } -int ethosu_network_put(struct ethosu_network *net) +int ethosu_rpmsg_network_put(struct ethosu_rpmsg_network *net) { - return kref_put(&net->kref, ethosu_network_destroy); + return kref_put(&net->kref, ethosu_rpmsg_network_destroy); } diff --git a/kernel/rpmsg/ethosu_rpmsg_network_info.c b/kernel/rpmsg/ethosu_rpmsg_network_info.c index 0e54d87..36b6290 100644 --- a/kernel/rpmsg/ethosu_rpmsg_network_info.c +++ b/kernel/rpmsg/ethosu_rpmsg_network_info.c @@ -31,18 +31,19 @@ #define NETWORK_INFO_RESP_TIMEOUT_MS 3000 -static inline int ethosu_network_info_send(struct ethosu_network_info *info, - struct ethosu_mailbox *mailbox) +static inline int ethosu_rpmsg_network_info_send( + struct ethosu_rpmsg_network_info *info, + struct ethosu_rpmsg_mailbox *mailbox) { /* Send network info request to firmware */ - return ethosu_mailbox_network_info_request(mailbox, - &info->msg, - info->net); + return ethosu_rpmsg_mailbox_network_info_request(mailbox, + &info->msg, + info->net); } -static void ethosu_network_info_fail(struct ethosu_mailbox_msg *msg) +static void ethosu_rpmsg_network_info_fail(struct ethosu_rpmsg_mailbox_msg *msg) { - struct ethosu_network_info *info = + struct ethosu_rpmsg_network_info *info = container_of(msg, typeof(*info), msg); if (completion_done(&info->done)) @@ -52,12 +53,12 @@ static void ethosu_network_info_fail(struct ethosu_mailbox_msg *msg) complete(&info->done); } -int ethosu_network_info_request(struct device *dev, - struct ethosu_mailbox *mailbox, - struct ethosu_network *net, - struct ethosu_uapi_network_info *uapi) +int ethosu_rpmsg_network_info_request(struct device *dev, + struct ethosu_rpmsg_mailbox *mailbox, + struct ethosu_rpmsg_network *net, + struct ethosu_uapi_network_info *uapi) { - struct ethosu_network_info *info; + struct ethosu_rpmsg_network_info *info; int ret; int timeout; @@ -69,16 +70,16 @@ int ethosu_network_info_request(struct device *dev, info->net = net; info->uapi = uapi; init_completion(&info->done); - info->msg.fail = ethosu_network_info_fail; + info->msg.fail = ethosu_rpmsg_network_info_fail; - ret = ethosu_mailbox_register(mailbox, &info->msg); + ret = ethosu_rpmsg_mailbox_register(mailbox, &info->msg); if (ret < 0) goto kfree; /* Get reference to network */ - ethosu_network_get(info->net); + ethosu_rpmsg_network_get(info->net); - ret = ethosu_network_info_send(info, mailbox); + ret = ethosu_rpmsg_network_info_send(info, mailbox); if (ret) goto deregister; @@ -104,8 +105,8 @@ int ethosu_network_info_request(struct device *dev, ret = info->errno; deregister: - ethosu_mailbox_deregister(mailbox, &info->msg); - ethosu_network_put(info->net); + ethosu_rpmsg_mailbox_deregister(mailbox, &info->msg); + ethosu_rpmsg_network_put(info->net); kfree: dev_dbg(dev, @@ -116,21 +117,21 @@ kfree: return ret; } -void ethosu_network_info_rsp(struct ethosu_mailbox *mailbox, - int msg_id, - struct ethosu_core_msg_network_info_rsp *rsp) +void ethosu_rpmsg_network_info_rsp(struct ethosu_rpmsg_mailbox *mailbox, + int msg_id, + struct ethosu_rpmsg_network_info_rsp *rsp) { int ret; struct device *dev = mailbox->dev; - struct ethosu_mailbox_msg *msg; - struct ethosu_network_info *info; + struct ethosu_rpmsg_mailbox_msg *msg; + struct ethosu_rpmsg_network_info *info; uint32_t i; const size_t rsp_desc_size = sizeof(rsp->desc); BUILD_BUG_ON(rsp_desc_size != sizeof(info->uapi->desc)); - msg = ethosu_mailbox_find(mailbox, msg_id, - ETHOSU_CORE_MSG_NETWORK_INFO_REQ); + msg = ethosu_rpmsg_mailbox_find(mailbox, msg_id, + ETHOSU_RPMSG_NETWORK_INFO_REQ); if (IS_ERR(msg)) { dev_warn(dev, "Id for network info msg not found. Id=0x%x: %ld\n", @@ -146,7 +147,7 @@ void ethosu_network_info_rsp(struct ethosu_mailbox *mailbox, info->errno = 0; - if (rsp->status != ETHOSU_CORE_STATUS_OK) { + if (rsp->status != ETHOSU_RPMSG_STATUS_OK) { dev_err(dev, "Failed to get information about the network\n"); info->errno = -EBADF; goto signal_complete; diff --git a/kernel/rpmsg/ethosu_rpmsg_version.c b/kernel/rpmsg/ethosu_rpmsg_version.c index 03e164b..dc2d8e0 100644 --- a/kernel/rpmsg/ethosu_rpmsg_version.c +++ b/kernel/rpmsg/ethosu_rpmsg_version.c @@ -36,9 +36,9 @@ * Functions ****************************************************************************/ -static void ethosu_version_fail(struct ethosu_mailbox_msg *msg) +static void ethosu_rpmsg_version_fail(struct ethosu_rpmsg_mailbox_msg *msg) { - struct ethosu_version *version = + struct ethosu_rpmsg_version *version = container_of(msg, typeof(*version), msg); if (completion_done(&version->done)) @@ -48,16 +48,16 @@ static void ethosu_version_fail(struct ethosu_mailbox_msg *msg) complete(&version->done); } -void ethosu_version_rsp(struct ethosu_mailbox *mailbox, - int msg_id, - struct ethosu_core_msg_version_rsp *rsp) +void ethosu_rpmsg_version_rsp(struct ethosu_rpmsg_mailbox *mailbox, + int msg_id, + struct ethosu_rpmsg_version_rsp *rsp) { struct device *dev = mailbox->dev; - struct ethosu_mailbox_msg *msg; - struct ethosu_version *version; + struct ethosu_rpmsg_mailbox_msg *msg; + struct ethosu_rpmsg_version *version; - msg = ethosu_mailbox_find(mailbox, msg_id, - ETHOSU_CORE_MSG_VERSION_REQ); + msg = ethosu_rpmsg_mailbox_find(mailbox, msg_id, + ETHOSU_RPMSG_VERSION_REQ); if (IS_ERR(msg)) { dev_warn(dev, "Id for version msg not found. Id=0x%0x: %ld\n", @@ -71,12 +71,12 @@ void ethosu_version_rsp(struct ethosu_mailbox *mailbox, if (completion_done(&version->done)) return; - if (rsp->major != ETHOSU_CORE_MSG_VERSION_MAJOR || - rsp->minor != ETHOSU_CORE_MSG_VERSION_MINOR) { + if (rsp->major != ETHOSU_RPMSG_VERSION_MAJOR || + rsp->minor != ETHOSU_RPMSG_VERSION_MINOR) { dev_warn(dev, "Msg: Protocol version mismatch. Expected %u.%u.X but got %u.%u.%u", - ETHOSU_CORE_MSG_VERSION_MAJOR, - ETHOSU_CORE_MSG_VERSION_MINOR, + ETHOSU_RPMSG_VERSION_MAJOR, + ETHOSU_RPMSG_VERSION_MINOR, rsp->major, rsp->minor, rsp->patch); version->errno = -EPROTO; } else { @@ -86,10 +86,10 @@ void ethosu_version_rsp(struct ethosu_mailbox *mailbox, complete(&version->done); } -int ethosu_version_check_request(struct device *dev, - struct ethosu_mailbox *mailbox) +int ethosu_rpmsg_version_check_request(struct device *dev, + struct ethosu_rpmsg_mailbox *mailbox) { - struct ethosu_version *version; + struct ethosu_rpmsg_version *version; int ret; int timeout; @@ -99,16 +99,16 @@ int ethosu_version_check_request(struct device *dev, version->dev = dev; init_completion(&version->done); - version->msg.fail = ethosu_version_fail; + version->msg.fail = ethosu_rpmsg_version_fail; - ret = ethosu_mailbox_register(mailbox, &version->msg); + ret = ethosu_rpmsg_mailbox_register(mailbox, &version->msg); if (ret < 0) goto free_version; dev_dbg(dev, "Protocol version request created. Id=0x%x, handle=%pK\n", version->msg.id, version); - ret = ethosu_mailbox_version_request(mailbox, &version->msg); + ret = ethosu_rpmsg_mailbox_version_request(mailbox, &version->msg); if (ret) goto deregister; @@ -135,7 +135,7 @@ int ethosu_version_check_request(struct device *dev, } deregister: - ethosu_mailbox_deregister(mailbox, &version->msg); + ethosu_rpmsg_mailbox_deregister(mailbox, &version->msg); free_version: dev_dbg(dev, "Protocol version destroy. Id=0x%x, handle=%pK\n", |