From f501f5d1b568c294b22ecf6455833fae806fd80d Mon Sep 17 00:00:00 2001 From: oliviermartin Date: Sat, 11 Jun 2011 11:26:42 +0000 Subject: ArmPkg/PL35xSmc: Split the SMC initialization in multiple Chip Select initialization functions Some ArmVExpress-based tiles do not map all the ArmVExpress Chips into their memory map. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11797 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S | 62 ++++++++++++++-------- .../Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm | 32 +++++++++-- 2 files changed, 69 insertions(+), 25 deletions(-) (limited to 'ArmPlatformPkg') diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S index fe63904d62..2987cbee53 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.S @@ -1,36 +1,32 @@ -#------------------------------------------------------------------------------ -# -# ARM VE 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) 2011, ARM 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. -# -#------------------------------------------------------------------------------ +// +// Copyright (c) 2011, ARM 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 #include #include #include +#include #include -#Start of Code section .text .align 3 GCC_ASM_EXPORT(ArmPlatformIsMemoryInitialized) GCC_ASM_EXPORT(ArmPlatformInitializeBootMemory) -.extern ASM_PFX(InitializeSMC) +.extern ASM_PFX(SMCInitializeNOR) +.extern ASM_PFX(SMCInitializeSRAM) +.extern ASM_PFX(SMCInitializePeripherals) +.extern ASM_PFX(SMCInitializeVRAM) /** Called at the early stage of the Boot phase to know if the memory has already been initialized @@ -65,10 +61,32 @@ ASM_PFX(ArmPlatformIsMemoryInitialized): **/ ASM_PFX(ArmPlatformInitializeBootMemory): mov r5, lr + + // // Initialize PL354 SMC + // LoadConstantToReg (ARM_VE_SMC_CTRL_BASE, r1) + + // NOR Flash 0 + LoadConstantToReg (PL354_SMC_DIRECT_CMD_ADDR_CS(0,0), r2) + blx ASM_PFX(SMCInitializeNOR) + + // NOR Flash 1 + LoadConstantToReg (PL354_SMC_DIRECT_CMD_ADDR_CS(1,0), r2) + blx ASM_PFX(SMCInitializeNOR) + + // Setup SRAM + blx ASM_PFX(SMCInitializeSRAM) + + // Memory Mapped Peripherals + blx ASM_PFX(SMCInitializePeripherals) + + // Initialize VRAM + //TODO: Check if we really must inititialize Video SRAM in UEFI. Does Linux can do it ? Does the Video driver can do it ? + // It will be faster (only initialize if required) and easier (remove assembly code because of a stack available) to move this initialization. LoadConstantToReg (VRAM_MOTHERBOARD_BASE, r2) - blx ASM_PFX(InitializeSMC) + blx ASM_PFX(SMCInitializeVRAM) + bx r5 .end diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm index 7d59f5017d..3b353558e6 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4Helper.asm @@ -15,13 +15,17 @@ #include #include #include +#include #include INCLUDE AsmMacroIoLib.inc EXPORT ArmPlatformIsMemoryInitialized EXPORT ArmPlatformInitializeBootMemory - IMPORT InitializeSMC + IMPORT SMCInitializeNOR + IMPORT SMCInitializeSRAM + IMPORT SMCInitializePeripherals + IMPORT SMCInitializeVRAM PRESERVE8 AREA CTA9x4Helper, CODE, READONLY @@ -59,10 +63,32 @@ ArmPlatformIsMemoryInitialized **/ ArmPlatformInitializeBootMemory mov r5, lr + + // // Initialize PL354 SMC + // LoadConstantToReg (ARM_VE_SMC_CTRL_BASE, r1) + + // NOR Flash 0 + mov r2, PL354_SMC_DIRECT_CMD_ADDR_CS(0,0) + blx SMCInitializeNOR + + // NOR Flash 1 + mov r2, PL354_SMC_DIRECT_CMD_ADDR_CS(1,0) + blx SMCInitializeNOR + + // Setup SRAM + blx SMCInitializeSRAM + + // Memory Mapped Peripherals + blx SMCInitializePeripherals + + // Initialize VRAM + //TODO: Check if we really must inititialize Video SRAM in UEFI. Does Linux can do it ? Does the Video driver can do it ? + // It will be faster (only initialize if required) and easier (remove assembly code because of a stack available) to move this initialization. LoadConstantToReg (VRAM_MOTHERBOARD_BASE, r2) - blx InitializeSMC + blx SMCInitializeVRAM + bx r5 - + END -- cgit v1.2.3