[Skiboot] [PATCH 03/13] gard: Add P9 support

Oliver O'Halloran oohall at gmail.com
Wed Nov 8 19:59:08 AEDT 2017


Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 external/gard/gard.c                        |  24 ++++++++++++++++++++++--
 external/gard/test/files/data-p9.bin        | Bin 0 -> 20480 bytes
 external/gard/test/results/02-usage.err     |   4 ++++
 external/gard/test/results/03-show_1-p9.err |   0
 external/gard/test/results/03-show_1-p9.out |  10 ++++++++++
 external/gard/test/tests/03-show_1-p9       |  10 ++++++++++
 6 files changed, 46 insertions(+), 2 deletions(-)
 create mode 100644 external/gard/test/files/data-p9.bin
 create mode 100644 external/gard/test/results/03-show_1-p9.err
 create mode 100644 external/gard/test/results/03-show_1-p9.out
 create mode 100644 external/gard/test/tests/03-show_1-p9

diff --git a/external/gard/gard.c b/external/gard/gard.c
index 5d4e382b2752..9505293d745c 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -526,6 +526,8 @@ static void usage(const char *progname)
 	print_version();
 	fprintf(stderr, "Usage: %s [-a -e -f <file> -p] <command> [<args>]\n\n",
 			progname);
+	fprintf(stderr, "-8 --p8\n");
+	fprintf(stderr, "-9 --p9\n\tSet the processor generation\n\n");
 	fprintf(stderr, "-e --ecc\n\tForce reading/writing with ECC bytes.\n\n");
 	fprintf(stderr, "-f --file <file>\n\tDon't search for MTD device,"
 	                " read from <file>.\n\n");
@@ -552,9 +554,11 @@ static struct option global_options[] = {
 	{ "file", required_argument, 0, 'f' },
 	{ "part", no_argument, 0, 'p' },
 	{ "ecc", no_argument, 0, 'e' },
+	{ "p8", no_argument, 0, '8' },
+	{ "p9", no_argument, 0, '9' },
 	{ 0 },
 };
-static const char *global_optstring = "+ef:p";
+static const char *global_optstring = "+ef:p89";
 
 int main(int argc, char **argv)
 {
@@ -570,7 +574,6 @@ int main(int argc, char **argv)
 
 	ctx = &_ctx;
 	memset(ctx, 0, sizeof(*ctx));
-	set_chip_gen(p8_chip_units);
 
 	if (is_fsp()) {
 		fprintf(stderr, "This is the OpenPower gard tool which does "
@@ -603,6 +606,12 @@ int main(int argc, char **argv)
 		case 'p':
 			part = true;
 			break;
+		case '8':
+			set_chip_gen(p8_chip_units);
+			break;
+		case '9':
+			set_chip_gen(p9_chip_units);
+			break;
 		case '?':
 			usage(progname);
 			rc = EXIT_FAILURE;
@@ -610,6 +619,8 @@ int main(int argc, char **argv)
 		}
 	}
 
+
+
 	/*
 	 * It doesn't make sense to specify that we have the gard partition but
 	 * read from flash
@@ -630,6 +641,15 @@ int main(int argc, char **argv)
 	argv += optind;
 	action = argv[0];
 
+	/* assume a P8 if we haven't been given any */
+	if (!chip_units) {
+#ifdef ASSUME_P9
+		set_chip_gen(p9_chip_units);
+#else
+		set_chip_gen(p8_chip_units);
+#endif
+	}
+
 	if (arch_flash_init(&(ctx->bl), filename, true)) {
 		/* Can fail for a few ways, most likely couldn't open MTD device */
 		fprintf(stderr, "Can't open %s\n", filename ? filename : "MTD Device. Are you root?");
diff --git a/external/gard/test/files/data-p9.bin b/external/gard/test/files/data-p9.bin
new file mode 100644
index 0000000000000000000000000000000000000000..f2141657ab0ba6c2a0ff5320618aa050b7bb149b
GIT binary patch
literal 20480
zcmeIy!3l&g6h+Y&K`lfq(;j9qh1ipYe8U7R!0ntYM6$fRlO%0#nU>7i+L9c3PE~!9
z^}K3aef!1l#7~t7eFY+jFdhR-umnq>fC36Apnw7jD4>7>3Mim}0tzUgfC36Apnw7j
zD4>7>3Mim}0tzUgfC36Apnw7jD4>7>3Mim}0tzUgfC36Apnw7jD4>7>3Mim}0tzU2
TtzeADR{;eSP(T3%{-MAPIkB7P

literal 0
HcmV?d00001

diff --git a/external/gard/test/results/02-usage.err b/external/gard/test/results/02-usage.err
index cfc9b4cd0f60..ba3dc683a796 100644
--- a/external/gard/test/results/02-usage.err
+++ b/external/gard/test/results/02-usage.err
@@ -1,5 +1,9 @@
 Usage: ./gard [-a -e -f <file> -p] <command> [<args>]
 
+-8 --p8
+-9 --p9
+	Set the processor generation
+
 -e --ecc
 	Force reading/writing with ECC bytes.
 
diff --git a/external/gard/test/results/03-show_1-p9.err b/external/gard/test/results/03-show_1-p9.err
new file mode 100644
index 000000000000..e69de29bb2d1
diff --git a/external/gard/test/results/03-show_1-p9.out b/external/gard/test/results/03-show_1-p9.out
new file mode 100644
index 000000000000..bdcf41868562
--- /dev/null
+++ b/external/gard/test/results/03-show_1-p9.out
@@ -0,0 +1,10 @@
+Record ID:    0x00000001
+========================
+Error ID:     0x90000007
+Error Type:         0xe3
+Path Type: physical
+>Sys, Instance #0
+ >Node, Instance #0
+  >Proc, Instance #0
+   >EQ, Instance #1
+    >EX, Instance #0
diff --git a/external/gard/test/tests/03-show_1-p9 b/external/gard/test/tests/03-show_1-p9
new file mode 100644
index 000000000000..c9b06d158a5d
--- /dev/null
+++ b/external/gard/test/tests/03-show_1-p9
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+run_binary "./gard" "-p -e -f test/files/data-p9.bin --p9 show 1"
+if [ "$?" -ne 0 ] ; then
+	fail_test
+fi
+
+diff_with_result
+
+pass_test
-- 
2.9.5



More information about the Skiboot mailing list