summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJia, Chunhui <chunhui.jia@linux.intel.com>2018-12-11 09:00:15 +0800
committerJia, Chunhui <chunhui.jia@linux.intel.com>2019-03-07 06:52:34 +0000
commit30206dbaa6eb0cbddd7e215339f8a112ca011d6a (patch)
treef92363eea85c80304f682433995cdb40bd2173ff
parenta4e09e46949bf9e5abb99aa18f5c399f03f2a00a (diff)
downloadphosphor-host-ipmid-30206dbaa6eb0cbddd7e215339f8a112ca011d6a.zip
phosphor-host-ipmid-30206dbaa6eb0cbddd7e215339f8a112ca011d6a.tar.gz
[IPMI]Set/Get global enables
Recv Message Queue and SEL are enabled by default. Event Message buffer are disabled by default (not supported). Any request that try to change the mask will be rejected. Test: test pass with ipmitool Change-Id: Ia6bd4a6bf7b2b04dcfde6bfec910ca854a7aaeb8 Signed-off-by: Jia, Chunhui <chunhui.jia@linux.intel.com>
-rw-r--r--host-ipmid-whitelist.conf1
-rw-r--r--systemintfcmds.cpp55
-rw-r--r--systemintfcmds.hpp1
3 files changed, 50 insertions, 7 deletions
diff --git a/host-ipmid-whitelist.conf b/host-ipmid-whitelist.conf
index d5dd754..7ac432c 100644
--- a/host-ipmid-whitelist.conf
+++ b/host-ipmid-whitelist.conf
@@ -20,6 +20,7 @@
0x06:0x24 //<App>:<Set Watchdog Timer>
0x06:0x25 //<App>:<Get Watchdog Timer>
0x06:0x2E //<App>:<Set BMC Global Enables>
+0x06:0x2F //<App>:<Get BMC Global Enables>
0x06:0x31 //<App>:<Get Message Flags>
0x06:0x35 //<App>:<Read Event Message Buffer>
0x06:0x36 //<App>:<Get BT Interface Capabilities>
diff --git a/systemintfcmds.cpp b/systemintfcmds.cpp
index 4964800..00e6c51 100644
--- a/systemintfcmds.cpp
+++ b/systemintfcmds.cpp
@@ -18,6 +18,17 @@ using namespace sdbusplus::xyz::openbmc_project::Control::server;
using cmdManagerPtr = std::unique_ptr<phosphor::host::command::Manager>;
extern cmdManagerPtr& ipmid_get_host_cmd_manager();
+// global enables
+// bit0 - Message Receive Queue enable
+// bit1 - Enable Event Message Buffer Full Interrupt
+// bit2 - Enable Event Message Buffer
+// bit3 - Enable System Event Logging
+// bit4 - reserved
+// bit5-7 - OEM 0~2 enables
+static constexpr uint8_t selEnable = 0x08;
+static constexpr uint8_t recvMsgQueueEnable = 0x01;
+static constexpr uint8_t globalEnablesDefault = selEnable | recvMsgQueueEnable;
+
//-------------------------------------------------------------------
// Called by Host post response from Get_Message_Flags
//-------------------------------------------------------------------
@@ -74,9 +85,9 @@ ipmi_ret_t ipmi_app_get_msg_flags(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
// bit:[1] from LSB : 1b = Event Message Buffer Full.
// Return as 0 if Event Message Buffer is not supported,
// or when the Event Message buffer is disabled.
- // TODO. For now. assume its not disabled and send "0x2" anyway:
+ // For now, it is not supported.
- uint8_t set_event_msg_buffer_full = 0x2;
+ uint8_t set_event_msg_buffer_full = 0x0;
*data_len = sizeof(set_event_msg_buffer_full);
// Pack the actual response
@@ -85,6 +96,23 @@ ipmi_ret_t ipmi_app_get_msg_flags(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
return rc;
}
+ipmi_ret_t ipmi_app_get_bmc_global_enables(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
+ ipmi_request_t request,
+ ipmi_response_t response,
+ ipmi_data_len_t data_len,
+ ipmi_context_t context)
+{
+ ipmi_ret_t rc = IPMI_CC_OK;
+ if (0 != *data_len)
+ {
+ *data_len = 0;
+ return IPMI_CC_REQ_DATA_LEN_INVALID;
+ }
+ *data_len = sizeof(globalEnablesDefault);
+ *reinterpret_cast<uint8_t*>(response) = globalEnablesDefault;
+ return rc;
+}
+
ipmi_ret_t ipmi_app_set_bmc_global_enables(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_request_t request,
ipmi_response_t response,
@@ -92,13 +120,22 @@ ipmi_ret_t ipmi_app_set_bmc_global_enables(ipmi_netfn_t netfn, ipmi_cmd_t cmd,
ipmi_context_t context)
{
ipmi_ret_t rc = IPMI_CC_OK;
- *data_len = 0;
- // Event and message logging enabled by default so return for now
-#ifdef __IPMI_DEBUG__
- std::printf("IPMI APP SET BMC GLOBAL ENABLES Ignoring for now\n");
-#endif
+ uint8_t reqMask = *reinterpret_cast<uint8_t*>(request);
+ if (sizeof(reqMask) != *data_len)
+ {
+ *data_len = 0;
+ return IPMI_CC_REQ_DATA_LEN_INVALID;
+ }
+ *data_len = 0;
+ // Recv Message Queue and SEL are enabled by default.
+ // Event Message buffer are disabled by default (not supported).
+ // Any request that try to change the mask will be rejected
+ if (reqMask != (selEnable | recvMsgQueueEnable))
+ {
+ return IPMI_CC_INVALID_FIELD_REQUEST;
+ }
return rc;
}
@@ -131,6 +168,10 @@ void register_netfn_app_functions()
ipmi_register_callback(NETFUN_APP, IPMI_CMD_SET_BMC_GLOBAL_ENABLES, NULL,
ipmi_app_set_bmc_global_enables, SYSTEM_INTERFACE);
+ // <Get BMC Global Enables>
+ ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_BMC_GLOBAL_ENABLES, NULL,
+ ipmi_app_get_bmc_global_enables, SYSTEM_INTERFACE);
+
// <Get Message Flags>
ipmi_register_callback(NETFUN_APP, IPMI_CMD_GET_MSG_FLAGS, NULL,
ipmi_app_get_msg_flags, SYSTEM_INTERFACE);
diff --git a/systemintfcmds.hpp b/systemintfcmds.hpp
index c0b3318..4eb30be 100644
--- a/systemintfcmds.hpp
+++ b/systemintfcmds.hpp
@@ -19,6 +19,7 @@
enum ipmi_netfn_system_intf_cmds
{
IPMI_CMD_SET_BMC_GLOBAL_ENABLES = 0x2E,
+ IPMI_CMD_GET_BMC_GLOBAL_ENABLES = 0x2F,
IPMI_CMD_GET_MSG_FLAGS = 0x31,
IPMI_CMD_READ_EVENT = 0x35,
};
OpenPOWER on IntegriCloud