freedreno/registers: Add prefix="variant"

To merge a7xx and a6xx regs, using variant property to manage the
differences, we'll want regs/etc to be named according to the first
generation it is use rather than the domain name.  Add a new prefix
type to accomplish this.  By default, if no variant property, things
will still be named based on domain (ie. REG_A6XX_...), and things
that have variant="A6XX" will also end up as they currently are
(since the chip enum matches domain name), but things that have
variant="A7XX" will end up as REG_A7XX_...

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21846>
This commit is contained in:
Rob Clark
2022-08-02 09:53:25 -07:00
committed by Marge Bot
parent fadf76b938
commit 684931166d
2 changed files with 16 additions and 5 deletions
+15 -5
View File
@@ -296,6 +296,7 @@ class Parser(object):
self.current_array = None
self.current_domain = None
self.current_prefix = None
self.current_prefix_type = None
self.current_stripe = None
self.current_bitset = None
self.current_bitsize = 32
@@ -307,8 +308,10 @@ class Parser(object):
parser, filename = self.stack[-1]
return Error("%s:%d:%d: %s" % (filename, parser.CurrentLineNumber, parser.CurrentColumnNumber, message))
def prefix(self):
if self.current_stripe:
def prefix(self, variant=None):
if self.current_prefix_type == "variant" and variant:
return variant
elif self.current_stripe:
return self.current_stripe + "_" + self.current_domain
elif self.current_prefix:
return self.current_prefix + "_" + self.current_domain
@@ -407,7 +410,8 @@ class Parser(object):
if "type" in attrs:
self.parse_field(None, attrs)
self.current_reg = Reg(attrs, self.prefix(), self.current_array, bit_size)
variant = parse_variants(attrs)
self.current_reg = Reg(attrs, self.prefix(variant), self.current_array, bit_size)
self.current_reg.bitset = self.current_bitset
if len(self.stack) == 1:
@@ -419,8 +423,12 @@ class Parser(object):
self.do_parse(os.path.join(self.path, filename))
elif name == "domain":
self.current_domain = attrs["name"]
if "prefix" in attrs and attrs["prefix"] == "chip":
if "prefix" in attrs:
self.current_prefix = parse_variants(attrs)
self.current_prefix_type = attrs["prefix"]
else:
self.current_prefix = None
self.current_prefix_type = None
elif name == "stripe":
self.current_stripe = parse_variants(attrs)
elif name == "enum":
@@ -442,7 +450,8 @@ class Parser(object):
self.parse_reg(attrs, 64)
elif name == "array":
self.current_bitsize = 32
self.current_array = Array(attrs, self.prefix())
variant = parse_variants(attrs)
self.current_array = Array(attrs, self.prefix(variant))
if len(self.stack) == 1:
self.file.append(self.current_array)
elif name == "bitset":
@@ -461,6 +470,7 @@ class Parser(object):
if name == "domain":
self.current_domain = None
self.current_prefix = None
self.current_prefix_type = None
elif name == "stripe":
self.current_stripe = None
elif name == "bitset":
+1
View File
@@ -218,6 +218,7 @@
<attribute name="inline" type="rng:Boolean" use="optional" />
<attribute name="bare" type="rng:Boolean" use="optional" />
<attribute name="prefix" type="NMTOKENS" use="optional" />
<attribute name="varset" type="NMTOKEN" use="optional" />
</complexType>
<complexType name="bitfieldType">