amd/registers: sort registers by offset in json
authorMarek Olšák <marek.olsak@amd.com>
Thu, 20 Aug 2020 08:03:13 +0000 (04:03 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 1 Sep 2020 12:45:46 +0000 (08:45 -0400)
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6423>

src/amd/registers/regdb.py

index fc9a0a2788e68704e405346ad203e2a52ba8d2eb..0167365d7c8f4321abca6f64fe675fd9b5e64e1b 100644 (file)
@@ -213,7 +213,7 @@ class RegisterDatabase(object):
         Perform some basic canonicalization:
         - enum entries are sorted by value
         - register type fields are sorted by starting bit
-        - __register_mappings is sorted by name
+        - __register_mappings is sorted by offset
         - the chips field of register mappings is sorted
 
         Lazily computes the set of all chips mentioned by register mappings.
@@ -230,10 +230,10 @@ class RegisterDatabase(object):
         self.__regmap_by_addr = defaultdict(list)
         self.__chips = set()
 
-        # Merge regiseter mappings using sort order and garbage collect enums
+        # Merge register mappings using sort order and garbage collect enums
         # and register types.
         old_register_mappings = self.__register_mappings
-        old_register_mappings.sort(key=lambda regmap: regmap.name)
+        old_register_mappings.sort(key=lambda regmap: regmap.map.at)
 
         self.__register_mappings = []
         for regmap in old_register_mappings: