]>
Commit | Line | Data |
---|---|---|
1d5d0ae9 | 1 | //\r |
2 | // Copyright (c) 2011, ARM Limited. All rights reserved.\r | |
3 | // \r | |
4 | // This program and the accompanying materials \r | |
5 | // are licensed and made available under the terms and conditions of the BSD License \r | |
6 | // which accompanies this distribution. The full text of the license may be found at \r | |
7 | // http://opensource.org/licenses/bsd-license.php \r | |
8 | //\r | |
9 | // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
10 | // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
11 | //\r | |
12 | //\r | |
13 | \r | |
14 | #include <AsmMacroIoLib.h>\r | |
15 | #include <Base.h>\r | |
16 | #include <Library/PcdLib.h>\r | |
17 | #include <ArmPlatform.h>\r | |
18 | #include <AutoGen.h>\r | |
19 | \r | |
20 | INCLUDE AsmMacroIoLib.inc\r | |
21 | \r | |
22 | EXPORT ArmPlatformIsMemoryInitialized\r | |
23 | EXPORT ArmPlatformInitializeBootMemory\r | |
24 | IMPORT InitializeSMC\r | |
25 | \r | |
26 | PRESERVE8\r | |
27 | AREA CTA9x4Helper, CODE, READONLY\r | |
28 | \r | |
29 | /**\r | |
30 | Called at the early stage of the Boot phase to know if the memory has already been initialized\r | |
31 | \r | |
32 | Running the code from the reset vector does not mean we start from cold boot. In some case, we\r | |
33 | can go through this code with the memory already initialized.\r | |
34 | Because this function is called at the early stage, the implementation must not use the stack.\r | |
35 | Its implementation must probably done in assembly to ensure this requirement.\r | |
36 | \r | |
37 | @return Return the condition value into the 'Z' flag\r | |
38 | \r | |
39 | **/\r | |
40 | ArmPlatformIsMemoryInitialized\r | |
41 | // Check if the memory has been already mapped, if so skipped the memory initialization\r | |
42 | LoadConstantToReg (ARM_VE_SYS_CFGRW1_REG ,r0)\r | |
43 | ldr r0, [r0, #0]\r | |
44 | \r | |
45 | // 0x40000000 = Value of Physical Configuration Switch SW[0]\r | |
46 | and r0, r0, #0x40000000\r | |
47 | tst r0, #0x40000000\r | |
48 | bx lr\r | |
49 | \r | |
50 | /**\r | |
51 | Initialize the memory where the initial stacks will reside\r | |
52 | \r | |
53 | This memory can contain the initial stacks (Secure and Secure Monitor stacks).\r | |
54 | In some platform, this region is already initialized and the implementation of this function can\r | |
55 | do nothing. This memory can also represent the Secure RAM.\r | |
56 | This function is called before the satck has been set up. Its implementation must ensure the stack\r | |
57 | pointer is not used (probably required to use assembly language)\r | |
58 | \r | |
59 | **/\r | |
60 | ArmPlatformInitializeBootMemory\r | |
61 | mov r5, lr\r | |
62 | // Initialize PL354 SMC\r | |
63 | LoadConstantToReg (ARM_VE_SMC_CTRL_BASE, r1)\r | |
64 | LoadConstantToReg (ARM_VE_SMB_PERIPH_VRAM, r2)\r | |
65 | blx InitializeSMC\r | |
66 | bx r5\r | |
67 | \r | |
68 | END\r |