diff options
-rw-r--r-- | kernel/common/ethosu_device.c | 62 | ||||
-rw-r--r-- | kernel/include/common/ethosu_device.h | 2 | ||||
-rw-r--r-- | kernel/include/rpmsg/ethosu_rpmsg.h | 193 | ||||
-rw-r--r-- | kernel/include/rpmsg/ethosu_rpmsg_cancel_inference.h | 34 | ||||
-rw-r--r-- | kernel/include/rpmsg/ethosu_rpmsg_capabilities.h | 24 | ||||
-rw-r--r-- | kernel/include/rpmsg/ethosu_rpmsg_inference.h | 78 | ||||
-rw-r--r-- | kernel/include/rpmsg/ethosu_rpmsg_mailbox.h | 121 | ||||
-rw-r--r-- | kernel/include/rpmsg/ethosu_rpmsg_network.h | 40 | ||||
-rw-r--r-- | kernel/include/rpmsg/ethosu_rpmsg_network_info.h | 34 | ||||
-rw-r--r-- | kernel/include/rpmsg/ethosu_rpmsg_version.h | 30 | ||||
-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 |
17 files changed, 607 insertions, 595 deletions
diff --git a/kernel/common/ethosu_device.c b/kernel/common/ethosu_device.c index f1e00ab..c14709e 100644 --- a/kernel/common/ethosu_device.c +++ b/kernel/common/ethosu_device.c @@ -69,12 +69,12 @@ static int ethosu_handle_rpmsg(struct rpmsg_device *rpdev, { struct ethosu_device *edev = dev_get_drvdata(&rpdev->dev); struct device *dev = &edev->dev; - struct ethosu_mailbox *mbox = &edev->mailbox; - struct ethosu_core_rpmsg *rpmsg = data; + struct ethosu_rpmsg_mailbox *mbox = &edev->mailbox; + struct ethosu_rpmsg *rpmsg = data; int length = len - sizeof(rpmsg->header); int ret = 0; - if (unlikely(rpmsg->header.magic != ETHOSU_CORE_MSG_MAGIC)) { + if (unlikely(rpmsg->header.magic != ETHOSU_RPMSG_MAGIC)) { dev_warn(dev, "Msg: Error invalid message magic. magic=0x%08x", rpmsg->header.magic); @@ -88,7 +88,7 @@ static int ethosu_handle_rpmsg(struct rpmsg_device *rpdev, rpmsg->header.magic, rpmsg->header.type, rpmsg->header.msg_id); switch (rpmsg->header.type) { - case ETHOSU_CORE_MSG_ERR: + case ETHOSU_RPMSG_ERR: if (length != sizeof(rpmsg->error)) { dev_warn(dev, "Msg: Error message of incorrect size. size=%u, expected=%zu", length, @@ -103,14 +103,14 @@ static int ethosu_handle_rpmsg(struct rpmsg_device *rpdev, rproc_report_crash(rproc_get_by_child(dev), RPROC_FATAL_ERROR); break; - case ETHOSU_CORE_MSG_PING: + case ETHOSU_RPMSG_PING: dev_dbg(dev, "Msg: Ping"); - ret = ethosu_mailbox_pong(mbox); + ret = ethosu_rpmsg_mailbox_pong(mbox); break; - case ETHOSU_CORE_MSG_PONG: + case ETHOSU_RPMSG_PONG: dev_dbg(dev, "Msg: Pong"); break; - case ETHOSU_CORE_MSG_INFERENCE_RSP: + case ETHOSU_RPMSG_INFERENCE_RSP: if (length != sizeof(rpmsg->inf_rsp)) { dev_warn(dev, "Msg: Inference response of incorrect size. size=%u, expected=%zu", length, @@ -123,10 +123,10 @@ static int ethosu_handle_rpmsg(struct rpmsg_device *rpdev, "Msg: Inference response. ofm_count=%u, status=%u", rpmsg->inf_rsp.ofm_count, rpmsg->inf_rsp.status); - ethosu_inference_rsp(mbox, rpmsg->header.msg_id, - &rpmsg->inf_rsp); + ethosu_rpmsg_inference_rsp(mbox, rpmsg->header.msg_id, + &rpmsg->inf_rsp); break; - case ETHOSU_CORE_MSG_CANCEL_INFERENCE_RSP: + case ETHOSU_RPMSG_CANCEL_INFERENCE_RSP: if (length != sizeof(rpmsg->cancel_rsp)) { dev_warn(dev, "Msg: Cancel Inference response of incorrect size. size=%u, expected=%zu", length, @@ -138,11 +138,11 @@ static int ethosu_handle_rpmsg(struct rpmsg_device *rpdev, dev_dbg(dev, "Msg: Cancel Inference response. status=%u", rpmsg->cancel_rsp.status); - ethosu_cancel_inference_rsp(mbox, - rpmsg->header.msg_id, - &rpmsg->cancel_rsp); + ethosu_rpmsg_cancel_inference_rsp(mbox, + rpmsg->header.msg_id, + &rpmsg->cancel_rsp); break; - case ETHOSU_CORE_MSG_VERSION_RSP: + case ETHOSU_RPMSG_VERSION_RSP: if (length != sizeof(rpmsg->version_rsp)) { dev_warn(dev, "Msg: Protocol version response of incorrect size. size=%u, expected=%zu", length, @@ -155,10 +155,10 @@ static int ethosu_handle_rpmsg(struct rpmsg_device *rpdev, rpmsg->version_rsp.major, rpmsg->version_rsp.minor, rpmsg->version_rsp.patch); - ethosu_version_rsp(mbox, rpmsg->header.msg_id, - &rpmsg->version_rsp); + ethosu_rpmsg_version_rsp(mbox, rpmsg->header.msg_id, + &rpmsg->version_rsp); break; - case ETHOSU_CORE_MSG_CAPABILITIES_RSP: + case ETHOSU_RPMSG_CAPABILITIES_RSP: if (length != sizeof(rpmsg->cap_rsp)) { dev_warn(dev, "Msg: Capabilities response of incorrect size. size=%u, expected=%zu", length, @@ -186,7 +186,7 @@ static int ethosu_handle_rpmsg(struct rpmsg_device *rpdev, ethosu_capability_rsp(mbox, rpmsg->header.msg_id, &rpmsg->cap_rsp); break; - case ETHOSU_CORE_MSG_NETWORK_INFO_RSP: + case ETHOSU_RPMSG_NETWORK_INFO_RSP: if (length != sizeof(rpmsg->net_info_rsp)) { dev_warn(dev, "Msg: Network info response of incorrect size. size=%u, expected=%zu", length, @@ -199,9 +199,9 @@ static int ethosu_handle_rpmsg(struct rpmsg_device *rpdev, "Msg: Network info response. status=%u", rpmsg->net_info_rsp.status); - ethosu_network_info_rsp(mbox, - rpmsg->header.msg_id, - &rpmsg->net_info_rsp); + ethosu_rpmsg_network_info_rsp(mbox, + rpmsg->header.msg_id, + &rpmsg->net_info_rsp); break; default: @@ -271,7 +271,7 @@ static long ethosu_ioctl(struct file *file, dev_dbg(dev, "Device ioctl: Send ping"); - ret = ethosu_mailbox_ping(&edev->mailbox); + ret = ethosu_rpmsg_mailbox_ping(&edev->mailbox); device_unlock(dev); @@ -314,7 +314,7 @@ static long ethosu_ioctl(struct file *file, dev_dbg(dev, "Device ioctl: Network create. type=%u\n", uapi.type); - ret = ethosu_network_create(dev, &edev->mailbox, &uapi); + ret = ethosu_rpmsg_network_create(dev, &edev->mailbox, &uapi); device_unlock(dev); @@ -370,7 +370,7 @@ static void ethosu_dev_release(struct device *dev) clear_bit(MINOR(edev->cdev.dev), minors); - ethosu_mailbox_deinit(&edev->mailbox); + ethosu_rpmsg_mailbox_deinit(&edev->mailbox); device_destroy(edev->class, edev->cdev.dev); kfree(edev); } @@ -481,12 +481,12 @@ int ethosu_dev_init(struct rpmsg_device *rpdev, goto device_unregister; } - ret = ethosu_mailbox_init(&edev->mailbox, dev, edev->ept); + ret = ethosu_rpmsg_mailbox_init(&edev->mailbox, dev, edev->ept); if (ret) goto free_rpmsg_ept; device_lock(dev); - ret = ethosu_version_check_request(dev, &edev->mailbox); + ret = ethosu_rpmsg_version_check_request(dev, &edev->mailbox); device_unlock(dev); if (ret) { dev_err(dev, "Protocol version check failed: %d", ret); @@ -494,8 +494,8 @@ int ethosu_dev_init(struct rpmsg_device *rpdev, } device_lock(dev); - ret = ethosu_capabilities_request(dev, &edev->mailbox, - &edev->capabilities); + ret = ethosu_rpmsg_capabilities_request(dev, &edev->mailbox, + &edev->capabilities); device_unlock(dev); if (ret) { dev_err(dev, "Failed to get device capabilities: %d", ret); @@ -534,7 +534,7 @@ del_cdev: cdev_del(&edev->cdev); deinit_mailbox: - ethosu_mailbox_deinit(&edev->mailbox); + ethosu_rpmsg_mailbox_deinit(&edev->mailbox); free_rpmsg_ept: rpmsg_destroy_ept(edev->ept); @@ -551,7 +551,7 @@ void ethosu_dev_deinit(struct rpmsg_device *rpdev) struct ethosu_device *edev = dev_get_drvdata(dev); device_lock(&edev->dev); - ethosu_mailbox_fail(&edev->mailbox); + ethosu_rpmsg_mailbox_fail(&edev->mailbox); device_unlock(&edev->dev); rpmsg_destroy_ept(edev->ept); diff --git a/kernel/include/common/ethosu_device.h b/kernel/include/common/ethosu_device.h index e96543e..04ac5d8 100644 --- a/kernel/include/common/ethosu_device.h +++ b/kernel/include/common/ethosu_device.h @@ -46,7 +46,7 @@ struct ethosu_device { struct rpmsg_endpoint *ept; struct cdev cdev; struct class *class; - struct ethosu_mailbox mailbox; + struct ethosu_rpmsg_mailbox mailbox; struct ethosu_uapi_device_capabilities capabilities; }; diff --git a/kernel/include/rpmsg/ethosu_rpmsg.h b/kernel/include/rpmsg/ethosu_rpmsg.h index c1923c2..0be323e 100644 --- a/kernel/include/rpmsg/ethosu_rpmsg.h +++ b/kernel/include/rpmsg/ethosu_rpmsg.h @@ -17,8 +17,8 @@ * http://www.gnu.org/licenses/gpl-2.0.html. */ -#ifndef ETHOSU_CORE_RPMSG_H -#define ETHOSU_CORE_RPMSG_H +#ifndef ETHOSU_RPMSG_H +#define ETHOSU_RPMSG_H #ifdef __KERNEL__ #include <linux/types.h> @@ -31,137 +31,138 @@ namespace EthosU { #endif /** Maximum number of IFM/OFM buffers per inference */ -#define ETHOSU_CORE_BUFFER_MAX 16 +#define ETHOSU_RPMSG_BUFFER_MAX 16 /** Maximum number of PMU counters to be returned for inference */ -#define ETHOSU_CORE_PMU_MAX 8 +#define ETHOSU_RPMSG_PMU_MAX 8 -#define ETHOSU_CORE_MSG_MAGIC 0x41457631 -#define ETHOSU_CORE_MSG_VERSION_MAJOR 0 -#define ETHOSU_CORE_MSG_VERSION_MINOR 2 -#define ETHOSU_CORE_MSG_VERSION_PATCH 0 +#define ETHOSU_RPMSG_MAGIC 0x41457631 +#define ETHOSU_RPMSG_VERSION_MAJOR 0 +#define ETHOSU_RPMSG_VERSION_MINOR 2 +#define ETHOSU_RPMSG_VERSION_PATCH 0 /** - * enum ethosu_core_msg_type - Message types + * enum ethosu_rpmsg_type - Message types * * Types for the messages sent between the host and the core subsystem. */ -enum ethosu_core_msg_type { - ETHOSU_CORE_MSG_ERR = 1, - ETHOSU_CORE_MSG_PING, - ETHOSU_CORE_MSG_PONG, - ETHOSU_CORE_MSG_INFERENCE_REQ, - ETHOSU_CORE_MSG_INFERENCE_RSP, - ETHOSU_CORE_MSG_VERSION_REQ, - ETHOSU_CORE_MSG_VERSION_RSP, - ETHOSU_CORE_MSG_CAPABILITIES_REQ, - ETHOSU_CORE_MSG_CAPABILITIES_RSP, - ETHOSU_CORE_MSG_NETWORK_INFO_REQ, - ETHOSU_CORE_MSG_NETWORK_INFO_RSP, - ETHOSU_CORE_MSG_CANCEL_INFERENCE_REQ, - ETHOSU_CORE_MSG_CANCEL_INFERENCE_RSP, - ETHOSU_CORE_MSG_MAX +enum ethosu_rpmsg_type { + ETHOSU_RPMSG_ERR = 1, + ETHOSU_RPMSG_PING, + ETHOSU_RPMSG_PONG, + ETHOSU_RPMSG_INFERENCE_REQ, + ETHOSU_RPMSG_INFERENCE_RSP, + ETHOSU_RPMSG_VERSION_REQ, + ETHOSU_RPMSG_VERSION_RSP, + ETHOSU_RPMSG_CAPABILITIES_REQ, + ETHOSU_RPMSG_CAPABILITIES_RSP, + ETHOSU_RPMSG_NETWORK_INFO_REQ, + ETHOSU_RPMSG_NETWORK_INFO_RSP, + ETHOSU_RPMSG_CANCEL_INFERENCE_REQ, + ETHOSU_RPMSG_CANCEL_INFERENCE_RSP, + ETHOSU_RPMSG_MAX }; /** - * struct ethosu_core_msg_header - Message header + * struct ethosu_rpmsg_header - Message header */ -struct ethosu_core_msg_header { +struct ethosu_rpmsg_header { uint32_t magic; uint32_t type; uint64_t msg_id; }; /** - * enum ethosu_core_status - Status + * enum ethosu_rpmsg_status - Status */ -enum ethosu_core_status { - ETHOSU_CORE_STATUS_OK, - ETHOSU_CORE_STATUS_ERROR, - ETHOSU_CORE_STATUS_RUNNING, - ETHOSU_CORE_STATUS_REJECTED, - ETHOSU_CORE_STATUS_ABORTED, - ETHOSU_CORE_STATUS_ABORTING, +enum ethosu_rpmsg_status { + ETHOSU_RPMSG_STATUS_OK, + ETHOSU_RPMSG_STATUS_ERROR, + ETHOSU_RPMSG_STATUS_RUNNING, + ETHOSU_RPMSG_STATUS_REJECTED, + ETHOSU_RPMSG_STATUS_ABORTED, + ETHOSU_RPMSG_STATUS_ABORTING, }; /** - * struct ethosu_core_buffer - Buffer descriptor + * struct ethosu_rpmsg_buffer - Buffer descriptor * * Pointer and size to a buffer within the Ethos-U address space. */ -struct ethosu_core_buffer { +struct ethosu_rpmsg_buffer { uint32_t ptr; uint32_t size; }; /** - * enum ethosu_core_network_type - Network buffer type + * enum ethosu_rpmsg_network_type - Network buffer type */ -enum ethosu_core_network_type { - ETHOSU_CORE_NETWORK_BUFFER = 1, - ETHOSU_CORE_NETWORK_INDEX +enum ethosu_rpmsg_network_type { + ETHOSU_RPMSG_NETWORK_BUFFER = 1, + ETHOSU_RPMSG_NETWORK_INDEX }; /** - * struct ethosu_core_network_buffer - Network buffer + * struct ethosu_rpmsg_network_buffer - Network buffer */ -struct ethosu_core_network_buffer { +struct ethosu_rpmsg_network_buffer { uint32_t type; union { - struct ethosu_core_buffer buffer; - uint32_t index; + struct ethosu_rpmsg_buffer buffer; + uint32_t index; }; }; /** - * struct ethosu_core_msg_inference_req - Inference request + * struct ethosu_rpmsg_inference_req - Inference request */ -struct ethosu_core_msg_inference_req { - uint32_t ifm_count; - struct ethosu_core_buffer ifm[ETHOSU_CORE_BUFFER_MAX]; - uint32_t ofm_count; - struct ethosu_core_buffer ofm[ETHOSU_CORE_BUFFER_MAX]; - struct ethosu_core_network_buffer network; - uint8_t pmu_event_config[ETHOSU_CORE_PMU_MAX]; - uint32_t pmu_cycle_counter_enable; +struct ethosu_rpmsg_inference_req { + uint32_t ifm_count; + struct ethosu_rpmsg_buffer ifm[ETHOSU_RPMSG_BUFFER_MAX]; + uint32_t ofm_count; + struct ethosu_rpmsg_buffer ofm[ETHOSU_RPMSG_BUFFER_MAX]; + struct ethosu_rpmsg_network_buffer network; + uint8_t pmu_event_config[ETHOSU_RPMSG_PMU_MAX + ]; + uint32_t pmu_cycle_counter_enable; }; /** - * struct ethosu_core_msg_inference_rsp - Inference response + * struct ethosu_rpmsg_inference_rsp - Inference response */ -struct ethosu_core_msg_inference_rsp { +struct ethosu_rpmsg_inference_rsp { uint32_t ofm_count; - uint32_t ofm_size[ETHOSU_CORE_BUFFER_MAX]; + uint32_t ofm_size[ETHOSU_RPMSG_BUFFER_MAX]; uint32_t status; - uint8_t pmu_event_config[ETHOSU_CORE_PMU_MAX]; - uint64_t pmu_event_count[ETHOSU_CORE_PMU_MAX]; + uint8_t pmu_event_config[ETHOSU_RPMSG_PMU_MAX]; + uint64_t pmu_event_count[ETHOSU_RPMSG_PMU_MAX]; uint32_t pmu_cycle_counter_enable; uint64_t pmu_cycle_counter_count; }; /** - * struct ethosu_core_msg_network_info_req - Network information request + * struct ethosu_rpmsg_network_info_req - Network information request */ -struct ethosu_core_msg_network_info_req { - struct ethosu_core_network_buffer network; +struct ethosu_rpmsg_network_info_req { + struct ethosu_rpmsg_network_buffer network; }; /** - * struct ethosu_core_msg_network_info_rsp - Network information response + * struct ethosu_rpmsg_network_info_rsp - Network information response */ -struct ethosu_core_msg_network_info_rsp { +struct ethosu_rpmsg_network_info_rsp { char desc[32]; uint32_t ifm_count; - uint32_t ifm_size[ETHOSU_CORE_BUFFER_MAX]; + uint32_t ifm_size[ETHOSU_RPMSG_BUFFER_MAX]; uint32_t ofm_count; - uint32_t ofm_size[ETHOSU_CORE_BUFFER_MAX]; + uint32_t ofm_size[ETHOSU_RPMSG_BUFFER_MAX]; uint32_t status; }; /** - * struct ethosu_core_msg_version_rsp - Message protocol version + * struct ethosu_rpmsg_version_rsp - Message protocol version */ -struct ethosu_core_msg_version_rsp { +struct ethosu_rpmsg_version_rsp { uint8_t major; uint8_t minor; uint8_t patch; @@ -169,9 +170,9 @@ struct ethosu_core_msg_version_rsp { }; /** - * struct ethosu_core_msg_capabilities_rsp - Message capabilities response + * struct ethosu_rpmsg_capabilities_rsp - Message capabilities response */ -struct ethosu_core_msg_capabilities_rsp { +struct ethosu_rpmsg_capabilities_rsp { uint32_t version_status; uint32_t version_minor; uint32_t version_major; @@ -188,56 +189,56 @@ struct ethosu_core_msg_capabilities_rsp { }; /** - * struct ethosu_core_msg_cancel_inference_req - Message cancel inference + * struct ethosu_rpmsg_cancel_inference_req - Message cancel inference * request */ -struct ethosu_core_msg_cancel_inference_req { +struct ethosu_rpmsg_cancel_inference_req { uint64_t inference_handle; }; /** - * struct ethosu_core_msg_cancel_inference_rsp - Message cancel inference + * struct ethosu_rpmsg_cancel_inference_rsp - Message cancel inference * response */ -struct ethosu_core_msg_cancel_inference_rsp { +struct ethosu_rpmsg_cancel_inference_rsp { uint32_t status; }; /** - * enum ethosu_core_err_type - Error types + * enum ethosu_rpmsg_err_type - Error types */ -enum ethosu_core_err_type { - ETHOSU_CORE_MSG_ERR_GENERIC = 0, - ETHOSU_CORE_MSG_ERR_UNSUPPORTED_TYPE, - ETHOSU_CORE_MSG_ERR_INVALID_PAYLOAD, - ETHOSU_CORE_MSG_ERR_INVALID_SIZE, - ETHOSU_CORE_MSG_ERR_INVALID_MAGIC, - ETHOSU_CORE_MSG_ERR_MAX +enum ethosu_rpmsg_err_type { + ETHOSU_RPMSG_ERR_GENERIC = 0, + ETHOSU_RPMSG_ERR_UNSUPPORTED_TYPE, + ETHOSU_RPMSG_ERR_INVALID_PAYLOAD, + ETHOSU_RPMSG_ERR_INVALID_SIZE, + ETHOSU_RPMSG_ERR_INVALID_MAGIC, + ETHOSU_RPMSG_ERR_MAX }; /** - * struct ethosu_core_msg_err - Error message struct + * struct ethosu_rpmsg_err - Error message struct */ -struct ethosu_core_msg_err { +struct ethosu_rpmsg_err { uint32_t type; /* optional use of extra error code */ char msg[128]; }; /** - * struct ethosu_core_rpmsg - Rpmsg message + * struct ethosu_rpmsg - Rpmsg message */ -struct ethosu_core_rpmsg { - struct ethosu_core_msg_header header; +struct ethosu_rpmsg { + struct ethosu_rpmsg_header header; union { - struct ethosu_core_msg_inference_req inf_req; - struct ethosu_core_msg_inference_rsp inf_rsp; - struct ethosu_core_msg_network_info_req net_info_req; - struct ethosu_core_msg_network_info_rsp net_info_rsp; - struct ethosu_core_msg_capabilities_rsp cap_rsp; - struct ethosu_core_msg_cancel_inference_req cancel_req; - struct ethosu_core_msg_cancel_inference_rsp cancel_rsp; - struct ethosu_core_msg_version_rsp version_rsp; - struct ethosu_core_msg_err error; + struct ethosu_rpmsg_inference_req inf_req; + struct ethosu_rpmsg_inference_rsp inf_rsp; + struct ethosu_rpmsg_network_info_req net_info_req; + struct ethosu_rpmsg_network_info_rsp net_info_rsp; + struct ethosu_rpmsg_capabilities_rsp cap_rsp; + struct ethosu_rpmsg_cancel_inference_req cancel_req; + struct ethosu_rpmsg_cancel_inference_rsp cancel_rsp; + struct ethosu_rpmsg_version_rsp version_rsp; + struct ethosu_rpmsg_err error; }; }; @@ -245,4 +246,4 @@ struct ethosu_core_rpmsg { } /*namespace EthosU */ #endif -#endif /* ETHOSU_CORE_RPMSG_H */ +#endif /* ETHOSU_RPMSG_H */ diff --git a/kernel/include/rpmsg/ethosu_rpmsg_cancel_inference.h b/kernel/include/rpmsg/ethosu_rpmsg_cancel_inference.h index 1d6cc03..799b006 100644 --- a/kernel/include/rpmsg/ethosu_rpmsg_cancel_inference.h +++ b/kernel/include/rpmsg/ethosu_rpmsg_cancel_inference.h @@ -17,8 +17,8 @@ * http://www.gnu.org/licenses/gpl-2.0.html. */ -#ifndef ETHOSU_CANCEL_INFERENCE_H -#define ETHOSU_CANCEL_INFERENCE_H +#ifndef ETHOSU_RPMSG_CANCEL_INFERENCE_H +#define ETHOSU_RPMSG_CANCEL_INFERENCE_H /**************************************************************************** * Includes @@ -34,16 +34,16 @@ * Types ****************************************************************************/ -struct ethosu_core_msg_cancel_inference_rsp; -struct ethosu_inference; +struct ethosu_rpmsg_cancel_inference_rsp; +struct ethosu_rpmsg_inference; struct ethosu_uapi_cancel_inference_status; -struct ethosu_cancel_inference { +struct ethosu_rpmsg_cancel_inference { struct device *dev; - struct ethosu_inference *inf; + struct ethosu_rpmsg_inference *inf; struct ethosu_uapi_cancel_inference_status *uapi; struct completion done; - struct ethosu_mailbox_msg msg; + struct ethosu_rpmsg_mailbox_msg msg; int errno; }; @@ -52,20 +52,20 @@ struct ethosu_cancel_inference { ****************************************************************************/ /** - * ethosu_cancel_inference_request() - Send cancel inference request + * ethosu_rpmsg_cancel_inference_request() - Send cancel inference request * * Return: 0 on success, error code otherwise. */ -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); /** - * ethosu_cancel_inference_rsp() - Handle cancel inference response + * ethosu_rpmsg_cancel_inference_rsp() - Handle cancel inference response */ -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); -#endif /* ETHOSU_CANCEL_INFERENCE_H */ +#endif /* ETHOSU_RPMSG_CANCEL_INFERENCE_H */ diff --git a/kernel/include/rpmsg/ethosu_rpmsg_capabilities.h b/kernel/include/rpmsg/ethosu_rpmsg_capabilities.h index aefdbaa..04e5354 100644 --- a/kernel/include/rpmsg/ethosu_rpmsg_capabilities.h +++ b/kernel/include/rpmsg/ethosu_rpmsg_capabilities.h @@ -17,8 +17,8 @@ * http://www.gnu.org/licenses/gpl-2.0.html. */ -#ifndef ETHOSU_CAPABILITIES_H -#define ETHOSU_CAPABILITIES_H +#ifndef ETHOSU_RPMSG_CAPABILITES_H +#define ETHOSU_RPMSG_CAPABILITES_H /**************************************************************************** * Includes @@ -33,18 +33,18 @@ * Types ****************************************************************************/ -struct ethosu_core_msg_capabilities_rsp; +struct ethosu_rpmsg_capabilities_rsp; struct ethosu_device; struct ethosu_uapi_device_capabilities; /** - * struct ethosu_capabilities - Capabilities internal struct + * struct ethosu_rpmsg_capabilities - Capabilities internal struct */ -struct ethosu_capabilities { +struct ethosu_rpmsg_capabilities { struct device *dev; struct completion done; struct ethosu_uapi_device_capabilities *uapi; - struct ethosu_mailbox_msg msg; + struct ethosu_rpmsg_mailbox_msg msg; int errno; }; @@ -52,12 +52,12 @@ struct ethosu_capabilities { * Functions ****************************************************************************/ -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); -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); -#endif +#endif /* ETHOSU_RPMSG_CAPABILITES_H */ diff --git a/kernel/include/rpmsg/ethosu_rpmsg_inference.h b/kernel/include/rpmsg/ethosu_rpmsg_inference.h index 8bdfb8a..e1d1610 100644 --- a/kernel/include/rpmsg/ethosu_rpmsg_inference.h +++ b/kernel/include/rpmsg/ethosu_rpmsg_inference.h @@ -17,8 +17,8 @@ * http://www.gnu.org/licenses/gpl-2.0.html. */ -#ifndef ETHOSU_INFERENCE_H -#define ETHOSU_INFERENCE_H +#ifndef ETHOSU_RPMSG_INFERENCE_H +#define ETHOSU_RPMSG_INFERENCE_H /**************************************************************************** * Includes @@ -35,13 +35,13 @@ ****************************************************************************/ struct ethosu_buffer; -struct ethosu_core_msg_inference_rsp; -struct ethosu_network; +struct ethosu_rpmsg_inference_rsp; +struct ethosu_rpmsg_network; struct ethosu_uapi_inference_create; struct file; /** - * struct ethosu_inference - Inference struct + * struct ethosu_rpmsg_inference - Inference struct * @edev: Arm Ethos-U device * @file: File handle * @kref: Reference counter @@ -57,24 +57,24 @@ struct file; * @pmu_cycle_counter_count: PMU cycle counter count after inference * @msg: Mailbox message */ -struct ethosu_inference { - struct device *dev; - struct ethosu_mailbox *mailbox; - struct file *file; - struct kref kref; - wait_queue_head_t waitq; - bool done; - uint32_t ifm_count; - struct ethosu_buffer *ifm[ETHOSU_FD_MAX]; - uint32_t ofm_count; - struct ethosu_buffer *ofm[ETHOSU_FD_MAX]; - struct ethosu_network *net; - enum ethosu_uapi_status status; - uint8_t pmu_event_config[ETHOSU_PMU_EVENT_MAX]; - uint64_t pmu_event_count[ETHOSU_PMU_EVENT_MAX]; - uint32_t pmu_cycle_counter_enable; - uint64_t pmu_cycle_counter_count; - struct ethosu_mailbox_msg msg; +struct ethosu_rpmsg_inference { + struct device *dev; + struct ethosu_rpmsg_mailbox *mailbox; + struct file *file; + struct kref kref; + wait_queue_head_t waitq; + bool done; + uint32_t ifm_count; + struct ethosu_buffer *ifm[ETHOSU_FD_MAX]; + uint32_t ofm_count; + struct ethosu_buffer *ofm[ETHOSU_FD_MAX]; + struct ethosu_rpmsg_network *net; + enum ethosu_uapi_status status; + uint8_t pmu_event_config[ETHOSU_PMU_EVENT_MAX]; + uint64_t pmu_event_count[ETHOSU_PMU_EVENT_MAX]; + uint32_t pmu_cycle_counter_enable; + uint64_t pmu_cycle_counter_count; + struct ethosu_rpmsg_mailbox_msg msg; }; /**************************************************************************** @@ -82,43 +82,43 @@ struct ethosu_inference { ****************************************************************************/ /** - * ethosu_inference_create() - Create inference + * ethosu_rpmsg_inference_create() - Create inference * * This function must be called in the context of a user space process. * * Return: fd on success, else error code. */ -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); /** - * ethosu_inference_get_from_fd() - Get inference handle from fd + * ethosu_rpmsg_inference_get_from_fd() - Get inference handle from fd * * This function must be called from a user space context. * * Return: Pointer on success, else ERR_PTR. */ -struct ethosu_inference *ethosu_inference_get_from_fd(int fd); +struct ethosu_rpmsg_inference *ethosu_rpmsg_inference_get_from_fd(int fd); /** - * ethosu_inference_get() - Get inference + * ethosu_rpmsg_inference_get() - Get inference */ -void ethosu_inference_get(struct ethosu_inference *inf); +void ethosu_rpmsg_inference_get(struct ethosu_rpmsg_inference *inf); /** - * ethosu_inference_put() - Put inference + * ethosu_rpmsg_inference_put() - Put inference * * Return: 1 if object was removed, else 0. */ -int ethosu_inference_put(struct ethosu_inference *inf); +int ethosu_rpmsg_inference_put(struct ethosu_rpmsg_inference *inf); /** - * ethosu_inference_rsp() - Handle inference response + * ethosu_rpmsg_inference_rsp() - Handle inference response */ -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); -#endif /* ETHOSU_INFERENCE_H */ +#endif /* ETHOSU_RPMSG_INFERENCE_H */ diff --git a/kernel/include/rpmsg/ethosu_rpmsg_mailbox.h b/kernel/include/rpmsg/ethosu_rpmsg_mailbox.h index 66eb172..b660288 100644 --- a/kernel/include/rpmsg/ethosu_rpmsg_mailbox.h +++ b/kernel/include/rpmsg/ethosu_rpmsg_mailbox.h @@ -17,8 +17,8 @@ * http://www.gnu.org/licenses/gpl-2.0.html. */ -#ifndef ETHOSU_MAILBOX_H -#define ETHOSU_MAILBOX_H +#ifndef ETHOSU_RPMSG_MAILBOX_H +#define ETHOSU_RPMSG_MAILBOX_H /**************************************************************************** * Includes @@ -36,15 +36,15 @@ struct device; struct ethosu_buffer; -struct ethosu_core_msg; -struct ethosu_core_queue; +struct ethosu_rpmsg; +struct ethosu_rpmsg_core_queue; struct ethosu_device; -struct ethosu_network; +struct ethosu_rpmsg_network; struct resource; -typedef void (*ethosu_mailbox_cb)(void *user_arg); +typedef void (*ethosu_rpmsg_mailbox_cb)(void *user_arg); -struct ethosu_mailbox { +struct ethosu_rpmsg_mailbox { struct device *dev; struct rpmsg_endpoint *ept; struct idr msg_idr; @@ -53,17 +53,17 @@ struct ethosu_mailbox { }; /** - * struct ethosu_mailbox_msg - Mailbox message + * struct ethosu_rpmsg_mailbox_msg - Mailbox message * @id: Message id * @type: Message request type * @fail: Message failure callback * * The fail callback will be called with the device mutex locked */ -struct ethosu_mailbox_msg { +struct ethosu_rpmsg_mailbox_msg { int id; uint32_t type; - void (*fail)(struct ethosu_mailbox_msg *msg); + void (*fail)(struct ethosu_rpmsg_mailbox_msg *msg); }; /**************************************************************************** @@ -71,124 +71,125 @@ struct ethosu_mailbox_msg { ****************************************************************************/ /** - * ethosu_mailbox_init() - Initialize mailbox + * ethosu_rpmsg_mailbox_init() - Initialize mailbox * * Return: 0 on success, else error code. */ -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); /** - * ethosu_mailbox_deinit() - Deinitialize mailbox + * ethosu_rpmsg_mailbox_deinit() - Deinitialize mailbox */ -void ethosu_mailbox_deinit(struct ethosu_mailbox *mbox); +void ethosu_rpmsg_mailbox_deinit(struct ethosu_rpmsg_mailbox *mbox); /** - * ethosu_mailbox_register() - Register the ethosu_mailbox_msg in ethosu_mailbox + * ethosu_rpmsg_mailbox_register() - Register the message in mailbox * * Context: Must be called with the device mutex locked * * Return: 0 on success, else error code. */ -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); /** - * ethosu_mailbox_free_id() - Free the id of the ethosu_mailbox_msg + * ethosu_rpmsg_mailbox_free_id() - Free the id of the message * * Context: Must be called with the device mutex locked */ -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); /** - * ethosu_mailbox_find() - Find mailbox message + * ethosu_rpmsg_mailbox_find() - Find mailbox message * * Context: Must be called with the device mutex locked * * Return: a valid pointer on success, otherwise an error ptr. */ -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); /** - * ethosu_mailbox_fail() - Fail mailbox messages + * ethosu_rpmsg_mailbox_fail() - Fail mailbox messages * * Call fail() callback on all messages in pending list. * * Context: Must be called with the device mutex locked */ -void ethosu_mailbox_fail(struct ethosu_mailbox *mbox); +void ethosu_rpmsg_mailbox_fail(struct ethosu_rpmsg_mailbox *mbox); /** - * ethosu_mailbox_reset() - Reset to end of queue + * ethosu_rpmsg_mailbox_reset() - Reset to end of queue */ -void ethosu_mailbox_reset(struct ethosu_mailbox *mbox); +void ethosu_rpmsg_mailbox_reset(struct ethosu_rpmsg_mailbox *mbox); /** - * ethosu_mailbox_ping() - Send ping message + * ethosu_rpmsg_mailbox_ping() - Send ping message * * Return: 0 on success, else error code. */ -int ethosu_mailbox_ping(struct ethosu_mailbox *mbox); +int ethosu_rpmsg_mailbox_ping(struct ethosu_rpmsg_mailbox *mbox); /** - * ethosu_mailbox_pong() - Send pong response + * ethosu_rpmsg_mailbox_pong() - Send pong response * * Return: 0 on success, else error code. */ -int ethosu_mailbox_pong(struct ethosu_mailbox *mbox); +int ethosu_rpmsg_mailbox_pong(struct ethosu_rpmsg_mailbox *mbox); /** - * ethosu_mailbox_version_request() - Send protocol version request + * ethosu_rpmsg_mailbox_version_request() - Send protocol version request * * Return: 0 on succes, else error code */ -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); /** - * ethosu_mailbox_capabilities_request() - Send capabilities request + * ethosu_rpmsg_mailbox_capabilities_request() - Send capabilities request * * Return: 0 on success, else error code. */ -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); /** - * ethosu_mailbox_inference() - Send inference + * ethosu_rpmsg_mailbox_inference() - Send inference * * Return: 0 on success, else error code. */ -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); /** - * ethosu_mailbox_network_info_request() - Send network info request + * ethosu_rpmsg_mailbox_network_info_request() - Send network info request * * Return: 0 on success, else error code. */ -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); /** - * ethosu_mailbox_cancel_inference() - Send inference cancellation + * ethosu_rpmsg_mailbox_cancel_inference() - Send inference cancellation * * Return: 0 on success, else error code. */ -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); -#endif /* ETHOSU_MAILBOX_H */ +#endif /* ETHOSU_RPMSG_MAILBOX_H */ diff --git a/kernel/include/rpmsg/ethosu_rpmsg_network.h b/kernel/include/rpmsg/ethosu_rpmsg_network.h index 269018a..40819ce 100644 --- a/kernel/include/rpmsg/ethosu_rpmsg_network.h +++ b/kernel/include/rpmsg/ethosu_rpmsg_network.h @@ -17,8 +17,8 @@ * http://www.gnu.org/licenses/gpl-2.0.html. */ -#ifndef ETHOSU_NETWORK_H -#define ETHOSU_NETWORK_H +#ifndef ETHOSU_RPMSG_NETWORK_H +#define ETHOSU_RPMSG_NETWORK_H /**************************************************************************** * Includes @@ -36,13 +36,13 @@ struct ethosu_uapi_network_create; struct device; struct file; -struct ethosu_network { - struct device *dev; - struct ethosu_mailbox *mailbox; - struct file *file; - struct kref kref; - struct ethosu_dma_mem *dma_mem; - uint32_t index; +struct ethosu_rpmsg_network { + struct device *dev; + struct ethosu_rpmsg_mailbox *mailbox; + struct file *file; + struct kref kref; + struct ethosu_dma_mem *dma_mem; + uint32_t index; }; /**************************************************************************** @@ -50,35 +50,35 @@ struct ethosu_network { ****************************************************************************/ /** - * ethosu_network_create() - Create network + * ethosu_rpmsg_network_create() - Create network * * This function must be called in the context of a user space process. * * Return: fd on success, else error code. */ -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); /** - * ethosu_network_get_from_fd() - Get network handle from fd + * ethosu_rpmsg_network_get_from_fd() - Get network handle from fd * * This function must be called from a user space context. * * Return: Pointer on success, else ERR_PTR. */ -struct ethosu_network *ethosu_network_get_from_fd(int fd); +struct ethosu_rpmsg_network *ethosu_rpmsg_network_get_from_fd(int fd); /** - * ethosu_network_get() - Get network + * ethosu_rpmsg_network_get() - Get network */ -void ethosu_network_get(struct ethosu_network *net); +void ethosu_rpmsg_network_get(struct ethosu_rpmsg_network *net); /** - * ethosu_network_put() - Put network + * ethosu_rpmsg_network_put() - Put network * * Return: 1 if object was removed, else 0. */ -int ethosu_network_put(struct ethosu_network *net); +int ethosu_rpmsg_network_put(struct ethosu_rpmsg_network *net); -#endif /* ETHOSU_NETWORK_H */ +#endif /* ETHOSU_RPMSG_NETWORK_H */ diff --git a/kernel/include/rpmsg/ethosu_rpmsg_network_info.h b/kernel/include/rpmsg/ethosu_rpmsg_network_info.h index aaa3733..a5965c0 100644 --- a/kernel/include/rpmsg/ethosu_rpmsg_network_info.h +++ b/kernel/include/rpmsg/ethosu_rpmsg_network_info.h @@ -17,8 +17,8 @@ * http://www.gnu.org/licenses/gpl-2.0.html. */ -#ifndef ETHOSU_NETWORK_INFO_H -#define ETHOSU_NETWORK_INFO_H +#ifndef ETHOSU_RPMSG_NETWORK_INFO_H +#define ETHOSU_RPMSG_NETWORK_INFO_H /**************************************************************************** * Includes @@ -33,17 +33,17 @@ * Types ****************************************************************************/ -struct ethosu_core_msg_network_info_rsp; -struct ethosu_network; +struct ethosu_rpmsg_network_info_rsp; +struct ethosu_rpmsg_network; struct ethosu_uapi_network_info; -struct ethosu_network_info { +struct ethosu_rpmsg_network_info { struct device *dev; - struct ethosu_network *net; + struct ethosu_rpmsg_network *net; struct ethosu_uapi_network_info *uapi; struct completion done; int errno; - struct ethosu_mailbox_msg msg; + struct ethosu_rpmsg_mailbox_msg msg; }; /**************************************************************************** @@ -51,22 +51,22 @@ struct ethosu_network_info { ****************************************************************************/ /** - * ethosu_network_info_request() - Send a network info request + * ethosu_rpmsg_network_info_request() - Send a network info request * * This function must be called in the context of a user space process. * * Return: 0 on success, . */ -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); /** - * ethosu_network_info_rsp() - Handle network info response. + * ethosu_rpmsg_network_info_rsp() - Handle network info response. */ -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); -#endif /* ETHOSU_NETWORK_INFO_H */ +#endif /* ETHOSU_RPMSG_NETWORK_INFO_H */ diff --git a/kernel/include/rpmsg/ethosu_rpmsg_version.h b/kernel/include/rpmsg/ethosu_rpmsg_version.h index 755a3d5..aa80835 100644 --- a/kernel/include/rpmsg/ethosu_rpmsg_version.h +++ b/kernel/include/rpmsg/ethosu_rpmsg_version.h @@ -17,8 +17,8 @@ * http://www.gnu.org/licenses/gpl-2.0.html. */ -#ifndef ETHOSU_VERSION_H -#define ETHOSU_VERSION_H +#ifndef ETHOSU_RPMSG_VERSION_H +#define ETHOSU_RPMSG_VERSION_H /**************************************************************************** * Includes @@ -33,27 +33,27 @@ * Types ****************************************************************************/ -struct ethosu_core_msg_version_rsp; +struct ethosu_rpmsg_version_rsp; /** - * struct ethosu_version - Protocol version internal struct + * struct ethosu_rpmsg_version - Protocol version internal struct */ -struct ethosu_version { - struct device *dev; - struct completion done; - struct ethosu_mailbox_msg msg; - int errno; +struct ethosu_rpmsg_version { + struct device *dev; + struct completion done; + struct ethosu_rpmsg_mailbox_msg msg; + int errno; }; /**************************************************************************** * Functions ****************************************************************************/ -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); -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); -#endif /* ETHOSU_VERSION_H */ +#endif /* ETHOSU_RPMSG_VERSION_H */ 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", |