Skip to contentSkip to conversation

ARMv8/fsl-lsch3: Refactor spin-table code

PATCH Superseded Arnab Basu 1 participant 1 message Jan 12, 2015 Arm (32-bit)

lore
Share & tools
lore

Arnab Basu

author
#0 lore raw

PATCH v2 3/9 ARMv8/fsl-lsch3: Refactor spin-table code

This creates the function cpu_update_dt for ARMv8 which currently patches the cpu node in the device table and sets enable-method to spin-table.

Cc Bhupesh Sharma <[email protected]>
Cc York Sun <[email protected]>
---
 arch/arm/cpu/armv8/Makefile                      |  1 +
 arch/arm/cpu/armv8/{fsl-lsch3/fdt.c => cpu-dt.c} | 32 +++++++++-------
 arch/arm/cpu/armv8/fsl-lsch3/fdt.c               | 48 ++++++++----------------
 3 files changed, 36 insertions(+), 45 deletions(-)
 copy arch/arm/cpu/armv8/{fsl-lsch3/fdt.c => cpu-dt.c} (68%)
arch/arm/cpu/armv8/Makefile +1 -0
index 0c10223..74c32b2 100644
@@ -14,5 +14,6 @@ obj-y	+= exceptions.o
 obj-y	+= cache.o
 obj-y	+= tlb.o
 obj-y	+= transition.o
+obj-y	+= cpu-dt.o
 
 obj-$(CONFIG_FSL_LSCH3) += fsl-lsch3/
arch/arm/cpu/armv8/cpu-dt.c renamed from arch/arm/cpu/armv8/fsl-lsch3/fdt.c +19 -13
similarity index 68%
copy from arch/arm/cpu/armv8/fsl-lsch3/fdt.c
copy to arch/arm/cpu/armv8/cpu-dt.c
index e392eb9..8833e6a 100644
@@ -7,17 +7,24 @@
 #include <common.h>
 #include <libfdt.h>
 #include <fdt_support.h>
-#include "mp.h"
 
 #ifdef CONFIG_MP
-void ft_fixup_cpu(void *blob)
+
+__weak u64 arch_get_release_addr(u64 cpu_id)
+{
+	return 0;
+}
+
+__weak void arch_spin_table_reserve_mem(void *fdt)
+{
+}
+
+static void cpu_update_dt_spin_table(void *blob)
 {
 	int off;
-	__maybe_unused u64 spin_tbl_addr = (u64)get_spin_tbl_addr();
-	fdt32_t *reg;
+	__maybe_unused u64 val;
 	int addr_cells;
-	u64 val;
-	size_t *boot_code_size = &(__secondary_boot_code_size);
+	__maybe_unused fdt32_t *reg;
 
 	off = fdt_path_offset(blob, "/cpus");
 	if (off < 0) {
@@ -30,9 +37,8 @@ void ft_fixup_cpu(void *blob)
 	while (off != -FDT_ERR_NOTFOUND) {
 		reg = (fdt32_t *)fdt_getprop(blob, off, "reg", 0);
 		if (reg) {
-			val = spin_tbl_addr;
-			val += id_to_core(of_read_number(reg, addr_cells))
-				* SPIN_TABLE_ELEM_SIZE;
+			val = arch_get_release_addr(
+					of_read_number(reg, addr_cells));
 			val = cpu_to_fdt64(val);
 			fdt_setprop_string(blob, off, "enable-method",
 					   "spin-table");
@@ -45,14 +51,14 @@ void ft_fixup_cpu(void *blob)
 						    "cpu", 4);
 	}
 
-	fdt_add_mem_rsv(blob, (uintptr_t)&secondary_boot_code,
-			*boot_code_size);
+	arch_spin_table_reserve_mem(blob);
 }
 #endif
 
-void ft_cpu_setup(void *blob, bd_t *bd)
+int cpu_update_dt(void *fdt)
 {
 #ifdef CONFIG_MP
-	ft_fixup_cpu(blob);
+	cpu_update_dt_spin_table(fdt);
 #endif
+	return 0;
 }
arch/arm/cpu/armv8/fsl-lsch3/fdt.c +16 -32

60 lines not on this page · raw message

Signature · 1 line
1.9.1