Skip to content

Commit

Permalink
pnor: Introduce an IPMI-based PNOR driver implementation
Browse files Browse the repository at this point in the history
Similar to the AST MBOX implementation, the IPMI PNOR implementation
negotiates the layout of the LPC FW space with the BMC, but using IPMI
rather than the AST mailbox as a protocol transport. The same protocol
is still used and has simply been adapted to the new interface.

Note that currently the change of transport has had a 2-3x impact on
boot performance. Optimisation is an ongoing effort.

Change-Id: I7f838f5b5e88ac877a725386a33df58ee5e7213c
Signed-off-by: Andrew Jeffery <andrewrj@au1.ibm.com>
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/65942
Tested-by: Jenkins Server <pfd-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: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
Andrew Jeffery authored and dcrowell77 committed Oct 10, 2018
1 parent 4874662 commit c829113
Show file tree
Hide file tree
Showing 11 changed files with 1,270 additions and 21 deletions.
7 changes: 7 additions & 0 deletions src/include/usr/ipmi/ipmiif.H
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ namespace IPMI
inline const command_t pnor_response(void)
{ return std::make_pair(NETFUN_IBM, 0x08); }

inline const command_t hiomap_event(void)
{ return std::make_pair(NETFUN_IBM, 0x0f); }

// $TODO RTC:123256 - need to add code to get dcmi capabilities
// This is a dcmi message used to request the
// user defined power limit from the BMC.
Expand All @@ -307,6 +310,10 @@ namespace IPMI
inline const command_t test_drop(void)
{ return std::make_pair(NETFUN_APP, 0x3e); }

// IPMI PNOR
inline const command_t pnor_hiomap_request(void)
{ return std::make_pair(NETFUN_IBM, 0x5a); }

/**
* Send message asynchronously
* @param[in] i_cmd, the network function and command
Expand Down
7 changes: 5 additions & 2 deletions src/include/usr/pnor/pnor_reasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ namespace PNOR

// ast_mboxdd.C
MOD_ASTMBOXDD_DO_MESSAGE = 0xE0, /**< astMbox::doMessage */

// pnor_ipmidd.C
MOD_IPMIPNORDD_SEND_MESSAGE = 0xF0, /**< PnorDD::sendMessage */
};

enum PNORReasonCode
Expand Down Expand Up @@ -177,8 +180,8 @@ namespace PNOR
RC_BASE_EXT_MISMATCH = PNOR_COMP_ID | 0x2F,
RC_KEY_TRAN_FLAG_UNSET = PNOR_COMP_ID | 0x30,
RC_BAD_SECURE_MAGIC_NUM = PNOR_COMP_ID | 0x31,
RC_MBOX_BAD_SEQUENCE = PNOR_COMP_ID | 0x32,
RC_MBOX_ERROR_STATUS = PNOR_COMP_ID | 0x33,
RC_HIOMAP_BAD_SEQUENCE = PNOR_COMP_ID | 0x32,
RC_HIOMAP_ERROR_STATUS = PNOR_COMP_ID | 0x33,
RC_UNSIGNED_PNOR_SECTION = PNOR_COMP_ID | 0x34,
RC_NOT_A_LOADED_SECTION = PNOR_COMP_ID | 0x35,
RC_NOT_A_SUPPORTED_SECTION = PNOR_COMP_ID | 0x36,
Expand Down
16 changes: 12 additions & 4 deletions src/usr/ipmibase/ipmirp.C
Original file line number Diff line number Diff line change
Expand Up @@ -598,23 +598,31 @@ void IpmiRP::execute(void)
// bottom of this loop will start the transmit process.
// Be sure to push_back to ensure ordering of transmission.
case IPMI::MSG_STATE_SEND:
if (!l_shutdown_pending)
{
IPMI::Message* l_ipmi_msg =
static_cast<IPMI::Message*>(msg->extra_data);
const IPMI::command_t l_pnor = IPMI::pnor_hiomap_request();
bool l_is_pnor = (l_ipmi_msg->iv_netfun == l_pnor.first &&
l_ipmi_msg->iv_cmd == l_pnor.second);
IPMI_TRAC(WARN_MRK "Got message (0x%x:0x%x): l_is_pnor: %d",
l_ipmi_msg->iv_netfun, l_ipmi_msg->iv_cmd, l_is_pnor);
/* PNOR requests always allowed, else we hang shutdown */
if (!l_shutdown_pending || l_is_pnor)
{
iv_sendq.push_back(msg);
}
// shutting down, do not accept new messages
else
{
IPMI_TRAC(WARN_MRK "IPMI shutdown pending. Message dropped");
IPMI::Message* ipmi_msg =
static_cast<IPMI::Message*>(msg->extra_data);
response(ipmi_msg, IPMI::CC_BADSTATE);
response(l_ipmi_msg, IPMI::CC_BADSTATE);
msg_free(msg);
}
break;

// State changes from the IPMI hardware. These are async
// messages so we get rid of them here.
}
case IPMI::MSG_STATE_IDLE:
msg_free(msg);
// No-op - we do it at the bottom of the loop.
Expand Down
10 changes: 8 additions & 2 deletions src/usr/pnor/HBconfig
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
config PNORDD_IS_SFC
default y
depends on !PNORDD_IS_BMCMBOX
depends on !PNORDD_IS_BMCMBOX && !PNORDD_IS_IPMI
help
The Serial Flash Controller is based on the SFC backends

config PNORDD_IS_BMCMBOX
default n
depends on !PNORDD_IS_SFC
depends on !PNORDD_IS_SFC && !PNORDD_IS_IPMI
help
The Serial Flash Controller is using the MBOX BMC protocol

config PNORDD_IS_IPMI
default n
depends on !PNORDD_IS_SFC && !PNORDD_IS_BMCMBOX
help
The Serial Flash Controller is managed via IPMI

config SFC_IS_IBM_DPSS
default n
depends on !SFC_IS_AST2400 && !SFC_IS_FAKE && !SFC_IS_AST2500 && PNORDD_IS_SFC
Expand Down
8 changes: 4 additions & 4 deletions src/usr/pnor/ast_mboxdd.C
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ errlHndl_t astMbox::doMessage(mboxMessage& io_msg)
/*@
* @errortype
* @moduleid PNOR::MOD_ASTMBOXDD_DO_MESSAGE
* @reasoncode PNOR::RC_MBOX_BAD_SEQUENCE
* @reasoncode PNOR::RC_HIOMAP_BAD_SEQUENCE
* @userdata1[48:55] mbox status 1 reg
* @userdata1[56:63] mbox flag reg
* @userdata2[32:39] original command code
Expand All @@ -254,7 +254,7 @@ errlHndl_t astMbox::doMessage(mboxMessage& io_msg)
*/
l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
PNOR::MOD_ASTMBOXDD_DO_MESSAGE,
PNOR::RC_MBOX_BAD_SEQUENCE,
PNOR::RC_HIOMAP_BAD_SEQUENCE,
TWO_UINT8_TO_UINT16(l_stat1, l_flags),
FOUR_UINT8_TO_UINT32(old_cmd,
io_msg.iv_cmd,
Expand Down Expand Up @@ -282,7 +282,7 @@ errlHndl_t astMbox::doMessage(mboxMessage& io_msg)
/*@
* @errortype
* @moduleid PNOR::MOD_ASTMBOXDD_DO_MESSAGE
* @reasoncode PNOR::RC_MBOX_ERROR_STATUS
* @reasoncode PNOR::RC_HIOMAP_ERROR_STATUS
* @userdata1[48:55] mbox status 1 reg
* @userdata1[56:63] mbox flag reg
* @userdata2[32:39] original command code
Expand All @@ -295,7 +295,7 @@ errlHndl_t astMbox::doMessage(mboxMessage& io_msg)
*/
l_err = new ERRORLOG::ErrlEntry(ERRORLOG::ERRL_SEV_UNRECOVERABLE,
PNOR::MOD_ASTMBOXDD_DO_MESSAGE,
PNOR::RC_MBOX_ERROR_STATUS,
PNOR::RC_HIOMAP_ERROR_STATUS,
TWO_UINT8_TO_UINT16(l_stat1, l_flags),
FOUR_UINT8_TO_UINT32(old_cmd,
io_msg.iv_cmd,
Expand Down
3 changes: 2 additions & 1 deletion src/usr/pnor/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2011,2017
# Contributors Listed Below - COPYRIGHT 2011,2018
# [+] Google Inc.
# [+] International Business Machines Corp.
#
Expand Down Expand Up @@ -33,6 +33,7 @@ OBJS += $(if $(CONFIG_SECUREBOOT),spnorrp.o)
OBJS += $(if $(CONFIG_PNORDD_IS_SFC),pnordd.o)
OBJS += $(if $(CONFIG_PNORDD_IS_BMCMBOX),ast_mboxdd.o)
OBJS += $(if $(CONFIG_PNORDD_IS_BMCMBOX),pnor_mboxdd.o)
OBJS += $(if $(CONFIG_PNORDD_IS_IPMI),pnor_ipmidd.o)
OBJS += pnor_common.o
OBJS += pnorvalid.o
OBJS += ecc.o
Expand Down

0 comments on commit c829113

Please sign in to comment.