From patchwork Mon May 5 10:57:13 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 4113751 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9438D9F271 for ; Mon, 5 May 2014 11:01:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 98CB220398 for ; Mon, 5 May 2014 11:01:52 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A55032037A for ; Mon, 5 May 2014 11:01:51 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WhGc6-0003q3-8W; Mon, 05 May 2014 10:59:14 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WhGc3-0003kb-Dr for linux-arm-kernel@lists.infradead.org; Mon, 05 May 2014 10:59:12 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5300L9WL61K000@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Mon, 05 May 2014 19:58:49 +0900 (KST) X-AuditID: cbfee61a-b7f2b6d000006c4d-a1-53676ee8b980 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 30.6D.27725.8EE67635; Mon, 05 May 2014 19:58:49 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N5300CW5L3PC1B0@mmp1.samsung.com>; Mon, 05 May 2014 19:58:48 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Kukjin Kim Subject: [PATCH 1/7] arm: firmware: Check firmware is running or not Date: Mon, 05 May 2014 12:57:13 +0200 Message-id: <1399287439-31376-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1399287439-31376-1-git-send-email-b.zolnierkie@samsung.com> References: <1399287439-31376-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKLMWRmVeSWpSXmKPExsVy+t9jAd2XeenBBh37mS02zljPajHvs6xF 74KrbBZnm96wW7w/9IzZYtPja6wWl3fNYbP43HuE0WLG+X1MFmdOX2K1OPmnl9Fi/YzXLBYb v3o48HrcubaHzWPzknqP2/8eM3tsudrO4tG3ZRWjx+dNcgFsUVw2Kak5mWWpRfp2CVwZa2Ys Ziro4ql4dusqUwPjPc4uRk4OCQETiRtNyxkhbDGJC/fWs3UxcnEICSxilJhzbCELhNPFJHHk yHV2kCo2ASuJie2rwDpEBNQkehZvZQQpYhbYyyyxtHsTWJGwgItE7825YEUsAqoSz9tnsYLY vAIeEp86TrBBrFOU6H42AczmFPCUWLr5MTOILQRUs+FtO9sERt4FjAyrGEVTC5ILipPScw31 ihNzi0vz0vWS83M3MYID85nUDsaVDRaHGAU4GJV4eBOY04OFWBPLiitzDzFKcDArifBmJwKF eFMSK6tSi/Lji0pzUosPMUpzsCiJ8x5otQ4UEkhPLEnNTk0tSC2CyTJxcEo1MEr8+XRR4BWT tAD7sY1vJql8vr1XND3kgcaPbbJ83p9X954731Jx61v9qdAut6/7LSPOu7yZWXey79BxtfY/ TToBt0qeF7yRW/nH58e/W6W5nhVivhNm8nilKZbJWdk+efz+PZ9TlPetA4zpTT//v96WOpnn /TH73pL2jEmufUbX1xVFHe5e9FqJpTgj0VCLuag4EQDu36U5SAIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140505_035911_636511_1D756477 X-CRM114-Status: GOOD ( 10.08 ) X-Spam-Score: -5.7 (-----) Cc: linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, Sachin Kamat , Viresh Kumar , Tomasz Figa , Daniel Lezcano , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Kyungmin Park , linaro-kernel@lists.linaro.org, linux-arm-kernel@lists.infradead.org, b.zolnierkie@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kyungmin Park To support multi-platform, it needs to know it's running under secure OS or not. Sometimes it needs to access physical address by SMC calls. e.g., if (firmware_run()) { addr = physical address; } else { addr = virtual address; } call_firmware_ops(read_address, addr, &value); Signed-off-by: Kyungmin Park Signed-off-by: Bartlomiej Zolnierkiewicz --- arch/arm/common/firmware.c | 5 +++++ arch/arm/include/asm/firmware.h | 3 +++ 2 files changed, 8 insertions(+) diff --git a/arch/arm/common/firmware.c b/arch/arm/common/firmware.c index 27ddccb..e9d9ee5 100644 --- a/arch/arm/common/firmware.c +++ b/arch/arm/common/firmware.c @@ -16,3 +16,8 @@ static const struct firmware_ops default_firmware_ops; const struct firmware_ops *firmware_ops = &default_firmware_ops; + +int firmware_run(void) +{ + return firmware_ops != &default_firmware_ops; +} diff --git a/arch/arm/include/asm/firmware.h b/arch/arm/include/asm/firmware.h index 2c9f10d..c72ec47 100644 --- a/arch/arm/include/asm/firmware.h +++ b/arch/arm/include/asm/firmware.h @@ -46,6 +46,9 @@ struct firmware_ops { /* Global pointer for current firmware_ops structure, can't be NULL. */ extern const struct firmware_ops *firmware_ops; +/* Check firmware is running */ +extern int firmware_run(void); + /* * call_firmware_op(op, ...) *