diff options
-rw-r--r-- | src/include/usr/ipmi/ipmiif.H | 4 | ||||
-rw-r--r-- | src/include/usr/ipmi/ipmisel.H | 9 | ||||
-rw-r--r-- | src/usr/ipmi/ipmisel.C | 23 |
3 files changed, 34 insertions, 2 deletions
diff --git a/src/include/usr/ipmi/ipmiif.H b/src/include/usr/ipmi/ipmiif.H index d94e5d4a2..55546d13e 100644 --- a/src/include/usr/ipmi/ipmiif.H +++ b/src/include/usr/ipmi/ipmiif.H @@ -6,6 +6,7 @@ /* OpenPOWER HostBoot Project */ /* */ /* Contributors Listed Below - COPYRIGHT 2012,2017 */ +/* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -245,6 +246,9 @@ namespace IPMI // Storage messages + inline const command_t get_sel_time(void) + { return std::make_pair(NETFUN_STORAGE, 0x48); } + inline const command_t set_sel_time(void) { return std::make_pair(NETFUN_STORAGE, 0x49); } diff --git a/src/include/usr/ipmi/ipmisel.H b/src/include/usr/ipmi/ipmisel.H index 4509130f4..caf62f6e4 100644 --- a/src/include/usr/ipmi/ipmisel.H +++ b/src/include/usr/ipmi/ipmisel.H @@ -5,7 +5,8 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2016 */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -312,6 +313,12 @@ namespace IPMISEL void send_esel(IPMISEL::eselInitData * i_data, errlHndl_t &o_err, IPMI::completion_code &o_cc); + /** + * @brief read the SEL time + * @return time from unix epoch or 0 on error + */ + uint32_t get_sel_time(); + } // namespace IPMISEL #ifndef __HOSTBOOT_RUNTIME diff --git a/src/usr/ipmi/ipmisel.C b/src/usr/ipmi/ipmisel.C index 5d2d6afce..de7feec18 100644 --- a/src/usr/ipmi/ipmisel.C +++ b/src/usr/ipmi/ipmisel.C @@ -5,7 +5,8 @@ /* */ /* OpenPOWER HostBoot Project */ /* */ -/* Contributors Listed Below - COPYRIGHT 2014,2016 */ +/* Contributors Listed Below - COPYRIGHT 2014,2017 */ +/* [+] Google Inc. */ /* [+] International Business Machines Corp. */ /* */ /* */ @@ -468,6 +469,26 @@ void send_esel(eselInitData * i_data, return; } // send_esel +uint32_t get_sel_time() +{ + uint8_t *data = NULL; + size_t len = 0; + errlHndl_t l_err; + IPMI::completion_code l_cc = IPMI::CC_UNKBAD; + + l_err = IPMI::sendrecv( IPMI::get_sel_time(), l_cc, len, data ); + if( l_err || l_cc != IPMI::CC_OK || len != sizeof(uint32_t) ) + { + delete l_err; + delete [] data; + return 0; + } + + uint32_t timet = le32toh(*reinterpret_cast<uint32_t*>(data)); + delete [] data; + return timet; +} + } // IPMISEL #ifndef __HOSTBOOT_RUNTIME |