From patchwork Wed Nov 8 08:59:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 835725 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3yX0fz5bpLz9sBd for ; Wed, 8 Nov 2017 20:02:19 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Nx9mgm77"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3yX0fz3n7kzDrK1 for ; Wed, 8 Nov 2017 20:02:19 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Nx9mgm77"; dkim-atps=neutral X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c01::241; helo=mail-pl0-x241.google.com; envelope-from=oohall@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Nx9mgm77"; dkim-atps=neutral Received: from mail-pl0-x241.google.com (mail-pl0-x241.google.com [IPv6:2607:f8b0:400e:c01::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3yX0c60mvWzDrCX for ; Wed, 8 Nov 2017 19:59:49 +1100 (AEDT) Received: by mail-pl0-x241.google.com with SMTP id f2so885145plj.6 for ; Wed, 08 Nov 2017 00:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rpD8OoArCugtK+vwbwsNWLu0nRQfnOo9udbVwrR8Ew8=; b=Nx9mgm779V/YvzhWEoDJ1alKuEaOlgp6sGW7k3cCJVwXUVy8ukbFsqMZ5Lo7hVBur8 bqansZx67t2V01MlF9U5tGcCD04ZHAH2LBNbo2Bz3SNVRQExftBGpRvXjzsURjaJ2f34 r1eWo7v7Su+Pik1JLkLKpA1xnGQaIz1EDj7h5obL3YXr7O7jCyvzHBWOe/pJtstz7U6S sPcpx8TVfsyWOxKz9NhAE6xDhYk8mIImMBlwtw3lAKg1plKrQikyVqb7BZqLLtlVnjxO NHbyqCFq4dqm08yPGBimfuo31w8h2T1LDhn7wJGsIKTuf2qToRLKlsxrWadVd3ZrDkjk OCqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rpD8OoArCugtK+vwbwsNWLu0nRQfnOo9udbVwrR8Ew8=; b=jmKVItaGdT5ZXmdZanTnmqwMQ/bvaDeRvJX0Hi8huAkMpcZI7bnnDXjzwNrMS/JvJ5 reUV7lBRQDTCNrZ3aFD/ihg1zZBQH2GVqZ2w6aEiA1vCGzxPf/k4YfYpu28aoWXYA+iv 9KRGMlMsRKMtr4zvIzIv7EkC2T8SCx3a48EoC+TSEDy40RnnZXWfw0FkiBE6mns61IrD /yK5N8qdjL1AOyrv9yI7wefuFh+D+E+fP2P0HaxEPMVk4ES+tFa4j4xFk5dKuWc7cR8q x231TaQD3k3nOSUcdz5fQuAM7ugWVm7suklo38O+/xHZIVqGNSMJPdJfJXcCZfnoMm3C q8xw== X-Gm-Message-State: AJaThX7QSFhOyuZyI4qoDxILpmF1WQQm01Vetn/Al/3DyRRem0oHXnZ/ tc4lJLHqpgGHx1wozNkKfi945g== X-Google-Smtp-Source: ABhQp+TE18mj9IqzxdE9zQt7Bqv+Yt2rJt1uhzKgKkcwYpo4B6MgdJc9hRx+kP65QdKX++HPaxvHdA== X-Received: by 10.84.201.6 with SMTP id u6mr1542220pld.28.1510131587384; Wed, 08 Nov 2017 00:59:47 -0800 (PST) Received: from flat-canetoad.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id 24sm7005210pfk.9.2017.11.08.00.59.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Nov 2017 00:59:46 -0800 (PST) From: Oliver O'Halloran To: skiboot@lists.ozlabs.org Date: Wed, 8 Nov 2017 19:59:12 +1100 Message-Id: <20171108085918.12590-8-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171108085918.12590-1-oohall@gmail.com> References: <20171108085918.12590-1-oohall@gmail.com> Subject: [Skiboot] [PATCH 07/13] gard: {list, show}: Fix the Type field in the output X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.24 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" 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 --- 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