mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 08:04:22 +08:00
56b77ba112
The lengthiest capability is `WORKAROUND_TRBE_OVERWRITE_FILL_MODE` and its length is 35 characters so increase the width of left justified strings to 40 and adjust the tab space for `ARM64_NCAPS` accordingly. Now the generated cpucaps.h is properly formatted. Signed-off-by: Prathu Baronia <quic_pbaronia@quicinc.com> Link: https://lore.kernel.org/r/20230527123900.680520-1-quic_pbaronia@quicinc.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
41 lines
761 B
Awk
Executable File
41 lines
761 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_%-40s\t%d\n", $0, cap_num++)
|
|
next
|
|
}
|
|
|
|
END {
|
|
printf("#define ARM64_NCAPS\t\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")
|
|
}
|