From f3021dc1a1d0cb457f76d29d349143e37d15c7d0 Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Thu, 22 Oct 2020 09:38:52 +0900 Subject: ss-systemmanager branch 0.1 --- system_manager/Makefile.server | 2 +- system_manager/server/Makefile | 26 +- system_manager/server/PhaseInfo.txt | 2 + .../include/crashdetector/ss_crashdetector.h | 2 +- system_manager/server/include/heartbeat/ss_hb_if.h | 2 +- .../server/include/heartbeat/ss_hb_session.h | 2 +- .../server/include/heartbeat/ss_hb_thread.h | 2 +- .../include/processlauncher/ProcessLauncher.h | 2 +- .../include/processlauncher/ProcessLauncher_if.h | 2 +- .../processlauncher/ss_sm_process_launcher.h | 3 +- .../ss_sm_process_launcher_protocol.h | 2 +- system_manager/server/include/ss_sm_config.h | 87 +- .../server/include/ss_sm_default_paths.h | 5 +- .../server/include/ss_sm_dynamic_launch_table.h | 2 +- .../server/include/ss_sm_dynamic_launcher.h | 40 +- .../server/include/ss_sm_launch_configuration.h | 38 +- system_manager/server/include/ss_sm_signals.h | 2 +- .../server/include/ss_sm_systemmanagerlog.h | 2 +- system_manager/server/include/ss_sm_version.h | 6 +- system_manager/server/include/ss_system_manager.h | 190 +- .../server/include/ss_system_manager_callbacks.h | 2 +- .../server/include/ss_system_memory_monitor.h | 2 +- .../server/include/ss_system_thread_info.h | 2 +- .../server/include/system_launcher_cfg_format.h | 19 +- system_manager/server/sm_launch__CWORD84_.xml | 116 + system_manager/server/src/heartbeat/ss_hb_if.cpp | 2 +- .../src/heartbeat/ss_hb_service_protocol.cpp | 2 +- .../server/src/heartbeat/ss_hb_session.cpp | 2 +- .../server/src/heartbeat/ss_hb_thread.cpp | 2 +- .../server/src/processlauncher/ProcessLauncher.cpp | 4 +- .../src/processlauncher/ProcessLauncher_if.cpp | 2 +- system_manager/server/src/ss_sm_config.cpp | 161 +- .../server/src/ss_sm_dynamic_launcher.cpp | 37 +- system_manager/server/src/ss_sm_version.cpp | 6 +- system_manager/server/src/ss_system_manager.cpp | 2223 +++----------------- .../server/src/ss_system_manager_callbacks.cpp | 703 +------ .../server/src/ss_system_manager_error_event.cpp | 79 +- .../ss_system_manager_error_event_responses.cpp | 20 +- .../src/ss_system_manager_error_event_triggers.cpp | 5 +- .../server/src/ss_system_memory_monitor.cpp | 18 +- .../server/src/systemmanager_application.cpp | 16 +- system_manager/server/src/systemmanager_main.cpp | 2 +- system_manager/server/version.txt | 2 + 43 files changed, 876 insertions(+), 2970 deletions(-) create mode 100644 system_manager/server/PhaseInfo.txt create mode 100644 system_manager/server/sm_launch__CWORD84_.xml create mode 100644 system_manager/server/version.txt (limited to 'system_manager') diff --git a/system_manager/Makefile.server b/system_manager/Makefile.server index b2b149ce..83bc39bb 100644 --- a/system_manager/Makefile.server +++ b/system_manager/Makefile.server @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/system_manager/server/Makefile b/system_manager/server/Makefile index f1713ba0..04185f9a 100644 --- a/system_manager/server/Makefile +++ b/system_manager/server/Makefile @@ -1,5 +1,5 @@ # -# @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. +# @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -58,7 +58,6 @@ CPPFLAGS += -I./../../interface_unified/library/include ######### add compile option ############# CPPFLAGS += -DLINUX CPPFLAGS += -DIMPL_AGL_APPLICATION_CALLBACKS_PRE_BACKGROUND -CXXFLAGS += -std=c++11 CPPFLAGS_ProcessLauncher.o = -fno-exceptions CPPFLAGS_ProcessLauncher_if.o = -fno-exceptions @@ -84,23 +83,18 @@ LDLIBS += -Wl,-Bdynamic -lrt # for mq_xxx LDLIBS += -Wl,-Bdynamic -lSS_SystemIfUnified LDLIBS += -Wl,-Bdynamic -lssver -#LDLIBS += -Wl,-Bdynamic -lMounter LDLIBS += -Wl,-Bdynamic -lresm -#LDLIBS += -Wl,-Bdynamic -lextension LDLIBS += -Wl,-Bdynamic -lsssmcfg -#LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI -#LDLIBS += -Wl,-Bdynamic -lClock_API -#LDLIBS += -Wl,-Bdynamic -lpower_hal -#LDLIBS += -Wl,-Bdynamic -lsecurity_hal +LDLIBS += -Wl,-Bdynamic -lDiagCodeAPI +LDLIBS += -Wl,-Bdynamic -lClock_API +LDLIBS += -Wl,-Bdynamic -lpower_hal -LDLIBS += -Wl,-Bdynamic -lSS_RomAccessIf LDLIBS += -Wl,-Bdynamic -lcommon LDLIBS += -Wl,-Bdynamic -lNS_FrameworkUnified LDLIBS += -Wl,-Bdynamic -lPosixBasedOS001legacy LDLIBS += -Wl,-Bdynamic -lvp LDLIBS += -Wl,-Bdynamic -ltar -lz LDLIBS += -Wl,-Bdynamic -lrpc -lev -LDLIBS += -Wl,-Bdynamic -lssaccess ######### add library path ############# LDFLAGS += -g -Wl,--gc-sections @@ -109,4 +103,16 @@ LDFLAGS += -Wl,--no-as-needed LINK_CXX=Y +install-data: install_data + +install_data: + cpp -P -include $(SDKTARGETSYSROOT)/usr/agl/include/agl_thread.h ./sm_launch__CWORD84_.xml ./sm_launch.tmp.xml + $(SDKTARGETSYSROOT)/usr/agl/share/launch_xml2cfg.sh ./sm_launch.tmp.xml > ./sm_launch.cfg + install -d -m 755 $(DESTDIR)/usr/agl/conf/BS/ss/system_manager/rwdata + install -m 644 ./sm_launch.cfg $(DESTDIR)/usr/agl/conf/BS/ss/system_manager/rwdata + install -d -m 755 $(DESTDIR)/nv/BS/ss/system_manager/rwdata + install -d -m 755 $(DESTDIR)/usr/agl/share/BS/ss/system_manager/rodata + install -m 644 ./version.txt $(DESTDIR)/usr/agl/share/BS/ss/system_manager/rodata + install -m 644 ./PhaseInfo.txt $(DESTDIR)/usr/agl/share/BS/ss/system_manager/rodata + include ../../system_service.mk diff --git a/system_manager/server/PhaseInfo.txt b/system_manager/server/PhaseInfo.txt new file mode 100644 index 00000000..7ed792b7 --- /dev/null +++ b/system_manager/server/PhaseInfo.txt @@ -0,0 +1,2 @@ +Unknown +20191026 diff --git a/system_manager/server/include/crashdetector/ss_crashdetector.h b/system_manager/server/include/crashdetector/ss_crashdetector.h index 90c20a09..ae05af40 100644 --- a/system_manager/server/include/crashdetector/ss_crashdetector.h +++ b/system_manager/server/include/crashdetector/ss_crashdetector.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/heartbeat/ss_hb_if.h b/system_manager/server/include/heartbeat/ss_hb_if.h index 476be20e..8d6618ff 100644 --- a/system_manager/server/include/heartbeat/ss_hb_if.h +++ b/system_manager/server/include/heartbeat/ss_hb_if.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/heartbeat/ss_hb_session.h b/system_manager/server/include/heartbeat/ss_hb_session.h index e2611b7f..5414f097 100644 --- a/system_manager/server/include/heartbeat/ss_hb_session.h +++ b/system_manager/server/include/heartbeat/ss_hb_session.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/heartbeat/ss_hb_thread.h b/system_manager/server/include/heartbeat/ss_hb_thread.h index ddae44e0..7ca8e17d 100644 --- a/system_manager/server/include/heartbeat/ss_hb_thread.h +++ b/system_manager/server/include/heartbeat/ss_hb_thread.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/processlauncher/ProcessLauncher.h b/system_manager/server/include/processlauncher/ProcessLauncher.h index 05d96cd3..409524f0 100644 --- a/system_manager/server/include/processlauncher/ProcessLauncher.h +++ b/system_manager/server/include/processlauncher/ProcessLauncher.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/processlauncher/ProcessLauncher_if.h b/system_manager/server/include/processlauncher/ProcessLauncher_if.h index 61b9f5f8..f8d047a9 100644 --- a/system_manager/server/include/processlauncher/ProcessLauncher_if.h +++ b/system_manager/server/include/processlauncher/ProcessLauncher_if.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/processlauncher/ss_sm_process_launcher.h b/system_manager/server/include/processlauncher/ss_sm_process_launcher.h index aa335a39..1ca177cb 100644 --- a/system_manager/server/include/processlauncher/ss_sm_process_launcher.h +++ b/system_manager/server/include/processlauncher/ss_sm_process_launcher.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -43,6 +43,7 @@ typedef struct { CHAR logging_mask[SS_SM_MAX_MODULE_LOG_MASK_LENGTH]; GroupLaunchMapIter groupIterator; ModuleLaunchListIter moduleIterator; + int cpu_assign; } T_ProcessLauncherLaunchReq; /////////////////////////////////////////////////////////////////////////////// diff --git a/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h b/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h index 0e03d1d0..cd698326 100644 --- a/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h +++ b/system_manager/server/include/processlauncher/ss_sm_process_launcher_protocol.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/ss_sm_config.h b/system_manager/server/include/ss_sm_config.h index 2e52d12d..19736f67 100644 --- a/system_manager/server/include/ss_sm_config.h +++ b/system_manager/server/include/ss_sm_config.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -248,6 +248,7 @@ class ModuleLaunchParams { SS_String arguments; SS_String restart; UI_32 configuration_priority; + int cpu_assign; UI_32 previous_priority; UI_32 current_priority; BOOL critical; @@ -269,32 +270,43 @@ class ModuleLaunchParams { CStartReason m_startReason; CStopReason m_stopReason; - ModuleLaunchParams() noexcept; + ModuleLaunchParams(); ~ModuleLaunchParams(); - SMModuleState GetModuleState(void) noexcept; - BOOL IsModuleState(SMModuleState f_moduleState) noexcept; - BOOL IsModuleConnected() const noexcept; - VOID SetModuleState(SMModuleState f_moduleState - , BOOL f_bLog = TRUE) noexcept; - std::string ModuleStateStr(void) noexcept; - - SMModuleDebugDumpState GetModuleDebugDumpState(void) noexcept; - std::string GetModuleDebugDumpStateStr(void) noexcept; - VOID SetModuleDebugDumpState(SMModuleDebugDumpState f_moduleState - , BOOL f_bLog = TRUE) noexcept; - EFrameworkunifiedStatus SendMsgAndUpdateState( - const UI_32 f_iCmd, const T_SS_SM_START_DataStructType * const f_startData) noexcept; - EFrameworkunifiedStatus SendMsgAndUpdateState( - T_SS_SM_STOP_DataStruct const * f_stopData) noexcept; - - EFrameworkunifiedStatus GetPriority(UI_32 & f_Priority) noexcept; // NOLINT - EFrameworkunifiedStatus SetPriority(UI_32 f_Priority) noexcept; + SMModuleState GetModuleState(void); + BOOL IsModuleState(SMModuleState f_moduleState); + BOOL IsModuleConnected() const; + VOID SetModuleState(SMModuleState f_moduleState, BOOL f_bLog = TRUE); + std::string ModuleStateStr(void); + + SMModuleDebugDumpState GetModuleDebugDumpState(void); + std::string GetModuleDebugDumpStateStr(void); + VOID SetModuleDebugDumpState(SMModuleDebugDumpState f_moduleDebugDumpState, BOOL f_bLog = TRUE); + EFrameworkunifiedStatus SendMsgAndUpdateState( + const UI_32 f_iCmd, const T_SS_SM_START_DataStructType* const f_startData); + EFrameworkunifiedStatus SendMsgAndUpdateState(T_SS_SM_STOP_DataStruct const* f_stopData); + + EFrameworkunifiedStatus GetPriority(UI_32& f_Priority); // NOLINT + EFrameworkunifiedStatus SetPriority(UI_32 f_Priority); + + BOOL IsAGLUnit(void) const { return is_agl_unit; } + BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; } + BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; } + void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; } + void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) { + disable_agl_resethistory = f_disable_agl_resethistory; + } + void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) { + disable_nonagl_resethistory = f_disable_nonagl_resethistory; + } private: SMModuleState m_moduleState; SMModuleStateStrMapType m_ModuleStateStrMap; SMModuleDebugDumpState m_ModuleDebugDumpState; SMModuleDebugDumpStateStrMapType m_ModuleDebugDumpStateStrMap; + BOOL is_agl_unit; + BOOL disable_agl_resethistory; + BOOL disable_nonagl_resethistory; }; typedef std::list ModuleLaunchList; @@ -389,7 +401,7 @@ typedef LaunchOrderedVector::iterator LaunchOrderedIter; class SMConfigParams { public: - SMConfigParams() noexcept; + SMConfigParams(); virtual ~SMConfigParams(); //////////////////////////////////////////////////////////////////////////////////////////// @@ -403,8 +415,8 @@ class SMConfigParams { /// \return BOOL /// BOOL - TRUE or FALSE //////////////////////////////////////////////////////////////////////////////////////////// - BOOL LoadSMConfigParameters(ConfigurationData &f_ConfigParams, // NOLINT - SS_String f_FileName) noexcept; + BOOL LoadSMConfigParameters(ConfigurationData& f_ConfigParams, // NOLINT + SS_String f_FileName); //////////////////////////////////////////////////////////////////////////////////////////// /// GetSMConfigInformation @@ -416,8 +428,8 @@ class SMConfigParams { /// \return BOOL /// BOOL - TRUE or FALSE //////////////////////////////////////////////////////////////////////////////////////////// - BOOL GetSMConfigInformation(ConfigurationData &f_SMConfigParams, // NOLINT - SS_String f_FileName) noexcept; + BOOL GetSMConfigInformation(ConfigurationData& f_ConfigParams, // NOLINT + SS_String f_FileName); //////////////////////////////////////////////////////////////////////////////////////////// /// PrintConfigInfo @@ -428,7 +440,7 @@ class SMConfigParams { /// /// \return VOID //////////////////////////////////////////////////////////////////////////////////////////// - VOID PrintConfigInfo(ConfigurationData const & f_SMConfigParams) noexcept; + VOID PrintConfigInfo(ConfigurationData const& f_ConfigParams); }; class SysMgrConfiguration { @@ -440,7 +452,7 @@ class SysMgrConfiguration { /// \return NA /// //////////////////////////////////////////////////////////////////////////////////////////// - SysMgrConfiguration() noexcept; + SysMgrConfiguration(); //////////////////////////////////////////////////////////////////////////////////////////// /// ~SysMgrConfiguration @@ -476,11 +488,11 @@ class SysMgrConfiguration { /// \return BOOL /// BOOL - TRUE or FALSE //////////////////////////////////////////////////////////////////////////////////////////// - BOOL LoadParametersCfg(GroupLaunchMap &groups_map, // NOLINT - ProcessNameMap &f_processNameMap, // NOLINT - LaunchOrderedVector &f_OrderList, // NOLINT - SS_String &f_launchOrderName, // NOLINT - SS_String &f_launchCfgFn) noexcept; // NOLINT + BOOL LoadParametersCfg(GroupLaunchMap& groups_map, // NOLINT + ProcessNameMap& f_processNameMap, // NOLINT + LaunchOrderedVector& f_OrderList, // NOLINT + SS_String& f_launchOrderName, // NOLINT + SS_String& f_launchCfgFn); // NOLINT //////////////////////////////////////////////////////////////////////////////////////////// @@ -492,7 +504,7 @@ class SysMgrConfiguration { /// /// \return VOID //////////////////////////////////////////////////////////////////////////////////////////// - VOID PrintGroupInfo(GroupLaunchInfo & refGrpInfo) noexcept; // NOLINT + VOID PrintGroupInfo(GroupLaunchInfo& refGrpInfo); // NOLINT //////////////////////////////////////////////////////////////////////////////////////////// /// PrintModuleInfo @@ -503,7 +515,7 @@ class SysMgrConfiguration { /// /// \return VOID //////////////////////////////////////////////////////////////////////////////////////////// - VOID PrintModuleInfo(ModuleLaunchParams & refMbrInfo) noexcept; // NOLINT + VOID PrintModuleInfo(ModuleLaunchParams& refMbrInfo); // NOLINT //////////////////////////////////////////////////////////////////////////////////////////// /// PrintAllInfo @@ -514,15 +526,18 @@ class SysMgrConfiguration { /// /// \return VOID //////////////////////////////////////////////////////////////////////////////////////////// - VOID PrintAllInfo(GroupLaunchMap & refGrpMap) noexcept; // NOLINT + VOID PrintAllInfo(GroupLaunchMap& refGrpMap); // NOLINT protected: // define all the configuration parameters that will be used to get data CNSConfigReader * l_pReaderCfg; - SysMgrConfiguration(const SysMgrConfiguration &) noexcept; + SysMgrConfiguration(const SysMgrConfiguration&) : l_pReaderCfg(NULL) {} SysMgrConfiguration & operator = (const SysMgrConfiguration &); + + private: + BOOL ParseBoolParameter(PCSTR f_value, BOOL f_default = FALSE) const; }; #endif // SS_SM_CONFIG_H_ // NOLINT diff --git a/system_manager/server/include/ss_sm_default_paths.h b/system_manager/server/include/ss_sm_default_paths.h index caf30545..8ffafd98 100644 --- a/system_manager/server/include/ss_sm_default_paths.h +++ b/system_manager/server/include/ss_sm_default_paths.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,8 +34,7 @@ const CHAR UsingVMPlayerVariable[] = "USING_VM_PLAYER"; */ const CHAR DefaultBasePath[] = ""; const CHAR DefaultBinaryPath[] = "/agl/bin/"; -const CHAR DefaultConfigFilesPathOld[] = "/usr/agl/share/systemmanager/scfg/"; // Past compatible -const CHAR DefaultConfigFilesPath[] = "/usr/agl/conf/systemmanager/"; +const CHAR DefaultConfigFilesPath[] = "/usr/agl/conf/BS/ss/system_manager/rwdata/"; const CHAR DefaultLaunchConfigFileName[] = "sm_launch.cfg"; const CHAR DefaultSMConfigFileName[] = "gpf_ss_sm_config_data.cfg"; diff --git a/system_manager/server/include/ss_sm_dynamic_launch_table.h b/system_manager/server/include/ss_sm_dynamic_launch_table.h index 6b1bdcb6..685b43bf 100644 --- a/system_manager/server/include/ss_sm_dynamic_launch_table.h +++ b/system_manager/server/include/ss_sm_dynamic_launch_table.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/ss_sm_dynamic_launcher.h b/system_manager/server/include/ss_sm_dynamic_launcher.h index 2b33c67a..a6efb1fd 100644 --- a/system_manager/server/include/ss_sm_dynamic_launcher.h +++ b/system_manager/server/include/ss_sm_dynamic_launcher.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,16 +45,16 @@ typedef struct _tDynamicLaunchParams { class DynamicLaunchBase { public: - DynamicLaunchBase() noexcept; + DynamicLaunchBase(); virtual ~DynamicLaunchBase(); UI_32 get_id() const; - UI_32 advance_id() noexcept; - UI_32 decrement_id() noexcept; + UI_32 advance_id(); + UI_32 decrement_id(); BOOL is_begin(); BOOL is_end(); VOID to_begin(); VOID to_end(); - VOID print_info() noexcept; + VOID print_info(); protected: typedef std::vector DynamicOrderedVector; @@ -67,24 +67,30 @@ class DynamicModuleStart; class DynamicLauncher: public DynamicLaunchBase { public: - DynamicLauncher() noexcept; + DynamicLauncher(); virtual ~DynamicLauncher(); BOOL dynamic_launch_enabled() const; VOID configure_dynamic_launch(const SS_SOURCE & source_type, // NOLINT - GroupLaunchMap & group_info, LaunchOrderedVector & order_info) noexcept; // NOLINT - VOID copyDynOrderedVector(DynamicModuleStart &) noexcept; + GroupLaunchMap & group_info, LaunchOrderedVector & order_info); // NOLINT + VOID copyDynOrderedVector(DynamicModuleStart &); private: // Disable class copy constructors - DynamicLauncher(const DynamicLauncher &) noexcept; + explicit DynamicLauncher(const DynamicLauncher& f_source) + : m_nLaunchGroupId(f_source.m_nLaunchGroupId) + , m_nLaunchBeforeGroupId(f_source.m_nLaunchBeforeGroupId) + , m_nLaunchAfterGroupId(f_source.m_nLaunchAfterGroupId) + , m_nAviageTriggerId(f_source.m_nAviageTriggerId) + , m_bDynamicLaunchEnabled(f_source.m_bDynamicLaunchEnabled) + , m_eSourceType(f_source.m_eSourceType) {} DynamicLauncher & operator = (const DynamicLauncher &); // helper methods.. - DynamicLaunchInfo * get_dynamic_source_info(const SS_SOURCE & source_type, // NOLINT - BOOL &source_trigger, BOOL &is_aviage_required) noexcept; // NOLINT - UI_32 get_id_using_group_name(PCSTR group_name, GroupLaunchMap & group_info) noexcept; // NOLINT - VOID create_normal_launch_vector(GroupLaunchMap & group_info, LaunchOrderedVector & order_info) noexcept; // NOLINT - BOOL is_inGroupLaunchMap(UI_32& id, GroupLaunchMap & group_info) noexcept; // NOLINT + DynamicLaunchInfo* get_dynamic_source_info(const SS_SOURCE& source_type, // NOLINT + BOOL& source_trigger, BOOL &is_aviage_required); // NOLINT + UI_32 get_id_using_group_name(PCSTR group_name, GroupLaunchMap& group_info); // NOLINT + VOID create_normal_launch_vector(GroupLaunchMap& group_info, LaunchOrderedVector& order_info); // NOLINT + BOOL is_inGroupLaunchMap(UI_32& id, GroupLaunchMap& group_info); // NOLINT // Data Members UI_32 m_nLaunchGroupId; @@ -97,9 +103,9 @@ class DynamicLauncher: public DynamicLaunchBase { class DynamicModuleStart: public DynamicLaunchBase { public: - DynamicModuleStart() noexcept; - virtual ~DynamicModuleStart() noexcept; - VOID setGroupVector(DynamicOrderedVector &) noexcept; + DynamicModuleStart(); + virtual ~DynamicModuleStart(); + VOID setGroupVector(DynamicOrderedVector&); }; #endif // SS_SM_DYNAMIC_LAUNCHER_H_ // NOLINT diff --git a/system_manager/server/include/ss_sm_launch_configuration.h b/system_manager/server/include/ss_sm_launch_configuration.h index c0abdf24..72967144 100644 --- a/system_manager/server/include/ss_sm_launch_configuration.h +++ b/system_manager/server/include/ss_sm_launch_configuration.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,25 +90,6 @@ prefix DefaultModuleLaunchParams SystemModulesGroup[] = { (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0} }; -prefix DefaultModuleLaunchParams _CWORD121_ModulesGroup[] = { - {(const PCHAR)SERVICE_CAN_SHADOW, (const PCHAR)"VS_CANShadow", - (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0}, - {(const PCHAR)SERVICE_VS_DIAG_DISP, (const PCHAR)"VS_DoIPServer", - (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0}, - {(const PCHAR)SERVICE_VS_DIAG, (const PCHAR)"VS_DiagService", - (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0}, - {(const PCHAR)SERVICE_VS_VEHICLE, (const PCHAR)"VS_VehicleService", - (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0}, - {(const PCHAR)SERVICE_VS__CWORD85_, (const PCHAR)"VS__CWORD85_Service", - (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0}, - {(const PCHAR)SERVICE__CWORD51__DR, (const PCHAR)"_CWORD51__DR.exe", - (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0}, - {(const PCHAR)SERVICE_VS_RVC, (const PCHAR)"VS_RVCService", - (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0}, - {(const PCHAR)0, (const PCHAR)0, - (const PCHAR)0, (const PCHAR)0, 0, FALSE, 0, (const PCHAR)"0x00000000, 0x00000000", FALSE, FALSE, 0} -}; - prefix DefaultModuleLaunchParams AudioModulesGroup[] = { {(const PCHAR)SERVICE_AS_AUDIO, (const PCHAR)"AS_AudioService", (const PCHAR)"", (const PCHAR)"me", 10, TRUE, 3, (const PCHAR)"0x00000000, 0x00000000", TRUE, FALSE, 0}, @@ -197,15 +178,14 @@ prefix DefaultGroupLaunchInfo g_arrLaunchTable[] = { {(const PCHAR)"CoreModules", 1, CoreModulesGroup }, {(const PCHAR)"ShadowModules", 2, ShadowModulesGroup }, {(const PCHAR)"SystemModules", 3, SystemModulesGroup }, - {(const PCHAR)"_CWORD121_", 4, _CWORD121_ModulesGroup }, - {(const PCHAR)"Audio", 5, AudioModulesGroup }, - {(const PCHAR)"Radio", 6, RadioModulesGroup }, - {(const PCHAR)"Multimedia", 7, MultimediaModulesGroup }, - {(const PCHAR)"HMI", 8, HMIModulesGroup }, - {(const PCHAR)"Navigation", 9, NavigationModulesGroup }, - {(const PCHAR)"SoftwareUpdate", 10, SoftwareUpdateModulesGroup }, - {(const PCHAR)"Networking", 11, NetworkingModulesGroup }, - {(const PCHAR)"Browser", 12, BrowserModulesGroup }, + {(const PCHAR)"Audio", 4, AudioModulesGroup }, + {(const PCHAR)"Radio", 5, RadioModulesGroup }, + {(const PCHAR)"Multimedia", 6, MultimediaModulesGroup }, + {(const PCHAR)"HMI", 7, HMIModulesGroup }, + {(const PCHAR)"Navigation", 8, NavigationModulesGroup }, + {(const PCHAR)"SoftwareUpdate", 9, SoftwareUpdateModulesGroup }, + {(const PCHAR)"Networking", 10, NetworkingModulesGroup }, + {(const PCHAR)"Browser", 11, BrowserModulesGroup }, }; #endif // SS_SM_LAUNCH_CONFIGURATION_H_ // NOLINT diff --git a/system_manager/server/include/ss_sm_signals.h b/system_manager/server/include/ss_sm_signals.h index 64e1134c..4c52b329 100644 --- a/system_manager/server/include/ss_sm_signals.h +++ b/system_manager/server/include/ss_sm_signals.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/ss_sm_systemmanagerlog.h b/system_manager/server/include/ss_sm_systemmanagerlog.h index 79ce22f2..04997510 100644 --- a/system_manager/server/include/ss_sm_systemmanagerlog.h +++ b/system_manager/server/include/ss_sm_systemmanagerlog.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/ss_sm_version.h b/system_manager/server/include/ss_sm_version.h index d80be6c7..ea0a7750 100644 --- a/system_manager/server/include/ss_sm_version.h +++ b/system_manager/server/include/ss_sm_version.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,8 +31,8 @@ class CSMVersion { public: CSMVersion(); ~CSMVersion(); - EFrameworkunifiedStatus get_version(SS_VersionNumberType &f_VersionNumber) noexcept; // NOLINT - EFrameworkunifiedStatus get_build_info(std::string &f_buildInfoStr) noexcept; // NOLINT + EFrameworkunifiedStatus get_version(SS_VersionNumberType& f_VersionNumber); // NOLINT + EFrameworkunifiedStatus get_build_info(std::string& f_buildInfoStr); // NOLINT private: }; diff --git a/system_manager/server/include/ss_system_manager.h b/system_manager/server/include/ss_system_manager.h index bc866fb3..12d5bad0 100644 --- a/system_manager/server/include/ss_system_manager.h +++ b/system_manager/server/include/ss_system_manager.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,17 +30,16 @@ #include #include #include -#include #include #include #include #include -#include #include #include #include #include #include +#include #include #include #include @@ -60,6 +59,21 @@ #include "ss_system_memory_monitor.h" #include "ss_sm_dynamic_launcher.h" +static_assert((SS_SM_PROG_UPDATE_STATE_NONE == PWR_PROGUPDATE_STATE_NONE), + "SS_SM_PROG_UPDATE_STATE_NONE should be equal to " + "PWR_PROGUPDATE_STATE_NONE"); +static_assert((SS_SM_PROG_UPDATE_STATE_UPDATED == PWR_PROGUPDATE_STATE_UPDATED), + "SS_SM_PROG_UPDATE_STATE_UPDATED should be equal to " + "PWR_PROGUPDATE_STATE_UPDATED"); +static_assert((SS_SM_PROG_UPDATE_STATE_MAP_UPDATED == + PWR_PROGUPDATE_STATE_MAP_UPDATED), + "SS_SM_PROG_UPDATE_STATE_MAP_UPDATED should be equal to " + "PWR_PROGUPDATE_STATE_MAP_UPDATED"); +static_assert((SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED == + PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED), + "SS_SM_PROG_UPDATE_STATE_MAPDIFF_UPDATED should be equal to " + "PWR_PROGUPDATE_STATE_MAPDIFF_UPDATED"); + #define SM_SHUTDOWN_COMPLETE_MONITOR_TIMEOUT 60 typedef enum { @@ -302,9 +316,9 @@ class CSystemManager { EFrameworkunifiedStatus OnLVI2Notify(HANDLE hApp); EFrameworkunifiedStatus OnModuleStartCompleteResponse(HANDLE hApp); /// Process start complete from client - EFrameworkunifiedStatus OnModuleStopCompleteResponse(HANDLE hApp) noexcept; /// Process stop Complete from client - EFrameworkunifiedStatus OnGetStartExtInfo(HANDLE hApp) noexcept; - EFrameworkunifiedStatus OnGetStopExtInfo(HANDLE hApp) noexcept; + EFrameworkunifiedStatus OnModuleStopCompleteResponse(HANDLE hApp); /// Process stop Complete from client + EFrameworkunifiedStatus OnGetStartExtInfo(HANDLE hApp); + EFrameworkunifiedStatus OnGetStopExtInfo(HANDLE hApp); EFrameworkunifiedStatus OnModuleStopCompleteNotification(HANDLE hApp); EFrameworkunifiedStatus ProcessModuleStopCompleteResponse(HANDLE hApp, PCSTR f_moduleName); @@ -322,7 +336,7 @@ class CSystemManager { EFrameworkunifiedStatus OnLaunchGroupTriggerProcessResponseTimerExpiry(HANDLE hApp); EFrameworkunifiedStatus OnNppStopComplete(HANDLE hApp); /// Process stop Complete from NPPService - EFrameworkunifiedStatus OnOpenSession(HANDLE hApp) noexcept; /// Process open session request + EFrameworkunifiedStatus OnOpenSession(HANDLE hApp); /// Process open session request EFrameworkunifiedStatus OnCloseSession(HANDLE hApp); /// Process close session acknowledgment EFrameworkunifiedStatus CloseApplication(HANDLE hApp); @@ -336,51 +350,36 @@ class CSystemManager { EFrameworkunifiedStatus OnNPPReadyStatusCallback(HANDLE hApp); EFrameworkunifiedStatus OnNPPReadyEventCallback(HANDLE hApp); EFrameworkunifiedStatus OnWakeupCallback(HANDLE hApp); - EFrameworkunifiedStatus OnPowerRequestCallback(HANDLE hApp) noexcept; + EFrameworkunifiedStatus OnPowerRequestCallback(HANDLE hApp); EFrameworkunifiedStatus OnBackupMgrAvailCallback(HANDLE hApp); EFrameworkunifiedStatus OnShutdownModulesRequest(HANDLE hApp); - EFrameworkunifiedStatus OnSystemModeInfoRequest(HANDLE hApp) noexcept; + EFrameworkunifiedStatus OnSystemModeInfoRequest(HANDLE hApp); EFrameworkunifiedStatus ClearDramBackupInfo(HANDLE hApp); - EFrameworkunifiedStatus OnInitCompReportCallback(HANDLE hApp) noexcept; + EFrameworkunifiedStatus OnInitCompReportCallback(HANDLE hApp); EFrameworkunifiedStatus SetEnvVariableForVupMode(BOOL bIsVupMode); - static int CreateSyslogd(); static int CreateRtUsb(); - EFrameworkunifiedStatus PerformMountResetAll(); - EFrameworkunifiedStatus PerformMountResetRamd(const HANDLE h_app, const bool isMountRamd); - EFrameworkunifiedStatus PerformMountNand(); - EFrameworkunifiedStatus PerformMountRamd(); - EFrameworkunifiedStatus PerformUmountNand(); - EFrameworkunifiedStatus PerformUmountRamd(); - EFrameworkunifiedStatus PerformForceUmountRamd(); - EFrameworkunifiedStatus PerformFinalUmount(BOOL bIsNeedLog); EFrameworkunifiedStatus SecureChipOff(); - EFrameworkunifiedStatus OnRebootNotification(HANDLE hApp); EFrameworkunifiedStatus CallStopCompleteHandler(HANDLE hApp, BOOL bISDetectTimeout = FALSE); - EFrameworkunifiedStatus OnVarCodeSetRequest(HANDLE hApp) noexcept; - EFrameworkunifiedStatus OnSetBootloaderInfoRequest(HANDLE hApp) noexcept; - EFrameworkunifiedStatus OnGetBootloaderInfoRequest( HANDLE hApp ); - EFrameworkunifiedStatus On_CWORD56_HeartBeatRequest(HANDLE hApp) noexcept; + EFrameworkunifiedStatus On_CWORD56_HeartBeatRequest(HANDLE hApp); EFrameworkunifiedStatus On_CWORD56_HeartBeatResponseIntervalTimerExpiry(HANDLE hApp); EFrameworkunifiedStatus OnGroupLaunchWaitTimeout(HANDLE hApp); EFrameworkunifiedStatus OnModuleConnectWaitTimeout(HANDLE hApp); EFrameworkunifiedStatus OnStartRespMonitorTimeout(HANDLE hApp); EFrameworkunifiedStatus OnShutdownCompleteMonitorTimeout(HANDLE hApp); - EFrameworkunifiedStatus PerformCpuReset(HANDLE hApp, ESMCpuResetReason f_eSmCpuResetReason, std::string f_messageStr = "") noexcept; // NOLINT - EFrameworkunifiedStatus OnCpuResetRequest(HANDLE hApp) noexcept; - EFrameworkunifiedStatus OnSetBootModeRequest(HANDLE hApp) noexcept; - EFrameworkunifiedStatus OnSetDataResetModeRequest(HANDLE hApp) noexcept; - EFrameworkunifiedStatus OnSetProgUpdateStateRequest(HANDLE hApp) noexcept; + EFrameworkunifiedStatus PerformCpuReset(HANDLE hApp, ESMCpuResetReason f_eSmCpuResetReason, std::string f_messageStr = ""); // NOLINT + EFrameworkunifiedStatus OnCpuResetRequest(HANDLE hApp); + EFrameworkunifiedStatus OnSetDataResetModeRequest(HANDLE hApp); + EFrameworkunifiedStatus OnSetProgUpdateStateRequest(HANDLE hApp); EFrameworkunifiedStatus OnLaunchGroupTriggerProcessResponse(HANDLE hApp); - EFrameworkunifiedStatus OnSetWakeupOrderRequest(HANDLE hApp) noexcept; - EFrameworkunifiedStatus OnSetNextWakeupTypeRequest(HANDLE hApp) noexcept; - - LBM_UINT32 GetDramStatusInfo(const HANDLE h_app); - void SetDramStatusInfo(LBM_UINT32 f_state); + EFrameworkunifiedStatus OnSetNextWakeupTypeRequest(HANDLE hApp); + bool GetDramPowerStatusInfo(const HANDLE h_app); + bool GetDramStoreStatusInfo(const HANDLE h_app); + bool GetSyscomPowerStatusInfo(const HANDLE h_app); // // Start Confirmation, Get _CWORD56_ Version callback functions - EFrameworkunifiedStatus OnSetStartupConfirmationDataRequest(HANDLE hApp) noexcept; + EFrameworkunifiedStatus OnSetStartupConfirmationDataRequest(HANDLE hApp); void SystemManagerDebugDump(HANDLE hApp); @@ -401,9 +400,6 @@ class CSystemManager { UI_32 m_ActiveGroupId; // Modules of Group to whom START/STOP has been sent wakeInfo m_Wake; // WakeUp data from power EPWR_WAKEUP_FACTOR_TYPE m_StartUpReason; // System Manager preserve start up reason - LBM_RAM_t m_Lbm_Ram; - LBM_RAM_t *m_BootMemory; // Boot If - UI_32 m_BootMemoryMapSize; // Size of Boot If ESMDataResetModeInfo m_DataResetMode; // Data Reset Mode SMProgUpdateState m_ProgUpdateState; // ProgUpdate State ESMNextWakeupType m_NextWakeupType; // Next Progupdate State @@ -418,8 +414,6 @@ class CSystemManager { UI_32 m_NbrDebugDumpRspnRecv; // Total number of debug dump responses received. BOOL m_isRcvModeInfo; SystemModeInfo m_SystemModeInfo; // System Mode Info, SM to read data from persistent file at start - ESMBootModeInfo m_BootMode; // Application or Programming - std::vector ListOfServicesAuthorizedToSetBootMode; SS_String m_BinaryFilesPath; // Store binary files path SS_String m_ConfigFilesPath; // Store config files path ConfigurationData m_SMConfig; // Configuration Data of System Manager and its threads @@ -471,10 +465,12 @@ class CSystemManager { bool m_InitialBoot; + PsmFactorT m_ResetFactor; // reset(start-up) factor. + void SetCmdHist(std::string cmd, cmdHist &hist, cmdHistIter &it, std::string sender); // NOLINT // ILGRST or ACCOFFON Logging - bool StoreDebugLogs(SS_STORELOGS_OPE_TYPE type); + bool StoreDebugLogs(const HANDLE h_app, SS_STORELOGS_OPE_TYPE); UI_32 InProgressStateToSendMsg() const; SMModuleState InProgressStateToState() const; @@ -505,22 +501,6 @@ class CSystemManager { //// enum<=>enum maps //// // // - // Control Mode <=> Limp Home Cutoff Mode enum maps - std::map m_Control_to_LimpHomeCutoffMode_map; - std::map m_LimpHomeCutoff_to_ControlMode_map; - // - // Control Mode <=> Production Mode enum maps - std::map m_Control_to_ProductionMode_map; - std::map m_Production_to_ControlMode_map; - // - // Control Mode <=> Transport Mode enum maps - std::map m_Control_to_TransportMode_map; - std::map m_Transport_to_ControlMode_map; - // - // PowerService SystemModeInfo <=> SystemServices BootMode enum maps - std::map m_PSSMI_to_SSBootMode_map; - std::map m_SSBootMode_to_PSSMI_map; - // // EPWR_POWER_STATE_TYPE <=> BOOL std::map m_PowerType_to_SSBoolEnumMap; std::map @@ -528,17 +508,9 @@ class CSystemManager { std::map m_SSBool_to_PowerTypeEnumMap; // // User Mode - std::map m_ROM_to_SSUserModeEnumMap; - std::map m_SS_to_ROMUserModeEnumMap; std::map m_SSUserMode_to_SSBoolEnumMap; std::map m_SSBool_to_SSUserModeEnumMap; - std::map m_PsmSysupDram_to_SysupDramMap; - std::map m_PsmStartStatus_to_SysupCndMap; - std::map m_PsmComSts_to_SubcpuStsMap; - std::map m_PsmDramSts_to_SdramStsMap; - std::map m_PsmDramSts_to_RamjudgeStsMap; - std::map m_PsmDramSts_to_SelfRefreshMap; // //// End of enum<=>enum maps //// ////******************************************************************//// @@ -559,13 +531,13 @@ class CSystemManager { // Wakeup from Power EFrameworkunifiedStatus BeginStartup(HANDLE hApp); - EFrameworkunifiedStatus start_all_modules_of_group(HANDLE hApp, UI_32 f_ui32GroupNumber) noexcept; + EFrameworkunifiedStatus start_all_modules_of_group(HANDLE hApp, UI_32 f_ui32GroupNumber); EFrameworkunifiedStatus send_power_request_complete_response(HANDLE hApp, - std::string pStr) noexcept; + std::string pStr); BOOL have_all_services_start_completed(const SMModuleState f_moduleState); // Power Off from Power - EFrameworkunifiedStatus PublishPowerOnOffNotification(HANDLE hApp) noexcept; + EFrameworkunifiedStatus PublishPowerOnOffNotification(HANDLE hApp); // Shutdown from Power EFrameworkunifiedStatus stop_all_modules_of_group(HANDLE hApp); @@ -577,6 +549,8 @@ class CSystemManager { EFrameworkunifiedStatus send_shutdown_complete_response(HANDLE hApp); EFrameworkunifiedStatus SendShutdownResponseMessage(HANDLE hApp); + PsmFactorT GetResetFactor(PCSTR f_module_name, BOOL f_user_reset); + PsmFactorT GetResetFactor(const ModuleLaunchListIter f_module_iter, BOOL f_user_reset); EFrameworkunifiedStatus ValidateUserModeMessage(HANDLE hApp, EPWR_USER_MODE_TYPE &l_eUserModeState); // NOLINT @@ -589,71 +563,6 @@ class CSystemManager { VOID ReadUsingVMPlayerEnvironmentVariable(); - EFrameworkunifiedStatus GetBootMode(ROM_AccessIf & f_cRomAccess - , ESMBootModeInfo & f_BootMode); // NOLINT - EFrameworkunifiedStatus GetLastUserMode(ROM_AccessIf & f_cRomAccess // NOLINT - , EPWR_USER_MODE_TYPE& f_lastUserMode); // NOLINT - EFrameworkunifiedStatus SaveLastUserModeToNVM(EPWR_USER_MODE_TYPE l_eUserModeState); - EFrameworkunifiedStatus GetLimpHomeCutoffMode(ROM_AccessIf & f_cRomAccess - , EPWR_LHC_TYPE& f_limpHomeCutoff); // NOLINT - EFrameworkunifiedStatus GetProductionMode(ROM_AccessIf & f_cRomAccess - , EPWR_PROD_MODE_TYPE& f_productionMode); // NOLINT - EFrameworkunifiedStatus GetSignature(ROM_AccessIf & f_cRomAccess - , UI_32 * pData); - EFrameworkunifiedStatus GetTransportMode(ROM_AccessIf & f_cRomAccess - , EPWR_TRANSPORT_MODE_TYPE& f_transportMode); // NOLINT - EFrameworkunifiedStatus GetDataResetMode(ROM_AccessIf & f_cRomAccess - , ESMDataResetModeInfo& f_dataResetMode, bool isFast = false); // NOLINT - EFrameworkunifiedStatus GetResetCount(ROM_AccessIf & f_cRomAccess - , UI_32& f_resetCount); // NOLINT - EFrameworkunifiedStatus GetLastIlgReset(ROM_AccessIf & f_cRomAccess - , BOOL& f_lastIlgReset); // NOLINT - EFrameworkunifiedStatus GetProgUpdateState(ROM_AccessIf & f_cRomAccess - , SMProgUpdateState& f_progUpdateState); // NOLINT - EFrameworkunifiedStatus GetErrLogCount(ROM_AccessIf & f_cRomAccess - , UI_32& f_errLogCount); // NOLINT - EFrameworkunifiedStatus GetNextWakeupType(ROM_AccessIf & f_cRomAccess - , ESMNextWakeupType& f_wakeupType); // NOLINT - EFrameworkunifiedStatus SetActiveFlashloader(ROM_AccessIf & f_cRomAccess - , EACTIVE_FLASHLOADER f_FlashloaderMode); - EFrameworkunifiedStatus SetBootMode(ROM_AccessIf & f_cRomAccess - , ESMBootModeInfo f_BootMode); - EFrameworkunifiedStatus SetLastUserMode(ROM_AccessIf & f_cRomAccess - , EPWR_USER_MODE_TYPE f_lastUserMode); - EFrameworkunifiedStatus SetLimpHomeCutoffMode(ROM_AccessIf & f_cRomAccess - , EPWR_LHC_TYPE f_limpHomeCutoff); - EFrameworkunifiedStatus SetProductionMode(ROM_AccessIf & f_cRomAccess - , EPWR_PROD_MODE_TYPE f_productionMode); - EFrameworkunifiedStatus SetSignature(ROM_AccessIf & f_cRomAccess - , UI_32 Data); - EFrameworkunifiedStatus SetTransportMode(ROM_AccessIf & f_cRomAccess - , EPWR_TRANSPORT_MODE_TYPE f_transportMode); - EFrameworkunifiedStatus SetDataResetMode(ROM_AccessIf & f_cRomAccess - , ESMDataResetModeInfo f_dataResetMode); - EFrameworkunifiedStatus SetResetCount(ROM_AccessIf & f_cRomAccess - , UI_32 f_resetCount); - EFrameworkunifiedStatus SetLastIlgReset(ROM_AccessIf & f_cRomAccess - , BOOL f_lastIlgReset); - EFrameworkunifiedStatus SetProgUpdateState(ROM_AccessIf & f_cRomAccess - , SMProgUpdateState f_progUpdateState); - EFrameworkunifiedStatus SetErrLogCount(ROM_AccessIf & f_cRomAccess - , UI_32 f_errLogCount); - EFrameworkunifiedStatus SetNextWakeupType(ROM_AccessIf & f_cRomAccess - , ESMNextWakeupType f_wakeupType); - EFrameworkunifiedStatus SetProductPrivate(ROM_AccessIf & f_cRomAccess - , UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]); - EFrameworkunifiedStatus PublishBootModeNotification(HANDLE hApp) noexcept; - EFrameworkunifiedStatus ReturnBootModeAndStatus(HANDLE hApp - , SS_SystemManagerProtocol protocolID - , PCSTR p_sIDName - , ESMBootModeInfo f_BootMode - , EFrameworkunifiedStatus eFrameworkunifiedStatus) noexcept; - EFrameworkunifiedStatus ValidateBootModeMessage(HANDLE hApp - , ESMBootModeInfo &l_eBootModeState) noexcept; // NOLINT - EFrameworkunifiedStatus ValidateRequester(HANDLE hApp - , std::vector &L - , PCSTR p_sActionName); - VOID InitiateAllGroupsShutdown(HANDLE hApp); VOID SendDeferMsg(HANDLE hApp); EFrameworkunifiedStatus GetVersionNumber(SS_VersionNumberType &f_VersionNumber); // NOLINT @@ -682,24 +591,23 @@ class CSystemManager { EFrameworkunifiedStatus RemoveModuleEntryFromHB(HANDLE hApp, const CHAR *f_ModuleName); - EFrameworkunifiedStatus PublishUserModeNotification(HANDLE hApp) noexcept; + EFrameworkunifiedStatus PublishUserModeNotification(HANDLE hApp); EFrameworkunifiedStatus PerformPowerOnOffUserModePublication( HANDLE hApp, - const char * p_NotificationStr) noexcept; + const char * p_NotificationStr); EFrameworkunifiedStatus SendSystemModeInfoResponse( HANDLE hApp, - EPWR_STARTUP_STAGE_TYPE f_startupStage) noexcept; + EPWR_STARTUP_STAGE_TYPE f_startupStage); VOID SYSTEMMANAGERLOG_StartupConfirmationMsg(EPWR_SC_MSG_STRUCT & f_scMsg); // NOLINT - VOID LogGroupModulesState(UI_32 f_groupId, std::string pStr) noexcept; - VOID LogAllGroupModulesState(std::string pStr) noexcept; + VOID LogGroupModulesState(UI_32 f_groupId, std::string pStr); + VOID LogAllGroupModulesState(std::string pStr); EFrameworkunifiedStatus ProcessGroupAsStarted(HANDLE hApp , GroupLaunchMapIter f_GroupIterator); EFrameworkunifiedStatus ProcessGroupAsStarted(HANDLE hApp , UI_32 f_groupId); - EFrameworkunifiedStatus GetModuleIterator(PCSTR f_moduleName - , ModuleLaunchListIter & f_moduleIter) noexcept; // NOLINT + EFrameworkunifiedStatus GetModuleIterator(PCSTR f_moduleName, ModuleLaunchListIter & f_moduleIter); // NOLINT BOOL IsGroupStarted(UI_32 f_groupId); BOOL IsGroupStopped(UI_32 f_groupId); EFrameworkunifiedStatus ResetModulesStateToConnected(HANDLE hApp); @@ -793,7 +701,7 @@ class CSystemManager { EErrorEventType f_eventType, std::string &f_moduleQueueName, // NOLINT EErrorEventResetType f_resetType = eErrorEventResetTypeNone, - const SMLoggingInfo &f_loggingInfo = SMLoggingInfo()) noexcept; + const SMLoggingInfo &f_loggingInfo = SMLoggingInfo()); EFrameworkunifiedStatus PerformResetAfterLogging(HANDLE f_hApp, ESMCpuResetReason f_eCpuResetReason, diff --git a/system_manager/server/include/ss_system_manager_callbacks.h b/system_manager/server/include/ss_system_manager_callbacks.h index b513b86a..e9d59388 100644 --- a/system_manager/server/include/ss_system_manager_callbacks.h +++ b/system_manager/server/include/ss_system_manager_callbacks.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/ss_system_memory_monitor.h b/system_manager/server/include/ss_system_memory_monitor.h index 68c426a3..50cf8574 100644 --- a/system_manager/server/include/ss_system_memory_monitor.h +++ b/system_manager/server/include/ss_system_memory_monitor.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/ss_system_thread_info.h b/system_manager/server/include/ss_system_thread_info.h index ef9255f2..f21ad5a9 100644 --- a/system_manager/server/include/ss_system_thread_info.h +++ b/system_manager/server/include/ss_system_thread_info.h @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/include/system_launcher_cfg_format.h b/system_manager/server/include/system_launcher_cfg_format.h index 5f667a40..b30b21fd 100644 --- a/system_manager/server/include/system_launcher_cfg_format.h +++ b/system_manager/server/include/system_launcher_cfg_format.h @@ -1,6 +1,6 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,6 +42,23 @@ typedef struct _tLaunchParams { BOOL shutdown_critical; UI_32 shutdown_wait_time; UI_32 fast_shutdown_wait_time; + + public: + BOOL IsAGLUnit(void) const { return is_agl_unit; } + BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; } + BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; } + void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; } + void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) { + disable_agl_resethistory = f_disable_agl_resethistory; + } + void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) { + disable_nonagl_resethistory = f_disable_nonagl_resethistory; + } + + private: + BOOL is_agl_unit; + BOOL disable_agl_resethistory; + BOOL disable_nonagl_resethistory; } LaunchInfo; LaunchInfo g_arrLaunchTableCfg[] = { diff --git a/system_manager/server/sm_launch__CWORD84_.xml b/system_manager/server/sm_launch__CWORD84_.xml new file mode 100644 index 00000000..1392bbb0 --- /dev/null +++ b/system_manager/server/sm_launch__CWORD84_.xml @@ -0,0 +1,116 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/system_manager/server/src/heartbeat/ss_hb_if.cpp b/system_manager/server/src/heartbeat/ss_hb_if.cpp index 0e70d2b2..a3c27776 100644 --- a/system_manager/server/src/heartbeat/ss_hb_if.cpp +++ b/system_manager/server/src/heartbeat/ss_hb_if.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp b/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp index cf9bcf33..5fb4e001 100644 --- a/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp +++ b/system_manager/server/src/heartbeat/ss_hb_service_protocol.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/src/heartbeat/ss_hb_session.cpp b/system_manager/server/src/heartbeat/ss_hb_session.cpp index 23e77cbc..8178e46d 100644 --- a/system_manager/server/src/heartbeat/ss_hb_session.cpp +++ b/system_manager/server/src/heartbeat/ss_hb_session.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/src/heartbeat/ss_hb_thread.cpp b/system_manager/server/src/heartbeat/ss_hb_thread.cpp index 13354ab9..19d124ae 100644 --- a/system_manager/server/src/heartbeat/ss_hb_thread.cpp +++ b/system_manager/server/src/heartbeat/ss_hb_thread.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/src/processlauncher/ProcessLauncher.cpp b/system_manager/server/src/processlauncher/ProcessLauncher.cpp index e17feaf5..6b709fe0 100644 --- a/system_manager/server/src/processlauncher/ProcessLauncher.cpp +++ b/system_manager/server/src/processlauncher/ProcessLauncher.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -194,7 +194,7 @@ EFrameworkunifiedStatus CProcessLauncher::PLLaunchModule(HANDLE hThread, T_Proce l_ModuleLaunchReq.name); SS_String sPathAndFileName = l_ModuleLaunchReq.path; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - l_pProcessPtr = new (std::nothrow) Process(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) + l_pProcessPtr = new (std::nothrow) Process(l_ModuleLaunchReq.cpu_assign); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) if (NULL == l_pProcessPtr) { // LCOV_EXCL_BR_LINE 11::new operation failed // LCOV_EXCL_START 11::new operation failed diff --git a/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp b/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp index b75ed53d..3d9b2e92 100644 --- a/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp +++ b/system_manager/server/src/processlauncher/ProcessLauncher_if.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/src/ss_sm_config.cpp b/system_manager/server/src/ss_sm_config.cpp index 1351a415..2a8d11e6 100644 --- a/system_manager/server/src/ss_sm_config.cpp +++ b/system_manager/server/src/ss_sm_config.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,7 +98,11 @@ struct CfgLaunchParams { is_start_required(0), shutdown_critical(0), shutdown_wait_time(0), - fast_shutdown_wait_time(0) { + fast_shutdown_wait_time(0), + cpu_assign(0x0), + is_agl_unit(TRUE), + disable_agl_resethistory(FALSE), + disable_nonagl_resethistory(FALSE) { std::memset(&group_name[0], 0, sizeof(group_name)); std::memset(&name[0], 0, sizeof(name)); std::memset(&binary_name[0], 0, sizeof(binary_name)); @@ -128,6 +132,24 @@ struct CfgLaunchParams { TUserNameBuffer unix_user_name; // TODO(username): Stuff.: Does Posix define a useful // constant representing max length of user id? CHAR env_value_condition[256]; + int cpu_assign; + + public: + BOOL IsAGLUnit(void) const { return is_agl_unit; } + BOOL IsAGLResetHistoryDisable(void) const { return disable_agl_resethistory; } + BOOL IsNonAGLResetHistoryDisable(void) const { return disable_nonagl_resethistory; } + void SetAGLUnit(BOOL f_is_agl_unit) { is_agl_unit = f_is_agl_unit; } + void SetAGLResetHistoryDisable(BOOL f_disable_agl_resethistory) { + disable_agl_resethistory = f_disable_agl_resethistory; + } + void SetNonAGLResetHisoryDisable(BOOL f_disable_nonagl_resethistory) { + disable_nonagl_resethistory = f_disable_nonagl_resethistory; + } + + private: + BOOL is_agl_unit; + BOOL disable_agl_resethistory; + BOOL disable_nonagl_resethistory; }; namespace ss_sm_cfg { @@ -151,12 +173,19 @@ class cfg_args { shutdown_wait_time, fast_shutdown_wait_time, unix_user_name, + is_agl_unit, + disable_agl_resethistory, + disable_nonagl_resethistory, env_value_condition, + cpu_assign, END }; }; }; // namespace ss_sm_cfg +static void set_grp_member_info(const LaunchInfo& launch_info, ModuleLaunchList& module_lst); // NOLINT +static void load_parameters_order_cfg( + GroupLaunchMap& groups_map, LaunchOrderedVector& f_OrderList, SS_String& f_launchOrderName, SS_String& f_launchCfgFn); // NOLINT /******************************************************************************* * CTimeSpan class * @@ -209,12 +238,13 @@ UI_64 CTimeSpan::GetTimeMilliseconds() { * End of CTimeSpan class * ******************************************************************************/ -ModuleLaunchParams::ModuleLaunchParams() noexcept : +ModuleLaunchParams::ModuleLaunchParams(): name("") , path("") , arguments("") , restart("") , configuration_priority(0) + , cpu_assign(0x0) , previous_priority(0) , current_priority(0) , critical(FALSE) @@ -232,7 +262,10 @@ ModuleLaunchParams::ModuleLaunchParams() noexcept : , m_serviceAvailability(FALSE) , m_startReason() , m_stopReason() - , m_ModuleDebugDumpState(MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED) { + , m_ModuleDebugDumpState(MODULE_DEBUG_DUMP_STATE_NOT_REQUESTED) + , is_agl_unit(TRUE) + , disable_agl_resethistory(FALSE) + , disable_nonagl_resethistory(FALSE) { // LCOV_EXCL_BR_START 11:Gcov constraints (because exception-handling routes are automatically generated) SetModuleState(MODULE_STATE_INVALID, FALSE); // // Module State strings @@ -260,6 +293,7 @@ ModuleLaunchParams::ModuleLaunchParams() noexcept : m_ModuleStateStrMap[MODULE_STATE_STOP_BACKGROUND_SENT] = "BACKGROUND_STOP_SENT"; m_ModuleStateStrMap[MODULE_STATE_STOP_BACKGROUND_FAILED] = "BACKGROUND_STOP_FAIL"; m_ModuleStateStrMap[MODULE_STATE_STOPPED_BACKGROUND] = "BACKGROUND_STOPPED"; + // LCOV_EXCL_BR_STOP m_startReason.SetReason(NotStarted); m_stopReason.SetReason(NotStopped); @@ -274,17 +308,17 @@ ModuleLaunchParams::ModuleLaunchParams() noexcept : ModuleLaunchParams::~ModuleLaunchParams() { } // End of ModuleLaunchParams::~ModuleLaunchParams() : -SMModuleState ModuleLaunchParams::GetModuleState(void) noexcept { +SMModuleState ModuleLaunchParams::GetModuleState(void) { return m_moduleState; } // End of SMModuleState ModuleLaunchParams::GetModuleState(void) -BOOL ModuleLaunchParams::IsModuleState(SMModuleState f_moduleState) noexcept { +BOOL ModuleLaunchParams::IsModuleState(SMModuleState f_moduleState) { return m_moduleState == f_moduleState; } // End of BOOL ModuleLaunchParams::IsModuleState(SMModuleState f_moduleState ) // IsModuleConnected // Determine if a module is in a state capable of receiving messages from System Manager. -BOOL ModuleLaunchParams::IsModuleConnected() const noexcept { +BOOL ModuleLaunchParams::IsModuleConnected() const { BOOL l_isModuleConnected = FALSE; switch (m_moduleState) { @@ -318,7 +352,7 @@ BOOL ModuleLaunchParams::IsModuleConnected() const noexcept { return (l_isModuleConnected); } // End of BOOL ModuleLaunchParams::IsModuleConnected(void) -VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState, BOOL f_bLog) noexcept { +VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState, BOOL f_bLog) { m_moduleState = f_moduleState; switch (m_moduleState) { // Because the module status cannot be changed from the external API @@ -418,22 +452,22 @@ VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState, BOOL f_bLog } } // End of VOID ModuleLaunchParams::SetModuleState(SMModuleState f_moduleState ) -std::string ModuleLaunchParams::ModuleStateStr(void) noexcept { +std::string ModuleLaunchParams::ModuleStateStr(void) { return m_ModuleStateStrMap[m_moduleState]; } // End of std::string ModuleLaunchParams::ModuleStateStr(SMModuleState f_moduleState ) -SMModuleDebugDumpState ModuleLaunchParams::GetModuleDebugDumpState(void) noexcept { // LCOV_EXCL_START 6: Because the condition cannot be set // NOLINT(whitespace/line_length) +SMModuleDebugDumpState ModuleLaunchParams::GetModuleDebugDumpState(void) { // LCOV_EXCL_START 6: Because the condition cannot be set // NOLINT(whitespace/line_length) AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert return m_ModuleDebugDumpState; } // End of SMModuleDebugDumpState ModuleLaunchParams::GetModuleDebugDumpState(void) // LCOV_EXCL_STOP -std::string ModuleLaunchParams::GetModuleDebugDumpStateStr(void) noexcept { +std::string ModuleLaunchParams::GetModuleDebugDumpStateStr(void) { return m_ModuleDebugDumpStateStrMap[m_ModuleDebugDumpState]; } // End of std::string ModuleLaunchParams::GetModuleDebugDumpStateStr() VOID ModuleLaunchParams::SetModuleDebugDumpState( - SMModuleDebugDumpState f_moduleDebugDumpState, BOOL f_bLog) noexcept { + SMModuleDebugDumpState f_moduleDebugDumpState, BOOL f_bLog) { m_ModuleDebugDumpState = f_moduleDebugDumpState; if (f_bLog) { // LCOV_EXCL_BR_LINE 200:f_bLog must be TRUE @@ -443,8 +477,7 @@ VOID ModuleLaunchParams::SetModuleDebugDumpState( } // End of VOID ModuleLaunchParams::SetModuleDebugDumpState(SMModuleDebugDumpState f_moduleDebugDumpState ) EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState( - const UI_32 f_iCmd, const T_SS_SM_START_DataStructType * const f_startData) - noexcept { + const UI_32 f_iCmd, const T_SS_SM_START_DataStructType* const f_startData) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); char l_cBuf[500] = " Error: char l_cBuf[] not built"; T_SS_SM_START_DataStructType l_startData; @@ -524,7 +557,7 @@ EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState( // End of EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(T_SS_SM_START_DataStructType const * f_startData) EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState( - T_SS_SM_STOP_DataStructType const * f_stopData) noexcept { + T_SS_SM_STOP_DataStructType const* f_stopData) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); char l_cBuf[500] = " Error: char l_cBuf[] not built"; EFrameworkunifiedStatus l_eStatus = FrameworkunifiedSendMsg(hsession, SS_SM_STOP, @@ -553,7 +586,7 @@ EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState( } // End of EFrameworkunifiedStatus ModuleLaunchParams::SendMsgAndUpdateState(T_SS_SM_STOP_DataStructType const * f_stopData) -EFrameworkunifiedStatus ModuleLaunchParams::GetPriority(UI_32 & f_Priority) noexcept { +EFrameworkunifiedStatus ModuleLaunchParams::GetPriority(UI_32& f_Priority) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus; @@ -583,7 +616,7 @@ EFrameworkunifiedStatus ModuleLaunchParams::GetPriority(UI_32 & f_Priority) noex return l_eStatus; } // End of EFrameworkunifiedStatus ModuleLaunchParams::GetPriority (UI_32 & f_Priority ) -EFrameworkunifiedStatus ModuleLaunchParams::SetPriority(UI_32 f_Priority) noexcept { +EFrameworkunifiedStatus ModuleLaunchParams::SetPriority(UI_32 f_Priority) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus; @@ -647,7 +680,7 @@ EFrameworkunifiedStatus ModuleLaunchParams::SetPriority(UI_32 f_Priority) noexce return l_eStatus; } // End of EFrameworkunifiedStatus ModuleLaunchParams::SetPriority( UI_32 f_Priority ) -SysMgrConfiguration::SysMgrConfiguration() noexcept: +SysMgrConfiguration::SysMgrConfiguration(): l_pReaderCfg(NULL) { } @@ -686,8 +719,7 @@ static BOOL is_satisfy_env_launch_cond(CHAR *env_cond) { // LCOV_EXCL_START 6: return l_isSatisfy; } -void set_grp_member_info(const LaunchInfo & launch_info, - ModuleLaunchList & module_lst) noexcept { // NOLINT +static void set_grp_member_info(const LaunchInfo& launch_info, ModuleLaunchList& module_lst) { // NOLINT AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert // Note: the ModuleLaunchParams grp_member_info; @@ -704,13 +736,16 @@ void set_grp_member_info(const LaunchInfo & launch_info, grp_member_info.group_id = launch_info.group_id; grp_member_info.is_start_required = launch_info.is_start_required; grp_member_info.fast_shutdown_wait_time = launch_info.fast_shutdown_wait_time; + grp_member_info.SetAGLUnit(launch_info.IsAGLUnit()); + grp_member_info.SetAGLResetHistoryDisable(launch_info.IsAGLResetHistoryDisable()); + grp_member_info.SetNonAGLResetHisoryDisable(launch_info.IsNonAGLResetHistoryDisable()); module_lst.push_back(grp_member_info); } // LCOV_EXCL_STOP -ModuleLaunchListIter set_cfg_grp_member_info( - const CfgLaunchParams & launch_info, ModuleLaunchList & module_lst) noexcept { // NOLINT +static ModuleLaunchListIter set_cfg_grp_member_info( + const CfgLaunchParams& launch_info, ModuleLaunchList& module_lst) { // NOLINT ModuleLaunchParams grp_member_info; ModuleLaunchListIter moduleLaunchListIter; @@ -721,6 +756,7 @@ ModuleLaunchListIter set_cfg_grp_member_info( grp_member_info.restart = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) std::strcmp(launch_info.restart, "NULL") == 0 ? "" : launch_info.restart); grp_member_info.configuration_priority = launch_info.priority; + grp_member_info.cpu_assign = launch_info.cpu_assign; grp_member_info.retry_cnt = launch_info.retry_cnt; grp_member_info.logging_msk_str = ( // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) std::strcmp(launch_info.logging_msk_str, "NULL") == 0 ? "" : launch_info.logging_msk_str); @@ -731,6 +767,9 @@ ModuleLaunchListIter set_cfg_grp_member_info( grp_member_info.group_id = launch_info.group_id; grp_member_info.is_start_required = launch_info.is_start_required; grp_member_info.fast_shutdown_wait_time = launch_info.fast_shutdown_wait_time; + grp_member_info.SetAGLUnit(launch_info.IsAGLUnit()); + grp_member_info.SetAGLResetHistoryDisable(launch_info.IsAGLResetHistoryDisable()); + grp_member_info.SetNonAGLResetHisoryDisable(launch_info.IsNonAGLResetHistoryDisable()); strncpy(&grp_member_info.unix_user_name[0], &launch_info.unix_user_name[0], sizeof(TUserNameBuffer)); @@ -739,9 +778,9 @@ ModuleLaunchListIter set_cfg_grp_member_info( return (moduleLaunchListIter); } -void load_parameters_order_cfg(GroupLaunchMap &groups_map, // NOLINT - LaunchOrderedVector &f_OrderList, SS_String &f_launchOrderName, // NOLINT - SS_String &f_launchCfgFn) noexcept { // NOLINT +static void load_parameters_order_cfg(GroupLaunchMap& groups_map, // NOLINT + LaunchOrderedVector& f_OrderList, SS_String& f_launchOrderName, // NOLINT + SS_String& f_launchCfgFn) { // NOLINT SS_String l_OrderCfgFn = f_launchCfgFn; string::size_type pos = l_OrderCfgFn.find(".cfg"); @@ -832,7 +871,7 @@ class SubStringIterator { m_position(s.begin()), m_end(s.end()), m_seperator(c), m_done(false) { } - std::string next() noexcept { + std::string next() { SCIter begin = m_position; while (m_position != m_end && *m_position != m_seperator) { @@ -860,15 +899,15 @@ class SubStringIterator { }; template - -Iter skipPrecedingWS(Iter begin, Iter end) noexcept { // LCOV_EXCL_START 6: Because the condition cannot be set +static +Iter skipPrecedingWS(Iter begin, Iter end) { // LCOV_EXCL_START 6: Because the condition cannot be set AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert return std::find_if(begin, end, std::not1(std::ptr_fun((int (*)(int))std::isspace))); } // remove only preceding and trailing whitespace, but leave intermediate whitespace characters alone -std::string strip(const std::string& str) noexcept { +std::string strip(const std::string& str) { AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert std::string::const_iterator skipTo = skipPrecedingWS(str.begin(), str.end()); if (skipTo == str.end()) { // if string consists of ONLY whitespace @@ -879,9 +918,9 @@ std::string strip(const std::string& str) noexcept { } // LCOV_EXCL_STOP -BOOL SysMgrConfiguration::LoadParametersCfg(GroupLaunchMap &groups_map, - ProcessNameMap &f_processNameMap, LaunchOrderedVector &f_OrderList, - SS_String &f_launchOrderName, SS_String &f_launchCfgFn) noexcept { +BOOL SysMgrConfiguration::LoadParametersCfg(GroupLaunchMap& groups_map, + ProcessNameMap& f_processNameMap, LaunchOrderedVector& f_OrderList, + SS_String& f_launchOrderName, SS_String& f_launchCfgFn) { BOOL rtn_code = TRUE; FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); @@ -929,6 +968,9 @@ BOOL SysMgrConfiguration::LoadParametersCfg(GroupLaunchMap &groups_map, CHAR is_start_required[10] = { }; CHAR shutdown_critical[10] = { }; CHAR group_wait_for_trigger[10] = { }; + CHAR is_agl_unit[10] = { }; + CHAR disable_agl_resethistory[10] = { }; + CHAR disable_nonagl_resethistory[10] = { }; CfgLaunchParams cfg_data; int at = static_cast(ss_sm_cfg::cfg_args::group_name); @@ -1002,11 +1044,24 @@ BOOL SysMgrConfiguration::LoadParametersCfg(GroupLaunchMap &groups_map, strip(data_).c_str(), sizeof(cfg_data.unix_user_name) - 1); break; + case ss_sm_cfg::cfg_args::is_agl_unit: + strncpy(is_agl_unit, data, sizeof(is_agl_unit)); + break; + case ss_sm_cfg::cfg_args::disable_agl_resethistory: + strncpy(disable_agl_resethistory, data, sizeof(disable_agl_resethistory)); + break; + case ss_sm_cfg::cfg_args::disable_nonagl_resethistory: + strncpy(disable_nonagl_resethistory, data, sizeof(disable_nonagl_resethistory)); + break; case ss_sm_cfg::cfg_args::env_value_condition: // LCOV_EXCL_START 6: Because an initialization condition is set at SystemManager startup and the branching condition cannot be satisfied // NOLINT(whitespace/line_length) AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert snprintf(cfg_data.env_value_condition, sizeof(cfg_data.env_value_condition), "%s", data); break; + case ss_sm_cfg::cfg_args::cpu_assign: + cfg_data.cpu_assign = + static_cast(strtoul(data, NULL, 16)); + break; default: AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, @@ -1066,6 +1121,10 @@ BOOL SysMgrConfiguration::LoadParametersCfg(GroupLaunchMap &groups_map, cfg_data.shutdown_critical = (std::strcmp("True", shutdown_critical) == 0); + cfg_data.SetAGLUnit(ParseBoolParameter(is_agl_unit, TRUE)); + cfg_data.SetAGLResetHistoryDisable(ParseBoolParameter(disable_agl_resethistory)); + cfg_data.SetNonAGLResetHisoryDisable(ParseBoolParameter(disable_nonagl_resethistory)); + GroupLaunchInfo grp_info; grp_info.start_complete = FALSE; grp_info.stop_complete = FALSE; @@ -1139,7 +1198,7 @@ BOOL SysMgrConfiguration::LoadParametersCfg(GroupLaunchMap &groups_map, return rtn_code; } -VOID SysMgrConfiguration::PrintGroupInfo(GroupLaunchInfo & refGrpInfo) noexcept { +VOID SysMgrConfiguration::PrintGroupInfo(GroupLaunchInfo& refGrpInfo) { std::stringstream l_logMsg; l_logMsg << endl << "Group: " << refGrpInfo.name.data() << endl @@ -1151,7 +1210,7 @@ VOID SysMgrConfiguration::PrintGroupInfo(GroupLaunchInfo & refGrpInfo) noexcept FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str()); } -VOID SysMgrConfiguration::PrintModuleInfo(ModuleLaunchParams & refMbrInfo) noexcept { +VOID SysMgrConfiguration::PrintModuleInfo(ModuleLaunchParams& refMbrInfo) { std::stringstream l_logMsg; // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length) @@ -1161,6 +1220,8 @@ VOID SysMgrConfiguration::PrintModuleInfo(ModuleLaunchParams & refMbrInfo) noexc << refMbrInfo.restart.data() << endl << " configuration_priority: " << refMbrInfo.configuration_priority << endl + << " cpu_assign: " + << refMbrInfo.cpu_assign << endl << " current_priority: " << refMbrInfo.current_priority << endl << " previous_priority: " << refMbrInfo.previous_priority << endl << " critical: " << (refMbrInfo.critical == TRUE ? "YES" : "NO") @@ -1174,7 +1235,10 @@ VOID SysMgrConfiguration::PrintModuleInfo(ModuleLaunchParams & refMbrInfo) noexc << (refMbrInfo.shutdown_critical == TRUE ? "YES" : "NO") << endl << " shutdown_wait_time: " << refMbrInfo.shutdown_wait_time << endl << " fast_shutdown_wait_time: " - << refMbrInfo.fast_shutdown_wait_time << endl << " state: " + << refMbrInfo.fast_shutdown_wait_time << endl << " is_agl_unit: " + << refMbrInfo.IsAGLUnit() << endl << " disable_agl_resethistory: " + << refMbrInfo.IsAGLResetHistoryDisable() << endl << " disable_nonagl_resethistory: " + << refMbrInfo.IsNonAGLResetHistoryDisable() << endl << " state: " << refMbrInfo.ModuleStateStr() << endl << " group ID: " << refMbrInfo.group_id << endl << " debug dump state: " << refMbrInfo.GetModuleDebugDumpStateStr(); @@ -1183,7 +1247,7 @@ VOID SysMgrConfiguration::PrintModuleInfo(ModuleLaunchParams & refMbrInfo) noexc FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str()); } -VOID SysMgrConfiguration::PrintAllInfo(GroupLaunchMap & refGrpMap) noexcept { +VOID SysMgrConfiguration::PrintAllInfo(GroupLaunchMap& refGrpMap) { // get first client from the map... GroupLaunchMapIter grp_iter = refGrpMap.begin(); @@ -1196,10 +1260,25 @@ VOID SysMgrConfiguration::PrintAllInfo(GroupLaunchMap & refGrpMap) noexcept { } } +BOOL SysMgrConfiguration::ParseBoolParameter(PCSTR f_value, BOOL f_default) const { + if (FALSE == f_default) { + const char TRUE_VALUE[] = "True"; + if (0 == strcmp(TRUE_VALUE, f_value)) { + return TRUE; + } + } else { + const char FALSE_VALUE[] = "False"; + if (0 == strcmp(FALSE_VALUE, f_value)) { + return FALSE; + } + } + return f_default; +} + /* * SM Configuration data constructor */ -SMConfigParams::SMConfigParams() noexcept { +SMConfigParams::SMConfigParams() { } /* @@ -1217,7 +1296,7 @@ SMConfigParams::~SMConfigParams() { /// /// \return VOID //////////////////////////////////////////////////////////////////////////////////////////// -VOID SMConfigParams::PrintConfigInfo(ConfigurationData const & f_ConfigParams) noexcept { +VOID SMConfigParams::PrintConfigInfo(ConfigurationData const & f_ConfigParams) { FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppHeartBeatInterval_Initial Info: %d", f_ConfigParams.HBConfig.ApplicationHeartBeatIntervalInitial); FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "AppHeartBeatInterval_Repeat Info: %d", @@ -1260,8 +1339,7 @@ VOID SMConfigParams::PrintConfigInfo(ConfigurationData const & f_ConfigParams) n /// \return BOOL /// BOOL - TRUE or FALSE //////////////////////////////////////////////////////////////////////////////////////////// -BOOL SMConfigParams::GetSMConfigInformation(ConfigurationData &f_ConfigParams, - SS_String f_FileName) noexcept { +BOOL SMConfigParams::GetSMConfigInformation(ConfigurationData& f_ConfigParams, SS_String f_FileName) { EFrameworkunifiedStatus l_eStatus; BOOL l_rtnCode = FALSE; // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) @@ -1398,8 +1476,7 @@ BOOL SMConfigParams::GetSMConfigInformation(ConfigurationData &f_ConfigParams, /// \return BOOL /// BOOL - TRUE or FALSE //////////////////////////////////////////////////////////////////////////////////////////// -BOOL SMConfigParams::LoadSMConfigParameters(ConfigurationData &f_ConfigParams, - SS_String f_FileName) noexcept { +BOOL SMConfigParams::LoadSMConfigParameters(ConfigurationData& f_ConfigParams, SS_String f_FileName) { BOOL rtn_code = TRUE; rtn_code = GetSMConfigInformation(f_ConfigParams, f_FileName); diff --git a/system_manager/server/src/ss_sm_dynamic_launcher.cpp b/system_manager/server/src/ss_sm_dynamic_launcher.cpp index 02c7f076..6144fa4d 100644 --- a/system_manager/server/src/ss_sm_dynamic_launcher.cpp +++ b/system_manager/server/src/ss_sm_dynamic_launcher.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,7 +27,7 @@ #include "ss_sm_dynamic_launch_table.h" #include "ss_sm_systemmanagerlog.h" -DynamicLaunchBase::DynamicLaunchBase() noexcept: +DynamicLaunchBase::DynamicLaunchBase(): m_vOrderedGroup(), m_iterOrderedGroup() { } @@ -41,7 +41,7 @@ UI_32 DynamicLaunchBase::get_id() const { return *m_iterOrderedGroup; } -UI_32 DynamicLaunchBase::advance_id() noexcept { +UI_32 DynamicLaunchBase::advance_id() { if (!is_end()) { m_iterOrderedGroup++; } @@ -49,7 +49,7 @@ UI_32 DynamicLaunchBase::advance_id() noexcept { return *m_iterOrderedGroup; } -UI_32 DynamicLaunchBase::decrement_id() noexcept { +UI_32 DynamicLaunchBase::decrement_id() { if (!is_begin()) { // LCOV_EXCL_BR_LINE 5: stdlib error case. m_iterOrderedGroup--; } @@ -80,7 +80,7 @@ VOID DynamicLaunchBase::to_end() { return; } -VOID DynamicLaunchBase::print_info() noexcept { +VOID DynamicLaunchBase::print_info() { UI_32 idx = 1; std::stringstream l_logMsg; DynamicOrderedIter l_dyn_iter = m_vOrderedGroup.begin(); @@ -95,7 +95,7 @@ VOID DynamicLaunchBase::print_info() noexcept { FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", l_logStr.c_str()); } -DynamicLauncher::DynamicLauncher() noexcept:DynamicLaunchBase(), +DynamicLauncher::DynamicLauncher() :DynamicLaunchBase(), m_nLaunchGroupId(0), m_nLaunchBeforeGroupId(0), m_nLaunchAfterGroupId(0), @@ -113,8 +113,8 @@ BOOL DynamicLauncher::dynamic_launch_enabled() const { // LCOV_EXCL_START 8: De } // LCOV_EXCL_STOP -VOID DynamicLauncher::configure_dynamic_launch(const SS_SOURCE & source_type, - GroupLaunchMap & group_info, LaunchOrderedVector & order_info) noexcept { +VOID DynamicLauncher::configure_dynamic_launch(const SS_SOURCE& source_type, + GroupLaunchMap& group_info, LaunchOrderedVector& order_info) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); m_eSourceType = source_type; // "Dynamic Launch" is not used due to high dependency on a service table @@ -123,7 +123,7 @@ VOID DynamicLauncher::configure_dynamic_launch(const SS_SOURCE & source_type, } BOOL DynamicLauncher::is_inGroupLaunchMap(UI_32& id, - GroupLaunchMap & group_info) noexcept { // LCOV_EXCL_START 8: Dead code + GroupLaunchMap& group_info) { // LCOV_EXCL_START 8: Dead code AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); BOOL Ret = FALSE; @@ -136,9 +136,10 @@ BOOL DynamicLauncher::is_inGroupLaunchMap(UI_32& id, } // LCOV_EXCL_STOP -DynamicLaunchInfo * DynamicLauncher::get_dynamic_source_info( - const SS_SOURCE & source_type, BOOL &source_trigger, - BOOL &is_aviage_required) noexcept { // LCOV_EXCL_START 8: Dead code +// LCOV_EXCL_START 8: Dead code +DynamicLaunchInfo* DynamicLauncher::get_dynamic_source_info( + const SS_SOURCE& source_type, BOOL& source_trigger, + BOOL& is_aviage_required) { AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert UI_32 num_of_items = static_cast(_countof(g_arrDynamicLaunchTableCfg)); DynamicLaunchInfo * point_to_this = NULL; @@ -160,7 +161,7 @@ DynamicLaunchInfo * DynamicLauncher::get_dynamic_source_info( // LCOV_EXCL_STOP UI_32 DynamicLauncher::get_id_using_group_name(PCSTR group_name, - GroupLaunchMap & group_info) noexcept { // LCOV_EXCL_START 8: Dead code + GroupLaunchMap& group_info) { // LCOV_EXCL_START 8: Dead code AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert GroupLaunchMapIter l_grp_iter = group_info.begin(); UI_32 rtn_grp_id = 0; @@ -175,8 +176,8 @@ UI_32 DynamicLauncher::get_id_using_group_name(PCSTR group_name, } // LCOV_EXCL_STOP -VOID DynamicLauncher::create_normal_launch_vector(GroupLaunchMap & group_info, - LaunchOrderedVector & order_info) noexcept { +VOID DynamicLauncher::create_normal_launch_vector(GroupLaunchMap& group_info, + LaunchOrderedVector& order_info) { m_vOrderedGroup.clear(); if (order_info.size() != 0) { // LCOV_EXCL_BR_LINE 6: To initialize conditions for launching SystemManager @@ -202,19 +203,19 @@ VOID DynamicLauncher::create_normal_launch_vector(GroupLaunchMap & group_info, print_info(); } -VOID DynamicLauncher::copyDynOrderedVector(DynamicModuleStart & Start) noexcept { +VOID DynamicLauncher::copyDynOrderedVector(DynamicModuleStart& Start) { Start.setGroupVector(this->m_vOrderedGroup); } // DynamicModuleStart -DynamicModuleStart::DynamicModuleStart() noexcept:DynamicLaunchBase() { +DynamicModuleStart::DynamicModuleStart() :DynamicLaunchBase() { } DynamicModuleStart::~DynamicModuleStart() { } -VOID DynamicModuleStart::setGroupVector(DynamicOrderedVector & Vector) noexcept { +VOID DynamicModuleStart::setGroupVector(DynamicOrderedVector& Vector) { m_vOrderedGroup.assign(Vector.begin(), Vector.end()); m_iterOrderedGroup = m_vOrderedGroup.begin(); } // LCOV_EXCL_BR_LINE 10: Final line diff --git a/system_manager/server/src/ss_sm_version.cpp b/system_manager/server/src/ss_sm_version.cpp index dbbd64c9..9df970f2 100644 --- a/system_manager/server/src/ss_sm_version.cpp +++ b/system_manager/server/src/ss_sm_version.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ CSMVersion::CSMVersion() { CSMVersion::~CSMVersion() { } -EFrameworkunifiedStatus CSMVersion::get_version(SS_VersionNumberType &f_VersionNumber) noexcept { +EFrameworkunifiedStatus CSMVersion::get_version(SS_VersionNumberType& f_VersionNumber) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); CSSVer ver; @@ -59,7 +59,7 @@ EFrameworkunifiedStatus CSMVersion::get_version(SS_VersionNumberType &f_VersionN return l_eStatus; } // End of EFrameworkunifiedStatus CSMVersion::get_version(SS_VersionNumberType &f_VersionNumber) -EFrameworkunifiedStatus CSMVersion::get_build_info(std::string &f_buildInfoStr) noexcept { +EFrameworkunifiedStatus CSMVersion::get_build_info(std::string& f_buildInfoStr) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; std::string build_info_str; diff --git a/system_manager/server/src/ss_system_manager.cpp b/system_manager/server/src/ss_system_manager.cpp index 62f944e2..8e26f232 100644 --- a/system_manager/server/src/ss_system_manager.cpp +++ b/system_manager/server/src/ss_system_manager.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,12 +20,9 @@ /// /////////////////////////////////////////////////////////////////////////////// -//#include #include #include #include -//#include -//#include #include #include @@ -45,7 +42,7 @@ #include #include -//#include +#include #include #include @@ -53,8 +50,6 @@ #include #include #include -#include -#include #include #include #include @@ -62,12 +57,10 @@ #include #include #include -#include #include #include -//#include -//#include -//#include +#include +#include #include #include #include @@ -102,7 +95,7 @@ using namespace std; // NOLINT static CSystemManager g_oSystemManger; -#define SS_SM_TEMP_FILE_FOR_STORE_LOGS "/nv/romaccess/sm_tempStoreLogs" +#define SS_SM_TEMP_FILE_FOR_STORE_LOGS "/nv/BS/ss/system_manager/rwdata/sm_tempStoreLogs" #define TR_USB_PATH "/usr/agl/bin/realtimeUsbLog" // \brief: public structure that is used for logging by NSLogger. @@ -130,21 +123,6 @@ std::string NumberToString(int Number) { // LCOV_EXCL_START 8: dead code // LCOV_EXCL_STOP /* Check if "Mount Point" exsists as Directory */ -static bool CheckMountPoint(const char* mntpt) { - bool exists_mntpt = false; - struct stat stat_buf; - - if (NULL != mntpt) { // LCOV_EXCL_BR_LINE 200: cannot be null - if (0 == lstat(mntpt, &stat_buf)) { - if(S_ISDIR(stat_buf.st_mode)) { - exists_mntpt = true; - } - } - } - return exists_mntpt; -} - - /*****************************************************************************/ /** @ingroup: CSystemManager @@ -227,8 +205,6 @@ CSystemManager::CSystemManager() : m_hPowerServiceSession(NULL), m_ActiveGroupId(SS_SM_INITIAL_GROUP), m_StartUpReason(epswfINVALID), - m_BootMemory(NULL), - m_BootMemoryMapSize(0), m_DataResetMode(e_SS_SM_DATA_RESET_MODE_NONE), m_ProgUpdateState(SS_SM_PROG_UPDATE_STATE_NONE), m_NextWakeupType(e_SS_SM_NEXT_WAKEUP_TYPE_NONE), @@ -241,7 +217,6 @@ CSystemManager::CSystemManager() : m_MaxShutdownTime(0), m_NbrDebugDumpRspnRecv(0), m_isRcvModeInfo(FALSE), - m_BootMode(e_SS_SM_BOOT_MODE_INVALID), m_BinaryFilesPath(""), m_ConfigFilesPath(""), m_pfStopCompleteHandler( @@ -282,10 +257,12 @@ CSystemManager::CSystemManager() : m_requestedArtifactId(eArtifactIdInterfaceunifiedDebugLog) { // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) m_InitialBoot = true; + m_ResetFactor = PSM_FACTOR_NONE; + m_Wake.powerupType = epswsPWRON; m_Wake.up.level = epswlFULLRUN; - m_SystemModeInfo.lastUserMode = epsumINVALID; + m_SystemModeInfo.lastUserMode = m_lastUserMode; m_SystemModeInfo.limpHomeCutoff = epslhcINVALID; m_SystemModeInfo.productionMode = epspmINVALID; m_SystemModeInfo.transportMode = epstmINVALID; @@ -295,44 +272,17 @@ CSystemManager::CSystemManager() : bzero(&m_SMConfig, sizeof(m_SMConfig)); bzero(&m_startUpConfirmationMsg, sizeof(m_startUpConfirmationMsg)); bzero(&m_HBReport, sizeof(m_HBReport)); - bzero(&m_Lbm_Ram, sizeof(LBM_RAM_t)); m__CWORD56_HistIter = m__CWORD56_CmdHist.begin(); m_TimerHistIter = m_TimerCmdHist.begin(); m_SMHistIter = m_SMCmdHist.begin(); m_PubHistIter = m_PubCmdHist.begin(); m_ErrHistIter = m_ErrHist.begin(); - // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length) - ListOfServicesAuthorizedToSetBootMode.push_back(SERVICE_SOFTWAREUPDATE); - // - // ToDo: Remove "Updater Thread" name from the Authorized list - ListOfServicesAuthorizedToSetBootMode.push_back("UpdaterThread"); - // - // ToDo Jay 02 July 2012 Replace with actual name - ListOfServicesAuthorizedToSetBootMode.push_back(SERVICE_HMI); - ListOfServicesAuthorizedToSetBootMode.push_back(SERVICE_VS_DIAG); - ListOfServicesAuthorizedToSetBootMode.push_back(SERVICE_PSM_SHADOW); - ListOfServicesAuthorizedToSetBootMode.push_back(TC_SysManager); - ListOfServicesAuthorizedToSetBootMode.push_back(SERVICE_VUP); - ListOfServicesAuthorizedToSetBootMode.push_back(SS_UPDATESERVICE); - ListOfServicesAuthorizedToSetBootMode.push_back("SSBOX"); ////******************************************************************//// //// Initialization of enum<=>enum and enum=>string maps //// //// //// - // - // **** Initialization of BootMode enum maps **** - // Map of Power Service SystemModeInfo to System Services BootMode - // enum values - m_PSSMI_to_SSBootMode_map[epssinfINVALID] = e_SS_SM_BOOT_MODE_INVALID; - m_PSSMI_to_SSBootMode_map[epssinfNORMAL] = e_SS_SM_BOOT_MODE_APPLICATION; - m_PSSMI_to_SSBootMode_map[epssinfPROGRAMMING] = e_SS_SM_BOOT_MODE_PROGRAMMING; - // - // Map of System Services to Power Service SystemModeInfo BootMode - // enum values - m_SSBootMode_to_PSSMI_map[e_SS_SM_BOOT_MODE_INVALID] = epssinfINVALID; - m_SSBootMode_to_PSSMI_map[e_SS_SM_BOOT_MODE_APPLICATION] = epssinfNORMAL; - m_SSBootMode_to_PSSMI_map[e_SS_SM_BOOT_MODE_PROGRAMMING] = epssinfPROGRAMMING; + // // **** Initialization of powerupType enum maps **** // Map of System Services powerupType to BOOL enum values @@ -355,60 +305,6 @@ CSystemManager::CSystemManager() : // Map of BOOL to System Services User Mode enum values m_SSUserMode_to_SSBoolEnumMap[epsumOFF] = FALSE; m_SSUserMode_to_SSBoolEnumMap[epsumON] = TRUE; - // - // Map of ROM to System Services User Mode enum values - m_ROM_to_SSUserModeEnumMap[USER_OFF] = epsumOFF; - m_ROM_to_SSUserModeEnumMap[USER_ON] = epsumON; - // - // Map of System Services to ROM User Mode enum values - m_SS_to_ROMUserModeEnumMap[epsumOFF] = USER_OFF; - m_SS_to_ROMUserModeEnumMap[epsumON] = USER_ON; - // - // **** Initialization of Limp Home Cutoff maps **** - // Map of Control to Limp Home Cutoff Mode enum values - m_Control_to_LimpHomeCutoffMode_map[DISABLE_MODE] = epslhcDISABLED; - m_Control_to_LimpHomeCutoffMode_map[ENABLE_MODE] = epslhcENABLED; - // - // Map of Limp Home Cutoff Mode to Control enum values - m_LimpHomeCutoff_to_ControlMode_map[epslhcDISABLED] = DISABLE_MODE; - m_LimpHomeCutoff_to_ControlMode_map[epslhcENABLED] = ENABLE_MODE; - // - // **** Initialization of Production Mode maps **** - // Map of Control to Production Mode enum values - m_Control_to_ProductionMode_map[DISABLE_MODE] = epspmDISABLED; - m_Control_to_ProductionMode_map[ENABLE_MODE] = epspmENABLED; - // - // Map of Production to Mode Control enum values - m_Production_to_ControlMode_map[epspmDISABLED] = DISABLE_MODE; - m_Production_to_ControlMode_map[epspmENABLED] = ENABLE_MODE; - // - // **** Initialization of Transport Mode maps **** - // Map of Control Mode to Transport Mode enum values - m_Control_to_TransportMode_map[DISABLE_MODE] = epstmDISABLED; - m_Control_to_TransportMode_map[ENABLE_MODE] = epstmENABLED; - // - // Map of Transport Mode to Control Mode enum values - m_Transport_to_ControlMode_map[epstmDISABLED] = DISABLE_MODE; - m_Transport_to_ControlMode_map[epstmENABLED] = ENABLE_MODE; - -// m_PsmSysupDram_to_SysupDramMap[PSM_SYSUP_DRAM_NORMAL] = SYSUP_DRAM_NORMAL; -// m_PsmSysupDram_to_SysupDramMap[PSM_SYSUP_DRAM_SFTERRSR] = SYSUP_DRAM_SFTERRSR; -// m_PsmSysupDram_to_SysupDramMap[PSM_SYSUP_DRAM_DISCARD] = SYSUP_DRAM_DISCARD; - -// m_PsmStartStatus_to_SysupCndMap[PSM_START_STATUS_FACTRESET] = SYSUP_CND_FACTRESET; -// m_PsmStartStatus_to_SysupCndMap[PSM_START_STATUS_NORMAL] = SYSUP_CND_NORMAL; - -// m_PsmComSts_to_SubcpuStsMap[PSM_COM_STS_NORMAL] = SUBCPU_STS_NOMAL; -// m_PsmComSts_to_SubcpuStsMap[PSM_COM_STS_ABNORMAL] = SUBCPU_STS_COMNG; - -// m_PsmDramSts_to_SdramStsMap[PSM_DRAM_STS_NORMAL] = SDRAM_STS_NOMAL; -// m_PsmDramSts_to_SdramStsMap[PSM_DRAM_STS_ABNORMAL] = SDRAM_STS_BUPNG; - -// m_PsmDramSts_to_RamjudgeStsMap[PSM_DRAM_STS_NORMAL] = RAMJUDGE_STS_NOMAL; -// m_PsmDramSts_to_RamjudgeStsMap[PSM_DRAM_STS_ABNORMAL] = RAMJUDGE_STS_NG; - -// m_PsmDramSts_to_SelfRefreshMap[PSM_DRAM_STS_NORMAL] = SELF_REFRESH_OK; -// m_PsmDramSts_to_SelfRefreshMap[PSM_DRAM_STS_ABNORMAL] = SELF_REFRESH_NG; // LCOV_EXCL_BR_STOP //// //// @@ -469,18 +365,6 @@ void CSystemManager::Initialize_memory(HANDLE hApp, bool* l_isInitFail, EFramewo m_PreLaunchModuleList.push_back(l_rtuparam); } - { - PreLaunchModuleParams l_param; - l_param.LaunchFunc = CreateSyslogd; - l_param.relaunchLimit = 1; // limit of abnormal relaunching - l_param.name = "syslogd"; - l_param.binaryFileName = "/usr/bin/syslogd"; - if (l_param.pid == 1) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: CreateSyslogd()"); - } - m_PreLaunchModuleList.push_back(l_param); - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); int fd = open("/dev/urandom", O_RDONLY); // LCOV_EXCL_BR_LINE 5: standard lib error @@ -521,84 +405,13 @@ void CSystemManager::Initialize_memory(HANDLE hApp, bool* l_isInitFail, EFramewo ReadPathFromEnvironmentVariables(); ReadUsingVMPlayerEnvironmentVariable(); - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "\n" - "bootIf\n" - " sts :%#x %s\n" - " dram123 :%#x/%#x/%#x %s\n" - " syscomSts :%#x %s\n" - " pwSts :%#x %s\n" - " ramjudgeSts :%#x %s\n" - " dram_self_refresh:%#x %s", m_BootMemory->sts, - (m_BootMemory->sts == SYSUP_CND_FACTRESET) ? "FACT" : "NML", - m_BootMemory->dram1, m_BootMemory->dram2, m_BootMemory->dram3, - (m_BootMemory->dram1 == SYSUP_DRAM_NORMAL) ? "NML" : - (m_BootMemory->dram1 == SYSUP_DRAM_DISCARD) ? "DISCARD" : "ERROR", - m_BootMemory->syscomSts, - (m_BootMemory->syscomSts == SUBCPU_STS_COMNG) ? "NG" : "NML", - m_BootMemory->pwSts, - (m_BootMemory->pwSts == SDRAM_STS_BUPNG) ? "NG" : "NML", - m_BootMemory->ramjudgeSts, - (m_BootMemory->ramjudgeSts == RAMJUDGE_STS_NG) ? "NG" : "NML", - m_BootMemory->dram_self_refresh, - (m_BootMemory->dram_self_refresh == SELF_REFRESH_NG) ? "NG" : "OK"); - - { - DRAM_BACKUP_STATE l_bkupState = - (SDRAM_STS_BUPNG == m_BootMemory->pwSts) ? DRAM_BACKUP_STATE_NG : DRAM_BACKUP_STATE_OK; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - ROM_AccessIf rom_access; - if (eFrameworkunifiedStatusOK != (*l_eStatus_work = rom_access.SystemInitialize(l_bkupState))) { - l_eStatus = *l_eStatus_work; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: rom_access.SystemInitialize(%d)", l_eStatus); - *l_isInitFail = true; - } - } + // FIXME : Dump information from power_hal by using if (eFrameworkunifiedStatusOK != (*l_eStatus_work = SetSystemModeInfoStruct())) { LOG_ERROR("SetSystemModeInfoStruct()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) *l_isInitFail = true; } - m_BootMode = m_PSSMI_to_SSBootMode_map[m_SystemModeInfo.systemMode]; - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Bootmode is '%s'", GetStr(m_BootMode).c_str()); - FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "Bootmode is '%s'", GetStr(m_BootMode).c_str()); - - { - ROM_AccessIf rom_access; - rom_access.Initialize(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - BOOL isLastIlgReset = FALSE; - - if (eFrameworkunifiedStatusOK != (*l_eStatus_work = GetLastIlgReset(rom_access, isLastIlgReset))) { - l_eStatus = *l_eStatus_work; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: GetLastIlgReset(%d)", l_eStatus); - } - - m_isIlgReset = isIllReset ? TRUE : isLastIlgReset; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - - if (eFrameworkunifiedStatusOK != (*l_eStatus_work = SetLastIlgReset(rom_access, m_isIlgReset))) { - l_eStatus = *l_eStatus_work; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: SetLastIlgReset(%d)", l_eStatus); - } - } - - { - RAM_WAKEUP_STATE l_ramWakeupState = - (SDRAM_STS_BUPNG == m_BootMemory->pwSts) ? RAM_WAKEUP_STATE_BACKUP_NG : RAM_WAKEUP_STATE_DONT_CARE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - RAM_AccessIf l_cRamAccess(l_ramWakeupState); - RAM_SM_INFO_t info; - - if (eFrameworkunifiedStatusOK != (*l_eStatus_work = l_cRamAccess.getRamInfo(&info))) { - l_eStatus = *l_eStatus_work; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: l_cRamAccess.getRamInfo(%d)", l_eStatus); - } else { - m_isImmediateReset = info.isImmediateReset; - info.isImmediateReset = TRUE; - if (eFrameworkunifiedStatusOK != (*l_eStatus_work = l_cRamAccess.setRamInfo(&info))) { - l_eStatus = *l_eStatus_work; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: l_cRamAccess.setRamInfo(%d)", l_eStatus); - } - } - } - // Select configuration file for wakeup services BOOL bIsVupMode = (m_SystemModeInfo.systemMode == epssinfPROGRAMMING) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) @@ -606,7 +419,6 @@ void CSystemManager::Initialize_memory(HANDLE hApp, bool* l_isInitFail, EFramewo std::memset(&inPrm, 0, sizeof(inPrm)); inPrm.bIsVupMode = bIsVupMode; - inPrm.cbRebootNoticeFunc = SysMgrCallback; if (eFrameworkunifiedStatusOK != (*l_eStatus_work = ss_sm_initHook(hApp, &inPrm, &m_productCustomPrm))) { SS_ASERT_LOG(0, "ERROR: ss_sm_initHook()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) @@ -874,9 +686,7 @@ EFrameworkunifiedStatus CSystemManager::Initialize(HANDLE hApp) { bool l_isInitFail = false; EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; int ret; -// PsmStartStatusT l_sts; -// PsmComStsT l_syscom_sts; -// PsmDramStsT l_dram_sts; + PsmFactorT l_startup_factor; // Need to call Lock System Initialize API once in the system ret = CL_LockSystemInit(); @@ -890,79 +700,52 @@ EFrameworkunifiedStatus CSystemManager::Initialize(HANDLE hApp) { l_isInitFail = true; } - SS_STATIC_ASERT(sizeof(LBM_RAM_t) <= SS_SYS_AREA_BOOT_MAX_SIZE); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) + ret = PsmGetStartupFactor(hApp, &l_startup_factor); + if (ret == 0) { + if ((static_cast(l_startup_factor) & PSM_RESET_HISTORY) == PSM_RESET_HISTORY) { + DGCODE_RET_API l_ret = DGCODE_RET_ERROR; + uint64_t l_SystemResetRobCode = 0; + DGCODE_ROB_SSR_INFO l_info; + if (l_startup_factor == PSM_FACTOR_AGL_WITH_HISTORY) { + l_SystemResetRobCode = 0x2219; // AGL cause + } else if (l_startup_factor == PSM_FACTOR_TIER1_WITH_HISTORY) { + l_SystemResetRobCode = 0x221A; // Tier1 cause + } else if (l_startup_factor == PSM_FACTOR_USER_WITH_HISTORY) { + l_SystemResetRobCode = 0x8027; // USER cause + } else { + // No processing + } - m_BootMemoryMapSize = SS_SYS_AREA_BOOT_MAX_SIZE; -// if (EL_mem_getLength(EL_MEM_ID_SYS_BOOT) < m_BootMemoryMapSize) { -// m_BootMemoryMapSize = static_cast(EL_mem_getLength(EL_MEM_ID_SYS_BOOT)); -// } - m_BootMemory = &m_Lbm_Ram; - if (m_BootMemory == NULL) { // LCOV_EXCL_BR_LINE 200: m_BootMemory always not null - // LCOV_EXCL_START 200: m_BootMemory always not null - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - m_BootMemoryMapSize = 0; - fprintf(stderr, "SS_SysManager/%s/ERROR:EL_mem_getLength\n", __FUNCTION__); - // LCOV_EXCL_STOP - } + if (l_SystemResetRobCode != 0) { + memset(&l_info, 0x00, sizeof(DGCODE_ROB_SSR_INFO)); -// ret = PsmGetStartStatusPower(hApp, &l_sts); -// if ((ret == 0) && ((l_sts >= PSM_START_STATUS_FACTRESET) && (l_sts < PSM_START_STATUS_MAX))) { -// m_BootMemory->sts = m_PsmStartStatus_to_SysupCndMap[static_cast(l_sts)]; -// } else { -// (void)fprintf(stderr, "SS_SysManager/%s/ERROR:start status not get\n", __FUNCTION__); -// } -// ret = PsmGetSyscomStatusPower(hApp, &l_syscom_sts); -// if ((ret == 0) && ((l_syscom_sts >= PSM_COM_STS_NORMAL) && (l_syscom_sts < PSM_COM_STS_MAX))) { -// m_BootMemory->syscomSts = m_PsmComSts_to_SubcpuStsMap[static_cast(l_syscom_sts)]; -// } else { -// (void)fprintf(stderr, "SS_SysManager/%s/ERROR:communication status between mainsoc-sys not get\n", __FUNCTION__); -// } -// ret = PsmGetDramPowerSupplyAbnormalityCheckResultPower(hApp, &l_dram_sts); -// if ((ret == 0) && ((l_dram_sts >= PSM_DRAM_STS_NORMAL) && (l_dram_sts < PSM_DRAM_STS_MAX))) { -// m_BootMemory->pwSts = m_PsmDramSts_to_SdramStsMap[static_cast(l_dram_sts)]; -// m_BootMemory->ramjudgeSts = m_PsmDramSts_to_RamjudgeStsMap[static_cast(l_dram_sts)]; -// m_BootMemory->dram_self_refresh = m_PsmDramSts_to_SelfRefreshMap[static_cast(l_dram_sts)]; -// } else { -// (void)fprintf(stderr, "SS_SysManager/%s/ERROR:dram power supply abnormality check result not get\n", __FUNCTION__); -// } - - if (SYSUP_CND_FACTRESET == m_BootMemory->sts) { - if (eFrameworkunifiedStatusOK != (l_eStatus = PerformMountResetAll())) { - fprintf(stderr, "SS_SysManager/%s/Error: PerformMountResetAll() errored: %d\n", __FUNCTION__, l_eStatus); + l_ret = Diag_PutRoBInfo(hApp, l_SystemResetRobCode, &l_info); + if (l_ret == DGCODE_RET_ERROR) { + LOG_ERROR("Diag_PutRoBInfo()"); + } + } } - SetDramStatusInfo(SYSUP_DRAM_NORMAL); } else { - if (eFrameworkunifiedStatusOK != (l_eStatus = PerformMountNand())) { // LCOV_EXCL_BR_LINE 200: PerformMountNand return always OK - // LCOV_EXCL_START 200: PerformMountNand return always OK - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - fprintf(stderr, "SS_SysManager/%s/Error: PerformMountNand() errored: %d\n", __FUNCTION__, l_eStatus); - l_isInitFail = true; - // LCOV_EXCL_STOP - } + (void)fprintf(stderr, "SS_SysManager/%s/ERROR:start-up factor not get\n", __FUNCTION__); } - BOOL isIllReset = (m_BootMemory->syscomSts == SUBCPU_STS_COMNG) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - bool isMountRamd = false; - - if (isIllReset || ("elog" == m_bootOpt)) { - fprintf(stderr, "SS_SysManager/%s/Error: ILGRST LOG SAVE\n", __FUNCTION__); - isMountRamd = StoreDebugLogs(SS_STORELOGS_ILLEGAL); + m_isIlgReset = (false == GetSyscomPowerStatusInfo(hApp)) ? TRUE : FALSE; + if (m_isIlgReset || ("elog" == m_bootOpt)) { + fprintf(stderr, "SS_SysManager/%s/Error: ILGRST LOG SAVE\n", __func__); + StoreDebugLogs(hApp, SS_STORELOGS_ILLEGAL); } else { - isMountRamd = StoreDebugLogs(SS_STORELOGS_ACCOFFON); + StoreDebugLogs(hApp, SS_STORELOGS_ACCOFFON); } - if (SDRAM_STS_BUPNG == m_BootMemory->pwSts) { - l_eStatus = PerformMountResetRamd(hApp, isMountRamd); - if (eFrameworkunifiedStatusOK != l_eStatus) { - fprintf(stderr, "SS_SysManager/%s/Error: PerformMountResetRamd() errored: %d\n", __FUNCTION__, l_eStatus); + if (m_isIlgReset == TRUE) { + // overwrite AGL_ILLRESET_FLAG. + uint32_t tmp = static_cast(m_isIlgReset); + if (PowerHalSetResetInfo(AGL_ILLRESET_FLAG, tmp)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not set AGL_ILLRESET_FLAG to power_hal"); } } else { - if (isMountRamd == false) { - if (eFrameworkunifiedStatusOK != (l_eStatus = PerformMountRamd())) { -// fprintf(stderr, "SS_SysManager/%s/Error: PerformMountRamd() errored: %d\n", __FUNCTION__, l_eStatus); - l_isInitFail = true; - } - } + // keep last value of AGL_ILLRESET_FLAG. } FRAMEWORKUNIFIED_SET_ZONES(); @@ -986,7 +769,7 @@ EFrameworkunifiedStatus CSystemManager::Initialize(HANDLE hApp) { // Threads MUST NOT be started until this line // ===== Initialization No.1 - Initialize_memory(hApp, &l_isInitFail, &l_eStatus, isIllReset); + Initialize_memory(hApp, &l_isInitFail, &l_eStatus, m_isIlgReset); // ===== Initialization No.2 Initialize_callbacks(hApp, &l_isInitFail, &l_eStatus); @@ -1060,143 +843,41 @@ ERROR: return pid; }// LCOV_EXCL_STOP -#define SYSLOGD_PATH "/usr/bin/syslogd" -#define SYSLOGD_NFS_PATH "/tmp/syslogd" -#define SYSLOG_LIMIT_FSIZE (249 * 1024); // 249KB -int CSystemManager::CreateSyslogd(void) {// LCOV_EXCL_START 8: dead code - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - int pid = -1; - int ret; - - ret = mkdir("/var/run", 0775); - if ((ret < 0) && (errno != EEXIST)) { - return -1; - } - { - // Suppress Warning : logrotate - // error: stat of /ramd/log/frameworkunifiedlog/syslog/syslog.log failed: No such file or directory - int fd; - fd = open("/ramd/log/frameworkunifiedlog/syslog/syslog.log", O_CREAT | O_RDWR | O_CLOEXEC, 0644); - if (fd != -1) { - AGL_ASSERT_NOT_TESTED(); - close(fd); - } - } - - pid = fork(); - switch (pid) { - case 0: // child process - { - struct sched_param param; - int policy; - const char *exec; - struct rlimit rlim; - sigset_t mask; - const char* nfsenv = getenv("AGL_NFS"); - if (nfsenv && (strcmp(nfsenv, "y") == 0)) { - exec = const_cast(SYSLOGD_NFS_PATH); - } else { - exec = const_cast(SYSLOGD_PATH); - } - // file size - if (sigaddset(&mask, SIGXFSZ) < 0) { // RLIMIT_FSIZE - SS_ASERT(0); - _exit(-1); - } - if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) { - SS_ASERT(0); - _exit(-1); - } - getrlimit(RLIMIT_FSIZE, &rlim); - rlim.rlim_cur = SYSLOG_LIMIT_FSIZE; - if (setrlimit(RLIMIT_FSIZE, &rlim) < 0) { - SS_ASERT(0); - _exit(-1); - } - param.sched_priority = 0; - policy = SCHED_OTHER; - if (sched_setscheduler(getpid(), policy, ¶m) < 0) { - SS_ASERT(0); - _exit(-1); - } - if (setpriority(PRIO_PROCESS, getpid(), 0) < 0) { - SS_ASERT(0); - _exit(-1); - } - // exec - if (execlp(exec, exec, "-n", "-f", "/usr/agl/conf/syslogd/syslog.conf", NULL) < 0) { - SS_ASERT(0); - _exit(-1); - } - _exit(0); - } - break; - - case -1: // error - SS_ASERT(0); - goto ERROR; - - default: // parent process - break; - } - - ERROR: return pid; -}// LCOV_EXCL_STOP - -bool CSystemManager::StoreDebugLogs(SS_STORELOGS_OPE_TYPE type) { +bool CSystemManager::StoreDebugLogs(const HANDLE h_app, + SS_STORELOGS_OPE_TYPE type) { bool isMountRamd = false; EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; int pid; - if (m_BootMemory->ramjudgeSts != RAMJUDGE_STS_NOMAL) { -// fprintf(stderr, "SS_SysManager/%s/Error: RAM JUDGE NG\n", __FUNCTION__); + if (!GetDramPowerStatusInfo(h_app)) { goto ERROR; } else if (access(SS_SM_TEMP_FILE_FOR_STORE_LOGS, F_OK) == 0) { fprintf(stderr, "SS_SysManager/%s/Error: Skip StoreDebugLogs\n", __FUNCTION__); goto ERROR; } - if (eFrameworkunifiedStatusOK != (l_eStatus = PerformMountRamd())) { - fprintf(stderr, "SS_SysManager/%s/Error: PerformMountRamd() errored: %d\n", __FUNCTION__, l_eStatus); - goto ERROR; - } isMountRamd = true; if (type == SS_STORELOGS_ILLEGAL) { - // In order to obtain the anomaly reboot count, nv information is acquired first when ILG is reset. - // * Duplicate initialization and recovery operations to simplify design. - // Therefore, SystemInitialize() must operate normally even if it is called more than once. - DRAM_BACKUP_STATE l_bkupState = - (SDRAM_STS_BUPNG == m_BootMemory->pwSts) ? DRAM_BACKUP_STATE_NG : DRAM_BACKUP_STATE_OK; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - ROM_AccessIf rom_access; - if (eFrameworkunifiedStatusOK != (l_eStatus = rom_access.SystemInitialize(l_bkupState))) { - fprintf(stderr, "SS_SysManager/%s/Error: rom_access.SystemInitialize(%d)\n", __FUNCTION__, l_eStatus); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) + UI_32 l_ErrLogCount = 0; + if (PowerHalGetResetInfo(AGL_ERRLOG_COUNTER, &l_ErrLogCount)) { + fprintf(stderr, "SS_SysManager/%s/Error: " + "Could not read AGL_ERRLOG_COUNTER from power_hal\n", __FUNCTION__); goto ERROR; } - rom_access.Initialize(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - - UI_32 l_SigValue; - - if ((eFrameworkunifiedStatusOK != GetSignature(rom_access, &l_SigValue)) - || (l_SigValue != NVM_VALID_SIGNATURE)) { - fprintf(stderr, "SS_SysManager/%s/Error: NVM SIGERR\n", __FUNCTION__); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else { - UI_32 l_ErrLogCount; - - if (eFrameworkunifiedStatusOK != GetErrLogCount(rom_access, l_ErrLogCount)) { - fprintf(stderr, "SS_SysManager/%s/Error: GetErrLogCount()\n", __FUNCTION__); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else { - if (l_ErrLogCount >= SS_SM_ERR_LOGGING_LIMIT) { - fprintf(stderr, "SS_SysManager/%s/Error: Skip StoreDebugLogs by continuous error \n", __FUNCTION__); - goto ERROR; - } + if (l_ErrLogCount >= SS_SM_ERR_LOGGING_LIMIT) { + fprintf(stderr, "SS_SysManager/%s/Error: " + "Skip StoreDebugLogs by continuous error l_ErrLogCount=%lu\n", + __FUNCTION__, l_ErrLogCount); + goto ERROR; + } - l_ErrLogCount++; - if (eFrameworkunifiedStatusOK != SetErrLogCount(rom_access, l_ErrLogCount)) { - fprintf(stderr, "SS_SysManager/%s/Error: SetErrLogCount()\n", __FUNCTION__); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } - } + l_ErrLogCount++; + if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, l_ErrLogCount)) { + // Just logging, don't go to ERROR. + fprintf(stderr, "SS_SysManager/%s/Error: " + "Could not write AGL_ERRLOG_COUNTER to power_hal\n", __FUNCTION__); } } else if (type == SS_STORELOGS_ACCOFFON) { if (0 != unlink(SS_LOGGER_SAVE_INTERFACEUNIFIEDLOG_FLAG)) { @@ -1249,381 +930,6 @@ bool CSystemManager::StoreDebugLogs(SS_STORELOGS_OPE_TYPE type) { return isMountRamd; } -#define SM_MNT_P_NAND_LOG "/mnt_nv/mmcblk0p11" -#define SM_MNT_P_NAND_PTDATE "/mnt_nv/mmcblk0p17" -#define SM_MNT_P_NAND_LOG2 "/mnt_nv/mmcblk0p18" -#define SM_MNT_P_NAND_NV "/nv" -#define SM_MNT_P_NAND_NV_SYSTEM "/nv_system" -#define SM_MNT_P_RAMD_SYSTEMMANAGERLOG "/ramd/log/frameworkunifiedlog" -#define SM_MNT_P_RAMD_BKUP "/ramd/bkup" - -#define SM_MNT_P_RAMD_SDL "/ramd/sdl" - -EFrameworkunifiedStatus CSystemManager::PerformMountResetAll(void) { // LCOV_EXCL_START 6: Because the condition cannot be set - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; -// MntErr l_eMnt; - -// l_eMnt = MntResetAll(); -// if (MNT_SUCCESS != l_eMnt) { -// fprintf(stderr, "SS_SysManager/%s/Error: MntResetAll(%d)\n", __FUNCTION__, l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - - return l_eStatus; -} -// LCOV_EXCL_STOP - -EFrameworkunifiedStatus CSystemManager::PerformMountResetRamd(const HANDLE h_app, const bool isMountRamd) { - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; -// MntErr l_eMnt; - bool l_reset = false; - bool l_reset_sdl = false; -// PsmDramStsT l_dram_sts; - int ret; - -// l_eMnt = MntReset(SM_MNT_P_RAMD_SYSTEMMANAGERLOG); -// if (MNT_SUCCESS != l_eMnt) { -// fprintf(stderr, "SS_SysManager/%s/Error: MntReset(%s:%d)\n", __FUNCTION__, SM_MNT_P_RAMD_SYSTEMMANAGERLOG, l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - // Although RomAccessIf.progUpdate should be used to determine the initial start after updating Changing the - // RomAccessIf initialization timings at the end of development is risky and should be judged by SYSUP_DRAM_DISCARD. -// ret = PsmGetDramPowerSupplyAbnormalityCheckResultPower(h_app, &l_dram_sts); -// if ((ret == 0) && ((l_dram_sts >= PSM_DRAM_STS_NORMAL) && (l_dram_sts < PSM_DRAM_STS_MAX))) { -// m_BootMemory->pwSts = m_PsmDramSts_to_SdramStsMap[static_cast(l_dram_sts)]; -// m_BootMemory->ramjudgeSts = m_PsmDramSts_to_RamjudgeStsMap[static_cast(l_dram_sts)]; -// m_BootMemory->dram_self_refresh = m_PsmDramSts_to_SelfRefreshMap[static_cast(l_dram_sts)]; -// } else { -// LOG_ERROR("PsmGetDramPowerSupplyAbnormalityCheckResultPower()"); -// } - - if ((SYSUP_DRAM_DISCARD == GetDramStatusInfo(h_app)) - && (m_BootMemory->ramjudgeSts == RAMJUDGE_STS_NOMAL - && m_BootMemory->dram_self_refresh == SELF_REFRESH_OK)) { - if (!isMountRamd) { -// l_eMnt = MntMountEx(SM_MNT_P_RAMD_BKUP); -// if (MNT_SUCCESS != l_eMnt) { -// fprintf(stderr, "SS_SysManager/%s/Error: MntMountEX(%s:%d)\n", __FUNCTION__, SM_MNT_P_RAMD_BKUP, l_eMnt); -// l_reset = true; -// l_eStatus = eFrameworkunifiedStatusFail; -// } - - if (CheckMountPoint(SM_MNT_P_RAMD_SDL)) { -// l_eMnt = MntMountEx(SM_MNT_P_RAMD_SDL); -// if (MNT_SUCCESS != l_eMnt) { -// fprintf(stderr, "SS_SysManager/%s/Error: MntMountEX(%s:%d)\n", __FUNCTION__, SM_MNT_P_RAMD_SDL, l_eMnt); -// l_reset_sdl = true; -// l_eStatus = eFrameworkunifiedStatusFail; -// } - } - - } - } else { - l_reset = true; - - if (CheckMountPoint(SM_MNT_P_RAMD_SDL)) { - l_reset_sdl = true; - } - - } - - /* SM_MNT_P_RAMD_BKUP */ - if (l_reset) { -// l_eMnt = MntReset(SM_MNT_P_RAMD_BKUP); -// if (MNT_SUCCESS != l_eMnt) { // LCOV_EXCL_BR_LINE 6: Due to Initialize processing - // LCOV_EXCL_START 6: Due to Initialize processing -// AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert -// fprintf(stderr, "SS_SysManager/%s/Error: MntReset(%s:%d)\n", __FUNCTION__, SM_MNT_P_RAMD_BKUP, l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; - // LCOV_EXCL_STOP -// } - } - - /* SM_MNT_P_RAMD_SDL */ - // Additional correspondence of SDL is NA only : For common code, Add "Check Mount Point" - if (l_reset_sdl) { - if (CheckMountPoint(SM_MNT_P_RAMD_SDL)) { // LCOV_EXCL_BR_LINE 6: l_reset_sdl==True guarantees CheckMountPoint is True // NOLINT(whitespace/line_length) -// l_eMnt = MntReset(SM_MNT_P_RAMD_SDL); -// if (MNT_SUCCESS != l_eMnt) { -// fprintf(stderr, "SS_SysManager/%s/Error: MntReset(%s:%d)\n", __FUNCTION__, SM_MNT_P_RAMD_SDL, l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - } - } - - return l_eStatus; -} - -EFrameworkunifiedStatus CSystemManager::PerformMountNand(void) { - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - -// Delete in order to move mount to init quickly - - return l_eStatus; -} - -EFrameworkunifiedStatus CSystemManager::PerformMountRamd(void) { - -//#define SS_SM_MOUNT_RAMD_MAX (2) - - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - -#if 0 - const char* l_mountlist[SS_SM_MOUNT_RAMD_MAX] = { SM_MNT_P_RAMD_SYSTEMMANAGERLOG, SM_MNT_P_RAMD_BKUP }; - MntErr l_eMnt[SS_SM_MOUNT_RAMD_MAX]; - - MntMultiMountEx(l_mountlist, SS_SM_MOUNT_RAMD_MAX, l_eMnt); - for (int i = 0; i < SS_SM_MOUNT_RAMD_MAX; i++) { - if (MNT_SUCCESS != l_eMnt[i] && MNT_ERR_MOUNTED != l_eMnt[i]) { -// fprintf(stderr, "SS_SysManager/%s/Error: MntMultiMountEx(%s:%d)\n", -// __FUNCTION__, l_mountlist[i], l_eMnt[i]); - MntErr l_eMntReset; - l_eMntReset = MntReset(l_mountlist[i]); - if (MNT_SUCCESS != l_eMntReset) { -// fprintf(stderr, "SS_SysManager/%s/Error: MntReset(%s:%d)\n", -// __FUNCTION__, l_mountlist[i], l_eMntReset); - l_eStatus = eFrameworkunifiedStatusFail; - } - } - } -#endif - const char* l_mountlist[] = { SM_MNT_P_RAMD_SYSTEMMANAGERLOG, - SM_MNT_P_RAMD_BKUP }; - const char* l_mountlist_sdl[] = { SM_MNT_P_RAMD_SYSTEMMANAGERLOG, - SM_MNT_P_RAMD_BKUP, - SM_MNT_P_RAMD_SDL }; - const char** l_mlist = l_mountlist; - int ramd_mount_max = sizeof (l_mountlist) / sizeof (l_mountlist[0]); - - // Additional correspondence of SDL is NA only : For common code, Add "Check Mount Point" - if (CheckMountPoint(SM_MNT_P_RAMD_SDL)) { - l_mlist = l_mountlist_sdl; - ramd_mount_max = sizeof (l_mountlist_sdl) / sizeof (l_mountlist_sdl[0]); - } - -// MntErr l_eMnt[ramd_mount_max]; - -// MntMultiMountEx((const char**)l_mlist, ramd_mount_max, l_eMnt); -// for (int i = 0; i < ramd_mount_max; i++) { -// if (MNT_SUCCESS != l_eMnt[i] && MNT_ERR_MOUNTED != l_eMnt[i]) { -// fprintf(stderr, "SS_SysManager/%s/Error: MntMultiMountEx(%s:%d)\n", __FUNCTION__, l_mlist[i], l_eMnt[i]); -// MntErr l_eMntReset; -// l_eMntReset = MntReset(l_mlist[i]); -// if (MNT_SUCCESS != l_eMntReset) { -// fprintf(stderr, "SS_SysManager/%s/Error: MntReset(%s:%d)\n", __FUNCTION__, l_mlist[i], l_eMntReset); -// l_eStatus = eFrameworkunifiedStatusFail; -// } -// } -// } - - return l_eStatus; -} - -EFrameworkunifiedStatus CSystemManager::PerformUmountNand(void) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; -// MntErr l_eMnt; - -// l_eMnt = MntUmountEx(SM_MNT_P_NAND_PTDATE); -// if (MNT_SUCCESS != l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: MntUmountEx(%s:%d)", -// SM_MNT_P_NAND_PTDATE, l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - -// l_eMnt = MntUmountEx(SM_MNT_P_NAND_NV); -// if (MNT_SUCCESS != l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: MntUmountEx(%s:%d)", -// SM_MNT_P_NAND_NV, l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - -// l_eMnt = MntUmountEx(SM_MNT_P_NAND_LOG2); // /nv/log2 -// if (MNT_SUCCESS != l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: MntUmountEx(%s:%d)", -// SM_MNT_P_NAND_LOG2, l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - -// l_eMnt = MntUmountEx(SM_MNT_P_NAND_LOG); // /nv/log -// if (MNT_SUCCESS != l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: MntUmountEx(%s:%d)", -// SM_MNT_P_NAND_LOG, l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - -// l_eMnt = MntUmountEx(SM_MNT_P_NAND_NV_SYSTEM); -// if (MNT_SUCCESS != l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: MntUmountEx(/nv_system:%d)", -// l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - -EFrameworkunifiedStatus CSystemManager::PerformUmountRamd(void) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; -// MntErr l_eMnt; - - - /* SM_MNT_P_RAMD_BKUP */ - PreLaunchModuleListIter l_itr; - for (l_itr = m_PreLaunchModuleList.begin(); - m_PreLaunchModuleList.end() != l_itr; l_itr++) { - if (("syslogd" == l_itr->name) && (-1 != l_itr->pid)) { // LCOV_EXCL_BR_LINE 200:prelaunch mode is not valid at UT test //NOLINT (whitespace/line_length) - // LCOV_EXCL_START 200 :prelaunch mode is not valid at UT test - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - if (0 != kill(l_itr->pid, SS_SM_KILL_SIGNAL)) { // LCOV_EXCL_BR_LINE 5:kill error case - SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } else { - SS_ASERT_ERRNO(l_itr->pid == waitpid(l_itr->pid, NULL, 0)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } - // LCOV_EXCL_STOP - } - } - -// l_eMnt = MntUmountEx(SM_MNT_P_RAMD_BKUP); -// if (MNT_ERR_BUSY == l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: MntUmountEx(%s) BUSY", SM_MNT_P_RAMD_BKUP); - - ModuleLaunchListIter l_ModuleListIter; - l_eStatus = GetModuleIterator(MN_NS_BACKUPMGR, l_ModuleListIter); - if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200 : BACKUP cannot be error - // LCOV_EXCL_START 200 : BACKUP cannot be error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s not found", MN_NS_BACKUPMGR); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) - // LCOV_EXCL_STOP - } else if (0 >= l_ModuleListIter->pid) { - SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - l_eStatus = eFrameworkunifiedStatusFail; - } else { - int ret; - - ret = kill(l_ModuleListIter->pid, SS_SM_TERMINATE_SIGNAL); - if (0 != ret) { // LCOV_EXCL_BR_LINE 5:kill error case - // LCOV_EXCL_START 5: kill error case - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - l_eStatus = eFrameworkunifiedStatusFail; - // LCOV_EXCL_STOP - } else { - pid_t retPid; - - retPid = waitpid(l_ModuleListIter->pid, NULL, 0); - if (l_ModuleListIter->pid != retPid) { // LCOV_EXCL_BR_LINE 5:waitpid error case - // LCOV_EXCL_START 5: kill error case - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - l_eStatus = eFrameworkunifiedStatusFail; - // LCOV_EXCL_STOP - } else { -// l_eMnt = MntUmountEx(SM_MNT_P_RAMD_BKUP); -// if (MNT_SUCCESS != l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, -// " Error: MntUmountEx(%s:%d)", -// SM_MNT_P_RAMD_BKUP, l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - } - } - } -// } else if (MNT_SUCCESS != l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: MntUmountEx(%s:%d)", SM_MNT_P_RAMD_BKUP, l_eMnt); -// } - - - /* SM_MNT_P_RAMD_SDL */ - // Additional correspondence of SDL is NA only : For common code, Add "Check Mount Point" - if (CheckMountPoint(SM_MNT_P_RAMD_SDL)) { -// l_eMnt = MntUmountEx(SM_MNT_P_RAMD_SDL); -// if (MNT_SUCCESS != l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: MntUmountEx(%s:%d)", SM_MNT_P_RAMD_SDL, l_eMnt); -// } - } - - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - -EFrameworkunifiedStatus CSystemManager::PerformForceUmountRamd(void) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - ModuleLaunchListIter l_ModuleListIter; - - l_eStatus = GetModuleIterator(MN_NS_BACKUPMGR, l_ModuleListIter); - if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 200 : cannot be error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s not found", MN_NS_BACKUPMGR); // LCOV_EXCL_LINE:200 cannot be error - } else if (0 >= l_ModuleListIter->pid) { - SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - l_eStatus = eFrameworkunifiedStatusFail; - } else { - if (0 != kill(l_ModuleListIter->pid, SS_SM_TERMINATE_SIGNAL)) { - SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - l_eStatus = eFrameworkunifiedStatusFail; - } else { - if (l_ModuleListIter->pid != waitpid(l_ModuleListIter->pid, NULL, 0)) { // LCOV_EXCL_BR_LINE 5:waitpid error case //NOLINT (whitespace/line_length) - // LCOV_EXCL_START 5: waitpid error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - l_eStatus = eFrameworkunifiedStatusFail; - // LCOV_EXCL_STOP - } else { -// MntErr l_eMnt = MntUmountEx2(SM_MNT_P_RAMD_BKUP, MNT_UMOUNT_NOLOG); -// if (MNT_SUCCESS != l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: MntUmountEx(%s:%d)", -// SM_MNT_P_RAMD_BKUP, l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - } - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - -EFrameworkunifiedStatus CSystemManager::PerformFinalUmount(BOOL bIsNeedLog) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; -// MntErr l_eMnt; -// MntLogMode l_MntMode = MNT_LOGOFF; - ModuleLaunchListIter l_ModuleListIter; - - if (eFrameworkunifiedStatusOK != GetModuleIterator(MN_SS_LOGGERSRV, l_ModuleListIter)) { // LCOV_EXCL_BR_LINE 200:LOGSERVER is not valid at UT - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: %s not found", MN_SS_LOGGERSRV); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) - } else if (0 >= l_ModuleListIter->pid) { // LCOV_EXCL_BR_LINE 200:LOGSERVER is not valid at UT - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SS_ASERT(0); // LCOV_EXCL_LINE 200: LOGSERVER is not valid at UT - } else { - // LCOV_EXCL_START 200: LOGSERVER is not valid at UT - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - if (0 != kill(l_ModuleListIter->pid, SS_SM_KILL_SIGNAL)) { // LCOV_EXCL_BR_LINE 5: standard lib error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - SS_ASERT_ERRNO(0); // LCOV_EXCL_LINE 5: standard lib error - } - // LCOV_EXCL_STOP - } - - if (bIsNeedLog) { -// l_MntMode = MNT_LOGON; - } - -// l_eMnt = MntFinalUmount(l_MntMode); -// if (MNT_SUCCESS != l_eMnt) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: MntFinalUmount(%d)", l_eMnt); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - #define SS_SM_SCAC_DEVICE_NODE "/dev/scac_driver" #define SS_SM_SCAC_CMD_SHUTDOWN 0x3000 @@ -1651,12 +957,6 @@ EFrameworkunifiedStatus CSystemManager::SecureChipOff() { close(fd); } -// const EFrameworkunifiedStatus l_ret = ResetSecurityIC(); -// if (eFrameworkunifiedStatusOK != l_ret) { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "ResetSecurityIC ERR(%#X)", l_ret); -// l_eStatus = eFrameworkunifiedStatusFail; -// } - isOffDone = true; } else { FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Skip Chip Off"); @@ -1728,7 +1028,6 @@ EFrameworkunifiedStatus CSystemManager::SetSystemModeInfoStruct() { if (m_UsingVMPlayer) { FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " 'm_UsingVMPlayer' is True," " using default SystemModeInfo values"); - m_SystemModeInfo.lastUserMode = epsumOFF; m_SystemModeInfo.limpHomeCutoff = epslhcDISABLED; m_SystemModeInfo.productionMode = epspmDISABLED; m_SystemModeInfo.transportMode = epstmDISABLED; @@ -1739,153 +1038,29 @@ EFrameworkunifiedStatus CSystemManager::SetSystemModeInfoStruct() { // Don't change the m_SystemModeInfo.startupStage. // It is set dynamically as System Manager initializes the _CWORD102_. } else { - UI_32 SigValue; - UI_32 * pSigValue = &SigValue; - ROM_AccessIf l_cRomAccess; - l_cRomAccess.Initialize(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - bool isFast = true; - - if (eFrameworkunifiedStatusOK != (l_eStatus = GetSignature(l_cRomAccess, pSigValue))) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("GetSignature( l_cRomAccess, pSigValue)"); // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup - } else { - ESMBootModeInfo l_BootMode; - if (SigValue != NVM_VALID_SIGNATURE) { - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "[SBX]NVM SIGERR"); - - isFast = false; - - // LCOV_EXCL_BR_START 6: For setting the initialization conditions at SystemManager startup - if (eFrameworkunifiedStatusOK != (l_eStatus = - SetSignature(l_cRomAccess, NVM_VALID_SIGNATURE))) { - // LCOV_EXCL_BR_STOP - LOG_ERROR("SetSignature(NVM_VALID_SIGNATURE"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetActiveFlashloader(l_cRomAccess, NEW_FLASHLOADER))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetActiveFlashloader(NEW_FLASHLOADER)"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetBootMode(l_cRomAccess, e_SS_SM_BOOT_MODE_APPLICATION))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetBootMode(e_SS_SM_BOOT_MODE_APPLICATION)"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetLastUserMode(l_cRomAccess, epsumON))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetLastUserMode(epsumON))"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetLimpHomeCutoffMode(l_cRomAccess, epslhcDISABLED))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetLimpHomeCutOffReqMode(epslhcDISABLED)"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetProductionMode(l_cRomAccess, epspmDISABLED))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetProductionMode(epspmDISABLED)"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetTransportMode(l_cRomAccess, epstmDISABLED))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetTransportMode(epstmDISABLED)"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetDataResetMode(l_cRomAccess, e_SS_SM_DATA_RESET_MODE_FACTORY))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetDataResetMode(e_SS_SM_DATA_RESET_MODE_FACTORY)"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetResetCount(l_cRomAccess, 0))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetResetCount(0)"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetLastIlgReset(l_cRomAccess, FALSE))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetLastIlgReset(LAST_ILGRESET_NORMAL)"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetProgUpdateState(l_cRomAccess, - m_ProgUpdateState))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetProgUpdateState(NONE)"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetErrLogCount(l_cRomAccess, 0))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetErrLogCount(0)"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = SetNextWakeupType(l_cRomAccess, - e_SS_SM_NEXT_WAKEUP_TYPE_NONE))) { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("SetNextWakeupType(NEXT_WAKEUP_TYPE_NONE)"); - } else { - UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]; - - memset(buf, 0, sizeof(buf)); + uint32_t tmp = 0; + if (PowerHalGetResetInfo(AGL_RESET_COUNTER, &m_ResetCount)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not read AGLRESET_COUNTER from power_hal, assume to 0"); + m_ResetCount = 0; + } - if (eFrameworkunifiedStatusOK - != (l_eStatus = SetProductPrivate(l_cRomAccess, buf))) { - LOG_ERROR("SetProductPrivate(fill_0)"); - } - } - } // End if NVM had not yet been initialized + if (PowerHalGetResetInfo(AGL_PROGUPDATE_STATE, &m_ProgUpdateState)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not read AGL_PROGUPDATE_STATE from power_hal, " + "assume to SS_SM_PROG_UPDATE_STATE_NONE"); + m_ProgUpdateState = SS_SM_PROG_UPDATE_STATE_NONE; + } - if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 6: Because the condition of the first if statement is satisfied, the branch condition cannot be satisfied. - // LCOV_EXCL_START 6: Because the condition of the first if statement is satisfied, the branch condition cannot be satisfied. - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - // Get Boot Mode ( BootMode determines SystemModeInfo ) - if (eFrameworkunifiedStatusOK - != (l_eStatus = GetBootMode(l_cRomAccess, l_BootMode))) { - LOG_ERROR("GetBootMode()"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = GetLastUserMode(l_cRomAccess, - m_SystemModeInfo.lastUserMode))) { - LOG_ERROR("GetLastUserMode()"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = GetLimpHomeCutoffMode(l_cRomAccess, - m_SystemModeInfo.limpHomeCutoff))) { - LOG_ERROR("GetLimpHomeCutoff()"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = GetProductionMode(l_cRomAccess, - m_SystemModeInfo.productionMode))) { - LOG_ERROR("GetProductionMode()"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = GetTransportMode(l_cRomAccess, - m_SystemModeInfo.transportMode))) { - LOG_ERROR("GetTransportMode()"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = GetDataResetMode(l_cRomAccess, - m_DataResetMode, isFast))) { // Call using Fast - LOG_ERROR("GetDataResetMode()"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = GetResetCount(l_cRomAccess, - m_ResetCount))) { - LOG_ERROR("GetResetCount()"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = GetProgUpdateState(l_cRomAccess, - m_ProgUpdateState))) { - LOG_ERROR("GetProgUpdateState()"); - } else if (eFrameworkunifiedStatusOK - != (l_eStatus = GetNextWakeupType(l_cRomAccess, - m_NextWakeupType))) { - LOG_ERROR("GetNextWakeupType()"); - } - // LCOV_EXCL_STOP - } // End else either 1) Signature already set or 2) NVM successfully - // initialized - // ToDo Jay 2012 September 24 Save SystemModeInfo ( ala Progamming / - // Application ) or get overlap wrt BootMode straightened out - // Convert BootMode as read from NVM to SystemModeInfo as expected by - // PowerShadow. ToDo: Investigate consolidating the two types. - if (eFrameworkunifiedStatusOK == l_eStatus) { - switch (l_BootMode) { - case e_SS_SM_BOOT_MODE_APPLICATION: - m_SystemModeInfo.systemMode = epssinfNORMAL; - break; - case e_SS_SM_BOOT_MODE_PROGRAMMING: - m_SystemModeInfo.systemMode = epssinfPROGRAMMING; - break; - default: - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: Unknown l_BootMode value: 0x%X", - l_BootMode); - l_eStatus = eFrameworkunifiedStatusInvldParam; - break; - } - } - } // End else a successful read of the NVM Signature field + if (PowerHalGetResetInfo(AGL_DATARESET_STATE, &tmp)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not read AGL_DATARESET_STATE from power_hal, " + "assume to e_SS_SM_DATA_REESET_MODE_NONE"); + m_DataResetMode = e_SS_SM_DATA_RESET_MODE_NONE; + } else { + m_DataResetMode = static_cast(tmp); + } + m_SystemModeInfo.systemMode = epssinfNORMAL; } // End else ! m_UsingVMPlayer FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); @@ -1908,7 +1083,7 @@ EFrameworkunifiedStatus CSystemManager::ClearDramBackupInfo(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "PsmClrRamJudgeFlgPower()"); -// ret = PsmClrRamJudgeFlgPower(hApp); + ret = PsmClrRamJudgeFlgPower(hApp); if (ret != 0) { // LCOV_EXCL_BR_LINE 11: Excluded due to gcov constraints (others) SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) l_eStatus = eFrameworkunifiedStatusFail; @@ -2006,60 +1181,27 @@ VOID CSystemManager::SMStateStartCompleteEntry(HANDLE hApp) { l_eStatus = SendRequestToHeartBeat(hApp, SS_HEARTBEAT_START, &send_data, static_cast(sizeof(send_data))); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "SendRequestToHeartBeat()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) + m_DataResetMode = e_SS_SM_DATA_RESET_MODE_NONE; { - ROM_AccessIf rom_access; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - rom_access.Initialize(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - - if (e_SS_SM_DATA_RESET_MODE_NONE != m_DataResetMode) { - l_eStatus = SetDataResetMode(rom_access, e_SS_SM_DATA_RESET_MODE_NONE); // LCOV_EXCL_BR_LINE 11: Excluded due to gcov constraints (others) - - if (eFrameworkunifiedStatusOK != l_eStatus) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: SetDataResetMode(%d)", l_eStatus); - } else { - m_DataResetMode = e_SS_SM_DATA_RESET_MODE_NONE; - } - } - if (m_ProgUpdateState != SS_SM_PROG_UPDATE_STATE_NONE) { - m_ProgUpdateState = SS_SM_PROG_UPDATE_STATE_NONE; - l_eStatus = SetProgUpdateState(rom_access, m_ProgUpdateState); // LCOV_EXCL_BR_LINE 11: Excluded due to gcov constraints (others) - if (eFrameworkunifiedStatusOK != l_eStatus) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: SetProgUpdateState(%d)", l_eStatus); - } - } - - m_isIlgReset = FALSE; - - l_eStatus = SetLastIlgReset(rom_access, m_isIlgReset); // LCOV_EXCL_BR_LINE 11: Excluded due to gcov constraints (others) - if (eFrameworkunifiedStatusOK != l_eStatus) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: SetLastIlgReset(%d)", l_eStatus); + uint32_t tmp = static_cast(m_DataResetMode); + if (PowerHalSetResetInfo(AGL_DATARESET_STATE, tmp)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not set AGL_DATARESET_STATE to power_hal"); } + } - if (e_SS_SM_NEXT_WAKEUP_TYPE_NONE != m_NextWakeupType) { - l_eStatus = SetNextWakeupType(rom_access, e_SS_SM_NEXT_WAKEUP_TYPE_NONE); // LCOV_EXCL_BR_LINE 11: Excluded due to gcov constraints (others) - if (eFrameworkunifiedStatusOK != l_eStatus) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: SetNextWakeupType(%d)", l_eStatus); - } - } + m_ProgUpdateState = SS_SM_PROG_UPDATE_STATE_NONE; + if (PowerHalSetResetInfo(AGL_PROGUPDATE_STATE, m_ProgUpdateState)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not set AGL_PROGUPDATE_STATE to power_hal"); } + m_isIlgReset = FALSE; { - RAM_AccessIf ram_access; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - RAM_SM_INFO_t info; - - l_eStatus = ram_access.getRamInfo(&info); // LCOV_EXCL_BR_LINE 11: Excluded due to gcov constraints (others) - if (eFrameworkunifiedStatusOK != l_eStatus) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: ram_access.getRamInfo(%d)", l_eStatus); - } - - info.needRenotifyStartPrm = FALSE; - info.lastResetStatus = e_SS_SM_RESET_STATUS_NONE; - info.lastWakeupType = epsstWARMSTART; - info.lastDramBackupStatus = e_SS_SM_DRAM_BACKUP_OK; - memset(info.order_name, 0x00, sizeof(info.order_name)); - - l_eStatus = ram_access.setRamInfo(&info); // LCOV_EXCL_BR_LINE 11: Excluded due to gcov constraints (others) - if (eFrameworkunifiedStatusOK != l_eStatus) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: ram_access.setRamInfo(%d)", l_eStatus); + uint32_t tmp = static_cast(m_isIlgReset); + if (PowerHalSetResetInfo(AGL_ILLRESET_FLAG, tmp)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not set AGL_ILLRESET_FLAG to power_hal"); } } @@ -2159,7 +1301,6 @@ VOID CSystemManager::SMStateExit(HANDLE hApp, SS_SMModuleState l_SMState) { default: break; } - } // End of VOID CSystemManager::SMStateExit(SS_SMModuleState l_SMState) /////////////////////////////////////////////////////////////////////////////// @@ -2208,14 +1349,12 @@ EFrameworkunifiedStatus CSystemManager::register_all_notification_callbacks(HAND NTFY_SSSystemMgrUserMode, sizeof(T_SS_SM_UserModeOnOffNotification_Struct), eFrameworkunifiedStateVar } }; - FrameworkunifiedNotificationsList sm_notifications[] = { { NTFY_SSHUBootModes, - sizeof(TSS_BootModeListStruct), eFrameworkunifiedStateVar }, { - NTFY_SSSystemMgrStartUpType, sizeof(EPWR_SC_WAKEUP_TYPE), - eFrameworkunifiedStateVar }, { NTFY_SSSystemMgrDataReset, - sizeof(ESMDataResetType), eFrameworkunifiedStateVar }, { - NTFY_SSSystemMgrShutdownStarted, 0, eFrameworkunifiedStateVar }, { - NTFY_SSServiceWakeupStatus, sizeof(ESMServiceWakeupStatus), - eFrameworkunifiedStateVar }, { NTFY_SSNeedAplRestart, 0, eFrameworkunifiedStateVar } }; + FrameworkunifiedNotificationsList sm_notifications[] = { + { NTFY_SSSystemMgrStartUpType, sizeof(EPWR_SC_WAKEUP_TYPE), eFrameworkunifiedStateVar }, + { NTFY_SSSystemMgrDataReset, sizeof(ESMDataResetType), eFrameworkunifiedStateVar }, + { NTFY_SSSystemMgrShutdownStarted, 0, eFrameworkunifiedStateVar }, + { NTFY_SSServiceWakeupStatus, sizeof(ESMServiceWakeupStatus), eFrameworkunifiedStateVar }, + { NTFY_SSNeedAplRestart, 0, eFrameworkunifiedStateVar } }; if (m_SMConfig.UMConfig.IsUserModeNotificationABOOL) { l_eStatus = FrameworkunifiedNPRegisterNotifications(hApp, userModeNotificationsBOOL, @@ -2223,7 +1362,7 @@ EFrameworkunifiedStatus CSystemManager::register_all_notification_callbacks(HAND } else { l_eStatus = FrameworkunifiedNPRegisterNotifications(hApp, userModeNotificationsStruct, - static_cast(_countof(userModeNotificationsStruct))); + static_cast(_countof(userModeNotificationsStruct))); } if (eFrameworkunifiedStatusOK != l_eStatus) { @@ -2775,15 +1914,8 @@ SS_String CSystemManager::ReadLaunchConfigFileNameFromEnvironmentVariable() { // LCOV_EXCL_START 5: standard lib error AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "no found %s", retStr.c_str()); - // For working even if the system installed into legacy path - SS_String tmpStr = DefaultConfigFilesPathOld; - tmpStr += l_FileName; + SS_ASERT(0); // LCOV_EXCL_STOP - if (access(tmpStr.c_str(), F_OK) == 0) { // LCOV_EXCL_BR_LINE 5: standard lib error - retStr = tmpStr; // LCOV_EXCL_BR_LINE 5: standard lib error - } else { - SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } } return retStr; } @@ -2819,14 +1951,7 @@ SS_String CSystemManager::ReadConfigDataFileNameFromEnvironmentVariable() { // LCOV_EXCL_START 5: standard lib error AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, "no found %s", retStr.c_str()); - // For working even if the system installed into legacy path - SS_String tmpStr = DefaultConfigFilesPathOld; - tmpStr += l_FileName; - if (access(tmpStr.c_str(), F_OK) == 0) { - retStr = tmpStr; - } else { - SS_ASERT(0); - } + SS_ASERT(0); // LCOV_EXCL_STOP } FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); @@ -2887,28 +2012,6 @@ EFrameworkunifiedStatus CSystemManager::start_process_launching(HANDLE hApp) { SS_String l_launchOrderName = "DEFAULT"; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) LaunchOrderedVector l_OrderList; - { - RAM_AccessIf ram_access; - EFrameworkunifiedStatus l_eRamStatus; - RAM_SM_INFO_t info; - - // LCOV_EXCL_BR_START 6: Because RamAccessIf::getRamInfo returns only eFrameworkunifiedStatusOK - if (eFrameworkunifiedStatusOK != - (l_eRamStatus = ram_access.getRamInfo(&info))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 6: Because RamAccessIf::getRamInfo returns only eFrameworkunifiedStatusOK - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: ram_access.getRamInfo(%d)", l_eRamStatus); - // LCOV_EXCL_STOP - } else { - if (info.order_name[0] != '\0') { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - l_launchOrderName = info.order_name; // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup - } - } - } - l_bIsGoodRc = l_launchConfig.LoadParametersCfg(m_MapProclaunchGrps, m_MapProcNames, l_OrderList, l_launchOrderName, l_LaunchConfigFile); @@ -3216,7 +2319,7 @@ VOID CSystemManager::SystemManagerDebugDump(HANDLE hApp) { // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length) l_debugDumpBuf << FrameworkunifiedGetAppName(hApp) << "/" << endl << " " << endl << endl << " ***internals*** " << endl - << endl << " boot mode " << GetStr(m_BootMode).c_str() << endl << " SM state: " + << endl << " SM state: " << GetStr(m_SMCurrentState).c_str() << endl << " SM startup reason: " << GetStr(m_StartUpReason).c_str() << endl << " SM shutdown reason: " << GetStr(m_shutdownTrigger).c_str() << endl << " LUM: " @@ -3486,23 +2589,6 @@ EFrameworkunifiedStatus CSystemManager::PerformTerminateProcedure(HANDLE hApp, SS_String s_ModuleStatus2 = f_stopCompName + " is now unregistered "; FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "%s", s_ModuleStatus2.c_str()); } - - if (SS_SM_APPS_STOPPING_AT__CWORD56__REQ == m_SMCurrentState - || SS_SM_APPS_STOPPING_AT_INTERNAL_REQ == m_SMCurrentState) { - // When the shutdown_critical service terminates during the termination sequence, NAVI_DET is set to acquire the LOG at the next startup. - // In the event of a Relaunch, NAVI_DET should be set because the likelihood of recovery is low. - fprintf(stderr, "SS_SysManager/%s:will %s dead in Stopping \n", __FUNCTION__, - f_ModuleIterator->name.c_str()); - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "will %s dead in Stopping ", - f_ModuleIterator->name.c_str()); - { - RAM_AccessIf ram_access; - RAM_SM_INFO_t info; - SS_ASERT(eFrameworkunifiedStatusOK == ram_access.getRamInfo(&info)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - info.isErrorReset = TRUE; - SS_ASERT(eFrameworkunifiedStatusOK == ram_access.setRamInfo(&info)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } - } } return l_eStatus; @@ -3536,6 +2622,7 @@ EFrameworkunifiedStatus CSystemManager::SendRequestToLauncher(HANDLE hApp, strcpy(l_ModuleLaunchReq.logging_mask, // NOLINT f_ModuleIterator->logging_msk_str.c_str()); l_ModuleLaunchReq.priority = f_ModuleIterator->configuration_priority; + l_ModuleLaunchReq.cpu_assign = f_ModuleIterator->cpu_assign; l_ModuleLaunchReq.groupIterator = m_MapProclaunchGrps.find( f_ModuleIterator->group_id); l_ModuleLaunchReq.moduleIterator = f_ModuleIterator; @@ -3729,24 +2816,13 @@ EFrameworkunifiedStatus CSystemManager::RegisterCallbacksForRequester(HANDLE hAp &CSystemManager::OnGetStopExtInfo> }, { SS_SM_CRNT_STATE_QUERY, SysMgrCallback }, - { SS_SM_BOOT_MODE_SET_REQ, SysMgrCallback }, { SS_SM_DATA_RESET_MODE_SET_REQ, SysMgrCallback }, { SS_SM_PROG_UPDATE_STATE_SET_REQ, SysMgrCallback }, - { SS_SM_DEBUG_VAR_CODE_DATA_SET_REQ, SysMgrCallback }, - { SS_SM_SET_BOOTLOADER_INFO, SysMgrCallback }, - - { SS_SM_GET_BOOTLOADER_INFO, SysMgrCallback }, { SS_SM__CWORD56__HEARTBEAT_REQ, SysMgrCallback }, - { SS_SM_WAKEUP_ORDER_SET_REQ, SysMgrCallback }, { SS_SM_NEXT_WAKEUP_TYPE_SET_REQ, SysMgrCallback }, // Error Event Logging @@ -3887,7 +2963,7 @@ EFrameworkunifiedStatus CSystemManager::open_session_with_sm_test_client(HANDLE /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::OnOpenSession(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::OnOpenSession(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; @@ -4230,989 +3306,163 @@ EFrameworkunifiedStatus CSystemManager::GetBuildInfo(std::string &f_BuildInfoStr CSMVersion cVersion; if (eFrameworkunifiedStatusOK != (l_eStatus = cVersion.get_build_info(f_BuildInfoStr))) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length) - LOG_ERROR("cVersion.get_build_info()"); // LCOV_EXCL_BR_LINE 6:For setting the initialization conditions at SystemManager startup // NOLINT(whitespace/line_length) } FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); return l_eStatus; } // End of EFrameworkunifiedStatus CSystemManager::GetBuildInfo(std::string) -EFrameworkunifiedStatus CSystemManager::GetBootMode(ROM_AccessIf & f_cRomAccess, ESMBootModeInfo & f_BootMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; +bool CSystemManager::GetDramPowerStatusInfo(const HANDLE h_app) { + PsmDramStsT l_dram_sts = PSM_DRAM_STS_NORMAL; + bool ret = false; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup + // Checking dram power status. + if (PsmGetDramPowerSupplyAbnormalityCheckResultPower(h_app, &l_dram_sts)) + return ret; - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - f_BootMode = e_SS_SM_BOOT_MODE_APPLICATION; // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, - " 'm_UsingVMPlayer' is True"); - } else { - EBOOT_MODE l_boot_mode; - // LCOV_EXCL_BR_START 6: Because RomAccessIf APIs cannot satisfy the fail condition - if (eFrameworkunifiedStatusOK != (l_eStatus = - f_cRomAccess.GetBootMode(&l_boot_mode))) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 6: Because RomAccessIf APIs cannot satisfy the fail condition - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - f_BootMode = e_SS_SM_BOOT_MODE_INVALID; - LOG_ERROR("f_cRomAccess.GetBootMode()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else if (l_boot_mode == APPLICATION_MODE) { - f_BootMode = e_SS_SM_BOOT_MODE_APPLICATION; - // LCOV_EXCL_STOP - } else { - f_BootMode = e_SS_SM_BOOT_MODE_PROGRAMMING; - } - } - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " BootMode is '%s'", - GetStr(f_BootMode).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::GetBootMode( + if (l_dram_sts == PSM_DRAM_STS_NORMAL) + ret = true; -EFrameworkunifiedStatus CSystemManager::GetLastUserMode(ROM_AccessIf & f_cRomAccess, EPWR_USER_MODE_TYPE& f_lastUserMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - EUSER_MODE l_RomData; + return ret; +} - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, - " 'm_UsingVMPlayer' is True"); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - f_lastUserMode = epsumON; // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup - } else { - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.GetLastUserMode(&l_RomData))) { // LCOV_EXCL_BR_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("f_cRomAccess.GetLastUserMode()"); // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - f_lastUserMode = epsumINVALID; // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - } else { - f_lastUserMode = m_ROM_to_SSUserModeEnumMap[l_RomData]; - } - } - if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Read LastUserMode of 'User%s'", - f_lastUserMode == epsumON ? "On" : "Off"); - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::GetLastUserMode( +bool CSystemManager::GetDramStoreStatusInfo(const HANDLE h_app) { + PsmSysupDramT l_dram1 = PSM_SYSUP_DRAM_NORMAL; + PsmSysupDramT l_dram2 = PSM_SYSUP_DRAM_NORMAL; + PsmSysupDramT l_dram3 = PSM_SYSUP_DRAM_NORMAL; + PsmStartStatusT l_sts = PSM_START_STATUS_FACTRESET; -EFrameworkunifiedStatus CSystemManager::SaveLastUserModeToNVM(EPWR_USER_MODE_TYPE f_eUserModeState) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, - " Warning: 'm_UsingVMPlayer' is True; " - "unable to save LastUserMode to NVM"); - } else { - // Initialize ROM access object - ROM_AccessIf f_cRomAccess; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - f_cRomAccess.Initialize(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - EUSER_MODE l_RomData = m_SS_to_ROMUserModeEnumMap[f_eUserModeState]; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) + bool ret = false; - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.SetLastUserMode(l_RomData))) { - LOG_ERROR("f_cRomAccess.SetLastUserMode()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Successfully wrote LastUserMode '%s' to NVM", - l_RomData == USER_OFF ? "USER_OFF" : "USER_ON"); - } - } + // Checking factory shipment status + if (PsmGetStartStatusPower(h_app, &l_sts)) + return ret; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::SaveLastUserModeToNVM( + if (l_sts == PSM_START_STATUS_FACTRESET) { + ret = true; + goto finish; + } -EFrameworkunifiedStatus CSystemManager::GetLimpHomeCutoffMode(ROM_AccessIf & f_cRomAccess, EPWR_LHC_TYPE& f_limpHomeCutoff) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - ECONTROL_MODE l_RomData; + // Checking dram power + if (!GetDramPowerStatusInfo(h_app)) + goto finish; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, - " 'm_UsingVMPlayer' is True"); - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - f_limpHomeCutoff = epslhcDISABLED; // LCOV_EXCL_LINE 6: For setting the initialization conditions at SystemManager startup - } else { - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.GetLimpHomeCutOffReqMode(&l_RomData))) { // LCOV_EXCL_BR_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition // NOLINT(whitespace/line_length) + // Checking dram status. + if (PsmGetDramBackupStatusPower(h_app, &l_dram1, &l_dram2, &l_dram3)) + goto finish; - LOG_ERROR("f_cRomAccess.GetLimpHomeCutOffReqMode()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - f_limpHomeCutoff = epslhcINVALID; // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - } else { - f_limpHomeCutoff = m_Control_to_LimpHomeCutoffMode_map[l_RomData]; - } - } + // l_dram2 and l_dram3 would be ignored. + if (l_dram1 == PSM_SYSUP_DRAM_NORMAL) + ret = true; - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " LimpHomeCutoff is %s", - GetStr(f_limpHomeCutoff).c_str()); + if (l_dram2 == PSM_SYSUP_DRAM_SFTERRSR) + ret = true; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::GetLimpHomeCutoffMode( +finish: + return ret; +} -EFrameworkunifiedStatus CSystemManager::GetProductionMode(ROM_AccessIf & f_cRomAccess, EPWR_PROD_MODE_TYPE& f_productionMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - ECONTROL_MODE l_RomData; +bool CSystemManager::GetSyscomPowerStatusInfo(const HANDLE h_app) { + PsmComStsT l_syscom_sts = PSM_COM_STS_NORMAL; + bool ret = false; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " 'm_UsingVMPlayer' is True"); - f_productionMode = epspmDISABLED; - // LCOV_EXCL_STOP - } else { - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.GetProductionMode(&l_RomData))) { // LCOV_EXCL_BR_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition // NOLINT(whitespace/line_length) - LOG_ERROR("f_cRomAccess.GetProductionMode()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - f_productionMode = epspmINVALID; // LCOV_EXCL_LINE 6: RomAccessIf APIs cannot satisfy the fail condition - } else { - f_productionMode = m_Control_to_ProductionMode_map[l_RomData]; - } - } + if (PsmGetSyscomStatusPower(h_app, &l_syscom_sts)) + return ret; - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Production Mode is %s", - GetStr(f_productionMode).c_str()); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) + if (l_syscom_sts == PSM_COM_STS_NORMAL) + ret = true; - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::GetProductionMode( + return ret; +} -EFrameworkunifiedStatus CSystemManager::GetSignature(ROM_AccessIf & f_cRomAccess, UI_32 * pData) { +EFrameworkunifiedStatus CSystemManager::OnSetStartupConfirmationDataRequest(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup + INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) + FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp)); + EFrameworkunifiedStatus l_eStatus; + Pwr_ServiceSetInterface tServiceSetIf; + // ReadMsg(): * + // Check hApp ptr, msg size, msg reception, read msg if all ok. * + // Report any errors found. * + // * + if (eFrameworkunifiedStatusOK + != (l_eStatus = ReadMsg < Pwr_ServiceSetInterface > (hApp, tServiceSetIf))) { // LCOV_EXCL_BR_LINE 4:NSFW's error + // LCOV_EXCL_START 4:NSFW's error AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; + LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) // LCOV_EXCL_STOP } else { - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.GetSignature(pData))) { // LCOV_EXCL_BR_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("f_cRomAccess.GetSignature()"); // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - } - } - if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM Signature is %llx", - static_cast(*pData)); - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::GetSignature(ROM_AccessIf & f_cRomAccess + m_startUpConfirmationMsg = tServiceSetIf.data.startupConfirmationMsg; + FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s Startup Confirmation data:", FrameworkunifiedGetMsgSrc(hApp)); + SYSTEMMANAGERLOG_StartupConfirmationMsg(m_startUpConfirmationMsg); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) + DGCODE_RET_API l_ret = DGCODE_RET_ERROR; -EFrameworkunifiedStatus CSystemManager::GetTransportMode(ROM_AccessIf & f_cRomAccess, EPWR_TRANSPORT_MODE_TYPE& f_transportMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - ECONTROL_MODE l_RomData; + l_ret = Diag_StartupAllStatusOfDTC(); + if (l_ret == DGCODE_RET_ERROR) { + LOG_ERROR("Diag_StartupAllStatusOfDTC()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) + } - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.GetTransportMode(&l_RomData))) { // LCOV_EXCL_BR_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition // NOLINT(whitespace/line_length) + if ((e_SS_SM_NEXT_WAKEUP_TYPE_COLD == m_NextWakeupType) && (epsstCOLDSTART != m_startUpConfirmationMsg.wakeupType)) { // LCOV_EXCL_BR_LINE 6: Because the above formula cannot be set to true // NOLINT(whitespace/line_length) + // LCOV_EXCL_START 6: Because the condition cannot be set AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - ("f_cRomAccess.GetTransportMode()"); // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - } else { - f_transportMode = m_Control_to_TransportMode_map[l_RomData]; + FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "WakeupType Change to Cold by Svc Request"); + m_startUpConfirmationMsg.wakeupType = epsstCOLDSTART; + // LCOV_EXCL_STOP } - } - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Transport Mode is %s", - GetStr(f_transportMode).c_str()); - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::GetTransportMode( + m_ResetStatus = ((m_isIlgReset == TRUE) ? + e_SS_SM_RESET_STATUS_NG : + ((m_isImmediateReset == TRUE) ? + e_SS_SM_RESET_STATUS_IMMEDIATE : e_SS_SM_RESET_STATUS_NONE)); + if (e_SS_SM_RESET_STATUS_NG == m_ResetStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, + "ResetStatus NG illRst:%s lastErr:Not Support", + m_isIlgReset ? "TRUE" : "FALSE"); + m_ResetCount++; + if (PowerHalSetResetInfo(AGL_RESET_COUNTER, m_ResetCount)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not back up m_ResetCount(%lu) to power_hal", m_ResetCount); + } + } -EFrameworkunifiedStatus CSystemManager::GetDataResetMode(ROM_AccessIf & f_cRomAccess, - ESMDataResetModeInfo& f_dataResetMode, bool isFast) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - EDATARESET_MODE l_DataResetMode; + m_DramBackupStatus = + ((epsstWARMSTART != m_startUpConfirmationMsg.wakeupType) + || (e_SS_SM_DATA_RESET_MODE_FACTORY == m_DataResetMode) + || (GetDramStoreStatusInfo(hApp) == false)) ? + e_SS_SM_DRAM_BACKUP_NG : e_SS_SM_DRAM_BACKUP_OK; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - if (isFast) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set - l_eStatus = f_cRomAccess.GetDataResetModeFast(&l_DataResetMode); - } else { - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - l_eStatus = f_cRomAccess.GetDataResetMode(&l_DataResetMode); // LCOV_EXCL_LINE 6: Because the condition cannot be set + if (e_SS_SM_DRAM_BACKUP_NG == m_DramBackupStatus) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, + "DramBackup NG wakeupType:%s dataResetMode:%s", + (epsstWARMSTART == m_startUpConfirmationMsg.wakeupType) ? + "WARM" : "COLD", + (e_SS_SM_DATA_RESET_MODE_FACTORY == m_DataResetMode) ? + "FACTORY" : "NotFactory"); } - if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - ("f_cRomAccess.GetDataResetMode()"); // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - } else { - switch (l_DataResetMode) { // LCOV_EXCL_BR_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - case DATARESET_NONE: - f_dataResetMode = e_SS_SM_DATA_RESET_MODE_NONE; - break; - // LCOV_EXCL_START 6: Because values other than DATARESET NONE cannot be returned by RomAccessIf APIs - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - case DATARESET_USER: - f_dataResetMode = e_SS_SM_DATA_RESET_MODE_USER; - break; - case DATARESET_FACTORY: - f_dataResetMode = e_SS_SM_DATA_RESET_MODE_FACTORY; - break; - default: - f_dataResetMode = e_SS_SM_DATA_RESET_MODE_NONE; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: reset_mode = %d", l_DataResetMode); - break; - // LCOV_EXCL_STOP + if (m_needReNotifyStartPrm) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be satisfied from the external API + // LCOV_EXCL_BR_START 6: Because both sides are not FALSE + if (e_SS_SM_DRAM_BACKUP_NG == m_DramBackupStatus) { + // LCOV_EXCL_BR_STOP + m_DramBackupStatus = e_SS_SM_DRAM_BACKUP_NG; } } - } - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Data Reset Mode is %s", - f_dataResetMode == e_SS_SM_DATA_RESET_MODE_USER ? "DATARESET_USER" : - f_dataResetMode == e_SS_SM_DATA_RESET_MODE_FACTORY ? "DATARESET_FACTORY" : "DATARESET_NONE"); - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} -// End of EFrameworkunifiedStatus CSystemManager::GetDataResetMode( -EFrameworkunifiedStatus CSystemManager::GetResetCount(ROM_AccessIf & f_cRomAccess, UI_32& f_rebootCount) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; + if (m_needReNotifyStartPrm) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be satisfied from the external API + if (e_SS_SM_RESET_STATUS_NG == m_ResetStatus) { + // do nothing, keep m_ResetStatus. + } else if (e_SS_SM_RESET_STATUS_IMMEDIATE == m_ResetStatus) { + // do nothing, keep m_ResetStatus. + } else { + m_ResetStatus = e_SS_SM_RESET_STATUS_NONE; + } - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.GetResetCount(&f_rebootCount))) { // LCOV_EXCL_BR_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("f_cRomAccess.GetResetCount()"); // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition + if (epsstWARMSTART != m_startUpConfirmationMsg.wakeupType) { // LCOV_EXCL_BR_LINE 6: Because the above condition cannot be satisfied // NOLINT(whitespace/line_length) + m_startUpConfirmationMsg.wakeupType = epsstCOLDSTART; + } } - } - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " Reboot Count is %d", f_rebootCount); - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} -// End of EFrameworkunifiedStatus CSystemManager::GetResetCount( -EFrameworkunifiedStatus CSystemManager::GetLastIlgReset(ROM_AccessIf & f_cRomAccess, BOOL& f_lastIlgReset) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - } else { - ELASTILGRESET_MODE l_lastIlgReset; - - // LCOV_EXCL_BR_START 6: Because RomAccessIf APIs cannot satisfy the fail condition - if (eFrameworkunifiedStatusOK - != (l_eStatus = f_cRomAccess.GetLastIlgReset(&l_lastIlgReset))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("f_cRomAccess.GetLastIlgReset()"); // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - } - - f_lastIlgReset = (l_lastIlgReset == LAST_ILGRESET_NG) ? TRUE : FALSE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } - - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " LastIlgRerset is %s", f_lastIlgReset ? "LAST_ILGRESET_NORMAL" : "LAST_ILGRESET_NG"); - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} -// End of EFrameworkunifiedStatus CSystemManager::GetLastIlgReset( - -EFrameworkunifiedStatus CSystemManager::GetProgUpdateState(ROM_AccessIf & f_cRomAccess, SMProgUpdateState& f_progUpdateState) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:m_UsingVMPlayer is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - // LCOV_EXCL_BR_START 6: Because RomAccessIf APIs cannot satisfy the fail condition - if (eFrameworkunifiedStatusOK - != (l_eStatus = f_cRomAccess.GetProgUpdateState(&f_progUpdateState))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - ("f_cRomAccess.GetProgUpdateState()"); // LCOV_EXCL_LINE 6: Because RomAccessIf APIs cannot satisfy the fail condition - } - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} -// End of EFrameworkunifiedStatus CSystemManager::GetProgUpdateState( - -EFrameworkunifiedStatus CSystemManager::GetErrLogCount(ROM_AccessIf & f_cRomAccess, UI_32& f_errLogCount) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6:Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) - // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:m_UsingVMPlayer is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - // LCOV_EXCL_BR_START 6: Because RomAccessIf APIs cannot satisfy the fail condition - if (eFrameworkunifiedStatusOK - != (l_eStatus = f_cRomAccess.GetErrLogCount(&f_errLogCount))) { - // LCOV_EXCL_BR_STOP - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("f_cRomAccess.GetErrLogCount()"); // LCOV_EXCL_LINE 6:Because RomAccessIf APIs cannot satisfy the fail condition - } - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} -// End of EFrameworkunifiedStatus CSystemManager::GetErrLogCount - -EFrameworkunifiedStatus CSystemManager::GetNextWakeupType(ROM_AccessIf & f_cRomAccess, ESMNextWakeupType& f_wakeupType) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:m_UsingVMPlayer is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - } else { - ENEXT_WAKEUP_TYPE l_wakeupType; - - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.GetNextWakeupType(&l_wakeupType))) { - LOG_ERROR("f_cRomAccess.GetNextWakeupType()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else { - switch (l_wakeupType) { - case NEXT_WAKEUP_TYPE_NONE: - f_wakeupType = e_SS_SM_NEXT_WAKEUP_TYPE_NONE; - break; - case NEXT_WAKEUP_TYPE_COLD: - f_wakeupType = e_SS_SM_NEXT_WAKEUP_TYPE_COLD; - break; - case NEXT_WAKEUP_TYPE_HOT: - f_wakeupType = e_SS_SM_NEXT_WAKEUP_TYPE_HOT; - break; - default: - f_wakeupType = e_SS_SM_NEXT_WAKEUP_TYPE_NONE; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: wakeupType = %d", l_wakeupType); - break; - } - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} -// End of EFrameworkunifiedStatus CSystemManager::GetNextWakeupType( - -EFrameworkunifiedStatus CSystemManager::SetActiveFlashloader(ROM_AccessIf & f_cRomAccess, EACTIVE_FLASHLOADER f_FlashloaderMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: SetSystemModeInfoStruct() has checked - // LCOV_EXCL_START 6: SetSystemModeInfoStruct() has checked - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.SetActiveFlashloader(f_FlashloaderMode))) { - LOG_ERROR("f_cRomAccess.SetActiveFlashloader()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM ActiveFlashloader initialized to %s", - f_FlashloaderMode == NEW_FLASHLOADER ? "NEW_FLASHLOADER" : "OLD_FLASHLOADER"); - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::SetActiveFlashloader( - -EFrameworkunifiedStatus CSystemManager::SetBootMode(ROM_AccessIf & f_cRomAccess, ESMBootModeInfo f_BootMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: SetSystemModeInfoStruct() has checked - // LCOV_EXCL_START 6: SetSystemModeInfoStruct() has checked - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - EBOOT_MODE l_RomBootMode; - switch (f_BootMode) { // LCOV_EXCL_BR_LINE 200:only e_SS_SM_BOOT_MODE_APPLICATION is called - case e_SS_SM_BOOT_MODE_APPLICATION: - l_RomBootMode = APPLICATION_MODE; - break; - case e_SS_SM_BOOT_MODE_PROGRAMMING: - // LCOV_EXCL_START 200:only e_SS_SM_BOOT_MODE_APPLICATION is called - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - l_RomBootMode = PROGRAMMING_MODE; - break; - // LCOV_EXCL_STOP - default: - // LCOV_EXCL_START 200:only e_SS_SM_BOOT_MODE_APPLICATION is called - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - // Shouldn't ever get here, but hey, in case we do... - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: Unknown ESMBootModeInfo f_BootMode: 0x%X", f_BootMode); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } - - if (eFrameworkunifiedStatusOK == l_eStatus) { // LCOV_EXCL_BR_LINE 200: l_eStatus is always eFrameworkunifiedStatusOK - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.SetBootMode(l_RomBootMode))) { - LOG_ERROR("f_cRomAccess.SetBootMode()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM BootMode initialized to %s", - l_RomBootMode == APPLICATION_MODE ? "APPLICATION_MODE" : "PROGRAMMING_MODE"); - } - } - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::SetBootMode( - -EFrameworkunifiedStatus CSystemManager::SetLastUserMode(ROM_AccessIf & f_cRomAccess, EPWR_USER_MODE_TYPE f_lastUserMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - EUSER_MODE l_RomMode = f_lastUserMode == epsumOFF ? USER_OFF : USER_ON; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: SetSystemModeInfoStruct() has checked - // LCOV_EXCL_START 6: SetSystemModeInfoStruct() has checked - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.SetLastUserMode(l_RomMode))) { - LOG_ERROR("f_cRomAccess.SetLastUserMode()"); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM LastUserMode initialized to %s", - f_lastUserMode == epsumOFF ? "USER_OFF" : "USER_ON"); - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus SetLastUserMode(ROM_AccessIf & f_cRomAccess - -EFrameworkunifiedStatus CSystemManager::SetLimpHomeCutoffMode(ROM_AccessIf & f_cRomAccess, EPWR_LHC_TYPE f_controlMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - ECONTROL_MODE l_RomControlMode; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: SetSystemModeInfoStruct() has checked - // LCOV_EXCL_START 6: SetSystemModeInfoStruct() has checked - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - l_RomControlMode = f_controlMode == epslhcDISABLED ? DISABLE_MODE : ENABLE_MODE; - if (eFrameworkunifiedStatusOK - != (l_eStatus = f_cRomAccess.SetLimpHomeCutOffReqMode(l_RomControlMode))) { - LOG_ERROR("f_cRomAccess.SetLimpHomeCutOffReqMode()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM LimpHomeCutOff initialized to %s", - f_controlMode == epslhcDISABLED ? "DISABLE_MODE" : "ENABLE_MODE"); - } - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of CSystemManager::SetLimpHomeCutoffMode(ROM_AccessIf & f_cRomAccess - -EFrameworkunifiedStatus CSystemManager::SetProductionMode(ROM_AccessIf & f_cRomAccess, EPWR_PROD_MODE_TYPE f_productionMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - ECONTROL_MODE l_RomControlMode; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: SetSystemModeInfoStruct() has checked - // LCOV_EXCL_START 6: SetSystemModeInfoStruct() has checked - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - l_RomControlMode = f_productionMode == epspmDISABLED ? DISABLE_MODE : ENABLE_MODE; - if (eFrameworkunifiedStatusOK - != (l_eStatus = f_cRomAccess.SetProductionMode(l_RomControlMode))) { - LOG_ERROR("f_cRomAccess.SetProductionMode()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM ProductionMode initialized to %s", - f_productionMode == epspmDISABLED ? "DISABLE_MODE" : "ENABLE_MODE"); - } - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of CSystemManager::SetLimpHomeCutoff(ROM_AccessIf & f_cRomAccess - -EFrameworkunifiedStatus CSystemManager::SetSignature(ROM_AccessIf & f_cRomAccess, UI_32 f_Data) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - // LCOV_EXCL_BR_START 6: Because RomAccessIf APIs cannot satisfy the fail condition - if (eFrameworkunifiedStatusOK != - (l_eStatus = f_cRomAccess.SetSignature(f_Data))) { - // LCOV_EXCL_BR_STOP - LOG_ERROR("f_cRomAccess.SetSignature()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } - } - - if (eFrameworkunifiedStatusOK == l_eStatus) { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM Signature is set to %llx", - static_cast(f_Data)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of - -EFrameworkunifiedStatus CSystemManager::SetTransportMode(ROM_AccessIf & f_cRomAccess, EPWR_TRANSPORT_MODE_TYPE f_transportMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - ECONTROL_MODE l_RomControlMode; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: SetSystemModeInfoStruct() has checked - // LCOV_EXCL_START 6: SetSystemModeInfoStruct() has checked - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - l_RomControlMode = f_transportMode == epstmDISABLED ? DISABLE_MODE : ENABLE_MODE; - if (eFrameworkunifiedStatusOK - != (l_eStatus = f_cRomAccess.SetTransportMode(l_RomControlMode))) { - LOG_ERROR("f_cRomAccess.SetTransportMode()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM TransportMode initialized to %s", - f_transportMode == epstmDISABLED ? "DISABLE_MODE" : "ENABLE_MODE"); - } - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of CSystemManager::SetLimpHomeCutoff(ROM_AccessIf & f_cRomAccess - -EFrameworkunifiedStatus CSystemManager::SetDataResetMode(ROM_AccessIf & f_cRomAccess, ESMDataResetModeInfo f_dataResetMode) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - EDATARESET_MODE l_DataResetMode; - - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) - // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - switch (f_dataResetMode) { - case e_SS_SM_DATA_RESET_MODE_NONE: - l_DataResetMode = DATARESET_NONE; - break; - case e_SS_SM_DATA_RESET_MODE_USER: - l_DataResetMode = DATARESET_USER; - break; - case e_SS_SM_DATA_RESET_MODE_FACTORY: - l_DataResetMode = DATARESET_FACTORY; - break; - default: - l_DataResetMode = DATARESET_NONE; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: reset_mode = %d", f_dataResetMode); - break; - } - - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.SetDataResetMode(l_DataResetMode))) { - LOG_ERROR("f_cRomAccess.SetDataResetMode()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM DataResetMode set to %s", - f_dataResetMode == e_SS_SM_DATA_RESET_MODE_USER ? "DATARESET_USER" : - f_dataResetMode == e_SS_SM_DATA_RESET_MODE_FACTORY ? "DATARESET_FACTORY" : "DATARESET_NONE"); - } - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of CSystemManager::SetDataResetMode(ROM_AccessIf & f_cRomAccess - -EFrameworkunifiedStatus CSystemManager::SetResetCount(ROM_AccessIf & f_cRomAccess, UI_32 f_resetCount) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) - // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.SetResetCount(f_resetCount))) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) // NOLINT(whitespace/line_length) - LOG_ERROR("f_cRomAccess.SetResetCount()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, - " NVM ResetCount set to %d", f_resetCount); - } - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of CSystemManager::SetResetCount(ROM_AccessIf & f_cRomAccess - -EFrameworkunifiedStatus CSystemManager::SetLastIlgReset(ROM_AccessIf & f_cRomAccess, BOOL f_lastIlgReset) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - } else { - // LCOV_EXCL_BR_START 6: For setting the initialization conditions at SystemManager startup - ELASTILGRESET_MODE l_lastIlgReset = - f_lastIlgReset ? LAST_ILGRESET_NG : LAST_ILGRESET_NORMAL; - // LCOV_EXCL_BR_STOP - - if (eFrameworkunifiedStatusOK - != (l_eStatus = - f_cRomAccess.SetLastIlgReset(l_lastIlgReset))) { - LOG_ERROR("f_cRomAccess.SetLastIlgReset()"); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM LastIlgReset is set to %s", - f_lastIlgReset ? "LAST_ILGRESET_NG" : "LAST_ILGRESET_NORMAL"); - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of CSystemManager::SetLastIlgReset(ROM_AccessIf & f_cRomAccess - -EFrameworkunifiedStatus CSystemManager::SetProgUpdateState(ROM_AccessIf & f_cRomAccess, SMProgUpdateState f_progUpdateState) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) - // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "Error:m_UsingVMPlayer is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - if (eFrameworkunifiedStatusOK - != (l_eStatus = f_cRomAccess.SetProgUpdateState(f_progUpdateState))) { - LOG_ERROR("f_cRomAccess.SetProgUpdateState()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NVM ProgUpdateState : %#x", f_progUpdateState); - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of CSystemManager::SetProgUpdateState(ROM_AccessIf & f_cRomAccess - -EFrameworkunifiedStatus CSystemManager::SetErrLogCount(ROM_AccessIf & f_cRomAccess, UI_32 f_errLogCount) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) - // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "Error:m_UsingVMPlayer is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - if (eFrameworkunifiedStatusOK != (l_eStatus = - f_cRomAccess.SetErrLogCount(f_errLogCount))) { - LOG_ERROR("f_cRomAccess.SetErrLogCount()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, - "NVM ErrLogCount : %#x", f_errLogCount); - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of CSystemManager::SetErrLogCount(ROM_AccessIf & f_cRomAccess - -EFrameworkunifiedStatus CSystemManager::SetNextWakeupType(ROM_AccessIf & f_cRomAccess, ESMNextWakeupType f_wakeupType) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error:m_UsingVMPlayer is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - } else { - ENEXT_WAKEUP_TYPE l_wakeupType; - - switch (f_wakeupType) { - case e_SS_SM_NEXT_WAKEUP_TYPE_NONE: - l_wakeupType = NEXT_WAKEUP_TYPE_NONE; - break; - case e_SS_SM_NEXT_WAKEUP_TYPE_COLD: - l_wakeupType = NEXT_WAKEUP_TYPE_COLD; - break; - case e_SS_SM_NEXT_WAKEUP_TYPE_HOT: - l_wakeupType = NEXT_WAKEUP_TYPE_HOT; - break; - default: - l_wakeupType = NEXT_WAKEUP_TYPE_NONE; - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: wakeupType = %d", f_wakeupType); - break; - } - - if (eFrameworkunifiedStatusOK - != (l_eStatus = f_cRomAccess.SetNextWakeupType(l_wakeupType))) { - LOG_ERROR("f_cRomAccess.SetNextWakeupType()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, "NVM NextWakeupType : %#x", f_wakeupType); - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of CSystemManager::SetNextWakeupType(ROM_AccessIf & f_cRomAccess - -EFrameworkunifiedStatus CSystemManager::SetProductPrivate(ROM_AccessIf & f_cRomAccess, UI_8 buf[ROM_PRODUCT_PRIVATE_MAX]) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: SetSystemModeInfoStruct() has checked - // LCOV_EXCL_START 6: SetSystemModeInfoStruct() has checked - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - // LCOV_EXCL_STOP - } else { - if (eFrameworkunifiedStatusOK != (l_eStatus = f_cRomAccess.SetProductPrivate(buf))) { - LOG_ERROR("f_cRomAccess.SetProductPrivate()"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " NVM ProductPrivate is set"); - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of CSystemManager::SetProductPrivate(ROM_AccessIf & f_cRomAccess - -LBM_UINT32 CSystemManager::GetDramStatusInfo(const HANDLE h_app) { - LBM_UINT32 dramStatus = SYSUP_DRAM_NORMAL; -// PsmSysupDramT l_dram1 = PSM_SYSUP_DRAM_NORMAL; -// PsmSysupDramT l_dram2 = PSM_SYSUP_DRAM_NORMAL; -// PsmSysupDramT l_dram3 = PSM_SYSUP_DRAM_NORMAL; - int ret; - -// ret = PsmGetDramBackupStatusPower(h_app, &l_dram1, &l_dram2, &l_dram3); -// if ((ret == 0) -// && ((l_dram1 >= PSM_SYSUP_DRAM_NORMAL) && (l_dram1 < PSM_SYSUP_DRAM_MAX)) -// && ((l_dram2 >= PSM_SYSUP_DRAM_NORMAL) && (l_dram2 < PSM_SYSUP_DRAM_MAX)) -// && ((l_dram3 >= PSM_SYSUP_DRAM_NORMAL) && (l_dram3 < PSM_SYSUP_DRAM_MAX))) { -// m_BootMemory->dram1 = m_PsmSysupDram_to_SysupDramMap[static_cast(l_dram1)]; -// m_BootMemory->dram2 = m_PsmSysupDram_to_SysupDramMap[static_cast(l_dram2)]; -// m_BootMemory->dram3 = m_PsmSysupDram_to_SysupDramMap[static_cast(l_dram3)]; -// if ((m_BootMemory->dram1 == m_BootMemory->dram2) -// || (m_BootMemory->dram1 == m_BootMemory->dram3)) { -// dramStatus = m_BootMemory->dram1; -// } else if (m_BootMemory->dram2 == m_BootMemory->dram3) { -// dramStatus = m_BootMemory->dram2; -// SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) -// } else { -// dramStatus = SYSUP_DRAM_NORMAL; -// SS_ASERT(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) -// } -// } else { -// FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "PsmGetDramBackupStatusPower()"); -// } - - return dramStatus; -} - -void CSystemManager::SetDramStatusInfo(LBM_UINT32 f_state) { - m_BootMemory->dram1 = m_BootMemory->dram2 = m_BootMemory->dram3 = f_state; - return; -} - -EFrameworkunifiedStatus CSystemManager::OnSetStartupConfirmationDataRequest(HANDLE hApp) noexcept { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - FRAMEWORKUNIFIEDLOG(ZONE_PERFORMANCE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp)); - EFrameworkunifiedStatus l_eStatus; - Pwr_ServiceSetInterface tServiceSetIf; - // ReadMsg(): * - // Check hApp ptr, msg size, msg reception, read msg if all ok. * - // Report any errors found. * - // * - if (eFrameworkunifiedStatusOK - != (l_eStatus = ReadMsg < Pwr_ServiceSetInterface > (hApp, tServiceSetIf))) { // LCOV_EXCL_BR_LINE 4:NSFW's error - // LCOV_EXCL_START 4:NSFW's error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - // LCOV_EXCL_STOP - } else { - m_startUpConfirmationMsg = tServiceSetIf.data.startupConfirmationMsg; - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " %s Startup Confirmation data:", FrameworkunifiedGetMsgSrc(hApp)); - SYSTEMMANAGERLOG_StartupConfirmationMsg(m_startUpConfirmationMsg); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) -// DGCODE_RET_API l_ret = DGCODE_RET_ERROR; - -// l_ret = Diag_StartupAllStatusOfDTC(); -// if (l_ret == DGCODE_RET_ERROR) { -// LOG_ERROR("Diag_StartupAllStatusOfDTC()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) -// } - - if ((e_SS_SM_NEXT_WAKEUP_TYPE_COLD == m_NextWakeupType) && (epsstCOLDSTART != m_startUpConfirmationMsg.wakeupType)) { // LCOV_EXCL_BR_LINE 6: Because the above formula cannot be set to true // NOLINT(whitespace/line_length) - // LCOV_EXCL_START 6: Because the condition cannot be set - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "WakeupType Change to Cold by Svc Request"); - m_startUpConfirmationMsg.wakeupType = epsstCOLDSTART; - // LCOV_EXCL_STOP - } - - RAM_WAKEUP_STATE l_ramWakeupState = - (SDRAM_STS_BUPNG == m_BootMemory->pwSts) ? RAM_WAKEUP_STATE_BACKUP_NG : RAM_WAKEUP_STATE_DONT_CARE; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - if (epsstWARMSTART != m_startUpConfirmationMsg.wakeupType) { - l_ramWakeupState = RAM_WAKEUP_STATE_BATTERY_DOWN; - } - RAM_SM_INFO_t info; - { - RAM_AccessIf ram_access(l_ramWakeupState); - - if (eFrameworkunifiedStatusOK != (l_eStatus = ram_access.getRamInfo(&info))) { // LCOV_EXCL_BR_LINE 200: As they are not returned except to eFrameworkunifiedStatusOK // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: ram_access.getRamInfo(%d)", l_eStatus); - } - - if (epsstWARMSTART != m_startUpConfirmationMsg.wakeupType) { - // To standardize the behavior when DRAM is backed up/not backed up, standardize the FALSE. - m_isImmediateReset = FALSE; - info.isImmediateReset = TRUE; - if (eFrameworkunifiedStatusOK != (l_eStatus = ram_access.setRamInfo(&info))) { // LCOV_EXCL_BR_LINE 200: As they are not returned except to eFrameworkunifiedStatusOK // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: ram_access.setRamInfo(%d)", l_eStatus); - } - } - } - - m_needReNotifyStartPrm = info.needRenotifyStartPrm; - m_ResetStatus = (((m_isIlgReset == TRUE) || (info.isErrorReset == TRUE)) ? - e_SS_SM_RESET_STATUS_NG : - ((m_isImmediateReset == TRUE) ? - e_SS_SM_RESET_STATUS_IMMEDIATE : e_SS_SM_RESET_STATUS_NONE)); - if (e_SS_SM_RESET_STATUS_NG == m_ResetStatus) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, - "ResetStatus NG illRst:%s lastErr:%s", - m_isIlgReset ? "TRUE" : "FALSE", - info.isErrorReset ? "ERROR" : "NOT ERROR"); - } - - // Count the number of abnormal REBOOTs based on the ResetStatus judged from the startup information (not counted when NG is retransmitted). - if (e_SS_SM_RESET_STATUS_NG == m_ResetStatus) { - ROM_AccessIf rom_access; -#ifndef SS_SM_SKIP_PUT_ROB_SYSTEM_RESET - const uint64_t l_SystemResetRobCode = 0x2219; -// DGCODE_ROB_SSR_INFO l_info; - -// memset(&l_info, 0x00, sizeof(DGCODE_ROB_SSR_INFO)); - -// l_ret = Diag_PutRoBInfo(hApp, l_SystemResetRobCode, l_info); -// if (l_ret == DGCODE_RET_ERROR) { -// LOG_ERROR("Diag_PutDiagCodeWithSSR_Custom()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) -// } -#endif - - m_ResetCount++; - rom_access.Initialize(); - // Count the number of abnormal REBOOTs based on the ResetStatus judged from the startup information (not counted when NG is retransmitted). - if (eFrameworkunifiedStatusOK != (l_eStatus = - SetResetCount(rom_access, m_ResetCount))) { - // LCOV_EXCL_BR_STOP - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: SetResetCount(%d)", l_eStatus); - } - } - - // LCOV_EXCL_BR_START 11:unexpected branch // NOLINT(whitespace/line_length) - m_DramBackupStatus = - ((epsstWARMSTART != m_startUpConfirmationMsg.wakeupType) - || (e_SS_SM_DATA_RESET_MODE_FACTORY == m_DataResetMode) - || (SDRAM_STS_BUPNG == m_BootMemory->pwSts) - || (GetDramStatusInfo(hApp) == SYSUP_DRAM_DISCARD)) ? - e_SS_SM_DRAM_BACKUP_NG : e_SS_SM_DRAM_BACKUP_OK; - // LCOV_EXCL_BR_STOP - - if (e_SS_SM_DRAM_BACKUP_NG == m_DramBackupStatus) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __PRETTY_FUNCTION__, - "DramBackup NG wakeupType:%s dataResetMode:%s pwSts:%s", - (epsstWARMSTART == m_startUpConfirmationMsg.wakeupType) ? "WARM" : "COLD", - (e_SS_SM_DATA_RESET_MODE_FACTORY == m_DataResetMode) ? "FACTORY" : "NotFactory", - (SDRAM_STS_NOMAL == m_BootMemory->pwSts) ? "OK" : "NG"); - } - - if (m_needReNotifyStartPrm) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be satisfied from the external API - // LCOV_EXCL_BR_START 6: Because both sides are not FALSE - if ((e_SS_SM_DRAM_BACKUP_NG == m_DramBackupStatus) - || (e_SS_SM_DRAM_BACKUP_NG == info.lastDramBackupStatus)) { - // LCOV_EXCL_BR_STOP - m_DramBackupStatus = e_SS_SM_DRAM_BACKUP_NG; - } - } - - // To ensure notification to SVCs when DRAM backups are destroyed, - // Saving DramBackupStatus to RamAccessIf Prior to dramStatus Initialization - info.lastDramBackupStatus = m_DramBackupStatus; - { - RAM_AccessIf ram_access(l_ramWakeupState); - if (eFrameworkunifiedStatusOK != (l_eStatus = ram_access.setRamInfo(&info))) { // LCOV_EXCL_BR_LINE 200: As they are not returned except to eFrameworkunifiedStatusOK // NOLINT(whitespace/line_length) - // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: ram_access.setRamInfo(%d)", l_eStatus); - } - } - - SetDramStatusInfo(SYSUP_DRAM_NORMAL); - - if (m_needReNotifyStartPrm) { // LCOV_EXCL_BR_LINE 6: Because the condition cannot be satisfied from the external API - if ((e_SS_SM_RESET_STATUS_NG == info.lastResetStatus) - || (e_SS_SM_RESET_STATUS_NG == m_ResetStatus)) { - m_ResetStatus = e_SS_SM_RESET_STATUS_NG; - } else if ((e_SS_SM_RESET_STATUS_IMMEDIATE == info.lastResetStatus) - || (e_SS_SM_RESET_STATUS_IMMEDIATE == m_ResetStatus)) { - m_ResetStatus = e_SS_SM_RESET_STATUS_IMMEDIATE; - } else { - m_ResetStatus = e_SS_SM_RESET_STATUS_NONE; - } - - if ((epsstWARMSTART != info.lastWakeupType) || (epsstWARMSTART != m_startUpConfirmationMsg.wakeupType)) { // LCOV_EXCL_BR_LINE 6: Because the above condition cannot be satisfied // NOLINT(whitespace/line_length) - m_startUpConfirmationMsg.wakeupType = epsstCOLDSTART; - } - } - - info.lastResetStatus = m_ResetStatus; - info.lastWakeupType = m_startUpConfirmationMsg.wakeupType; - info.needRenotifyStartPrm = TRUE; - info.isErrorReset = FALSE; - { - RAM_AccessIf ram_access(l_ramWakeupState); - if (eFrameworkunifiedStatusOK != (l_eStatus = ram_access.setRamInfo(&info))) { // LCOV_EXCL_BR_LINE 200:As there are no cases other than eFrameworkunifiedStatusOK // NOLINT(whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: ram_access.setRamInfo(%d)", l_eStatus); - } - } - - CALL_AND_LOG_STATUS(ClearDramBackupInfo(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) + CALL_AND_LOG_STATUS(ClearDramBackupInfo(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "\n" "start prm\n" @@ -5250,11 +3500,6 @@ EFrameworkunifiedStatus CSystemManager::OnSetStartupConfirmationDataRequest(HAND m_PubCmdHist, m_PubHistIter, "", l_eStatus); // LCOV_EXCL_BR_STOP } - - if (eFrameworkunifiedStatusOK != (l_eStatus = PublishBootModeNotification(hApp))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length) - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - LOG_ERROR("PublishBootModeNotification()"); // LCOV_EXCL_LINE 4: nsfw error - } } EFrameworkunifiedStatus l_responseStatus = l_eStatus; @@ -5291,12 +3536,12 @@ EFrameworkunifiedStatus CSystemManager::GetTimeStamp(std::string& TimeStamp) { uint8_t status; struct tm theTime; ftime(&timebuf); -// Clock_getSystemTimeY2K38(&time, &status); -// CLOCK_RETURN clock_ret = Clock_CnvSecToDateY2K38(&time, &theTime); + Clock_getSystemTimeY2K38(&time, &status); + CLOCK_RETURN clock_ret = Clock_CnvSecToDateY2K38(&time, &theTime); -// if (CLOCK_OK != clock_ret) { -// return eFrameworkunifiedStatusNullPointer; -// } + if (CLOCK_OK != clock_ret) { + return eFrameworkunifiedStatusNullPointer; + } sprintf(l_format, "GMT Time,%04d-%02d-%02d %02d:%02d:%02d.%hu\n", // NOLINT theTime.tm_year + 1900, theTime.tm_mon + 1, theTime.tm_mday, diff --git a/system_manager/server/src/ss_system_manager_callbacks.cpp b/system_manager/server/src/ss_system_manager_callbacks.cpp index 359f7abb..2e597ce6 100644 --- a/system_manager/server/src/ss_system_manager_callbacks.cpp +++ b/system_manager/server/src/ss_system_manager_callbacks.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ /// \brief This file provides support for System Manager business logic. /// /////////////////////////////////////////////////////////////////////////////// -//#include #include #include #include @@ -42,15 +41,12 @@ #include #include -//#include +#include #include #include -#include -#include #include #include -//#include #include #include @@ -61,7 +57,6 @@ #include #include #include -//#include #include "ss_system_manager_callbacks.h" #include "ss_system_manager.h" @@ -106,7 +101,7 @@ enum { POWEROFF = FALSE }; -VOID CSystemManager::LogGroupModulesState(UI_32 f_groupId, std::string pStr) noexcept { +VOID CSystemManager::LogGroupModulesState(UI_32 f_groupId, std::string pStr) { if (IS_ZONE_SET(ZONE_INFO)) { // LCOV_EXCL_BR_LINE 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) // LCOV_EXCL_START 6: Because the applicable variable cannot be changed from the external API (only evaluated by the initial value) AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert @@ -119,7 +114,7 @@ VOID CSystemManager::LogGroupModulesState(UI_32 f_groupId, std::string pStr) noe f_groupId); } else { std::string sIsOKFlag; - TEXT(__FUNCTION__, " Group %d/%s, %d modules: %s, %s", f_groupId, + TEXT(__FUNCTION__, " Group %d/%s, %ld modules: %s, %s", f_groupId, l_GroupIterator->second.name.c_str(), l_GroupIterator->second.modules.size(), pStr.c_str(), GetStr(m_SMCurrentState).c_str()); @@ -147,7 +142,7 @@ VOID CSystemManager::LogGroupModulesState(UI_32 f_groupId, std::string pStr) noe } } // End of VOID CSystemManager::LogGroupModulesState( UI_32 f_groupId, std::string pStr) -VOID CSystemManager::LogAllGroupModulesState(std::string pStr) noexcept { +VOID CSystemManager::LogAllGroupModulesState(std::string pStr) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); std::string l_sIsOKFlag; @@ -606,7 +601,7 @@ EFrameworkunifiedStatus CSystemManager::OnClientStartMonitorTimerExpiry(HANDLE h /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::send_power_request_complete_response(HANDLE hApp, std::string pStr) noexcept { +EFrameworkunifiedStatus CSystemManager::send_power_request_complete_response(HANDLE hApp, std::string pStr) { EFrameworkunifiedStatus l_eStatus; FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); @@ -789,7 +784,7 @@ EFrameworkunifiedStatus CSystemManager::OnBackupMgrAvailCallback(HANDLE hApp) { /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::OnPowerRequestCallback(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::OnPowerRequestCallback(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; Pwr_ServiceSetInterface tServiceIf; @@ -808,6 +803,7 @@ EFrameworkunifiedStatus CSystemManager::OnPowerRequestCallback(HANDLE hApp) noex LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) // LCOV_EXCL_STOP } else { + // NOTE: interface_unified always set userMode as 0. so don't use m_lastUserMode. m_lastUserMode = tServiceIf.data.powerRequestMsg.userMode; // // 2012 December 04 Temporary hack ( I hope ) to set m_Wake to nominal @@ -1306,12 +1302,13 @@ EFrameworkunifiedStatus CSystemManager::OnShutdownCompleteMonitorTimeout(HANDLE FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: Reset Timeout"); - CALL_AND_LOG_STATUS(PerformUmountRamd()); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) l_eStatus = SecureChipOff(); if (eFrameworkunifiedStatusOK != l_eStatus) { FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: SecureChipOff Failed"); } + m_ResetFactor = PSM_FACTOR_AGL_WITH_HISTORY; + l_eStatus = perform_force_reset(hApp); FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); @@ -1329,8 +1326,7 @@ EFrameworkunifiedStatus CSystemManager::OnShutdownCompleteMonitorTimeout(HANDLE /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::start_all_modules_of_group(HANDLE hApp, - UI_32 f_ui32GroupNumber) noexcept { +EFrameworkunifiedStatus CSystemManager::start_all_modules_of_group(HANDLE hApp, UI_32 f_ui32GroupNumber) { EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); @@ -1367,8 +1363,8 @@ EFrameworkunifiedStatus CSystemManager::start_all_modules_of_group(HANDLE hApp, // ZONE_INFO logging internally. if (!l_ModuleListIterator->is_start_required) { if (FRAMEWORKUNIFIED_NS_NPSERVICE == l_ModuleListIterator->name) { - const SMModuleState l_transition_state = InProgressStateToState(); - l_ModuleListIterator->SetModuleState(l_transition_state); + const SMModuleState l_transition_state = InProgressStateToState(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) + l_ModuleListIterator->SetModuleState(l_transition_state); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) } else { // Not an error FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, @@ -1438,7 +1434,7 @@ EFrameworkunifiedStatus CSystemManager::start_all_modules_of_group(HANDLE hApp, case MODULE_STATE_STOPPED_BACKGROUND: case MODULE_STATE_STOP_BACKGROUND_FAILED: { - const UI_32 l_iCmd = InProgressStateToSendMsg(); + const UI_32 l_iCmd = InProgressStateToSendMsg(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) if (l_iCmd != SS_SYSTEM_MANAGER_PROTOCOL_ENDING_INDEX) { // LCOV_EXCL_BR_LINE 6: Excluded due to value never returned at present // LCOV_EXCL_BR_START 15: Excluded due to inlined functions CALL_AND_LOG_STATUS_IF_ERRORED(l_ModuleListIterator->SendMsgAndUpdateState(l_iCmd, &f_startupData)); @@ -1456,7 +1452,7 @@ EFrameworkunifiedStatus CSystemManager::start_all_modules_of_group(HANDLE hApp, } if (0 == l_numModulesMessaged) { - LogGroupModulesState(f_ui32GroupNumber, " Warning: NO modules were sent system_manager protocol message"); + LogGroupModulesState(f_ui32GroupNumber, " Warning: NO modules were sent system_manager protocol message"); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) char l_cBuf[100]; snprintf(l_cBuf, sizeof(l_cBuf), "ProcessGroupAsStarted(%d)", l_GroupIterator->second.id); @@ -1541,20 +1537,20 @@ EFrameworkunifiedStatus CSystemManager::ProcessGroupAsStarted(HANDLE hApp, // check if WakeUp Level has been achieved if (m_SystemStarter.is_end() == FALSE) { // Start modules from next group - l_groupID = m_SystemStarter.advance_id(); + l_groupID = m_SystemStarter.advance_id(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) char l_cBuf[100] = {0}; snprintf(l_cBuf, sizeof(l_cBuf), "start_all_modules_of_group(%u)", l_groupID); - l_eStatus = start_all_modules_of_group(hApp, l_groupID); + l_eStatus = start_all_modules_of_group(hApp, l_groupID); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set } } else if ((m_SMCurrentState == SS_SM_APPS_PRE_STOP_IN_PROGRESS) || (m_SMCurrentState == SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS)) { if (m_SystemStarter.is_begin() == FALSE) { // Stop modules from next group - l_groupID = m_SystemStarter.decrement_id(); + l_groupID = m_SystemStarter.decrement_id(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) char l_cBuf[100] = {0}; snprintf(l_cBuf, sizeof(l_cBuf), "stop_all_modules_of_group(%u)", l_groupID); - l_eStatus = start_all_modules_of_group(hApp, l_groupID); + l_eStatus = start_all_modules_of_group(hApp, l_groupID); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 6: Because the condition cannot be set } } else { @@ -1668,20 +1664,19 @@ EFrameworkunifiedStatus CSystemManager::OnShutdownModulesRequest(HANDLE hApp) { case SS_SM_APPS_BACKGROUND_STOP_IN_PROGRESS: case SS_SM_APPS_BACKGROUND_RUN_COMPLETE: - if (l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger == epssdmsdtIGN_OFF) { - ROM_AccessIf rom_access; - - rom_access.Initialize(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - if (eFrameworkunifiedStatusOK != (l_eStatus = SetErrLogCount(rom_access, 0))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SetErrLogCount(%d)", l_eStatus); + if (l_tServiceSetIf.data.shutdownRequestMsg.shutdownTrigger == + epssdmsdtIGN_OFF) { + m_ResetCount = 0; + if (PowerHalSetResetInfo(AGL_RESET_COUNTER, m_ResetCount)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not back up m_ResetCount(%lu) to power_hal", m_ResetCount); } - m_ResetCount = 0; - if (eFrameworkunifiedStatusOK != (l_eStatus = SetResetCount(rom_access, m_ResetCount))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SetResetCount(%d)", l_eStatus); + if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, 0)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not reset AGL_ERRLOG_COUNTER"); } } - if (!m_isPrevErrEventCompleted || ((!((m_SMCurrentState == SS_SM_APPS_START_COMPLETE) || (m_SMCurrentState == SS_SM_APPS_PRE_RUN_COMPLETE) @@ -1773,8 +1768,7 @@ EFrameworkunifiedStatus CSystemManager::OnShutdownModulesRequest(HANDLE hApp) { /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::SendSystemModeInfoResponse(HANDLE hApp, - EPWR_STARTUP_STAGE_TYPE f_startupStage) noexcept { +EFrameworkunifiedStatus CSystemManager::SendSystemModeInfoResponse(HANDLE hApp, EPWR_STARTUP_STAGE_TYPE f_startupStage) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; SystemModeInfo l_SystemModeInfo; @@ -1815,7 +1809,7 @@ EFrameworkunifiedStatus CSystemManager::SendSystemModeInfoResponse(HANDLE hApp, /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::OnSystemModeInfoRequest(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::OnSystemModeInfoRequest(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) @@ -1865,7 +1859,7 @@ EFrameworkunifiedStatus CSystemManager::OnSystemModeInfoRequest(HANDLE hApp) noe /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::OnInitCompReportCallback(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::OnInitCompReportCallback(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) @@ -1919,9 +1913,9 @@ BOOL CSystemManager::have_all_services_start_completed(const SMModuleState f_mod ModuleLaunchListIter l_ModuleListIterator = l_GroupIterator->second.modules.begin(); for (; l_ModuleListIterator != l_GroupIterator->second.modules.end(); l_ModuleListIterator++) { if ((l_ModuleListIterator->is_start_required == TRUE) - && ((l_ModuleListIterator->IsModuleState(f_moduleState) == FALSE) - && (l_ModuleListIterator->IsModuleState(MODULE_STATE_SKIPPED) == FALSE) - && (l_ModuleListIterator->IsModuleState(l_failedState) == FALSE))) { + && ((l_ModuleListIterator->IsModuleState(f_moduleState) == FALSE) // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) + && (l_ModuleListIterator->IsModuleState(MODULE_STATE_SKIPPED) == FALSE) // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) + && (l_ModuleListIterator->IsModuleState(l_failedState) == FALSE))) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) // Allow _SKIPPED/START_FAILED for StartRespMonitor conditions bIsStartCompleted = FALSE; break; @@ -2006,29 +2000,23 @@ EFrameworkunifiedStatus CSystemManager::perform_force_reset(HANDLE hApp) { "NO NAVIDET!! but SendShutdownComp for FactReset"); CALL_AND_LOG_STATUS(send_shutdown_complete_response(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) sleep(60); - } else if (access("/nv/bs/ss_debug", F_OK) == 0) { + } else if (access("/nv/BS/ss/system_manager/rwdata/ss_debug", F_OK) == 0) { fprintf(stderr, "SS_SysManager/%s/NO NAVIDET!! but SendShutdownComp\n", __FUNCTION__); FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NO NAVIDET!! but SendShutdownComp"); CALL_AND_LOG_STATUS(send_shutdown_complete_response(hApp)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) sleep(60); } - FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, "Perform Final Umount(0)"); - CALL_AND_LOG_STATUS(PerformFinalUmount(TRUE)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - - fprintf(stderr, "SS_SysManager/%s/Perform Final Umount(0)\n", __FUNCTION__); fflush(stderr); usleep(100 * 1000); -// SS_ASERT(0 == EL_Gpio_finalize()); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - -// if (0 == PsmNaviResetPower(hApp)) { // LCOV_EXCL_BR_LINE 200: power_hal if, can not to be error. -// SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) -// } else { -// usleep(300 * 1000); -// fprintf(stderr, "SS_SysManager/%s/Error: Not Reset !!!\n", __FUNCTION__); -// l_eStatus = eFrameworkunifiedStatusFail; -// } + if (0 == PsmNaviResetPower(hApp, m_ResetFactor)) { // LCOV_EXCL_BR_LINE 200: power_hal if, can not to be error. + SS_ASERT_ERRNO(0); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) + } else { + usleep(300 * 1000); + fprintf(stderr, "SS_SysManager/%s/Error: Not Reset !!!\n", __FUNCTION__); + l_eStatus = eFrameworkunifiedStatusFail; + } send_shutdown_complete_response(hApp); // Try to NAVI_RESET even if ignored @@ -2102,6 +2090,46 @@ EFrameworkunifiedStatus CSystemManager::SendShutdownResponseMessage(HANDLE hApp) return l_eStatus; } // End of EFrameworkunifiedStatus CSystemManager::SendShutdownResponseMessage( HANDLE hApp ) + +PsmFactorT CSystemManager::GetResetFactor(PCSTR f_module_name, BOOL f_user_reset) { + PsmFactorT l_reset_factor = PSM_FACTOR_NONE; + EFrameworkunifiedStatus l_eStatus; + ModuleLaunchListIter l_moduleIter; + l_eStatus = GetModuleIterator(f_module_name, l_moduleIter); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) + if (eFrameworkunifiedStatusOK != l_eStatus) { + LOG_ERROR("GetModuleIterator()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) + } else { + l_reset_factor = GetResetFactor(l_moduleIter, f_user_reset); + } + return l_reset_factor; +} // End of PsmFactorT CSystemManager::GetResetFactor(PCSTR f_module_name) + + +PsmFactorT CSystemManager::GetResetFactor(const ModuleLaunchListIter f_module_iter, BOOL f_user_reset) { + PsmFactorT l_reset_factor; + if (f_module_iter->IsAGLUnit() == TRUE) { + if (f_module_iter->IsAGLResetHistoryDisable() == TRUE) { + l_reset_factor = PSM_FACTOR_AGL; + } else { + l_reset_factor = PSM_FACTOR_AGL_WITH_HISTORY; + } + } else { + if (f_module_iter->IsNonAGLResetHistoryDisable() == TRUE) { + l_reset_factor = PSM_FACTOR_TIER1; + } else { + l_reset_factor = PSM_FACTOR_TIER1_WITH_HISTORY; + } + } + + if (f_user_reset == TRUE) { + if ((l_reset_factor == PSM_FACTOR_AGL) || (l_reset_factor == PSM_FACTOR_TIER1)) { + l_reset_factor = PSM_FACTOR_USER; + } else { + l_reset_factor = PSM_FACTOR_USER_WITH_HISTORY; + } + } + return l_reset_factor; +} // End of PsmFactorT GetResetFactor(ModuleLaunchListIter & f_module_iter) /////////////////////////////////////////////////////////////////////////////// /// \ingroup OnClientStopMonitorTimerExpiry /// @@ -2149,14 +2177,6 @@ EFrameworkunifiedStatus CSystemManager::OnClientStopMonitorTimerExpiry(HANDLE hA // DEAD CODE fprintf(stderr, "SS_SysManager/%s:SVC stop timeout\n", __FUNCTION__); FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " SVC stop timeout"); - { - RAM_AccessIf ram_access; - RAM_SM_INFO_t info; - - SS_ASERT(eFrameworkunifiedStatusOK == ram_access.getRamInfo(&info)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - info.isErrorReset = TRUE; - SS_ASERT(eFrameworkunifiedStatusOK == ram_access.setRamInfo(&info)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } l_eStatus = CallStopCompleteHandler(hApp); LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "CallStopCompleteHandler( hApp )"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length) } @@ -2225,14 +2245,6 @@ VOID CSystemManager::check_all_groups_have_stopped(HANDLE hApp) { } fprintf(stderr, "SS_SysManager/%s:critical service no stop\n", __FUNCTION__); FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "critical service no stop"); - { - RAM_AccessIf ram_access; - RAM_SM_INFO_t info; - - SS_ASERT(eFrameworkunifiedStatusOK == ram_access.getRamInfo(&info)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - info.isErrorReset = TRUE; - SS_ASERT(eFrameworkunifiedStatusOK == ram_access.setRamInfo(&info)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } } CALL_AND_LOG_STATUS(CallStopCompleteHandler(hApp, l_bIsDetectTimeout)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) @@ -2286,8 +2298,7 @@ EFrameworkunifiedStatus CSystemManager::OnNppStopComplete(HANDLE hApp) { return eFrameworkunifiedStatusOK; } -EFrameworkunifiedStatus CSystemManager::GetModuleIterator(PCSTR f_moduleName, - ModuleLaunchListIter &f_moduleIter) noexcept { +EFrameworkunifiedStatus CSystemManager::GetModuleIterator(PCSTR f_moduleName, ModuleLaunchListIter &f_moduleIter) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus; @@ -2364,13 +2375,14 @@ BOOL CSystemManager::IsGroupStarted(UI_32 f_groupID) { const SMModuleState l_dest_state = InProgressStateToState(); // LCOV_EXCL_BR_LINE 11: Gcov constraints (because exception-handling routes are automatically generated) // NOLINT(whitespace/line_length) if (l_dest_state != MODULE_STATE_INVALID) { for (; l_ModuleListIter != l_GroupIter->second.modules.end(); l_ModuleListIter++) { - if (((l_ModuleListIter->IsModuleState(l_dest_state) == FALSE) + if (((l_ModuleListIter->IsModuleState(l_dest_state) == FALSE) // LCOV_EXCL_BR_START 11:Gcov constraints (because exception-handling routes are automatically generated) && (l_ModuleListIter->IsModuleState(MODULE_STATE_START_FAILED) == FALSE) && (l_ModuleListIter->IsModuleState(MODULE_STATE_START_PRE_FAILED) == FALSE) && (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_PRE_FAILED) == FALSE) && (l_ModuleListIter->IsModuleState(MODULE_STATE_START_BACKGROUND_FAILED) == FALSE) && (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_BACKGROUND_FAILED) == FALSE) && (l_ModuleListIter->IsModuleState(MODULE_STATE_STOP_FAILED) == FALSE)) + // LCOV_EXCL_BR_STOP 11:Gcov constraints (because exception-handling routes are automatically generated) || ((l_ModuleListIter->is_start_required == TRUE) // LCOV_EXCL_START 6: Because the value cannot be stored to make the condition true && ((l_ModuleListIter->IsModuleState(MODULE_STATE_LAUNCHING) == TRUE) @@ -2425,7 +2437,7 @@ BOOL CSystemManager::IsGroupStopped(UI_32 f_groupID) { /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::OnModuleStopCompleteResponse(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::OnModuleStopCompleteResponse(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusErrOther; INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) @@ -2454,7 +2466,7 @@ EFrameworkunifiedStatus CSystemManager::OnModuleStopCompleteResponse(HANDLE hApp /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::OnGetStartExtInfo(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::OnGetStartExtInfo(HANDLE hApp) { EFrameworkunifiedStatus l_eStatus; T_SS_SM_START_ExtDataStructType l_extInfo = { 0 }; @@ -2518,7 +2530,7 @@ EFrameworkunifiedStatus CSystemManager::OnGetStartExtInfo(HANDLE hApp) noexcept /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::OnGetStopExtInfo(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::OnGetStopExtInfo(HANDLE hApp) { EFrameworkunifiedStatus l_eStatus; T_SS_SM_STOP_ExtDataStructType l_extInfo = { 0 }; @@ -2839,112 +2851,10 @@ EFrameworkunifiedStatus CSystemManager::ValidateUserModeMessage(HANDLE hApp, EPW } // End of EFrameworkunifiedStatus CSystemManager::ValidateUserModeMessage( HANDLE hApp, EPWR_USER_MODE_TYPE &l_eUserModeState ) // LCOV_EXCL_STOP -//***************************************************************************** -// Boot Mode Protocol functions * -// * -EFrameworkunifiedStatus CSystemManager::OnSetBootModeRequest(HANDLE hApp) noexcept { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus; - INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp)); - - SetCmdHist("SS_SM_BOOT_MODE_SET_REQ", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp)); - - ESMBootModeInfo l_eBootModeState = e_SS_SM_BOOT_MODE_INVALID; - l_eStatus = ValidateBootModeMessage(hApp, l_eBootModeState); - - if (eFrameworkunifiedStatusOK != l_eStatus) { - LOG_ERROR_REC_HIST(l_eStatus, "ValidateBootModeMessage(&l_eBootModeState)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length) - } else { - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, - " Per %s's request, changing 'CSystemManager::m_BootMode' from '0x%x' to '0x%x'", - FrameworkunifiedGetMsgSrc(hApp), m_SystemModeInfo.systemMode, - l_eBootModeState); - - // Got valid boot mode flag - m_BootMode = l_eBootModeState; - - if (m_UsingVMPlayer) { // LCOV_EXCL_BR_LINE 6: For setting the initialization conditions at SystemManager startup - // LCOV_EXCL_START 6: For setting the initialization conditions at SystemManager startup - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warning: 'm_UsingVMPlayer' is True"); - l_eStatus = eFrameworkunifiedStatusOK; - // LCOV_EXCL_STOP - } else { - // Initialize ROM access object - ROM_AccessIf rom_access; - EBOOT_MODE boot_mode = PROGRAMMING_MODE; - rom_access.Initialize(); - - if (m_BootMode == e_SS_SM_BOOT_MODE_APPLICATION) { - boot_mode = APPLICATION_MODE; - } - - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "boot_mode:%s", (boot_mode == APPLICATION_MODE) ? "APL" : "PROG"); - - // Try setting boot mode. If it's failed revert back to Invalid mode - if (eFrameworkunifiedStatusOK == (l_eStatus = rom_access.SetBootMode(boot_mode))) { - l_eStatus = PublishBootModeNotification(hApp); - } else { - l_eBootModeState = e_SS_SM_BOOT_MODE_INVALID; - } - } - } - // - // Return current status to the client, good or bad - // ( ReturnBootModeAndStatus() will report errors as needed ) - // - l_eStatus = ReturnBootModeAndStatus(hApp, SS_SM_BOOT_MODE_SET_RESP, - "SS_SM_BOOT_MODE_SET_RESP", m_BootMode, l_eStatus); - LOG_STATUS_IF_ERRORED(l_eStatus, "ReturnBootModeAndStatus(SS_SM_BOOT_MODE_SET_RESP"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::OnSetBootModeRequest( HANDLE hApp ) - -//***************************************************************************** -// Wakeup Order Protocol functions * -// * -EFrameworkunifiedStatus CSystemManager::OnSetWakeupOrderRequest(HANDLE hApp) noexcept { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus; - TSystemManagerWakeupOrderInfo tWakeupOrderInfo; - - INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp)); - - SetCmdHist("SS_SM_WAKEUP_ORDER_SET_REQ", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp)); - - if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < TSystemManagerWakeupOrderInfo - > (hApp, tWakeupOrderInfo))) { - LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } else { - RAM_AccessIf ram_access; - RAM_SM_INFO_t info; - - if (eFrameworkunifiedStatusOK != (l_eStatus = ram_access.getRamInfo(&info))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: getRamInfo(%d)", l_eStatus); - } else { - snprintf(info.order_name, sizeof(info.order_name), "%s", - tWakeupOrderInfo.order_name); - if (eFrameworkunifiedStatusOK != (l_eStatus = ram_access.setRamInfo(&info))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: setRamInfo(%d)", l_eStatus); - } - } - } - l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_eStatus, sizeof(l_eStatus)); - LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 6:Error Pattern can't pass here - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::OnSetWakeupOrderRequest( HANDLE hApp ) - //***************************************************************************** // Next Wakeup Type Set Protocol functions * // * -EFrameworkunifiedStatus CSystemManager::OnSetNextWakeupTypeRequest(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::OnSetNextWakeupTypeRequest(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus; ESMNextWakeupType l_wakeupType; @@ -2960,15 +2870,6 @@ EFrameworkunifiedStatus CSystemManager::OnSetNextWakeupTypeRequest(HANDLE hApp) case e_SS_SM_NEXT_WAKEUP_TYPE_NONE: case e_SS_SM_NEXT_WAKEUP_TYPE_COLD: case e_SS_SM_NEXT_WAKEUP_TYPE_HOT: - { - ROM_AccessIf rom_access; - rom_access.Initialize(); - if (eFrameworkunifiedStatusOK != (l_eStatus = SetNextWakeupType(rom_access, l_wakeupType))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: SetNextWakeupType(%d)", l_eStatus); - } else { - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "SetNextWakeupType(%d)", l_wakeupType); - } - } break; default: FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "unknown type(%d)", l_wakeupType); @@ -2980,142 +2881,17 @@ EFrameworkunifiedStatus CSystemManager::OnSetNextWakeupTypeRequest(HANDLE hApp) FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::OnSetWakeupOrderRequest( HANDLE hApp ) - -EFrameworkunifiedStatus CSystemManager::PublishBootModeNotification(HANDLE hApp) noexcept { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - TSS_BootModeListStruct l_bootModes; - l_bootModes.hostBootMode = m_BootMode; - l_bootModes._CWORD56_BootMode = m_startUpConfirmationMsg._CWORD56_BootMode; - - char l_cBuf[500] = { 0 }; - snprintf(l_cBuf, sizeof(l_cBuf), "FrameworkunifiedNPPublishNotification(%s, %s, %s)", - NTFY_SSHUBootModes, GetStr(m_BootMode).c_str(), - GetStr(m_startUpConfirmationMsg._CWORD56_BootMode).c_str()); - - l_eStatus = FrameworkunifiedNPPublishNotification(hApp, NTFY_SSHUBootModes, &l_bootModes, sizeof(l_bootModes)); - - REC_HIST_IF_SUCCESSFUL(NTFY_SSHUBootModes, m_PubCmdHist, m_PubHistIter, "", l_eStatus); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length) - - LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length) - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::PublishBootModeNotification(ESMBootModeInfo f_BootMode) - -EFrameworkunifiedStatus CSystemManager::ReturnBootModeAndStatus(HANDLE hApp, - SS_SystemManagerProtocol protocolID, PCSTR p_sIDName, - ESMBootModeInfo f_BootMode, EFrameworkunifiedStatus eFrameworkunifiedStatus) noexcept { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus; - TSystemManagerBootModeRequestResponse l_response; - PCSTR p_sBootModeName = ( - f_BootMode == e_SS_SM_BOOT_MODE_APPLICATION ? - "BOOT_MODE_APPLICATION" : "BOOT_MODE_PROGRAMMING"); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - - (void) p_sBootModeName; - l_response.hostBootMode = f_BootMode; - l_response.eFrameworkunifiedStatus = eFrameworkunifiedStatus; - - ModuleLaunchListIter l_ModuleListIter; - PCSTR l_moduleName = FrameworkunifiedGetMsgSrc(hApp); - if (eFrameworkunifiedStatusOK != (l_eStatus = GetModuleIterator(l_moduleName, l_ModuleListIter))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: Module %s not found in Group Launch Map", l_moduleName); - } else if (l_ModuleListIter->hsession != NULL) { - if (eFrameworkunifiedStatusOK != (l_eStatus = FrameworkunifiedSendMsg(l_ModuleListIter->hsession, protocolID, sizeof(TSystemManagerBootModeRequestResponse), (PVOID) & l_response))) { // LCOV_EXCL_BR_LINE 4:NSFW error case //NOLINT (whitespace/line_length) - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: FrameworkunifiedSendMsg(%s, %s) errored: %d/'%s'", p_sIDName, - p_sBootModeName, l_eStatus, GetStr(l_eStatus).c_str()); - // LCOV_EXCL_STOP - } - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " NULL == hsession; %s not connected yet", - l_ModuleListIter->name.c_str()); - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::ReturnBootModeAndStatus() - -EFrameworkunifiedStatus CSystemManager::ValidateBootModeMessage(HANDLE hApp, - ESMBootModeInfo &l_eBootModeState) noexcept { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus; - TSystemManagerBootModeRequestResponse tBootModeInfoStruct; - ESMBootModeInfo l_my_eBootModeState; - - // ReadMsg(): * - // Check hApp ptr, msg size, msg reception, read msg if all ok. * - // Report any errors found. * - // * - if (eFrameworkunifiedStatusOK - != (l_eStatus = ReadMsg < TSystemManagerBootModeRequestResponse - > (hApp, tBootModeInfoStruct))) { - LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) -// BUGBUG: Temporarily disable authorization for reproservice join -#if 0 - } else if ( eFrameworkunifiedStatusOK != - (l_eStatus = ValidateRequester( - hApp - , ListOfServicesAuthorizedToSetBootMode, - "change Boot Mode"))) { - // ValidateRequester() will report via FRAMEWORKUNIFIEDLOG any // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) - // errors it detects, as well as reporting the name of an - // unauthorized requester - } -#endif - } else { - l_my_eBootModeState = tBootModeInfoStruct.hostBootMode; - switch (l_my_eBootModeState) { // LCOV_EXCL_BR_LINE 6: Out-of-range values for the enum are not feasible - case e_SS_SM_BOOT_MODE_INVALID: - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: l_eBootModeState == e_SS_SM_BOOT_MODE_INVALID"); - l_eStatus = eFrameworkunifiedStatusInvldParam; - break; - - case e_SS_SM_BOOT_MODE_APPLICATION: - case e_SS_SM_BOOT_MODE_PROGRAMMING: - l_eBootModeState = l_my_eBootModeState; - break; - - // default: Don't code a 'default' here - let the compiler - // issue a warning ( set via -Wall or -Wswitch ) when the set of - // enumerations changes - then the maintainer will - // automagically know to update this switch statement. - } // End switch - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::ValidateBootModeMessage() +} // End of EFrameworkunifiedStatus CSystemManager::OnSetNextWakeupTypeRequest( HANDLE hApp ) // * // End of Boot Mode Protocol functions * //***************************************************************************** -EFrameworkunifiedStatus CSystemManager::OnRebootNotification(HANDLE hApp) { - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "+"); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - CALL_AND_LOG_STATUS(PerformForceUmountRamd()); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - CALL_AND_LOG_STATUS(PerformFinalUmount(FALSE)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - - // Wait for reset from SYS after completion of sync - fprintf(stderr, "SS_SysManager/%s/wait reset for RebootNotification\n", __FUNCTION__); - sleep(10); - fprintf(stderr, "SS_SysManager/%s/Not reset 10sec after RebootNotification\n", __FUNCTION__); - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::OnRebootNotification() //***************************************************************************** // Data Reset Mode Protocol functions * // * -EFrameworkunifiedStatus CSystemManager::OnSetDataResetModeRequest(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::OnSetDataResetModeRequest(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus; ESMDataResetModeInfo l_dataResetMode; @@ -3127,14 +2903,13 @@ EFrameworkunifiedStatus CSystemManager::OnSetDataResetModeRequest(HANDLE hApp) n if (eFrameworkunifiedStatusOK != (l_eStatus = ReadMsg < ESMDataResetModeInfo > (hApp, l_dataResetMode))) { LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) } else { - // Set Data Reset Mode to ROM access object - ROM_AccessIf rom_access; - rom_access.Initialize(); - - if (eFrameworkunifiedStatusOK != (l_eStatus = SetDataResetMode(rom_access, l_dataResetMode))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: SetDataResetMode(%d)", l_eStatus); - } else { - m_DataResetMode = l_dataResetMode; + uint32_t tmp; + m_DataResetMode = l_dataResetMode; + tmp = static_cast(m_DataResetMode); + if (PowerHalSetResetInfo(AGL_DATARESET_STATE, tmp)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not set AGL_DATARESET_STATE."); + // Return error to client of system_manager. + l_eStatus = eFrameworkunifiedStatusFail; } } // @@ -3148,7 +2923,7 @@ EFrameworkunifiedStatus CSystemManager::OnSetDataResetModeRequest(HANDLE hApp) n return l_eStatus; } // End of EFrameworkunifiedStatus CSystemManager::OnSetDataResetModeRequest( HANDLE hApp ) -EFrameworkunifiedStatus CSystemManager::OnSetProgUpdateStateRequest(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::OnSetProgUpdateStateRequest(HANDLE hApp) { EFrameworkunifiedStatus l_eStatus; SMProgUpdateState l_progUpdateState; @@ -3163,16 +2938,11 @@ EFrameworkunifiedStatus CSystemManager::OnSetProgUpdateStateRequest(HANDLE hApp) LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) // LCOV_EXCL_STOP } else { - // Set Program Update Status to ROM access object - ROM_AccessIf rom_access; - rom_access.Initialize(); - m_ProgUpdateState |= l_progUpdateState; - if (SS_SM_PROG_UPDATE_STATE_UPDATED & l_progUpdateState) { - SetDramStatusInfo(SYSUP_DRAM_DISCARD); - } - if (eFrameworkunifiedStatusOK != (l_eStatus = SetProgUpdateState(rom_access, m_ProgUpdateState))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: SetProgUpdateState(%d)", l_eStatus); + if (PowerHalSetResetInfo(AGL_PROGUPDATE_STATE, m_ProgUpdateState)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Could not set AGL_PROGUPDATE_STATE."); + // return Error to client of system_manager. + l_eStatus = eFrameworkunifiedStatusFail; } } // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData() @@ -3188,21 +2958,6 @@ EFrameworkunifiedStatus CSystemManager::CallStopCompleteHandler(HANDLE hApp, BOO FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - m_isImmediateReset = FALSE; - - { - RAM_AccessIf ram_access; - RAM_SM_INFO_t info; - - if (eFrameworkunifiedStatusOK != (l_eStatus = ram_access.getRamInfo(&info))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: ram_access.getRamInfo(%d)", l_eStatus); - } else { - info.isImmediateReset = m_isImmediateReset; - if (eFrameworkunifiedStatusOK != (l_eStatus = ram_access.setRamInfo(&info))) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: ram_access.setRamInfo(%d)", l_eStatus); - } - } - } if (bIsDetectTimeout) { fprintf(stderr, "SS_SysManager/%s/State StopComplete(timeout)\n", __FUNCTION__); @@ -3210,9 +2965,6 @@ EFrameworkunifiedStatus CSystemManager::CallStopCompleteHandler(HANDLE hApp, BOO fprintf(stderr, "SS_SysManager/%s/State StopComplete\n", __FUNCTION__); } - CALL_AND_LOG_STATUS(PerformUmountRamd()); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - CALL_AND_LOG_STATUS(PerformUmountNand()); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - l_eStatus = SecureChipOff(); if (eFrameworkunifiedStatusOK != l_eStatus) { FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Error: SecureChipOff Failed"); @@ -3246,119 +2998,8 @@ static char *get_line(const char *filepath) { return strdup(line); } -#define PATH_ROOTFS_SIDEA "/dev/mmcblk0p4" -#define PATH_ROOTFS_SIDEB "/dev/mmcblk0p5" - -static const char *get_path_rootfs(void) { - char *side; - const char *devpath; - - if ((side = get_line("/proc/device-tree/bootinfo/nand_rootfs_part")) == NULL) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "get nand_rootfs_partfailed."); - return PATH_ROOTFS_SIDEA; - } - - if (!strcmp(side, "SideA")) { - devpath = PATH_ROOTFS_SIDEA; - } else if (!strcmp(side, "SideB")) { - devpath = PATH_ROOTFS_SIDEB; - } else { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Invalid side, fall back to SideA"); - devpath = PATH_ROOTFS_SIDEA; - } - free(side); - - return devpath; -} - -#define READ_SIZE (4096) -#define OUTPUT_MAX (1024) - -static int output_count = 0; -static int check_pramfs_body(int emmcfd, off_t offset, size_t read_count) { - int rtn = -1; - size_t i; - char *prDat, *emDat; - - if (output_count >= OUTPUT_MAX) { - return rtn; - } - - /* Pramfs MMAP */ -// prDat = reinterpret_cast(EL_mem_exram_mmap(EL_MEM_TYPE_REGION_PRAMFS, offset, read_count, PROT_READ, -// MAP_SHARED, EL_MEM_CACHE_VALID)); - if (prDat == MAP_FAILED) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Map (Pramfs) failed offset=0x%lx", offset); - goto FAIL_MAP; - } - - /* EMMC MMAP */ - emDat = reinterpret_cast(mmap(NULL, read_count, PROT_READ, MAP_SHARED, emmcfd, offset)); - if (emDat == MAP_FAILED) { // LCOV_EXCL_BR_LINE 5: mmap error - // LCOV_EXCL_START 5: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Map (EMMC) failed offset=0x%lx", offset); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) - goto FAIL_MAP2; - // LCOV_EXCL_STOP - } - - rtn = memcmp(prDat, emDat, read_count); - if (rtn) { - for (i = 0; i < read_count; i++) { - if (*(prDat+i) != *(emDat+i)) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "%08lx : %02x : %02x", i + offset, *(prDat+i), *(emDat+i)); - output_count++; - } - } - } - munmap(emDat, read_count); -FAIL_MAP2: -// EL_mem_exram_munmap(prDat, read_count); -FAIL_MAP: - - return rtn; -} - -static void checker_pramfs() { - int i, r_cnt, emmcfd; - size_t pramfs_size; - off_t offset = 0; - const char *path = get_path_rootfs(); - - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Check Start %s", path); - - emmcfd = open(path, O_RDONLY|O_CLOEXEC); - if (emmcfd < 0) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "open fail errno=%d", errno); - goto FAIL_OPEN; - } - -// pramfs_size = EL_mem_getLength(EL_MEM_ID_PRAMFS_ALL); - - r_cnt = static_cast(pramfs_size/READ_SIZE); - for (i=0 ; i < r_cnt ; i++) { - check_pramfs_body(emmcfd, offset, READ_SIZE); - if (output_count >= OUTPUT_MAX) { - goto LOG_MAX; - } - offset += READ_SIZE; - } - if (pramfs_size%READ_SIZE) { - check_pramfs_body(emmcfd, offset, pramfs_size%READ_SIZE); - } - -LOG_MAX: - if (output_count >= OUTPUT_MAX) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "NG part num over %d", OUTPUT_MAX); - } - close(emmcfd); -FAIL_OPEN: - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "Check End"); - return; -} - EFrameworkunifiedStatus CSystemManager::PerformCpuReset(HANDLE hApp, - ESMCpuResetReason f_eSmCpuResetReason, std::string f_messageStr) noexcept { + ESMCpuResetReason f_eSmCpuResetReason, std::string f_messageStr) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; if (FALSE == m_isRcvModeInfo) { @@ -3371,18 +3012,14 @@ EFrameworkunifiedStatus CSystemManager::PerformCpuReset(HANDLE hApp, } else { switch (f_eSmCpuResetReason) { case e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR: - /* Outputs the pramfs validation result to the frameworkunifiedlog when falsification is checked */ - checker_pramfs(); - m_pfStopCompleteHandler = (SysMgrCallback); - // The break is omitted because the same process as for abnormal rebooting is performed. case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR: case e_SS_SM_CPU_RESET_REASON_DSP_ERR: m_isImmResetReq = TRUE; FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, " will reset immediately"); // The break is omitted because the same process as for a normal reboot is performed. - - case e_SS_SM_CPU_RESET_REASON_NORMAL: - case e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET: { + case e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET: + m_pfStopCompleteHandler = (SysMgrCallback); + case e_SS_SM_CPU_RESET_REASON_NORMAL: { TSystemManagerCpuResetInfo l_resetInfo; l_resetInfo.resetReason = f_eSmCpuResetReason; @@ -3402,6 +3039,8 @@ EFrameworkunifiedStatus CSystemManager::PerformCpuReset(HANDLE hApp, break; case e_SS_SM_DATA_RESET_MODE_USER: l_eSmDataResetType = e_SS_SM_DATA_RESET_TYPE_USER; + l_eStatus = FrameworkunifiedBroadcastEvent(hApp, SS_SM_EVENT_USER_DATA_RESET, NULL, 0); + LOG_STATUS(l_eStatus, "FrameworkunifiedBroadcastEvent(SS_SM_EVENT_USER_DATA_RESET)"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) break; default: SS_ASERT_LOG(0, "unexpected data reset mode : %d", m_DataResetMode); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) @@ -3432,7 +3071,7 @@ EFrameworkunifiedStatus CSystemManager::PerformCpuReset(HANDLE hApp, //***************************************************************************** // CPU Reset Protocol functions * // * -EFrameworkunifiedStatus CSystemManager::OnCpuResetRequest(HANDLE hApp) noexcept { // SS_SM_CPU_RESET_REQ +EFrameworkunifiedStatus CSystemManager::OnCpuResetRequest(HANDLE hApp) { // SS_SM_CPU_RESET_REQ FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusFail; std::string l_moduleName = FrameworkunifiedGetMsgSrc(hApp); @@ -3512,45 +3151,17 @@ EFrameworkunifiedStatus CSystemManager::OnCpuResetRequest(HANDLE hApp) noexcept FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); return l_eStatus; } - // * // End of CPU Reset Protocol functions * //***************************************************************************** -EFrameworkunifiedStatus CSystemManager::ValidateRequester(HANDLE hApp, - std::vector &L, PCSTR p_sActionName) { // LCOV_EXCL_START 6: Because the condition cannot be set - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus; - // - // FrameworkunifiedGetMsgSrc( hApp ) is known to return a non-null string from having - // been successfully called by this function's caller. - // - PCSTR p_sRequesterName = FrameworkunifiedGetMsgSrc(hApp); - if (L.end() == find(L.begin(), L.end(), p_sRequesterName)) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: Unauthorized service '%s' requested to %s;" - " request refused.", p_sRequesterName, p_sActionName); - l_eStatus = eFrameworkunifiedStatusInvldID; - } else { - l_eStatus = eFrameworkunifiedStatusOK; - } - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} // End of EFrameworkunifiedStatus CSystemManager::ValidateRequester( HANDLE hApp ) -// LCOV_EXCL_STOP VOID CSystemManager::InitiateAllGroupsShutdown(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus; - char l_cBuf[100]; // Prioritize safe termination sequence and do not save logs during termination m_errorEventQueueLocked = TRUE; - snprintf(l_cBuf, sizeof(l_cBuf), "SaveLastUserModeToNVM(%s)", GetStr(m_lastUserMode).c_str()); - l_eStatus = SaveLastUserModeToNVM(m_lastUserMode); - LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, l_cBuf); // LCOV_EXCL_BR_LINE 15: marco defined in ss_system_manager.h // NOLINT(whitespace/line_length) - m_MaxShutdownTime = calculate_max_shutdown_time(); l_eStatus = FrameworkunifiedNPPublishNotification(hApp, NTFY_SSSystemMgrShutdownStarted, NULL, 0); @@ -3624,7 +3235,7 @@ VOID CSystemManager::SendDeferMsg(HANDLE hApp) { /// Success ==> eFrameworkunifiedStatusOK /// Failure ==> Other values /////////////////////////////////////////////////////////////////////////////// -EFrameworkunifiedStatus CSystemManager::PublishPowerOnOffNotification(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::PublishPowerOnOffNotification(HANDLE hApp) { EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); @@ -3637,7 +3248,7 @@ EFrameworkunifiedStatus CSystemManager::PublishPowerOnOffNotification(HANDLE hAp return l_eStatus; } -EFrameworkunifiedStatus CSystemManager::PublishUserModeNotification(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::PublishUserModeNotification(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus; @@ -3650,8 +3261,7 @@ EFrameworkunifiedStatus CSystemManager::PublishUserModeNotification(HANDLE hApp) return l_eStatus; } // End of EFrameworkunifiedStatus CSystemManager::PublishUserModeNotification( -EFrameworkunifiedStatus CSystemManager::PerformPowerOnOffUserModePublication(HANDLE hApp, - const char * p_NotificationStr) noexcept { +EFrameworkunifiedStatus CSystemManager::PerformPowerOnOffUserModePublication(HANDLE hApp, const char * p_NotificationStr) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus; char l_cBuf[500] = { 0 }; @@ -3752,92 +3362,7 @@ EFrameworkunifiedStatus CSystemManager::ResetModulesStateToConnected(HANDLE hApp return l_eStatus; } // End of EFrameworkunifiedStatus CSystemManager::ResetModulesStateToConnected(HANDLE hApp) -EFrameworkunifiedStatus CSystemManager::OnVarCodeSetRequest(HANDLE hApp) noexcept { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - EFrameworkunifiedStatus l_eStatus; - INTERFACEUNIFIEDLOG_RECEIVED_FROM(hApp); // LCOV_EXCL_BR_LINE 15: marco defined in ns_logger_if.h // NOLINT(whitespace/line_length) - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp)); - - SetCmdHist("SS_SM_DEBUG_VAR_CODE_DATA_SET_REQ", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp)); - - UI_32 l_msgLen; - if (NULL != m_pVarCodeStr) { - delete[] m_pVarCodeStr; - } - if (0 == (l_msgLen = FrameworkunifiedGetMsgLength(hApp))) { - l_eStatus = eFrameworkunifiedStatusInvldBufSize; - FRAMEWORKUNIFIEDLOG(ZONE_WARN, __FUNCTION__, " Warning: Variant code string length is 0."); - } else if (NULL == (m_pVarCodeStr = new (std::nothrow) CHAR[l_msgLen])) { // LCOV_EXCL_BR_LINE 5: new's error case - // LCOV_EXCL_START 5: new's error case - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - l_eStatus = eFrameworkunifiedStatusNullPointer; - LOG_ERROR("new (std::nothrow) CHAR[l_msgLen]"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - // LCOV_EXCL_STOP - } else { - l_eStatus = FrameworkunifiedGetMsgDataOfSize(hApp, m_pVarCodeStr, l_msgLen, eSMRRelease); - if (eFrameworkunifiedStatusOK != l_eStatus) { // LCOV_EXCL_BR_LINE 4: nsfw error - // LCOV_EXCL_START 4: nsfw error - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - delete[] m_pVarCodeStr; // LCOV_EXCL_LINE 6: Because it cannot pass the delete[] failure case - m_pVarCodeStr = NULL; - - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - " Error: FrameworkunifiedGetMsgDataOfSize(hApp, m_pVarCodeStr, " - "l_msgLen '%d', eSMRRelease) errored: %d/'%s'", - l_msgLen, l_eStatus, GetStr(l_eStatus).c_str()); - // LCOV_EXCL_STOP - } else { - // Guarantee NULL termination of the string. - m_pVarCodeStr[l_msgLen - 1] = 0; - FRAMEWORKUNIFIEDLOG(ZONE_INFO, __FUNCTION__, " m_pVarCodeStr is '%s'", m_pVarCodeStr); - } - } - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - -EFrameworkunifiedStatus CSystemManager::OnSetBootloaderInfoRequest(HANDLE hApp) noexcept { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp)); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - TSystemManagerBootInfoStruct l_bootInfo; - - SetCmdHist("SS_SM_SET_BOOTLOADER_INFO", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp)); - - l_eStatus = ReadMsg < TSystemManagerBootInfoStruct > (hApp, l_bootInfo); - if (eFrameworkunifiedStatusOK != l_eStatus) { - LOG_ERROR("ReadMsg()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - } - - // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData() - // because this request is sent by FrameworkunifiedInvokeSync() - l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, &l_eStatus, sizeof(l_eStatus)); - LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - - -EFrameworkunifiedStatus CSystemManager::OnGetBootloaderInfoRequest( HANDLE hApp ) { - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); - FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "from %s", FrameworkunifiedGetMsgSrc(hApp)); - EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; - - SetCmdHist("SS_SM_GET_BOOTLOADER_INFO", m_SMCmdHist, m_SMHistIter, FrameworkunifiedGetMsgSrc(hApp)); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - - // Instead of sending Return Message, this function must call FrameworkunifiedSetSyncResponseData() - // because this request is sent by FrameworkunifiedInvokeSync() - l_eStatus = FrameworkunifiedSetSyncResponseData(hApp, m_BootMemory, sizeof(LBM_RAM_t)); - LOG_STATUS_IF_ERRORED(l_eStatus, "FrameworkunifiedSetSyncResponseData()"); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - - FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); - return l_eStatus; -} - - -EFrameworkunifiedStatus CSystemManager::On_CWORD56_HeartBeatRequest(HANDLE hApp) noexcept { +EFrameworkunifiedStatus CSystemManager::On_CWORD56_HeartBeatRequest(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_PERIODIC_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; diff --git a/system_manager/server/src/ss_system_manager_error_event.cpp b/system_manager/server/src/ss_system_manager_error_event.cpp index b57bdc16..131b86ab 100644 --- a/system_manager/server/src/ss_system_manager_error_event.cpp +++ b/system_manager/server/src/ss_system_manager_error_event.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -42,11 +42,11 @@ #include #include #include -//#include +#include #include #include #include -#include + #include #include #include @@ -144,12 +144,13 @@ EFrameworkunifiedStatus CSystemManager::ErrorEventInit(HANDLE f_hApp) { /////////////////////////////////////////////////////////////////////////////// EFrameworkunifiedStatus CSystemManager::ErrorEventEnqueue(HANDLE f_hApp, EErrorEventType f_eventType, std::string &f_moduleQueueName, - EErrorEventResetType f_resetType, const SMLoggingInfo &f_loggingInfo) noexcept { + EErrorEventResetType f_resetType, const SMLoggingInfo &f_loggingInfo) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); EFrameworkunifiedStatus l_eStatus = eFrameworkunifiedStatusOK; ERROR_EVENT_INFO l_errorEventInfo; ERROR_EVENT_QUEUE_ITER l_errorEventIter; ERROR_EVENT_QUEUE_RET l_retVal; + BOOL isErrorReset = FALSE; if (eErrorEventResetTypeHard == f_resetType) { // Forced reset if shutdown process is not completed after Reboot requesting @@ -157,24 +158,16 @@ EFrameworkunifiedStatus CSystemManager::ErrorEventEnqueue(HANDLE f_hApp, m_aTimerIDs[eSM_TIMER_SHUTDOWN_COMPLETE_MONITOR], SM_SHUTDOWN_COMPLETE_MONITOR_TIMEOUT, 0, 0, 0); - RAM_SM_INFO_t info; - { - RAM_AccessIf ram_access; - - SS_ASERT(eFrameworkunifiedStatusOK == ram_access.getRamInfo(&info)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) - switch (f_loggingInfo.resetReason) { case e_SS_SM_CPU_RESET_REASON_GENERIC_ERR: case e_SS_SM_CPU_RESET_REASON_DSP_ERR: - info.isErrorReset = TRUE; - SS_ASERT(eFrameworkunifiedStatusOK == ram_access.setRamInfo(&info)); // LCOV_EXCL_BR_LINE 15: marco defined in ss_templates.h // NOLINT(whitespace/line_length) + isErrorReset = TRUE; break; default: break; } - } // LCOV_EXCL_START 6:This variable cannot be modified by external API - if ((m_ResetCount > SS_SM_ERR_NAVI_RESET_LIMIT) && info.isErrorReset) { + if ((m_ResetCount > SS_SM_ERR_NAVI_RESET_LIMIT) && isErrorReset) { // LCOV_EXCL_BR_STOP // LCOV_EXCL_START 6:This variable cannot be modified by external API (evaluated only initial value) AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert @@ -295,11 +288,10 @@ EFrameworkunifiedStatus CSystemManager::ErrorEventProcessNext(HANDLE f_hApp) { case eErrorEventTypeInterfaceunifiedEmmcLogs: case eErrorEventTypeUserInvokedClearLogs: if (eFrameworkunifiedStatusOK == m_errorEventResult) { - ROM_AccessIf rom_access; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - rom_access.Initialize(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - l_eStatus = SetErrLogCount(rom_access, 0); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - if (eFrameworkunifiedStatusOK != l_eStatus) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SetErrLogCount(%d)", l_eStatus); + if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, 0)) { + // Logging only. + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not reset AGL_ERRLOG_COUNTER"); } } break; @@ -351,6 +343,17 @@ EFrameworkunifiedStatus CSystemManager::ErrorEventProcessNext(HANDLE f_hApp) { &CSystemManager::perform_force_reset>); } + if ((m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_CRITICAL_ERR) || + (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_GENERIC_ERR) || + (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_DSP_ERR) || + (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET)) { + BOOL l_user_reset = FALSE; + if (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_USER_FORCE_RESET) { + l_user_reset = TRUE; + } + m_ResetFactor = GetResetFactor(m_errorEventCurrentIter->m_moduleQueueName.c_str(), l_user_reset); + } + l_eStatus = PerformResetAfterLogging(f_hApp, m_errorEventCurrentIter->m_loggingInfo.resetReason, m_errorEventCurrentIter->m_loggingInfo.messageStr); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) @@ -404,7 +407,7 @@ EFrameworkunifiedStatus CSystemManager::ErrorEventProcessNext(HANDLE f_hApp) { size_t path_len = strlen(m_errorEventCurrentIter->m_loggingInfo.path.c_str()); if (path_len > modl_len) { FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, - "Input buffer size over. input : %d, enable : %d", + "Input buffer size over. input : %ld, enable : %ld", path_len, modl_len); } l_errorEventNtfData.ModuleName[sizeof(l_errorEventNtfData.ModuleName) - 1] = 0; @@ -432,7 +435,6 @@ EFrameworkunifiedStatus CSystemManager::ErrorEventProcessNext(HANDLE f_hApp) { == m_errorEventCurrentIter->m_eventType))) { // LCOV_EXCL_BR_STOP // LCOV_EXCL_START 6: Because the following conditions cannot be satisfied when called from an external API - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert // Note: If logger crashes, a core file will exist. std::string l_hmiDispStr; l_hmiDispStr = SERVICE_LOGGER; @@ -445,6 +447,9 @@ EFrameworkunifiedStatus CSystemManager::ErrorEventProcessNext(HANDLE f_hApp) { FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "will NAVIDET as SSL dead"); m_pfStopCompleteHandler = (SysMgrCallback); + + m_ResetFactor = GetResetFactor(SERVICE_LOGGER, FALSE); + l_eStatus = PerformResetAfterLogging(f_hApp, e_SS_SM_CPU_RESET_REASON_GENERIC_ERR); LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformResetAfterLogging()"); @@ -465,7 +470,6 @@ EFrameworkunifiedStatus CSystemManager::ErrorEventProcessNext(HANDLE f_hApp) { LOG_ERROR_REC_HIST_IF_ERRORED(l_eStatus, "FrameworkunifiedPublishEvent(SS_SM_EVENT_ERROR)"); - // LCOV_EXCL_STOP } else if (m_errorEventCurrentIter->m_eventType == eErrorEventTypeModuleInvokedResetRequest && (m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_NORMAL || m_errorEventCurrentIter->m_loggingInfo.resetReason == e_SS_SM_CPU_RESET_REASON_DATA_RESET)) { @@ -477,40 +481,33 @@ EFrameworkunifiedStatus CSystemManager::ErrorEventProcessNext(HANDLE f_hApp) { BOOL bIsNeedLogging = TRUE; { - ROM_AccessIf rom_access; UI_32 l_ErrLogCount = 0; + if (PowerHalGetResetInfo(AGL_ERRLOG_COUNTER, &l_ErrLogCount)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not get AGL_ERRLOG_COUNTER form power_hal, assume to 0."); + l_ErrLogCount = 0; + } - rom_access.Initialize(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - - // LCOV_EXCL_BR_START 200: Because it depends on the ROMAccessIf canonical return values - if (eFrameworkunifiedStatusOK - != GetErrLogCount(rom_access, l_ErrLogCount)) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 200: Because it depends on the ROMAccessIf canonical return values - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "GetErrLogCount()"); - // LCOV_EXCL_STOP - } else { - // LCOV_EXCL_BR_START 6: Because the condition cannot be set + { if ((l_ErrLogCount >= SS_SM_ERR_LOGGING_LIMIT) && (eErrorEventResetTypeHard == m_errorEventCurrentIter->m_errorEventResetType)) { - // LCOV_EXCL_BR_STOP - // LCOV_EXCL_START 8: l_ErrLogCount is always 0 - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200: test assert fprintf(stderr, "SS_SysManager/%s:Skip Logging by continuous error \n", __FUNCTION__); FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Skip Logging by continuous error "); + + m_ResetFactor = PSM_FACTOR_AGL_WITH_HISTORY; + l_eStatus = PerformResetAfterLogging(f_hApp, m_errorEventCurrentIter->m_loggingInfo.resetReason, m_errorEventCurrentIter->m_loggingInfo.messageStr); LOG_STATUS_REC_HIST_IF_ERRORED(l_eStatus, "PerformResetAfterLogging()"); bIsNeedLogging = FALSE; - // LCOV_EXCL_STOP } else if (eErrorEventResetTypeHard == m_errorEventCurrentIter->m_errorEventResetType) { l_ErrLogCount++; - if (eFrameworkunifiedStatusOK != SetErrLogCount(rom_access, l_ErrLogCount)) { - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "SetErrLogCount()"); + if (PowerHalSetResetInfo(AGL_ERRLOG_COUNTER, l_ErrLogCount)) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, + "Could not set AGL_ERRLOG_COUNTER to power_hal."); } } } diff --git a/system_manager/server/src/ss_system_manager_error_event_responses.cpp b/system_manager/server/src/ss_system_manager_error_event_responses.cpp index fab98848..28e8dbf8 100644 --- a/system_manager/server/src/ss_system_manager_error_event_responses.cpp +++ b/system_manager/server/src/ss_system_manager_error_event_responses.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ /////////////////////////////////////////////////////////////////////////////// #include #include -//#include +#include #include #include #include @@ -471,15 +471,13 @@ EFrameworkunifiedStatus CSystemManager::OnObtainSystemmanagerSystemDataCsv(HANDL // LCOV_EXCL_BR_STOP { - ROM_AccessIf rom_access; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) - UI_32 l_ErrLogCount; - - rom_access.Initialize(); // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) + UI_32 l_ErrLogCount = 0; + if (PowerHalGetResetInfo(AGL_ERRLOG_COUNTER, &l_ErrLogCount)) { // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) + FRAMEWORKUNIFIEDLOG(ZONE_SYSLOG, __FUNCTION__, + "Could not get AGL_ERRLOG_COUNTER from power_hal."); + } - if (eFrameworkunifiedStatusOK != GetErrLogCount(rom_access, l_ErrLogCount)) { // LCOV_EXCL_BR_LINE 200:will not be this case - AGL_ASSERT_NOT_TESTED(); // LCOV_EXCL_LINE 200:test assert - FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, " Error: GetErrLogCount()"); // LCOV_EXCL_LINE 200:will not be this case - } else { + { l_stream << "ErrLogCount," << l_ErrLogCount << "/" << SS_SM_ERR_LOGGING_LIMIT << endl; // LCOV_EXCL_BR_LINE 11:unexpected branch // NOLINT(whitespace/line_length) } @@ -833,7 +831,7 @@ EFrameworkunifiedStatus CSystemManager::OnObtainDebugDumpLog(HANDLE f_hApp) { for (l_moduleIter = l_GroupIter->second.modules.begin(); l_moduleIter != l_GroupIter->second.modules.end(); l_moduleIter++) { - const BOOL isModuleConnected = l_moduleIter->IsModuleConnected(); + const BOOL isModuleConnected = l_moduleIter->IsModuleConnected(); // LCOV_EXCL_BR_LINE 11:Gcov constraints (because exception-handling routes are automatically generated) if ((SERVICE_NS_NPP != l_moduleIter->name) && // NPP is a special case and does NOT session connect with SM. (TRUE == isModuleConnected)) { l_eStatus = FrameworkunifiedSendMsg(l_moduleIter->hsession, SS_SM_DEBUG_DUMP, diff --git a/system_manager/server/src/ss_system_manager_error_event_triggers.cpp b/system_manager/server/src/ss_system_manager_error_event_triggers.cpp index a0bf3261..385a628d 100644 --- a/system_manager/server/src/ss_system_manager_error_event_triggers.cpp +++ b/system_manager/server/src/ss_system_manager_error_event_triggers.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -33,11 +33,10 @@ #include #include #include -//#include +#include #include #include #include -#include #include #include #include diff --git a/system_manager/server/src/ss_system_memory_monitor.cpp b/system_manager/server/src/ss_system_memory_monitor.cpp index 86d9f3c2..7ea9b717 100644 --- a/system_manager/server/src/ss_system_memory_monitor.cpp +++ b/system_manager/server/src/ss_system_memory_monitor.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ #include #include #include -//#include +#include #include #include @@ -287,15 +287,15 @@ EFrameworkunifiedStatus CSysMemoryMonitor::OnSystemmanagerlogTimerExpiry(HANDLE uint8_t status; struct tm gmt; struct tm local; -// Clock_getSystemTimeY2K38(&timebuf, &status); -// Clock_CnvSecToDateY2K38(&timebuf, &gmt); -// Clock_getLocalTimeY2K38(&timebuf, &local); + Clock_getSystemTimeY2K38(&timebuf, &status); + Clock_CnvSecToDateY2K38(&timebuf, &gmt); + Clock_getLocalTimeY2K38(&timebuf, &local); -// sprintf(l_format, " G%02d %02d%02d%02d L%02d %02d%02d%02d", gmt.tm_mday, // NOLINT -// gmt.tm_hour, gmt.tm_min, gmt.tm_sec, local.tm_mday, -// local.tm_hour, local.tm_min, local.tm_sec); + sprintf(l_format, " G%02d %02d%02d%02d L%02d %02d%02d%02d", gmt.tm_mday, // NOLINT + gmt.tm_hour, gmt.tm_min, gmt.tm_sec, local.tm_mday, + local.tm_hour, local.tm_min, local.tm_sec); -// FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s", l_format); + FRAMEWORKUNIFIEDLOG(ZONE_STATE, __FUNCTION__, "%s", l_format); } count++; diff --git a/system_manager/server/src/systemmanager_application.cpp b/system_manager/server/src/systemmanager_application.cpp index 20edec3f..506bb2c2 100644 --- a/system_manager/server/src/systemmanager_application.cpp +++ b/system_manager/server/src/systemmanager_application.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,6 +29,11 @@ #include "ss_sm_systemmanagerlog.h" #include "ss_system_manager.h" +#include +#include +#include +#include + ////////////////////////////////////////// // Function : FrameworkunifiedOnInitialization ////////////////////////////////////////// @@ -37,7 +42,14 @@ EFrameworkunifiedStatus FrameworkunifiedOnInitialization(HANDLE hApp) { FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "+"); eStatus = CSystemManager::GetInstance().Initialize(hApp); - + struct rlimit setrl = {RLIM_INFINITY, RLIM_INFINITY}; + struct rlimit getrl = {}; + int ret = prlimit(getpid(), RLIMIT_MSGQUEUE, &setrl, &getrl); + if (ret != 0) { + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "prlimit ret%d", ret); + FRAMEWORKUNIFIEDLOG(ZONE_ERR, __FUNCTION__, "Previous limits: soft=%lld; hard=%lld", (long long) getrl.rlim_cur, + (long long) getrl.rlim_max); + } FRAMEWORKUNIFIEDLOG(ZONE_FUNC, __FUNCTION__, "-"); return eStatus; } diff --git a/system_manager/server/src/systemmanager_main.cpp b/system_manager/server/src/systemmanager_main.cpp index 8cc31fc2..d12aeccc 100644 --- a/system_manager/server/src/systemmanager_main.cpp +++ b/system_manager/server/src/systemmanager_main.cpp @@ -1,5 +1,5 @@ /* - * @copyright Copyright (c) 2016-2019 TOYOTA MOTOR CORPORATION. + * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/system_manager/server/version.txt b/system_manager/server/version.txt new file mode 100644 index 00000000..7fe8299f --- /dev/null +++ b/system_manager/server/version.txt @@ -0,0 +1,2 @@ +AGL Sample +20191026_release -- cgit 1.2.3-korg