summaryrefslogtreecommitdiffstats
path: root/src/sbefw/core/sbemain.C
diff options
context:
space:
mode:
authorspashabk-in <shakeebbk@in.ibm.com>2018-04-16 01:51:22 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2018-06-01 23:26:33 -0400
commitc1da4a458459a9ab8a09421069d42f3154bd3792 (patch)
tree76ec6db75e66eec61ebc9818b8f037a3209438d0 /src/sbefw/core/sbemain.C
parent13c1572a60e09a4e2e39ed951edaa246af30e37a (diff)
downloadtalos-sbe-c1da4a458459a9ab8a09421069d42f3154bd3792.tar.gz
talos-sbe-c1da4a458459a9ab8a09421069d42f3154bd3792.zip
Handle hreset of SBE
Figure out hreset from l1 loader, and if it is hreset avoid l2 loader and instead jump to kernel boot. In kernel boot - avoid contructor calls and any intialization RTC: 165477 Change-Id: Ia10c83dd7c15fb5115964cba315fbedfe10a636e Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/57246 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>
Diffstat (limited to 'src/sbefw/core/sbemain.C')
-rw-r--r--src/sbefw/core/sbemain.C118
1 files changed, 65 insertions, 53 deletions
diff --git a/src/sbefw/core/sbemain.C b/src/sbefw/core/sbemain.C
index e49fc029..bc84739b 100644
--- a/src/sbefw/core/sbemain.C
+++ b/src/sbefw/core/sbemain.C
@@ -5,7 +5,8 @@
/* */
/* OpenPOWER sbe Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2015,2017 */
+/* Contributors Listed Below - COPYRIGHT 2015,2018 */
+/* [+] International Business Machines Corp. */
/* */
/* */
/* Licensed under the Apache License, Version 2.0 (the "License"); */
@@ -67,21 +68,29 @@ extern uint64_t _sbss_end __attribute__ ((section (".sbss")));
// false in future.
void __eabi()
{
- // Initialise sbss section
- uint64_t *startAddr = &_sbss_start;
- while ( startAddr != &_sbss_end )
- {
- *startAddr = 0;
- startAddr++;
- }
-
- // Call global constructors
- void(**ctors)() = &ctor_start_address;
- while( ctors != &ctor_end_address)
+ do
{
- (*ctors)();
- ctors++;
- }
+ SBE_GLOBAL->isHreset = SBE::isHreset();
+ if (SBE_GLOBAL->isHreset)
+ {
+ // skip constructors
+ break;
+ }
+ // Initialise sbss section
+ uint64_t *startAddr = &_sbss_start;
+ while ( startAddr != &_sbss_end )
+ {
+ *startAddr = 0;
+ startAddr++;
+ }
+ // Call global constructors
+ void(**ctors)() = &ctor_start_address;
+ while( ctors != &ctor_end_address)
+ {
+ (*ctors)();
+ ctors++;
+ }
+ } while (false);
}
} // end extern "C"
@@ -289,47 +298,50 @@ uint32_t main(int argc, char **argv)
break;
}
- // TODO via RTC 126146.
- // Check if we should call plat_TargetsInit in some other thread.
- // We may want to keep only PK init in main and can move
- // plat init to some other thread. Only if this is required by more
- // than one thread and there can be some race condition, we will
- // keep it here before starting other threads.
- fapi2::ReturnCode fapiRc = fapi2::plat_TargetsInit();
- if( fapiRc != fapi2::FAPI2_RC_SUCCESS )
- {
- SBE_ERROR(SBE_FUNC"plat_TargetsInit failed");
- (void)SbeRegAccess::theSbeRegAccess().
- stateTransition(SBE_FAILURE_EVENT);
- // Hard Reset SBE to recover
- break;
- }
-
- fapiRc = fapi2::plat_AttrInit();
- if(fapiRc != fapi2::FAPI2_RC_SUCCESS)
+ if (!SBE_GLOBAL->isHreset)
{
- SBE_ERROR(SBE_FUNC"plat_AttrInit failed");
- (void)SbeRegAccess::theSbeRegAccess().
- stateTransition(SBE_FAILURE_EVENT);
- // Hard Reset SBE to recover
- break;
- }
-
- if(SbeRegAccess::theSbeRegAccess().init())
- {
- SBE_ERROR(SBE_FUNC"Failed to initialize SbeRegAccess.");
- // init failure could mean the below will fail too, but attempt it
- // anyway
- (void)SbeRegAccess::theSbeRegAccess().stateTransition(
- SBE_FAILURE_EVENT);
- // Hard Reset SBE to recover
- break;
+ // TODO via RTC 126146.
+ // Check if we should call plat_TargetsInit in some other thread.
+ // We may want to keep only PK init in main and can move
+ // plat init to some other thread. Only if this is required by more
+ // than one thread and there can be some race condition, we will
+ // keep it here before starting other threads.
+ fapi2::ReturnCode fapiRc = fapi2::plat_TargetsInit();
+ if( fapiRc != fapi2::FAPI2_RC_SUCCESS )
+ {
+ SBE_ERROR(SBE_FUNC"plat_TargetsInit failed");
+ (void)SbeRegAccess::theSbeRegAccess().
+ stateTransition(SBE_FAILURE_EVENT);
+ // Hard Reset SBE to recover
+ break;
+ }
+
+ fapiRc = fapi2::plat_AttrInit();
+ if(fapiRc != fapi2::FAPI2_RC_SUCCESS)
+ {
+ SBE_ERROR(SBE_FUNC"plat_AttrInit failed");
+ (void)SbeRegAccess::theSbeRegAccess().
+ stateTransition(SBE_FAILURE_EVENT);
+ // Hard Reset SBE to recover
+ break;
+ }
+
+ if(SbeRegAccess::theSbeRegAccess().init())
+ {
+ SBE_ERROR(SBE_FUNC"Failed to initialize SbeRegAccess.");
+ // init failure could mean the below will fail too, but attempt it
+ // anyway
+ (void)SbeRegAccess::theSbeRegAccess().stateTransition(
+ SBE_FAILURE_EVENT);
+ // Hard Reset SBE to recover
+ break;
+ }
+ if(SBE::isSimicsRunning())
+ {
+ SBE_INFO("SBE is running on simics");
+ }
}
- if(SBE::isSimicsRunning())
- {
- SBE_INFO("SBE is running on simics");
- }
// Start running the highest priority thread.
// This function never returns
pk_start_threads();
OpenPOWER on IntegriCloud