imx6_mp.c (266203) | imx6_mp.c (266274) |
---|---|
1/*- 2 * Copyright (c) 2014 Juergen Weiss <weiss@uni-mainz.de> 3 * Copyright (c) 2014 Ian Lepore <ian@freebsd.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2014 Juergen Weiss <weiss@uni-mainz.de> 3 * Copyright (c) 2014 Ian Lepore <ian@freebsd.org> 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: stable/10/sys/arm/freescale/imx/imx6_mp.c 266203 2014-05-16 00:14:50Z ian $"); | 28__FBSDID("$FreeBSD: stable/10/sys/arm/freescale/imx/imx6_mp.c 266274 2014-05-16 23:27:18Z ian $"); |
29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/bus.h> | 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/bus.h> |
32#include <sys/kernel.h> |
|
32#include <sys/lock.h> 33#include <sys/mutex.h> 34#include <sys/smp.h> 35 36#include <machine/smp.h> 37#include <machine/fdt.h> 38#include <machine/intr.h> 39 --- 27 unchanged lines hidden (view full) --- 67 68 gic_init_secondary(); 69} 70 71void 72platform_mp_setmaxid(void) 73{ 74 bus_space_handle_t scu; | 33#include <sys/lock.h> 34#include <sys/mutex.h> 35#include <sys/smp.h> 36 37#include <machine/smp.h> 38#include <machine/fdt.h> 39#include <machine/intr.h> 40 --- 27 unchanged lines hidden (view full) --- 68 69 gic_init_secondary(); 70} 71 72void 73platform_mp_setmaxid(void) 74{ 75 bus_space_handle_t scu; |
76 int hwcpu, ncpu; |
|
75 uint32_t val; 76 77 /* If we've already set the global vars don't bother to do it again. */ 78 if (mp_ncpus != 0) 79 return; 80 81 if (bus_space_map(fdtbus_bs_tag, SCU_PHYSBASE, SCU_SIZE, 0, &scu) != 0) 82 panic("Couldn't map the SCU\n"); 83 val = bus_space_read_4(fdtbus_bs_tag, scu, SCU_CONFIG_REG); | 77 uint32_t val; 78 79 /* If we've already set the global vars don't bother to do it again. */ 80 if (mp_ncpus != 0) 81 return; 82 83 if (bus_space_map(fdtbus_bs_tag, SCU_PHYSBASE, SCU_SIZE, 0, &scu) != 0) 84 panic("Couldn't map the SCU\n"); 85 val = bus_space_read_4(fdtbus_bs_tag, scu, SCU_CONFIG_REG); |
86 hwcpu = (val & SCU_CONFIG_REG_NCPU_MASK) + 1; |
|
84 bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE); 85 | 87 bus_space_unmap(fdtbus_bs_tag, scu, SCU_SIZE); 88 |
86 mp_maxid = (val & SCU_CONFIG_REG_NCPU_MASK); 87 mp_ncpus = mp_maxid + 1; | 89 ncpu = hwcpu; 90 TUNABLE_INT_FETCH("hw.ncpu", &ncpu); 91 if (ncpu < 1 || ncpu > hwcpu) 92 ncpu = hwcpu; 93 94 mp_ncpus = ncpu; 95 mp_maxid = ncpu - 1; |
88} 89 90int 91platform_mp_probe(void) 92{ 93 94 /* I think platform_mp_setmaxid must get called first, but be safe. */ 95 if (mp_ncpus == 0) --- 75 unchanged lines hidden --- | 96} 97 98int 99platform_mp_probe(void) 100{ 101 102 /* I think platform_mp_setmaxid must get called first, but be safe. */ 103 if (mp_ncpus == 0) --- 75 unchanged lines hidden --- |