main.cpp (7212d21db10901ffa078747c0f288f3341369d21) | main.cpp (3fb52e53551e528f4b2f53b053a7e996993d06d7) |
---|---|
1#include <libpdbg.h> 2 3#include <analyzer/analyzer_main.hpp> 4#include <attn/attn_main.hpp> 5#include <cli.hpp> 6 7/** 8 * @brief Attention handler application main() 9 * 10 * This is the main interface to the hardware diagnostics application. This 11 * application will either be loaded as a daemon for monitoring the attention 12 * gpio or it will be loaded as an application to analyze hardware and 13 * diagnose hadrware error conditions. 14 * 15 * Command line arguments: 16 * | 1#include <libpdbg.h> 2 3#include <analyzer/analyzer_main.hpp> 4#include <attn/attn_main.hpp> 5#include <cli.hpp> 6 7/** 8 * @brief Attention handler application main() 9 * 10 * This is the main interface to the hardware diagnostics application. This 11 * application will either be loaded as a daemon for monitoring the attention 12 * gpio or it will be loaded as an application to analyze hardware and 13 * diagnose hadrware error conditions. 14 * 15 * Command line arguments: 16 * |
17 * analyze analyze hardware 18 * --daemon load application as a daemon 19 * --breakpoints enable breakpoint special attn handling (in daemon mode) | 17 * commands: |
20 * | 18 * |
19 * analyze analyze hardware 20 * 21 * options: 22 * 23 * --daemon load application as a daemon 24 * --vital off disable vital attention handling (daemon mode) 25 * --checkstop off disable checkstop attention handling (daemon mode) 26 * --terminate off disable TI attention handling (daemon mode) 27 * --breakpoints off disable breakpoint attention handling (daemon mode) 28 * 29 * example: 30 * 31 * openpower-hw-diags --daemon --terminate off 32 * |
|
21 * @return 0 = success 22 */ 23int main(int argc, char* argv[]) 24{ 25 int rc = 0; // return code 26 | 33 * @return 0 = success 34 */ 35int main(int argc, char* argv[]) 36{ 37 int rc = 0; // return code 38 |
39 // attention handler configuration flags 40 bool vital_enable = true; 41 bool checkstop_enable = true; 42 bool ti_enable = true; 43 bool bp_enable = true; 44 |
|
27 // initialize pdbg targets 28 pdbg_targets_init(nullptr); 29 | 45 // initialize pdbg targets 46 pdbg_targets_init(nullptr); 47 |
30 // TODO Handle target init fail | 48 // get configuration options 49 parseConfig(argv, argv + argc, vital_enable, checkstop_enable, ti_enable, 50 bp_enable); |
31 32 // check if we are being loaded as a daemon 33 if (true == getCliOption(argv, argv + argc, "--daemon")) 34 { | 51 52 // check if we are being loaded as a daemon 53 if (true == getCliOption(argv, argv + argc, "--daemon")) 54 { |
35 // Check command line args for breakpoint handling enable option 36 bool bp_enable = getCliOption(argv, argv + argc, "--breakpoints"); | 55 attn::Config config(vital_enable, checkstop_enable, ti_enable, 56 bp_enable); |
37 38 // Configure and start attention monitor | 57 58 // Configure and start attention monitor |
39 attn::attnDaemon(bp_enable); | 59 attn::attnDaemon(&config); |
40 } | 60 } |
41 // We are being loaded as an application, so parse the command line 42 // arguments to determine what operation is being requested. | 61 // we are being loaded as an application |
43 else 44 { 45 // Request to analyze the hardware for error conditions 46 if (true == getCliOption(argv, argv + argc, "analyze")) 47 { 48 analyzer::analyzeHardware(); 49 } 50 } 51 52 return rc; 53} | 62 else 63 { 64 // Request to analyze the hardware for error conditions 65 if (true == getCliOption(argv, argv + argc, "analyze")) 66 { 67 analyzer::analyzeHardware(); 68 } 69 } 70 71 return rc; 72} |