Yatharth Kochar | 71c9a5e | 2015-10-10 19:06:53 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015, ARM Limited and Contributors. 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 __BL1_FWU_H__ |
| 32 | #define __BL1_FWU_H__ |
| 33 | |
| 34 | #include <bl_common.h> |
| 35 | |
| 36 | /* |
| 37 | * Defines for BL1 SMC function ids. |
| 38 | */ |
| 39 | #define BL1_SMC_CALL_COUNT 0x0 |
| 40 | #define BL1_SMC_UID 0x1 |
| 41 | /* SMC #0x2 reserved */ |
| 42 | #define BL1_SMC_VERSION 0x3 |
| 43 | |
| 44 | /* |
| 45 | * Corresponds to the function ID of the SMC that |
| 46 | * the BL1 exception handler service to execute BL31. |
| 47 | */ |
| 48 | #define BL1_SMC_RUN_IMAGE 0x4 |
| 49 | |
| 50 | /* |
| 51 | * BL1 SMC version |
| 52 | */ |
| 53 | #define BL1_SMC_MAJOR_VER 0x0 |
| 54 | #define BL1_SMC_MINOR_VER 0x1 |
| 55 | |
| 56 | /* |
| 57 | * Defines for FWU SMC function ids. |
| 58 | */ |
| 59 | |
| 60 | #define FWU_SMC_IMAGE_COPY 0x10 |
| 61 | #define FWU_SMC_IMAGE_AUTH 0x11 |
| 62 | #define FWU_SMC_IMAGE_EXECUTE 0x12 |
| 63 | #define FWU_SMC_IMAGE_RESUME 0x13 |
| 64 | #define FWU_SMC_SEC_IMAGE_DONE 0x14 |
| 65 | #define FWU_SMC_UPDATE_DONE 0x15 |
| 66 | |
| 67 | /* |
| 68 | * Number of FWU calls (above) implemented |
| 69 | */ |
| 70 | #define FWU_NUM_SMC_CALLS 6 |
| 71 | |
| 72 | #if TRUSTED_BOARD_BOOT |
| 73 | # define BL1_NUM_SMC_CALLS (FWU_NUM_SMC_CALLS + 4) |
| 74 | #else |
| 75 | # define BL1_NUM_SMC_CALLS 4 |
| 76 | #endif |
| 77 | |
| 78 | /* |
| 79 | * The macros below are used to identify FWU |
| 80 | * calls from the SMC function ID |
| 81 | */ |
| 82 | #define FWU_SMC_FID_START FWU_SMC_IMAGE_COPY |
| 83 | #define FWU_SMC_FID_END FWU_SMC_UPDATE_DONE |
| 84 | #define is_fwu_fid(_fid) \ |
| 85 | ((_fid >= FWU_SMC_FID_START) && (_fid <= FWU_SMC_FID_END)) |
| 86 | |
| 87 | #ifndef __ASSEMBLY__ |
| 88 | #include <cassert.h> |
| 89 | |
| 90 | /* |
| 91 | * Check if the total number of FWU SMC calls are as expected. |
| 92 | */ |
| 93 | CASSERT(FWU_NUM_SMC_CALLS == \ |
| 94 | (FWU_SMC_FID_END - FWU_SMC_FID_START + 1),\ |
| 95 | assert_FWU_NUM_SMC_CALLS_mismatch); |
| 96 | |
| 97 | #endif /* __ASSEMBLY__ */ |
| 98 | #endif /* __BL1_FWU_H__ */ |