Lines Matching +full:cpu +full:- +full:offset

1 // SPDX-License-Identifier: GPL-2.0
22 * The amp image with FIT format which consists of non-linux firmwares.
23 * Please refer to: driver/cpu/amp.its.
25 * amp.img generation: ./tools/mkimage -f drivers/cpu/amp.its -E -p 0xe00 amp.img
32 * description, arch, cpu, thumb, hyp, udelay(optional) properties.
33 * The addresses depend on U-Boot: kernel_addr_r, fdt_addr_r and
34 * ramdisk_addr_r. Please refer to: driver/cpu/amp.its.
37 * U-Boot is not responsible for memory distribution/fixup any more, please
47 #define gicd_readl(offset) readl((void *)GICD_BASE + (offset)) argument
48 #define gicd_writel(v, offset) writel(v, (void *)GICD_BASE + (offset)) argument
49 #define LINXU_AMP_NODES "/rockchip-amp/amp-cpus"
82 const void *fdt = gd->fdt_blob; in parse_cpus_boot_by_linux()
83 int noffset, cpu, i = 0; in parse_cpus_boot_by_linux() local
91 fdt_for_each_subnode(cpu, fdt, noffset) { in parse_cpus_boot_by_linux()
92 mpidr = fdtdec_get_uint64(fdt, cpu, "id", 0xffffffff); in parse_cpus_boot_by_linux()
96 printf("CPU[0x%llx] is required boot by Linux\n", mpidr); in parse_cpus_boot_by_linux()
102 static int load_linux_for_nonboot_cpu(u32 cpu, u32 aarch64, u32 load, in load_linux_for_nonboot_cpu() argument
123 args->arg0 = (ulong)gd->fdt_blob; in load_linux_for_nonboot_cpu()
124 args->arg1 = 0; in load_linux_for_nonboot_cpu()
125 args->arg2 = 0; in load_linux_for_nonboot_cpu()
127 args->arg0 = 0; in load_linux_for_nonboot_cpu()
128 args->arg1 = 0; in load_linux_for_nonboot_cpu()
129 args->arg2 = (ulong)gd->fdt_blob; in load_linux_for_nonboot_cpu()
132 /* don't need call cleanup_before_linux() as this nonboot cpu is clean */ in load_linux_for_nonboot_cpu()
136 /* fixup: ramdisk/fdt/entry depend on U-Boot */ in load_linux_for_nonboot_cpu()
153 u32 val, num_irq, offset; in setup_sync_bits_for_linux() local
160 offset = ((num_irq - 1) / 4) * 4; in setup_sync_bits_for_linux()
161 gicd_writel(0x0, GICD_IPRIORITYRn + offset); in setup_sync_bits_for_linux()
164 static int smc_cpu_on(u32 cpu, u32 pe_state, u32 entry, in smc_cpu_on() argument
169 AMP_I("Brought up cpu[%x] with state 0x%x, entry 0x%08x ...", in smc_cpu_on()
170 cpu, pe_state, entry); in smc_cpu_on()
172 /* if target pe state is default arch state, power up cpu directly */ in smc_cpu_on()
176 ret = sip_smc_amp_cfg(AMP_PE_STATE, cpu, pe_state, 0); in smc_cpu_on()
178 AMP_E("smc pe-state, ret=%d\n", ret); in smc_cpu_on()
186 ret = sip_smc_amp_cfg(AMP_BOOT_ARG01, cpu, args->arg0, args->arg1); in smc_cpu_on()
192 ret = sip_smc_amp_cfg(AMP_BOOT_ARG23, cpu, args->arg2, args->arg3); in smc_cpu_on()
199 ret = psci_cpu_on(cpu, entry); in smc_cpu_on()
201 printf("cpu up failed, ret=%d\n", ret); in smc_cpu_on()
220 return -ENXIO; in standalone_handler()
239 u32 cpu, aarch64, hyp; in brought_up_amp() local
245 u8 type = -ENODATA; in brought_up_amp()
246 u8 arch = -ENODATA; in brought_up_amp()
249 cpu = fit_get_u32_default(fit, noffset, "cpu", -ENODATA); in brought_up_amp()
252 entry = load = fit_get_u32_default(fit, noffset, "load", -ENODATA); in brought_up_amp()
254 boot_on = fit_get_u32_default(fit, noffset, "boot-on", 1); in brought_up_amp()
262 if (!desc || load == -ENODATA) { in brought_up_amp()
270 if (!desc || cpu == -ENODATA || arch == -ENODATA || type == -ENODATA || in brought_up_amp()
271 (load == -ENODATA && !is_linux)) { in brought_up_amp()
273 return -EINVAL; in brought_up_amp()
280 AMP_I(" cpu: 0x%x\n", cpu); in brought_up_amp()
286 AMP_I(" linux-os: %d\n\n", is_linux); in brought_up_amp()
289 /* this cpu is boot cpu ? */ in brought_up_amp()
290 if ((read_mpidr() & 0x0fff) == cpu) { in brought_up_amp()
291 bootcpu->arch = arch; in brought_up_amp()
292 bootcpu->entry = entry; in brought_up_amp()
293 bootcpu->state = pe_state; in brought_up_amp()
294 bootcpu->linux_os = is_linux; in brought_up_amp()
298 /* === only nonboot cpu can reach here === */ in brought_up_amp()
302 ret = load_linux_for_nonboot_cpu(cpu, in brought_up_amp()
315 return -ENXIO; in brought_up_amp()
318 /* If linux assign the boot-on state, use it */ in brought_up_amp()
320 if (cpu == g_cpus_boot_by_linux[i]) { in brought_up_amp()
330 ret = smc_cpu_on(cpu, pe_state, entry, &args, is_linux); in brought_up_amp()
373 /* === only boot cpu can reach here === */ in brought_up_all_amp()
377 AMP_I("Brought up cpu[%x, self] with state 0x%x, entry 0x%08x ...", in brought_up_all_amp()
392 /* return: boot cpu continue to boot linux */ in brought_up_all_amp()
402 int offset, cnt; in amp_cpus_on() local
408 return -EIO; in amp_cpus_on()
411 return -ENODEV; in amp_cpus_on()
415 return -ENOMEM; in amp_cpus_on()
418 offset = part.start; in amp_cpus_on()
420 if (blk_dread(dev_desc, offset, cnt, hdr) != cnt) { in amp_cpus_on()
421 ret = -EIO; in amp_cpus_on()
427 ret = -EINVAL; in amp_cpus_on()
433 ret = -EINVAL; in amp_cpus_on()
441 ret = -ENOMEM; in amp_cpus_on()
447 offset += cnt; in amp_cpus_on()
448 cnt = DIV_ROUND_UP(totalsize, part.blksz) - cnt; in amp_cpus_on()
449 if (blk_dread(dev_desc, offset, cnt, fit + FIT_HEADER_SIZE) != cnt) { in amp_cpus_on()
450 ret = -EIO; in amp_cpus_on()
483 images->os.arch = g_bootcpu.arch; in arm64_switch_amp_pe()