From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Zyngier Date: Sat, 28 Feb 2015 13:56:58 +0000 Subject: [U-Boot] [PATCH v4 02/14] ARM: Factor out armv7_get_cpu_id macro In-Reply-To: References: Message-ID: <20150228135658.5c1ac8c1@arm.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, 27 Feb 2015 13:28:01 +0000 Jan Kiszka wrote: > Handy for obtaining the ID of the current CPU. We will have more use > cases. > > CC: Marc Zyngier > Signed-off-by: Jan Kiszka > --- > arch/arm/cpu/armv7/sunxi/psci.S | 4 ++-- > arch/arm/include/asm/macro.h | 7 +++++++ > 2 files changed, 9 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/cpu/armv7/sunxi/psci.S > b/arch/arm/cpu/armv7/sunxi/psci.S index 9e898f2..0523217 100644 > --- a/arch/arm/cpu/armv7/sunxi/psci.S > +++ b/arch/arm/cpu/armv7/sunxi/psci.S > @@ -19,6 +19,7 @@ > > #include > #include > +#include > #include > #include > > @@ -315,8 +316,7 @@ psci_arch_init: > mcr p15, 0, r5, c1, c1, 0 @ Write SCR > isb > > - mrc p15, 0, r4, c0, c0, 5 @ MPIDR > - and r4, r4, #3 @ cpu number in cluster > + armv7_get_cpu_id r4 > mov r5, #0x400 @ 1kB of stack per CPU > mul r4, r4, r5 > > diff --git a/arch/arm/include/asm/macro.h > b/arch/arm/include/asm/macro.h index 1c8c425..0bc925a 100644 > --- a/arch/arm/include/asm/macro.h > +++ b/arch/arm/include/asm/macro.h > @@ -198,6 +198,13 @@ lr .req x30 > .endm > #endif > > +#else /* !CONFIG_ARM64 */ > + > +.macro armv7_get_cpu_id rn > + mrc p15, 0, \rn, c0, c0, 5 /* read MPIDR */ > + and \rn, \rn, #0xff /* return CPU ID > in cluster */ > +.endm > + How does this work in a multi-cluster situation? Or when you have sparse MPIDRs? Thanks, M. > #endif /* CONFIG_ARM64 */ > > #endif /* __ASSEMBLY__ */ -- Jazz is not dead. It just smells funny.