1265694Sian/*-
2265694Sian * Copyright 2011 Semihalf
3265694Sian * All rights reserved.
4265694Sian *
5265694Sian * Redistribution and use in source and binary forms, with or without
6265694Sian * modification, are permitted provided that the following conditions
7265694Sian * are met:
8265694Sian * 1. Redistributions of source code must retain the above copyright
9265694Sian *    notice, this list of conditions and the following disclaimer.
10265694Sian * 2. Redistributions in binary form must reproduce the above copyright
11265694Sian *    notice, this list of conditions and the following disclaimer in the
12265694Sian *    documentation and/or other materials provided with the distribution.
13265694Sian *
14265694Sian * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15265694Sian * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16265694Sian * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17265694Sian * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18265694Sian * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19265694Sian * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20265694Sian * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21265694Sian * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22265694Sian * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23265694Sian * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24265694Sian * SUCH DAMAGE.
25265694Sian */
26265694Sian
27265694Sian#include <machine/asm.h>
28265694Sian#include <machine/armreg.h>
29265694Sian
30265694Sian__FBSDID("$FreeBSD$");
31265694Sian
32267130Szbb.global _C_LABEL(mptramp_pmu_boot)
33267130Szbb
34265694SianASENTRY_NP(mptramp)
35265694Sian	mov	r0, #0
36265694Sian	mcr	p15, 0, r0, c7, c7, 0
37265694Sian
38265694Sian	mrs	r3, cpsr
39265694Sian	bic	r3, r3, #(PSR_MODE)
40265694Sian	orr	r3, r3, #(PSR_SVC32_MODE)
41265694Sian        msr	cpsr_fsxc, r3
42265694Sian
43265694Sian	mrc	p15, 0, r0, c0, c0, 5
44265694Sian	and	r0, #0x0f		/* Get CPU ID */
45265694Sian
46265694Sian	/* Read boot address for CPU */
47265694Sian	mov	r1, #0x100
48265694Sian	mul	r2, r0, r1
49267130Szbb	ldr	r1, mptramp_pmu_boot
50265694Sian	add	r0, r2, r1
51265694Sian	ldr	r1, [r0], #0x00
52265694Sian
53265694Sian	mov pc, r1
54265694Sian
55267130Szbb_C_LABEL(mptramp_pmu_boot):
56267130Szbb	.word 0x0
57267130Szbb
58265694SianEND(mptramp)
59265694Sian
60267129Szbb	.global _C_LABEL(mptramp_end)
61267129Szbb_C_LABEL(mptramp_end):
62