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-01 23:56:44 -0500
commit34cffed2ccf3971b73b27245d2d11c135f67bcd8 (patch)
tree478dca2f22594db846bbcd57e82bb8ad8bb215f0
parenta6131d3a215de6f6daa48d0f5141fd8964d8586e (diff)
downloadskiboot-34cffed2ccf3971b73b27245d2d11c135f67bcd8.zip
skiboot-34cffed2ccf3971b73b27245d2d11c135f67bcd8.tar.gz
skiboot-34cffed2ccf3971b73b27245d2d11c135f67bcd8.tar.bz2
libflash/ipmi-hiomap: Improve event handling
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);
}