ARM: stub out read_cpuid and read_cpuid_ext for CPU_CP15=n
Traditionally for !CPU_CP15 read_cpuid and read_cpuid_ext returned the processor id independent of the parameter passed in. This is wrong of course but theoretically this doesn't harm because it's only called on machines having a cp15. Instead return 0 unconditionally which might make unused code paths be better optimizable and so smaller and warn about unexpected usage. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Message-Id: 1359646587-1788-2-git-send-email-u.kleine-koenig@pengutronix.de
This commit is contained in:
Родитель
ac52e83f4c
Коммит
6ebd4d038d
|
@ -50,6 +50,7 @@ extern unsigned int processor_id;
|
||||||
: "cc"); \
|
: "cc"); \
|
||||||
__val; \
|
__val; \
|
||||||
})
|
})
|
||||||
|
|
||||||
#define read_cpuid_ext(ext_reg) \
|
#define read_cpuid_ext(ext_reg) \
|
||||||
({ \
|
({ \
|
||||||
unsigned int __val; \
|
unsigned int __val; \
|
||||||
|
@ -59,11 +60,24 @@ extern unsigned int processor_id;
|
||||||
: "cc"); \
|
: "cc"); \
|
||||||
__val; \
|
__val; \
|
||||||
})
|
})
|
||||||
#else
|
|
||||||
#define read_cpuid(reg) (processor_id)
|
|
||||||
#define read_cpuid_ext(reg) 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#else /* ifdef CONFIG_CPU_CP15 */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* read_cpuid and read_cpuid_ext should only ever be called on machines that
|
||||||
|
* have cp15 so warn on other usages.
|
||||||
|
*/
|
||||||
|
#define read_cpuid(reg) \
|
||||||
|
({ \
|
||||||
|
WARN_ON_ONCE(1); \
|
||||||
|
0; \
|
||||||
|
})
|
||||||
|
|
||||||
|
#define read_cpuid_ext(reg) read_cpuid(reg)
|
||||||
|
|
||||||
|
#endif /* ifdef CONFIG_CPU_CP15 / else */
|
||||||
|
|
||||||
|
#ifdef CONFIG_CPU_CP15
|
||||||
/*
|
/*
|
||||||
* The CPU ID never changes at run time, so we might as well tell the
|
* The CPU ID never changes at run time, so we might as well tell the
|
||||||
* compiler that it's constant. Use this function to read the CPU ID
|
* compiler that it's constant. Use this function to read the CPU ID
|
||||||
|
@ -74,6 +88,15 @@ static inline unsigned int __attribute_const__ read_cpuid_id(void)
|
||||||
return read_cpuid(CPUID_ID);
|
return read_cpuid(CPUID_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* ifdef CONFIG_CPU_CP15 */
|
||||||
|
|
||||||
|
static inline unsigned int __attribute_const__ read_cpuid_id(void)
|
||||||
|
{
|
||||||
|
return processor_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* ifdef CONFIG_CPU_CP15 / else */
|
||||||
|
|
||||||
static inline unsigned int __attribute_const__ read_cpuid_cachetype(void)
|
static inline unsigned int __attribute_const__ read_cpuid_cachetype(void)
|
||||||
{
|
{
|
||||||
return read_cpuid(CPUID_CACHETYPE);
|
return read_cpuid(CPUID_CACHETYPE);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче