@@ -5,6 +5,7 @@
#include "libpdbg.h"
static pdbg_progress_tick_t progress_tick;
+static bool pdbg_short_context = false;
struct pdbg_target *get_parent(struct pdbg_target *target, bool system)
{
@@ -342,3 +343,19 @@ void pdbg_set_progress_tick(pdbg_progress_tick_t fn)
{
progress_tick = fn;
}
+
+bool pdbg_context_short(void)
+{
+ if (pdbg_target_root()) {
+ pdbg_log(PDBG_ERROR, "pdbg_context_short() must be called before pdbg_targets_init()\n");
+ return false;
+ }
+
+ pdbg_short_context = true;
+ return true;
+}
+
+bool pdbg_context_is_short(void)
+{
+ return pdbg_short_context;
+}
@@ -1441,6 +1441,15 @@ void pdbg_set_loglevel(int loglevel);
*/
void pdbg_log(int loglevel, const char *fmt, ...);
+/**
+ * @brief Set the library context for short running application
+ *
+ * This distinguishes the long running applications using libpdbg from the
+ * pdbg tool like applications which terminate after short execution and do
+ * not set particular hardware state for a long time.
+ */
+bool pdbg_context_short(void);
+
#ifdef __cplusplus
}
#endif
@@ -95,4 +95,6 @@ bool target_is_virtual(struct pdbg_target *target);
struct pdbg_target *target_to_real(struct pdbg_target *target, bool strict);
struct pdbg_target *target_to_virtual(struct pdbg_target *target, bool strict);
+bool pdbg_context_is_short(void);
+
#endif
For P10 systems, BMC applications use libpdbg for hardware access and are typically long running. Such applications may need slightly different behaviour of libpdbg when doing probe or other hardware access than pdbg tool. The default behaviour of libpdbg is set to be used in long running application. Pdbg tool (or similar applications, e.g. ecmd) can set the short running application context explicitly using pdbg_context_short(). Signed-off-by: Amitay Isaacs <amitay@ozlabs.org> --- libpdbg/libpdbg.c | 17 +++++++++++++++++ libpdbg/libpdbg.h | 9 +++++++++ libpdbg/target.h | 2 ++ 3 files changed, 28 insertions(+)