Skip to content

Commit 2a1cc4f

Browse files
velozrdcrowell77
authored andcommitted
Updated VPD from HBRT on FSP systems
Created a generic message type that is used as a mailbox message that is passed from HBRT to FSP. The new generic message type is used to make a VPD write call. Change-Id: I21240d19909f786d525e2a98878000af4aea6e9f RTC:171488 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/45048 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com> Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com> Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: William G. Hoffa <wghoffa@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
1 parent 7e787ac commit 2a1cc4f

File tree

8 files changed

+377
-66
lines changed

8 files changed

+377
-66
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/* IBM_PROLOG_BEGIN_TAG */
2+
/* This is an automatically generated prolog. */
3+
/* */
4+
/* $Source: src/include/runtime/generic_hbrt_fsp_message.H $ */
5+
/* */
6+
/* OpenPOWER HostBoot Project */
7+
/* */
8+
/* Contributors Listed Below - COPYRIGHT 2013,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 __RUNTIME__GENERIC_HBRT_FSP_MESSAGE_H
26+
#define __RUNTIME__GENERIC_HBRT_FSP_MESSAGE_H
27+
28+
#include <builtins.h>
29+
30+
/** @file generic_hbrt_fsp_message.H
31+
* @brief A generic structure for passing data
32+
*
33+
* This file has a generic struct to be used by the
34+
* FSP/HWSV team to send and receive data.
35+
*/
36+
37+
/**
38+
* This struct sends an MBox message to the FSP
39+
*/
40+
struct GenericFspMboxMessage_t
41+
{
42+
uint32_t msgq; // Example: MBOX::FSP_VPD_MSGQ
43+
uint32_t msgType; // Example: VPD_MSG_TYPE:VPD_WRITE_PROC
44+
struct // flags
45+
{
46+
uint32_t __reserved__async:1;
47+
uint32_t __reserved__pseudosync:1;
48+
uint32_t __reserved__unused:30;
49+
};
50+
uint64_t data; // generic member that can be used
51+
// to do casting to other types:
52+
// MyDataType_t* mydatatype =
53+
// (MyDataType_t*)&(l_generic_msg.data);
54+
} PACKED ;
55+
56+
/**
57+
* This struct receives the response message from the FSP
58+
*/
59+
struct GenericFspRspMessage_t
60+
{
61+
uint32_t msgq; // Example: MBOX::FSP_VPD_MSGQ
62+
uint32_t msgType; // Example: VPD_MSG_TYPE:VPD_WRITE_PROC
63+
struct // flags
64+
{
65+
uint32_t __reserved__async:1;
66+
uint32_t __reserved__pseudosync:1;
67+
uint32_t __reserved__unused:30;
68+
};
69+
uint32_t errPlid; // error log id
70+
} PACKED ;
71+
72+
73+
#endif // __RUNTIME__GENERIC_HBRT_FSP_MESSAGE_H

src/include/runtime/interface.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include <stdint.h>
4747
#include <time.h>
4848
#include <limits.h>
49+
#include "generic_hbrt_fsp_message.H"
4950

5051
/** Memory error types defined for memory_error() interface. */
5152
enum MemoryError_t
@@ -504,6 +505,7 @@ typedef struct hostInterfaces
504505
HBRT_FW_MSG_TYPE_REQ_HCODE_UPDATE = 3,
505506
HBRT_FW_MSG_HBRT_FSP = 4,
506507
HBRT_FW_MSG_TYPE_ERROR_LOG = 5,
508+
HBRT_FW_MSG_HBRT_FSP_RESP = 6,
507509
};
508510

509511
struct hbrt_fw_msg // define struct hbrt_fw_msg
@@ -546,9 +548,19 @@ typedef struct hostInterfaces
546548
// uint8_t *myData =
547549
// (uint8_t*)&l_req_fw_msg->error_log.i_data;
548550
} __attribute__ ((packed)) error_log;
549-
};
550-
};
551551

552+
// This struct is sent from HBRT with
553+
// io_type set to HBRT_FW_MSG_HBRT_FSP
554+
// This struct sends an MBox message to the FSP
555+
struct GenericFspMboxMessage_t generic_message;
556+
557+
// This struct is sent from FSP with
558+
// io_type set to HBRT_FW_MSG_HBRT_FSP_RESP
559+
// This struct receives a message from the FSP
560+
struct GenericFspRspMessage_t generic_message_resp;
561+
562+
}; // end union
563+
}; // end struct hbrt_fw_msg
552564

553565
// Created a static constexpr to return the base size of hbrt_fw_msg
554566
// Can't do #define - sizeof not allowed to be used in #defines

src/include/usr/vpd/vpdreasoncodes.H

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/* */
66
/* OpenPOWER HostBoot Project */
77
/* */
8-
/* Contributors Listed Below - COPYRIGHT 2013,2016 */
8+
/* Contributors Listed Below - COPYRIGHT 2013,2017 */
99
/* [+] Google Inc. */
1010
/* [+] International Business Machines Corp. */
1111
/* */
@@ -92,6 +92,7 @@ enum vpdModuleId
9292
VPD_RT_WRITE_PNOR = 0x81,
9393
VPD_BLD_RT_IMAGE = 0x82,
9494
VPD_SEND_MBOX_WRITE_MESSAGE = 0x83,
95+
VPD_RT_FIRMWARE_REQUEST = 0x84,
9596

9697
};
9798

@@ -139,6 +140,8 @@ enum vpdReasonCode
139140
VPD_WRITE_DEST_UNRESOLVED = VPD_COMP_ID | 0x34,
140141
VPD_CACHE_SIZE_EXCEEDED = VPD_COMP_ID | 0x35,
141142
VPD_INVALID_LENGTH = VPD_COMP_ID | 0x36,
143+
VPD_RT_NULL_FIRMWARE_REQUEST_PTR = VPD_COMP_ID | 0x37,
144+
VPD_RT_WRITE_MSG_ERR = VPD_COMP_ID | 0x38,
142145
};
143146

144147

src/usr/isteps/pm/runtime/test/firmwareRequestTest.H

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,95 @@ class FirmwareRequestTest : public CxxTest::TestSuite
162162
"FirmwareRequestTest::testFirmwareRequestErrLogToFsp");
163163

164164
} // end testFirmwareRequestErrLogToFsp
165+
166+
/**
167+
* @brief: testFirmwareRequestHbrtToFsp
168+
* test the firmware_request's HBRT to FSP call
169+
*/
170+
void testFirmwareRequestHbrtToFsp (void)
171+
{
172+
TRACFCOMP(g_trac_pnor, ENTER_MRK
173+
"FirmwareRequestTest::testFirmwareRequestHbrtToFsp");
174+
175+
if (g_hostInterfaces == NULL ||
176+
g_hostInterfaces->firmware_request == NULL)
177+
{
178+
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
179+
"Hypervisor firmware_request interface not linked");
180+
}
181+
else
182+
{
183+
// Test HBRT to FSP
184+
// populate the firmware_request structure with arbitrary data
185+
hostInterfaces::hbrt_fw_msg l_req_fw_msg;
186+
l_req_fw_msg.io_type = hostInterfaces::HBRT_FW_MSG_HBRT_FSP;
187+
l_req_fw_msg.generic_message.msgq = 0x300;
188+
l_req_fw_msg.generic_message.msgType = 0x400;
189+
l_req_fw_msg.generic_message.data = 0xDEADBEEF;
190+
191+
TRACFCOMP(g_trac_pnor,
192+
"FirmwareRequestTest::testFirmwareRequestHbrtToFsp req: "
193+
"type:%d, msgq:0x%.8X, msgType:0x%.8X, data:0x%.8X",
194+
l_req_fw_msg.io_type,
195+
l_req_fw_msg.generic_message.msgq,
196+
l_req_fw_msg.generic_message.msgType,
197+
l_req_fw_msg.generic_message.data);
198+
199+
hostInterfaces::hbrt_fw_msg l_resp_fw_msg;
200+
uint64_t l_resp_fw_msg_size = sizeof(l_resp_fw_msg);
201+
size_t rc = g_hostInterfaces->firmware_request(
202+
sizeof(l_req_fw_msg), &l_req_fw_msg,
203+
&l_resp_fw_msg_size, &l_resp_fw_msg);
204+
205+
TRACFCOMP(g_trac_pnor,
206+
"FirmwareRequestTest::testFirmwareRequestHbrtToFsp resp: "
207+
"type:0x%.8X, msgq:0x%.8X, msgType:0x%.8X,"
208+
" errPlid:0x%X, rc=%d",
209+
l_resp_fw_msg.io_type,
210+
l_resp_fw_msg.generic_message_resp.msgq,
211+
l_resp_fw_msg.generic_message_resp.msgType,
212+
l_resp_fw_msg.generic_message_resp.errPlid,
213+
rc);
214+
215+
if (rc != 0)
216+
{
217+
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
218+
"firmware_request - HBRT to FSP failed - "
219+
"returned wrong value");
220+
}
221+
222+
if (l_resp_fw_msg.io_type !=
223+
hostInterfaces::HBRT_FW_MSG_HBRT_FSP_RESP)
224+
{
225+
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
226+
"firmware_request - HBRT to FSP failed - "
227+
"received incorrect msg_type");
228+
}
229+
230+
if (l_resp_fw_msg.generic_message_resp.msgq != 0x800)
231+
{
232+
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
233+
"firware_request - HBRT to FSP failed - "
234+
"received incorrect msgq");
235+
}
236+
237+
if (l_resp_fw_msg.generic_message_resp.msgType != 0x900)
238+
{
239+
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
240+
"firware_request - HBRT to FSP failed - "
241+
"received incorrect msgType");
242+
}
243+
244+
if (l_resp_fw_msg.generic_message_resp.errPlid != 0xA00)
245+
{
246+
TS_FAIL("FirmwareRequestTest::testFirmwareRequestHbrtToFsp: "
247+
"firware_request - HBRT to FSP failed - "
248+
"received incorrect errPlid");
249+
}
250+
}
251+
TRACFCOMP(g_trac_pnor, EXIT_MRK
252+
"FirmwareRequestTest::testFirmwareRequestHbrtToFsp");
253+
254+
} // end testFirmwareRequestHbrtToFsp
255+
165256
}; // end class FirmwareRequestTest

src/usr/testcore/rtloader/loader.H

Lines changed: 50 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,6 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
724724
hostInterfaces::hbrt_fw_msg* l_resp_fw_msg =
725725
(hostInterfaces::hbrt_fw_msg*) o_resp;
726726

727-
728727
if (*o_respLen < (hostInterfaces::HBRT_FW_MSG_BASE_SIZE +
729728
sizeof(l_resp_fw_msg->resp_generic)))
730729
{
@@ -742,7 +741,7 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
742741
break;
743742
}
744743

745-
TRACFCOMP(g_trac_hbrt, ENTER_MRK
744+
TRACFCOMP(g_trac_hbrt,
746745
"rt_firmware_request for HCODE SCOM update: "
747746
"type:%d, chipId:0x%X, section:%d, "
748747
"operation:%d, scomAddr:0x%X scomData:0x%X",
@@ -753,14 +752,13 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
753752
l_req_fw_msg->req_hcode_update.i_scomAddr,
754753
l_req_fw_msg->req_hcode_update.i_scomData);
755754

756-
l_resp_fw_msg->io_type =
757-
hostInterfaces::HBRT_FW_MSG_TYPE_RESP_GENERIC;
755+
l_resp_fw_msg->io_type =
756+
hostInterfaces::HBRT_FW_MSG_TYPE_RESP_GENERIC;
758757

759-
// dummy return value for testing
760-
l_resp_fw_msg->resp_generic.o_status = 264;
758+
// dummy return value for testing
759+
l_resp_fw_msg->resp_generic.o_status = 264;
761760

762-
TRACFCOMP(g_trac_hbrt, EXIT_MRK"rt_firmware_request");
763-
retVal = 1; // just return 1 for testing
761+
retVal = 1; // just return 1 for testing
764762
}
765763
else if (hostInterfaces::HBRT_FW_MSG_TYPE_ERROR_LOG
766764
== l_req_fw_msg->io_type)
@@ -781,30 +779,67 @@ class RuntimeLoaderTest : public CxxTest::TestSuite
781779
}
782780

783781

784-
TRACFCOMP(g_trac_hbrt, ENTER_MRK
782+
TRACFCOMP(g_trac_hbrt,
785783
"rt_firmware_request for error log: "
786784
"type:%d, plid:0x%08x, size:%d, data:0x%02x",
787785
l_req_fw_msg->io_type,
788786
l_req_fw_msg->error_log.i_plid,
789787
l_req_fw_msg->error_log.i_errlSize,
790788
l_req_fw_msg->error_log.i_data);
791789

792-
l_resp_fw_msg->io_type =
790+
l_resp_fw_msg->io_type =
793791
hostInterfaces::HBRT_FW_MSG_TYPE_RESP_GENERIC;
794792

795-
// dummy return value for testing
796-
l_resp_fw_msg->resp_generic.o_status = 20;
793+
// dummy return value for testing
794+
l_resp_fw_msg->resp_generic.o_status = 20;
795+
796+
retVal = 0; // just return 0 for testing
797+
}
798+
else if (hostInterfaces::HBRT_FW_MSG_HBRT_FSP
799+
== l_req_fw_msg->io_type)
800+
{
801+
if (i_reqLen < (hostInterfaces::HBRT_FW_MSG_BASE_SIZE +
802+
sizeof(l_req_fw_msg->generic_message)))
803+
{
804+
retVal = -EINVAL;
805+
break;
806+
}
797807

798-
TRACFCOMP(g_trac_hbrt, EXIT_MRK"rt_firmware_request");
799-
retVal = 0; // just return 0 for testing
808+
TRACFCOMP(g_trac_hbrt,
809+
"rt_firmware_request for VPD Write Msg: "
810+
"type:0x%.8X, msgq:0x%.8X, VPD type:0x%.8X, data:0x%X",
811+
l_req_fw_msg->io_type,
812+
l_req_fw_msg->generic_message.msgq,
813+
l_req_fw_msg->generic_message.msgType,
814+
l_req_fw_msg->generic_message.data);
815+
816+
l_resp_fw_msg->io_type =
817+
hostInterfaces::HBRT_FW_MSG_HBRT_FSP_RESP;
818+
819+
// random testing data
820+
l_resp_fw_msg->generic_message_resp.msgq = 0x800;
821+
l_resp_fw_msg->generic_message_resp.msgType = 0x900;
822+
l_resp_fw_msg->generic_message_resp.errPlid = 0xA00;
823+
retVal = 0;
824+
825+
TRACFCOMP(g_trac_hbrt,
826+
"rt_firmware_request for VPD Write Msg response: "
827+
"type:0x%.8X, msgq:0x%.8X, msgType:0x%.8X,"
828+
" errPlid:0x%X, retVal=%d",
829+
l_resp_fw_msg->io_type,
830+
l_resp_fw_msg->generic_message_resp.msgq,
831+
l_resp_fw_msg->generic_message_resp.msgType,
832+
l_resp_fw_msg->generic_message_resp.errPlid,
833+
retVal);
800834
}
801835
else
802836
{
803-
TRACFCOMP(g_trac_hbrt, ENTER_MRK
837+
TRACFCOMP(g_trac_hbrt,
804838
"rt_firmware_request an unrecognized request: "
805839
"type:%d", l_req_fw_msg->io_type);
806840
}
807841
} while (0) ;
842+
808843
return retVal;
809844
}
810845

src/usr/vpd/ipvpd.C

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,12 +2063,6 @@ errlHndl_t IpVpdFacade::writeKeyword ( const char * i_keywordName,
20632063
break;
20642064
}
20652065

2066-
// If we are writing both we don't have an FSP, skip the mbox msg
2067-
if ( iv_configInfo.vpdWriteHW )
2068-
{
2069-
break;
2070-
}
2071-
20722066
VPD::VpdWriteMsg_t msgdata;
20732067

20742068
// Quick double-check that our constants agree with the values

0 commit comments

Comments
 (0)