aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm64/kernel/setup.c
diff options
context:
space:
mode:
authorSuzuki K. Poulose <suzuki.poulose@arm.com>2015-10-19 09:24:43 -0400
committerCatalin Marinas <catalin.marinas@arm.com>2015-10-21 10:33:56 -0400
commit12d11817eaafa414eeb47af684093eb2165ebe37 (patch)
treec590b7343001c936c23289ffc7a683d3ab6c31df /arch/arm64/kernel/setup.c
parentcdcf817b7e4b62b935d8797f7d07ea0b97760884 (diff)
arm64: Move /proc/cpuinfo handling code
This patch moves the /proc/cpuinfo handling code: arch/arm64/kernel/{setup.c to cpuinfo.c} No functional changes Signed-off-by: Suzuki K. Poulose <suzuki.poulose@arm.com> Tested-by: Dave Martin <Dave.Martin@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/setup.c')
-rw-r--r--arch/arm64/kernel/setup.c123
1 files changed, 0 insertions, 123 deletions
diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c
index baf0da8c7d8a..556301fbeeef 100644
--- a/arch/arm64/kernel/setup.c
+++ b/arch/arm64/kernel/setup.c
@@ -28,7 +28,6 @@
28#include <linux/console.h> 28#include <linux/console.h>
29#include <linux/cache.h> 29#include <linux/cache.h>
30#include <linux/bootmem.h> 30#include <linux/bootmem.h>
31#include <linux/seq_file.h>
32#include <linux/screen_info.h> 31#include <linux/screen_info.h>
33#include <linux/init.h> 32#include <linux/init.h>
34#include <linux/kexec.h> 33#include <linux/kexec.h>
@@ -44,7 +43,6 @@
44#include <linux/of_fdt.h> 43#include <linux/of_fdt.h>
45#include <linux/of_platform.h> 44#include <linux/of_platform.h>
46#include <linux/efi.h> 45#include <linux/efi.h>
47#include <linux/personality.h>
48#include <linux/psci.h> 46#include <linux/psci.h>
49 47
50#include <asm/acpi.h> 48#include <asm/acpi.h>
@@ -381,124 +379,3 @@ static int __init topology_init(void)
381 return 0; 379 return 0;
382} 380}
383subsys_initcall(topology_init); 381subsys_initcall(topology_init);
384
385static const char *hwcap_str[] = {
386 "fp",
387 "asimd",
388 "evtstrm",
389 "aes",
390 "pmull",
391 "sha1",
392 "sha2",
393 "crc32",
394 "atomics",
395 NULL
396};
397
398#ifdef CONFIG_COMPAT
399static const char *compat_hwcap_str[] = {
400 "swp",
401 "half",
402 "thumb",
403 "26bit",
404 "fastmult",
405 "fpa",
406 "vfp",
407 "edsp",
408 "java",
409 "iwmmxt",
410 "crunch",
411 "thumbee",
412 "neon",
413 "vfpv3",
414 "vfpv3d16",
415 "tls",
416 "vfpv4",
417 "idiva",
418 "idivt",
419 "vfpd32",
420 "lpae",
421 "evtstrm"
422};
423
424static const char *compat_hwcap2_str[] = {
425 "aes",
426 "pmull",
427 "sha1",
428 "sha2",
429 "crc32",
430 NULL
431};
432#endif /* CONFIG_COMPAT */
433
434static int c_show(struct seq_file *m, void *v)
435{
436 int i, j;
437
438 for_each_online_cpu(i) {
439 struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i);
440 u32 midr = cpuinfo->reg_midr;
441
442 /*
443 * glibc reads /proc/cpuinfo to determine the number of
444 * online processors, looking for lines beginning with
445 * "processor". Give glibc what it expects.
446 */
447 seq_printf(m, "processor\t: %d\n", i);
448
449 /*
450 * Dump out the common processor features in a single line.
451 * Userspace should read the hwcaps with getauxval(AT_HWCAP)
452 * rather than attempting to parse this, but there's a body of
453 * software which does already (at least for 32-bit).
454 */
455 seq_puts(m, "Features\t:");
456 if (personality(current->personality) == PER_LINUX32) {
457#ifdef CONFIG_COMPAT
458 for (j = 0; compat_hwcap_str[j]; j++)
459 if (compat_elf_hwcap & (1 << j))
460 seq_printf(m, " %s", compat_hwcap_str[j]);
461
462 for (j = 0; compat_hwcap2_str[j]; j++)
463 if (compat_elf_hwcap2 & (1 << j))
464 seq_printf(m, " %s", compat_hwcap2_str[j]);
465#endif /* CONFIG_COMPAT */
466 } else {
467 for (j = 0; hwcap_str[j]; j++)
468 if (elf_hwcap & (1 << j))
469 seq_printf(m, " %s", hwcap_str[j]);
470 }
471 seq_puts(m, "\n");
472
473 seq_printf(m, "CPU implementer\t: 0x%02x\n",
474 MIDR_IMPLEMENTOR(midr));
475 seq_printf(m, "CPU architecture: 8\n");
476 seq_printf(m, "CPU variant\t: 0x%x\n", MIDR_VARIANT(midr));
477 seq_printf(m, "CPU part\t: 0x%03x\n", MIDR_PARTNUM(midr));
478 seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr));
479 }
480
481 return 0;
482}
483
484static void *c_start(struct seq_file *m, loff_t *pos)
485{
486 return *pos < 1 ? (void *)1 : NULL;
487}
488
489static void *c_next(struct seq_file *m, void *v, loff_t *pos)
490{
491 ++*pos;
492 return NULL;
493}
494
495static void c_stop(struct seq_file *m, void *v)
496{
497}
498
499const struct seq_operations cpuinfo_op = {
500 .start = c_start,
501 .next = c_next,
502 .stop = c_stop,
503 .show = c_show
504};