[Pdbg] [PATCH 06/18] libpdbg: Replace PR_PERL with PR_INFO

Amitay Isaacs amitay at ozlabs.org
Wed May 16 16:17:24 AEST 2018


From: Amitay Isaacs <amitay at gmail.com>

... and avoid duplicate definitions

Signed-off-by: Amitay Isaacs <amitay at gmail.com>
---
 libpdbg/chip.c       |  1 +
 libpdbg/htm.c        | 22 +++++++++-------------
 libpdbg/operations.h |  3 ++-
 libpdbg/target.h     |  7 -------
 4 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/libpdbg/chip.c b/libpdbg/chip.c
index ebfaaa8..f78b55b 100644
--- a/libpdbg/chip.c
+++ b/libpdbg/chip.c
@@ -23,6 +23,7 @@
 #include "target.h"
 #include "operations.h"
 #include "bitutils.h"
+#include "debug.h"
 
 static uint64_t mfspr(uint64_t reg, uint64_t spr)
 {
diff --git a/libpdbg/htm.c b/libpdbg/htm.c
index 741b39f..3a6187e 100644
--- a/libpdbg/htm.c
+++ b/libpdbg/htm.c
@@ -28,15 +28,11 @@
 #include "operations.h"
 #include "bitutils.h"
 #include "target.h"
+#include "debug.h"
 
 #define HTM_ERR(x) ({int rc = x; if (rc) {PR_ERROR("HTM Error %d %s:%d\n", \
 			rc, __FILE__, __LINE__);} \
 			rc;})
-/*
- * #define PR_PERL(x, args...) \
- *	fprintf(stderr, x, ##args)
- */
-#define PR_PERL(...)
 
 #define MIN(x,y) ((x < y) ? x : y)
 
@@ -334,15 +330,15 @@ static int do_htm_stop(struct htm *htm)
 		return -1;
 
 	if (status.state == UNINITIALIZED) {
-		PR_PERL("* Skipping STOP trigger, HTM appears uninitialized\n");
+		PR_INFO("* Skipping STOP trigger, HTM appears uninitialized\n");
 		return -1;
 	}
 	if (status.state == TRACING) {
-		PR_PERL("* Sending STOP trigger to HTM\n");
+		PR_INFO("* Sending STOP trigger to HTM\n");
 		if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_STOP)))
 			return -1;
 	} else {
-		PR_PERL("* Skipping STOP trigger, HTM is not running\n");
+		PR_INFO("* Skipping STOP trigger, HTM is not running\n");
 	}
 	return 1;
 }
@@ -388,7 +384,7 @@ static int do_adu_magic(struct pdbg_target *target, uint32_t index, uint64_t *ar
 	} while (val != 0x2000000000000004 && i < 10);
 
 	if (val != 0x2000000000000004) {
-		PR_PERL("Unexpected status on HTM start trigger PMISC command: 0x%"
+		P_INFO("Unexpected status on HTM start trigger PMISC command: 0x%"
 				PRIx64 "\n", val);
 		return -1;
 	}
@@ -561,7 +557,7 @@ static int do_htm_start(struct htm *htm)
 		return -1;
 	}
 
-	PR_PERL("* Sending START trigger to HTM\n");
+	PR_INFO("* Sending START trigger to HTM\n");
 	if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_MARK_VALID)))
 		return -1;
 
@@ -773,11 +769,11 @@ static int do_htm_pause(struct htm *htm)
 		return -1;
 
 	if (status.state == UNINITIALIZED) {
-		PR_PERL("* Skipping PAUSE trigger, HTM appears uninitialized\n");
+		PR_INFO("* Skipping PAUSE trigger, HTM appears uninitialized\n");
 		return 0;
 	}
 
-	PR_PERL("* Sending PAUSE trigger to HTM\n");
+	PR_INFO("* Sending PAUSE trigger to HTM\n");
 	if (HTM_ERR(pib_write(&htm->target, HTM_SCOM_TRIGGER, HTM_TRIG_PAUSE)))
 		return -1;
 
@@ -879,7 +875,7 @@ static int do_htm_dump(struct htm *htm, uint64_t size, const char *basename)
 		return -1;
 
 	if (status.state != COMPLETE) {
-		PR_PERL("* Skipping DUMP tigger, HTM is not in complete state\n");
+		PR_INFO("* Skipping DUMP tigger, HTM is not in complete state\n");
 		return -1;
 	}
 
diff --git a/libpdbg/operations.h b/libpdbg/operations.h
index d6c947f..cb3a57c 100644
--- a/libpdbg/operations.h
+++ b/libpdbg/operations.h
@@ -18,13 +18,14 @@
 
 #include "bitutils.h"
 #include "target.h"
+#include "debug.h"
 
 /* Error codes */
 #define EFSI 1
 
 #define CHECK_ERR(x) do {					\
 	if (x) {	       					\
-		PR_DEBUG("%s: %d\n", __FUNCTION__, __LINE__);	\
+		PR_DEBUG("failed\n");				\
 		return x;					\
 	}							\
 	} while(0)
diff --git a/libpdbg/target.h b/libpdbg/target.h
index a33e089..405da5e 100644
--- a/libpdbg/target.h
+++ b/libpdbg/target.h
@@ -24,13 +24,6 @@
 #include "device.h"
 #include "libpdbg.h"
 
-#define PR_DEBUG(x, args...) \
-	fprintf(stderr, x, ##args)
-#define PR_INFO(x, args...) \
-	fprintf(stderr, x, ##args)
-#define PR_ERROR(x, args...) \
-	fprintf(stderr, "%s: " x, __FUNCTION__, ##args)
-
 enum chip_type {CHIP_UNKNOWN, CHIP_P8, CHIP_P8NV, CHIP_P9};
 
 struct pdbg_target_class {
-- 
2.17.0



More information about the Pdbg mailing list