summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorMarty Gloff <mgloff@us.ibm.com>2017-03-20 14:25:27 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-04-10 13:26:13 -0400
commitd85536ac35dd97a666b7b8de090f255b1a33c7d8 (patch)
tree07df13fd800c898b60659ad54920e7c719f6ee66 /src/include
parent4a0692811d82840b2c6eed9c892c9a866586b989 (diff)
downloadtalos-hostboot-d85536ac35dd97a666b7b8de090f255b1a33c7d8.tar.gz
talos-hostboot-d85536ac35dd97a666b7b8de090f255b1a33c7d8.zip
SBE message passing interface - call appropriate command processor
Add definitions of SBE message and pass-through command. Create mechanism to call functions to process commands. Change-Id: Id14471b1e6f036c278fd5ae1950b942290282c1e RTC: 170761 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/38167 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Corey V. Swenson <cswenson@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/usr/sbeio/runtime/sbe_msg_passing.H158
-rw-r--r--src/include/usr/sbeio/sbeioreasoncodes.H7
2 files changed, 165 insertions, 0 deletions
diff --git a/src/include/usr/sbeio/runtime/sbe_msg_passing.H b/src/include/usr/sbeio/runtime/sbe_msg_passing.H
new file mode 100644
index 000000000..48d3331ce
--- /dev/null
+++ b/src/include/usr/sbeio/runtime/sbe_msg_passing.H
@@ -0,0 +1,158 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/sbeio/runtime/sbe_msg_passing.H $ */
+/* */
+/* OpenPOWER HostBoot Project */
+/* */
+/* Contributors Listed Below - COPYRIGHT 2017 */
+/* [+] 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 */
+#ifndef SBE_MSG_PASSING_H
+#define SBE_MSG_PASSING_H
+
+#include <stdint.h>
+#include <map>
+#include <errl/errlmanager.H>
+#include <targeting/common/target.H>
+
+
+namespace SBE_MSG
+{
+ // SBE Communication Buffer for Pass-through commands
+ /**
+ * @brief SBE Communication package size in number of pages
+ */
+ const uint8_t SBE_COMM_PKG_SIZE = 1;
+
+ /**
+ * @brief SBE Communication buffer size
+ */
+ const uint32_t SBE_COMM_BUFFER_SIZE = SBE_COMM_PKG_SIZE * PAGESIZE;
+
+ /**
+ * @brief SBE Message size / Pass-through Command size
+ */
+ const uint32_t SBE_MSG_SIZE = SBE_COMM_BUFFER_SIZE;
+
+
+ // SBE Header Version enums for SBE Header version field
+ enum sbeHdrVersion
+ {
+ SBEHDRVER_FIRST = 0x00010000, // First SBE Header version
+ // NOTE: Update SBEHDRVER_LATEST with each new version
+ SBEHDRVER_LATEST = SBEHDRVER_FIRST
+ };
+
+ #define ENUM_SBEHDRVER_CHECK(version) (((version) >= SBEHDRVER_FIRST) \
+ && ((version) <= SBEHDRVER_LATEST))
+
+
+ // Command Header Version enums for Command Header version field
+ enum cmdHdrVersion
+ {
+ CMDHDRVER_FIRST = 0x00010000, // First Command Hdr version
+ // NOTE: Update CMDHDRVER_LATEST with each new version
+ CMDHDRVER_LATEST = CMDHDRVER_FIRST
+ };
+
+ #define ENUM_CMDHDRVER_CHECK(version) (((version) >= CMDHDRVER_FIRST) \
+ && ((version) <= CMDHDRVER_LATEST))
+
+
+ // Pass-Through Command enums for Command Header command field
+ enum passThruCmds
+ {
+ PASSTHRU_SET_OCC_STATE = 0x00E00001, // Set OCC State
+ PASSTHRU_GET_OCC_SENSOR = 0x00E00002, // Get OCC Sensor Readings
+ PASSTHRU_SET_HYPER_ENV = 0x00E00003, // Set Hypervisor Environment
+ PASSTHRU_QRY_MD_FN = 0x00E00004, // Query Mode and Function
+ PASSTHRU_RST_PM_COMPLEX = 0x00E00005, // Reset PM Complex
+ PASSTHRU_CTL_AUTOSLEW = 0x00E00006, // Control Autoslew
+ PASSTHRU_GET_PSTATE = 0x00E00007, // Get PState Table
+ };
+
+
+ // SBE Header at start of SBE Message
+ typedef struct sbeHeader
+ {
+ uint32_t version; // SBE header version
+ uint32_t msgSize; // Message size (Pass-through cmd or rsp)
+ // Size includes SBE and Command Headers
+ uint32_t seqId; // Sequence ID
+ } PACKED sbeHeader_t;
+
+ // Command Header following SBE Header in SBE Message
+ typedef struct cmdHeader
+ {
+ uint32_t version; // Command header version
+ uint32_t status; // Status of processing (rsp only)
+ uint32_t dataOffset; // Data offset (cmd or rsp)
+ // Offset is from beginning of Command Header
+ uint32_t dataSize; // Data size (cmd or rsp)
+ // Size does NOT include ANY Header fields
+ uint32_t command; // Pass-through command
+ } PACKED cmdHeader_t;
+
+ // Max Pass-through command/response data size
+ const uint32_t SBE_MSG_MAX_DATA =
+ SBE_MSG_SIZE - sizeof(sbeHeader_t) - sizeof(cmdHeader_t);
+
+ // SBE Message (Pass-through command or response)
+ typedef struct sbeMessage
+ {
+ sbeHeader_t sbeHdr; // SBE header
+ cmdHeader_t cmdHdr; // Command header
+ uint8_t data[SBE_MSG_MAX_DATA]; // Pass-through command/response data
+ } sbeMessage_t;
+
+
+ /**
+ * @brief Function to process pass-through command from SBE message
+ *
+ * @param[in] i_procTgt HB processor target
+ * @param[in] i_reqDataSize Pass-through command request data size
+ * @param[in] i_reqData Pass-through command request data
+ * @param[out] o_rspStatus Pass-through command response status
+ * @param[out] o_rspDataSize Pass-through command response data size
+ * @param[out] o_rspData Pass-through command response data
+ *
+ * @return errlHndl_t Error log handle on failure.
+ */
+ typedef errlHndl_t (*processCmdFunction_t)(TARGETING::TargetHandle_t,
+ uint32_t,
+ uint8_t*,
+ uint32_t*,
+ uint32_t*,
+ uint8_t*);
+
+ // Process Command Map of pass-through command to function used to process
+ typedef std::map<uint32_t, processCmdFunction_t> ProcessCmdMap_t;
+
+ /**
+ * @brief Set process pass-through command function in Process Command Map
+ *
+ * @param[in] i_command Process pass-through command
+ * @param[in] i_function Function to process pass-through command
+ *
+ * @return int Return code.
+ */
+ int setProcessCmdFunction(enum passThruCmds i_command,
+ processCmdFunction_t i_function);
+} // namespace SBE_MSG
+
+#endif
diff --git a/src/include/usr/sbeio/sbeioreasoncodes.H b/src/include/usr/sbeio/sbeioreasoncodes.H
index 0cff071ba..83c3ec00e 100644
--- a/src/include/usr/sbeio/sbeioreasoncodes.H
+++ b/src/include/usr/sbeio/sbeioreasoncodes.H
@@ -47,6 +47,7 @@ enum sbeioModuleId
SBEIO_FIFO = 0x02,
SBEIO_FFDC_PARSER = 0x03,
SBEIO_FIFO_CONTINUE_MPIPL = 0x04,
+ SBEIO_RUNTIME = 0x05,
};
/**
@@ -84,6 +85,12 @@ enum sbeioReasonCode
//termination_rc
SBEIO_DEAD_SBE = SBEIO_COMP_ID | 0x1B,
+ // SBEIO Runtime error codes
+ SBEIO_RT_INVALID_COMMAND = SBEIO_COMP_ID | 0x30,
+ SBEIO_RT_FUNCTION_NOT_SET = SBEIO_COMP_ID | 0x31,
+ SBEIO_RT_RSP_DATA_TOO_LARGE = SBEIO_COMP_ID | 0x32,
+ SBEIO_RT_NO_SBE_COMM_BUFFER = SBEIO_COMP_ID | 0x38,
+
// Remove once we collect the FFDC ourselves - @todo-RTC:144313
//termination_rc
SBEIO_HWSV_COLLECT_SBE_RC = SBEIO_COMP_ID | 0xFF,
OpenPOWER on IntegriCloud