aboutsummaryrefslogtreecommitdiff
path: root/libflash/test
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2019-07-12 16:47:54 +0530
committerOliver O'Halloran <oohall@gmail.com>2019-08-15 17:53:56 +1000
commitaa694ea08c0d6350455400e69d266f1dada062c1 (patch)
treea534a1ddf411b6a1c5b00f72f23431965ffacbbb /libflash/test
parentfbd875d77f30ee9a713625c3f4400cde06e70ac8 (diff)
downloadskiboot-aa694ea08c0d6350455400e69d266f1dada062c1.zip
skiboot-aa694ea08c0d6350455400e69d266f1dada062c1.tar.gz
skiboot-aa694ea08c0d6350455400e69d266f1dada062c1.tar.bz2
HIOMAP: Reset bmc mbox in MPIPL path
During boot SBE and early hostboot does not use HIOMAP protocol to get image from PNOR. Instead it expects PNOR TOC and Hostboot Boot Loader to be available at particular address in LPC bus. mbox daemon in BMC side takes care of this during normal boot. Once boot is complete mbox daemon switches to normal mode. During normal reboot, BMC side mbox daemon gets notification and takes care of loading PNOR TOC and HBBL to LPC bus again. In MPIPL path, OPAL calls SBE S0 interrupt to initiate MPIPL. BMC will not be aware of this. But SBE expects PNOR TOC and HBBL to be available in LPC bus at predefined address. Hence call HIOMAP Reset from OPAL in assert path. This needs working LPC and IPMI driver in OPAL. If we have issue in these drivers then we may not be able to reset BMC MBOX properly. Hence MPIPL may fail. We have to live with this until we find a way to intiate BMC on MPIPL. CC: Andrew Jeffery <andrew@aj.id.au> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> [oliver: rebased] Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'libflash/test')
-rw-r--r--libflash/test/mbox-server.c1
-rw-r--r--libflash/test/test-ipmi-hiomap.c169
2 files changed, 170 insertions, 0 deletions
diff --git a/libflash/test/mbox-server.c b/libflash/test/mbox-server.c
index 69499dc..3f879df 100644
--- a/libflash/test/mbox-server.c
+++ b/libflash/test/mbox-server.c
@@ -273,6 +273,7 @@ int bmc_mbox_enqueue(struct bmc_mbox_msg *msg,
switch (msg->command) {
case MBOX_C_RESET_STATE:
prlog(PR_INFO, "RESET_STATE\n");
+ server_state.win_type = WIN_CLOSED;
rc = open_window(msg, false, 0, LPC_BLOCKS);
memset(msg->args, 0, sizeof(msg->args));
break;
diff --git a/libflash/test/test-ipmi-hiomap.c b/libflash/test/test-ipmi-hiomap.c
index 30dbe24..d3343fe 100644
--- a/libflash/test/test-ipmi-hiomap.c
+++ b/libflash/test/test-ipmi-hiomap.c
@@ -479,10 +479,101 @@ static const struct scenario_event hiomap_erase_qs0l1_call = {
},
};
+static const struct scenario_event hiomap_reset_call_seq_4 = {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 4,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 4,
+ },
+ },
+};
+
+static const struct scenario_event hiomap_reset_call_seq_5 = {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 5,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 5,
+ },
+ },
+};
+
+static const struct scenario_event hiomap_reset_call_seq_6 = {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 6,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 6,
+ },
+ },
+};
+
+static const struct scenario_event hiomap_reset_call_seq_7 = {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 7,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 7,
+ },
+ },
+};
+
+static const struct scenario_event hiomap_reset_call_seq_9 = {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 9,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 9,
+ },
+ },
+};
+
+static const struct scenario_event hiomap_reset_call_seq_a = {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 0xa,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 0xa,
+ },
+ },
+};
+
static const struct scenario_event scenario_hiomap_init[] = {
{ .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_event_p, .p = &hiomap_reset_call_seq_4, },
SCENARIO_SENTINEL,
};
@@ -501,6 +592,7 @@ static const struct scenario_event scenario_hiomap_event_daemon_ready[] = {
{ .type = scenario_event_p, .p = &hiomap_get_info_call, },
{ .type = scenario_event_p, .p = &hiomap_get_flash_info_call, },
{ .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_DAEMON_READY } },
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_4, },
SCENARIO_SENTINEL,
};
@@ -523,6 +615,7 @@ static const struct scenario_event scenario_hiomap_event_daemon_stopped[] = {
{ .type = scenario_event_p, .p = &hiomap_get_flash_info_call, },
{ .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_DAEMON_READY } },
{ .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_PROTOCOL_RESET } },
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_4, },
SCENARIO_SENTINEL,
};
@@ -546,6 +639,7 @@ static const struct scenario_event scenario_hiomap_event_daemon_restarted[] = {
{ .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_DAEMON_READY } },
{ .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_PROTOCOL_RESET } },
{ .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_DAEMON_READY } },
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_4, },
SCENARIO_SENTINEL,
};
@@ -575,6 +669,7 @@ scenario_hiomap_event_daemon_lost_flash_control[] = {
| HIOMAP_E_FLASH_LOST),
}
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -680,6 +775,7 @@ scenario_hiomap_event_daemon_regained_flash_control_dirty[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, },
SCENARIO_SENTINEL,
};
@@ -822,6 +918,7 @@ static const struct scenario_event scenario_hiomap_protocol_reset_recovery[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_9, },
SCENARIO_SENTINEL,
};
@@ -854,6 +951,7 @@ scenario_hiomap_protocol_read_one_block[] = {
.type = scenario_event_p,
.p = &hiomap_create_read_window_qs0l1_rs0l1_call,
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -927,6 +1025,7 @@ scenario_hiomap_protocol_read_two_blocks[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, },
SCENARIO_SENTINEL,
};
@@ -979,6 +1078,7 @@ scenario_hiomap_protocol_read_one_block_twice[] = {
.type = scenario_event_p,
.p = &hiomap_create_read_window_qs0l1_rs0l1_call,
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -1014,6 +1114,7 @@ scenario_hiomap_protocol_event_before_action[] = {
HIOMAP_E_FLASH_LOST,
}
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -1047,6 +1148,7 @@ scenario_hiomap_protocol_event_during_read[] = {
HIOMAP_E_FLASH_LOST,
}
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -1082,6 +1184,7 @@ scenario_hiomap_protocol_write_one_block[] = {
},
{ .type = scenario_event_p, .p = &hiomap_mark_dirty_qs0l1_call, },
{ .type = scenario_event_p, .p = &hiomap_flush_call, },
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, },
SCENARIO_SENTINEL,
};
@@ -1166,6 +1269,7 @@ scenario_hiomap_protocol_write_two_blocks[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_a, },
SCENARIO_SENTINEL,
};
@@ -1248,6 +1352,7 @@ scenario_hiomap_protocol_write_one_block_twice[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_9, },
SCENARIO_SENTINEL,
};
@@ -1301,6 +1406,7 @@ scenario_hiomap_protocol_event_during_write[] = {
HIOMAP_E_FLASH_LOST,
}
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, },
SCENARIO_SENTINEL,
};
@@ -1342,6 +1448,7 @@ scenario_hiomap_protocol_erase_one_block[] = {
.type = scenario_event_p,
.p = &hiomap_flush_call,
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, },
SCENARIO_SENTINEL,
};
@@ -1390,6 +1497,7 @@ scenario_hiomap_protocol_erase_two_blocks[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_a, },
SCENARIO_SENTINEL,
};
@@ -1449,6 +1557,7 @@ scenario_hiomap_protocol_erase_one_block_twice[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_9, },
SCENARIO_SENTINEL,
};
@@ -1516,6 +1625,7 @@ scenario_hiomap_protocol_event_during_erase[] = {
HIOMAP_E_FLASH_LOST,
}
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, },
SCENARIO_SENTINEL,
};
@@ -1620,6 +1730,7 @@ scenario_hiomap_protocol_get_flash_info[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -1646,6 +1757,7 @@ scenario_hiomap_protocol_persistent_error[] = {
{ .type = scenario_event_p, .p = &hiomap_get_info_call, },
{ .type = scenario_event_p, .p = &hiomap_get_flash_info_call, },
{ .type = scenario_sel, .s = { .bmc_state = HIOMAP_E_PROTOCOL_RESET } },
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, },
SCENARIO_SENTINEL,
};
@@ -1744,6 +1856,7 @@ scenario_hiomap_create_read_window_error[] = {
.cc = IPMI_INVALID_COMMAND_ERR,
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -1785,6 +1898,7 @@ scenario_hiomap_create_write_window_error[] = {
.cc = IPMI_INVALID_COMMAND_ERR,
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -1829,6 +1943,7 @@ static const struct scenario_event scenario_hiomap_mark_dirty_error[] = {
.cc = IPMI_INVALID_COMMAND_ERR,
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, },
SCENARIO_SENTINEL,
};
@@ -1870,6 +1985,7 @@ static const struct scenario_event scenario_hiomap_flush_error[] = {
.cc = IPMI_INVALID_COMMAND_ERR,
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, },
SCENARIO_SENTINEL,
};
@@ -1920,6 +2036,7 @@ static const struct scenario_event scenario_hiomap_erase_error[] = {
.cc = IPMI_INVALID_COMMAND_ERR,
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, },
SCENARIO_SENTINEL,
};
@@ -2140,6 +2257,7 @@ scenario_hiomap_create_read_window_malformed_small[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -2187,6 +2305,7 @@ scenario_hiomap_create_read_window_malformed_large[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -2233,6 +2352,7 @@ scenario_hiomap_create_write_window_malformed_small[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -2280,6 +2400,7 @@ scenario_hiomap_create_write_window_malformed_large[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_5, },
SCENARIO_SENTINEL,
};
@@ -2329,6 +2450,7 @@ scenario_hiomap_mark_dirty_malformed_small[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, },
SCENARIO_SENTINEL,
};
@@ -2379,6 +2501,7 @@ scenario_hiomap_mark_dirty_malformed_large[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, },
SCENARIO_SENTINEL,
};
@@ -2425,6 +2548,7 @@ scenario_hiomap_flush_malformed_small[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, },
SCENARIO_SENTINEL,
};
@@ -2472,6 +2596,7 @@ scenario_hiomap_flush_malformed_large[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_7, },
SCENARIO_SENTINEL,
};
@@ -2521,6 +2646,7 @@ scenario_hiomap_erase_malformed_small[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, },
SCENARIO_SENTINEL,
};
@@ -2566,6 +2692,7 @@ scenario_hiomap_erase_malformed_large[] = {
},
},
},
+ { .type = scenario_event_p, .p = &hiomap_reset_call_seq_6, },
SCENARIO_SENTINEL,
};
@@ -2771,6 +2898,20 @@ scenario_hiomap_protocol_recovery_failure_ack[] = {
},
},
},
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 14,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 14,
+ },
+ },
+ },
SCENARIO_SENTINEL,
};
@@ -2941,6 +3082,20 @@ scenario_hiomap_protocol_recovery_failure_get_info[] = {
},
},
},
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 15,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 15,
+ },
+ },
+ },
SCENARIO_SENTINEL,
};
@@ -3110,6 +3265,20 @@ scenario_hiomap_protocol_recovery_failure_get_flash_info[] = {
},
},
},
+ {
+ .type = scenario_cmd,
+ .c = {
+ .req = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 16,
+ },
+ .cc = IPMI_CC_NO_ERROR,
+ .resp = {
+ .cmd = HIOMAP_C_RESET,
+ .seq = 16,
+ },
+ },
+ },
SCENARIO_SENTINEL,
};