From: Cruise Hung <cruise.h...@amd.com>

[Why & How]
To query the bits and print them out for debug purposes.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlaus...@amd.com>
Acked-by: Alan Liu <haoping....@amd.com>
Signed-off-by: Cruise Hung <cruise.h...@amd.com>
---
 drivers/gpu/drm/amd/display/dmub/dmub_srv.h       |  4 ++++
 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c |  8 ++++++++
 drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h |  2 ++
 drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c   | 15 +++++++++++++++
 4 files changed, 29 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dmub/dmub_srv.h 
b/drivers/gpu/drm/amd/display/dmub/dmub_srv.h
index 4585e0419da6..53bd9bf8f0c8 100644
--- a/drivers/gpu/drm/amd/display/dmub/dmub_srv.h
+++ b/drivers/gpu/drm/amd/display/dmub/dmub_srv.h
@@ -378,6 +378,7 @@ struct dmub_srv_hw_funcs {
 
        union dmub_fw_boot_status (*get_fw_status)(struct dmub_srv *dmub);
 
+       union dmub_fw_boot_options (*get_fw_boot_option)(struct dmub_srv *dmub);
 
        void (*set_gpint)(struct dmub_srv *dmub,
                          union dmub_gpint_data_register reg);
@@ -778,6 +779,9 @@ void dmub_flush_buffer_mem(const struct dmub_fb *fb);
 enum dmub_status dmub_srv_get_fw_boot_status(struct dmub_srv *dmub,
                                             union dmub_fw_boot_status *status);
 
+enum dmub_status dmub_srv_get_fw_boot_option(struct dmub_srv *dmub,
+                                            union dmub_fw_boot_options 
*option);
+
 enum dmub_status dmub_srv_cmd_with_reply_data(struct dmub_srv *dmub,
                                              union dmub_rb_cmd *cmd);
 
diff --git a/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c 
b/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c
index 5e952541e72d..094e9f864557 100644
--- a/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c
+++ b/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.c
@@ -352,6 +352,14 @@ union dmub_fw_boot_status 
dmub_dcn31_get_fw_boot_status(struct dmub_srv *dmub)
        return status;
 }
 
+union dmub_fw_boot_options dmub_dcn31_get_fw_boot_option(struct dmub_srv *dmub)
+{
+       union dmub_fw_boot_options option;
+
+       option.all = REG_READ(DMCUB_SCRATCH14);
+       return option;
+}
+
 void dmub_dcn31_enable_dmub_boot_options(struct dmub_srv *dmub, const struct 
dmub_srv_hw_params *params)
 {
        union dmub_fw_boot_options boot_options = {0};
diff --git a/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h 
b/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h
index 89c5a948b67d..4d520a893c7b 100644
--- a/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h
+++ b/drivers/gpu/drm/amd/display/dmub/src/dmub_dcn31.h
@@ -239,6 +239,8 @@ void dmub_dcn31_skip_dmub_panel_power_sequence(struct 
dmub_srv *dmub, bool skip)
 
 union dmub_fw_boot_status dmub_dcn31_get_fw_boot_status(struct dmub_srv *dmub);
 
+union dmub_fw_boot_options dmub_dcn31_get_fw_boot_option(struct dmub_srv 
*dmub);
+
 void dmub_dcn31_setup_outbox0(struct dmub_srv *dmub,
                              const struct dmub_region *outbox0);
 
diff --git a/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c 
b/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
index 3253162e3701..70af110af687 100644
--- a/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
+++ b/drivers/gpu/drm/amd/display/dmub/src/dmub_srv.c
@@ -255,6 +255,7 @@ static bool dmub_srv_hw_setup(struct dmub_srv *dmub, enum 
dmub_asic asic)
                funcs->get_gpint_response = dmub_dcn31_get_gpint_response;
                funcs->get_gpint_dataout = dmub_dcn31_get_gpint_dataout;
                funcs->get_fw_status = dmub_dcn31_get_fw_boot_status;
+               funcs->get_fw_boot_option = dmub_dcn31_get_fw_boot_option;
                funcs->enable_dmub_boot_options = 
dmub_dcn31_enable_dmub_boot_options;
                funcs->skip_dmub_panel_power_sequence = 
dmub_dcn31_skip_dmub_panel_power_sequence;
                //outbox0 call stacks
@@ -846,6 +847,20 @@ enum dmub_status dmub_srv_get_fw_boot_status(struct 
dmub_srv *dmub,
        return DMUB_STATUS_OK;
 }
 
+enum dmub_status dmub_srv_get_fw_boot_option(struct dmub_srv *dmub,
+                                            union dmub_fw_boot_options *option)
+{
+       option->all = 0;
+
+       if (!dmub->sw_init)
+               return DMUB_STATUS_INVALID;
+
+       if (dmub->hw_funcs.get_fw_boot_option)
+               *option = dmub->hw_funcs.get_fw_boot_option(dmub);
+
+       return DMUB_STATUS_OK;
+}
+
 enum dmub_status dmub_srv_cmd_with_reply_data(struct dmub_srv *dmub,
                                              union dmub_rb_cmd *cmd)
 {
-- 
2.34.1

Reply via email to