blob: 58ddb2d4968746a0896f69f259272620a0ad4b03 [file] [log] [blame]
From 73ba34b74551c5f61a1f2c93f48a7f59cb576cd6 Mon Sep 17 00:00:00 2001
From: Jim Yuan <jim.yuan@supermicro.com>
Date: Tue, 11 Oct 2016 10:26:14 -0700
Subject: [PATCH 06/14] send board ID to ipmi
Signed-off-by: Jim Yuan <jim.yuan@supermicro.com>
---
src/include/usr/ipmi/ipmiif.H | 6 ++++-
src/include/usr/ipmi/ipmipowerstate.H | 2 +-
.../initservice/istepdispatcher/istepdispatcher.C | 11 ++++++++
src/usr/ipmiext/ipmipowerstate.C | 29 ++++++++++++++++++++++
4 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/src/include/usr/ipmi/ipmiif.H b/src/include/usr/ipmi/ipmiif.H
index 4b41cb3bc..8039adbf7 100644
--- a/src/include/usr/ipmi/ipmiif.H
+++ b/src/include/usr/ipmi/ipmiif.H
@@ -299,7 +299,11 @@ namespace IPMI
// user defined power limit from the BMC.
inline const command_t get_power_limit(void)
{ return std::make_pair(NETFUN_GRPEXT, 0x03); }
-
+
+ //SMC
+ inline const command_t set_board_id(void)
+ { return std::make_pair(NETFUN_NONE, 0x20); }
+
// Some helper messages
// Used to create an empty message for reception
inline const command_t no_command(void)
diff --git a/src/include/usr/ipmi/ipmipowerstate.H b/src/include/usr/ipmi/ipmipowerstate.H
index b65275075..e943e8b66 100644
--- a/src/include/usr/ipmi/ipmipowerstate.H
+++ b/src/include/usr/ipmi/ipmipowerstate.H
@@ -78,7 +78,7 @@ enum ACPI_DEVICE_POWER_STATE_TO_SET
*/
errlHndl_t setACPIPowerState();
-
+errlHndl_t SmcsetBoardId();
} // namespace
#endif
diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C
index 16f1c8a01..0f9731094 100644
--- a/src/usr/initservice/istepdispatcher/istepdispatcher.C
+++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C
@@ -284,6 +284,17 @@ void IStepDispatcher::init(errlHndl_t &io_rtaskRetErrl)
err_ipmi->collectTrace("INITSVC", 1024);
errlCommit(err_ipmi, INITSVC_COMP_ID );
}
+ //send board ID
+ errlHndl_t err_ipmi1 = IPMI::SmcsetBoardId();
+
+ if(err_ipmi1)
+ {
+ TRACFCOMP(g_trac_initsvc,
+ "init: ERROR: IPMI set Board Id Failed");
+ err_ipmi->collectTrace("INITSVC", 1024);
+ errlCommit(err_ipmi1, INITSVC_COMP_ID );
+ }
+
#endif
diff --git a/src/usr/ipmiext/ipmipowerstate.C b/src/usr/ipmiext/ipmipowerstate.C
index 30c2a70ef..f8e61f82b 100644
--- a/src/usr/ipmiext/ipmipowerstate.C
+++ b/src/usr/ipmiext/ipmipowerstate.C
@@ -50,6 +50,35 @@ namespace IPMI
/******************************************************************************/
// Functions
/******************************************************************************/
+errlHndl_t SmcsetBoardId()
+{
+ errlHndl_t err_ipmi = NULL;
+
+ size_t len = 10;
+
+ //create request data buffer
+ uint8_t* data = new uint8_t[len];
+
+ IPMI::completion_code cc = IPMI::CC_UNKBAD;
+ //P8DTU board ID 0933
+ data[0] = 0x33;
+ data[1] = 0x9;
+ memset(&data[2], 0, 8);
+ err_ipmi = IPMI::sendrecv(IPMI::set_board_id(), cc, len, data);
+
+ //cleanup buffer
+ delete[] data;
+
+ if(cc != IPMI::CC_OK)
+ {
+ IPMI_TRAC("Set board id: BMC returned not ok CC[%x]",cc);
+ // should we log error and then retry?
+ // what happens if the communication is broken
+ // reset will try and set it again.
+ }
+
+ return err_ipmi;
+}
errlHndl_t setACPIPowerState()
{
--
2.16.2.windows.1