From 915fd4bb87508f88960eb2d4e51ae1bdc454b5b0 Mon Sep 17 00:00:00 2001 From: "Jason M. Bills" Date: Mon, 3 Feb 2020 15:36:59 -0800 Subject: Add PECI_CC_TIMEOUT response If the driver times-out on a PECI call and returns ETIMEDOUT, return a new PECI_CC_TIMEOUT response to the caller. Tested: Ran a PECI command with a timeout and confirmed that it returns PECI_CC_TIMEOUT. Change-Id: I93e25948ef05d0e7f137500310a4dfa99ed8980c Signed-off-by: Jason M. Bills --- libpeci/peci.c | 5 +++++ libpeci/peci.h | 1 + 2 files changed, 6 insertions(+) diff --git a/libpeci/peci.c b/libpeci/peci.c index 58079bc..4929547 100644 --- a/libpeci/peci.c +++ b/libpeci/peci.c @@ -13,6 +13,7 @@ // See the License for the specific language governing permissions and // limitations under the License. */ +#include #include #include #include @@ -114,6 +115,10 @@ static EPECIStatus HW_peci_issue_cmd(unsigned int cmd, char* cmdPtr, if (ioctl(peci_fd, cmd, cmdPtr) != 0) { + if (errno == ETIMEDOUT) + { + return PECI_CC_TIMEOUT; + } return PECI_CC_DRIVER_ERR; } diff --git a/libpeci/peci.h b/libpeci/peci.h index 33b664d..53a8bba 100644 --- a/libpeci/peci.h +++ b/libpeci/peci.h @@ -45,6 +45,7 @@ typedef enum PECI_CC_DRIVER_ERR, PECI_CC_CPU_NOT_PRESENT, PECI_CC_MEM_ERR, + PECI_CC_TIMEOUT, } EPECIStatus; // PECI Timeout Options -- cgit v1.2.3