drivers/gpu/drm/amd/display/dmub/src/dmub_dcn35.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn35.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn35.c- Extension
.c- Size
- 20129 bytes
- Lines
- 621
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
../dmub_srv.hdc_types.hdmub_reg.hdmub_dcn35.hdc/dc_types.hdcn/dcn_3_5_0_offset.hdcn/dcn_3_5_0_sh_mask.h
Detected Declarations
function filesfunction dmub_dcn35_get_fb_base_offsetfunction dmub_dcn35_translate_addrfunction dmub_dcn35_resetfunction dmub_dcn35_reset_releasefunction dmub_dcn35_backdoor_loadfunction dmub_dcn35_backdoor_load_zfb_modefunction dmub_dcn35_setup_windowsfunction dmub_dcn35_setup_mailboxfunction dmub_dcn35_get_inbox1_wptrfunction dmub_dcn35_get_inbox1_rptrfunction dmub_dcn35_set_inbox1_wptrfunction dmub_dcn35_setup_out_mailboxfunction dmub_dcn35_get_outbox1_wptrfunction dmub_dcn35_set_outbox1_rptrfunction dmub_dcn35_is_hw_initfunction dmub_dcn35_is_supportedfunction dmub_dcn35_set_gpintfunction dmub_dcn35_is_gpint_ackedfunction dmub_dcn35_get_gpint_responsefunction dmub_dcn35_get_gpint_dataoutfunction dmub_dcn35_get_fw_boot_statusfunction dmub_dcn35_get_fw_boot_optionfunction dmub_dcn35_enable_dmub_boot_optionsfunction dmub_dcn35_skip_dmub_panel_power_sequencefunction dmub_dcn35_setup_outbox0function dmub_dcn35_get_outbox0_wptrfunction dmub_dcn35_set_outbox0_rptrfunction dmub_dcn35_get_current_timefunction dmub_dcn35_get_diagnostic_datafunction dmub_dcn35_get_preos_fw_infofunction dmub_dcn35_configure_dmub_in_system_memoryfunction dmub_dcn35_should_detectfunction dmub_dcn35_send_inbox0_cmdfunction dmub_dcn35_clear_inbox0_ack_registerfunction dmub_dcn35_read_inbox0_ack_registerfunction dmub_dcn35_is_hw_powered_up
Annotated Snippet
void dmub_srv_dcn35_regs_init(struct dmub_srv *dmub, struct dc_context *ctx) {
struct dmub_srv_dcn35_regs *regs = dmub->regs_dcn35;
#define REG_STRUCT regs
#define DMUB_SR(reg) REG_STRUCT->offset.reg = REG_OFFSET_EXP(reg);
DMUB_DCN35_REGS()
DMCUB_INTERNAL_REGS()
#undef DMUB_SR
#define DMUB_SF(reg, field) REG_STRUCT->mask.reg##__##field = FD_MASK(reg, field);
DMUB_DCN35_FIELDS()
#undef DMUB_SF
#define DMUB_SF(reg, field) REG_STRUCT->shift.reg##__##field = FD_SHIFT(reg, field);
DMUB_DCN35_FIELDS()
#undef DMUB_SF
#undef REG_STRUCT
}
static void dmub_dcn35_get_fb_base_offset(struct dmub_srv *dmub,
uint64_t *fb_base,
uint64_t *fb_offset)
{
uint32_t tmp;
/*
if (dmub->soc_fb_info.fb_base || dmub->soc_fb_info.fb_offset) {
*fb_base = dmub->soc_fb_info.fb_base;
*fb_offset = dmub->soc_fb_info.fb_offset;
return;
}
*/
REG_GET(DCN_VM_FB_LOCATION_BASE, FB_BASE, &tmp);
*fb_base = (uint64_t)tmp << 24;
REG_GET(DCN_VM_FB_OFFSET, FB_OFFSET, &tmp);
*fb_offset = (uint64_t)tmp << 24;
}
static inline void dmub_dcn35_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_dcn35_reset(struct dmub_srv *dmub)
{
union dmub_gpint_data_register cmd;
const uint32_t timeout = 100000;
uint32_t in_reset, is_enabled, scratch, i, pwait_mode;
REG_GET(DMCUB_CNTL2, DMCUB_SOFT_RESET, &in_reset);
REG_GET(DMCUB_CNTL, DMCUB_ENABLE, &is_enabled);
if (in_reset == 0 && is_enabled != 0) {
cmd.bits.status = 1;
cmd.bits.command_code = DMUB_GPINT__STOP_FW;
cmd.bits.param = 0;
dmub->hw_funcs.set_gpint(dmub, cmd);
for (i = 0; i < timeout; ++i) {
if (dmub->hw_funcs.is_gpint_acked(dmub, cmd))
break;
udelay(1);
}
for (i = 0; i < timeout; ++i) {
scratch = REG_READ(DMCUB_SCRATCH7);
if (scratch == DMUB_GPINT__STOP_FW_RESPONSE)
break;
udelay(1);
}
for (i = 0; i < timeout; ++i) {
REG_GET(DMCUB_CNTL, DMCUB_PWAIT_MODE_STATUS, &pwait_mode);
if (pwait_mode & (1 << 0))
break;
udelay(1);
}
/* Force reset in case we timed out, DMCUB is likely hung. */
}
if (is_enabled) {
Annotation
- Immediate include surface: `../dmub_srv.h`, `dc_types.h`, `dmub_reg.h`, `dmub_dcn35.h`, `dc/dc_types.h`, `dcn/dcn_3_5_0_offset.h`, `dcn/dcn_3_5_0_sh_mask.h`.
- Detected declarations: `function files`, `function dmub_dcn35_get_fb_base_offset`, `function dmub_dcn35_translate_addr`, `function dmub_dcn35_reset`, `function dmub_dcn35_reset_release`, `function dmub_dcn35_backdoor_load`, `function dmub_dcn35_backdoor_load_zfb_mode`, `function dmub_dcn35_setup_windows`, `function dmub_dcn35_setup_mailbox`, `function dmub_dcn35_get_inbox1_wptr`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.