Skip to content

Commit

Permalink
Support periodic timer
Browse files Browse the repository at this point in the history
This timer will be sued to toggle EI bus after every 24 hours.

Change-Id: Id21af317914ddfb02d42a166bc7c0b6ce62bffdd
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/60777
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: RAJA DAS <rajadas2@in.ibm.com>
Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
(cherry picked from commit 4fe7e7c6520087ec1416e332be2b0b8ca85574d4)
Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/48096
  • Loading branch information
Shakeebbk authored and sgupta2m committed Jun 20, 2018
1 parent 5d80e11 commit 9f90433
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 7 deletions.
7 changes: 6 additions & 1 deletion src/build/img_defs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ ifndef NEST_SRCDIR
export NEST_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/nest
endif

ifndef IO_SRCDIR
export IO_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/io
endif

ifndef PM_SRCDIR
export PM_SRCDIR = $(IMPORT_SRCDIR)/chips/p9/procedures/hwp/pm
endif
Expand Down Expand Up @@ -184,7 +188,7 @@ export P9_XIP_BINDIR = $(BASE_OBJDIR)/xip
endif

ifndef IMG_INCLUDES
export IMG_INCLUDES = -I$(IMAGEPROCS_COMMON_SRCDIR) -I$(IMAGEPROCS_P9_SRCDIR) -I$(IMAGEPROCS_CEN_SRCDIR) -I$(P9_XIP_SRCDIR) -I$(BUILD_DIR) -I$(CACHE_SRCDIR) -I$(UTILS_SRCDIR) -I$(CORE_SRCDIR) -I$(PERV_SRCDIR) -I$(NEST_SRCDIR) -I$(PM_SRCDIR) -I$(INITFILES_SRCDIR) -I$(HWPLIB_SRCDIR) -I$(HWPFFDC_SRCDIR)
export IMG_INCLUDES = -I$(IMAGEPROCS_COMMON_SRCDIR) -I$(IMAGEPROCS_P9_SRCDIR) -I$(IMAGEPROCS_CEN_SRCDIR) -I$(P9_XIP_SRCDIR) -I$(BUILD_DIR) -I$(CACHE_SRCDIR) -I$(UTILS_SRCDIR) -I$(CORE_SRCDIR) -I$(PERV_SRCDIR) -I$(NEST_SRCDIR) -I$(IO_SRCDIR) -I$(PM_SRCDIR) -I$(INITFILES_SRCDIR) -I$(HWPLIB_SRCDIR) -I$(HWPFFDC_SRCDIR)
endif

ifndef BOOT_OBJDIR
Expand Down Expand Up @@ -378,6 +382,7 @@ GCC-DEFS += -DPLAT_NO_THREAD_LOCAL_STORAGE=1
# disable assert
GCC-DEFS += -DNDEBUG
GCC-DEFS += -DHOST_INTERFACE_AVAILABLE=$(HOST_INTERFACE_AVAILABLE)
GCC-DEFS += -DPERIODIC_IO_TOGGLE_SUPPORTED=$(PERIODIC_IO_TOGGLE_SUPPORTED)

# use the default settings in the code unless a size is defined
ifdef PK_TRACE_SZ
Expand Down
2 changes: 1 addition & 1 deletion src/build/import_hwp_mk/power/istepmpipl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export SUB_OBJDIR = /$(IMPORT_OBJDIR)/istepmpipl
include img_defs.mk
include istepmpiplfiles.mk

export VPATH = $(PERV_SRCDIR):$(NEST_SRCDIR):$(CACHE_SRCDIR):$(CORE_SRCDIR):$(PM_SRCDIR):$(INITFILES_SRCDIR):$(HWPLIB_SRCDIR)
export VPATH = $(PERV_SRCDIR):$(NEST_SRCDIR):$(IO_SRCDIR):$(CACHE_SRCDIR):$(CORE_SRCDIR):$(PM_SRCDIR):$(INITFILES_SRCDIR):$(HWPLIB_SRCDIR)

OBJSISTEPMPIPL := $(addprefix $(OBJDIR-ISTEPMPIPL)/, $(ISTEPMPIPL_OBJECTS))

Expand Down
2 changes: 2 additions & 0 deletions src/build/import_hwp_mk/power/istepmpipl/istepmpiplfiles.mk
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ ISTEPMPIPL-CPP-SOURCES +=p9_query_cache_access_state.C
ISTEPMPIPL-CPP-SOURCES += p9_sbe_fastarray_abist_catchup.C
ISTEPMPIPL-CPP-SOURCES += p9_sbe_fastarray_cleanup.C
ISTEPMPIPL-CPP-SOURCES += p9_sbe_fastarray_setup.C
# io eol toggle procedure moved here to locate it on seeprom
ISTEPMPIPL-CPP-SOURCES += p9_sbe_io_eol_toggle.C
ISTEPMPIPL-C-SOURCES =
ISTEPMPIPL-S-SOURCES =

Expand Down
1 change: 1 addition & 0 deletions src/build/power_defs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SBE_TRACE_LEVEL_DEF = 2
FAPI_TRACE_LEVEL_DEF = 2

HOST_INTERFACE_AVAILABLE = 1
PERIODIC_IO_TOGGLE_SUPPORTED = 1

export SBE_S0_SUPPORT = 1

Expand Down
1 change: 1 addition & 0 deletions src/sbefw/core/sbe_sp_intf.H
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ enum sbeSecondaryResponse
SBE_SEC_S0_START_MPIPL_FAILED = 0x24,
SBE_SEC_S0_STOP_CLOCK_FAILED = 0x25,
SBE_SEC_S0_CONTINUE_MPIPL_FAILED = 0x26,
SBE_SEC_PERIODIC_IO_TOGGLE_FAILED = 0x27,
};

/**
Expand Down
44 changes: 39 additions & 5 deletions src/sbefw/core/sbecmdprocessor.C
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,18 @@
#include "sbeglobals.H"
#include "core/chipop_handler.H"
#include "core/ipl.H"
#include "sbeFFDC.H"

#ifdef _S0_
#include "sbes0handler.H"
#endif

#if PERIODIC_IO_TOGGLE_SUPPORTED
#include "p9_sbe_io_eol_toggle.H"
#endif

const uint32_t PERIODIC_TIMER_INTERVAL_MS = 24*60*60*1000; // 24 hours

using namespace fapi2;

// Forward declaration for performAttrSetup
Expand Down Expand Up @@ -418,18 +425,45 @@ void sbeSyncCommandProcessor_routine(void *i_pArg)
#endif
} while(true); // Thread always exists
SBE_EXIT(SBE_FUNC);
#undef SBE_FUNC
}

//////////////////////////////////////////////////////
//////////////////////////////////////////////////////
void sbeAsyncCommandProcessor_routine(void *arg)
{
SBE_INFO("sbeAsyncCommandProcessor Thread started");

#define SBE_FUNC "sbeAsyncCommandProcessor"
SBE_INFO(SBE_FUNC " Thread started");
#if PERIODIC_IO_TOGGLE_SUPPORTED
do
{
// @TODO RTC via : 130392
// Add infrastructure for host interface
// Since currently there is only one async job
// - IO EOL toggle, this task runs every
// PERIODIC_TIMER_INTERVAL_MS and performs the
// operation. Modify this implementation by introducing job
// queue, if there are more asynchronous jobs.
int l_rcPk = pk_semaphore_pend (
&SBE_GLOBAL->sbeSemAsyncProcess,
PK_MILLISECONDS(PERIODIC_TIMER_INTERVAL_MS));
// PK API failure
if ((-l_rcPk) != PK_SEMAPHORE_PEND_TIMED_OUT)
{
SBE_ERROR(SBE_FUNC" pk_semaphore_pend failed, "
"l_rcPk=-%04x", -l_rcPk );
// Ignore the failure
}

} while(0);
ReturnCode rc = FAPI2_RC_SUCCESS;
Target<TARGET_TYPE_PROC_CHIP > proc = plat_getChipTarget();
SBE_EXEC_HWP(rc, p9_sbe_io_eol_toggle, proc)
if (rc != FAPI2_RC_SUCCESS)
{
SBE_ERROR(SBE_FUNC " p9_sbe_io_eol_toggle failed");
// SBE async ffdc
captureAsyncFFDC(SBE_PRI_GENERIC_EXECUTION_FAILURE,
SBE_SEC_PERIODIC_IO_TOGGLE_FAILED);
}
} while(1);
#endif // PERIODIC_IO_TOGGLE_SUPPORTED
#undef SBE_FUNC
}
10 changes: 10 additions & 0 deletions src/sbefw/core/sbeglobals.H
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ class SBEGlobalsSingleton
*
*/
PkSemaphore sbeSemCmdProcess;

/**
* @brief Global semaphore for async task
*
* This is used to send invoke commands on Async process
*
*/
PkSemaphore sbeSemAsyncProcess;

sbeRole SBERole;
// SBE Frequency. Initially nest frequency is 133 MHZ
uint32_t sbefreq;
Expand Down Expand Up @@ -138,6 +147,7 @@ class SBEGlobalsSingleton
sbeIntrSource(),
sbeSemCmdRecv(),
sbeSemCmdProcess(),
sbeSemAsyncProcess(),
SBERole(SBE_ROLE_MASTER),
sbefreq(( 133 * 1000 * 1000)/SBE::SBE_TO_NEST_FREQ_FACTOR),
sbeFWSecurityEnabled(1)
Expand Down
9 changes: 9 additions & 0 deletions src/sbefw/core/sbemain.C
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
// Max defines for Semaphores
static uint32_t MAX_SEMAPHORE_COUNT = 3;

// As periodic timer expire in 24 hours count should never
// be more than 1.
static uint32_t MAX_PERIODIC_TIMER_SEMAPHORE_COUNT = 1;
extern "C"
{
// These variables are declared in linker script to keep track of
Expand Down Expand Up @@ -119,6 +122,12 @@ uint32_t sbeInitSems(void)
{
break;
}
l_rc = pk_semaphore_create(&SBE_GLOBAL->sbeSemAsyncProcess, 0,
MAX_PERIODIC_TIMER_SEMAPHORE_COUNT);
if (l_rc)
{
break;
}
} while (false);

if (l_rc)
Expand Down

0 comments on commit 9f90433

Please sign in to comment.