Skip to content

Commit

Permalink
Move NVDIMM operations under NVDIMM modules
Browse files Browse the repository at this point in the history
Makes it easier to find and include NVDIMM operations.
Also makes it easier to exclude from non-nvdimm supported systems.

Change-Id: I870c2246e1bb9201e6e8032f1868e6e4e6a2b91a
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/70489
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: Roland Veloz <rveloz@us.ibm.com>
Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com>
Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com>
  • Loading branch information
mderkse1 authored and dcrowell77 committed Jan 21, 2019
1 parent 868b68d commit ad1c30e
Show file tree
Hide file tree
Showing 26 changed files with 579 additions and 224 deletions.
4 changes: 3 additions & 1 deletion src/build/mkrules/dist.targets.mk
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ COPY_RENAME_FILES = \
hbplugins/prdf/p9_hcd_memmap_base.H:src/import/chips/p9/procedures/hwp/lib/p9_hcd_memmap_base.H:errltool \
hbplugins/prdf/p9_hcd_header_defs.H:src/import/chips/p9/procedures/hwp/lib/p9_hcd_header_defs.H:errltool \
hbplugins/prdf/p9_ppe_defs.H:src/import/chips/p9/procedures/hwp/lib/p9_ppe_defs.H:errltool

#
# Symbolic links created in the target.
#
Expand Down Expand Up @@ -363,6 +363,8 @@ fsp.tar_CONTENTS = \
$(call ROOTPATH_WILDCARD,src/usr/*/plugins/*)) \
$(addsuffix :plugins/,\
$(call ROOTPATH_WILDCARD,src/usr/secureboot/common/plugins/*)) \
$(addsuffix :plugins/,\
$(call ROOTPATH_WILDCARD,src/usr/isteps/nvdimm/plugins/*)) \
src/build/debug/fsp-memdump.sh:src/build/debug/ \
obj/genfiles/hbfw_term_rc.H \
obj/genfiles/srcListing \
Expand Down
5 changes: 5 additions & 0 deletions src/include/usr/i2c/i2cif.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
#define __I2CIF_H
#include <list>

// Handy macros to check i2c ranges
// Pass in an instance of a TARGETING::ATTR_I2C_BUS_SPEED_ARRAY_type
#define I2C_BUS_MAX_ENGINE(var) (sizeof(var)/sizeof(var[0]))
#define I2C_BUS_MAX_PORT(var) (sizeof(var[0])/sizeof(var[0][0]))

namespace I2C
{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/include/usr/i2c/nvdimmif.H $ */
/* $Source: src/include/usr/isteps/nvdimm/nvdimmif.H $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2013,2018 */
/* Contributors Listed Below - COPYRIGHT 2013,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -26,7 +26,7 @@
#define __NVDIMMIF_H

#include <list>
#include "eepromif.H"
#include <i2c/eepromif.H>

namespace NVDIMM
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
/* $Source: src/include/usr/i2c/nvdimmddreasoncodes.H $ */
/* $Source: src/include/usr/isteps/nvdimm/nvdimmreasoncodes.H $ */
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2011,2018 */
/* Contributors Listed Below - COPYRIGHT 2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -23,13 +23,13 @@
/* */
/* IBM_PROLOG_END_TAG */
/**
* @file nvdimmddreasoncodes.H
* @file nvdimmreasoncodes.H
*
* @brief Reason codes and module ids for the NVDIMM device driver
* @brief Reason codes and module ids for the NVDIMM
*
*/
#ifndef __NVDIMMDDREASONCODES_H
#define __NVDIMMDDREASONCODES_H
#ifndef __NVDIMMREASONCODES_H
#define __NVDIMMREASONCODES_H
// -----------------------------------------------
// Includes
// -----------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ RUNTIME_MODULES += sbeio_rt
RUNTIME_MODULES += tod_rt
RUNTIME_MODULES += nestmemutils
RUNTIME_MODULES += imageprocs_rt
RUNTIME_MODULES += $(if $(CONFIG_NVDIMM),nvdimm_rt)

RUNTIME_DATA_MODULES +=
RUNTIME_TESTCASE_MODULES += cxxtest_rt
Expand Down
5 changes: 0 additions & 5 deletions src/usr/i2c/HBconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,3 @@ config TPM_NUVOTON
default y
help
Enable Nuvoton TPM I2C driver

config NVDIMM
default n
help
Enable NVDIMM I2C support
3 changes: 1 addition & 2 deletions src/usr/i2c/eepromdd.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2011,2018 */
/* Contributors Listed Below - COPYRIGHT 2011,2019 */
/* [+] Google Inc. */
/* [+] International Business Machines Corp. */
/* */
Expand Down Expand Up @@ -51,7 +51,6 @@
#include <i2c/i2cif.H>
#include "eepromdd.H"
#include "errlud_i2c.H"
#include <i2c/nvdimmif.H>

// ----------------------------------------------
// Globals
Expand Down
142 changes: 3 additions & 139 deletions src/usr/i2c/errlud_i2c.C
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* Contributors Listed Below - COPYRIGHT 2014,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -23,19 +23,17 @@
/* */
/* IBM_PROLOG_END_TAG */
/**
* @file errlud_fsi.C
* @file errlud_i2c.C
*
* @brief Implementation of classes to log FSI FFDC
* @brief Implementation of classes to log i2c FFDC
*/
#include <string.h> // strlen
#include "errlud_i2c.H"
#include <i2c/i2creasoncodes.H>
#include <i2c/eepromddreasoncodes.H>
#include <i2c/nvdimmddreasoncodes.H>
#include <devicefw/driverif.H>
#include "eepromdd.H"
#include "i2c.H"
#include "nvdimmdd.H"

namespace I2C
{
Expand Down Expand Up @@ -325,137 +323,3 @@ UdEepromParms::~UdEepromParms()
}

} // end EEPROM namespace

namespace NVDIMM
{

//------------------------------------------------------------------------------
// NVDIMM User Details
//------------------------------------------------------------------------------
UdNvdimmParms::UdNvdimmParms( uint8_t i_opType,
TARGETING::Target * i_target,
uint64_t i_buflen,
nvdimm_addr_t &i_i2cInfo )
{
// Set up Ud instance variables
iv_CompId = NVDIMM_COMP_ID;
iv_Version = 3;
iv_SubSection = NVDIMM_UDT_PARAMETERS;

//***** Memory Layout *****
// 1 byte : Op Type Description
// 1 byte : Op Type (DeviceFW::OperationType)
// 4 bytes : Target HUID
// 8 bytes : Length of In/Out Buffer
// 8 bytes : Offset
// 8 bytes : Port
// 8 bytes : Engine
// 8 bytes : Device Address
// 1 byte : Address Size
// 8 bytes : Write Page Size
// 8 bytes : Device Size (in KB)
// 8 bytes : Chip Count
// 8 bytes : Write Cycle Time
// 1 byte : I2C MUX Bus Selector
// N bytes : I2C MUX path in string form

// Cache the MUX path in string form for reference and easy access
char *l_muxPath = i_i2cInfo.i2cMuxPath.toString();

char * l_pBuf = reinterpret_cast<char *>(
reallocUsrBuf(sizeof(uint8_t)*2
+sizeof(uint32_t)
+sizeof(uint64_t)*5
+sizeof(uint8_t)
+sizeof(uint64_t)*4
+sizeof(uint8_t)
+(strlen(l_muxPath) +1) ) );

uint64_t tmp64 = 0;
uint32_t tmp32 = 0;
uint8_t tmp8 = 0;

if( i_opType == DeviceFW::READ )
{
tmp8 = 0;
}
else if( i_opType == DeviceFW::WRITE )
{
tmp8 = 1;
}
else
{
tmp8 = 2;
}
memcpy(l_pBuf, &tmp8, sizeof(tmp8));
l_pBuf += sizeof(tmp8);

tmp8 = i_opType;
memcpy(l_pBuf, &tmp8, sizeof(tmp8));
l_pBuf += sizeof(tmp8);

tmp32 = TARGETING::get_huid(i_target);
memcpy(l_pBuf, &tmp32, sizeof(tmp32));
l_pBuf += sizeof(tmp32);

tmp64 = i_buflen;
memcpy(l_pBuf, &tmp64, sizeof(tmp64));
l_pBuf += sizeof(tmp64);

tmp64 = i_i2cInfo.offset;
memcpy(l_pBuf, &tmp64, sizeof(tmp64));
l_pBuf += sizeof(tmp64);

tmp64 = i_i2cInfo.port;
memcpy(l_pBuf, &tmp64, sizeof(tmp64));
l_pBuf += sizeof(tmp64);

tmp64 = i_i2cInfo.engine;
memcpy(l_pBuf, &tmp64, sizeof(tmp64));
l_pBuf += sizeof(tmp64);

tmp64 = i_i2cInfo.devAddr;
memcpy(l_pBuf, &tmp64, sizeof(tmp64));
l_pBuf += sizeof(tmp64);

tmp8 = static_cast<uint8_t>(i_i2cInfo.addrSize);
memcpy(l_pBuf, &tmp8, sizeof(tmp8));
l_pBuf += sizeof(tmp8);

tmp64 = i_i2cInfo.writePageSize;
memcpy(l_pBuf, &tmp64, sizeof(tmp64));
l_pBuf += sizeof(tmp64);

tmp64 = i_i2cInfo.devSize_KB;
memcpy(l_pBuf, &tmp64, sizeof(tmp64));
l_pBuf += sizeof(tmp64);

tmp64 = i_i2cInfo.chipCount;
memcpy(l_pBuf, &tmp64, sizeof(tmp64));
l_pBuf += sizeof(tmp64);

tmp64 = i_i2cInfo.writeCycleTime;
memcpy(l_pBuf, &tmp64, sizeof(tmp64));
l_pBuf += sizeof(tmp64);

// Begin Version 3 Data
tmp8 = i_i2cInfo.i2cMuxBusSelector;
memcpy(l_pBuf, &tmp8, sizeof(tmp8));
l_pBuf += sizeof(tmp8);

memcpy(l_pBuf, l_muxPath, strlen(l_muxPath));
l_pBuf += strlen(l_muxPath);
l_pBuf = '\0'; // add a terminator for ease of parsing
++l_pBuf;

free(l_muxPath);
l_muxPath = nullptr;
}

//------------------------------------------------------------------------------
UdNvdimmParms::~UdNvdimmParms()
{

}

} // end NVDIMM namespace
40 changes: 2 additions & 38 deletions src/usr/i2c/errlud_i2c.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2014,2018 */
/* Contributors Listed Below - COPYRIGHT 2014,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand Down Expand Up @@ -35,7 +35,7 @@
#include <devicefw/driverif.H>
#include "i2c_common.H"
#include "eepromdd.H"
#include "nvdimmdd.H"


namespace I2C
{
Expand Down Expand Up @@ -112,40 +112,4 @@ class UdEepromParms : public ERRORLOG::ErrlUserDetails

} // end EEPROM namespace

namespace NVDIMM
{
/**
* @class UdNvdimmParms
*
* Adds NVDIMM information to an error log as user detail data
*/
class UdNvdimmParms : public ERRORLOG::ErrlUserDetails
{
public:
/**
* @brief Constructor
*
* @param i_opType Operation Type
* @param i_target Chip being detected/acted upon
* @param i_buflen Length of In/Out Buffer
* @param i_i2cInfo Miscellaneous Parameters
*/
UdNvdimmParms( uint8_t i_opType,
TARGETING::Target * i_target,
uint64_t i_buflen,
nvdimm_addr_t &i_i2cInfo );

/**
* @brief Destructor
*/
virtual ~UdNvdimmParms();

private:
// Disabled
UdNvdimmParms(UdNvdimmParms &);
UdNvdimmParms & operator=(UdNvdimmParms &);
};

} // end NVDIMM namespace

#endif
5 changes: 4 additions & 1 deletion src/usr/i2c/i2c.C
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@
#include <secureboot/service.H>
#include <i2c/eepromif.H>
#include <i2c/tpmddif.H>
#include <i2c/nvdimmif.H>
#include <hwas/common/hwas.H> // HwasState

#ifdef CONFIG_NVDIMM
#include <isteps/nvdimm/nvdimmif.H>
#endif

// ----------------------------------------------
// Globals
// ----------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion src/usr/i2c/i2c.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@
# common objects with runtime
OBJS += eepromdd.o
OBJS += errlud_i2c.o
OBJS += $(if $(CONFIG_NVDIMM),nvdimmdd.o,)
6 changes: 1 addition & 5 deletions src/usr/i2c/i2c_common.H
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* */
/* OpenPOWER HostBoot Project */
/* */
/* Contributors Listed Below - COPYRIGHT 2011,2018 */
/* Contributors Listed Below - COPYRIGHT 2011,2019 */
/* [+] International Business Machines Corp. */
/* */
/* */
Expand All @@ -25,10 +25,6 @@
#ifndef __I2C_COMMON_H
#define __I2C_COMMON_H

// Handy macros to check i2c ranges
// Pass in an instance of a TARGETING::ATTR_I2C_BUS_SPEED_ARRAY_type
#define I2C_BUS_MAX_ENGINE(var) (sizeof(var)/sizeof(var[0]))
#define I2C_BUS_MAX_PORT(var) (sizeof(var[0])/sizeof(var[0][0]))

/**
* @file i2c_common.H
Expand Down
4 changes: 4 additions & 0 deletions src/usr/isteps/nvdimm/HBconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
config NVDIMM
default n
help
Enable NVDIMM support

0 comments on commit ad1c30e

Please sign in to comment.