drm/amd/powerplay: add SMU register macro for future use
authorHuang Rui <ray.huang@amd.com>
Sun, 19 Jun 2016 16:32:06 +0000 (00:32 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 15 Jul 2016 16:33:21 +0000 (12:33 -0400)
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/inc/smumgr.h

index fc9e3d1dd4098fe4115c19099c6e98e52dea1c1d..3c235f0177cd9e0667b9d0deab7860efec7ac061 100644 (file)
@@ -131,6 +131,12 @@ extern int smu_free_memory(void *device, void *handle);
        smum_wait_on_indirect_register(smumgr,                          \
                                mm##port##_INDEX, index, value, mask)
 
+#define SMUM_WAIT_INDIRECT_REGISTER(smumgr, port, reg, value, mask)    \
+           SMUM_WAIT_INDIRECT_REGISTER_GIVEN_INDEX(smumgr, port, ix##reg, value, mask)
+
+#define SMUM_WAIT_INDIRECT_FIELD(smumgr, port, reg, field, fieldval)                          \
+           SMUM_WAIT_INDIRECT_REGISTER(smumgr, port, reg, (fieldval) << SMUM_FIELD_SHIFT(reg, field), \
+                                   SMUM_FIELD_MASK(reg, field) )
 
 #define SMUM_WAIT_REGISTER_UNEQUAL_GIVEN_INDEX(smumgr,         \
                                                        index, value, mask) \
@@ -158,6 +164,10 @@ extern int smu_free_memory(void *device, void *handle);
                (SMUM_FIELD_MASK(reg, field) & ((field_val) <<                 \
                        SMUM_FIELD_SHIFT(reg, field))))
 
+#define SMUM_READ_INDIRECT_FIELD(device, port, reg, field) \
+           SMUM_GET_FIELD(cgs_read_ind_register(device, port, ix##reg), \
+                          reg, field)
+
 #define SMUM_WAIT_VFPF_INDIRECT_REGISTER_GIVEN_INDEX(smumgr,           \
                                port, index, value, mask)               \
        smum_wait_on_indirect_register(smumgr,                          \
@@ -191,6 +201,13 @@ extern int smu_free_memory(void *device, void *handle);
                        SMUM_SET_FIELD(cgs_read_ind_register(device, port, ix##reg), \
                        reg, field, fieldval))
 
+
+#define SMUM_WRITE_INDIRECT_FIELD(device, port, reg, field, fieldval)                  \
+               cgs_write_ind_register(device, port, ix##reg,                           \
+                       SMUM_SET_FIELD(cgs_read_ind_register(device, port, ix##reg),    \
+                                      reg, field, fieldval))
+
+
 #define SMUM_WAIT_VFPF_INDIRECT_FIELD(smumgr, port, reg, field, fieldval) \
        SMUM_WAIT_VFPF_INDIRECT_REGISTER(smumgr, port, reg,             \
                (fieldval) << SMUM_FIELD_SHIFT(reg, field),             \
@@ -200,4 +217,16 @@ extern int smu_free_memory(void *device, void *handle);
        SMUM_WAIT_VFPF_INDIRECT_REGISTER_UNEQUAL(smumgr, port, reg,     \
                (fieldval) << SMUM_FIELD_SHIFT(reg, field),             \
                SMUM_FIELD_MASK(reg, field))
+
+#define SMUM_WAIT_INDIRECT_REGISTER_UNEQUAL_GIVEN_INDEX(smumgr, port, index, value, mask)    \
+       smum_wait_for_indirect_register_unequal(smumgr,                 \
+               mm##port##_INDEX, index, value, mask)
+
+#define SMUM_WAIT_INDIRECT_REGISTER_UNEQUAL(smumgr, port, reg, value, mask)    \
+           SMUM_WAIT_INDIRECT_REGISTER_UNEQUAL_GIVEN_INDEX(smumgr, port, ix##reg, value, mask)
+
+#define SMUM_WAIT_INDIRECT_FIELD_UNEQUAL(smumgr, port, reg, field, fieldval)                          \
+           SMUM_WAIT_INDIRECT_REGISTER_UNEQUAL(smumgr, port, reg, (fieldval) << SMUM_FIELD_SHIFT(reg, field), \
+                                   SMUM_FIELD_MASK(reg, field) )
+
 #endif