ArmPlatformPkg/PrePi: Removed magic values

Introduced CPSR (Coprocessor Status Register) definitions

Signed-off-by: Olivier Martin <olivier.martin@arm.com>



git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14097 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
oliviermartin 2013-01-25 12:05:17 +00:00
parent c3adcc9755
commit 063ad84e20
3 changed files with 24 additions and 7 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR> Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
Copyright (c) 2011, ARM Ltd. All rights reserved.<BR> Copyright (c) 2011-2013, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
@ -26,6 +26,21 @@
#define DOMAIN_ACCESS_CONTROL_RESERVED(a) (2UL << (2 * (a))) #define DOMAIN_ACCESS_CONTROL_RESERVED(a) (2UL << (2 * (a)))
#define DOMAIN_ACCESS_CONTROL_MANAGER(a) (3UL << (2 * (a))) #define DOMAIN_ACCESS_CONTROL_MANAGER(a) (3UL << (2 * (a)))
// CPSR - Coprocessor Status Register definitions
#define CPSR_MODE_USER 0x10
#define CPSR_MODE_FIQ 0x11
#define CPSR_MODE_IRQ 0x12
#define CPSR_MODE_SVC 0x13
#define CPSR_MODE_ABORT 0x17
#define CPSR_MODE_HYP 0x1A
#define CPSR_MODE_UNDEFINED 0x1B
#define CPSR_MODE_SYSTEM 0x1F
#define CPSR_MODE_MASK 0x1F
#define CPSR_ASYNC_ABORT (1 << 8)
#define CPSR_IRQ (1 << 7)
#define CPSR_FIQ (1 << 6)
// CPACR - Coprocessor Access Control Register definitions // CPACR - Coprocessor Access Control Register definitions
#define CPACR_CP_DENIED(cp) 0x00 #define CPACR_CP_DENIED(cp) 0x00
#define CPACR_CP_PRIV(cp) ((0x1 << ((cp) << 1)) & 0x0FFFFFFF) #define CPACR_CP_PRIV(cp) ((0x1 << ((cp) << 1)) & 0x0FFFFFFF)

View File

@ -1,5 +1,5 @@
// //
// Copyright (c) 2011-2012, ARM Limited. All rights reserved. // Copyright (c) 2011-2013, ARM Limited. All rights reserved.
// //
// This program and the accompanying materials // This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License // are licensed and made available under the terms and conditions of the BSD License
@ -16,6 +16,8 @@
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
#include <AutoGen.h> #include <AutoGen.h>
#include <Chipset/ArmV7.h>
.text .text
.align 3 .align 3
@ -35,8 +37,7 @@ ASM_PFX(_ModuleEntryPoint):
_SetSVCMode: _SetSVCMode:
// Enter SVC mode, Disable FIQ and IRQ // Enter SVC mode, Disable FIQ and IRQ
//TODO: remove hardcoded values mov r1, #(CPSR_MODE_SVC | CPSR_IRQ | CPSR_FIQ)
mov r1, #0x13|0x80|0x40
msr CPSR_c, r1 msr CPSR_c, r1
// Check if we can install the stack at the top of the System Memory or if we need // Check if we can install the stack at the top of the System Memory or if we need

View File

@ -1,5 +1,5 @@
// //
// Copyright (c) 2011-2012, ARM Limited. All rights reserved. // Copyright (c) 2011-2013, ARM Limited. All rights reserved.
// //
// This program and the accompanying materials // This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License // are licensed and made available under the terms and conditions of the BSD License
@ -16,6 +16,8 @@
#include <Library/PcdLib.h> #include <Library/PcdLib.h>
#include <AutoGen.h> #include <AutoGen.h>
#include <Chipset/ArmV7.h>
INCLUDE AsmMacroIoLib.inc INCLUDE AsmMacroIoLib.inc
IMPORT CEntryPoint IMPORT CEntryPoint
@ -37,8 +39,7 @@ _ModuleEntryPoint
_SetSVCMode _SetSVCMode
// Enter SVC mode, Disable FIQ and IRQ // Enter SVC mode, Disable FIQ and IRQ
//TODO: remove hardcoded values mov r1, #(CPSR_MODE_SVC :OR: CPSR_IRQ :OR: CPSR_FIQ)
mov r1, #0x13 :OR: 0x80 :OR: 0x40
msr CPSR_c, r1 msr CPSR_c, r1
// Check if we can install the stack at the top of the System Memory or if we need // Check if we can install the stack at the top of the System Memory or if we need