aboutsummaryrefslogtreecommitdiff
path: root/libflash/ipmi-hiomap.h
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2018-11-09 11:03:14 +1030
committerStewart Smith <stewart@linux.ibm.com>2018-11-08 20:50:36 -0600
commit1151a987ae4579a8c51bba7ebc61c79c176830bd (patch)
tree0d4b6eeafb25489794779a177580eb789c480449 /libflash/ipmi-hiomap.h
parent97f839beffb512faebc456dff67a4d83353348ed (diff)
downloadskiboot-1151a987ae4579a8c51bba7ebc61c79c176830bd.zip
skiboot-1151a987ae4579a8c51bba7ebc61c79c176830bd.tar.gz
skiboot-1151a987ae4579a8c51bba7ebc61c79c176830bd.tar.bz2
libflash/ipmi-hiomap: Add support for unit tests
Lay the ground work for unit testing the ipmi-hiomap implementation. The design hooks a subset of the IPMI interface to move through a data-driven "scenario" of IPMI message exchanges. Two basic tests are added exercising the initialsation path of the protocol implementation. Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'libflash/ipmi-hiomap.h')
-rw-r--r--libflash/ipmi-hiomap.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/libflash/ipmi-hiomap.h b/libflash/ipmi-hiomap.h
index 4742b7d..f60f725 100644
--- a/libflash/ipmi-hiomap.h
+++ b/libflash/ipmi-hiomap.h
@@ -17,11 +17,42 @@
#ifndef __LIBFLASH_IPMI_HIOMAP_H
#define __LIBFLASH_IPMI_HIOMAP_H
+#include <lock.h>
#include <stdbool.h>
#include <stdint.h>
#include "blocklevel.h"
+enum lpc_window_state { closed_window, read_window, write_window };
+
+struct lpc_window {
+ uint32_t lpc_addr; /* Offset into LPC space */
+ uint32_t cur_pos; /* Current position of the window in the flash */
+ uint32_t size; /* Size of the window into the flash */
+};
+
+struct ipmi_hiomap {
+ /* Members protected by the blocklevel lock */
+ uint8_t seq;
+ uint8_t version;
+ uint8_t block_size_shift;
+ uint16_t timeout;
+ struct blocklevel_device bl;
+ uint32_t total_size;
+ uint32_t erase_granule;
+ struct lpc_window current;
+
+ /*
+ * update, bmc_state and window_state can be accessed by both calls
+ * through read/write/erase functions and the IPMI SEL handler. All
+ * three variables are protected by lock to avoid conflict.
+ */
+ struct lock lock;
+ bool update;
+ uint8_t bmc_state;
+ enum lpc_window_state window_state;
+};
+
int ipmi_hiomap_init(struct blocklevel_device **bl);
void ipmi_hiomap_exit(struct blocklevel_device *bl);