From patchwork Tue Jun 11 08:27:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rony Nandy X-Patchwork-Id: 17790 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f199.google.com (mail-gh0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id DAE0925E1A for ; Tue, 11 Jun 2013 08:27:37 +0000 (UTC) Received: by mail-gh0-f199.google.com with SMTP id g14sf4595619ghb.6 for ; Tue, 11 Jun 2013 01:27:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=7tX7gfCRCagtM5lQh9EBLKheMeOJ6lAKWdrmrLgIFKo=; b=OP1JvzwzIUkS+Z4Yu3jmvGWJQx86V23UHCNYMbGGlDW85IW9HTukAjzpTEpbWSOOcS OcIrvN5dFn5cafbVjICH847nmsqNYKszvyvstJjzpfrSJkQ78yoIzwposajH8peQONvq 79Qb0gl/yUyDupr1PpBLFLV4iKCpgvAeTtVIfqLlQkdlpwDPEiJMZquxHUlpW4fOhzVT 9TUojm6LkDTunicNu5R7lVCbD73UVHNGVB79tFxcZB5RShSt1kAP4Q/JuT2BkYzRIoDa prJxX4x2r8o8d7C6xt2ZJMhEAX1P/2hZWONbGGgtlY9Nev5CanCDnjCcYDUeCJgrjSlq xi3w== X-Received: by 10.58.97.200 with SMTP id ec8mr2515991veb.32.1370939257538; Tue, 11 Jun 2013 01:27:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.5 with SMTP id lg5ls3136501qeb.21.gmail; Tue, 11 Jun 2013 01:27:37 -0700 (PDT) X-Received: by 10.52.33.104 with SMTP id q8mr6503346vdi.96.1370939257305; Tue, 11 Jun 2013 01:27:37 -0700 (PDT) Received: from mail-ve0-x22e.google.com (mail-ve0-x22e.google.com [2607:f8b0:400c:c01::22e]) by mx.google.com with ESMTPS id ra6si6561135vec.8.2013.06.11.01.27.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 01:27:37 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c01::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c01::22e; Received: by mail-ve0-f174.google.com with SMTP id oz10so5472048veb.5 for ; Tue, 11 Jun 2013 01:27:37 -0700 (PDT) X-Received: by 10.58.97.238 with SMTP id ed14mr3435207veb.34.1370939257115; Tue, 11 Jun 2013 01:27:37 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp99639vcb; Tue, 11 Jun 2013 01:27:36 -0700 (PDT) X-Received: by 10.68.75.49 with SMTP id z17mr9620292pbv.169.1370939255967; Tue, 11 Jun 2013 01:27:35 -0700 (PDT) Received: from mail-pb0-x229.google.com (mail-pb0-x229.google.com [2607:f8b0:400e:c01::229]) by mx.google.com with ESMTPS id px9si6472699pbb.335.2013.06.11.01.27.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 01:27:35 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400e:c01::229 is neither permitted nor denied by best guess record for domain of rony.nandy@linaro.org) client-ip=2607:f8b0:400e:c01::229; Received: by mail-pb0-f41.google.com with SMTP id rp16so4725926pbb.28 for ; Tue, 11 Jun 2013 01:27:35 -0700 (PDT) X-Received: by 10.66.232.69 with SMTP id tm5mr17742431pac.120.1370939255148; Tue, 11 Jun 2013 01:27:35 -0700 (PDT) Received: from username-ubuntu.sisodomain.com ([115.113.119.130]) by mx.google.com with ESMTPSA id dc3sm13780518pbc.9.2013.06.11.01.27.33 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Jun 2013 01:27:34 -0700 (PDT) From: Rony Nandy To: ryan.harkin@linaro.org Cc: boot-architecture@lists.linaro.org Subject: [PATCH] This patch fixes the build breakage issue for Arndale BSP due to the patch "ArmPlatformPkg/ArmPlatformLib: Added support for ArmPlatformIsPrimaryCore()" Date: Tue, 11 Jun 2013 13:57:07 +0530 Message-Id: <1370939227-28823-1-git-send-email-rony.nandy@linaro.org> X-Mailer: git-send-email 1.7.9.5 X-Gm-Message-State: ALoCoQkKL213Q2agDS3n1/cbjbfUHQhwI0Uw2sN6HpGy+n98jwAN7dpiy15wXpo4JrT6amQYOLuB X-Original-Sender: rony.nandy@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c01::22e is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , --- .../ArndaleBoardLib/Exynos5250/BoardHelper.S | 25 ++++++++++++++++++++ .../ArndaleBoardPkg/arndale-Exynos5250.dsc | 16 ------------- .../ArndaleBoardPkg/arndale-Exynos5250.fdf | 15 ------------ .../Exynos5250/Drivers/Gic400Dxe/PL390GicSec.c | 3 ++- .../Drivers/Gic400Dxe/PL390GicSecLib.inf | 5 ++-- SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/Sec.c | 5 ++-- .../ExynosPkg/Exynos5250/Sec/Sec.inf | 3 --- .../ExynosPkg/Exynos5250/Sec/SecEntryPoint.S | 25 +++++++++++++------- 8 files changed, 49 insertions(+), 48 deletions(-) diff --git a/SamsungPlatformPkg/ArndaleBoardPkg/Library/ArndaleBoardLib/Exynos5250/BoardHelper.S b/SamsungPlatformPkg/ArndaleBoardPkg/Library/ArndaleBoardLib/Exynos5250/BoardHelper.S index 1975e65..7ee7821 100644 --- a/SamsungPlatformPkg/ArndaleBoardPkg/Library/ArndaleBoardLib/Exynos5250/BoardHelper.S +++ b/SamsungPlatformPkg/ArndaleBoardPkg/Library/ArndaleBoardLib/Exynos5250/BoardHelper.S @@ -14,6 +14,7 @@ #include #include #include +#include #include #.include AsmMacroIoLib.inc @@ -23,6 +24,9 @@ .align 2 GCC_ASM_EXPORT(ArmGetCpuCountPerCluster) +GCC_ASM_EXPORT(ArmPlatformGetCorePosition) +GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore) +GCC_ASM_EXPORT(ArmPlatformPeiBootAction) # IN None # OUT r0 = SCU Base Address @@ -68,4 +72,25 @@ _Return: ldmfd SP!, {r1-r2} bx lr +ASM_PFX(ArmPlatformIsPrimaryCore): + #last 2 bit of mpid register in 5250 is CPU ID + ldr r1, =0x3 + and r0, r0, r1 + #id for core0 should be 0 + ldr r1, =0x0 + cmp r0, r1 + moveq r0, #1 + movne r0, #0 + mov pc, lr + +ASM_PFX(ArmPlatformGetCorePosition): + and r1, r0, #0x03 //cpu core mask last 2 bits + and r0, r0, #(0x0f<<8) //cpu cluster mask bit 8-11 + add r0, r1, r0, LSR #7 + mov pc, lr + + +ASM_PFX(ArmPlatformPeiBootAction): + mov pc, lr + ASM_FUNCTION_REMOVE_IF_UNREFERENCED diff --git a/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.dsc b/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.dsc index 941c6e5..ade2997 100755 --- a/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.dsc +++ b/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.dsc @@ -56,7 +56,6 @@ [BuildOptions] RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A8 --fpu=softvfp -I$(WORKSPACE)/SamsungPlatformPkg/ExynosPkg/Exynos5250/Include/Platform - #GCC:*_*_ARM_PLATFORM_FLAGS == -mcpu=cortex-a8 -I$(WORKSPACE)/SamsungPlatformPkg/ExynosPkg/Exynos5250/Include/Platform GCC:*_*_ARM_PLATFORM_FLAGS == -march=armv7-a -I$(WORKSPACE)/SamsungPlatformPkg/ExynosPkg/Exynos5250/Include/Platform XCODE:*_*_ARM_PLATFORM_FLAGS == -arch armv7 -I$(WORKSPACE)/SamsungPlatformPkg/ExynosPkg/Exynos5250/Include/Platform @@ -242,7 +241,6 @@ SamsungPlatformPkg/ExynosPkg/Exynos5250/MemoryInitPei/MemoryInitPeim.inf ArmPkg/Drivers/CpuPei/CpuPei.inf IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf - #Nt32Pkg/BootModePei/BootModePei.inf MdeModulePkg/Universal/Variable/Pei/VariablePei.inf MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf { @@ -268,22 +266,17 @@ MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf - #MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf - #MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf - #MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf - #EmbeddedPkg/SerialDxe/SerialDxe.inf MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf - #MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf SamsungPlatformPkg/ArndaleBoardPkg/FvbDxe/FvbDxe.inf SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/TimerDxe/TimerDxe.inf @@ -318,9 +311,6 @@ # # Application # - #SamsungPlatformPkg/Apps/TestApps/HashServicesTest/HashServicesTest.inf - #SamsungPlatformPkg/Apps/TestApps/RngServicesTest/RngServicesTest.inf - # # Bds # @@ -346,9 +336,7 @@ # usb host : ehci + bus + pci_emul + mass_storage # SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/PciEmulation/PciEmulation.inf - #SamsungPlatformPkg/ExynosPkg/Exynos5250/OhciDxe/OhciDxe.inf MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf - #MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf @@ -363,8 +351,6 @@ LockBoxLib|MdeModulePkg/Library/LockBoxNullLib/LockBoxNullLib.inf } - MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf - #MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf SamsungPlatformPkg/Apps/Tools/fwupdate/fwupdate_5250.inf @@ -372,9 +358,7 @@ # # Crypto for Exynos # - #SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/HashDxe/HashDxe.inf # # Rng for Exynos # - #SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/RngDxe/RngDxe.inf diff --git a/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.fdf b/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.fdf index 8b5a5a7..9bccd79 100755 --- a/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.fdf +++ b/SamsungPlatformPkg/ArndaleBoardPkg/arndale-Exynos5250.fdf @@ -120,7 +120,6 @@ READ_STATUS = TRUE READ_LOCK_CAP = TRUE READ_LOCK_STATUS = TRUE - #INF ArmPlatformPkg/Sec/Sec.inf INF SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/Sec.inf @@ -155,8 +154,6 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf - #INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf - #INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf @@ -166,14 +163,10 @@ READ_LOCK_STATUS = TRUE # Multiple Console IO support # INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf - #INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf - #INF EmbeddedPkg/SerialDxe/SerialDxe.inf - INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf - #INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf !ifdef $(EXYNOS5250_EVT1) INF SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicDxe.inf @@ -207,9 +200,7 @@ READ_LOCK_STATUS = TRUE # USB HOST STACK # INF SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/PciEmulation/PciEmulation.inf - #INF SamsungPlatformPkg/ExynosPkg/Exynos5250/OhciDxe/OhciDxe.inf INF MdeModulePkg/Bus/Pci/EhciDxe/EhciDxe.inf - #INF MdeModulePkg/Bus/Pci/XhciDxe/XhciDxe.inf INF MdeModulePkg/Bus/Usb/UsbBusDxe/UsbBusDxe.inf INF MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassStorageDxe.inf @@ -223,20 +214,14 @@ READ_LOCK_STATUS = TRUE INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTablePei/FirmwarePerformancePei.inf - INF MdeModulePkg/Universal/Acpi/FirmwarePerformanceDataTableDxe/FirmwarePerformanceDxe.inf - #INF MdeModulePkg/Universal/Acpi/BootGraphicsResourceTableDxe/BootGraphicsResourceTableDxe.inf # Crypto for Exynos # - #INF SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/HashDxe/HashDxe.inf - #INF SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/RngDxe/RngDxe.inf # # UEFI application (Shell Embedded Boot Loader) # INF ShellBinPkg/UefiShell/UefiShell.inf - #INF SamsungPlatformPkg/Apps/TestApps/HashServicesTest/HashServicesTest.inf - #INF SamsungPlatformPkg/Apps/TestApps/RngServicesTest/RngServicesTest.inf # # Bds diff --git a/SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicSec.c b/SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicSec.c index f7b6d7c..82ecfde 100644 --- a/SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicSec.c +++ b/SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicSec.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -50,7 +51,7 @@ ArmGicSetupNonSecure ( } // Only the primary core should set the Non Secure bit to the SPIs (Shared Peripheral Interrupt). - if (IS_PRIMARY_CORE(MpId)) { + if (ArmPlatformIsPrimaryCore (MpId)) { // Ensure all GIC interrupts are Non-Secure for (Index = 0; Index < (ArmGicGetMaxNumInterrupts (GicDistributorBase) / 32); Index++) { MmioWrite32 (GicDistributorBase + ARM_GIC_ICDISR + (Index * 4), 0xffffffff); diff --git a/SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicSecLib.inf b/SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicSecLib.inf index 9e1fd09..ab399b4 100644 --- a/SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicSecLib.inf +++ b/SamsungPlatformPkg/ExynosPkg/Exynos5250/Drivers/Gic400Dxe/PL390GicSecLib.inf @@ -25,7 +25,9 @@ [Packages] ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec [LibraryClasses] ArmLib @@ -33,6 +35,3 @@ IoLib PcdLib -[FixedPcd.common] - gArmTokenSpaceGuid.PcdArmPrimaryCoreMask - gArmTokenSpaceGuid.PcdArmPrimaryCore diff --git a/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/Sec.c b/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/Sec.c index 549171b..3c4f498 100644 --- a/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/Sec.c +++ b/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/Sec.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "SecInternal.h" #include "Smc.h" @@ -94,7 +95,7 @@ CEntryPoint ( } // Primary CPU clears out the SCU tag RAMs, secondaries wait - if (IS_PRIMARY_CORE(MpId)) { + if (ArmPlatformIsPrimaryCore (MpId)) { if (ArmIsMpCore()) { // Is UEFI built as it is assumed that TZSW is running? // PcdTrustzoneSupport==1: YES. @@ -174,7 +175,7 @@ TrustedWorldInitialization ( ArmPlatformSecTrustzoneInit (MpId); // Setup the Trustzone Chipsets - if (IS_PRIMARY_CORE(MpId)) { + if (ArmPlatformIsPrimaryCore (MpId)) { if (ArmIsMpCore()) { // Signal the secondary core the Security settings is done (event: EVENT_SECURE_INIT) ArmCallSEV (); diff --git a/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/Sec.inf b/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/Sec.inf index 854b269..1cda8c3 100644 --- a/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/Sec.inf +++ b/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/Sec.inf @@ -62,9 +62,6 @@ gArmTokenSpaceGuid.PcdArmNsacr gArmTokenSpaceGuid.PcdArmNonSecModeTransition - gArmTokenSpaceGuid.PcdArmPrimaryCoreMask - gArmTokenSpaceGuid.PcdArmPrimaryCore - gArmTokenSpaceGuid.PcdSecureFvBaseAddress gArmTokenSpaceGuid.PcdSecureFvSize diff --git a/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/SecEntryPoint.S b/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/SecEntryPoint.S index 08a893c..4dec90b 100644 --- a/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/SecEntryPoint.S +++ b/SamsungPlatformPkg/ExynosPkg/Exynos5250/Sec/SecEntryPoint.S @@ -14,12 +14,14 @@ #include #include #include +#include #include "SecInternal.h" .text .align 3 GCC_ASM_IMPORT(CEntryPoint) +GCC_ASM_IMPORT(ArmPlatformIsPrimaryCore) GCC_ASM_IMPORT(CopyFirmwareFromEMMC) GCC_ASM_IMPORT(CopyFirmwareFromSDMMC) GCC_ASM_IMPORT(ArmPlatformClockInitialize) @@ -36,6 +38,16 @@ GCC_ASM_EXPORT(_ModuleEntryPoint) SecStartupAddr: .word ASM_PFX(_SecEntryFromTzsw) StartupAddr: .word ASM_PFX(CEntryPoint) +// Convert the (ClusterId,CoreId) into a Core Position +// 0x0F03 is the magic value for ARM_CORE_MASK | ARM_CLUSTER_MASK +//Core is 0-1 bits and cluster is 8-11 bits +#define GetCorePositionFromMpId(Pos, MpId, Tmp) \ + ldr Tmp, =0x0F03 ; \ + and MpId, Tmp ; \ + lsr Pos, MpId, #6 ; \ + and Tmp, MpId, #3 ; \ + add Pos, Pos, Tmp + // Reserve a region at the top of the IRAM Core stack // for Global variables for the XIP phase #define SetiRamStack(StackTop, GlobalSize, Tmp) \ @@ -85,13 +97,13 @@ ASM_PFX(_ModuleEntryPoint): _IdentifyCpu: // Identify CPU ID bl ASM_PFX(ArmReadMpidr) - // Get ID of this CPU in Multicore system - LoadConstantToReg (FixedPcdGet32(PcdArmPrimaryCoreMask), r1) - and r5, r0, r1 + // Keep a copy of the MpId register value + mov r5, r0 // Is it the Primary Core ? - LoadConstantToReg (FixedPcdGet32(PcdArmPrimaryCore), r3) - cmp r5, r3 + bl ASM_PFX(ArmPlatformIsPrimaryCore) + cmp r0, #1 + // Only the primary core initialize the memory (SMC) beq _InitMem @@ -119,9 +131,6 @@ _InitMem: bl ASM_PFX(ArmPlatformSecBootMemoryInit) - // Only Primary CPU could run this line (the secondary cores have jumped from _IdentifyCpu to _SetupStack) - LoadConstantToReg (FixedPcdGet32(PcdArmPrimaryCore), r5) - _SetupPrimaryCoreStack: // Get the top of the primary stacks (and the base of the secondary stacks) LoadConstantToReg (FixedPcdGet32(PcdCPUCoresSecStackBase), r1)