Commit 4414fb8d authored by Andrew Jeffery's avatar Andrew Jeffery
Browse files

transport: Retain knowledge of setting and clearing of events


The protocol layer now just filters the events based on the version of
the protocol in use, and leaves it to the transport layer to manage how
the resulting state is represented. For the moment this simply moves
manipulation of bmc_events in struct mbox_context down in to the
transport layer.

Change-Id: Iff1df934505dc9c769be3d376396d425fb4e8264
Signed-off-by: Andrew Jeffery's avatarAndrew Jeffery <andrew@aj.id.au>
parent 2ebfd20f
......@@ -33,10 +33,7 @@ int protocol_events_set(struct mbox_context *context, uint8_t bmc_event)
break;
}
context->bmc_events |= (bmc_event & mask);
MSG_DBG("BMC Events set to: 0x%.2x\n", context->bmc_events);
return context->transport->flush_events(context);
return context->transport->set_events(context, (bmc_event & mask));
}
/*
......@@ -48,10 +45,7 @@ int protocol_events_set(struct mbox_context *context, uint8_t bmc_event)
*/
int protocol_events_clear(struct mbox_context *context, uint8_t bmc_event)
{
context->bmc_events &= ~bmc_event;
MSG_DBG("BMC Events clear to: 0x%.2x\n", context->bmc_events);
return context->transport->flush_events(context);
return context->transport->clear_events(context, bmc_event);
}
int protocol_v1_reset(struct mbox_context *context)
......
......@@ -7,7 +7,8 @@
struct mbox_context;
struct transport_ops {
int (*flush_events)(struct mbox_context *context);
int (*set_events)(struct mbox_context *context, uint8_t events);
int (*clear_events)(struct mbox_context *context, uint8_t events);
};
#endif /* TRANSPORT_H */
......@@ -11,7 +11,16 @@
#include "protocol.h"
#include "transport.h"
int transport_dbus_flush_events(struct mbox_context *context)
static int transport_dbus_set_events(struct mbox_context *context,
uint8_t events)
{
/* FIXME ! */
MSG_ERR("%s is unimplemented!\n", __func__);
return 0;
}
static int transport_dbus_clear_events(struct mbox_context *context,
uint8_t events)
{
/* FIXME ! */
MSG_ERR("%s is unimplemented!\n", __func__);
......@@ -19,7 +28,8 @@ int transport_dbus_flush_events(struct mbox_context *context)
}
static const struct transport_ops transport_dbus_ops = {
.flush_events = transport_dbus_flush_events,
.set_events = transport_dbus_set_events,
.clear_events = transport_dbus_clear_events,
};
static int transport_dbus_get_info(sd_bus_message *m, void *userdata,
......@@ -48,7 +58,7 @@ static int transport_dbus_get_info(sd_bus_message *m, void *userdata,
/* Switch transport to DBus. This is fine as DBus signals are async */
context->transport = &transport_dbus_ops;
context->transport->flush_events(context);
context->transport->set_events(context, context->bmc_events);
rc = sd_bus_message_new_method_return(m, &n);
if (rc < 0) {
......
......@@ -121,8 +121,25 @@ static int transport_mbox_flush_events(struct mbox_context *context)
return 0;
}
static int transport_mbox_set_events(struct mbox_context *context,
uint8_t events)
{
context->bmc_events |= events;
return transport_mbox_flush_events(context);
}
static int transport_mbox_clear_events(struct mbox_context *context,
uint8_t events)
{
context->bmc_events &= ~events;
return transport_mbox_flush_events(context);
}
static const struct transport_ops transport_mbox_ops = {
.flush_events = transport_mbox_flush_events,
.set_events = transport_mbox_set_events,
.clear_events = transport_mbox_clear_events,
};
/* Command Handlers */
......
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