From patchwork Tue Oct 22 01:45:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyungmin Park X-Patchwork-Id: 3080591 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 479749F2B8 for ; Tue, 22 Oct 2013 01:46:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5F1E620108 for ; Tue, 22 Oct 2013 01:46:39 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 03826200F4 for ; Tue, 22 Oct 2013 01:46:38 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYR3G-0007wQ-Em; Tue, 22 Oct 2013 01:46:30 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYR3D-00006n-W8; Tue, 22 Oct 2013 01:46:28 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VYR39-00006U-LS for linux-arm-kernel@lists.infradead.org; Tue, 22 Oct 2013 01:46:25 +0000 Received: from epcpsbgm2.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MV100A6CRJ2NTD0@mailout2.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 22 Oct 2013 10:45:57 +0900 (KST) X-AuditID: cbfee61b-b7fd56d000001fc6-e3-5265d8d45e00 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id F2.BF.08134.4D8D5625; Tue, 22 Oct 2013 10:45:57 +0900 (KST) Received: from july ([10.252.75.74]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MV100LN9RKJGY00@mmp2.samsung.com>; Tue, 22 Oct 2013 10:45:56 +0900 (KST) Received: by july (sSMTP sendmail emulation); Tue, 22 Oct 2013 10:45:56 +0900 Date: Tue, 22 Oct 2013 10:45:56 +0900 From: Kyungmin Park To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] arm: firmware: Check firmware is running or not Message-id: <20131022014556.GA1364@july> MIME-version: 1.0 Content-disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGLMWRmVeSWpSXmKPExsVy+t9jQd2rN1KDDF6dYrPY9Pgaq8Xty7wW a4/cZbdYP+M1iwOLR0tzD5vH5iX1Hn1bVjEGMEdx2aSk5mSWpRbp2yVwZbzd8IO9oJGr4sTm L4wNjJs5uhg5OSQETCSmPV3FDmGLSVy4t56ti5GLQ0hgOqPE6n+zoZwvjBLzfz9mAqkSEvCV uDH7F1gHi4CqxN3v08DibAJaElc+7AGLiwhoSEzpegxmMwt4SOz+1sQGYgsLOEjcWLWIFcTm BaqZ9XorM4QtKPFj8j0WiHotifU7jzNB2NISj/7OAJsjKqAiMeXkNrYJjPyzkLTMQtIyC0nL AkbmVYyiqQXJBcVJ6blGesWJucWleel6yfm5mxjBoflMegfjqgaLQ4wCHIxKPLwZVqlBQqyJ ZcWVuYcYJTiYlUR49x4BCvGmJFZWpRblxxeV5qQWH2KU5mBREuc92GodKCSQnliSmp2aWpBa BJNl4uCUamCcWSZ3dtUqj8UbfWY/uPDN+9eO3wZ/CiesqHyU72ig3NL9fO2CvaueFibc5Ttj mnNhoWpxi9yf1Pzzs5m2lggISRe6d7VOb5+6t1zf20Sr+/NRhe33NVV9JCaYbzT3V9vM9npq vc0Ri7bDx+//KfmXzcNw8mpjzpHIwO9z2CU7M2zvSakeqXmhxFKckWioxVxUnAgA4WdBiUkC AAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131021_214623_942593_0EC8747B X-CRM114-Status: UNSURE ( 9.12 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -6.9 (------) Cc: t.figa@samsung.com, linux@arm.linux.org.uk, m.szyprowski@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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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. sometime 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 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 1563130..efc4554 100644 --- a/arch/arm/include/asm/firmware.h +++ b/arch/arm/include/asm/firmware.h @@ -42,6 +42,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, ...) *