From patchwork Thu Aug 11 10:08:20 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 73731 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp27470qga; Thu, 11 Aug 2016 03:09:17 -0700 (PDT) X-Received: by 10.98.19.214 with SMTP id 83mr15820708pft.117.1470910148156; Thu, 11 Aug 2016 03:09:08 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id g63si2534476pfg.227.2016.08.11.03.09.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Aug 2016 03:09: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=@linaro.org; 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; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 12F7B1A1E2B; Thu, 11 Aug 2016 03:09:07 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (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 653591A1E3D for ; Thu, 11 Aug 2016 03:09:05 -0700 (PDT) Received: by mail-wm0-x233.google.com with SMTP id q128so20224349wma.1 for ; Thu, 11 Aug 2016 03:09:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=sSN2xQvVBEoSFD1re3/VD1yBnbv4H1uLp7gBAjrdwts=; b=ErpaGizkENhL+fW4KP7WBJv8bnQsZw0WrFMXVz8+C9zvQPEhF3rKuSaACXiPdL4tXi WCrQAr0V9+mD/CaF+e5qPas0vg1jZDylVJcAa4bnlaR0BXCbq/pTDvLFjfUPBAHqjs22 vCKCbWTE58jBPAPc11iQD43lDkoOqnugrOn7E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=sSN2xQvVBEoSFD1re3/VD1yBnbv4H1uLp7gBAjrdwts=; b=AmY36jQWOInV7H3ubXBggVYbvz6rHfomchOqLqJpTXCMdl2l/lDHcvo56IS/2AG8dd ivEo/6V8RXGqY+nrZRSK5Y1o2g38U8q83l5qqZ5psxrPBHhDwiWnMjP+MeVZ5ItVltQv CFwPFsG0wCw3jPN7WKsO6aPU03twKSxhnB9wpnpSIerVcTC1CkPEJepYzrF8RL1WlZdN kpNI/F7bD6OjiMEDAgYIRzKCu8HKjNDVXoOFKrEXj4OcimvBVcmPkS5d4jd6mndtH/w2 FFPtI0d0Yx3L29tDirXZAoXQEdEb8JbEEoMrXuPWsCTO1PRQxvzAwD1n3A+2gB02UdML oBcA== X-Gm-Message-State: AEkoouvFIb7KuNQ+zj2RVsUl3yQGh/5oZ6KcSRZG930nziqLbzQJqjM0RULadpiJS5NklFUM X-Received: by 10.28.169.203 with SMTP id s194mr8386335wme.95.1470910143783; Thu, 11 Aug 2016 03:09:03 -0700 (PDT) Received: from localhost.localdomain (46.red-81-37-107.dynamicip.rima-tde.net. [81.37.107.46]) by smtp.gmail.com with ESMTPSA id p83sm2402873wma.18.2016.08.11.03.09.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 11 Aug 2016 03:09:03 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org Date: Thu, 11 Aug 2016 12:08:20 +0200 Message-Id: <1470910101-20322-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470910101-20322-1-git-send-email-ard.biesheuvel@linaro.org> References: <1470910101-20322-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 5/6] Platforms/Hisilicon/ArmPlatformLibPv660: switch to ASM_FUNC() asm macro X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Annotate functions with ASM_FUNC() so that they are emitted into separate sections. While we're at it, clean up some inefficient uses of LoadConstantToReg() (which require runtime relocation). Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S | 44 +++++--------------- 1 file changed, 10 insertions(+), 34 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S b/Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S index 3b545f188f64..3422df279c73 100644 --- a/Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S +++ b/Chips/Hisilicon/Library/ArmPlatformLibPv660/AArch64/Helper.S @@ -16,59 +16,35 @@ // #include -#include #include -#include -#include -.text -.align 2 - -GCC_ASM_EXPORT(ArmPlatformPeiBootAction) -GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) -GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId) -GCC_ASM_EXPORT(ArmPlatformGetCorePosition) -GCC_ASM_EXPORT(ArmGetCpuCountPerCluster) - -GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore) -GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask) -GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount) - -ASM_PFX(ArmPlatformPeiBootAction): +ASM_FUNC(ArmPlatformPeiBootAction) ret //UINTN //ArmPlatformGetPrimaryCoreMpId ( // VOID // ); -ASM_PFX(ArmPlatformGetPrimaryCoreMpId): - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x0) - ldrh w0, [x0] +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) + MOV32 (w0, FixedPcdGet32(PcdArmPrimaryCore)) ret # IN None # OUT x0 = number of cores present in the system -ASM_PFX(ArmGetCpuCountPerCluster): - LoadConstantToReg (_gPcd_FixedAtBuild_PcdCoreCount, x0) - ldrh w0, [x0] +ASM_FUNC(ArmGetCpuCountPerCluster) + MOV32 (w0, FixedPcdGet32(PcdCoreCount)) ret //UINTN //ArmPlatformIsPrimaryCore ( // IN UINTN MpId // ); -ASM_PFX(ArmPlatformIsPrimaryCore): - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask, x1) - ldrh w1, [x1] +ASM_FUNC(ArmPlatformIsPrimaryCore) + MOV32 (w1, FixedPcdGet32(PcdArmPrimaryCoreMask)) and x0, x0, x1 - LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, x1) - ldrh w1, [x1] + MOV32 (w1, FixedPcdGet32(PcdArmPrimaryCore)) cmp w0, w1 - b.ne 1f - mov x0, #1 - ret -1: - mov x0, #0 + cset x0, eq ret //UINTN @@ -76,7 +52,7 @@ ASM_PFX(ArmPlatformIsPrimaryCore): // IN UINTN MpId // ); // With this function: CorePos = (ClusterId * 4) + CoreId -ASM_PFX(ArmPlatformGetCorePosition): +ASM_FUNC(ArmPlatformGetCorePosition) and x1, x0, #ARM_CORE_MASK and x0, x0, #ARM_CLUSTER_MASK add x0, x1, x0, LSR #6