Skip to content

Commit d85536a

Browse files
mgloffdcrowell77
authored andcommitted
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>
1 parent 4a06928 commit d85536a

File tree

4 files changed

+417
-51
lines changed

4 files changed

+417
-51
lines changed
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
/* IBM_PROLOG_BEGIN_TAG */
2+
/* This is an automatically generated prolog. */
3+
/* */
4+
/* $Source: src/include/usr/sbeio/runtime/sbe_msg_passing.H $ */
5+
/* */
6+
/* OpenPOWER HostBoot Project */
7+
/* */
8+
/* Contributors Listed Below - COPYRIGHT 2017 */
9+
/* [+] International Business Machines Corp. */
10+
/* */
11+
/* */
12+
/* Licensed under the Apache License, Version 2.0 (the "License"); */
13+
/* you may not use this file except in compliance with the License. */
14+
/* You may obtain a copy of the License at */
15+
/* */
16+
/* http://www.apache.org/licenses/LICENSE-2.0 */
17+
/* */
18+
/* Unless required by applicable law or agreed to in writing, software */
19+
/* distributed under the License is distributed on an "AS IS" BASIS, */
20+
/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
21+
/* implied. See the License for the specific language governing */
22+
/* permissions and limitations under the License. */
23+
/* */
24+
/* IBM_PROLOG_END_TAG */
25+
#ifndef SBE_MSG_PASSING_H
26+
#define SBE_MSG_PASSING_H
27+
28+
#include <stdint.h>
29+
#include <map>
30+
#include <errl/errlmanager.H>
31+
#include <targeting/common/target.H>
32+
33+
34+
namespace SBE_MSG
35+
{
36+
// SBE Communication Buffer for Pass-through commands
37+
/**
38+
* @brief SBE Communication package size in number of pages
39+
*/
40+
const uint8_t SBE_COMM_PKG_SIZE = 1;
41+
42+
/**
43+
* @brief SBE Communication buffer size
44+
*/
45+
const uint32_t SBE_COMM_BUFFER_SIZE = SBE_COMM_PKG_SIZE * PAGESIZE;
46+
47+
/**
48+
* @brief SBE Message size / Pass-through Command size
49+
*/
50+
const uint32_t SBE_MSG_SIZE = SBE_COMM_BUFFER_SIZE;
51+
52+
53+
// SBE Header Version enums for SBE Header version field
54+
enum sbeHdrVersion
55+
{
56+
SBEHDRVER_FIRST = 0x00010000, // First SBE Header version
57+
// NOTE: Update SBEHDRVER_LATEST with each new version
58+
SBEHDRVER_LATEST = SBEHDRVER_FIRST
59+
};
60+
61+
#define ENUM_SBEHDRVER_CHECK(version) (((version) >= SBEHDRVER_FIRST) \
62+
&& ((version) <= SBEHDRVER_LATEST))
63+
64+
65+
// Command Header Version enums for Command Header version field
66+
enum cmdHdrVersion
67+
{
68+
CMDHDRVER_FIRST = 0x00010000, // First Command Hdr version
69+
// NOTE: Update CMDHDRVER_LATEST with each new version
70+
CMDHDRVER_LATEST = CMDHDRVER_FIRST
71+
};
72+
73+
#define ENUM_CMDHDRVER_CHECK(version) (((version) >= CMDHDRVER_FIRST) \
74+
&& ((version) <= CMDHDRVER_LATEST))
75+
76+
77+
// Pass-Through Command enums for Command Header command field
78+
enum passThruCmds
79+
{
80+
PASSTHRU_SET_OCC_STATE = 0x00E00001, // Set OCC State
81+
PASSTHRU_GET_OCC_SENSOR = 0x00E00002, // Get OCC Sensor Readings
82+
PASSTHRU_SET_HYPER_ENV = 0x00E00003, // Set Hypervisor Environment
83+
PASSTHRU_QRY_MD_FN = 0x00E00004, // Query Mode and Function
84+
PASSTHRU_RST_PM_COMPLEX = 0x00E00005, // Reset PM Complex
85+
PASSTHRU_CTL_AUTOSLEW = 0x00E00006, // Control Autoslew
86+
PASSTHRU_GET_PSTATE = 0x00E00007, // Get PState Table
87+
};
88+
89+
90+
// SBE Header at start of SBE Message
91+
typedef struct sbeHeader
92+
{
93+
uint32_t version; // SBE header version
94+
uint32_t msgSize; // Message size (Pass-through cmd or rsp)
95+
// Size includes SBE and Command Headers
96+
uint32_t seqId; // Sequence ID
97+
} PACKED sbeHeader_t;
98+
99+
// Command Header following SBE Header in SBE Message
100+
typedef struct cmdHeader
101+
{
102+
uint32_t version; // Command header version
103+
uint32_t status; // Status of processing (rsp only)
104+
uint32_t dataOffset; // Data offset (cmd or rsp)
105+
// Offset is from beginning of Command Header
106+
uint32_t dataSize; // Data size (cmd or rsp)
107+
// Size does NOT include ANY Header fields
108+
uint32_t command; // Pass-through command
109+
} PACKED cmdHeader_t;
110+
111+
// Max Pass-through command/response data size
112+
const uint32_t SBE_MSG_MAX_DATA =
113+
SBE_MSG_SIZE - sizeof(sbeHeader_t) - sizeof(cmdHeader_t);
114+
115+
// SBE Message (Pass-through command or response)
116+
typedef struct sbeMessage
117+
{
118+
sbeHeader_t sbeHdr; // SBE header
119+
cmdHeader_t cmdHdr; // Command header
120+
uint8_t data[SBE_MSG_MAX_DATA]; // Pass-through command/response data
121+
} sbeMessage_t;
122+
123+
124+
/**
125+
* @brief Function to process pass-through command from SBE message
126+
*
127+
* @param[in] i_procTgt HB processor target
128+
* @param[in] i_reqDataSize Pass-through command request data size
129+
* @param[in] i_reqData Pass-through command request data
130+
* @param[out] o_rspStatus Pass-through command response status
131+
* @param[out] o_rspDataSize Pass-through command response data size
132+
* @param[out] o_rspData Pass-through command response data
133+
*
134+
* @return errlHndl_t Error log handle on failure.
135+
*/
136+
typedef errlHndl_t (*processCmdFunction_t)(TARGETING::TargetHandle_t,
137+
uint32_t,
138+
uint8_t*,
139+
uint32_t*,
140+
uint32_t*,
141+
uint8_t*);
142+
143+
// Process Command Map of pass-through command to function used to process
144+
typedef std::map<uint32_t, processCmdFunction_t> ProcessCmdMap_t;
145+
146+
/**
147+
* @brief Set process pass-through command function in Process Command Map
148+
*
149+
* @param[in] i_command Process pass-through command
150+
* @param[in] i_function Function to process pass-through command
151+
*
152+
* @return int Return code.
153+
*/
154+
int setProcessCmdFunction(enum passThruCmds i_command,
155+
processCmdFunction_t i_function);
156+
} // namespace SBE_MSG
157+
158+
#endif

src/include/usr/sbeio/sbeioreasoncodes.H

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ enum sbeioModuleId
4747
SBEIO_FIFO = 0x02,
4848
SBEIO_FFDC_PARSER = 0x03,
4949
SBEIO_FIFO_CONTINUE_MPIPL = 0x04,
50+
SBEIO_RUNTIME = 0x05,
5051
};
5152

5253
/**
@@ -84,6 +85,12 @@ enum sbeioReasonCode
8485
//termination_rc
8586
SBEIO_DEAD_SBE = SBEIO_COMP_ID | 0x1B,
8687

88+
// SBEIO Runtime error codes
89+
SBEIO_RT_INVALID_COMMAND = SBEIO_COMP_ID | 0x30,
90+
SBEIO_RT_FUNCTION_NOT_SET = SBEIO_COMP_ID | 0x31,
91+
SBEIO_RT_RSP_DATA_TOO_LARGE = SBEIO_COMP_ID | 0x32,
92+
SBEIO_RT_NO_SBE_COMM_BUFFER = SBEIO_COMP_ID | 0x38,
93+
8794
// Remove once we collect the FFDC ourselves - @todo-RTC:144313
8895
//termination_rc
8996
SBEIO_HWSV_COLLECT_SBE_RC = SBEIO_COMP_ID | 0xFF,

0 commit comments

Comments
 (0)