1 #include "phalerror/phal_error.hpp" 2 #include "procedures/phal/common_utils.hpp" 3 #include "registration.hpp" 4 5 #include <libekb.H> 6 7 #include <phosphor-logging/log.hpp> 8 9 namespace openpower 10 { 11 namespace phal 12 { 13 14 using namespace phosphor::logging; 15 16 void prePoweroff(void) 17 { 18 try 19 { 20 phal_init(); 21 } 22 catch (const std::exception& ex) 23 { 24 log<level::ERR>("Exception raised during init PHAL", 25 entry("EXCEPTION=%s", ex.what())); 26 openpower::pel::detail::processBootErrorCallback(false); 27 // Dont throw exception on failure because, we need to proceed 28 // further eventhough there is failure for proc-pre-poweroff 29 return; 30 } 31 32 // To clear trace if success 33 openpower::pel::detail::processBootErrorCallback(true); 34 35 // callback method will be called upon failure which will create the PEL 36 int rc = ipl_pre_poweroff(); 37 if (rc) 38 { 39 log<level::ERR>("pre_poweroff failed"); 40 // Dont throw exception on failure because, we need to proceed 41 // further eventhough there is failure for proc-pre-poweroff 42 return; 43 } 44 } 45 46 REGISTER_PROCEDURE("prePoweroff", prePoweroff) 47 48 } // namespace phal 49 } // namespace openpower 50