aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/ipmi
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2014-11-19 12:47:17 -0500
committerCorey Minyard <cminyard@mvista.com>2014-12-11 16:04:13 -0500
commita8df150c5de4b2a542660e7b3727fddfce2e015b (patch)
tree3e4b1944148813ebe0916aadeb5fb600bcd775d0 /drivers/char/ipmi
parentd9b7e4f717a167610a49ceb9e5969e80146c89a8 (diff)
ipmi: Fix attention handling for system interfaces
If an attention came in while handling a message response, it could cause the state machine to go into the wrong mode and lock things up if the state machine wasn't in normal mode. So if the state machine is not in normal mode, save the attention flag for later. Signed-off-by: Corey Minyard <cminyard@mvista.com> Tested-by: Tony Rex <tony.rex@ericsson.com> Tested-by: Magnus Johansson E <magnus.e.johansson@ericsson.com> Cc: Per Fogelström <per.fogelstrom@ericsson.com>
Diffstat (limited to 'drivers/char/ipmi')
-rw-r--r--drivers/char/ipmi/ipmi_si_intf.c45
1 files changed, 30 insertions, 15 deletions
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index 2952d2dcc855..4a894afc5a2e 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -262,6 +262,11 @@ struct smi_info {
262 */ 262 */
263 bool supports_event_msg_buff; 263 bool supports_event_msg_buff;
264 264
265 /*
266 * Did we get an attention that we did not handle?
267 */
268 bool got_attn;
269
265 /* From the get device id response... */ 270 /* From the get device id response... */
266 struct ipmi_device_id device_id; 271 struct ipmi_device_id device_id;
267 272
@@ -813,25 +818,35 @@ static enum si_sm_result smi_event_handler(struct smi_info *smi_info,
813 * We prefer handling attn over new messages. But don't do 818 * We prefer handling attn over new messages. But don't do
814 * this if there is not yet an upper layer to handle anything. 819 * this if there is not yet an upper layer to handle anything.
815 */ 820 */
816 if (likely(smi_info->intf) && si_sm_result == SI_SM_ATTN) { 821 if (likely(smi_info->intf) &&
822 (si_sm_result == SI_SM_ATTN || smi_info->got_attn)) {
817 unsigned char msg[2]; 823 unsigned char msg[2];
818 824
819 smi_inc_stat(smi_info, attentions); 825 if (smi_info->si_state != SI_NORMAL) {
826 /*
827 * We got an ATTN, but we are doing something else.
828 * Handle the ATTN later.
829 */
830 smi_info->got_attn = true;
831 } else {
832 smi_info->got_attn = false;
833 smi_inc_stat(smi_info, attentions);
820 834
821 /* 835 /*
822 * Got a attn, send down a get message flags to see 836 * Got a attn, send down a get message flags to see
823 * what's causing it. It would be better to handle 837 * what's causing it. It would be better to handle
824 * this in the upper layer, but due to the way 838 * this in the upper layer, but due to the way
825 * interrupts work with the SMI, that's not really 839 * interrupts work with the SMI, that's not really
826 * possible. 840 * possible.
827 */ 841 */
828 msg[0] = (IPMI_NETFN_APP_REQUEST << 2); 842 msg[0] = (IPMI_NETFN_APP_REQUEST << 2);
829 msg[1] = IPMI_GET_MSG_FLAGS_CMD; 843 msg[1] = IPMI_GET_MSG_FLAGS_CMD;
830 844
831 smi_info->handlers->start_transaction( 845 smi_info->handlers->start_transaction(
832 smi_info->si_sm, msg, 2); 846 smi_info->si_sm, msg, 2);
833 smi_info->si_state = SI_GETTING_FLAGS; 847 smi_info->si_state = SI_GETTING_FLAGS;
834 goto restart; 848 goto restart;
849 }
835 } 850 }
836 851
837 /* If we are currently idle, try to start the next message. */ 852 /* If we are currently idle, try to start the next message. */