summaryrefslogtreecommitdiffstats
path: root/src/usr/ipmi
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2015-02-18 15:07:08 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2015-02-25 22:57:37 -0600
commitde162b1fbbafc0d1f98eb2231b14c4d351b3171e (patch)
tree9ed20c4caef4219670f7ac2f7e1931566f3695da /src/usr/ipmi
parent84a672bd28630d9998fc2808df3659ddcf5a7eda (diff)
downloadtalos-hostboot-de162b1fbbafc0d1f98eb2231b14c4d351b3171e.tar.gz
talos-hostboot-de162b1fbbafc0d1f98eb2231b14c4d351b3171e.zip
attr for ipmi max_buffer for hbrt
pass the ipmi max_buffer size from hostboot during ipl to hostboot runtime via targeting attribute Change-Id: I5971333fd3950af65c66a2936b00a0d4ad907330 RTC: 124099 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/15820 Tested-by: Jenkins Server Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/ipmi')
-rw-r--r--src/usr/ipmi/ipmi.mk28
-rw-r--r--src/usr/ipmi/ipmirp.C12
-rw-r--r--src/usr/ipmi/ipmisel.C34
-rw-r--r--src/usr/ipmi/makefile6
-rw-r--r--src/usr/ipmi/runtime/makefile6
-rw-r--r--src/usr/ipmi/runtime/rt_ipmirp.C24
6 files changed, 81 insertions, 29 deletions
diff --git a/src/usr/ipmi/ipmi.mk b/src/usr/ipmi/ipmi.mk
new file mode 100644
index 000000000..4b8b244e3
--- /dev/null
+++ b/src/usr/ipmi/ipmi.mk
@@ -0,0 +1,28 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/ipmi/ipmi.mk $
+#
+# OpenPOWER HostBoot Project
+#
+# Contributors Listed Below - COPYRIGHT 2015
+# [+] International Business Machines Corp.
+#
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+# implied. See the License for the specific language governing
+# permissions and limitations under the License.
+#
+# IBM_PROLOG_END_TAG
+# common objects between hostboot and runtime hostboot
+OBJS += ipmisel.o
+OBJS += ipmisensor.o
+OBJS += ipmidcmi.o
diff --git a/src/usr/ipmi/ipmirp.C b/src/usr/ipmi/ipmirp.C
index 0b6eb68e3..b27a45df9 100644
--- a/src/usr/ipmi/ipmirp.C
+++ b/src/usr/ipmi/ipmirp.C
@@ -286,8 +286,18 @@ void IpmiRP::getInterfaceCapabilities(void)
iv_outstanding_req, iv_xmit_buffer_size,
iv_recv_buffer_size, iv_bmc_timeout, iv_retries);
- mutex_unlock(&iv_mutex);
+ // store this size for hbrt's usage
+ TARGETING::Target * sys = NULL;
+ TARGETING::targetService().getTopLevelTarget( sys );
+ if (sys)
+ {
+ sys->setAttr<TARGETING::ATTR_IPMI_MAX_BUFFER_SIZE>
+ (iv_xmit_buffer_size - getXportHeaderSize() - 1);
+ IPMI_TRAC("setAttr(IPMI_MAX_BUFFER_SIZE) = %d",
+ (iv_xmit_buffer_size - getXportHeaderSize() - 1));
+ }
+ mutex_unlock(&iv_mutex);
} while(false);
delete[] data;
diff --git a/src/usr/ipmi/ipmisel.C b/src/usr/ipmi/ipmisel.C
index 92a70faa5..c05c60f26 100644
--- a/src/usr/ipmi/ipmisel.C
+++ b/src/usr/ipmi/ipmisel.C
@@ -99,14 +99,14 @@ void sendESEL(uint8_t* i_eselData, uint32_t i_dataSize,
msg->data[0] = i_eid;
// create the sel record of information
- IPMISEL::selRecord l_sel;
- l_sel.record_type = IPMISEL::record_type_ami_esel;
- l_sel.generator_id = IPMISEL::generator_id_ami;
- l_sel.evm_format_version = IPMISEL::format_ipmi_version_2_0;
+ selRecord l_sel;
+ l_sel.record_type = record_type_ami_esel;
+ l_sel.generator_id = generator_id_ami;
+ l_sel.evm_format_version = format_ipmi_version_2_0;
l_sel.sensor_type = i_sensorType;
l_sel.sensor_number = i_sensorNumber;
l_sel.event_dir_type = i_eventDirType;
- l_sel.event_data1 = IPMISEL::event_data1_ami;
+ l_sel.event_data1 = event_data1_ami;
eselInitData *eselData =
new eselInitData(&l_sel, i_eselData, i_dataSize);
@@ -139,15 +139,15 @@ void process_esel(msg_t *i_msg)
errlHndl_t l_err = NULL;
IPMI::completion_code l_cc = IPMI::CC_UNKBAD;
const uint32_t l_eid = i_msg->data[0];
- IPMISEL::eselInitData * l_data =
- (IPMISEL::eselInitData*)(i_msg->extra_data);
+ eselInitData * l_data =
+ (eselInitData*)(i_msg->extra_data);
IPMI_TRAC(ENTER_MRK "process_esel");
uint32_t l_send_count = MAX_SEND_COUNT;
while (l_send_count > 0)
{
// try to send the eles to the bmc
- IPMISEL::send_esel(l_data, l_err, l_cc);
+ send_esel(l_data, l_err, l_cc);
// if no error but last completion code was:
if ((l_err == NULL) &&
@@ -211,7 +211,7 @@ void process_esel(msg_t *i_msg)
/*
* @brief Send esel data to bmc
*/
-void send_esel(IPMISEL::eselInitData * i_data,
+void send_esel(eselInitData * i_data,
errlHndl_t &o_err, IPMI::completion_code &o_cc)
{
IPMI_TRAC(ENTER_MRK "send_esel");
@@ -248,7 +248,7 @@ void send_esel(IPMISEL::eselInitData * i_data,
// first send down the SEL Event Record data
size_t eSELindex = 0;
uint8_t l_lastEntry = 0;
- len = IPMISEL::PARTIAL_ADD_ESEL_REQ + sizeof(IPMISEL::selRecord);
+ len = PARTIAL_ADD_ESEL_REQ + sizeof(selRecord);
delete [] data;
data = new uint8_t[len];
@@ -256,8 +256,8 @@ void send_esel(IPMISEL::eselInitData * i_data,
createPartialAddHeader(reserveID,esel_recordID,eSELindex,l_lastEntry,data);
// copy in the SEL event record data
- memcpy(&data[IPMISEL::PARTIAL_ADD_ESEL_REQ], i_data->eSel,
- sizeof(IPMISEL::selRecord));
+ memcpy(&data[PARTIAL_ADD_ESEL_REQ], i_data->eSel,
+ sizeof(selRecord));
o_cc = IPMI::CC_UNKBAD;
TRACFBIN( g_trac_ipmi, INFO_MRK"1st partial_add_esel:", data, len);
@@ -289,7 +289,7 @@ void send_esel(IPMISEL::eselInitData * i_data,
//if the index + the maximum buffer is less than what we still
//have left in the eSEL, this is not the last entry (data[6] = 0)
//otherwise, it is and data[6] = 1
- if(eSELindex + (l_maxBuffer - IPMISEL::PARTIAL_ADD_ESEL_REQ)
+ if(eSELindex + (l_maxBuffer - PARTIAL_ADD_ESEL_REQ)
< l_eSELlen)
{
len = l_maxBuffer;
@@ -297,7 +297,7 @@ void send_esel(IPMISEL::eselInitData * i_data,
}
else
{
- len = l_eSELlen - eSELindex + IPMISEL::PARTIAL_ADD_ESEL_REQ;
+ len = l_eSELlen - eSELindex + PARTIAL_ADD_ESEL_REQ;
l_lastEntry = 0x01;
}
delete [] data;
@@ -305,11 +305,11 @@ void send_esel(IPMISEL::eselInitData * i_data,
// fill in the partial_add_esel request (command) data
createPartialAddHeader(reserveID, esel_recordID,
- eSELindex + sizeof(IPMISEL::selRecord),
+ eSELindex + sizeof(selRecord),
l_lastEntry, data);
- uint8_t dataCpyLen = len - IPMISEL::PARTIAL_ADD_ESEL_REQ;
- memcpy(&data[IPMISEL::PARTIAL_ADD_ESEL_REQ],
+ uint8_t dataCpyLen = len - PARTIAL_ADD_ESEL_REQ;
+ memcpy(&data[PARTIAL_ADD_ESEL_REQ],
&i_data->eSelExtra[eSELindex],
dataCpyLen);
diff --git a/src/usr/ipmi/makefile b/src/usr/ipmi/makefile
index fb6a249a4..9447bad37 100644
--- a/src/usr/ipmi/makefile
+++ b/src/usr/ipmi/makefile
@@ -25,19 +25,19 @@
ROOTPATH = ../../..
MODULE = ipmi
+#include common ojects between hostboot and runtime hostboot
+include ipmi.mk
+
OBJS += ipmimsg.o
OBJS += $(if $(CONFIG_BMC_BT_LPC_IPMI),ipmibt.o)
OBJS += ipmirp.o
-OBJS += ipmisel.o
OBJS += $(if $(CONFIG_BMC_BT_LPC_IPMI),ipmidd.o)
OBJS += ipmifru.o
OBJS += ipmiconfig.o
-OBJS += ipmisensor.o
OBJS += ipmiwatchdog.o
OBJS += ipmifruinv.o
OBJS += ipmipowerstate.o
OBJS += ipmiselrecord.o
-OBJS += ipmidcmi.o
SUBDIRS += runtime.d
#SUBDIRS += test.d
diff --git a/src/usr/ipmi/runtime/makefile b/src/usr/ipmi/runtime/makefile
index 6fa93cc6d..6f49d9ef1 100644
--- a/src/usr/ipmi/runtime/makefile
+++ b/src/usr/ipmi/runtime/makefile
@@ -26,9 +26,9 @@ HOSTBOOT_RUNTIME = 1
ROOTPATH = ../../../..
MODULE = ipmi_rt
-OBJS += ipmidcmi.o
-OBJS += ipmisel.o
-OBJS += ipmisensor.o
+#include common ojects between hostboot and runtime hostboot
+include ../ipmi.mk
+
OBJS += rt_ipmirp.o
SUBDIRS += test.d
diff --git a/src/usr/ipmi/runtime/rt_ipmirp.C b/src/usr/ipmi/runtime/rt_ipmirp.C
index 7184c85f7..f99723adf 100644
--- a/src/usr/ipmi/runtime/rt_ipmirp.C
+++ b/src/usr/ipmi/runtime/rt_ipmirp.C
@@ -54,11 +54,25 @@ trace_desc_t * g_trac_ipmi;
namespace IPMI
{
- // TODO RTC: 124099 move to a _hb attribute
- // ATTR_IPMI_MAX_BUFFER_SEND_SIZE
- static const size_t g_max_buffer = 61;
+ static size_t g_max_buffer = 0;
size_t max_buffer(void)
{
+ if (g_max_buffer == 0)
+ {
+ TARGETING::Target * sys = NULL;
+ TARGETING::targetService().getTopLevelTarget( sys );
+ if (sys)
+ {
+ g_max_buffer = sys->getAttr
+ <TARGETING::ATTR_IPMI_MAX_BUFFER_SIZE>();
+ IPMI_TRAC( INFO_MRK"getAttr(IPMI_MAX_BUFFER_SIZE) = %d",
+ g_max_buffer);
+ }
+ else
+ {
+ IPMI_TRAC( ERR_MRK"IPMI_MAX_BUFFER_SIZE not available" );
+ }
+ }
return g_max_buffer;
}
@@ -73,14 +87,14 @@ namespace IPMI
int rc = 0;
// if the buffer is too large this is a programming error.
- assert(io_len <= g_max_buffer);
+ assert(io_len <= max_buffer());
IPMI_TRAC("calling sync %x:%x len=%d",
i_cmd.first, i_cmd.second, io_len);
if(g_hostInterfaces && g_hostInterfaces->ipmi_msg)
{
- size_t l_len = g_max_buffer; // max size the BMC can return
+ size_t l_len = max_buffer(); // max size the BMC can return
uint8_t *l_data = new uint8_t[l_len];
rc = g_hostInterfaces->ipmi_msg(
OpenPOWER on IntegriCloud