daemon: Remove the concept of triggering or suppressing events

Rather, trigger them (or not) as necessary in the relevant code-paths.
This ensures that any call to one of protocol_events_{set,clear}()
actually has a consequence that we can set about dealing with in the
transport layer.

Change-Id: If64733fa53ed9def0da8330c99cbe48327bab934
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/protocol.c b/protocol.c
index c6934e6..58dad98 100644
--- a/protocol.c
+++ b/protocol.c
@@ -17,12 +17,10 @@
  * protocol_events_set() - Set BMC events
  * @context:	The mbox context pointer
  * @bmc_event:	The bits to set
- * @write_back:	Whether to write back to the register -> will interrupt host
  *
  * Return:	0 on success otherwise negative error code
  */
-int protocol_events_set(struct mbox_context *context, uint8_t bmc_event,
-		   bool write_back)
+int protocol_events_set(struct mbox_context *context, uint8_t bmc_event)
 {
 	uint8_t mask = 0x00;
 
@@ -38,30 +36,28 @@
 	context->bmc_events |= (bmc_event & mask);
 	MSG_DBG("BMC Events set to: 0x%.2x\n", context->bmc_events);
 
-	return write_back ? context->transport->flush_events(context) : 0;
+	return context->transport->flush_events(context);
 }
 
 /*
  * protocol_events_clear() - Clear BMC events
  * @context:	The mbox context pointer
  * @bmc_event:	The bits to clear
- * @write_back:	Whether to write back to the register -> will interrupt host
  *
  * Return:	0 on success otherwise negative error code
  */
-int protocol_events_clear(struct mbox_context *context, uint8_t bmc_event,
-		   bool write_back)
+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 write_back ? context->transport->flush_events(context) : 0;
+	return context->transport->flush_events(context);
 }
 
 int protocol_v1_reset(struct mbox_context *context)
 {
 	/* Host requested it -> No BMC Event */
-	windows_reset_all(context, EVENT_SUPPRESS);
+	windows_reset_all(context);
 	return lpc_reset(context);
 }
 
@@ -78,7 +74,8 @@
 
 	/* Do the {up,down}grade if necessary*/
 	if (rc != old_version) {
-		windows_reset_all(context, EVENT_TRIGGER);
+		/* Doing version negotiation, don't alert host to reset */
+		windows_reset_all(context);
 		return context->protocol->get_info(context, io);
 	}
 
@@ -151,7 +148,7 @@
 				return rc;
 			}
 		}
-		windows_close_current(context, EVENT_SUPPRESS, FLAGS_NONE);
+		windows_close_current(context, FLAGS_NONE);
 	}
 
 	/* Offset the host has requested */
@@ -331,15 +328,15 @@
 	}
 
 	/* Host asked for it -> Don't set the BMC Event */
-	windows_close_current(context, EVENT_SUPPRESS, io->req.flags);
+	windows_close_current(context, io->req.flags);
 
 	return 0;
 }
 
 int protocol_v1_ack(struct mbox_context *context, struct protocol_ack *io)
 {
-	return protocol_events_clear(context, (io->req.flags & BMC_EVENT_ACK_MASK),
-			      EVENT_TRIGGER);
+	return protocol_events_clear(context,
+				     (io->req.flags & BMC_EVENT_ACK_MASK));
 }
 
 /*
@@ -374,7 +371,8 @@
 
 	/* Do the {up,down}grade if necessary*/
 	if (rc != old_version) {
-		windows_reset_all(context, EVENT_TRIGGER);
+		/* Doing version negotiation, don't alert host to reset */
+		windows_reset_all(context);
 		return context->protocol->get_info(context, io);
 	}
 
@@ -496,7 +494,7 @@
 	}
 
 	/* Host asked for it -> Don't set the BMC Event */
-	windows_close_current(context, EVENT_SUPPRESS, io->req.flags);
+	windows_close_current(context, io->req.flags);
 
 	return 0;
 }