Jim Yuan | f5da1de | 2019-03-25 09:49:24 -0700 | [diff] [blame] | 1 | From 73ba34b74551c5f61a1f2c93f48a7f59cb576cd6 Mon Sep 17 00:00:00 2001 |
| 2 | From: Jim Yuan <jim.yuan@supermicro.com> |
| 3 | Date: Tue, 11 Oct 2016 10:26:14 -0700 |
| 4 | Subject: [PATCH 06/14] send board ID to ipmi |
| 5 | |
| 6 | Signed-off-by: Jim Yuan <jim.yuan@supermicro.com> |
| 7 | --- |
| 8 | src/include/usr/ipmi/ipmiif.H | 6 ++++- |
| 9 | src/include/usr/ipmi/ipmipowerstate.H | 2 +- |
| 10 | .../initservice/istepdispatcher/istepdispatcher.C | 11 ++++++++ |
| 11 | src/usr/ipmiext/ipmipowerstate.C | 29 ++++++++++++++++++++++ |
| 12 | 4 files changed, 46 insertions(+), 2 deletions(-) |
| 13 | |
| 14 | diff --git a/src/include/usr/ipmi/ipmiif.H b/src/include/usr/ipmi/ipmiif.H |
| 15 | index 4b41cb3bc..8039adbf7 100644 |
| 16 | --- a/src/include/usr/ipmi/ipmiif.H |
| 17 | +++ b/src/include/usr/ipmi/ipmiif.H |
| 18 | @@ -299,7 +299,11 @@ namespace IPMI |
| 19 | // user defined power limit from the BMC. |
| 20 | inline const command_t get_power_limit(void) |
| 21 | { return std::make_pair(NETFUN_GRPEXT, 0x03); } |
| 22 | - |
| 23 | + |
| 24 | + //SMC |
| 25 | + inline const command_t set_board_id(void) |
| 26 | + { return std::make_pair(NETFUN_NONE, 0x20); } |
| 27 | + |
| 28 | // Some helper messages |
| 29 | // Used to create an empty message for reception |
| 30 | inline const command_t no_command(void) |
| 31 | diff --git a/src/include/usr/ipmi/ipmipowerstate.H b/src/include/usr/ipmi/ipmipowerstate.H |
| 32 | index b65275075..e943e8b66 100644 |
| 33 | --- a/src/include/usr/ipmi/ipmipowerstate.H |
| 34 | +++ b/src/include/usr/ipmi/ipmipowerstate.H |
| 35 | @@ -78,7 +78,7 @@ enum ACPI_DEVICE_POWER_STATE_TO_SET |
| 36 | */ |
| 37 | errlHndl_t setACPIPowerState(); |
| 38 | |
| 39 | - |
| 40 | +errlHndl_t SmcsetBoardId(); |
| 41 | } // namespace |
| 42 | |
| 43 | #endif |
| 44 | diff --git a/src/usr/initservice/istepdispatcher/istepdispatcher.C b/src/usr/initservice/istepdispatcher/istepdispatcher.C |
| 45 | index 16f1c8a01..0f9731094 100644 |
| 46 | --- a/src/usr/initservice/istepdispatcher/istepdispatcher.C |
| 47 | +++ b/src/usr/initservice/istepdispatcher/istepdispatcher.C |
| 48 | @@ -284,6 +284,17 @@ void IStepDispatcher::init(errlHndl_t &io_rtaskRetErrl) |
| 49 | err_ipmi->collectTrace("INITSVC", 1024); |
| 50 | errlCommit(err_ipmi, INITSVC_COMP_ID ); |
| 51 | } |
| 52 | + //send board ID |
| 53 | + errlHndl_t err_ipmi1 = IPMI::SmcsetBoardId(); |
| 54 | + |
| 55 | + if(err_ipmi1) |
| 56 | + { |
| 57 | + TRACFCOMP(g_trac_initsvc, |
| 58 | + "init: ERROR: IPMI set Board Id Failed"); |
| 59 | + err_ipmi->collectTrace("INITSVC", 1024); |
| 60 | + errlCommit(err_ipmi1, INITSVC_COMP_ID ); |
| 61 | + } |
| 62 | + |
| 63 | #endif |
| 64 | |
| 65 | |
| 66 | diff --git a/src/usr/ipmiext/ipmipowerstate.C b/src/usr/ipmiext/ipmipowerstate.C |
| 67 | index 30c2a70ef..f8e61f82b 100644 |
| 68 | --- a/src/usr/ipmiext/ipmipowerstate.C |
| 69 | +++ b/src/usr/ipmiext/ipmipowerstate.C |
| 70 | @@ -50,6 +50,35 @@ namespace IPMI |
| 71 | /******************************************************************************/ |
| 72 | // Functions |
| 73 | /******************************************************************************/ |
| 74 | +errlHndl_t SmcsetBoardId() |
| 75 | +{ |
| 76 | + errlHndl_t err_ipmi = NULL; |
| 77 | + |
| 78 | + size_t len = 10; |
| 79 | + |
| 80 | + //create request data buffer |
| 81 | + uint8_t* data = new uint8_t[len]; |
| 82 | + |
| 83 | + IPMI::completion_code cc = IPMI::CC_UNKBAD; |
| 84 | + //P8DTU board ID 0933 |
| 85 | + data[0] = 0x33; |
| 86 | + data[1] = 0x9; |
| 87 | + memset(&data[2], 0, 8); |
| 88 | + err_ipmi = IPMI::sendrecv(IPMI::set_board_id(), cc, len, data); |
| 89 | + |
| 90 | + //cleanup buffer |
| 91 | + delete[] data; |
| 92 | + |
| 93 | + if(cc != IPMI::CC_OK) |
| 94 | + { |
| 95 | + IPMI_TRAC("Set board id: BMC returned not ok CC[%x]",cc); |
| 96 | + // should we log error and then retry? |
| 97 | + // what happens if the communication is broken |
| 98 | + // reset will try and set it again. |
| 99 | + } |
| 100 | + |
| 101 | + return err_ipmi; |
| 102 | +} |
| 103 | |
| 104 | errlHndl_t setACPIPowerState() |
| 105 | { |
| 106 | -- |
| 107 | 2.16.2.windows.1 |
| 108 | |