From 1e6bb450cf94fc3ade70f82703e6c57a30bbebaa Mon Sep 17 00:00:00 2001 From: Jim Yuan Date: Wed, 10 Aug 2016 10:41:32 -0700 Subject: [PATCH 12/14] Set OPAL_MODEL to p8dtu1u or p8dtu2u for 1U and 2U system. Signed-off-by: Jim Yuan --- src/usr/hwpf/hwp/start_payload/start_payload.C | 66 +++++++++++++++++++++- .../common/xmltohb/attribute_types_hb.xml | 1 + 2 files changed, 66 insertions(+), 1 deletion(-) diff --git a/src/usr/hwpf/hwp/start_payload/start_payload.C b/src/usr/hwpf/hwp/start_payload/start_payload.C index ad155f19e..80e62a0b6 100644 --- a/src/usr/hwpf/hwp/start_payload/start_payload.C +++ b/src/usr/hwpf/hwp/start_payload/start_payload.C @@ -89,6 +89,8 @@ #include #include #include //jim +#include //jim + #include #include @@ -487,6 +489,67 @@ void setAPSSGainOffsetFromPWSInfo(void) assert(0); } } + + +void setOpalMode (void) +{ + + uint8_t riser_id = 0 ; + errlHndl_t l_err = NULL; + size_t len = 4; + + //create request data buffer + uint8_t* data = new uint8_t[len]; + + IPMI::completion_code cc = IPMI::CC_UNKBAD; + + data[0] = 0x3; + data[1] = 0x70; + data[2] = 0x1; + data[3] = 0x2; //offset 0x2 for UIO info + l_err = IPMI::sendrecv(IPMI::master_readwrite(), cc, len, data); + + if( l_err == NULL ) + { + if( cc == IPMI::CC_OK ) + { + riser_id = data[0]; + } + + delete[] data; + } + +ATTR_OPAL_MODEL_type l_model = {0}; + +TARGETING::Target* sys = NULL; +targetService().getTopLevelTarget(sys); + +sys->tryGetAttr(l_model); +TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "OPAL Mode is %s", l_model); +TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "Riser ID is %d", riser_id); + +if (riser_id == 0x9) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "1U OPAL Mode"); + strcpy (l_model, "supermicro,p8dtu1u"); + + } +else //(riser_id == 0x19) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "2U OPAL Mode"); + strcpy (l_model, "supermicro,p8dtu2u"); + } + +if (!sys->trySetAttr(l_model)) + { + TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "set OPAL Mode failed"); + assert(0); + } + +sys->tryGetAttr(l_model); +TRACFCOMP( ISTEPS_TRACE::g_trac_isteps_trace, "after set, OPAL Mode is %s", l_model); + +} // // Wrapper function to call host_runtime_setup // @@ -529,7 +592,8 @@ void* call_host_runtime_setup( void *io_pArgs ) } setAPSSGainOffsetFromPWSInfo(); //jim add code before activate OCC. START_OCC_DURING_BOOT is defined in config. - + setOpalMode(); //jim + bool l_activateOCC = is_avp_load(); #ifdef CONFIG_START_OCC_DURING_BOOT diff --git a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml index 64a0c9bae..3cfdb9aa0 100644 --- a/src/usr/targeting/common/xmltohb/attribute_types_hb.xml +++ b/src/usr/targeting/common/xmltohb/attribute_types_hb.xml @@ -966,6 +966,7 @@ non-volatile + -- 2.16.2.windows.1