mboxd: Broadcast the daemon is ready on all transports

The code as it stood only sent the state update at startup on the active
transport, which is somewhat arbitrarily chosen as an implementation
detail of the mbox initialisation function.

If the host firmware is using IPMI, it will not learn of the update
unless it attempts to contact mboxd, which it won't do if it knows the
daemon isn't there, which it may have learned of by receiving a state
update from the daemon's shutdown path. In this circumstance the host
firmware is now stuck.

Relieve the host firmware of this problem by always sending the daemon
state on all supported transports. To avoid some insanity we introduce a
new callback in struct transport_ops that allows use to send the BMC's
entire event state rather than just set or clear updates.

Change-Id: I094ff4089eeebd8be99fbd343b94f7bbef023fb1
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/transport_mbox.c b/transport_mbox.c
index 3c2727a..852c0a4 100644
--- a/transport_mbox.c
+++ b/transport_mbox.c
@@ -121,21 +121,22 @@
 	return 0;
 }
 
-static int transport_mbox_set_events(struct mbox_context *context,
-				     uint8_t events, uint8_t mask)
+static int transport_mbox_put_events(struct mbox_context *context,
+					uint8_t mask)
 {
 	return transport_mbox_flush_events(context, context->bmc_events & mask);
 }
 
-static int transport_mbox_clear_events(struct mbox_context *context,
-				       uint8_t events, uint8_t mask)
+static int transport_mbox_update_events(struct mbox_context *context,
+					uint8_t events, uint8_t mask)
 {
 	return transport_mbox_flush_events(context, context->bmc_events & mask);
 }
 
 static const struct transport_ops transport_mbox_ops = {
-	.set_events = transport_mbox_set_events,
-	.clear_events = transport_mbox_clear_events,
+	.put_events = transport_mbox_put_events,
+	.set_events = transport_mbox_update_events,
+	.clear_events = transport_mbox_update_events,
 };
 
 /* Command Handlers */
@@ -665,9 +666,20 @@
 	return 0;
 }
 
-int transport_mbox_init(struct mbox_context *context)
+int transport_mbox_init(struct mbox_context *context,
+			const struct transport_ops **ops)
 {
-	return __transport_mbox_init(context, MBOX_HOST_PATH);
+	int rc;
+
+	rc = __transport_mbox_init(context, MBOX_HOST_PATH);
+	if (rc)
+		return rc;
+
+	if (ops) {
+		*ops = &transport_mbox_ops;
+	}
+
+	return 0;
 }
 
 void transport_mbox_free(struct mbox_context *context)