Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Jun 2014 21:37:05 +0000 (UTC)
From:      Zbigniew Bodek <zbb@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267130 - head/sys/arm/mv/armadaxp
Message-ID:  <201406052137.s55Lb5jB098138@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: zbb
Date: Thu Jun  5 21:37:04 2014
New Revision: 267130
URL: http://svnweb.freebsd.org/changeset/base/267130

Log:
  Avoid using hard-coded SoC's register address in mptramp code for Armada XP
  
  SoC's registers base address may differ between boards
  (0xf1000000 or 0xd0000000). Therefore, in order to use
  the proper CPU Boot Address Redirect register during SMP
  initialization in mptramp the real, physical address has
  to be passed to mptramp based on the value from DT.
  
  Reviewed by: gber

Modified:
  head/sys/arm/mv/armadaxp/armadaxp_mp.c
  head/sys/arm/mv/armadaxp/mptramp.S

Modified: head/sys/arm/mv/armadaxp/armadaxp_mp.c
==============================================================================
--- head/sys/arm/mv/armadaxp/armadaxp_mp.c	Thu Jun  5 21:35:10 2014	(r267129)
+++ head/sys/arm/mv/armadaxp/armadaxp_mp.c	Thu Jun  5 21:37:04 2014	(r267130)
@@ -37,6 +37,8 @@
 #include <vm/vm_kern.h>
 #include <vm/vm_extern.h>
 
+#include <dev/fdt/fdt_common.h>
+
 #include <machine/smp.h>
 #include <machine/fdt.h>
 #include <machine/armreg.h>
@@ -98,12 +100,13 @@ platform_mp_init_secondary(void)
 
 void mptramp(void);
 void mptramp_end(void);
+extern vm_offset_t mptramp_pmu_boot;
 
 void
 platform_mp_start_ap(void)
 {
 	uint32_t reg, *src, *dst, cpu_num, div_val, cputype;
-	vm_offset_t smp_boot;
+	vm_offset_t smp_boot, pmu_boot_off;
 	/*
 	 * Initialization procedure depends on core revision,
 	 * in this step CHIP ID is checked to choose proper procedure
@@ -114,6 +117,12 @@ platform_mp_start_ap(void)
 	smp_boot = kva_alloc(PAGE_SIZE);
 	pmap_kenter_nocache(smp_boot, 0xffff0000);
 	dst = (uint32_t *) smp_boot;
+	/*
+	 * Set the PA of CPU0 Boot Address Redirect register used in
+	 * mptramp according to the actual SoC registers' base address.
+	 */
+	pmu_boot_off = (CPU_PMU(0) - MV_BASE) + CPU_PMU_BOOT;
+	mptramp_pmu_boot = fdt_immr_pa + pmu_boot_off;
 
 	for (src = (uint32_t *)mptramp; src < (uint32_t *)mptramp_end;
 	    src++, dst++) {

Modified: head/sys/arm/mv/armadaxp/mptramp.S
==============================================================================
--- head/sys/arm/mv/armadaxp/mptramp.S	Thu Jun  5 21:35:10 2014	(r267129)
+++ head/sys/arm/mv/armadaxp/mptramp.S	Thu Jun  5 21:37:04 2014	(r267130)
@@ -29,6 +29,8 @@
 
 __FBSDID("$FreeBSD$");
 
+.global _C_LABEL(mptramp_pmu_boot)
+
 ASENTRY_NP(mptramp)
 	mov	r0, #0
 	mcr	p15, 0, r0, c7, c7, 0
@@ -44,14 +46,15 @@ ASENTRY_NP(mptramp)
 	/* Read boot address for CPU */
 	mov	r1, #0x100
 	mul	r2, r0, r1
-	ldr	r1, Lpmureg
+	ldr	r1, mptramp_pmu_boot
 	add	r0, r2, r1
 	ldr	r1, [r0], #0x00
 
 	mov pc, r1
 
-Lpmureg:
-        .word   0xd0022124
+_C_LABEL(mptramp_pmu_boot):
+	.word 0x0
+
 END(mptramp)
 
 	.global _C_LABEL(mptramp_end)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406052137.s55Lb5jB098138>