[Skiboot] [PATCH 07/13] gard: {list, show}: Fix the Type field in the output
Oliver O'Halloran
oohall at gmail.com
Wed Nov 8 19:59:12 AEDT 2017
The output of `gard list` has a field named "Type", however this
doesn't actually indicate the type of the record. Rather, it
shows the type of the path used to identify the hardware being
GARDed. This is of pretty dubious value considering the Physical
path seems to always be used when referring to GARDed hardware.
Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
external/gard/gard.c | 28 +++++++++++++++++++++++++++-
external/gard/gard.h | 20 ++++++++++++++++++++
external/gard/test/results/01-show_1.out | 2 +-
external/gard/test/results/03-show_1-p9.out | 2 +-
4 files changed, 49 insertions(+), 3 deletions(-)
diff --git a/external/gard/gard.c b/external/gard/gard.c
index bb92402fac04..e7d8fba7d71c 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -165,6 +165,30 @@ static const char *target_type_to_str(int type)
return "UNKNOWN";
}
+static const char *deconfig_reason_str(enum gard_reason reason)
+{
+ switch (reason) {
+ case GARD_NO_REASON:
+ return "None";
+ case GARD_MANUAL:
+ return "Manual";
+ case GARD_UNRECOVERABLE:
+ return "Unrecoverable";
+ case GARD_FATAL:
+ return "Fatal";
+ case GARD_PREDICTIVE:
+ return "Predictive";
+ case GARD_POWER:
+ return "Power"; // What does this even mean?
+ case GARD_HYP:
+ return "Hypervisor";
+ case GARD_RECONFIG:
+ return "Reconfig";
+ default:
+ return "Unknown";
+ }
+};
+
static const char *path_type_to_str(enum path_type t)
{
switch (t) {
@@ -320,7 +344,9 @@ static int do_show_i(struct gard_ctx *ctx, int pos, struct gard_record *gard, vo
printf("Record ID: 0x%08x\n", id);
printf("========================\n");
printf("Error ID: 0x%08x\n", be32toh(gard->errlog_eid));
- printf("Error Type: 0x%02x\n", gard->error_type);
+ printf("Error Type: %s (0x%02x)\n",
+ deconfig_reason_str(gard->error_type),
+ gard->error_type);
printf("Path Type: %s\n", path_type_to_str(gard->target_id.type_size >> PATH_TYPE_SHIFT));
count = gard->target_id.type_size & PATH_ELEMENTS_MASK;
for (i = 0; i < count && i < MAX_PATH_ELEMENTS; i++)
diff --git a/external/gard/gard.h b/external/gard/gard.h
index 9c814a797284..191cbafa1d36 100644
--- a/external/gard/gard.h
+++ b/external/gard/gard.h
@@ -20,6 +20,26 @@
#define PATH_TYPE_SHIFT 4
#define PATH_ELEMENTS_MASK (0x0F)
+/*
+ * Sourced from hostboot: src/include/usr/hwas/common/hwasCallout.H
+ */
+enum gard_reason {
+ GARD_NO_REASON = 0x0,
+ GARD_MANUAL = 0xD2,
+ GARD_UNRECOVERABLE = 0xE2,
+ GARD_FATAL = 0xE3,
+ GARD_PREDICTIVE = 0xE6,
+ GARD_POWER = 0xE9,
+ GARD_HYP = 0xEA,
+ GARD_RECONFIG = 0xEB,
+
+ /*
+ * This should only occur if the GUARD partition isn't correctly
+ * programmed with ECC bits.
+ */
+ GARD_VOID = 0xFF,
+};
+
/* see src/include/usr/targeting/common/entitypath.H */
enum path_type {
PATH_NA = 0x00,
diff --git a/external/gard/test/results/01-show_1.out b/external/gard/test/results/01-show_1.out
index e48d89b833d1..60fcea264b04 100644
--- a/external/gard/test/results/01-show_1.out
+++ b/external/gard/test/results/01-show_1.out
@@ -1,7 +1,7 @@
Record ID: 0x00000001
========================
Error ID: 0x90000015
-Error Type: 0xe6
+Error Type: Predictive (0xe6)
Path Type: physical
>Sys, Instance #0
>Node, Instance #0
diff --git a/external/gard/test/results/03-show_1-p9.out b/external/gard/test/results/03-show_1-p9.out
index bdcf41868562..c9ae5b21c6a7 100644
--- a/external/gard/test/results/03-show_1-p9.out
+++ b/external/gard/test/results/03-show_1-p9.out
@@ -1,7 +1,7 @@
Record ID: 0x00000001
========================
Error ID: 0x90000007
-Error Type: 0xe3
+Error Type: Fatal (0xe3)
Path Type: physical
>Sys, Instance #0
>Node, Instance #0
--
2.9.5
More information about the Skiboot
mailing list