diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/build/debug/simics-debug-framework.py | 60 | ||||
-rw-r--r-- | src/include/arch/ppc.H | 38 | ||||
-rw-r--r-- | src/usr/sbeio/sbe_psudd.C | 8 |
3 files changed, 105 insertions, 1 deletions
diff --git a/src/build/debug/simics-debug-framework.py b/src/build/debug/simics-debug-framework.py index 37794a2e4..eae2952c4 100644 --- a/src/build/debug/simics-debug-framework.py +++ b/src/build/debug/simics-debug-framework.py @@ -583,6 +583,66 @@ def magic_instruction_callback(user_arg, cpu, arg): percent_s = "%s" dateCommand = "shell \" date +'%s > TRACE REGS: %d %d' \""%(percent_s,first_num,second_num) SIM_run_alone(run_command, dateCommand ) + if arg == 7022: # MAGIC_SET_LOG_LEVEL + hb_hrmor = cpu.hrmor + per_node = 0x200000000000 #32TB + per_chip = 0x40000000000 #4TB + node_num = hb_hrmor//per_node + proc_num = hb_hrmor//per_chip + comp_id = cpu.r4 + log_level = cpu.r5 + # note the following list of component IDs must be kept in sync + # with the const defintions in sync with src/include/arch/ppc.H + component = [ ".pib_psu", # comp_id = 0 + ".sbe.int_bo" ] # comp_id = 1 + + comp_str = "" + # Right now only 2 components are supported, this if check + # needs to be updated if more components are supported + if comp_id >= 0 or comp_id <= 1: + #check if D1Proc0 exists + D1Proc0String = "D1Proc0" + try: + if(SIM_get_object(D1Proc0String)) : + print (D1Proc0String+" object found") + comp_str = "D%dProc%d"%((node_num + 1), proc_num ) + except: + print("No "+D1Proc0String+" object found") + + #check if P9Proc0 exists + P9Proc0String = "p9Proc0" + try: + if(SIM_get_object(P9Proc0String)) : + print (P9Proc0String+" object found") + comp_str = "p9Proc%d"%(proc_num ) + except: + print("No "+P9Proc0String+" object found") + + if comp_str != "" : + comp_str += component[comp_id] + + printCommand = "shell \" date +' MAGIC_SET_LOG_LEVEL(%d) for %s' \""%(log_level, comp_str) + SIM_run_alone(run_command, printCommand ) + + setLvlCommand = "%s"%(comp_str)+".log-level %d"%(log_level) + SIM_run_alone(run_command, setLvlCommand ) + else : + couldNotFindCommand = "shell \" Unable to find valid object on this system type, neither %s nor %s were found \""%(D1Proc0String, P9Proc0String) + SIM_run_alone(run_command, couldNotFindCommand ) + + if arg == 7023: # MAGIC_TOGGLE_OUTPUT + enable = cpu.r4 + zero = 0; + if enable > zero : + startCommand = "output-file-start hostboot_simics_log.txt -append -timestamp" + SIM_run_alone(run_command, startCommand ) + printCommand = "shell \" date +'>> MAGIC_TOGGLE_OUTPUT(1) starting output' \"" + SIM_run_alone(run_command, printCommand ) + else : + printCommand = "shell \" date +'<< MAGIC_TOGGLE_OUTPUT(0) stopping output' \"" + SIM_run_alone(run_command, printCommand ) + stopCommand = "output-file-stop hostboot_simics_log.txt" + SIM_run_alone(run_command, stopCommand ) if arg == 7055: # MAGIC_CONTINUOUS_TRACE hb_tracBinaryBuffer = cpu.r4 diff --git a/src/include/arch/ppc.H b/src/include/arch/ppc.H index 241e123de..4b07fd107 100644 --- a/src/include/arch/ppc.H +++ b/src/include/arch/ppc.H @@ -449,12 +449,26 @@ inline void MAGIC_INSTRUCTION(int _n) "i" ((((n) >> 0) & 0xf) | 16)); \ } +// Simics components that we can raise log levels for +// It is important to keep these lined up with +// simics-debug-framework.py +constexpr uint8_t PIB_PSU = 0; +constexpr uint8_t SBE_INT_BO = 1; + +constexpr uint8_t ENABLE_OUTPUT = 1; +constexpr uint8_t DISABLE_OUTPUT = 0; + +constexpr uint8_t LOG_LEVEL_OFF = 0; +constexpr uint8_t LOG_LEVEL_LOW = 1; +constexpr uint8_t LOG_LEVEL_MED = 2; +constexpr uint8_t LOG_LEVEL_HIGH = 3; +constexpr uint8_t LOG_LEVEL_MAX = 4; + // Arguments to MAGIC_INSTRUCTION(). // To ensure they do not conflict with haps from other groups (PHYP // for example), assign hap numbers in the range 7000..7999 (decimal). // Presently, the hap handler for magic instruction is found in // src/build/debug/simics-debug-framework.py - enum { MAGIC_SIMICS_CORESTATESAVE = 10, // Indicate to the PHYP model of simics @@ -480,6 +494,8 @@ enum MAGIC_GET_SBE_TRACES = 7019, // Collect SBE traces MAGIC_PRINT_ISTEP = 7020, // Print istep to simics console MAGIC_PRINT_TWO_REGS = 7021, // Print 2 numbers passed in + MAGIC_SET_LOG_LEVEL = 7022, // Set log level for given component + MAGIC_TOGGLE_OUTPUT = 7023, // Enable simic log capture MAGIC_CONTINUOUS_TRACE = 7055, // extract mixed trace buffer @@ -535,6 +551,26 @@ enum #define MAGIC_DONE_WAITING_FOR_FSP() \ asm volatile("mr 4, %0" :: "r" (2) : "4"); \ MAGIC_INSTRUCTION(MAGIC_SIMICS_FSP_WAIT); \ +/** + * @brief set the log level for a given component + * @param[in] _componentId Enum of simics comp ids + * @param[in] _logLevel desired log level + */ +#define MAGIC_INST_SET_LOG_LEVEL(_componentId, _logLevel) \ + asm volatile("mr 4, %0; mr 5, %1" :: \ + "r" (_componentId), "r" (_logLevel) : \ + "4", "5"); \ + MAGIC_INSTRUCTION(MAGIC_SET_LOG_LEVEL); \ +/** + * @brief Toggle simics log collections on or off, if one + * all simics logs will be collected in <sandbox>/simics/hb_simics_log.txt + * @param[in] 1 > will enable log collections, 0 stops collection + */ +#define MAGIC_INST_TOGGLE_OUTPUT(_enable) \ + asm volatile("mr 4, %0" :: \ + "r" (_enable) : \ + "4"); \ + MAGIC_INSTRUCTION(MAGIC_TOGGLE_OUTPUT); \ #endif diff --git a/src/usr/sbeio/sbe_psudd.C b/src/usr/sbeio/sbe_psudd.C index 3e23c9642..eb693c957 100644 --- a/src/usr/sbeio/sbe_psudd.C +++ b/src/usr/sbeio/sbe_psudd.C @@ -283,6 +283,10 @@ errlHndl_t SbePsu::performPsuChipOp(TARGETING::Target * i_target, do { + MAGIC_INST_TOGGLE_OUTPUT(ENABLE_OUTPUT); + MAGIC_INST_SET_LOG_LEVEL(PIB_PSU, LOG_LEVEL_MAX); + MAGIC_INST_SET_LOG_LEVEL(SBE_INT_BO, LOG_LEVEL_MAX); + // write PSU Request errl = writeRequest(i_target, i_pPsuRequest, @@ -308,6 +312,10 @@ errlHndl_t SbePsu::performPsuChipOp(TARGETING::Target * i_target, } while (0); + MAGIC_INST_SET_LOG_LEVEL(PIB_PSU, LOG_LEVEL_OFF); + MAGIC_INST_SET_LOG_LEVEL(SBE_INT_BO, LOG_LEVEL_OFF); + MAGIC_INST_TOGGLE_OUTPUT(DISABLE_OUTPUT); + iv_psuResponse = nullptr; mutex_unlock(&l_psuOpMux); } |