1239281Sgonzo/*- 2239281Sgonzo * Copyright (c) 2012 Olivier Houchard. All rights reserved. 3239281Sgonzo * 4239281Sgonzo * Redistribution and use in source and binary forms, with or without 5239281Sgonzo * modification, are permitted provided that the following conditions 6239281Sgonzo * are met: 7239281Sgonzo * 1. Redistributions of source code must retain the above copyright 8239281Sgonzo * notice, this list of conditions and the following disclaimer. 9239281Sgonzo * 2. Redistributions in binary form must reproduce the above copyright 10239281Sgonzo * notice, this list of conditions and the following disclaimer in the 11239281Sgonzo * documentation and/or other materials provided with the distribution. 12239281Sgonzo * 13239281Sgonzo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 14239281Sgonzo * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 15239281Sgonzo * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 16239281Sgonzo * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17239281Sgonzo * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18239281Sgonzo * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 19239281Sgonzo * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 20239281Sgonzo * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21239281Sgonzo * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22239281Sgonzo * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23239281Sgonzo */ 24239281Sgonzo 25239281Sgonzo#include <sys/cdefs.h> 26239281Sgonzo__FBSDID("$FreeBSD: releng/11.0/sys/arm/ti/omap4/omap4_mp.c 296100 2016-02-26 16:04:47Z andrew $"); 27239281Sgonzo#include <sys/param.h> 28239281Sgonzo#include <sys/systm.h> 29239281Sgonzo#include <sys/bus.h> 30239281Sgonzo#include <sys/lock.h> 31239281Sgonzo#include <sys/mutex.h> 32239281Sgonzo#include <sys/smp.h> 33239281Sgonzo 34281092Sandrew#include <vm/vm.h> 35281092Sandrew#include <vm/pmap.h> 36281092Sandrew 37295319Smmel#include <machine/cpu.h> 38239281Sgonzo#include <machine/smp.h> 39239281Sgonzo#include <machine/fdt.h> 40239281Sgonzo#include <machine/intr.h> 41239281Sgonzo 42239281Sgonzo#include <arm/ti/ti_smc.h> 43239281Sgonzo#include <arm/ti/omap4/omap4_smc.h> 44239281Sgonzo 45239281Sgonzovoid 46239281Sgonzoplatform_mp_setmaxid(void) 47239281Sgonzo{ 48239281Sgonzo 49290547Stijl mp_maxid = 1; 50290547Stijl mp_ncpus = 2; 51239281Sgonzo} 52239281Sgonzo 53239281Sgonzovoid 54239281Sgonzoplatform_mp_start_ap(void) 55239281Sgonzo{ 56239281Sgonzo bus_addr_t scu_addr; 57239281Sgonzo 58239281Sgonzo if (bus_space_map(fdtbus_bs_tag, 0x48240000, 0x1000, 0, &scu_addr) != 0) 59239281Sgonzo panic("Couldn't map the SCU\n"); 60239281Sgonzo /* Enable the SCU */ 61239281Sgonzo *(volatile unsigned int *)scu_addr |= 1; 62239281Sgonzo //*(volatile unsigned int *)(scu_addr + 0x30) |= 1; 63295319Smmel dcache_wbinv_poc_all(); 64295319Smmel 65239281Sgonzo ti_smc0(0x200, 0xfffffdff, MODIFY_AUX_CORE_0); 66242362Scognet ti_smc0(pmap_kextract((vm_offset_t)mpentry), 0, WRITE_AUX_CORE_1); 67239281Sgonzo armv7_sev(); 68239281Sgonzo bus_space_unmap(fdtbus_bs_tag, scu_addr, 0x1000); 69239281Sgonzo} 70