drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c- Extension
.c- Size
- 15757 bytes
- Lines
- 506
- 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.hdmub_reg.hdmub_dcn31.hyellow_carp_offset.hdcn/dcn_3_1_2_offset.hdcn/dcn_3_1_2_sh_mask.h
Detected Declarations
function dmub_dcn31_get_fb_base_offsetfunction dmub_dcn31_translate_addrfunction dmub_dcn31_resetfunction dmub_dcn31_reset_releasefunction dmub_dcn31_backdoor_loadfunction dmub_dcn31_setup_windowsfunction dmub_dcn31_setup_mailboxfunction dmub_dcn31_get_inbox1_wptrfunction dmub_dcn31_get_inbox1_rptrfunction dmub_dcn31_set_inbox1_wptrfunction dmub_dcn31_setup_out_mailboxfunction dmub_dcn31_get_outbox1_wptrfunction dmub_dcn31_set_outbox1_rptrfunction dmub_dcn31_is_hw_initfunction dmub_dcn31_is_supportedfunction dmub_dcn31_is_psrsu_supportedfunction dmub_dcn31_set_gpintfunction dmub_dcn31_is_gpint_ackedfunction dmub_dcn31_get_gpint_responsefunction dmub_dcn31_get_gpint_dataoutfunction dmub_dcn31_get_fw_boot_statusfunction dmub_dcn31_get_fw_boot_optionfunction dmub_dcn31_enable_dmub_boot_optionsfunction dmub_dcn31_skip_dmub_panel_power_sequencefunction dmub_dcn31_setup_outbox0function dmub_dcn31_get_outbox0_wptrfunction dmub_dcn31_set_outbox0_rptrfunction dmub_dcn31_get_current_timefunction dmub_dcn31_get_diagnostic_datafunction dmub_dcn31_should_detect
Annotated Snippet
#include "../dmub_srv.h"
#include "dmub_reg.h"
#include "dmub_dcn31.h"
#include "yellow_carp_offset.h"
#include "dcn/dcn_3_1_2_offset.h"
#include "dcn/dcn_3_1_2_sh_mask.h"
#define BASE_INNER(seg) DCN_BASE__INST0_SEG##seg
#define CTX dmub
#define REGS dmub->regs_dcn31
#define REG_OFFSET_EXP(reg_name) (BASE(reg##reg_name##_BASE_IDX) + reg##reg_name)
const struct dmub_srv_dcn31_regs dmub_srv_dcn31_regs = {
#define DMUB_SR(reg) REG_OFFSET_EXP(reg),
{
DMUB_DCN31_REGS()
DMCUB_INTERNAL_REGS()
},
#undef DMUB_SR
#define DMUB_SF(reg, field) FD_MASK(reg, field),
{ DMUB_DCN31_FIELDS() },
#undef DMUB_SF
#define DMUB_SF(reg, field) FD_SHIFT(reg, field),
{ DMUB_DCN31_FIELDS() },
#undef DMUB_SF
};
static void dmub_dcn31_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_dcn31_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_dcn31_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);
if (in_reset == 0) {
cmd.bits.status = 1;
cmd.bits.command_code = DMUB_GPINT__STOP_FW;
cmd.bits.param = 0;
dmub->hw_funcs.set_gpint(dmub, cmd);
/**
* Timeout covers both the ACK and the wait
* for remaining work to finish.
*/
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);
Annotation
- Immediate include surface: `../dmub_srv.h`, `dmub_reg.h`, `dmub_dcn31.h`, `yellow_carp_offset.h`, `dcn/dcn_3_1_2_offset.h`, `dcn/dcn_3_1_2_sh_mask.h`.
- Detected declarations: `function dmub_dcn31_get_fb_base_offset`, `function dmub_dcn31_translate_addr`, `function dmub_dcn31_reset`, `function dmub_dcn31_reset_release`, `function dmub_dcn31_backdoor_load`, `function dmub_dcn31_setup_windows`, `function dmub_dcn31_setup_mailbox`, `function dmub_dcn31_get_inbox1_wptr`, `function dmub_dcn31_get_inbox1_rptr`, `function dmub_dcn31_set_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.