From patchwork Fri Mar 24 00:31:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cyril Bur X-Patchwork-Id: 742999 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 3vq4Fz0x76z9s7K for ; Fri, 24 Mar 2017 11:35:35 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3vq4Fy6m1szDqZq for ; Fri, 24 Mar 2017 11:35:34 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3vq4Fq5PfqzDq7c for ; Fri, 24 Mar 2017 11:35:27 +1100 (AEDT) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v2O0STeN040247 for ; Thu, 23 Mar 2017 20:35:19 -0400 Received: from e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141]) by mx0a-001b2d01.pphosted.com with ESMTP id 29cr4aa2r2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 23 Mar 2017 20:35:19 -0400 Received: from localhost by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 24 Mar 2017 10:35:16 +1000 Received: from d23relay06.au.ibm.com (202.81.31.225) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 24 Mar 2017 10:35:16 +1000 Received: from d23av05.au.ibm.com (d23av05.au.ibm.com [9.190.234.119]) by d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v2O0Z73735848270 for ; Fri, 24 Mar 2017 11:35:15 +1100 Received: from d23av05.au.ibm.com (localhost [127.0.0.1]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v2O0Yhta018264 for ; Fri, 24 Mar 2017 11:34:43 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av05.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v2O0YhCh018090; Fri, 24 Mar 2017 11:34:43 +1100 Received: from camb691.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id AEB1CA01BF; Fri, 24 Mar 2017 11:34:18 +1100 (AEDT) From: Cyril Bur To: skiboot@lists.ozlabs.org Date: Fri, 24 Mar 2017 11:31:52 +1100 X-Mailer: git-send-email 2.12.1 X-TM-AS-MML: disable x-cbid: 17032400-0048-0000-0000-00000216AD2A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17032400-0049-0000-0000-000047C25B92 Message-Id: <20170324003152.13543-1-cyril.bur@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-23_22:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703240003 Subject: [Skiboot] [PATCH] external/gard: Print an error if run on an FSP system X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: ppaidipe@in.ibm.com, sam@mendozajonas.com, dja@axtens.net MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Signed-off-by: Cyril Bur --- external/gard/gard.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/external/gard/gard.c b/external/gard/gard.c index 4b26a3b8..1b3775c3 100644 --- a/external/gard/gard.c +++ b/external/gard/gard.c @@ -43,7 +43,9 @@ #define CLEARED_RECORD_ID 0xFFFFFFFF -#define FDT_ACTIVE_FLASH_PATH "/proc/device-tree/chosen/ibm,system-flash" +#define FDT_PATH "/proc/device-tree" +#define FDT_FSP_NODE FDT_PATH"/fsps" +#define FDT_ACTIVE_FLASH_PATH FDT_PATH"/chosen/ibm,system-flash" #define SYSFS_MTD_PATH "/sys/class/mtd/" #define FLASH_GARD_PART "GUARD" @@ -563,6 +565,11 @@ static void usage(const char *progname) } } +static bool is_fsp(void) +{ + return access(FDT_FSP_NODE, F_OK) == 0; +} + static struct option global_options[] = { { "file", required_argument, 0, 'f' }, { "part", no_argument, 0, 'p' }, @@ -586,6 +593,12 @@ int main(int argc, char **argv) ctx = &_ctx; memset(ctx, 0, sizeof(*ctx)); + if (is_fsp()) { + fprintf(stderr, "ERROR: This tool is not compatible with FSP systems\n\n"); + usage(progname); + return EXIT_FAILURE; + } + /* process global options */ for (;;) { int c;