diff --git a/openamp/0005-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch b/openamp/0005-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch new file mode 100644 index 0000000000..ec98e5e45b --- /dev/null +++ b/openamp/0005-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch @@ -0,0 +1,68 @@ +From 9ebf24a656b42d262e66a96b237cabb15508f4ea Mon Sep 17 00:00:00 2001 +From: ligd +Date: Tue, 19 Oct 2021 19:45:14 +0800 +Subject: [PATCH 1/2] rpmsg: notify the user when the remote address is + received + +Change-Id: I2f0601fb38944e0cfb8888aa397740161b159e40 +Signed-off-by: ligd +--- + lib/include/openamp/rpmsg.h | 4 ++++ + lib/rpmsg/rpmsg_virtio.c | 6 ++++++ + 2 files changed, 10 insertions(+) + +diff --git a/lib/include/openamp/rpmsg.h open-amp/lib/include/openamp/rpmsg.h +index 5c8b45c..93aeec6 100644 +--- a/lib/include/openamp/rpmsg.h ++++ open-amp/lib/include/openamp/rpmsg.h +@@ -56,6 +56,7 @@ struct rpmsg_device; + /* Returns positive value on success or negative error value on failure */ + typedef int (*rpmsg_ept_cb)(struct rpmsg_endpoint *ept, void *data, + size_t len, uint32_t src, void *priv); ++typedef void (*rpmsg_ns_bound_cb)(struct rpmsg_endpoint *ept); + typedef void (*rpmsg_ns_unbind_cb)(struct rpmsg_endpoint *ept); + typedef void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev, + const char *name, uint32_t dest); +@@ -68,6 +69,8 @@ typedef void (*rpmsg_ns_bind_cb)(struct rpmsg_device *rdev, + * @dest_addr: address of the default remote endpoint binded. + * @cb: user rx callback, return value of this callback is reserved + * for future use, for now, only allow RPMSG_SUCCESS as return value. ++ * @ns_bound_cb: end point service bound callback, called when remote ++ * ept address is received. + * @ns_unbind_cb: end point service unbind callback, called when remote + * ept is destroyed. + * @node: end point node. +@@ -82,6 +85,7 @@ struct rpmsg_endpoint { + uint32_t addr; + uint32_t dest_addr; + rpmsg_ept_cb cb; ++ rpmsg_ns_bound_cb ns_bound_cb; + rpmsg_ns_unbind_cb ns_unbind_cb; + struct metal_list node; + void *priv; +diff --git a/lib/rpmsg/rpmsg_virtio.c open-amp/lib/rpmsg/rpmsg_virtio.c +index 2f28a30..51c2565 100644 +--- a/lib/rpmsg/rpmsg_virtio.c ++++ open-amp/lib/rpmsg/rpmsg_virtio.c +@@ -569,12 +569,18 @@ static int rpmsg_virtio_ns_callback(struct rpmsg_endpoint *ept, void *data, + metal_mutex_release(&rdev->lock); + if (_ept->name[0] && rdev->support_ack) + rpmsg_send_ns_message(_ept, RPMSG_NS_CREATE_ACK); ++ /* notify application that the endpoint has been bound */ ++ if (_ept->ns_bound_cb) ++ _ept->ns_bound_cb(_ept); + } + } else { /* RPMSG_NS_CREATE_ACK */ + /* save the received destination address */ + if (_ept) + _ept->dest_addr = dest; + metal_mutex_release(&rdev->lock); ++ /* notify application that the endpoint has been bound */ ++ if (_ept && _ept->ns_bound_cb) ++ _ept->ns_bound_cb(_ept); + } + + return RPMSG_SUCCESS; +-- +2.25.1 + diff --git a/openamp/open-amp.defs b/openamp/open-amp.defs index a9e31f34aa..558bff680e 100644 --- a/openamp/open-amp.defs +++ b/openamp/open-amp.defs @@ -37,6 +37,7 @@ open-amp.zip: $(Q) patch -p0 < 0002-Negotiate-individual-buffer-size-dynamically.patch $(Q) patch -p0 < 0003-rpmsg-wait-endpoint-ready-in-rpmsg_send-and-rpmsg_se.patch $(Q) patch -p0 < 0004-openamp-add-ns_unbind_notify-support.patch + $(Q) patch -p0 < 0005-rpmsg-notify-the-user-when-the-remote-address-is-rec.patch .openamp_headers: open-amp.zip $(eval headers := $(wildcard open-amp/lib/include/openamp/*.h))