Skip to contentSkip to conversation

mpc8xxx: improve LAW error messages when setting up DDR

PATCH New Paul Gortmaker 3 participants 5 messages Oct 6, 2009 – Oct 8, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpc8xxx: improve LAW error messages when setting up DDR

When setting up the LAWs for the DDR, if there was an error, you got the not-so-helpful error text "ERROR" and nothing else. Not only is it non-informative, but it is also pretty frustrating trying to grep for "ERROR" in the source.

---
 cpu/mpc8xxx/ddr/util.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
cpu/mpc8xxx/ddr/util.c +3 -3
index 4451989..d0f61a8 100644
@@ -89,16 +89,16 @@ __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params,
 			? LAW_TRGT_IF_DDR_INTRLV : LAW_TRGT_IF_DDR_1;
 
 		if (set_ddr_laws(base, size, lawbar1_target_id) < 0) {
-			printf("ERROR\n");
+			printf("set_lawbar: ERROR (%d)\n", memctl_interleaved);
 			return ;
 		}
 	} else if (ctrl_num == 1) {
 		if (set_ddr_laws(base, size, LAW_TRGT_IF_DDR_2) < 0) {
-			printf("ERROR\n");
+			printf("set_lawbar: ERROR (ctrl #2)\n");
 			return ;
 		}
 	} else {
-		printf("unexpected controller number %u in %s\n",
+		printf("set_lawbar: unexpected controller number %u in %s\n",
 			ctrl_num, __FUNCTION__);
 	}
 }
Signature · 1 line
1.6.5.rc1
#1 lore raw

PATCH 1/1 mpc8xxx: improve LAW error messages when setting up DDR

Hi Paul,

Quoted 6 lines
cpu/mpc8xxx/ddr/util.c +0 -0
index 4451989..d0f61a8 100644
@@ -89,16 +89,16 @@ __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params,
 			? LAW_TRGT_IF_DDR_INTRLV : LAW_TRGT_IF_DDR_1;

cpu/mpc8xxx/ddr/util.c __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params, · line 97

Quoted 10 lines
cpu/mpc8xxx/ddr/util.c +2 -2
 
 		if (set_ddr_laws(base, size, lawbar1_target_id) < 0) {
-			printf("ERROR\n");
+			printf("set_lawbar: ERROR (%d)\n", memctl_interleaved);
 			return ;
 		}
 	} else if (ctrl_num == 1) {
 		if (set_ddr_laws(base, size, LAW_TRGT_IF_DDR_2) < 0) {
-			printf("ERROR\n");
+			printf("set_lawbar: ERROR (ctrl #2)\n");

This error would print out #2 for the 2nd controller...

cpu/mpc8xxx/ddr/util.c __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params, · line 102

Quoted 6 lines
cpu/mpc8xxx/ddr/util.c +1 -1
 			return ;
 		}
 	} else {
-		printf("unexpected controller number %u in %s\n",
+		printf("set_lawbar: unexpected controller number %u in %s\n",
 			ctrl_num, __FUNCTION__);

But this error would print out 2 for the 3rd controller. Either convention is going to be confusing, but it'd be nice if they were at least consistent.

__func__ is preferred over __FUNCTION__, maybe you could update it also?

Wouldn't this message look at bit funny with the title being "set_lawbar:" but then also including the full "__fsl_ddr_set_lawbar" in the same message? And neither of the other errors include the printing of __func__? Hopefully I'll never see the errors, so proceed as you see fit:)

Best,
Peter

#2 lore raw

PATCH 1/1 mpc8xxx: improve LAW error messages when setting up DDR

Quoted 9 lines · Peter Tyser

Hi Paul,

Quoted 7 lines
cpu/mpc8xxx/ddr/util.c +0 -0
index 4451989..d0f61a8 100644
@@ -89,16 +89,16 @@ __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params,
 			? LAW_TRGT_IF_DDR_INTRLV : LAW_TRGT_IF_DDR_1;
 
Quoted 11 lines

cpu/mpc8xxx/ddr/util.c __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params, · line 97

Quoted 9 lines
cpu/mpc8xxx/ddr/util.c +2 -2
 		if (set_ddr_laws(base, size, lawbar1_target_id) < 0) {
-			printf("ERROR\n");
+			printf("set_lawbar: ERROR (%d)\n", memctl_interleaved);
 			return ;
 		}
 	} else if (ctrl_num == 1) {
 		if (set_ddr_laws(base, size, LAW_TRGT_IF_DDR_2) < 0) {
-			printf("ERROR\n");
+			printf("set_lawbar: ERROR (ctrl #2)\n");

This error would print out #2 for the 2nd controller...

I was thinking 1 based counting for the messages presented to the end user instead of the internal zero based, but...

Quoted 9 lines

cpu/mpc8xxx/ddr/util.c __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params, · line 102

Quoted 7 lines
cpu/mpc8xxx/ddr/util.c +1 -1
 			return ;
 		}
 	} else {
-		printf("unexpected controller number %u in %s\n",
+		printf("set_lawbar: unexpected controller number %u in %s\n",
 			ctrl_num, __FUNCTION__);

But this error would print out 2 for the 3rd controller. Either

...as you point out, it then is inconsistent. I'll fix that.

Quoted 10 lines

convention is going to be confusing, but it'd be nice if they were at least consistent.

__func__ is preferred over __FUNCTION__, maybe you could update it also?

Wouldn't this message look at bit funny with the title being "set_lawbar:" but then also including the full "__fsl_ddr_set_lawbar" in the same message? And neither of the other errors include the printing of __func__? Hopefully I'll never see the errors, so proceed as you see fit:)

I never got to see this last one either, just the "ERROR" ones, fortunately (?) but you make a good point - while in there, they might as well all be standardized on func. I'll do that too.

Thanks,
Paul.

Quoted 4 lines

Best,
Peter

#3 lore raw

PATCH v2 1/1 mpc8xxx: improve LAW error messages when setting up DDR

When setting up the LAWs for the DDR, if there was an error, you got the not-so-helpful error text "ERROR" and nothing else. Not only is it non-informative, but it is also pretty frustrating trying to grep for "ERROR" in the source.

---

v2: sync ctrl #'s; use __func__ as per Peter's comments.

 cpu/mpc8xxx/ddr/util.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
cpu/mpc8xxx/ddr/util.c +5 -4
index 4451989..1e2d921 100644
@@ -89,17 +89,18 @@ __fsl_ddr_set_lawbar(const common_timing_params_t *memctl_common_params,
 			? LAW_TRGT_IF_DDR_INTRLV : LAW_TRGT_IF_DDR_1;
 
 		if (set_ddr_laws(base, size, lawbar1_target_id) < 0) {
-			printf("ERROR\n");
+			printf("%s: ERROR (ctrl #0, intrlv=%d)\n", __func__,
+				memctl_interleaved);
 			return ;
 		}
 	} else if (ctrl_num == 1) {
 		if (set_ddr_laws(base, size, LAW_TRGT_IF_DDR_2) < 0) {
-			printf("ERROR\n");
+			printf("%s: ERROR (ctrl #1)\n", __func__);
 			return ;
 		}
 	} else {
-		printf("unexpected controller number %u in %s\n",
-			ctrl_num, __FUNCTION__);
+		printf("%s: unexpected DDR controller number (%u)\n", __func__,
+			ctrl_num);
 	}
 }
 
Signature · 1 line
1.6.5.rc1
Applied
#4 lore raw

PATCH v2 1/1 mpc8xxx: improve LAW error messages when setting up DDR

Quoted 5 lines · Paul Gortmaker

When setting up the LAWs for the DDR, if there was an error, you got the not-so-helpful error text "ERROR" and nothing else. Not only is it non-informative, but it is also pretty frustrating trying to grep for "ERROR" in the source.

Quoted 7 lines

---

v2: sync ctrl #'s; use __func__ as per Peter's comments.

cpu/mpc8xxx/ddr/util.c | 9 +++++----

1 files changed, 5 insertions(+), 4 deletions(-)

applied to 85xx

-k