]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - sys/arm/ti/omap4/omap4_mp.c
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / sys / arm / ti / omap4 / omap4_mp.c
1 /*-
2  * Copyright (c) 2012 Olivier Houchard.  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
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
15  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
16  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
19  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
20  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  */
24
25 #include <sys/cdefs.h>
26 __FBSDID("$FreeBSD$");
27 #include <sys/param.h>
28 #include <sys/systm.h>
29 #include <sys/bus.h>
30 #include <sys/lock.h>
31 #include <sys/mutex.h>
32 #include <sys/smp.h>
33
34 #include <machine/smp.h>
35 #include <machine/fdt.h>
36 #include <machine/intr.h>
37
38 #include <arm/ti/ti_smc.h>
39 #include <arm/ti/omap4/omap4_smc.h>
40
41 void
42 platform_mp_init_secondary(void)
43 {
44         gic_init_secondary();
45 }
46
47 void
48 platform_mp_setmaxid(void)
49 {
50
51         mp_maxid = 1;
52 }
53
54 int
55 platform_mp_probe(void)
56 {
57
58         mp_ncpus = 2;
59         return (1);
60 }
61
62 void    
63 platform_mp_start_ap(void)
64 {
65         bus_addr_t scu_addr;
66
67         if (bus_space_map(fdtbus_bs_tag, 0x48240000, 0x1000, 0, &scu_addr) != 0)
68                 panic("Couldn't map the SCU\n");
69         /* Enable the SCU */
70         *(volatile unsigned int *)scu_addr |= 1;
71         //*(volatile unsigned int *)(scu_addr + 0x30) |= 1;
72         cpu_idcache_wbinv_all();
73         cpu_l2cache_wbinv_all();
74         ti_smc0(0x200, 0xfffffdff, MODIFY_AUX_CORE_0);
75         ti_smc0(pmap_kextract((vm_offset_t)mpentry), 0, WRITE_AUX_CORE_1);
76         armv7_sev();
77         bus_space_unmap(fdtbus_bs_tag, scu_addr, 0x1000);
78 }
79
80 void
81 platform_ipi_send(cpuset_t cpus, u_int ipi)
82 {
83         pic_ipi_send(cpus, ipi);
84 }