1/* 2 * Copyright (c) 2013, Google Inc. All rights reserved. 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining 5 * a copy of this software and associated documentation files 6 * (the "Software"), to deal in the Software without restriction, 7 * including without limitation the rights to use, copy, modify, merge, 8 * publish, distribute, sublicense, and/or sell copies of the Software, 9 * and to permit persons to whom the Software is furnished to do so, 10 * subject to the following conditions: 11 * 12 * The above copyright notice and this permission notice shall be 13 * included in all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 21 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 */ 23 24#include <asm.h> 25#include <platform/vexpress-a15.h> 26#include <platform/gic.h> 27#if WITH_LIB_SM 28#include <lib/sm/monitor.h> 29#endif 30 31#define GICC_CTLR (0x0000) 32#define GICC_IAR (0x000c) 33#define GICC_EOIR (0x0010) 34 35.section ".text" 36 37FUNCTION(platform_secondary_entry) 38 /* clear wakeup sgi */ 39 ldr r4, =GICBASE(0) + GICC_OFFSET 40 ldr r5, [r4, #GICC_IAR] 41 str r5, [r4, #GICC_EOIR] 42 43 b _start 44 45 46#if WITH_LIB_SM 47 48FUNCTION(platform_mon_initial_ns_return) 49 /* figure out our cpu number */ 50 mrc p15, 0, ip, c0, c0, 5 /* read MPIDR */ 51 52 /* mask off the bottom 12 bits to test cluster number:cpu number */ 53 ubfx ip, ip, #0, #12 54 55 /* if we're not cpu 0:0, wait for ns reset addr */ 56 cmp ip, #0 57 moveq lr, #~0 58 beq mon_initial_ns_return 59 60 ldr r4, =SECONDARY_BOOT_ADDR 61 ldr r5, =platform_secondary_entry_paddr 62 ldr r5, [r5] 63 dsb 641: 65 wfi 66 ldr lr, [r4] 67 cmp lr, r5 68 beq 1b 69 tst lr, lr 70 beq 1b 71 72 b mon_initial_ns_return 73#endif 74 75.ltorg 76 77