Skip to content

Commit

Permalink
Force VPD IO through HW (Axone) ,add plat function to get OCMB VPD
Browse files Browse the repository at this point in the history
This commit follows up on previous work that pulled in the code
that can find the correct EFD given a SPD blob of data which has
the DDR SPD and the EFD for the DDIMM. This commit adds ocmb_spd.C
which provides a DeviceFW::SPD read interface for OCBM targets,
and hooks is up to the platform implementation of the FAPI
interface platGetVPD for OCMB target. Also this commit forces all
VPD IO in Axone to go through HW, which will actually read from
the new EEPROM cache in pnor.

RTC: 203718
Change-Id: I270500898c422d4c78daa3b917b1b2e5b049e856
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/72165
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
velozr authored and dcrowell77 committed Mar 8, 2019
1 parent 4470dc3 commit 6e84cce
Show file tree
Hide file tree
Showing 10 changed files with 336 additions and 19 deletions.
18 changes: 16 additions & 2 deletions src/build/configs/simics_axone.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#fetch dimm spd via i2c
# Force DJVPD read/write to use EEPROM layer instead of VPD cache
set DJVPD_READ_FROM_HW
set DJVPD_WRITE_TO_HW
unset DJVPD_READ_FROM_PNOR
unset DJVPD_WRITE_TO_PNOR

# You can enabled MVPD read from HW but adds time to IPL
# Force MEMVPD read/write to PNOR ( No actual hardware )
set MEMVPD_READ_FROM_PNOR
set MEMVPD_WRITE_TO_PNOR
unset MEMVPD_READ_FROM_HW
unset MEMVPD_WRITE_TO_HW

# Force MVPD read/write to use EEPROM layer instead of VPD cache
# (not working because shoddy MVPD currently)
#set MVPD_READ_FROM_HW
#set MVPD_WRITE_TO_HW
set MVPD_READ_FROM_PNOR
set MVPD_WRITE_TO_PNOR


#skip enabling checkstop analysis until OCC is ready in simics
unset IPLTIME_CHECKSTOP_ANALYSIS
Expand Down
3 changes: 2 additions & 1 deletion src/include/usr/fapi2/hwpf_fapi2_reasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace fapi2
MOD_FAPI2_PLAT_GET_CHILDREN_FILTER_TEST = 0x0B,
MOD_FAPI2_GET_TARGETING_ATTR = 0x0C,
MOD_FAPI2_SET_TARGETING_ATTR = 0x0D,
MOD_FAPI2_PLAT_GET_VPD = 0x0E,
MOD_FAPI2_PLAT_GET_VPD_MCS = 0x0E,
MOD_FAPI2_PIB_ERR_MASK = 0x0F,
MOD_FAPI2_PLAT_PARSE_WOF_TABLES = 0x10,
MOD_FAPI2_CVPD_ACCESS = 0x11,
Expand All @@ -67,6 +67,7 @@ namespace fapi2
MOD_FAPI2_SET_ATTR_FREQ_MCA_MHZ = 0x18,
MOD_FAPI2_PLAT_GET_PROC_TEST = 0x19,
MOD_FAPI2_MONITOR_FOR_FSP_MSGS = 0x1A,
MOD_FAPI2_PLAT_GET_VPD_OCMB = 0x1B,
};

/**
Expand Down
38 changes: 34 additions & 4 deletions src/include/usr/fapi2/plat_vpd_access.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2016,2018 */
/* Contributors Listed Below - COPYRIGHT 2016,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -47,9 +47,39 @@ namespace fapi2
/// @note passing nullptr for o_blob will return the size of the keyword

fapi2::ReturnCode platGetVPD(
const fapi2::Target<fapi2::TARGET_TYPE_MCS>& i_target,
VPDInfo<fapi2::TARGET_TYPE_MCS>& io_vpd_info,
uint8_t* o_blob);
const fapi2::Target<fapi2::TARGET_TYPE_MCS>& i_target,
VPDInfo<fapi2::TARGET_TYPE_MCS>& io_vpd_info,
uint8_t* o_blob);

/// @brief Return a blob of memory VPD data associated with the input target
/// If looking for blob to match keyword EFD, then search criteria
/// frequency and master rank must be supplied.
///
/// Platform specific getVPD implmentation for OCMB_CHIP target type
///
/// @param[in] i_target, a valid fapi2 OCMB_CHIP target
/// @param[in] io_vpd_info, fapi2::VPDInfo class that specifies the criteria of
//// the desired data to be returned and meta data about returned data
/// @param[in] io_vpd_info.iv_vpd_type, currently only keyword EFD supported
/// @param[in/out] io_vpd_info.iv_size, as in param - the size of the keyword
/// as an out param - size of keyword if o_blob is a nullptr
/// @param[in] io_vpd_info.iv_omi_freq_mhz, frequency of attached OMI bus
/// @param[in] io_vpd_info.iv_rank_count, number of master ranks
/// @param[in] io_vpd_info.iv_is_config_ffdc_enabled, flag to collect FFDC or not
/// @param[out] io_vpd_info.iv_efd_type, type of DDIMM SPD
/// @param[out] io_vpd_info.iv_dmb_mfg_id, buffer manufacturer
/// @param[out] io_vpd_info.iv_dmb_revision, buffer revision
/// @param[out] io_vpd_info.iv_ddr_mode, DDR4 or DDR5
/// @param[out] o_blob, the blob of raw data from the vpd
/// @return FAPI2_RC_SUCCESS if there's no problem
/// @note The size of returned data may be less than or equal to the initial value of iv_size.
/// The value of iv_size will be adjusted to match the actual size of the returned data.
/// @note If data is returned for o_blob (EFD), it will be in little endian
/// @note passing nullptr for o_blob will return the size of the keyword
fapi2::ReturnCode platGetVPD(
const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_target,
VPDInfo<fapi2::TARGET_TYPE_OCMB_CHIP>& io_vpd_info,
uint8_t* o_blob);

};
#endif // _FAPI2_PLAT_VPDACCESS_H_
5 changes: 5 additions & 0 deletions src/include/usr/vpd/spdenums.H
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ enum
SPD_FIRST_MOD_SPEC = 0x8000,
};

enum
{
OCMB_SPD_EFD_COMBINED_SIZE = 0x800 // 2 KB
};

/**
* @brief Enumerations for fields that can be accessed in the SPD
*/
Expand Down
3 changes: 3 additions & 0 deletions src/include/usr/vpd/vpdreasoncodes.H
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ enum vpdModuleId
VPD_FILL_I2C_LOCK_MSG = 0x86,
// Centaur FRU VPD

// OCMB SPD
VPD_OCMB_GET_SPD = 0x90,


};

Expand Down
1 change: 1 addition & 0 deletions src/usr/fapi2/fapi2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ OBJS += plat_mmio_access.o
include ${ROOTPATH}/procedure.rules.mk

include ${HWP_PATH_1}/hwp/accessors/p9_get_mem_vpd_keyword.mk
include ${HWP_PATH_1}/hwp/accessors/ddimm_get_efd.mk

#EKB Objects (mirrored in src/import)
OBJS += error_info.o
Expand Down
122 changes: 114 additions & 8 deletions src/usr/fapi2/plat_vpd_access.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2012,2018 */
/* Contributors Listed Below - COPYRIGHT 2012,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -33,9 +33,11 @@
#include <vpd_access_defs.H>
#include <vpd_access.H>
#include <p9_get_mem_vpd_keyword.H>
#include <ddimm_get_efd.H>
#include <attribute_service.H>
#include <vpd/dvpdenums.H>
#include <errl/errlmanager.H>
#include <fapi2_spd_access.H>
//The following can be uncommented for unit testing
//#undef FAPI_DBG
//#define FAPI_DBG(args...) FAPI_INF(args)
Expand Down Expand Up @@ -79,7 +81,7 @@ fapi2::ReturnCode platGetVPD(
VPD_KEYWORD_SIZE);
/*@
* @errortype
* @moduleid fapi2::MOD_FAPI2_PLAT_GET_VPD
* @moduleid fapi2::MOD_FAPI2_PLAT_GET_VPD_MCS
* @reasoncode fapi2::RC_BUFFER_TOO_SMALL
* @userdata1 Buffer size
* @userdata2 Expected size
Expand All @@ -88,7 +90,7 @@ fapi2::ReturnCode platGetVPD(
*/
l_errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
fapi2::MOD_FAPI2_PLAT_GET_VPD,
fapi2::MOD_FAPI2_PLAT_GET_VPD_MCS,
fapi2::RC_BUFFER_TOO_SMALL,
io_vpd_info.iv_size,
VPD_KEYWORD_SIZE,
Expand Down Expand Up @@ -184,7 +186,7 @@ fapi2::ReturnCode platGetVPD(
io_vpd_info.iv_vpd_type);
/*@
* @errortype
* @moduleid fapi2::MOD_FAPI2_PLAT_GET_VPD
* @moduleid fapi2::MOD_FAPI2_PLAT_GET_VPD_MCS
* @reasoncode fapi2::RC_INVALID_TYPE
* @userdata1 Vpd type
* @userdata2 HUID of MCS target
Expand All @@ -193,8 +195,8 @@ fapi2::ReturnCode platGetVPD(
*/
l_errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
fapi2::MOD_FAPI2_PLAT_GET_VPD,
fapi2::RC_BUFFER_TOO_SMALL,
fapi2::MOD_FAPI2_PLAT_GET_VPD_MCS,
fapi2::RC_INVALID_TYPE,
io_vpd_info.iv_vpd_type,
TARGETING::get_huid(l_pMcsTarget),
true); //software callout
Expand Down Expand Up @@ -298,7 +300,7 @@ fapi2::ReturnCode platGetVPD(
io_vpd_info.iv_size);
/*@
* @errortype
* @moduleid fapi2::MOD_FAPI2_PLAT_GET_VPD
* @moduleid fapi2::MOD_FAPI2_PLAT_GET_VPD_MCS
* @reasoncode fapi2::RC_RETURNED_VPD_TOO_SMALL
* @userdata1[0:31] Returned vpd in bytes
* @userdata1[32:64] Expected number of vpd bytes
Expand All @@ -308,7 +310,7 @@ fapi2::ReturnCode platGetVPD(
*/
l_errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
fapi2::MOD_FAPI2_PLAT_GET_VPD,
fapi2::MOD_FAPI2_PLAT_GET_VPD_MCS,
fapi2::RC_RETURNED_VPD_TOO_SMALL,
TWO_UINT32_TO_UINT64(
l_buffSize,
Expand All @@ -334,4 +336,108 @@ fapi2::ReturnCode platGetVPD(
return l_rc;
}

fapi2::ReturnCode platGetVPD(
const fapi2::Target<fapi2::TARGET_TYPE_OCMB_CHIP>& i_ocmbFapi2Target,
VPDInfo<fapi2::TARGET_TYPE_OCMB_CHIP>& io_vpdInfo,
uint8_t* const o_blob)
{
FAPI_DBG("platGetVPD(OCMB): enter");

fapi2::ReturnCode l_rc{fapi2::FAPI2_RC_SUCCESS};

errlHndl_t l_errl = nullptr;

// Set up buffer we will read first 2KB of OCMB's eeprom to
// 1st KB is SPD info, 2nd KB is EFD info. Both are needed.
size_t l_spdBufferSize = SPD::OCMB_SPD_EFD_COMBINED_SIZE;
uint8_t* l_spdBuffer = nullptr;

do
{
// Get targeting OCMB target
TARGETING::Target * l_ocmbTarget = nullptr;
l_errl = fapi2::platAttrSvc::getTargetingTarget(i_ocmbFapi2Target,
l_ocmbTarget);
if (l_errl)
{
FAPI_ERR("platGetVPD(OCMB): Error from getTargetingTarget");
break; //return with error
}

// Retrieve the EFD data or the EFD data size if o_blob is NULL
if (fapi2::EFD == io_vpdInfo.iv_vpd_type)
{
// Allocate buffer to hold SPD and init to 0
l_spdBuffer = new uint8_t[l_spdBufferSize];
memset(l_spdBuffer, 0, l_spdBufferSize);

// Get the SPD buffer, where the EFD data is to be extracted from
// "ENTIRE_SPD" for OCMB target is first 2 KB of EEPROM
l_errl = deviceRead(l_ocmbTarget,
l_spdBuffer,
l_spdBufferSize,
DEVICE_SPD_ADDRESS(SPD::ENTIRE_SPD));

// If unable to retrieve the SPD buffer then can't
// extract the EFD data, so return error.
if (l_errl)
{
FAPI_ERR("platGetVPD(OCMB): Error from trying to read ENTIRE SPD from 0x%.08X ",
TARGETING::get_huid(l_ocmbTarget));
break;
}

// Retrieve the EFD data from the given SPD buffer.
// if o_blob is nullptr then size will be returned in io_vpdInfo.iv_size
FAPI_EXEC_HWP( l_rc,
ddimm_get_efd,
i_ocmbFapi2Target,
io_vpdInfo,
o_blob,
l_spdBuffer,
l_spdBufferSize );
if (l_rc)
{
FAPI_ERR("platGetVPD(OCMB): Error returned from ddimm_get_efd called on target 0x%.08X",
TARGETING::get_huid(l_ocmbTarget));
}
} // end if (fapi2::EFD == io_vpdInfo.iv_vpd_type)
else
{
/*@
* @errortype
* @moduleid fapi2::MOD_FAPI2_PLAT_GET_VPD_OCMB
* @reasoncode fapi2::RC_INVALID_TYPE
* @userdata1 vpd_type attempted
* @userdata2 HUID of OCMB target
* @devdesc Less than expected number of bytes returned.
* @custdesc Firmware Error
*/
l_errl = new ERRORLOG::ErrlEntry(
ERRORLOG::ERRL_SEV_UNRECOVERABLE,
fapi2::MOD_FAPI2_PLAT_GET_VPD_OCMB,
fapi2::RC_INVALID_TYPE,
io_vpdInfo.iv_vpd_type,
TARGETING::get_huid(l_ocmbTarget),
ERRORLOG::ErrlEntry::ADD_SW_CALLOUT);
}
} while (0);

// Caller is not interested in the SPD buffer, so delete it.
if (l_spdBuffer)
{
delete []l_spdBuffer;
l_spdBuffer = nullptr;
}

if ( l_errl )
{
l_rc.setPlatDataPtr(reinterpret_cast<void *> (l_errl));
}

FAPI_DBG("platGetVPD(OCMB): exit");

return l_rc;
}

} // namespace
3 changes: 2 additions & 1 deletion src/usr/vpd/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2013,2018
# Contributors Listed Below - COPYRIGHT 2013,2019
# [+] International Business Machines Corp.
#
#
Expand All @@ -31,6 +31,7 @@ include vpd.mk
#include unique objects
OBJS += vpd.o
OBJS += dimmPres.o
OBJS += ocmb_spd.o
OBJS += rtvpd_load.o

SUBDIRS += test.d
Expand Down

0 comments on commit 6e84cce

Please sign in to comment.