[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALofOnUCv9V4bxHQ=ykn13_=SSyP93pk7bU_FbgX5YAhOC95pQ@mail.gmail.com>
Date: Wed, 30 May 2012 07:21:17 -0700
From: Naresh Bhat <nbhat@...sta.com>
To: openipmi-developer@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: fix IPMI I/O error on NEC FC storage array
Hi,
The code changes will fix the IPMI I/O error on NEC FC storage array.
===========================================================================================
Signed-off-by: Naresh Bhat <nbhat@...sta.com>
--- linux-2.6.32.59/drivers/char/ipmi/ipmi_kcs_sm.c.orig 2012-05-31
06:11:54.753480863 -0700
+++ linux-2.6.32.59/drivers/char/ipmi/ipmi_kcs_sm.c 2012-05-31
06:21:26.780977397 -0700
@@ -344,6 +344,24 @@ static int get_kcs_result(struct si_sm_d
*/
static enum si_sm_result kcs_event(struct si_sm_data *kcs, long time)
{
+#define READ_STATUS_MAX_LOOP 4
+#define SI_SM_WAIT_STATE(_state_) \
+ do { \
+ int i; \
+ for (i = 0; (i < READ_STATUS_MAX_LOOP) \
+ && (state != _state_); i++) { \
+ state = GET_STATUS_STATE(read_status(kcs)); \
+ } \
+ } while (0);
+
+#define SI_SM_WAIT_STATE2(_state_, _state2_) \
+ do { \
+ int i; \
+ for (i = 0; (i < READ_STATUS_MAX_LOOP) && \
+ (state != _state_) && (state != _state2_); i++) { \
+ state = GET_STATUS_STATE(read_status(kcs)); \
+ } \
+ } while (0);
unsigned char status;
unsigned char state;
@@ -370,6 +388,7 @@ static enum si_sm_result kcs_event(struc
return SI_SM_IDLE;
case KCS_START_OP:
+ SI_SM_WAIT_STATE(KCS_IDLE_STATE);
if (state != KCS_IDLE) {
start_error_recovery(kcs,
"State machine not idle at start");
@@ -382,6 +401,7 @@ static enum si_sm_result kcs_event(struc
break;
case KCS_WAIT_WRITE_START:
+ SI_SM_WAIT_STATE(KCS_WRITE_STATE);
if (state != KCS_WRITE_STATE) {
start_error_recovery(
kcs,
@@ -399,6 +419,7 @@ static enum si_sm_result kcs_event(struc
break;
case KCS_WAIT_WRITE:
+ SI_SM_WAIT_STATE(KCS_WRITE_STATE);
if (state != KCS_WRITE_STATE) {
start_error_recovery(kcs,
"Not in write state for write");
@@ -414,6 +435,7 @@ static enum si_sm_result kcs_event(struc
break;
case KCS_WAIT_WRITE_END:
+ SI_SM_WAIT_STATE(KCS_WRITE_STATE);
if (state != KCS_WRITE_STATE) {
start_error_recovery(kcs,
"Not in write state"
@@ -426,6 +448,7 @@ static enum si_sm_result kcs_event(struc
break;
case KCS_WAIT_READ:
+ SI_SM_WAIT_STATE2(KCS_READ_STATE, KCS_IDLE_STATE);
if ((state != KCS_READ_STATE) && (state != KCS_IDLE_STATE)) {
start_error_recovery(
kcs,
@@ -472,6 +495,7 @@ static enum si_sm_result kcs_event(struc
break;
case KCS_ERROR2:
+ SI_SM_WAIT_STATE(KCS_READ_STATE);
if (state != KCS_READ_STATE) {
start_error_recovery(kcs,
"Not in read state for error2");
@@ -486,6 +510,7 @@ static enum si_sm_result kcs_event(struc
break;
case KCS_ERROR3:
+ SI_SM_WAIT_STATE(KCS_IDLE_STATE);
if (state != KCS_IDLE_STATE) {
start_error_recovery(kcs,
"Not in idle state for error3");
===========================================================================================
Thanks
-Naresh Bhat
Download attachment "Fix-IPMI-I-O-error-on-NEC-FC-storage-array.patch" of type "application/octet-stream" (2563 bytes)
Powered by blists - more mailing lists