mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 01:49:36 +00:00
![Mark Brown](/assets/img/avatar_default.png)
Anshuman suggested this. Suggested-by: Anshuman Khandual <anshuman.khandual@arm.com> Signed-off-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20210513151819.12526-1-broonie@kernel.org Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
40 lines
759 B
Awk
Executable file
40 lines
759 B
Awk
Executable file
#!/bin/awk -f
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# gen-cpucaps.awk: arm64 cpucaps header generator
|
|
#
|
|
# Usage: awk -f gen-cpucaps.awk cpucaps.txt
|
|
|
|
# Log an error and terminate
|
|
function fatal(msg) {
|
|
print "Error at line " NR ": " msg > "/dev/stderr"
|
|
exit 1
|
|
}
|
|
|
|
# skip blank lines and comment lines
|
|
/^$/ { next }
|
|
/^#/ { next }
|
|
|
|
BEGIN {
|
|
print "#ifndef __ASM_CPUCAPS_H"
|
|
print "#define __ASM_CPUCAPS_H"
|
|
print ""
|
|
print "/* Generated file - do not edit */"
|
|
cap_num = 0
|
|
print ""
|
|
}
|
|
|
|
/^[vA-Z0-9_]+$/ {
|
|
printf("#define ARM64_%-30s\t%d\n", $0, cap_num++)
|
|
next
|
|
}
|
|
|
|
END {
|
|
printf("#define ARM64_NCAPS\t\t\t\t%d\n", cap_num)
|
|
print ""
|
|
print "#endif /* __ASM_CPUCAPS_H */"
|
|
}
|
|
|
|
# Any lines not handled by previous rules are unexpected
|
|
{
|
|
fatal("unhandled statement")
|
|
}
|