]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Boot.asm
ArmPkg/ArmGicLib: Replaced 'ArmGicAcknowledgeSgiFrom' by 'ArmGicAcknowledgeInterrupt'
[mirror_edk2.git] / ArmPlatformPkg / ArmVExpressPkg / Library / ArmVExpressLibCTA9x4 / CTA9x4Boot.asm
CommitLineData
c52e2dca 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/ArmPlatformLib.h>\r
17#include <Drivers/PL35xSmc.h>\r
18#include <ArmPlatform.h>\r
19#include <AutoGen.h>\r
20\r
21 INCLUDE AsmMacroIoLib.inc\r
22\r
44e272fd 23 EXPORT ArmPlatformSecBootAction\r
c52e2dca 24 EXPORT ArmPlatformInitializeBootMemory\r
25 IMPORT PL35xSmcInitialize\r
26\r
27 PRESERVE8\r
28 AREA CTA9x4BootMode, CODE, READONLY\r
29\r
30//\r
31// For each Chip Select: ChipSelect / SetCycle / SetOpMode\r
32//\r
33VersatileExpressSmcConfiguration\r
34 // NOR Flash 0\r
35 DCD PL350_SMC_DIRECT_CMD_ADDR_CS(0)\r
36 DCD PL350_SMC_SET_CYCLE_NAND_T_RC(0xA) :OR: PL350_SMC_SET_CYCLE_NAND_T_WC(0x3) :OR: PL350_SMC_SET_CYCLE_NAND_T_REA(0x1) :OR: PL350_SMC_SET_CYCLE_NAND_T_WP(0x7) :OR: PL350_SMC_SET_CYCLE_NAND_T_AR(0x1)\r
37 DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_CONT :OR: PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_CONT :OR: PL350_SMC_SET_OPMODE_SET_ADV\r
38\r
39 // NOR Flash 1\r
40 DCD PL350_SMC_DIRECT_CMD_ADDR_CS(4)\r
41 DCD PL350_SMC_SET_CYCLE_NAND_T_RC(0xA) :OR: PL350_SMC_SET_CYCLE_NAND_T_WC(0x3) :OR: PL350_SMC_SET_CYCLE_NAND_T_REA(0x1) :OR: PL350_SMC_SET_CYCLE_NAND_T_WP(0x7) :OR: PL350_SMC_SET_CYCLE_NAND_T_AR(0x1)\r
42 DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_BURST_LENGTH_CONT :OR: PL350_SMC_SET_OPMODE_SET_WR_BURST_LENGTH_CONT :OR: PL350_SMC_SET_OPMODE_SET_ADV\r
43\r
44 // SRAM\r
45 DCD PL350_SMC_DIRECT_CMD_ADDR_CS(2)\r
46 DCD PL350_SMC_SET_CYCLE_SRAM_T_RC(0x8) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WC(0x5) :OR: PL350_SMC_SET_CYCLE_SRAM_T_CEOE(0x1) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WP(0x6) :OR: PL350_SMC_SET_CYCLE_SRAM_T_PC(0x1) :OR: PL350_SMC_SET_CYCLE_SRAM_T_TR(0x1)\r
47 DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_ADV\r
48\r
49 // Usb/Eth/VRAM\r
50 DCD PL350_SMC_DIRECT_CMD_ADDR_CS(3)\r
51 DCD PL350_SMC_SET_CYCLE_SRAM_T_RC(0xA) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WC(0xA) :OR: PL350_SMC_SET_CYCLE_SRAM_T_CEOE(0x2) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WP(0x2) :OR: PL350_SMC_SET_CYCLE_SRAM_T_PC(0x3) :OR: PL350_SMC_SET_CYCLE_SRAM_T_TR(0x6)\r
52 DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_SYNC :OR: PL350_SMC_SET_OPMODE_SET_WR_SYNC\r
53\r
54 // Memory Mapped Peripherals\r
55 DCD PL350_SMC_DIRECT_CMD_ADDR_CS(7)\r
56 DCD PL350_SMC_SET_CYCLE_SRAM_T_RC(0x6) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WC(0x5) :OR: PL350_SMC_SET_CYCLE_SRAM_T_CEOE(0x1) :OR: PL350_SMC_SET_CYCLE_SRAM_T_WP(0x2) :OR: PL350_SMC_SET_CYCLE_SRAM_T_PC(0x1) :OR: PL350_SMC_SET_CYCLE_SRAM_T_TR(0x1)\r
57 DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_SYNC :OR: PL350_SMC_SET_OPMODE_SET_WR_SYNC\r
58\r
59 // VRAM\r
60 DCD PL350_SMC_DIRECT_CMD_ADDR_CS(1)\r
61 DCD 0x00049249\r
62 DCD PL350_SMC_SET_OPMODE_MEM_WIDTH_32 :OR: PL350_SMC_SET_OPMODE_SET_RD_SYNC :OR: PL350_SMC_SET_OPMODE_SET_WR_SYNC\r
63VersatileExpressSmcConfigurationEnd\r
64\r
44e272fd 65/**\r
66 Call at the beginning of the platform boot up\r
67\r
68 This function allows the firmware platform to do extra actions at the early\r
69 stage of the platform power up.\r
70\r
71 Note: This function must be implemented in assembler as there is no stack set up yet\r
72\r
73**/\r
74ArmPlatformSecBootAction\r
75 bx lr\r
76\r
c52e2dca 77/**\r
78 Initialize the memory where the initial stacks will reside\r
79\r
80 This memory can contain the initial stacks (Secure and Secure Monitor stacks).\r
81 In some platform, this region is already initialized and the implementation of this function can\r
82 do nothing. This memory can also represent the Secure RAM.\r
83 This function is called before the satck has been set up. Its implementation must ensure the stack\r
84 pointer is not used (probably required to use assembly language)\r
85\r
86**/\r
87ArmPlatformInitializeBootMemory\r
88 mov r5, lr\r
89\r
90 //\r
91 // Initialize PL354 SMC\r
92 //\r
93 LoadConstantToReg (ARM_VE_SMC_CTRL_BASE, r1)\r
94 ldr r2, =VersatileExpressSmcConfiguration\r
95 ldr r3, =VersatileExpressSmcConfigurationEnd\r
96 blx PL35xSmcInitialize\r
97\r
98 //\r
99 // Page mode setup for VRAM\r
100 //\r
101 LoadConstantToReg (VRAM_MOTHERBOARD_BASE, r2)\r
102\r
103 // Read current state\r
104 ldr r0, [r2, #0]\r
105 ldr r0, [r2, #0]\r
106 ldr r0, = 0x00000000\r
107 str r0, [r2, #0]\r
108 ldr r0, [r2, #0]\r
109\r
110 // Enable page mode\r
111 ldr r0, [r2, #0]\r
112 ldr r0, [r2, #0]\r
113 ldr r0, = 0x00000000\r
114 str r0, [r2, #0]\r
115 ldr r0, = 0x00900090\r
116 str r0, [r2, #0]\r
117\r
118 // Confirm page mode enabled\r
119 ldr r0, [r2, #0]\r
120 ldr r0, [r2, #0]\r
121 ldr r0, = 0x00000000\r
122 str r0, [r2, #0]\r
123 ldr r0, [r2, #0]\r
124\r
125 bx r5\r