]> www.infradead.org Git - users/hch/configfs.git/commitdiff
drm/amdgpu: add macro to calculate offset with instance
authorSunil Khatri <sunil.khatri@amd.com>
Wed, 24 Jul 2024 17:05:56 +0000 (22:35 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Sat, 27 Jul 2024 21:28:28 +0000 (17:28 -0400)
Add macro definition which calculate offset of the
register with index override.

This is useful in case when there is an array of
registers which is common for all instances.
To read registers in that case it is easy to define
registers once and the index value is manually passed
to calculate proper offset of register for each instance.

Signed-off-by: Sunil Khatri <sunil.khatri@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/soc15.h

index 282584a48be095c978ba89530990ff9375977dc4..ef7c603b50ae32cf4b87996c607ed9ddd36371c6 100644 (file)
@@ -93,6 +93,10 @@ struct soc15_ras_field_entry {
 
 #define SOC15_REG_ENTRY_OFFSET(entry)  (adev->reg_offset[entry.hwip][entry.inst][entry.seg] + entry.reg_offset)
 
+/* Over ride the instance id */
+#define SOC15_REG_ENTRY_OFFSET_INST(entry, inst) \
+       (adev->reg_offset[entry.hwip][inst][entry.seg] + entry.reg_offset)
+
 #define SOC15_REG_GOLDEN_VALUE(ip, inst, reg, and_mask, or_mask) \
        { ip##_HWIP, inst, reg##_BASE_IDX, reg, and_mask, or_mask }