diff options
author | Andrew Jeffery <andrew@aj.id.au> | 2018-08-07 23:22:05 +0930 |
---|---|---|
committer | Andrew Jeffery <andrew@aj.id.au> | 2018-09-12 15:05:51 +0930 |
commit | c5c830487b1672c6184fdd8e3ec12d1735c3c232 (patch) | |
tree | f775d6e7cb456c84aa0ff4eb4df28e88df98d420 | |
parent | 093eda5c9384927e456cf709c8331f6e60bb9ae9 (diff) | |
download | phosphor-mboxbridge-c5c830487b1672c6184fdd8e3ec12d1735c3c232.tar.gz phosphor-mboxbridge-c5c830487b1672c6184fdd8e3ec12d1735c3c232.zip |
protocol: Add ack
Change-Id: I3ebad03d7f79381c683a121c181db9f30a13a3c4
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
-rw-r--r-- | protocol.c | 8 | ||||
-rw-r--r-- | protocol.h | 8 | ||||
-rw-r--r-- | transport_mbox.c | 13 |
3 files changed, 26 insertions, 3 deletions
@@ -283,6 +283,12 @@ int protocol_v1_close(struct mbox_context *context, struct protocol_close *io) return 0; } +int protocol_v1_ack(struct mbox_context *context, struct protocol_ack *io) +{ + return clr_bmc_events(context, (io->req.flags & BMC_EVENT_ACK_MASK), + SET_BMC_EVENT); +} + /* * get_suggested_timeout() - get the suggested timeout value in seconds * @context: The mbox context pointer @@ -451,6 +457,7 @@ static const struct protocol_ops protocol_ops_v1 = { .erase = NULL, .flush = protocol_v1_flush, .close = protocol_v1_close, + .ack = protocol_v1_ack, }; static const struct protocol_ops protocol_ops_v2 = { @@ -462,6 +469,7 @@ static const struct protocol_ops protocol_ops_v2 = { .erase = protocol_v2_erase, .flush = protocol_v2_flush, .close = protocol_v2_close, + .ack = protocol_v1_ack, }; static const struct protocol_ops *protocol_ops_map[] = { @@ -93,6 +93,12 @@ struct protocol_close { } req; }; +struct protocol_ack { + struct { + uint8_t flags; + } req; +}; + struct protocol_ops { int (*reset)(struct mbox_context *context); int (*get_info)(struct mbox_context *context, @@ -106,6 +112,7 @@ struct protocol_ops { int (*erase)(struct mbox_context *context, struct protocol_erase *io); int (*flush)(struct mbox_context *context, struct protocol_flush *io); int (*close)(struct mbox_context *context, struct protocol_close *io); + int (*ack)(struct mbox_context *context, struct protocol_ack *io); }; int protocol_init(struct mbox_context *context); @@ -125,6 +132,7 @@ int protocol_v1_mark_dirty(struct mbox_context *context, struct protocol_mark_dirty *io); int protocol_v1_flush(struct mbox_context *context, struct protocol_flush *io); int protocol_v1_close(struct mbox_context *context, struct protocol_close *io); +int protocol_v1_ack(struct mbox_context *context, struct protocol_ack *io); /* Protocol v2 */ int protocol_v2_get_info(struct mbox_context *context, diff --git a/transport_mbox.c b/transport_mbox.c index 89562e8..bc5e1e2 100644 --- a/transport_mbox.c +++ b/transport_mbox.c @@ -515,10 +515,17 @@ int mbox_handle_close_window(struct mbox_context *context, int mbox_handle_ack(struct mbox_context *context, union mbox_regs *req, struct mbox_msg *resp) { - uint8_t bmc_events = req->msg.args[0]; + struct protocol_ack io; + int rc; + + io.req.flags = req->msg.args[0]; - return clr_bmc_events(context, (bmc_events & BMC_EVENT_ACK_MASK), - SET_BMC_EVENT); + rc = context->protocol->ack(context, &io); + if (rc < 0) { + return mbox_xlate_errno(context, rc); + } + + return 0; } /* |