Lines Matching refs:dmub
151 static bool dmub_srv_hw_setup(struct dmub_srv *dmub, enum dmub_asic asic) in dmub_srv_hw_setup() argument
153 struct dmub_srv_hw_funcs *funcs = &dmub->hw_funcs; in dmub_srv_hw_setup()
162 dmub->regs = &dmub_srv_dcn20_regs; in dmub_srv_hw_setup()
194 dmub->regs = &dmub_srv_dcn21_regs; in dmub_srv_hw_setup()
199 dmub->regs = &dmub_srv_dcn30_regs; in dmub_srv_hw_setup()
205 dmub->regs = &dmub_srv_dcn301_regs; in dmub_srv_hw_setup()
211 dmub->regs = &dmub_srv_dcn302_regs; in dmub_srv_hw_setup()
217 dmub->regs = &dmub_srv_dcn303_regs; in dmub_srv_hw_setup()
230 dmub->regs_dcn31 = &dmub_srv_dcn315_regs; in dmub_srv_hw_setup()
232 dmub->regs_dcn31 = &dmub_srv_dcn316_regs; in dmub_srv_hw_setup()
234 dmub->regs_dcn31 = &dmub_srv_dcn31_regs; in dmub_srv_hw_setup()
267 dmub->regs_dcn32 = &dmub_srv_dcn32_regs; in dmub_srv_hw_setup()
309 enum dmub_status dmub_srv_create(struct dmub_srv *dmub, in dmub_srv_create() argument
314 dmub_memset(dmub, 0, sizeof(*dmub)); in dmub_srv_create()
316 dmub->funcs = params->funcs; in dmub_srv_create()
317 dmub->user_ctx = params->user_ctx; in dmub_srv_create()
318 dmub->asic = params->asic; in dmub_srv_create()
319 dmub->fw_version = params->fw_version; in dmub_srv_create()
320 dmub->is_virtual = params->is_virtual; in dmub_srv_create()
323 if (!dmub_srv_hw_setup(dmub, params->asic)) { in dmub_srv_create()
331 dmub->hw_funcs.emul_get_inbox1_rptr = in dmub_srv_create()
335 dmub->hw_funcs.emul_set_inbox1_wptr = in dmub_srv_create()
339 dmub->hw_funcs.is_supported = in dmub_srv_create()
344 if (!dmub->hw_funcs.get_inbox1_rptr || in dmub_srv_create()
345 !dmub->hw_funcs.set_inbox1_wptr) { in dmub_srv_create()
352 dmub->sw_init = true; in dmub_srv_create()
354 dmub_srv_destroy(dmub); in dmub_srv_create()
359 void dmub_srv_destroy(struct dmub_srv *dmub) in dmub_srv_destroy() argument
361 dmub_memset(dmub, 0, sizeof(*dmub)); in dmub_srv_destroy()
365 dmub_srv_calc_region_info(struct dmub_srv *dmub, in dmub_srv_calc_region_info() argument
382 if (!dmub->sw_init) in dmub_srv_calc_region_info()
422 if (dmub->fw_version == 0) in dmub_srv_calc_region_info()
423 dmub->fw_version = fw_info->fw_version; in dmub_srv_calc_region_info()
440 enum dmub_status dmub_srv_calc_fb_info(struct dmub_srv *dmub, in dmub_srv_calc_fb_info() argument
448 if (!dmub->sw_init) in dmub_srv_calc_fb_info()
473 enum dmub_status dmub_srv_has_hw_support(struct dmub_srv *dmub, in dmub_srv_has_hw_support() argument
478 if (!dmub->sw_init) in dmub_srv_has_hw_support()
481 if (dmub->hw_funcs.is_supported) in dmub_srv_has_hw_support()
482 *is_supported = dmub->hw_funcs.is_supported(dmub); in dmub_srv_has_hw_support()
487 enum dmub_status dmub_srv_is_hw_init(struct dmub_srv *dmub, bool *is_hw_init) in dmub_srv_is_hw_init() argument
491 if (!dmub->sw_init) in dmub_srv_is_hw_init()
494 if (!dmub->hw_init) in dmub_srv_is_hw_init()
497 if (dmub->hw_funcs.is_hw_init) in dmub_srv_is_hw_init()
498 *is_hw_init = dmub->hw_funcs.is_hw_init(dmub); in dmub_srv_is_hw_init()
503 enum dmub_status dmub_srv_hw_init(struct dmub_srv *dmub, in dmub_srv_hw_init() argument
519 if (!dmub->sw_init) in dmub_srv_hw_init()
528 dmub->fb_base = params->fb_base; in dmub_srv_hw_init()
529 dmub->fb_offset = params->fb_offset; in dmub_srv_hw_init()
530 dmub->psp_version = params->psp_version; in dmub_srv_hw_init()
532 if (dmub->hw_funcs.reset) in dmub_srv_hw_init()
533 dmub->hw_funcs.reset(dmub); in dmub_srv_hw_init()
543 if (params->fw_in_system_memory && dmub->hw_funcs.configure_dmub_in_system_memory) in dmub_srv_hw_init()
544 dmub->hw_funcs.configure_dmub_in_system_memory(dmub); in dmub_srv_hw_init()
546 if (params->load_inst_const && dmub->hw_funcs.backdoor_load) { in dmub_srv_hw_init()
554 if (params->fw_in_system_memory && dmub->hw_funcs.backdoor_load_zfb_mode) in dmub_srv_hw_init()
555 dmub->hw_funcs.backdoor_load_zfb_mode(dmub, &cw0, &cw1); in dmub_srv_hw_init()
557 dmub->hw_funcs.backdoor_load(dmub, &cw0, &cw1); in dmub_srv_hw_init()
595 dmub->fw_state = fw_state_fb->cpu_addr; in dmub_srv_hw_init()
597 dmub->scratch_mem_fb = *scratch_mem_fb; in dmub_srv_hw_init()
599 if (dmub->hw_funcs.setup_windows) in dmub_srv_hw_init()
600 dmub->hw_funcs.setup_windows(dmub, &cw2, &cw3, &cw4, &cw5, &cw6); in dmub_srv_hw_init()
602 if (dmub->hw_funcs.setup_outbox0) in dmub_srv_hw_init()
603 dmub->hw_funcs.setup_outbox0(dmub, &outbox0); in dmub_srv_hw_init()
605 if (dmub->hw_funcs.setup_mailbox) in dmub_srv_hw_init()
606 dmub->hw_funcs.setup_mailbox(dmub, &inbox1); in dmub_srv_hw_init()
607 if (dmub->hw_funcs.setup_out_mailbox) in dmub_srv_hw_init()
608 dmub->hw_funcs.setup_out_mailbox(dmub, &outbox1); in dmub_srv_hw_init()
611 rb_params.ctx = dmub; in dmub_srv_hw_init()
614 dmub_rb_init(&dmub->inbox1_rb, &rb_params); in dmub_srv_hw_init()
617 rb_params.ctx = dmub; in dmub_srv_hw_init()
620 dmub_rb_init(&dmub->outbox1_rb, &rb_params); in dmub_srv_hw_init()
623 outbox0_rb_params.ctx = dmub; in dmub_srv_hw_init()
626 dmub_rb_init(&dmub->outbox0_rb, &outbox0_rb_params); in dmub_srv_hw_init()
629 if (dmub->hw_funcs.enable_dmub_boot_options) in dmub_srv_hw_init()
630 dmub->hw_funcs.enable_dmub_boot_options(dmub, params); in dmub_srv_hw_init()
632 if (dmub->hw_funcs.skip_dmub_panel_power_sequence) in dmub_srv_hw_init()
633 dmub->hw_funcs.skip_dmub_panel_power_sequence(dmub, in dmub_srv_hw_init()
636 if (dmub->hw_funcs.reset_release) in dmub_srv_hw_init()
637 dmub->hw_funcs.reset_release(dmub); in dmub_srv_hw_init()
639 dmub->hw_init = true; in dmub_srv_hw_init()
644 enum dmub_status dmub_srv_hw_reset(struct dmub_srv *dmub) in dmub_srv_hw_reset() argument
646 if (!dmub->sw_init) in dmub_srv_hw_reset()
649 if (dmub->hw_funcs.reset) in dmub_srv_hw_reset()
650 dmub->hw_funcs.reset(dmub); in dmub_srv_hw_reset()
652 dmub->hw_init = false; in dmub_srv_hw_reset()
657 enum dmub_status dmub_srv_cmd_queue(struct dmub_srv *dmub, in dmub_srv_cmd_queue() argument
660 if (!dmub->hw_init) in dmub_srv_cmd_queue()
663 if (dmub_rb_push_front(&dmub->inbox1_rb, cmd)) in dmub_srv_cmd_queue()
669 enum dmub_status dmub_srv_cmd_execute(struct dmub_srv *dmub) in dmub_srv_cmd_execute() argument
673 if (!dmub->hw_init) in dmub_srv_cmd_execute()
681 flush_rb = dmub->inbox1_rb; in dmub_srv_cmd_execute()
682 flush_rb.rptr = dmub->inbox1_last_wptr; in dmub_srv_cmd_execute()
685 dmub->hw_funcs.set_inbox1_wptr(dmub, dmub->inbox1_rb.wrpt); in dmub_srv_cmd_execute()
687 dmub->inbox1_last_wptr = dmub->inbox1_rb.wrpt; in dmub_srv_cmd_execute()
692 enum dmub_status dmub_srv_wait_for_auto_load(struct dmub_srv *dmub, in dmub_srv_wait_for_auto_load() argument
697 if (!dmub->hw_init) in dmub_srv_wait_for_auto_load()
701 union dmub_fw_boot_status status = dmub->hw_funcs.get_fw_status(dmub); in dmub_srv_wait_for_auto_load()
712 enum dmub_status dmub_srv_wait_for_phy_init(struct dmub_srv *dmub, in dmub_srv_wait_for_phy_init() argument
717 if (!dmub->hw_init) in dmub_srv_wait_for_phy_init()
720 if (!dmub->hw_funcs.is_phy_init) in dmub_srv_wait_for_phy_init()
724 if (dmub->hw_funcs.is_phy_init(dmub)) in dmub_srv_wait_for_phy_init()
733 enum dmub_status dmub_srv_wait_for_idle(struct dmub_srv *dmub, in dmub_srv_wait_for_idle() argument
738 if (!dmub->hw_init) in dmub_srv_wait_for_idle()
742 rptr = dmub->hw_funcs.get_inbox1_rptr(dmub); in dmub_srv_wait_for_idle()
744 if (rptr > dmub->inbox1_rb.capacity) in dmub_srv_wait_for_idle()
747 dmub->inbox1_rb.rptr = rptr; in dmub_srv_wait_for_idle()
749 if (dmub_rb_empty(&dmub->inbox1_rb)) in dmub_srv_wait_for_idle()
759 dmub_srv_send_gpint_command(struct dmub_srv *dmub, in dmub_srv_send_gpint_command() argument
766 if (!dmub->sw_init) in dmub_srv_send_gpint_command()
769 if (!dmub->hw_funcs.set_gpint) in dmub_srv_send_gpint_command()
772 if (!dmub->hw_funcs.is_gpint_acked) in dmub_srv_send_gpint_command()
779 dmub->hw_funcs.set_gpint(dmub, reg); in dmub_srv_send_gpint_command()
784 if (dmub->hw_funcs.is_gpint_acked(dmub, reg)) in dmub_srv_send_gpint_command()
791 enum dmub_status dmub_srv_get_gpint_response(struct dmub_srv *dmub, in dmub_srv_get_gpint_response() argument
796 if (!dmub->sw_init) in dmub_srv_get_gpint_response()
799 if (!dmub->hw_funcs.get_gpint_response) in dmub_srv_get_gpint_response()
802 *response = dmub->hw_funcs.get_gpint_response(dmub); in dmub_srv_get_gpint_response()
807 enum dmub_status dmub_srv_get_gpint_dataout(struct dmub_srv *dmub, in dmub_srv_get_gpint_dataout() argument
812 if (!dmub->sw_init) in dmub_srv_get_gpint_dataout()
815 if (!dmub->hw_funcs.get_gpint_dataout) in dmub_srv_get_gpint_dataout()
818 *dataout = dmub->hw_funcs.get_gpint_dataout(dmub); in dmub_srv_get_gpint_dataout()
823 enum dmub_status dmub_srv_get_fw_boot_status(struct dmub_srv *dmub, in dmub_srv_get_fw_boot_status() argument
828 if (!dmub->sw_init) in dmub_srv_get_fw_boot_status()
831 if (dmub->hw_funcs.get_fw_status) in dmub_srv_get_fw_boot_status()
832 *status = dmub->hw_funcs.get_fw_status(dmub); in dmub_srv_get_fw_boot_status()
837 enum dmub_status dmub_srv_cmd_with_reply_data(struct dmub_srv *dmub, in dmub_srv_cmd_with_reply_data() argument
843 status = dmub_srv_cmd_queue(dmub, cmd); in dmub_srv_cmd_with_reply_data()
849 status = dmub_srv_cmd_execute(dmub); in dmub_srv_cmd_with_reply_data()
855 status = dmub_srv_wait_for_idle(dmub, 100000); in dmub_srv_cmd_with_reply_data()
861 dmub_rb_get_return_data(&dmub->inbox1_rb, cmd); in dmub_srv_cmd_with_reply_data()
889 bool dmub_srv_get_outbox0_msg(struct dmub_srv *dmub, struct dmcub_trace_buf_entry *entry) in dmub_srv_get_outbox0_msg() argument
891 dmub->outbox0_rb.wrpt = dmub->hw_funcs.get_outbox0_wptr(dmub); in dmub_srv_get_outbox0_msg()
893 return dmub_rb_out_trace_buffer_front(&dmub->outbox0_rb, (void *)entry); in dmub_srv_get_outbox0_msg()
896 bool dmub_srv_get_diagnostic_data(struct dmub_srv *dmub, struct dmub_diagnostic_data *diag_data) in dmub_srv_get_diagnostic_data() argument
898 if (!dmub || !dmub->hw_funcs.get_diagnostic_data || !diag_data) in dmub_srv_get_diagnostic_data()
900 dmub->hw_funcs.get_diagnostic_data(dmub, diag_data); in dmub_srv_get_diagnostic_data()
904 bool dmub_srv_should_detect(struct dmub_srv *dmub) in dmub_srv_should_detect() argument
906 if (!dmub->hw_init || !dmub->hw_funcs.should_detect) in dmub_srv_should_detect()
909 return dmub->hw_funcs.should_detect(dmub); in dmub_srv_should_detect()
912 enum dmub_status dmub_srv_clear_inbox0_ack(struct dmub_srv *dmub) in dmub_srv_clear_inbox0_ack() argument
914 if (!dmub->hw_init || !dmub->hw_funcs.clear_inbox0_ack_register) in dmub_srv_clear_inbox0_ack()
917 dmub->hw_funcs.clear_inbox0_ack_register(dmub); in dmub_srv_clear_inbox0_ack()
921 enum dmub_status dmub_srv_wait_for_inbox0_ack(struct dmub_srv *dmub, uint32_t timeout_us) in dmub_srv_wait_for_inbox0_ack() argument
926 if (!dmub->hw_init || !dmub->hw_funcs.read_inbox0_ack_register) in dmub_srv_wait_for_inbox0_ack()
930 ack = dmub->hw_funcs.read_inbox0_ack_register(dmub); in dmub_srv_wait_for_inbox0_ack()
937 enum dmub_status dmub_srv_send_inbox0_cmd(struct dmub_srv *dmub, in dmub_srv_send_inbox0_cmd() argument
940 if (!dmub->hw_init || !dmub->hw_funcs.send_inbox0_cmd) in dmub_srv_send_inbox0_cmd()
943 dmub->hw_funcs.send_inbox0_cmd(dmub, data); in dmub_srv_send_inbox0_cmd()