aboutsummaryrefslogtreecommitdiff
path: root/libflash
diff options
context:
space:
mode:
authorAndrew Jeffery <andrew@aj.id.au>2019-02-21 16:58:29 +1030
committerStewart Smith <stewart@linux.ibm.com>2019-02-24 17:43:37 -0600
commitf65c781eee16b5fb2c4bd0a06c365133e2657026 (patch)
tree8013cdd5039930f1ccb59d18c9ebf85cce716035 /libflash
parentecf6430d1ee99368bfdacc808cabfec5e515610b (diff)
downloadskiboot-f65c781eee16b5fb2c4bd0a06c365133e2657026.zip
skiboot-f65c781eee16b5fb2c4bd0a06c365133e2657026.tar.gz
skiboot-f65c781eee16b5fb2c4bd0a06c365133e2657026.tar.bz2
test-ipmi-hiomap: Add get-flash-info test
Cc: stable Signed-off-by: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Diffstat (limited to 'libflash')
-rw-r--r--libflash/test/test-ipmi-hiomap.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index 7e76891..e29242f 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -1356,6 +1356,51 @@ static void test_hiomap_protocol_action_error(void)
}
static const struct scenario_event
+scenario_hiomap_protocol_get_flash_info[] = {
+ { .type = scenario_event_p, .p = &hiomap_ack_call, },
+ { .type = scenario_event_p, .p = &hiomap_get_info_call, },
+ { .type = scenario_event_p, .p = &hiomap_get_flash_info_call, },
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_GET_FLASH_INFO,
+ .seq = 4,
+ .args = {
+ },
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_GET_FLASH_INFO,
+ .seq = 4,
+ .args = {
+ [0] = 0x00, [1] = 0x20,
+ [2] = 0x01, [3] = 0x00,
+ },
+ },
+ },
+ },
+ SCENARIO_SENTINEL,
+};
+
+static void test_hiomap_protocol_get_flash_info(void)
+{
+ struct blocklevel_device *bl;
+ const char *name;
+ uint32_t granule;
+ uint64_t size;
+
+ scenario_enter(scenario_hiomap_protocol_get_flash_info);
+ assert(!ipmi_hiomap_init(&bl));
+ assert(!bl->get_info(bl, &name, &size, &granule));
+ assert(!name);
+ assert(size == (32 * 1024 * 1024));
+ assert(granule == (4 * 1024));
+ ipmi_hiomap_exit(bl);
+ scenario_exit();
+}
+
+static const struct scenario_event
scenario_hiomap_protocol_persistent_error[] = {
{ .type = scenario_event_p, .p = &hiomap_ack_call, },
{ .type = scenario_event_p, .p = &hiomap_get_info_call, },
@@ -1413,6 +1458,7 @@ struct test_case test_cases[] = {
TEST_CASE(test_hiomap_protocol_bad_sequence),
TEST_CASE(test_hiomap_protocol_action_error),
TEST_CASE(test_hiomap_protocol_persistent_error),
+ TEST_CASE(test_hiomap_protocol_get_flash_info),
{ NULL, NULL },
};