Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013, ARM Limited. All rights reserved. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions are met: |
| 6 | * |
| 7 | * Redistributions of source code must retain the above copyright notice, this |
| 8 | * list of conditions and the following disclaimer. |
| 9 | * |
| 10 | * Redistributions in binary form must reproduce the above copyright notice, |
| 11 | * this list of conditions and the following disclaimer in the documentation |
| 12 | * and/or other materials provided with the distribution. |
| 13 | * |
| 14 | * Neither the name of ARM nor the names of its contributors may be used |
| 15 | * to endorse or promote products derived from this software without specific |
| 16 | * prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| 19 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
| 22 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 23 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 24 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 25 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | * POSSIBILITY OF SUCH DAMAGE. |
| 29 | */ |
| 30 | |
| 31 | #ifndef __RUNTIME_SVC_H__ |
| 32 | #define __RUNTIME_SVC_H__ |
| 33 | #include <psci.h> |
| 34 | |
| 35 | /******************************************************************************* |
| 36 | * Bit definitions inside the function id as per the SMC calling convention |
| 37 | ******************************************************************************/ |
| 38 | #define FUNCID_TYPE_SHIFT 31 |
| 39 | #define FUNCID_CC_SHIFT 30 |
| 40 | #define FUNCID_OWNER_SHIFT 24 |
| 41 | #define FUNCID_NUM_SHIFT 0 |
| 42 | |
| 43 | #define FUNCID_TYPE_MASK 0x1 |
| 44 | #define FUNCID_CC_MASK 0x1 |
| 45 | #define FUNCID_OWNER_MASK 0x3f |
| 46 | #define FUNCID_NUM_MASK 0xffff |
| 47 | |
| 48 | #define GET_SMC_CC(id) ((id >> FUNCID_CC_SHIFT) & \ |
| 49 | FUNCID_CC_MASK) |
| 50 | |
| 51 | #define SMC_64 1 |
| 52 | #define SMC_32 0 |
| 53 | #define SMC_UNK 0xffffffff |
| 54 | |
| 55 | /******************************************************************************* |
| 56 | * Constants to indicate type of exception to the common exception handler. |
| 57 | ******************************************************************************/ |
| 58 | #define SYNC_EXCEPTION_SP_EL0 0x0 |
| 59 | #define IRQ_SP_EL0 0x1 |
| 60 | #define FIQ_SP_EL0 0x2 |
| 61 | #define SERROR_SP_EL0 0x3 |
| 62 | #define SYNC_EXCEPTION_SP_ELX 0x4 |
| 63 | #define IRQ_SP_ELX 0x5 |
| 64 | #define FIQ_SP_ELX 0x6 |
| 65 | #define SERROR_SP_ELX 0x7 |
| 66 | #define SYNC_EXCEPTION_AARCH64 0x8 |
| 67 | #define IRQ_AARCH64 0x9 |
| 68 | #define FIQ_AARCH64 0xa |
| 69 | #define SERROR_AARCH64 0xb |
| 70 | #define SYNC_EXCEPTION_AARCH32 0xc |
| 71 | #define IRQ_AARCH32 0xd |
| 72 | #define FIQ_AARCH32 0xe |
| 73 | #define SERROR_AARCH32 0xf |
| 74 | |
| 75 | #ifndef __ASSEMBLY__ |
| 76 | |
| 77 | typedef struct { |
| 78 | unsigned long x0; |
| 79 | unsigned long x1; |
| 80 | unsigned long x2; |
| 81 | unsigned long x3; |
| 82 | unsigned long x4; |
| 83 | unsigned long x5; |
| 84 | unsigned long x6; |
| 85 | unsigned long x7; |
| 86 | unsigned long x8; |
| 87 | unsigned long x9; |
| 88 | unsigned long x10; |
| 89 | unsigned long x11; |
| 90 | unsigned long x12; |
| 91 | unsigned long x13; |
| 92 | unsigned long x14; |
| 93 | unsigned long x15; |
| 94 | unsigned long x16; |
| 95 | unsigned long x17; |
| 96 | unsigned long x18; |
| 97 | unsigned long x19; |
| 98 | unsigned long x20; |
| 99 | unsigned long x21; |
| 100 | unsigned long x22; |
| 101 | unsigned long x23; |
| 102 | unsigned long x24; |
| 103 | unsigned long x25; |
| 104 | unsigned long x26; |
| 105 | unsigned long x27; |
| 106 | unsigned long x28; |
| 107 | unsigned long sp_el0; |
| 108 | unsigned long spsr; |
| 109 | unsigned long fp; |
| 110 | unsigned long lr; |
| 111 | } gp_regs; |
| 112 | |
| 113 | |
| 114 | /******************************************************************************* |
| 115 | * Function & variable prototypes |
| 116 | ******************************************************************************/ |
| 117 | extern void runtime_svc_init(unsigned long mpidr); |
| 118 | |
| 119 | #endif /*__ASSEMBLY__*/ |
| 120 | |
| 121 | |
| 122 | #endif /* __RUNTIME_SVC_H__ */ |