[PATCH 1/6] ARM: make cpu architecture detection available as static inline function

Sascha Hauer s.hauer at pengutronix.de
Tue Mar 5 05:34:47 EST 2013


On Mon, Mar 04, 2013 at 09:46:56PM +0100, Alexander Aring wrote:
> Hi,
> 
> > +/*
> > + * Early version to get the ARM cpu architecture. Only needed during
> > + * early startup when the C environment is not yet fully initialized.
> > + * Normally you should use cpu_architecture() instead.
> > + */
> > +static inline int arm_early_get_cpu_architecture(void)
> > +{
> > +	int cpu_arch;
> > +
> > +	if ((read_cpuid_id() & 0x0008f000) == 0) {
> > +		cpu_arch = CPU_ARCH_UNKNOWN;
> > +	} else if ((read_cpuid_id() & 0x0008f000) == 0x00007000) {
> > +		cpu_arch = (read_cpuid_id() & (1 << 23)) ? CPU_ARCH_ARMv4T : CPU_ARCH_ARMv3;
> > +	} else if ((read_cpuid_id() & 0x00080000) == 0x00000000) {
> > +		cpu_arch = (read_cpuid_id() >> 16) & 7;
> > +		if (cpu_arch)
> > +			cpu_arch += CPU_ARCH_ARMv3;
> 
> I know... it's only a movement, but is cpu += CPU_ARCH_ARMv3 correct
> here? All other has only a assignment.

This particular line is present in the Kernel since the pre-git days, so
I assume it's correct ;)

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list