drm/amd/display: Move dm_read_reg_func to dc_helper.

Move out of header to dc_helper.c, in preparation for future
implementations.

Signed-off-by: Yongqiang Sun <yongqiang.sun@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Yongqiang Sun 2019-02-28 15:14:39 -05:00 committed by Alex Deucher
parent 7ddaef96cd
commit 901f4f97be
2 changed files with 22 additions and 17 deletions

View File

@ -119,6 +119,24 @@ uint32_t generic_reg_set_ex(const struct dc_context *ctx,
return reg_val; return reg_val;
} }
uint32_t dm_read_reg_func(
const struct dc_context *ctx,
uint32_t address,
const char *func_name)
{
uint32_t value;
#ifdef DM_CHECK_ADDR_0
if (address == 0) {
DC_ERR("invalid register read; address = 0\n");
return 0;
}
#endif
value = cgs_read_register(ctx->cgs_device, address);
trace_amdgpu_dc_rreg(&ctx->perf_trace->read_count, address, value);
return value;
}
uint32_t generic_reg_get(const struct dc_context *ctx, uint32_t addr, uint32_t generic_reg_get(const struct dc_context *ctx, uint32_t addr,
uint8_t shift, uint32_t mask, uint32_t *field_value) uint8_t shift, uint32_t mask, uint32_t *field_value)
{ {

View File

@ -52,30 +52,17 @@ irq_handler_idx dm_register_interrupt(
* GPU registers access * GPU registers access
* *
*/ */
uint32_t dm_read_reg_func(
const struct dc_context *ctx,
uint32_t address,
const char *func_name);
/* enable for debugging new code, this adds 50k to the driver size. */ /* enable for debugging new code, this adds 50k to the driver size. */
/* #define DM_CHECK_ADDR_0 */ /* #define DM_CHECK_ADDR_0 */
#define dm_read_reg(ctx, address) \ #define dm_read_reg(ctx, address) \
dm_read_reg_func(ctx, address, __func__) dm_read_reg_func(ctx, address, __func__)
static inline uint32_t dm_read_reg_func(
const struct dc_context *ctx,
uint32_t address,
const char *func_name)
{
uint32_t value;
#ifdef DM_CHECK_ADDR_0
if (address == 0) {
DC_ERR("invalid register read; address = 0\n");
return 0;
}
#endif
value = cgs_read_register(ctx->cgs_device, address);
trace_amdgpu_dc_rreg(&ctx->perf_trace->read_count, address, value);
return value;
}
#define dm_write_reg(ctx, address, value) \ #define dm_write_reg(ctx, address, value) \
dm_write_reg_func(ctx, address, value, __func__) dm_write_reg_func(ctx, address, value, __func__)