Commit 7c008829 authored by Nicholas Kazlauskas's avatar Nicholas Kazlauskas Committed by Alex Deucher

drm/amd/display: Add the DMUB service

The DMUB service is the interface to the DMCUB.

It's required to support Renoir features so it will be enabled and
compiled automatically when the Renoir display engine is enabled via
CONFIG_DRM_AMD_DC_DCN2_1.

DMUB code will initially be guarded by CONFIG_DRM_AMD_DC_DMUB and later
switched to CONFIG_DRM_AMD_DC_DCN2_1 with the config option dropped.
Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: default avatarHersen Wu <hersenxs.wu@amd.com>
Acked-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 9e0880d9
...@@ -30,6 +30,7 @@ config DRM_AMD_DC_DCN2_1 ...@@ -30,6 +30,7 @@ config DRM_AMD_DC_DCN2_1
bool "DCN 2.1 family" bool "DCN 2.1 family"
depends on DRM_AMD_DC && X86 depends on DRM_AMD_DC && X86
depends on DRM_AMD_DC_DCN2_0 depends on DRM_AMD_DC_DCN2_0
select DRM_AMD_DC_DMUB
help help
Choose this option if you want to have Choose this option if you want to have
Renoir support for display engine Renoir support for display engine
...@@ -52,6 +53,11 @@ config DRM_AMD_DC_HDCP ...@@ -52,6 +53,11 @@ config DRM_AMD_DC_HDCP
if you want to support if you want to support
HDCP authentication HDCP authentication
config DRM_AMD_DC_DMUB
def_bool n
help
DMUB support for display engine
config DEBUG_KERNEL_DC config DEBUG_KERNEL_DC
bool "Enable kgdb break in DC" bool "Enable kgdb break in DC"
depends on DRM_AMD_DC depends on DRM_AMD_DC
......
...@@ -38,6 +38,10 @@ ifdef CONFIG_DRM_AMD_DC_HDCP ...@@ -38,6 +38,10 @@ ifdef CONFIG_DRM_AMD_DC_HDCP
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/hdcp subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/hdcp
endif endif
ifdef CONFIG_DRM_AMD_DC_DMUB
subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dmub/inc
endif
#TODO: remove when Timing Sync feature is complete #TODO: remove when Timing Sync feature is complete
subdir-ccflags-y += -DBUILD_FEATURE_TIMING_SYNC=0 subdir-ccflags-y += -DBUILD_FEATURE_TIMING_SYNC=0
...@@ -47,6 +51,10 @@ ifdef CONFIG_DRM_AMD_DC_HDCP ...@@ -47,6 +51,10 @@ ifdef CONFIG_DRM_AMD_DC_HDCP
DAL_LIBS += modules/hdcp DAL_LIBS += modules/hdcp
endif endif
ifdef CONFIG_DRM_AMD_DC_DMUB
DAL_LIBS += dmub/src
endif
AMD_DAL = $(addsuffix /Makefile, $(addprefix $(FULL_AMD_DISPLAY_PATH)/,$(DAL_LIBS))) AMD_DAL = $(addsuffix /Makefile, $(addprefix $(FULL_AMD_DISPLAY_PATH)/,$(DAL_LIBS)))
include $(AMD_DAL) include $(AMD_DAL)
/*
* Copyright 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef _DMUB_CMD_H_
#define _DMUB_CMD_H_
#include "dmub_types.h"
#include "atomfirmware.h"
#define DMUB_RB_CMD_SIZE 64
#define DMUB_RB_MAX_ENTRY 128
#define DMUB_RB_SIZE (DMUB_RB_CMD_SIZE * DMUB_RB_MAX_ENTRY)
#define REG_SET_MASK 0xFFFF
enum dmub_cmd_type {
DMUB_CMD__NULL,
DMUB_CMD__REG_SEQ_READ_MODIFY_WRITE,
DMUB_CMD__REG_SEQ_FIELD_UPDATE_SEQ,
DMUB_CMD__REG_SEQ_BURST_WRITE,
DMUB_CMD__REG_REG_WAIT,
DMUB_CMD__DIGX_ENCODER_CONTROL,
DMUB_CMD__SET_PIXEL_CLOCK,
DMUB_CMD__ENABLE_DISP_POWER_GATING,
DMUB_CMD__DPPHY_INIT,
DMUB_CMD__DIG1_TRANSMITTER_CONTROL,
// PSR
DMUB_CMD__PSR_ENABLE,
DMUB_CMD__PSR_DISABLE,
DMUB_CMD__PSR_COPY_SETTINGS,
DMUB_CMD__PSR_SET_LEVEL,
};
#pragma pack(push, 1)
struct dmub_cmd_header {
enum dmub_cmd_type type : 8;
unsigned int reserved0 : 16;
unsigned int payload_bytes : 6; /* up to 60 bytes */
unsigned int reserved : 2;
};
/*
* Read modify write
*
* 60 payload bytes can hold up to 5 sets of read modify writes,
* each take 3 dwords.
*
* number of sequences = header.payload_bytes / sizeof(struct dmub_cmd_read_modify_write_sequence)
*
* modify_mask = 0xffff'ffff means all fields are going to be updated. in this case
* command parser will skip the read and we can use modify_mask = 0xffff'ffff as reg write
*/
struct dmub_cmd_read_modify_write_sequence {
uint32_t addr;
uint32_t modify_mask;
uint32_t modify_value;
};
#define DMUB_READ_MODIFY_WRITE_SEQ__MAX 5
struct dmub_rb_cmd_read_modify_write {
struct dmub_cmd_header header; // type = DMUB_CMD__REG_SEQ_READ_MODIFY_WRITE
struct dmub_cmd_read_modify_write_sequence seq[DMUB_READ_MODIFY_WRITE_SEQ__MAX];
};
/*
* Update a register with specified masks and values sequeunce
*
* 60 payload bytes can hold address + up to 7 sets of mask/value combo, each take 2 dword
*
* number of field update sequence = (header.payload_bytes - sizeof(addr)) / sizeof(struct read_modify_write_sequence)
*
*
* USE CASE:
* 1. auto-increment register where additional read would update pointer and produce wrong result
* 2. toggle a bit without read in the middle
*/
struct dmub_cmd_reg_field_update_sequence {
uint32_t modify_mask; // 0xffff'ffff to skip initial read
uint32_t modify_value;
};
#define DMUB_REG_FIELD_UPDATE_SEQ__MAX 7
struct dmub_rb_cmd_reg_field_update_sequence {
struct dmub_cmd_header header;
uint32_t addr;
struct dmub_cmd_reg_field_update_sequence seq[DMUB_REG_FIELD_UPDATE_SEQ__MAX];
};
/*
* Burst write
*
* support use case such as writing out LUTs.
*
* 60 payload bytes can hold up to 14 values to write to given address
*
* number of payload = header.payload_bytes / sizeof(struct read_modify_write_sequence)
*/
#define DMUB_BURST_WRITE_VALUES__MAX 14
struct dmub_rb_cmd_burst_write {
struct dmub_cmd_header header; // type = DMUB_CMD__REG_SEQ_BURST_WRITE
uint32_t addr;
uint32_t write_values[DMUB_BURST_WRITE_VALUES__MAX];
};
struct dmub_rb_cmd_common {
struct dmub_cmd_header header;
uint8_t cmd_buffer[DMUB_RB_CMD_SIZE - sizeof(struct dmub_cmd_header)];
};
struct dmub_cmd_reg_wait_data {
uint32_t addr;
uint32_t mask;
uint32_t condition_field_value;
uint32_t time_out_us;
};
struct dmub_rb_cmd_reg_wait {
struct dmub_cmd_header header;
struct dmub_cmd_reg_wait_data reg_wait;
};
struct dmub_cmd_digx_encoder_control_data {
union dig_encoder_control_parameters_v1_5 dig;
};
struct dmub_rb_cmd_digx_encoder_control {
struct dmub_cmd_header header;
struct dmub_cmd_digx_encoder_control_data encoder_control;
};
struct dmub_cmd_set_pixel_clock_data {
struct set_pixel_clock_parameter_v1_7 clk;
};
struct dmub_rb_cmd_set_pixel_clock {
struct dmub_cmd_header header;
struct dmub_cmd_set_pixel_clock_data pixel_clock;
};
struct dmub_cmd_enable_disp_power_gating_data {
struct enable_disp_power_gating_parameters_v2_1 pwr;
};
struct dmub_rb_cmd_enable_disp_power_gating {
struct dmub_cmd_header header;
struct dmub_cmd_enable_disp_power_gating_data power_gating;
};
struct dmub_cmd_dig1_transmitter_control_data {
struct dig_transmitter_control_parameters_v1_6 dig;
};
struct dmub_rb_cmd_dig1_transmitter_control {
struct dmub_cmd_header header;
struct dmub_cmd_dig1_transmitter_control_data transmitter_control;
};
struct dmub_rb_cmd_dpphy_init {
struct dmub_cmd_header header;
uint8_t reserved[60];
};
struct dmub_cmd_psr_copy_settings_data {
uint32_t reg1;
uint32_t reg2;
uint32_t reg3;
};
struct dmub_rb_cmd_psr_copy_settings {
struct dmub_cmd_header header;
struct dmub_cmd_psr_copy_settings_data psr_copy_settings_data;
};
struct dmub_cmd_psr_set_level_data {
uint16_t psr_level;
};
struct dmub_rb_cmd_psr_set_level {
struct dmub_cmd_header header;
struct dmub_cmd_psr_set_level_data psr_set_level_data;
};
struct dmub_rb_cmd_psr_disable {
struct dmub_cmd_header header;
};
struct dmub_rb_cmd_psr_enable {
struct dmub_cmd_header header;
};
struct dmub_cmd_psr_notify_vblank_data {
uint32_t vblank_int; // Which vblank interrupt was triggered
};
struct dmub_rb_cmd_notify_vblank {
struct dmub_cmd_header header;
struct dmub_cmd_psr_notify_vblank_data psr_notify_vblank_data;
};
struct dmub_cmd_psr_notify_static_state_data {
uint32_t ss_int; // Which static screen interrupt was triggered
uint32_t ss_enter; // Enter (1) or exit (0) static screen
};
struct dmub_rb_cmd_psr_notify_static_state {
struct dmub_cmd_header header;
struct dmub_cmd_psr_notify_static_state_data psr_notify_static_state_data;
};
union dmub_rb_cmd {
struct dmub_rb_cmd_read_modify_write read_modify_write;
struct dmub_rb_cmd_reg_field_update_sequence reg_field_update_seq;
struct dmub_rb_cmd_burst_write burst_write;
struct dmub_rb_cmd_reg_wait reg_wait;
struct dmub_rb_cmd_common cmd_common;
struct dmub_rb_cmd_digx_encoder_control digx_encoder_control;
struct dmub_rb_cmd_set_pixel_clock set_pixel_clock;
struct dmub_rb_cmd_enable_disp_power_gating enable_disp_power_gating;
struct dmub_rb_cmd_dpphy_init dpphy_init;
struct dmub_rb_cmd_dig1_transmitter_control dig1_transmitter_control;
struct dmub_rb_cmd_psr_enable psr_enable;
struct dmub_rb_cmd_psr_disable psr_disable;
struct dmub_rb_cmd_psr_copy_settings psr_copy_settings;
struct dmub_rb_cmd_psr_set_level psr_set_level;
};
#pragma pack(pop)
#endif /* _DMUB_CMD_H_ */
/*
* Copyright 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef _DMUB_RB_H_
#define _DMUB_RB_H_
#include "dmub_types.h"
#include "dmub_cmd.h"
#if defined(__cplusplus)
extern "C" {
#endif
struct dmub_cmd_header;
struct dmub_rb_init_params {
void *ctx;
void *base_address;
uint32_t capacity;
};
struct dmub_rb {
void *base_address;
uint32_t data_count;
uint32_t rptr;
uint32_t wrpt;
uint32_t capacity;
void *ctx;
void *dmub;
};
static inline bool dmub_rb_empty(struct dmub_rb *rb)
{
return (rb->wrpt == rb->rptr);
}
static inline bool dmub_rb_full(struct dmub_rb *rb)
{
uint32_t data_count;
if (rb->wrpt >= rb->rptr)
data_count = rb->wrpt - rb->rptr;
else
data_count = rb->capacity - (rb->rptr - rb->wrpt);
return (data_count == (rb->capacity - DMUB_RB_CMD_SIZE));
}
static inline bool dmub_rb_push_front(struct dmub_rb *rb,
const struct dmub_cmd_header *cmd)
{
uint8_t *wt_ptr = (uint8_t *)(rb->base_address) + rb->wrpt;
if (dmub_rb_full(rb))
return false;
dmub_memcpy(wt_ptr, cmd, DMUB_RB_CMD_SIZE);
rb->wrpt += DMUB_RB_CMD_SIZE;
if (rb->wrpt >= rb->capacity)
rb->wrpt %= rb->capacity;
return true;
}
static inline bool dmub_rb_front(struct dmub_rb *rb,
struct dmub_cmd_header *cmd)
{
uint8_t *rd_ptr = (uint8_t *)rb->base_address + rb->rptr;
if (dmub_rb_empty(rb))
return false;
dmub_memcpy(cmd, rd_ptr, DMUB_RB_CMD_SIZE);
return true;
}
static inline bool dmub_rb_pop_front(struct dmub_rb *rb)
{
if (dmub_rb_empty(rb))
return false;
rb->rptr += DMUB_RB_CMD_SIZE;
if (rb->rptr >= rb->capacity)
rb->rptr %= rb->capacity;
return true;
}
static inline void dmub_rb_init(struct dmub_rb *rb,
struct dmub_rb_init_params *init_params)
{
rb->base_address = init_params->base_address;
rb->capacity = init_params->capacity;
rb->rptr = 0;
rb->wrpt = 0;
}
#if defined(__cplusplus)
}
#endif
#endif /* _DMUB_RB_H_ */
This diff is collapsed.
/*
* Copyright 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef _DMUB_TRACE_BUFFER_H_
#define _DMUB_TRACE_BUFFER_H_
#include "dmub_types.h"
#define LOAD_DMCU_FW 1
#define LOAD_PHY_FW 2
struct dmcub_trace_buf_entry {
uint32_t trace_code;
uint32_t tick_count;
uint32_t param0;
uint32_t param1;
};
#define TRACE_BUF_SIZE (1024) //1 kB
#define PERF_TRACE_MAX_ENTRY ((TRACE_BUF_SIZE - 8)/sizeof(struct dmcub_trace_buf_entry))
struct dmcub_trace_buf {
uint32_t entry_count;
uint32_t clk_freq;
struct dmcub_trace_buf_entry entries[PERF_TRACE_MAX_ENTRY];
};
#endif /* _DMUB_TRACE_BUFFER_H_ */
/*
* Copyright 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef _DMUB_TYPES_H_
#define _DMUB_TYPES_H_
/* Basic type definitions. */
#include <asm/byteorder.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/delay.h>
#include <stdarg.h>
#if defined(__cplusplus)
extern "C" {
#endif
#ifndef dmub_memcpy
#define dmub_memcpy(dest, source, bytes) memcpy((dest), (source), (bytes))
#endif
#ifndef dmub_memset
#define dmub_memset(dest, val, bytes) memset((dest), (val), (bytes))
#endif
#ifndef dmub_udelay
#define dmub_udelay(microseconds) udelay(microseconds)
#endif
union dmub_addr {
struct {
uint32_t low_part;
uint32_t high_part;
} u;
uint64_t quad_part;
};
#if defined(__cplusplus)
}
#endif
#endif /* _DMUB_TYPES_H_ */
#
# Copyright 2019 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
ifdef CONFIG_DRM_AMD_DC_DMUB
DMUB = dmub_srv.o dmub_reg.o dmub_dcn20.o dmub_dcn21.o
AMD_DAL_DMUB = $(addprefix $(AMDDALPATH)/dmub/src/,$(DMUB))
AMD_DISPLAY_FILES += $(AMD_DAL_DMUB)
endif
/*
* Copyright 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#include "../inc/dmub_srv.h"
#include "dmub_reg.h"
#include "dcn/dcn_2_0_0_offset.h"
#include "dcn/dcn_2_0_0_sh_mask.h"
#include "soc15_hw_ip.h"
#include "vega10_ip_offset.h"
#define BASE_INNER(seg) DCN_BASE__INST0_SEG##seg
#define CTX dmub
void dmub_dcn20_reset(struct dmub_srv *dmub)
{
REG_UPDATE(DMCUB_CNTL, DMCUB_SOFT_RESET, 1);
REG_UPDATE(DMCUB_CNTL, DMCUB_ENABLE, 0);
}
void dmub_dcn20_reset_release(struct dmub_srv *dmub)
{
REG_WRITE(DMCUB_SCRATCH15, dmub->psp_version & 0x001100FF);
REG_UPDATE_2(DMCUB_CNTL, DMCUB_ENABLE, 1, DMCUB_TRACEPORT_EN, 1);
REG_UPDATE(DMCUB_CNTL, DMCUB_SOFT_RESET, 0);
}
void dmub_dcn20_backdoor_load(struct dmub_srv *dmub, struct dmub_window *cw0,
struct dmub_window *cw1)
{
REG_UPDATE(DMCUB_SEC_CNTL, DMCUB_SEC_RESET, 1);
REG_UPDATE_2(DMCUB_MEM_CNTL, DMCUB_MEM_READ_SPACE, 0x4,
DMCUB_MEM_WRITE_SPACE, 0x4);
REG_WRITE(DMCUB_REGION3_CW0_OFFSET, cw0->offset.u.low_part);
REG_WRITE(DMCUB_REGION3_CW0_OFFSET_HIGH, cw0->offset.u.high_part);
REG_WRITE(DMCUB_REGION3_CW0_BASE_ADDRESS, cw0->region.base);
REG_SET_2(DMCUB_REGION3_CW0_TOP_ADDRESS, 0,
DMCUB_REGION3_CW0_TOP_ADDRESS, cw0->region.top,
DMCUB_REGION3_CW0_ENABLE, 1);
REG_WRITE(DMCUB_REGION3_CW1_OFFSET, cw1->offset.u.low_part);
REG_WRITE(DMCUB_REGION3_CW1_OFFSET_HIGH, cw1->offset.u.high_part);
REG_WRITE(DMCUB_REGION3_CW1_BASE_ADDRESS, cw1->region.base);
REG_SET_2(DMCUB_REGION3_CW1_TOP_ADDRESS, 0,
DMCUB_REGION3_CW1_TOP_ADDRESS, cw1->region.top,
DMCUB_REGION3_CW1_ENABLE, 1);
REG_UPDATE_2(DMCUB_SEC_CNTL, DMCUB_SEC_RESET, 0, DMCUB_MEM_UNIT_ID,
0x20);
}
void dmub_dcn20_setup_windows(struct dmub_srv *dmub,
const struct dmub_window *cw2,
const struct dmub_window *cw3,
const struct dmub_window *cw4,
const struct dmub_window *cw5)
{
REG_WRITE(DMCUB_REGION3_CW2_OFFSET, cw2->offset.u.low_part);
REG_WRITE(DMCUB_REGION3_CW2_OFFSET_HIGH, cw2->offset.u.high_part);
REG_WRITE(DMCUB_REGION3_CW2_BASE_ADDRESS, cw2->region.base);
REG_SET_2(DMCUB_REGION3_CW2_TOP_ADDRESS, 0,
DMCUB_REGION3_CW2_TOP_ADDRESS, cw2->region.top,
DMCUB_REGION3_CW2_ENABLE, 1);
REG_WRITE(DMCUB_REGION3_CW3_OFFSET, cw3->offset.u.low_part);
REG_WRITE(DMCUB_REGION3_CW3_OFFSET_HIGH, cw3->offset.u.high_part);
REG_WRITE(DMCUB_REGION3_CW3_BASE_ADDRESS, cw3->region.base);
REG_SET_2(DMCUB_REGION3_CW3_TOP_ADDRESS, 0,
DMCUB_REGION3_CW3_TOP_ADDRESS, cw3->region.top,
DMCUB_REGION3_CW3_ENABLE, 1);
/* TODO: Move this to CW4. */
REG_WRITE(DMCUB_REGION4_OFFSET, cw4->offset.u.low_part);
REG_WRITE(DMCUB_REGION4_OFFSET_HIGH, cw4->offset.u.high_part);
REG_SET_2(DMCUB_REGION4_TOP_ADDRESS, 0, DMCUB_REGION4_TOP_ADDRESS,
cw4->region.top - cw4->region.base - 1, DMCUB_REGION4_ENABLE,
1);
}
void dmub_dcn20_setup_mailbox(struct dmub_srv *dmub,
const struct dmub_region *inbox1)
{
/* TODO: Use CW4 instead of region 4. */
REG_WRITE(DMCUB_INBOX1_BASE_ADDRESS, 0x80000000);
REG_WRITE(DMCUB_INBOX1_SIZE, inbox1->top - inbox1->base);
REG_WRITE(DMCUB_INBOX1_RPTR, 0);
REG_WRITE(DMCUB_INBOX1_WPTR, 0);
}
uint32_t dmub_dcn20_get_inbox1_rptr(struct dmub_srv *dmub)
{
return REG_READ(DMCUB_INBOX1_RPTR);
}
void dmub_dcn20_set_inbox1_wptr(struct dmub_srv *dmub, uint32_t wptr_offset)
{
REG_WRITE(DMCUB_INBOX1_WPTR, wptr_offset);
}
bool dmub_dcn20_is_supported(struct dmub_srv *dmub)
{
uint32_t supported = 0;
REG_GET(CC_DC_PIPE_DIS, DC_DMCUB_ENABLE, &supported);
return supported;
}
bool dmub_dcn20_is_phy_init(struct dmub_srv *dmub)
{
return REG_READ(DMCUB_SCRATCH10) != 0;
}
/*
* Copyright 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef _DMUB_DCN20_H_
#define _DMUB_DCN20_H_
#include "../inc/dmub_types.h"
struct dmub_srv;
/* Hardware functions. */
void dmub_dcn20_init(struct dmub_srv *dmub);
void dmub_dcn20_reset(struct dmub_srv *dmub);
void dmub_dcn20_reset_release(struct dmub_srv *dmub);
void dmub_dcn20_backdoor_load(struct dmub_srv *dmub,
const struct dmub_window *cw0,
const struct dmub_window *cw1);
void dmub_dcn20_setup_windows(struct dmub_srv *dmub,
const struct dmub_window *cw2,
const struct dmub_window *cw3,
const struct dmub_window *cw4,
const struct dmub_window *cw5);
void dmub_dcn20_setup_mailbox(struct dmub_srv *dmub,
const struct dmub_region *inbox1);
uint32_t dmub_dcn20_get_inbox1_rptr(struct dmub_srv *dmub);
void dmub_dcn20_set_inbox1_wptr(struct dmub_srv *dmub, uint32_t wptr_offset);
bool dmub_dcn20_is_supported(struct dmub_srv *dmub);
bool dmub_dcn20_is_phy_init(struct dmub_srv *dmub);
#endif /* _DMUB_DCN20_H_ */
/*
* Copyright 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#include "../inc/dmub_srv.h"
#include "dmub_reg.h"
#include "dcn/dcn_2_1_0_offset.h"
#include "dcn/dcn_2_1_0_sh_mask.h"
#include "renoir_ip_offset.h"
#define BASE_INNER(seg) DMU_BASE__INST0_SEG##seg
#define CTX dmub
static inline void dmub_dcn21_translate_addr(const union dmub_addr *addr_in,
uint64_t fb_base,
uint64_t fb_offset,
union dmub_addr *addr_out)
{
addr_out->quad_part = addr_in->quad_part - fb_base + fb_offset;
}
void dmub_dcn21_backdoor_load(struct dmub_srv *dmub,
const struct dmub_window *cw0,
const struct dmub_window *cw1)
{
union dmub_addr offset;
uint64_t fb_base = dmub->fb_base, fb_offset = dmub->fb_offset;
REG_UPDATE(DMCUB_SEC_CNTL, DMCUB_SEC_RESET, 1);
REG_UPDATE_2(DMCUB_MEM_CNTL, DMCUB_MEM_READ_SPACE, 0x3,
DMCUB_MEM_WRITE_SPACE, 0x3);
dmub_dcn21_translate_addr(&cw0->offset, fb_base, fb_offset, &offset);
REG_WRITE(DMCUB_REGION3_CW0_OFFSET, offset.u.low_part);
REG_WRITE(DMCUB_REGION3_CW0_OFFSET_HIGH, offset.u.high_part);
REG_WRITE(DMCUB_REGION3_CW0_BASE_ADDRESS, cw0->region.base);
REG_SET_2(DMCUB_REGION3_CW0_TOP_ADDRESS, 0,
DMCUB_REGION3_CW0_TOP_ADDRESS, cw0->region.top,
DMCUB_REGION3_CW0_ENABLE, 1);
dmub_dcn21_translate_addr(&cw1->offset, fb_base, fb_offset, &offset);
REG_WRITE(DMCUB_REGION3_CW1_OFFSET, offset.u.low_part);
REG_WRITE(DMCUB_REGION3_CW1_OFFSET_HIGH, offset.u.high_part);
REG_WRITE(DMCUB_REGION3_CW1_BASE_ADDRESS, cw1->region.base);
REG_SET_2(DMCUB_REGION3_CW1_TOP_ADDRESS, 0,
DMCUB_REGION3_CW1_TOP_ADDRESS, cw1->region.top,
DMCUB_REGION3_CW1_ENABLE, 1);
REG_UPDATE_2(DMCUB_SEC_CNTL, DMCUB_SEC_RESET, 0, DMCUB_MEM_UNIT_ID,
0x20);
}
void dmub_dcn21_setup_windows(struct dmub_srv *dmub,
const struct dmub_window *cw2,
const struct dmub_window *cw3,
const struct dmub_window *cw4,
const struct dmub_window *cw5)
{
union dmub_addr offset;
uint64_t fb_base = dmub->fb_base, fb_offset = dmub->fb_offset;
dmub_dcn21_translate_addr(&cw2->offset, fb_base, fb_offset, &offset);
REG_WRITE(DMCUB_REGION3_CW2_OFFSET, offset.u.low_part);
REG_WRITE(DMCUB_REGION3_CW2_OFFSET_HIGH, offset.u.high_part);
REG_WRITE(DMCUB_REGION3_CW2_BASE_ADDRESS, cw2->region.base);
REG_SET_2(DMCUB_REGION3_CW2_TOP_ADDRESS, 0,
DMCUB_REGION3_CW2_TOP_ADDRESS, cw2->region.top,
DMCUB_REGION3_CW2_ENABLE, 1);
dmub_dcn21_translate_addr(&cw3->offset, fb_base, fb_offset, &offset);
REG_WRITE(DMCUB_REGION3_CW3_OFFSET, offset.u.low_part);
REG_WRITE(DMCUB_REGION3_CW3_OFFSET_HIGH, offset.u.high_part);
REG_WRITE(DMCUB_REGION3_CW3_BASE_ADDRESS, cw3->region.base);
REG_SET_2(DMCUB_REGION3_CW3_TOP_ADDRESS, 0,
DMCUB_REGION3_CW3_TOP_ADDRESS, cw3->region.top,
DMCUB_REGION3_CW3_ENABLE, 1);
/* TODO: Move this to CW4. */
dmub_dcn21_translate_addr(&cw4->offset, fb_base, fb_offset, &offset);
REG_WRITE(DMCUB_REGION4_OFFSET, offset.u.low_part);
REG_WRITE(DMCUB_REGION4_OFFSET_HIGH, offset.u.high_part);
REG_SET_2(DMCUB_REGION4_TOP_ADDRESS, 0, DMCUB_REGION4_TOP_ADDRESS,
cw4->region.top - cw4->region.base - 1, DMCUB_REGION4_ENABLE,
1);
dmub_dcn21_translate_addr(&cw5->offset, fb_base, fb_offset, &offset);
REG_WRITE(DMCUB_REGION3_CW5_OFFSET, offset.u.low_part);
REG_WRITE(DMCUB_REGION3_CW5_OFFSET_HIGH, offset.u.high_part);
REG_WRITE(DMCUB_REGION3_CW5_BASE_ADDRESS, cw5->region.base);
REG_SET_2(DMCUB_REGION3_CW5_TOP_ADDRESS, 0,
DMCUB_REGION3_CW5_TOP_ADDRESS, cw5->region.top,
DMCUB_REGION3_CW5_ENABLE, 1);
}
bool dmub_dcn21_is_auto_load_done(struct dmub_srv *dmub)
{
return (REG_READ(DMCUB_SCRATCH0) == 3);
}
/*
* Copyright 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef _DMUB_DCN21_H_
#define _DMUB_DCN21_H_
#include "dmub_dcn20.h"
/* Hardware functions. */
void dmub_dcn21_backdoor_load(struct dmub_srv *dmub,
const struct dmub_window *cw0,
const struct dmub_window *cw1);
void dmub_dcn21_setup_windows(struct dmub_srv *dmub,
const struct dmub_window *cw2,
const struct dmub_window *cw3,
const struct dmub_window *cw4,
const struct dmub_window *cw5);
bool dmub_dcn21_is_auto_load_done(struct dmub_srv *dmub);
#endif /* _DMUB_DCN21_H_ */
/*
* Copyright 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#include "dmub_reg.h"
#include "../inc/dmub_srv.h"
struct dmub_reg_value_masks {
uint32_t value;
uint32_t mask;
};
static inline void
set_reg_field_value_masks(struct dmub_reg_value_masks *field_value_mask,
uint32_t value, uint32_t mask, uint8_t shift)
{
field_value_mask->value =
(field_value_mask->value & ~mask) | (mask & (value << shift));
field_value_mask->mask = field_value_mask->mask | mask;
}
static void set_reg_field_values(struct dmub_reg_value_masks *field_value_mask,
uint32_t addr, int n, uint8_t shift1,
uint32_t mask1, uint32_t field_value1,
va_list ap)
{
uint32_t shift, mask, field_value;
int i = 1;
/* gather all bits value/mask getting updated in this register */
set_reg_field_value_masks(field_value_mask, field_value1, mask1,
shift1);
while (i < n) {
shift = va_arg(ap, uint32_t);
mask = va_arg(ap, uint32_t);
field_value = va_arg(ap, uint32_t);
set_reg_field_value_masks(field_value_mask, field_value, mask,
shift);
i++;
}
}
static inline uint32_t get_reg_field_value_ex(uint32_t reg_value, uint32_t mask,
uint8_t shift)
{
return (mask & reg_value) >> shift;
}
void dmub_reg_update(struct dmub_srv *srv, uint32_t addr, int n, uint8_t shift1,
uint32_t mask1, uint32_t field_value1, ...)
{
struct dmub_reg_value_masks field_value_mask = { 0 };
uint32_t reg_val;
va_list ap;
va_start(ap, field_value1);
set_reg_field_values(&field_value_mask, addr, n, shift1, mask1,
field_value1, ap);
va_end(ap);
reg_val = srv->funcs.reg_read(srv->user_ctx, addr);
reg_val = (reg_val & ~field_value_mask.mask) | field_value_mask.value;
srv->funcs.reg_write(srv->user_ctx, addr, reg_val);
}
void dmub_reg_set(struct dmub_srv *srv, uint32_t addr, uint32_t reg_val, int n,
uint8_t shift1, uint32_t mask1, uint32_t field_value1, ...)
{
struct dmub_reg_value_masks field_value_mask = { 0 };
va_list ap;
va_start(ap, field_value1);
set_reg_field_values(&field_value_mask, addr, n, shift1, mask1,
field_value1, ap);
va_end(ap);
reg_val = (reg_val & ~field_value_mask.mask) | field_value_mask.value;
srv->funcs.reg_write(srv->user_ctx, addr, reg_val);
}
void dmub_reg_get(struct dmub_srv *srv, uint32_t addr, uint8_t shift,
uint32_t mask, uint32_t *field_value)
{
uint32_t reg_val = srv->funcs.reg_read(srv->user_ctx, addr);
*field_value = get_reg_field_value_ex(reg_val, mask, shift);
}
/*
* Copyright 2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* Authors: AMD
*
*/
#ifndef _DMUB_REG_H_
#define _DMUB_REG_H_
#include "../inc/dmub_types.h"
struct dmub_srv;
/* Register offset and field lookup. */
#define BASE(seg) BASE_INNER(seg)
#define REG_OFFSET(base_index, addr) (BASE(base_index) + addr)
#define REG(reg_name) REG_OFFSET(mm ## reg_name ## _BASE_IDX, mm ## reg_name)
#define FD(reg_field) reg_field ## __SHIFT, reg_field ## _MASK
#define FN(reg_name, field) FD(reg_name##__##field)
/* Register reads and writes. */
#define REG_READ(reg) ((CTX)->funcs.reg_read((CTX)->user_ctx, REG(reg)))
#define REG_WRITE(reg, val) \
((CTX)->funcs.reg_write((CTX)->user_ctx, REG(reg), (val)))
/* Register field setting. */
#define REG_SET_N(reg_name, n, initial_val, ...) \
dmub_reg_set(CTX, REG(reg_name), initial_val, n, __VA_ARGS__)
#define REG_SET(reg_name, initial_val, field, val) \
REG_SET_N(reg_name, 1, initial_val, \
FN(reg_name, field), val)
#define REG_SET_2(reg, init_value, f1, v1, f2, v2) \
REG_SET_N(reg, 2, init_value, \
FN(reg, f1), v1, \
FN(reg, f2), v2)
#define REG_SET_3(reg, init_value, f1, v1, f2, v2, f3, v3) \
REG_SET_N(reg, 3, init_value, \
FN(reg, f1), v1, \
FN(reg, f2), v2, \
FN(reg, f3), v3)
#define REG_SET_4(reg, init_value, f1, v1, f2, v2, f3, v3, f4, v4) \
REG_SET_N(reg, 4, init_value, \
FN(reg, f1), v1, \
FN(reg, f2), v2, \
FN(reg, f3), v3, \
FN(reg, f4), v4)
/* Register field updating. */
#define REG_UPDATE_N(reg_name, n, ...)\
dmub_reg_update(CTX, REG(reg_name), n, __VA_ARGS__)
#define REG_UPDATE(reg_name, field, val) \
REG_UPDATE_N(reg_name, 1, \
FN(reg_name, field), val)
#define REG_UPDATE_2(reg, f1, v1, f2, v2) \
REG_UPDATE_N(reg, 2,\
FN(reg, f1), v1,\
FN(reg, f2), v2)
#define REG_UPDATE_3(reg, f1, v1, f2, v2, f3, v3) \
REG_UPDATE_N(reg, 3, \
FN(reg, f1), v1, \
FN(reg, f2), v2, \
FN(reg, f3), v3)
#define REG_UPDATE_4(reg, f1, v1, f2, v2, f3, v3, f4, v4) \
REG_UPDATE_N(reg, 4, \
FN(reg, f1), v1, \
FN(reg, f2), v2, \
FN(reg, f3), v3, \
FN(reg, f4), v4)
/* Register field getting. */
#define REG_GET(reg_name, field, val) \
dmub_reg_get(CTX, REG(reg_name), FN(reg_name, field), val)
void dmub_reg_set(struct dmub_srv *srv, uint32_t addr, uint32_t reg_val, int n,
uint8_t shift1, uint32_t mask1, uint32_t field_value1, ...);
void dmub_reg_update(struct dmub_srv *srv, uint32_t addr, int n, uint8_t shift1,
uint32_t mask1, uint32_t field_value1, ...);
void dmub_reg_get(struct dmub_srv *srv, uint32_t addr, uint8_t shift,
uint32_t mask, uint32_t *field_value);
#endif /* _DMUB_REG_H_ */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment