From patchwork Mon Jun 2 12:35:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 31282 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3E2F120AE6 for ; Mon, 2 Jun 2014 12:36:24 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id wo20sf25918054obc.7 for ; Mon, 02 Jun 2014 05:36:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=P1qAEb5EYj1Q37aai4te4yUUqDa9OFYWWPH7+w2EQhs=; b=KB0C4AUvuVk0KCgGSCEqjA5qjzx/gimAFYfQ0ufm3L50tBOoI7q8J8rYKzaX0fvLhu 9jLXHWynfoMwAMLj5a6Nb3OO/lkbWoJuPDWcCelnqfH1t2+zOESX2ohYyP7/Hgo6eGNL IM9NWUd83Whobb7f2Ujj4GYGFnDSbWyBGeQuQfZX/A7PvIcxIh21l1balwkpXSgzlP37 Odkhf/rywdg7OomEo0f8KYnB/5U20CAe1eaSS99jTnoWkswPxFboU8Ep3bltWXn42xuw dPyagMC0bExSqGMk4/Sof9vQ/e47qXvig3bCLhlOQcEve530L7n6W2oxzAxqUFSv9/MH IP1g== X-Gm-Message-State: ALoCoQnazgd6oLXjseDtmDy0VhLZGBLp3VriBDg58UfI/9qBwJHck5+KzetvCndTnWP6ndaGPymK X-Received: by 10.182.197.172 with SMTP id iv12mr13397659obc.1.1401712583684; Mon, 02 Jun 2014 05:36:23 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.131 with SMTP id d3ls1989655qge.52.gmail; Mon, 02 Jun 2014 05:36:23 -0700 (PDT) X-Received: by 10.58.47.36 with SMTP id a4mr173452ven.63.1401712583541; Mon, 02 Jun 2014 05:36:23 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id xy4si7781835vcb.35.2014.06.02.05.36.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 02 Jun 2014 05:36:23 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id hq11so2998478vcb.39 for ; Mon, 02 Jun 2014 05:36:23 -0700 (PDT) X-Received: by 10.220.249.6 with SMTP id mi6mr2844236vcb.33.1401712583414; Mon, 02 Jun 2014 05:36:23 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp94346vcb; Mon, 2 Jun 2014 05:36:22 -0700 (PDT) X-Received: by 10.66.122.70 with SMTP id lq6mr40163969pab.51.1401712582560; Mon, 02 Jun 2014 05:36:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ym9si15860323pab.72.2014.06.02.05.36.21; Mon, 02 Jun 2014 05:36:21 -0700 (PDT) Received-SPF: none (google.com: linux-samsung-soc-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751877AbaFBMgH (ORCPT + 7 others); Mon, 2 Jun 2014 08:36:07 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:44542 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754292AbaFBMgA (ORCPT ); Mon, 2 Jun 2014 08:36:00 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N6J004SSKBZFOA0@mailout3.samsung.com>; Mon, 02 Jun 2014 21:35:59 +0900 (KST) X-AuditID: cbfee61a-b7fef6d00000200b-28-538c6fae5fc9 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id A1.B7.08203.EAF6C835; Mon, 02 Jun 2014 21:35:59 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N6J007MFKBF0910@mmp2.samsung.com>; Mon, 02 Jun 2014 21:35:58 +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 v2 1/7] arm: firmware: Check firmware is running or not Date: Mon, 02 Jun 2014 14:35:37 +0200 Message-id: <1401712543-14281-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1401712543-14281-1-git-send-email-b.zolnierkie@samsung.com> References: <1401712543-14281-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrKLMWRmVeSWpSXmKPExsVy+t9jQd31+T3BBu9usllsnLGe1WLeZ1mL 3gVX2SzONr1ht3h/6BmzxabH11gtLu+aw2bxufcIo8WM8/uYLM6cvsRqcfJPL6PF+hmvWSw2 fvVw4PW4c20Pm8fmJfUet/89ZvbYcrWdxaNvyypGj8+b5ALYorhsUlJzMstSi/TtErgy1sxY zFTQxVPx7NZVpgbGe5xdjJwcEgImEm+fzWWEsMUkLtxbz9bFyMUhJDCdUWLlxLcsEE4Xk8S6 TQ/ZQKrYBKwkJravAusQEVCT6Fm8lRGkiFlgL7PE0u5N7CAJYQF3iRmbH4E1sAioSiy9cxus gVfAQ+LXlzOsEOsUJbqfTQCr4RTwlFh57yFYXAioZt+rXUwTGHkXMDKsYhRNLUguKE5KzzXU K07MLS7NS9dLzs/dxAgOzGdSOxhXNlgcYhTgYFTi4f2p3hMsxJpYVlyZe4hRgoNZSYR3qQVQ iDclsbIqtSg/vqg0J7X4EKM0B4uSOO+BVutAIYH0xJLU7NTUgtQimCwTB6dUA2NscmVIbfbk ZX73NwkXv7xrk+N3c8fuGXuYshrO3tyxIuSPR3Gas4h+9cyFhdPiJsXsE58vf/ksx1/35VGl z5vOzkzO3TrtNc+TpFsHFA6zqckZOnJwlLvPvxI37ze74AS7pvdryuRvbnrfsd5jAuOOIw9S 0/wmbTX4Yy/hknkg7nCRwKvZvUpKLMUZiYZazEXFiQCYqGpXSAIAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: b.zolnierkie@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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, ...) *