Fixup to point to real RAM and NOR addressess.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10511 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
andrewfish 2010-05-19 01:44:13 +00:00
parent 1a352322f9
commit 4ade93d032
5 changed files with 92 additions and 40 deletions

View File

@ -300,14 +300,14 @@
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|10
gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0
gEmbeddedTokenSpaceGuid.PcdPrePiHobBase|0x80001000
gEmbeddedTokenSpaceGuid.PcdPrePiStackBase|0x87FE0000 # stack at top of memory
gEmbeddedTokenSpaceGuid.PcdPrePiHobBase|0x00001000
gEmbeddedTokenSpaceGuid.PcdPrePiStackBase|0x07FE0000 # stack at top of memory
gEmbeddedTokenSpaceGuid.PcdPrePiStackSize|0x20000 # 128K stack
gEmbeddedTokenSpaceGuid.PcdMemoryBase|0x80000000
gEmbeddedTokenSpaceGuid.PcdMemorySize|0x10000000
gEmbeddedTokenSpaceGuid.PcdMemoryBase|0x00000000
gEmbeddedTokenSpaceGuid.PcdMemorySize|0x10000000 # 256 MB
gArmTokenSpaceGuid.PcdCpuVectorBaseAddress|0x80000000
gArmTokenSpaceGuid.PcdCpuResetAddress|0x80008000
gArmTokenSpaceGuid.PcdCpuVectorBaseAddress|0x00000000
gArmTokenSpaceGuid.PcdCpuResetAddress|0x40000000 # set to start of NOR
gEmbeddedTokenSpaceGuid.PcdTimerPeriod|100000
gEmbeddedTokenSpaceGuid.PcdEmbeddedPerformanceCounterPeriodInNanoseconds|77

View File

@ -27,12 +27,11 @@
[FD.ArmEb_EFI]
####BaseAddress = 0x80208000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress #The base address of the FLASH Device.
BaseAddress = 0x80008000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress #The base address of the FLASH Device.
Size = 0x00080000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdSize #The size in bytes of the FLASH Device
BaseAddress = 0x40000000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdBaseAddress #The base address of the FLASH Device.
Size = 0x00200000|gEmbeddedTokenSpaceGuid.PcdEmbeddedFdSize #The size in bytes of the FLASH Device
ErasePolarity = 1
BlockSize = 0x40
NumBlocks = 0x2000
BlockSize = 0x00001000
NumBlocks = 0x200
################################################################################
#
@ -50,10 +49,7 @@ NumBlocks = 0x2000
#
################################################################################
# 512 bytes of configuration header & 8 bytes of image header
0x00000000|0x00000208
0x00000208|0x0007FDF8
0x00000000|0x00200000
gEmbeddedTokenSpaceGuid.PcdFlashFvMainBase|gEmbeddedTokenSpaceGuid.PcdFlashFvMainSize
FV = FVMAIN_COMPACT

View File

@ -1,5 +1,11 @@
#------------------------------------------------------------------------------
#
# ARM EB Entry point. Reset vector in FV header will brach to
# _ModuleEntryPoint.
#
# We use crazy macros, like LoadConstantToReg, since Xcode assembler
# does not support = assembly syntax for ldr.
#
# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
#
# This program and the accompanying materials
@ -13,7 +19,9 @@
#------------------------------------------------------------------------------
#include <AsmMacroIoLib.h>
#include <Base.h>
#include <Library/PcdLib.h>
#include <ArmEb/ArmEb.h>
.text
.align 3
@ -22,29 +30,49 @@
.globl ASM_PFX(_ModuleEntryPoint)
ASM_PFX(_ModuleEntryPoint):
// Turn off remapping NOR to 0. We can now use DRAM in low memory
MmioOr32 (EB_SP810_CTRL_BASE ,BIT8)
// Enable NEON register in case folks want to use them for optimizations (CopyMem)
mrc p15, 0, r0, c1, c0, 2
orr r0, r0, #0x00f00000 // Enable VPF access (V* instructions)
mcr p15, 0, r0, c1, c0, 2
mov r0, #0x40000000 // Set EN bit in FPEXC
msr FPEXC,r0
// Set CPU vectors to start of DRAM
LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base
mcr p15, 0, r0, c12, c0, 0
isb // Sync changes to control registers
// Fill vector table with branchs to current pc (jmp $)
// CPU DXE driver likes known values so it can let GDB stub hook vectors
ldr r1, ShouldNeverGetHere
movs r2, #0
FillVectors
str r1, [r0, r2]
adds r2, r2, #4
cmp r2, #32
bne FillVectors
//
// Set stack based on PCD values. Need to do it this way to make C code work
// when it runs from FLASH.
//
LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) /* stack base arg2 */
LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) /* stack size arg3 */
LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) // stack base arg2
LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) // stack size arg3
add r4, r2, r3
//Enter SVC mode and set up SVC stack pointer
mov r0,#0x13|0x80|0x40
msr CPSR_c,r0
sub r4, r4, #0x400
mov r13,r4
mov r13, r4
// Call C entry point
LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) /* memory size arg1 */
LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) /* memory size arg0 */
blx ASM_PFX(CEntryPoint) /* Assume C code is ARM */
LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) // memory size arg1
LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) // memory size arg0
blx ASM_PFX(CEntryPoint)
ShouldNeverGetHere:
/* _CEntryPoint should never return */
// _CEntryPoint should never return
b ShouldNeverGetHere

View File

@ -13,8 +13,11 @@
//------------------------------------------------------------------------------
#include <AsmMacroIoLib.h>
#include <Base.h>
#include <Library/PcdLib.h>
#include <ArmEb/ArmEb.h>
#include <AutoGen.h>
INCLUDE AsmMacroIoLib.inc
IMPORT CEntryPoint
@ -26,28 +29,50 @@
_ModuleEntryPoint
// Turn off remapping NOR to 0. We can now use DRAM in low memory
MmioOr32 (0x10001000 ,BIT8) //EB_SP810_CTRL_BASE
// Enable NEON register in case folks want to use them for optimizations (CopyMem)
mrc p15, 0, r0, c1, c0, 2
orr r0, r0, #0x00f00000 // Enable VPF access (V* instructions)
mcr p15, 0, r0, c1, c0, 2
mov r0, #0x40000000 // Set EN bit in FPEXC
msr FPEXC,r0
// Set CPU vectors to start of DRAM
LoadConstantToReg (FixedPcdGet32(PcdCpuVectorBaseAddress) ,r0) // Get vector base
mcr p15, 0, r0, c12, c0, 0
isb // Sync changes to control registers
// Fill vector table with branchs to current pc (jmp $)
// CPU DXE driver likes known values so it can let GDB stub hook vectors
ldr r1, ShouldNeverGetHere
movs r2, #0
FillVectors
str r1, [r0, r2]
adds r2, r2, #4
cmp r2, #32
bne FillVectors
//
// Set stack based on PCD values. Need to do it this way to make C code work
// when it runs from FLASH.
//
LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) /* stack base arg2 */
LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) /* stack size arg3 */
LoadConstantToReg (FixedPcdGet32(PcdPrePiStackBase) ,r2) // stack base arg2
LoadConstantToReg (FixedPcdGet32(PcdPrePiStackSize) ,r3) // stack size arg3
add r4, r2, r3
//Enter SVC mode and set up SVC stack pointer
mov r0,#0x13|0x80|0x40
msr CPSR_c,r0
mov r13,r4
mov r13, r4
// Call C entry point
LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) /* memory size arg1 */
LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) /* memory size arg0 */
blx CEntryPoint /* Assume C code is thumb */
LoadConstantToReg (FixedPcdGet32(PcdMemorySize) ,r1) // memory size arg1
LoadConstantToReg (FixedPcdGet32(PcdMemoryBase) ,r0) // memory size arg0
blx CEntryPoint
ShouldNeverGetHere
/* _CEntryPoint should never return */
// _CEntryPoint should never return
b ShouldNeverGetHere
END

View File

@ -62,4 +62,7 @@
gEmbeddedTokenSpaceGuid.PcdPrePiStackBase
gEmbeddedTokenSpaceGuid.PcdMemoryBase
gEmbeddedTokenSpaceGuid.PcdMemorySize
gArmTokenSpaceGuid.PcdCpuVectorBaseAddress