From patchwork Wed Oct 25 06:45:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Wojtas X-Patchwork-Id: 117021 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp509561qgn; Tue, 24 Oct 2017 23:47:08 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TiDwfA5KDIs751RC/Vl1nm3UzdDAUP6KZrXLD0GzvY40T2QhqwIipFYtaNMvZ2R8Mb/ni5 X-Received: by 10.99.4.133 with SMTP id 127mr1121772pge.72.1508914028189; Tue, 24 Oct 2017 23:47:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508914028; cv=none; d=google.com; s=arc-20160816; b=dvDJ2VpWAdk4qHynfnqYfr7jcx8zVy/Tb1Wuvn6hEszETNghv+51tnp9RPc/PTHBCb jgWkmf5InjFZIyvQQr8FrVm3Hp3sAH76k6z6KQTcac8BUQq1Vwqqpkp9s+NkN5Z6UDO9 32a97dTs+GgRkg6ZDV/sbsrpuW5N76GcQefjmPSMSbchfx9cE4/YBAgyIfrh8D4gSPlm wW5VTSrxaeyH56+QS4e+F6QJZ390jPCYhkgHrnkASg/SZeUXr7uRZkreUK+jl5bpb12N LTRSHDjqu+nrDq8a8/6rBsnlXKPRyusf2SY4WKNFWrkamw/n7dIZds2WOrFkm/2EQ9va yGQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=kjOKiqJqeI2RoJ4gwtAOdjf+S+7J8YroQwOGxANTTp4=; b=psVzfrHul4kstnpwtHq4lFEnvTly9+9KEUIhefsH1n8M4T+RgqbLcTSuG6Oa52IQHF nsUHR5/vvemz9CHTli8Y3j9V+2F1NNtBcg/RNQ4NJCoZoqpOazzUC+uZGlTcUHGLQhle ooX3LyAopk/RwzZfnjPmJvehRm/21CXtH6fvKiyoh1+VD7jVOM+vSmv4CUYOyn3pCJvy FNeb+iG4RK3rfFT1hHDzj4PF7QUWCl1P3wrdBio/dlpsBsT85O0VQUa9sTo4Fjh+9wuV RmEy5Fmw7nzEAz5CyDBpBq38xqZLg29v79xnFI1h5vSq8n4D0Q6ymIISTAaBRpgCfJzr io7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=PmT0Rlip; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id t64si1396029pgc.697.2017.10.24.23.47.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Oct 2017 23:47:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@semihalf-com.20150623.gappssmtp.com header.s=20150623 header.b=PmT0Rlip; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 23AC52034CF7A; Tue, 24 Oct 2017 23:43:12 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: None (no SPF record) identity=mailfrom; client-ip=2a00:1450:4010:c07::241; helo=mail-lf0-x241.google.com; envelope-from=mw@semihalf.com; receiver=edk2-devel@lists.01.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5B3532034C084 for ; Tue, 24 Oct 2017 23:43:09 -0700 (PDT) Received: by mail-lf0-x241.google.com with SMTP id p184so26533181lfe.12 for ; Tue, 24 Oct 2017 23:46:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=JUsg1sArW1Mn6hCTG3lQLUR7gCzjdaMFTWxOng+EYeg=; b=PmT0RlipjdpJpp6Yh9x6Ny+iWDH3CWW9tGmFNhK4omvzmxLeIxaLV4N9vWHdBla43V V/gTikgFn9EqcNuzbeUa5ZYMcyjxWyzs69XCqqCl4GNYi7fla4ioy50rxJVqEmpCEDZz pfYifrzyueMVqhW+g7aDV/bYC6sx2hSKSyGG3qH1GX3o+8bMhpD/5+L3mSkR04KZN2oI 9eKBcTiPKtnNG9HS6X1VQePJB+vPDLjT0KRlFESpop4Xa+3GMJuZGvd80D/zo/lrjtSN yZDTuJgoN1Zzx1i2NY++7XDgRrVkeOrPntBcDQcrPHWA1VTpNeCXyjpBXH2ka5UXznbt lZmQ== 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=JUsg1sArW1Mn6hCTG3lQLUR7gCzjdaMFTWxOng+EYeg=; b=t+axSSXkHr/xPnVuVtQRt8mBj9EuGbB+80xWDCSSqCnmRXaWxUcr5eSOQ7lyKUeOSA 4qF14Av4/7SY3vlH0CUB/vNZSxqA2dUHeEe/cizRzLSjktrvWrVTF908R9oLGsLURhNg scWpOJEnHwW/kEjlxLxIdW17Mic0vAdxPkRLtekJI7iXasFBewXevQdx/+j64hF84iaX CSqd/ZBMqfVHrLsecwNbEN2OXFMGBFokyTvyNhxWPN6eqtRjjnM9MRXEv0IItwyNqOEc +7/xoULZYwy5bbt/dGxunw9q4cR+hMWrcyHtcmbfH4EH6PtK/W+ubHoreNP+lqRRss3d x4eA== X-Gm-Message-State: AMCzsaW3sYiN0zX+AEgscyMZmlLtHGVPREI1pbWQ8Mon5PCf7FpstvO/ Uw4d44pZPYCTnroiR99GkuNmEUCUV0I= X-Received: by 10.25.169.4 with SMTP id s4mr6619808lfe.61.1508914012236; Tue, 24 Oct 2017 23:46:52 -0700 (PDT) Received: from gilgamesh.semihalf.com (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id r22sm513129ljr.16.2017.10.24.23.46.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 24 Oct 2017 23:46:51 -0700 (PDT) From: Marcin Wojtas To: edk2-devel@lists.01.org Date: Wed, 25 Oct 2017 08:45:29 +0200 Message-Id: <1508913930-30886-8-git-send-email-mw@semihalf.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1508913930-30886-1-git-send-email-mw@semihalf.com> References: <1508913930-30886-1-git-send-email-mw@semihalf.com> Subject: [edk2] [platforms: PATCH v2 7/8] Marvell/Armada: Armada70x0Lib: Add support for 32-bit ARM X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jinghua@marvell.com, ard.biesheuvel@linaro.org, leif.lindholm@linaro.org, nadavh@marvell.com, neta@marvell.com, kostap@marvell.com MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" From: Ard Biesheuvel Add an ARM implementation of ArmPlatformHelper.S. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel Signed-off-by: Marcin Wojtas Reviewed-by: Leif Lindholm --- Platform/Marvell/Armada/Library/Armada70x0Lib/ARM/ArmPlatformHelper.S | 77 ++++++++++++++++++++ Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.inf | 3 + 2 files changed, 80 insertions(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Platform/Marvell/Armada/Library/Armada70x0Lib/ARM/ArmPlatformHelper.S b/Platform/Marvell/Armada/Library/Armada70x0Lib/ARM/ArmPlatformHelper.S new file mode 100644 index 0000000..21459e5 --- /dev/null +++ b/Platform/Marvell/Armada/Library/Armada70x0Lib/ARM/ArmPlatformHelper.S @@ -0,0 +1,77 @@ +//Based on ArmPlatformPkg/Library/ArmPlatformLibNull/AArch64/ArmPlatformHelper.S +// +// Copyright (c) 2012-2013, ARM Limited. All rights reserved. +// Copyright (c) 2016, Marvell. All rights reserved. +// Copyright (c) 2017, Linaro Limited. All rights reserved. +// +// This program and the accompanying materials are licensed and made available +// under the terms and conditions of the BSD License which accompanies this +// distribution. The full text of the license may be found at +// http://opensource.org/licenses/bsd-license.php +// +// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED +// + +#include +#include + +#define CCU_MC_BASE 0xF0001700 +#define CCU_MC_RCR_OFFSET 0x0 +#define CCU_MC_RCR_REMAP_EN BIT0 +#define CCU_MC_RCR_REMAP_SIZE(Size) (((Size) - 1) ^ (SIZE_1MB - 1)) + +#define CCU_MC_RSBR_OFFSET 0x4 +#define CCU_MC_RSBR_SOURCE_BASE(Base) (((Base) >> 20) << 10) +#define CCU_MC_RTBR_OFFSET 0x8 +#define CCU_MC_RTBR_TARGET_BASE(Base) (((Base) >> 20) << 10) + +ASM_FUNC(ArmPlatformPeiBootAction) + .if FixedPcdGet64 (PcdSystemMemoryBase) != 0 + .err PcdSystemMemoryBase should be 0x0 on this platform! + .endif + + .if FixedPcdGet64 (PcdSystemMemorySize) > FixedPcdGet32 (PcdDramRemapTarget) + // + // Use the low range for UEFI itself. The remaining memory will be mapped + // and added to the GCD map later. + // + ADRL (r0, mSystemMemoryEnd) + MOV32 (r2, FixedPcdGet32 (PcdDramRemapTarget) - 1) + mov r3, #0 + strd r2, r3, [r0] + .endif + + bx lr + +//UINTN +//ArmPlatformGetCorePosition ( +// IN UINTN MpId +// ); +// With this function: CorePos = (ClusterId * 2) + CoreId +ASM_FUNC(ArmPlatformGetCorePosition) + and r1, r0, #ARM_CORE_MASK + and r0, r0, #ARM_CLUSTER_MASK + add r0, r1, r0, LSR #7 + bx lr + +//UINTN +//ArmPlatformGetPrimaryCoreMpId ( +// VOID +// ); +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) + MOV32 (r0, FixedPcdGet32(PcdArmPrimaryCore)) + bx lr + +//UINTN +//ArmPlatformIsPrimaryCore ( +// IN UINTN MpId +// ); +ASM_FUNC(ArmPlatformIsPrimaryCore) + MOV32 (r1, FixedPcdGet32(PcdArmPrimaryCoreMask)) + and r0, r0, r1 + MOV32 (r1, FixedPcdGet32(PcdArmPrimaryCore)) + cmp r0, r1 + moveq r0, #1 + movne r0, #0 + bx lr diff --git a/Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.inf b/Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.inf index 2236d9f..71abdd4 100644 --- a/Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.inf +++ b/Platform/Marvell/Armada/Library/Armada70x0Lib/Armada70x0Lib.inf @@ -60,6 +60,9 @@ [Sources.AArch64] AArch64/ArmPlatformHelper.S +[Sources.ARM] + ARM/ArmPlatformHelper.S + [FixedPcd] gArmTokenSpaceGuid.PcdSystemMemoryBase gArmTokenSpaceGuid.PcdSystemMemorySize