Skip to content

Commit a0b130e

Browse files
Sticklyman1936ctmarinas
authored andcommitted
arm64/sysreg: Move generation of RES0/RES1/UNKN to function
The RESx and UNKN define generation happens in two places (EndSysreg and EndSysregFields), and was using nearly identical code. Split this out into a function, and call that instead, rather then keeping the dupliated code. There are no changes to the generated sysregs as part of this change. Signed-off-by: Sascha Bischoff <sascha.bischoff@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent fe2ef46 commit a0b130e

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

arch/arm64/tools/gen-sysreg.awk

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@ function define_field_sign(prefix, reg, field, sign) {
6666
define(prefix, reg "_" field "_SIGNED", sign)
6767
}
6868

69+
# Print the Res0, Res1, Unkn masks
70+
function define_resx_unkn(prefix, reg, res0, res1, unkn) {
71+
if (res0 != null)
72+
define(prefix, reg "_RES0", "(" res0 ")")
73+
if (res1 != null)
74+
define(prefix, reg "_RES1", "(" res1 ")")
75+
if (unkn != null)
76+
define(prefix, reg "_UNKN", "(" unkn ")")
77+
if (res0 != null || res1 != null || unkn != null)
78+
print ""
79+
}
80+
6981
# Parse a "<msb>[:<lsb>]" string into the global variables @msb and @lsb
7082
function parse_bitdef(reg, field, bitdef, _bits)
7183
{
@@ -143,10 +155,7 @@ $1 == "EndSysregFields" && block_current() == "SysregFields" {
143155
if (next_bit >= 0)
144156
fatal("Unspecified bits in " reg)
145157

146-
define(prefix, reg "_RES0", "(" res0 ")")
147-
define(prefix, reg "_RES1", "(" res1 ")")
148-
define(prefix, reg "_UNKN", "(" unkn ")")
149-
print ""
158+
define_resx_unkn(prefix, reg, res0, res1, unkn)
150159

151160
reg = null
152161
res0 = null
@@ -201,14 +210,7 @@ $1 == "EndSysreg" && block_current() == "Sysreg" {
201210
if (next_bit >= 0)
202211
fatal("Unspecified bits in " reg)
203212

204-
if (res0 != null)
205-
define(prefix, reg "_RES0", "(" res0 ")")
206-
if (res1 != null)
207-
define(prefix, reg "_RES1", "(" res1 ")")
208-
if (unkn != null)
209-
define(prefix, reg "_UNKN", "(" unkn ")")
210-
if (res0 != null || res1 != null || unkn != null)
211-
print ""
213+
define_resx_unkn(prefix, reg, res0, res1, unkn)
212214

213215
reg = null
214216
op0 = null

0 commit comments

Comments
 (0)