mboxd: Bump version and use mboxctl to reset the daemon

The updated mboxd and associated mboxctl fix the need to sleep when
resetting the mbox daemon state, and implement v2 of the mbox protocol.

mboxd now defaults to using 1MiB windows filling the reserved space if
no relevant options are specified on the commandline. The systemd unit
file explicitly specifies 1MiB for clarity, but leaves the number of
windows unspecified to allow flexibility in the size of the reserved
memory. Currently the devicetree reserves 64MiB, but this is likely to
be reduced to 16MiB in the near future. A 1MiB window size currently
covers all but three partitions on the PNOR, and experiments with a 2MiB
window size didn't show any drastic improvements over 1MiB in boot times.

The changes have been tested on a Witherspoon system using the
reboot-loop scripts developed when debugging the UCD90160/I2C issue.
mboxd survived all 30-40 reboots; some issues were encountered, though
they all appeared to be unrelated failures in Hostboot's DDR procedures.

Fixes openbmc/openbmc#1045.

Change-Id: Ia0343a3c3195d526a6d97bb1d056b62bc6088711
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/common/recipes-phosphor/mboxd/mboxd.bb b/common/recipes-phosphor/mboxd/mboxd.bb
index 9a7f716..e43a5b4 100644
--- a/common/recipes-phosphor/mboxd/mboxd.bb
+++ b/common/recipes-phosphor/mboxd/mboxd.bb
@@ -8,6 +8,7 @@
 inherit obmc-phosphor-systemd
 
 DEPENDS += "autoconf-archive-native"
+RDEPENDS_${PN} += "libsystemd"
 
 S = "${WORKDIR}/git"
 
@@ -17,7 +18,9 @@
 SRC_URI += "file://99-aspeed-lpc-ctrl.rules"
 SRC_URI += "file://aspeed-lpc-ctrl-h.patch"
 
-SRCREV="1974c6f9e61fb194580b1874b3e88f612e5c4ba6"
+SRCREV="ded91bc53dafdb86ac4f203cc9d3006573fc407f"
+
+PROVIDES += "mboxctl"
 
 MBOXD_FLASH_SIZE ??= "32M"
 SYSTEMD_SUBSTITUTIONS += "FLASH_SIZE:${MBOXD_FLASH_SIZE}:${PN}.service"
diff --git a/common/recipes-phosphor/mboxd/mboxd/mboxd-reload@.service b/common/recipes-phosphor/mboxd/mboxd/mboxd-reload@.service
index 8a07d11..9a8d844 100644
--- a/common/recipes-phosphor/mboxd/mboxd/mboxd-reload@.service
+++ b/common/recipes-phosphor/mboxd/mboxd/mboxd-reload@.service
@@ -7,9 +7,7 @@
 [Service]
 Type=oneshot
 RemainAfterExit=yes
-ExecStart=/usr/bin/killall -HUP mboxd
-# TODO: openbmc/openbmc#1045 - mboxd reload workaround
-ExecStart=/bin/sleep 45
+ExecStart={sbindir}/mboxctl --reset
 
 [Install]
 WantedBy=obmc-power-chassis-off@%i.target
diff --git a/common/recipes-phosphor/mboxd/mboxd/mboxd.service b/common/recipes-phosphor/mboxd/mboxd/mboxd.service
index dda2532..eab1da8 100644
--- a/common/recipes-phosphor/mboxd/mboxd/mboxd.service
+++ b/common/recipes-phosphor/mboxd/mboxd/mboxd.service
@@ -8,7 +8,7 @@
 
 [Service]
 Restart=always
-ExecStart={sbindir}/mboxd --flash {FLASH_SIZE} --verbose
+ExecStart={sbindir}/mboxd --flash {FLASH_SIZE} --verbose --window-size 1M
 
 [Install]
 WantedBy={SYSTEMD_DEFAULT_TARGET}