Home | History | Annotate | Line # | Download | only in fdt
cpu_fdt.c revision 1.25.4.2
      1  1.25.4.2    martin /* $NetBSD: cpu_fdt.c,v 1.25.4.2 2019/11/01 18:12:26 martin Exp $ */
      2       1.1  jmcneill 
      3       1.1  jmcneill /*-
      4       1.1  jmcneill  * Copyright (c) 2017 Jared McNeill <jmcneill (at) invisible.ca>
      5       1.1  jmcneill  * All rights reserved.
      6       1.1  jmcneill  *
      7       1.1  jmcneill  * Redistribution and use in source and binary forms, with or without
      8       1.1  jmcneill  * modification, are permitted provided that the following conditions
      9       1.1  jmcneill  * are met:
     10       1.1  jmcneill  * 1. Redistributions of source code must retain the above copyright
     11       1.1  jmcneill  *    notice, this list of conditions and the following disclaimer.
     12       1.1  jmcneill  * 2. Redistributions in binary form must reproduce the above copyright
     13       1.1  jmcneill  *    notice, this list of conditions and the following disclaimer in the
     14       1.1  jmcneill  *    documentation and/or other materials provided with the distribution.
     15       1.1  jmcneill  *
     16       1.1  jmcneill  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17       1.1  jmcneill  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18       1.1  jmcneill  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19       1.1  jmcneill  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20       1.1  jmcneill  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
     21       1.1  jmcneill  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     22       1.1  jmcneill  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
     23       1.1  jmcneill  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
     24       1.1  jmcneill  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25       1.1  jmcneill  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26       1.1  jmcneill  * SUCH DAMAGE.
     27       1.1  jmcneill  */
     28       1.1  jmcneill 
     29      1.12       ryo #include "opt_multiprocessor.h"
     30      1.12       ryo #include "psci_fdt.h"
     31      1.12       ryo 
     32       1.1  jmcneill #include <sys/cdefs.h>
     33  1.25.4.2    martin __KERNEL_RCSID(0, "$NetBSD: cpu_fdt.c,v 1.25.4.2 2019/11/01 18:12:26 martin Exp $");
     34       1.1  jmcneill 
     35       1.1  jmcneill #include <sys/param.h>
     36      1.12       ryo #include <sys/atomic.h>
     37       1.1  jmcneill #include <sys/bus.h>
     38       1.1  jmcneill #include <sys/device.h>
     39       1.4     skrll #include <sys/lwp.h>
     40       1.1  jmcneill #include <sys/systm.h>
     41       1.1  jmcneill #include <sys/kernel.h>
     42       1.1  jmcneill 
     43       1.1  jmcneill #include <dev/fdt/fdtvar.h>
     44       1.1  jmcneill 
     45       1.5       ryo #include <arm/armreg.h>
     46       1.1  jmcneill #include <arm/cpu.h>
     47       1.5       ryo #include <arm/cpufunc.h>
     48      1.12       ryo #include <arm/locore.h>
     49      1.12       ryo 
     50      1.12       ryo #include <arm/arm/psci.h>
     51      1.12       ryo #include <arm/fdt/arm_fdtvar.h>
     52      1.12       ryo #include <arm/fdt/psci_fdtvar.h>
     53      1.12       ryo 
     54      1.12       ryo #include <uvm/uvm_extern.h>
     55       1.1  jmcneill 
     56       1.1  jmcneill static int	cpu_fdt_match(device_t, cfdata_t, void *);
     57       1.1  jmcneill static void	cpu_fdt_attach(device_t, device_t, void *);
     58       1.1  jmcneill 
     59       1.3  jmcneill enum cpu_fdt_type {
     60       1.3  jmcneill 	ARM_CPU_UP = 1,
     61       1.3  jmcneill 	ARM_CPU_ARMV7,
     62       1.3  jmcneill 	ARM_CPU_ARMV8,
     63       1.3  jmcneill };
     64       1.3  jmcneill 
     65       1.1  jmcneill struct cpu_fdt_softc {
     66       1.1  jmcneill 	device_t		sc_dev;
     67       1.1  jmcneill 	int			sc_phandle;
     68       1.1  jmcneill };
     69       1.1  jmcneill 
     70       1.3  jmcneill static const struct of_compat_data compat_data[] = {
     71       1.3  jmcneill 	{ "arm,arm1176jzf-s",		ARM_CPU_UP },
     72       1.3  jmcneill 
     73       1.6  jakllsch 	{ "arm,arm-v7",			ARM_CPU_ARMV7 },
     74       1.3  jmcneill 	{ "arm,cortex-a5",		ARM_CPU_ARMV7 },
     75       1.3  jmcneill 	{ "arm,cortex-a7",		ARM_CPU_ARMV7 },
     76       1.3  jmcneill 	{ "arm,cortex-a8",		ARM_CPU_ARMV7 },
     77       1.3  jmcneill 	{ "arm,cortex-a9",		ARM_CPU_ARMV7 },
     78       1.3  jmcneill 	{ "arm,cortex-a12",		ARM_CPU_ARMV7 },
     79       1.3  jmcneill 	{ "arm,cortex-a15",		ARM_CPU_ARMV7 },
     80       1.3  jmcneill 	{ "arm,cortex-a17",		ARM_CPU_ARMV7 },
     81       1.3  jmcneill 
     82      1.11  jmcneill 	{ "arm,armv8",			ARM_CPU_ARMV8 },
     83       1.3  jmcneill 	{ "arm,cortex-a53",		ARM_CPU_ARMV8 },
     84       1.3  jmcneill 	{ "arm,cortex-a57",		ARM_CPU_ARMV8 },
     85       1.3  jmcneill 	{ "arm,cortex-a72",		ARM_CPU_ARMV8 },
     86       1.3  jmcneill 	{ "arm,cortex-a73",		ARM_CPU_ARMV8 },
     87       1.7  jmcneill 
     88       1.3  jmcneill 	{ NULL }
     89       1.3  jmcneill };
     90       1.3  jmcneill 
     91       1.1  jmcneill CFATTACH_DECL_NEW(cpu_fdt, sizeof(struct cpu_fdt_softc),
     92       1.1  jmcneill 	cpu_fdt_match, cpu_fdt_attach, NULL, NULL);
     93       1.1  jmcneill 
     94       1.1  jmcneill static int
     95       1.1  jmcneill cpu_fdt_match(device_t parent, cfdata_t cf, void *aux)
     96       1.1  jmcneill {
     97       1.1  jmcneill 	struct fdt_attach_args * const faa = aux;
     98       1.3  jmcneill 	const int phandle = faa->faa_phandle;
     99       1.3  jmcneill 	enum cpu_fdt_type type;
    100       1.2  jmcneill 	int is_compatible;
    101       1.2  jmcneill 	bus_addr_t mpidr;
    102       1.2  jmcneill 
    103       1.3  jmcneill 	is_compatible = of_match_compat_data(phandle, compat_data);
    104       1.2  jmcneill 	if (!is_compatible)
    105       1.2  jmcneill 		return 0;
    106       1.2  jmcneill 
    107       1.3  jmcneill 	type = of_search_compatible(phandle, compat_data)->data;
    108       1.3  jmcneill 	switch (type) {
    109       1.3  jmcneill 	case ARM_CPU_ARMV7:
    110       1.3  jmcneill 	case ARM_CPU_ARMV8:
    111       1.3  jmcneill 		if (fdtbus_get_reg(phandle, 0, &mpidr, NULL) != 0)
    112       1.3  jmcneill 			return 0;
    113       1.3  jmcneill 	default:
    114       1.3  jmcneill 		break;
    115       1.3  jmcneill 	}
    116       1.1  jmcneill 
    117       1.2  jmcneill 	return is_compatible;
    118       1.1  jmcneill }
    119       1.1  jmcneill 
    120       1.1  jmcneill static void
    121       1.1  jmcneill cpu_fdt_attach(device_t parent, device_t self, void *aux)
    122       1.1  jmcneill {
    123       1.1  jmcneill 	struct cpu_fdt_softc * const sc = device_private(self);
    124       1.1  jmcneill 	struct fdt_attach_args * const faa = aux;
    125       1.3  jmcneill 	const int phandle = faa->faa_phandle;
    126       1.3  jmcneill 	enum cpu_fdt_type type;
    127       1.1  jmcneill 	bus_addr_t mpidr;
    128       1.3  jmcneill 	cpuid_t cpuid;
    129       1.1  jmcneill 
    130       1.1  jmcneill 	sc->sc_dev = self;
    131       1.3  jmcneill 	sc->sc_phandle = phandle;
    132       1.3  jmcneill 
    133       1.3  jmcneill 	type = of_search_compatible(phandle, compat_data)->data;
    134       1.1  jmcneill 
    135       1.3  jmcneill 	switch (type) {
    136       1.3  jmcneill 	case ARM_CPU_ARMV7:
    137       1.3  jmcneill 	case ARM_CPU_ARMV8:
    138       1.3  jmcneill 		if (fdtbus_get_reg(phandle, 0, &mpidr, NULL) != 0) {
    139       1.3  jmcneill 			aprint_error(": missing 'reg' property\n");
    140       1.3  jmcneill 			return;
    141       1.3  jmcneill 		}
    142       1.9       ryo 		cpuid = mpidr;
    143       1.3  jmcneill 		break;
    144       1.3  jmcneill 	default:
    145       1.3  jmcneill 		cpuid = 0;
    146       1.3  jmcneill 		break;
    147       1.1  jmcneill 	}
    148       1.1  jmcneill 
    149       1.2  jmcneill 	/* Attach the CPU */
    150       1.3  jmcneill 	cpu_attach(self, cpuid);
    151       1.8  jmcneill 
    152       1.8  jmcneill 	/* Attach CPU frequency scaling provider */
    153       1.8  jmcneill 	config_found(self, faa, NULL);
    154       1.1  jmcneill }
    155      1.12       ryo 
    156      1.24  jmcneill #if defined(MULTIPROCESSOR) && (NPSCI_FDT > 0 || defined(__aarch64__))
    157      1.12       ryo static register_t
    158      1.12       ryo cpu_fdt_mpstart_pa(void)
    159      1.12       ryo {
    160      1.16     skrll 	bool ok __diagused;
    161      1.16     skrll 	paddr_t pa;
    162      1.16     skrll 
    163      1.16     skrll 	ok = pmap_extract(pmap_kernel(), (vaddr_t)cpu_mpstart, &pa);
    164      1.16     skrll 	KASSERT(ok);
    165      1.16     skrll 
    166      1.16     skrll 	return pa;
    167      1.12       ryo }
    168      1.24  jmcneill #endif
    169      1.12       ryo 
    170      1.24  jmcneill #ifdef MULTIPROCESSOR
    171      1.13  jmcneill static bool
    172      1.13  jmcneill arm_fdt_cpu_okay(const int child)
    173      1.13  jmcneill {
    174      1.13  jmcneill 	const char *s;
    175      1.13  jmcneill 
    176      1.13  jmcneill 	s = fdtbus_get_string(child, "device_type");
    177      1.13  jmcneill 	if (!s || strcmp(s, "cpu") != 0)
    178      1.13  jmcneill 		return false;
    179      1.13  jmcneill 
    180      1.13  jmcneill 	s = fdtbus_get_string(child, "status");
    181      1.13  jmcneill 	if (s) {
    182      1.13  jmcneill 		if (strcmp(s, "okay") == 0)
    183      1.13  jmcneill 			return false;
    184      1.13  jmcneill 		if (strcmp(s, "disabled") == 0)
    185      1.13  jmcneill 			return of_hasprop(child, "enable-method");
    186      1.13  jmcneill 		return false;
    187      1.13  jmcneill 	} else {
    188      1.13  jmcneill 		return true;
    189      1.13  jmcneill 	}
    190      1.13  jmcneill }
    191      1.14  jmcneill #endif /* MULTIPROCESSOR */
    192      1.12       ryo 
    193      1.12       ryo void
    194      1.12       ryo arm_fdt_cpu_bootstrap(void)
    195      1.12       ryo {
    196      1.12       ryo #ifdef MULTIPROCESSOR
    197      1.12       ryo 	uint64_t mpidr, bp_mpidr;
    198      1.12       ryo 	u_int cpuindex;
    199      1.16     skrll 	int child;
    200      1.16     skrll 
    201      1.16     skrll 	const int cpus = OF_finddevice("/cpus");
    202      1.16     skrll 	if (cpus == -1) {
    203      1.16     skrll 		aprint_error("%s: no /cpus node found\n", __func__);
    204      1.16     skrll 		arm_cpu_max = 1;
    205      1.16     skrll 		return;
    206      1.16     skrll 	}
    207      1.16     skrll 
    208      1.16     skrll 	/* Count CPUs */
    209      1.16     skrll 	arm_cpu_max = 0;
    210      1.16     skrll 
    211      1.16     skrll 	/* MPIDR affinity levels of boot processor. */
    212      1.16     skrll 	bp_mpidr = cpu_mpidr_aff_read();
    213      1.16     skrll 
    214      1.16     skrll 	/* Boot APs */
    215      1.16     skrll 	cpuindex = 1;
    216      1.16     skrll 	for (child = OF_child(cpus); child; child = OF_peer(child)) {
    217      1.16     skrll 		if (!arm_fdt_cpu_okay(child))
    218      1.16     skrll 			continue;
    219      1.16     skrll 
    220      1.16     skrll 		arm_cpu_max++;
    221      1.16     skrll 		if (fdtbus_get_reg64(child, 0, &mpidr, NULL) != 0)
    222      1.16     skrll 			continue;
    223      1.16     skrll 		if (mpidr == bp_mpidr)
    224      1.16     skrll 			continue; 	/* BP already started */
    225      1.16     skrll 
    226      1.16     skrll 		KASSERT(cpuindex < MAXCPUS);
    227      1.16     skrll 		cpu_mpidr[cpuindex] = mpidr;
    228      1.16     skrll 		cpu_dcache_wb_range((vaddr_t)&cpu_mpidr[cpuindex],
    229      1.16     skrll 		    sizeof(cpu_mpidr[cpuindex]));
    230      1.16     skrll 
    231      1.16     skrll 		cpuindex++;
    232      1.16     skrll 	}
    233      1.16     skrll #endif
    234      1.16     skrll }
    235      1.16     skrll 
    236      1.19  jmcneill #ifdef MULTIPROCESSOR
    237      1.25  jmcneill static struct arm_cpu_method *
    238      1.25  jmcneill arm_fdt_cpu_enable_method(int phandle)
    239      1.19  jmcneill {
    240      1.25  jmcneill 	const char *method;
    241      1.25  jmcneill 
    242      1.25  jmcneill  	method = fdtbus_get_string(phandle, "enable-method");
    243      1.25  jmcneill 	if (method == NULL)
    244      1.25  jmcneill 		return NULL;
    245      1.25  jmcneill 
    246      1.19  jmcneill 	__link_set_decl(arm_cpu_methods, struct arm_cpu_method);
    247      1.25  jmcneill 	struct arm_cpu_method * const *acmp;
    248      1.25  jmcneill 	__link_set_foreach(acmp, arm_cpu_methods) {
    249      1.25  jmcneill 		if (strcmp(method, (*acmp)->acm_compat) == 0)
    250      1.25  jmcneill 			return *acmp;
    251      1.19  jmcneill 	}
    252      1.25  jmcneill 
    253      1.25  jmcneill 	return NULL;
    254      1.25  jmcneill }
    255      1.25  jmcneill 
    256      1.25  jmcneill static int
    257      1.25  jmcneill arm_fdt_cpu_enable(int phandle, struct arm_cpu_method *acm)
    258      1.25  jmcneill {
    259      1.25  jmcneill 	return acm->acm_enable(phandle);
    260      1.19  jmcneill }
    261      1.19  jmcneill #endif
    262      1.19  jmcneill 
    263      1.22     skrll int
    264      1.16     skrll arm_fdt_cpu_mpstart(void)
    265      1.16     skrll {
    266      1.22     skrll 	int ret = 0;
    267      1.16     skrll #ifdef MULTIPROCESSOR
    268      1.16     skrll 	uint64_t mpidr, bp_mpidr;
    269      1.19  jmcneill 	u_int cpuindex, i;
    270      1.19  jmcneill 	int child, error;
    271      1.25  jmcneill 	struct arm_cpu_method *acm;
    272      1.12       ryo 
    273      1.12       ryo 	const int cpus = OF_finddevice("/cpus");
    274      1.12       ryo 	if (cpus == -1) {
    275      1.12       ryo 		aprint_error("%s: no /cpus node found\n", __func__);
    276      1.22     skrll 		return 0;
    277      1.12       ryo 	}
    278      1.12       ryo 
    279      1.12       ryo 	/* MPIDR affinity levels of boot processor. */
    280      1.12       ryo 	bp_mpidr = cpu_mpidr_aff_read();
    281      1.12       ryo 
    282      1.12       ryo 	/* Boot APs */
    283      1.12       ryo 	cpuindex = 1;
    284      1.12       ryo 	for (child = OF_child(cpus); child; child = OF_peer(child)) {
    285      1.13  jmcneill 		if (!arm_fdt_cpu_okay(child))
    286      1.12       ryo 			continue;
    287      1.16     skrll 
    288      1.12       ryo 		if (fdtbus_get_reg64(child, 0, &mpidr, NULL) != 0)
    289      1.12       ryo 			continue;
    290      1.18     skrll 
    291      1.12       ryo 		if (mpidr == bp_mpidr)
    292      1.12       ryo 			continue; 	/* BP already started */
    293      1.12       ryo 
    294      1.25  jmcneill 		acm = arm_fdt_cpu_enable_method(child);
    295      1.25  jmcneill 		if (acm == NULL)
    296      1.25  jmcneill 			acm = arm_fdt_cpu_enable_method(cpus);
    297      1.25  jmcneill 		if (acm == NULL)
    298      1.12       ryo 			continue;
    299      1.12       ryo 
    300      1.25  jmcneill 		error = arm_fdt_cpu_enable(child, acm);
    301      1.19  jmcneill 		if (error != 0) {
    302      1.25  jmcneill 			aprint_error("%s: failed to enable CPU %#" PRIx64 "\n", __func__, mpidr);
    303      1.12       ryo 			continue;
    304      1.12       ryo 		}
    305      1.12       ryo 
    306      1.19  jmcneill 		/* Wake up AP in case firmware has placed it in WFE state */
    307      1.19  jmcneill 		__asm __volatile("sev" ::: "memory");
    308      1.19  jmcneill 
    309      1.19  jmcneill 		/* Wait for AP to start */
    310      1.21  jmcneill 		for (i = 0x10000000; i > 0; i--) {
    311  1.25.4.1    martin 			if (cpu_hatched_p(cpuindex))
    312      1.19  jmcneill 				break;
    313      1.19  jmcneill 		}
    314      1.22     skrll 
    315      1.22     skrll 		if (i == 0) {
    316      1.22     skrll 			ret++;
    317      1.19  jmcneill 			aprint_error("cpu%d: WARNING: AP failed to start\n", cpuindex);
    318      1.22     skrll 		}
    319      1.19  jmcneill 
    320      1.12       ryo 		cpuindex++;
    321      1.12       ryo 	}
    322      1.19  jmcneill #endif /* MULTIPROCESSOR */
    323      1.22     skrll 	return ret;
    324      1.19  jmcneill }
    325      1.12       ryo 
    326      1.19  jmcneill static int
    327      1.19  jmcneill cpu_enable_nullop(int phandle)
    328      1.19  jmcneill {
    329      1.19  jmcneill 	return ENXIO;
    330      1.19  jmcneill }
    331      1.19  jmcneill ARM_CPU_METHOD(default, "", cpu_enable_nullop);
    332      1.12       ryo 
    333      1.19  jmcneill #if defined(MULTIPROCESSOR) && NPSCI_FDT > 0
    334      1.19  jmcneill static int
    335      1.19  jmcneill cpu_enable_psci(int phandle)
    336      1.19  jmcneill {
    337      1.19  jmcneill 	static bool psci_probed, psci_p;
    338      1.19  jmcneill 	uint64_t mpidr;
    339      1.19  jmcneill 	int ret;
    340      1.19  jmcneill 
    341      1.19  jmcneill 	if (!psci_probed) {
    342      1.19  jmcneill 		psci_probed = true;
    343      1.19  jmcneill 		psci_p = psci_fdt_preinit() == 0;
    344      1.12       ryo 	}
    345      1.19  jmcneill 	if (!psci_p)
    346      1.19  jmcneill 		return ENXIO;
    347      1.19  jmcneill 
    348      1.19  jmcneill 	fdtbus_get_reg64(phandle, 0, &mpidr, NULL);
    349      1.19  jmcneill 
    350  1.25.4.2    martin #if !defined(AARCH64)
    351  1.25.4.2    martin 	/*
    352  1.25.4.2    martin 	 * not necessary on AARCH64. beside there it hangs the system
    353  1.25.4.2    martin 	 * because cache ops are only functional after cpu_attach()
    354  1.25.4.2    martin 	 * was called.
    355  1.25.4.2    martin 	 */
    356  1.25.4.2    martin 	cpu_dcache_wbinv_all();
    357  1.25.4.2    martin #endif
    358      1.19  jmcneill 	ret = psci_cpu_on(mpidr, cpu_fdt_mpstart_pa(), 0);
    359      1.19  jmcneill 	if (ret != PSCI_SUCCESS)
    360      1.19  jmcneill 		return EIO;
    361      1.19  jmcneill 
    362      1.19  jmcneill 	return 0;
    363      1.19  jmcneill }
    364      1.19  jmcneill ARM_CPU_METHOD(psci, "psci", cpu_enable_psci);
    365      1.19  jmcneill #endif
    366      1.19  jmcneill 
    367      1.23  jmcneill #if defined(MULTIPROCESSOR) && defined(__aarch64__)
    368      1.23  jmcneill static int
    369      1.23  jmcneill spintable_cpu_on(u_int cpuindex, paddr_t entry_point_address, paddr_t cpu_release_addr)
    370      1.23  jmcneill {
    371      1.23  jmcneill 	/*
    372      1.23  jmcneill 	 * we need devmap for cpu-release-addr in advance.
    373      1.23  jmcneill 	 * __HAVE_MM_MD_DIRECT_MAPPED_PHYS nor pmap didn't work at this point.
    374      1.23  jmcneill 	 */
    375      1.23  jmcneill 	if (pmap_devmap_find_pa(cpu_release_addr, sizeof(paddr_t)) == NULL) {
    376      1.23  jmcneill 		aprint_error("%s: devmap for cpu-release-addr"
    377      1.23  jmcneill 		    " 0x%08"PRIxPADDR" required\n", __func__, cpu_release_addr);
    378      1.23  jmcneill 		return -1;
    379      1.23  jmcneill 	} else {
    380      1.23  jmcneill 		extern struct bus_space arm_generic_bs_tag;
    381      1.23  jmcneill 		bus_space_handle_t ioh;
    382      1.23  jmcneill 
    383      1.23  jmcneill 		bus_space_map(&arm_generic_bs_tag, cpu_release_addr,
    384      1.23  jmcneill 		    sizeof(paddr_t), 0, &ioh);
    385      1.23  jmcneill 		bus_space_write_4(&arm_generic_bs_tag, ioh, 0,
    386      1.23  jmcneill 		    entry_point_address);
    387      1.23  jmcneill 		bus_space_unmap(&arm_generic_bs_tag, ioh, sizeof(paddr_t));
    388      1.23  jmcneill 	}
    389      1.23  jmcneill 
    390      1.23  jmcneill 	return 0;
    391      1.23  jmcneill }
    392      1.23  jmcneill 
    393      1.19  jmcneill static int
    394      1.19  jmcneill cpu_enable_spin_table(int phandle)
    395      1.19  jmcneill {
    396      1.20  jmcneill 	uint64_t mpidr, addr;
    397      1.19  jmcneill 	int ret;
    398      1.19  jmcneill 
    399      1.19  jmcneill 	fdtbus_get_reg64(phandle, 0, &mpidr, NULL);
    400      1.19  jmcneill 
    401      1.20  jmcneill 	if (of_getprop_uint64(phandle, "cpu-release-addr", &addr) != 0)
    402      1.19  jmcneill 		return ENXIO;
    403      1.19  jmcneill 
    404      1.20  jmcneill 	ret = spintable_cpu_on(mpidr, cpu_fdt_mpstart_pa(), (paddr_t)addr);
    405      1.19  jmcneill 	if (ret != 0)
    406      1.19  jmcneill 		return EIO;
    407      1.19  jmcneill 
    408      1.19  jmcneill 	return 0;
    409      1.12       ryo }
    410      1.19  jmcneill ARM_CPU_METHOD(spin_table, "spin-table", cpu_enable_spin_table);
    411      1.19  jmcneill #endif
    412