From patchwork Thu Aug 20 15:11:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rayagonda Kokatanur X-Patchwork-Id: 1348444 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=broadcom.com header.i=@broadcom.com header.a=rsa-sha256 header.s=google header.b=XxC4xHt3; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BXSmm0t4tz9sV4 for ; Fri, 21 Aug 2020 01:12:07 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 64B0D82369; Thu, 20 Aug 2020 17:11:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=broadcom.com header.i=@broadcom.com header.b="XxC4xHt3"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 40C4382381; Thu, 20 Aug 2020 17:11:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9805982369 for ; Thu, 20 Aug 2020 17:11:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=rayagonda.kokatanur@broadcom.com Received: by mail-pl1-x644.google.com with SMTP id g15so1171850plj.6 for ; Thu, 20 Aug 2020 08:11:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z/LZQKevZocktxM9VqrcTYJABI8SfVMocgGeW8kr7FE=; b=XxC4xHt3kYllsOraEpqsvMRAj4/jV1a2PvV3sD1rZK3DoR9ZjjjJh6bsUIEWDyVKnn 1fclyzWD5jHMfi0GTGFap95omGXK1LrPIVER+SZo3X0YCqUgC29yjKTorFEFaeL/8BuY RS3+yN0aKmni1ia0zWRAMNLalNsWX8OEK/s1Q= 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=Z/LZQKevZocktxM9VqrcTYJABI8SfVMocgGeW8kr7FE=; b=CaUvw77tOm1hg/dnPPdtlVP24ALyRLICKlSo5lVmeLJxswQX7ZUnhUnowlRxbeaVNL +MBScmx2nAE/It+ame0jt61zMIny99QI6/Rx4p9HzroHsHp+ShffZ4wg1O0pHqXPP2rq xR5c8WNfBhMemBWFmXf82F7XySbdyGBHbKPjcyQtBiKKB15qlbUojZMHtX7Iw1P/itFq VYXV/4A3LDvsGWFeMsvZn5YqP1nNtoenHGr/3K7V03i18vRBRsxTGMlBhZ8ubIKdlcVO NKm/z8H/ms5UuuceS4iPqgxF0IFrbBbHwmgr3Xo3NqgwnRiZIiJd0ykazLMSF6iMGBJF BlVA== X-Gm-Message-State: AOAM531JnuFNNm1Iot6YfXv+AqlyPAm+1F9MrLOFBzHlwkEitQo08WVX Lxcmj1NT6MfpHvP0u7kMd4pAAqD//nQitAGXXVoTA0S12DLRsV2Dd1AxetxWUwBohlRs0F+/B1U Lsl6Wx0t51O9K2HVNXLuSCdQdZVpsV1K1/1+FDd2DNLI5axO2zw6Hm+sJWGGDYaYN7tV5c0WEom RAB0QBdMgl X-Google-Smtp-Source: ABdhPJyGabPRTUj1yS8vot3I8kLHLT250rwm5qmJOcGRaeP/NiC7qNsLTE646bc7MmyZEbcY4WOZ2A== X-Received: by 2002:a17:90a:e64b:: with SMTP id ep11mr2911920pjb.86.1597936297262; Thu, 20 Aug 2020 08:11:37 -0700 (PDT) Received: from rayagonda.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id e23sm2861014pgb.79.2020.08.20.08.11.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2020 08:11:36 -0700 (PDT) From: Rayagonda Kokatanur To: u-boot@lists.denx.de, Simon Glass , Tom Rini , Bharat Gooty , Vladimir Olovyannikov Cc: Rayagonda Kokatanur Subject: [PATCH v2 3/5] cmd: broadcom: add command for chimp handshake Date: Thu, 20 Aug 2020 20:41:06 +0530 Message-Id: <20200820151108.5503-4-rayagonda.kokatanur@broadcom.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200820151108.5503-1-rayagonda.kokatanur@broadcom.com> References: <20200820151108.5503-1-rayagonda.kokatanur@broadcom.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean From: Bharat Kumar Reddy Gooty Add command for chimp handshake. Handshake is used to know chimp is loaded and booted successfully. Signed-off-by: Bharat Kumar Reddy Gooty Signed-off-by: Rayagonda Kokatanur Reviewed-by: Simon Glass --- Changes from V1: -Address review comments from Simon, Rearrange header files. Remove use of typedef. Command description correction. cmd/broadcom/Makefile | 1 + cmd/broadcom/chimp_handshake.c | 33 +++++++++++++++++++++++++++++++++ include/broadcom/chimp.h | 6 ++++++ 3 files changed, 40 insertions(+) create mode 100644 cmd/broadcom/chimp_handshake.c diff --git a/cmd/broadcom/Makefile b/cmd/broadcom/Makefile index 6cdece1a3a..62268d98d0 100644 --- a/cmd/broadcom/Makefile +++ b/cmd/broadcom/Makefile @@ -3,3 +3,4 @@ obj-y += chimp_boot.o obj-y += nitro_image_load.o +obj-y += chimp_handshake.o diff --git a/cmd/broadcom/chimp_handshake.c b/cmd/broadcom/chimp_handshake.c new file mode 100644 index 0000000000..a90a73a6d7 --- /dev/null +++ b/cmd/broadcom/chimp_handshake.c @@ -0,0 +1,33 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2020 Broadcom + */ + +#include +#include +#include + +/* This command should be called after loading the nitro binaries */ +static int do_chimp_hs(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + int ret = CMD_RET_USAGE; + u32 hstatus; + + /* Returns 1, if handshake call is success */ + if (chimp_handshake_status_optee(0, &hstatus)) + ret = CMD_RET_SUCCESS; + + if (hstatus == CHIMP_HANDSHAKE_SUCCESS) + printf("ChiMP Handshake successful\n"); + else + printf("ERROR: ChiMP Handshake status 0x%x\n", hstatus); + + return ret; +} + +U_BOOT_CMD + (chimp_hs, 1, 1, do_chimp_hs, + "Verify the Chimp handshake", + "chimp_hs\n" +); diff --git a/include/broadcom/chimp.h b/include/broadcom/chimp.h index 73bb1c21e9..738f73eefd 100644 --- a/include/broadcom/chimp.h +++ b/include/broadcom/chimp.h @@ -15,6 +15,12 @@ */ #define BCM_CHIMP_RUNNIG_GOOD 0x8000 +enum { + CHIMP_HANDSHAKE_SUCCESS = 0, + CHIMP_HANDSHAKE_WAIT_ERROR, + CHIMP_HANDSHAKE_WAIT_TIMEOUT, +}; + /** * chimp_fastboot_optee() - api to load bnxt firmware *