hw/lpc-mbox: Simplify message bookkeeping and timeouts
hw/lpc-mbox: Simplify message bookkeeping and timeouts

Currently the hw/lpc-mbox layer keeps a pointer for the currently
inflight message for the duration of the mbox call. This creates
problems when messages timeout, is that pointer still valid, what can we
do with it. The memory is owned by the caller but if the caller has
declared a timeout, it may have freed that memory.

Another problem is locking. This patch also locks around sending and
receiving to avoid races with timeouts and possible resends. There was
some locking previously which was likely insufficient - definitely too
hard to be sure is correct

All this is made much easier with the previous rework which moves
sequence number allocation and verification into lpc-mbox rather than
the caller.

Signed-off-by: Cyril Bur <6ce38dade8c4b52fd55c193fae70fd1d1275c3c3@au1.ibm.com>
Signed-off-by: Stewart Smith <ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.vnet.ibm.com>

open-power/skiboot,legoater/skiboot,qemu/skiboot,stewart-ibm/skiboot,stewart-ibm/skiboot,open-power/skiboot,open-power/skiboot,open-power/skiboot,legoater/skiboot,shenki/skiboot,legoater/skiboot,qemu/skiboot,legoater/skiboot,open-power/skiboot,shenki/skiboot,shenki/skiboot,legoater/skiboot,stewart-ibm/skiboot,qemu/skiboot,qemu/skiboot,qemu/skiboot,shenki/skiboot,shenki/skiboot