1 #include "registration.hpp" 2 3 extern "C" 4 { 5 #include <libpdbg.h> 6 } 7 #include <phosphor-logging/log.hpp> 8 9 namespace openpower 10 { 11 namespace phal 12 { 13 using namespace phosphor::logging; 14 15 /** 16 * @brief Stop instruction executions on all functional threads in the 17 * host processors. 18 * This procedure is used to stop all threads in the system in 19 * attempt best case approach. Like issue processor level stopall 20 * chip-op with ignore hardware error mode. Since this function 21 * is used in power-off/error path, ignore the internal error now. 22 */ 23 void threadStopAll(void) 24 { 25 // Set pdbg back-end to sbefifo. 26 pdbg_set_backend(PDBG_BACKEND_SBEFIFO, NULL); 27 28 // initialize the pdbg. 29 pdbg_targets_init(NULL); 30 31 struct pdbg_target* pibTarget; 32 33 pdbg_for_each_class_target("pib", pibTarget) 34 { 35 // probe pib traget. 36 pdbg_target_probe(pibTarget); 37 } 38 39 // Issue system level thread stop 40 if (thread_stop_all() < 0) 41 { 42 log<level::ERR>("Failed to stop all threads"); 43 return; 44 } 45 log<level::INFO>("Processor thread stopall completed"); 46 } 47 48 REGISTER_PROCEDURE("threadStopAll", threadStopAll) 49 50 } // namespace phal 51 } // namespace openpower 52