Commit c5c83048 authored by Andrew Jeffery's avatar Andrew Jeffery
Browse files

protocol: Add ack


Change-Id: I3ebad03d7f79381c683a121c181db9f30a13a3c4
Signed-off-by: Andrew Jeffery's avatarAndrew Jeffery <andrew@aj.id.au>
parent 093eda5c
......@@ -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,
......
......@@ -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];
rc = context->protocol->ack(context, &io);
if (rc < 0) {
return mbox_xlate_errno(context, rc);
}
return clr_bmc_events(context, (bmc_events & BMC_EVENT_ACK_MASK),
SET_BMC_EVENT);
return 0;
}
/*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment