This is an implementation of ArmPlatformLib that discovers the size of system DRAM from a device tree blob located at the address passed in gArmTokenSpaceGuid.PcdDeviceTreeBaseAddress, which should equal the value in gArmTokenSpaceGuid.PcdSystemMemoryBase. As the device tree blob is passed in system DRAM, this library can only be used if sufficient DRAM is available (>= 128 MB) and if not using shadowed NOR. The reason for this is that it makes it easier to guarantee that such a device tree blob at base of DRAM will not be clobbered before we get a chance to preserve it. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Michael Casadevall <michael.casadevall@linaro.org> Acked-by: Laszlo Ersek <lersek@redhat.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-By: Olivier Martin <olivier.martin@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16138 6f19259b-4bc3-4df7-8a09-765794883524
75 lines
1.9 KiB
ArmAsm
75 lines
1.9 KiB
ArmAsm
#
|
|
# Copyright (c) 2011-2013, ARM Limited. All rights reserved.
|
|
# Copyright (c) 2014, 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 <AsmMacroIoLib.h>
|
|
#include <Base.h>
|
|
#include <Library/ArmLib.h>
|
|
#include <Library/PcdLib.h>
|
|
#include <AutoGen.h>
|
|
|
|
.text
|
|
.align 2
|
|
|
|
GCC_ASM_EXPORT(ArmPlatformPeiBootAction)
|
|
GCC_ASM_EXPORT(ArmPlatformIsPrimaryCore)
|
|
GCC_ASM_EXPORT(ArmPlatformGetPrimaryCoreMpId)
|
|
GCC_ASM_EXPORT(ArmPlatformGetCorePosition)
|
|
GCC_ASM_EXPORT(ArmGetPhysAddrTop)
|
|
|
|
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCore)
|
|
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdArmPrimaryCoreMask)
|
|
GCC_ASM_IMPORT(_gPcd_FixedAtBuild_PcdCoreCount)
|
|
|
|
ASM_PFX(ArmPlatformPeiBootAction):
|
|
bx lr
|
|
|
|
//UINTN
|
|
//ArmPlatformGetPrimaryCoreMpId (
|
|
// VOID
|
|
// );
|
|
ASM_PFX(ArmPlatformGetPrimaryCoreMpId):
|
|
LoadConstantToReg (_gPcd_FixedAtBuild_PcdArmPrimaryCore, r0)
|
|
ldr r0, [r0]
|
|
bx lr
|
|
|
|
//UINTN
|
|
//ArmPlatformIsPrimaryCore (
|
|
// IN UINTN MpId
|
|
// );
|
|
ASM_PFX(ArmPlatformIsPrimaryCore):
|
|
mov r0, #1
|
|
bx lr
|
|
|
|
//UINTN
|
|
//ArmPlatformGetCorePosition (
|
|
// IN UINTN MpId
|
|
// );
|
|
// With this function: CorePos = (ClusterId * 4) + CoreId
|
|
ASM_PFX(ArmPlatformGetCorePosition):
|
|
and r1, r0, #ARM_CORE_MASK
|
|
and r0, r0, #ARM_CLUSTER_MASK
|
|
add r0, r1, r0, LSR #6
|
|
bx lr
|
|
|
|
//EFI_PHYSICAL_ADDRESS
|
|
//GetPhysAddrTop (
|
|
// VOID
|
|
// );
|
|
ASM_PFX(ArmGetPhysAddrTop):
|
|
mov r0, #0x00000000
|
|
mov r1, #0x10000
|
|
bx lr
|
|
|
|
ASM_FUNCTION_REMOVE_IF_UNREFERENCED
|