Skip to content

Commit 60e9f77

Browse files
author
Rob Clark
committed
drm/msm/registers: Generate _HI/LO builders for reg64
The upstream mesa copy of the GPU regs has shifted more things to reg64 instead of seperate 32b HI/LO reg32's. This works better with the "new- style" c++ builders that mesa has been migrating to for a6xx+ (to better handle register shuffling between gens), but it leaves the C builders with missing _HI/LO builders. So handle the special case of reg64, automatically generating the missing _HI/LO builders. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/673559/
1 parent 29e087f commit 60e9f77

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/gpu/drm/msm/registers/gen_header.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ class Bitset(object):
161161
def __init__(self, name, template):
162162
self.name = name
163163
self.inline = False
164+
self.reg = None
164165
if template:
165166
self.fields = template.fields[:]
166167
else:
@@ -266,6 +267,11 @@ def dump_pack_struct(self, is_deprecated, reg=None):
266267
def dump(self, is_deprecated, prefix=None):
267268
if prefix is None:
268269
prefix = self.name
270+
if self.reg and self.reg.bit_size == 64:
271+
print("static inline uint32_t %s_LO(uint32_t val)\n{" % prefix)
272+
print("\treturn val;\n}")
273+
print("static inline uint32_t %s_HI(uint32_t val)\n{" % prefix)
274+
print("\treturn val;\n}")
269275
for f in self.fields:
270276
if f.name:
271277
name = prefix + "_" + f.name
@@ -645,6 +651,7 @@ def parse_reg(self, attrs, bit_size):
645651

646652
self.current_reg = Reg(attrs, self.prefix(variant), self.current_array, bit_size)
647653
self.current_reg.bitset = self.current_bitset
654+
self.current_bitset.reg = self.current_reg
648655

649656
if len(self.stack) == 1:
650657
self.file.append(self.current_reg)

0 commit comments

Comments
 (0)