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: 4113531 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E3967BFF02 for ; Mon, 5 May 2014 10:59:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1BD8620254 for ; Mon, 5 May 2014 10:59:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 22B0320384 for ; Mon, 5 May 2014 10:59:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753832AbaEEK6w (ORCPT ); Mon, 5 May 2014 06:58:52 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:58092 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753389AbaEEK6u (ORCPT ); Mon, 5 May 2014 06:58:50 -0400 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>; 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 Cc: Daniel Lezcano , Tomasz Figa , Sachin Kamat , Viresh Kumar , "Rafael J. Wysocki" , Kyungmin Park , linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linaro-kernel@lists.linaro.org, b.zolnierkie@samsung.com 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== Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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, ...) *