1 //------------------------------------------------------------------------------
3 // Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
5 // This program and the accompanying materials
6 // are licensed and made available under the terms and conditions of the BSD License
7 // which accompanies this distribution. The full text of the license may be found at
8 // http://opensource.org/licenses/bsd-license.php
10 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13 //------------------------------------------------------------------------------
15 #include <AsmMacroIoLib.h>
17 #include <Library/PcdLib.h>
18 #include <ArmEb/ArmEb.h>
21 INCLUDE AsmMacroIoLib.inc
24 EXPORT _ModuleEntryPoint
27 AREA ModuleEntryPoint, CODE, READONLY
32 // Turn off remapping NOR to 0. We can now use DRAM in low memory
33 MmioOr32 (0x10001000 ,BIT8) //EB_SP810_CTRL_BASE
35 // Enable NEON register in case folks want to use them for optimizations (CopyMem)
36 mrc p15, 0, r0, c1, c0, 2
37 orr r0, r0, #0x00f00000 // Enable VPF access (V* instructions)
38 mcr p15, 0, r0, c1, c0, 2
39 mov r0, #0x40000000 // Set EN bit in FPEXC
43 // Set CPU vectors to start of DRAM
44 LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base
45 mcr p15, 0, r0, c12, c0, 0
46 isb // Sync changes to control registers
48 // Fill vector table with branchs to current pc (jmp $)
49 // CPU DXE driver likes known values so it can let GDB stub hook vectors
50 ldr r1, ShouldNeverGetHere
59 // Set stack based on PCD values. Need to do it this way to make C code work
60 // when it runs from FLASH.
62 LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) // stack base arg2
63 LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) // stack size arg3
68 LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) // memory size arg1
69 LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) // memory size arg0
73 // _CEntryPoint should never return