aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-11-01 23:17:24 +1030
committerStewart Smith <stewart@linux.ibm.com>2018-11-02 18:16:52 +1100
commitf145626d62274470c620e3bd8a9ac27d2c6a4762 (patch)
treee6ce80ba0f02b2fc4995c37c6ae8acb4b98f9f84
parentee6a266a2b23ecd11a6b1b5fd3a3a67797012217 (diff)
downloadskiboot-f145626d62274470c620e3bd8a9ac27d2c6a4762.zip
skiboot-f145626d62274470c620e3bd8a9ac27d2c6a4762.tar.gz
skiboot-f145626d62274470c620e3bd8a9ac27d2c6a4762.tar.bz2
libflash/ipmi-hiomap: Improve event handling
[ Upstream commit 34cffed2ccf3971b73b27245d2d11c135f67bcd8 ] The host firmware side of the hiomap protocol has two input sources: 1. Requests to adjust the flash mappings from itself or the kernel 2. State change events received from the BMC The handling of BMC state change events (2.) is asynchronous in two ways: a. The BMC pushes the state change event to the host, which is recorded but not acted on b. When handling requests to adjust the flash mapping, skiboot first addresses any new BMC state changes before servicing the mapping request Further, the hiomap protocol sends a mix of ackable and stateful events, where ackable events are only relevant until skiboot's hiomap event handler (b. above) cleans them up, whereas stateful events persist until the BMC provides a subsequent state change event. As we handle the ackable events asynchronous to receiving notification (b. vs a. above), OR in the received event state rather than directly assign to ensure we don't lose events that we must not miss. As an example, without the OR we may lose ackable events if the daemon restarts and pushes a new state change event during initialisation, which will necessarily bear no relation to the previous state change event value. Similarly, don't close active windows in a. based on the event content, as we need the window type information to handle state restoration in b. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
-rw-r--r--libflash/ipmi-hiomap.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libflash/ipmi-hiomap.c b/libflash/ipmi-hiomap.c
index 8a7a1af..856d827 100644
--- a/libflash/ipmi-hiomap.c
+++ b/libflash/ipmi-hiomap.c
@@ -469,12 +469,11 @@ static void hiomap_event(uint8_t events, void *context)
{
struct ipmi_hiomap *ctx = context;
+ prlog(PR_DEBUG, "Received events: 0x%x\n", events);
+
lock(&ctx->lock);
- ctx->bmc_state = events;
+ ctx->bmc_state |= events;
ctx->update = true;
-
- if (events & (HIOMAP_E_PROTOCOL_RESET | HIOMAP_E_WINDOW_RESET))
- ctx->window_state = closed_window;
unlock(&ctx->lock);
}