2 * Copyright 2019 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
30 * DOC: DMUB interface and operation
32 * DMUB is the interface to the display DMCUB microcontroller on DCN hardware.
33 * It delegates hardware initialization and command submission to the
34 * microcontroller. DMUB is the shortname for DMCUB.
36 * This interface is not thread-safe. Ensure that all access to the interface
37 * is properly synchronized by the caller.
39 * Initialization and usage of the DMUB service should be done in the
42 * 1. dmub_srv_create()
43 * 2. dmub_srv_has_hw_support()
44 * 3. dmub_srv_calc_region_info()
45 * 4. dmub_srv_hw_init()
47 * The call to dmub_srv_create() is required to use the server.
49 * The calls to dmub_srv_has_hw_support() and dmub_srv_calc_region_info()
50 * are helpers to query cache window size and allocate framebuffer(s)
51 * for the cache windows.
53 * The call to dmub_srv_hw_init() programs the DMCUB registers to prepare
54 * for command submission. Commands can be queued via dmub_srv_cmd_queue()
55 * and executed via dmub_srv_cmd_execute().
57 * If the queue is full the dmub_srv_wait_for_idle() call can be used to
58 * wait until the queue has been cleared.
60 * Destroying the DMUB service can be done by calling dmub_srv_destroy().
61 * This does not clear DMUB hardware state, only software state.
63 * The interface is intended to be standalone and should not depend on any
64 * other component within DAL.
67 #include "inc/dmub_cmd.h"
68 #include "dc/dc_types.h"
70 #if defined(__cplusplus)
74 /* Forward declarations */
76 struct dmub_srv_common_regs;
77 struct dmub_srv_dcn31_regs;
79 struct dmcub_trace_buf_entry;
81 /* enum dmub_status - return code for dmcub functions */
85 DMUB_STATUS_QUEUE_FULL,
88 DMUB_STATUS_HW_FAILURE,
91 /* enum dmub_asic - dmub asic identifier */
111 /* enum dmub_window_id - dmub window identifier */
112 enum dmub_window_id {
113 DMUB_WINDOW_0_INST_CONST = 0,
115 DMUB_WINDOW_2_BSS_DATA,
117 DMUB_WINDOW_4_MAILBOX,
118 DMUB_WINDOW_5_TRACEBUFF,
119 DMUB_WINDOW_6_FW_STATE,
120 DMUB_WINDOW_7_SCRATCH_MEM,
124 /* enum dmub_notification_type - dmub outbox notification identifier */
125 enum dmub_notification_type {
126 DMUB_NOTIFICATION_NO_DATA = 0,
127 DMUB_NOTIFICATION_AUX_REPLY,
128 DMUB_NOTIFICATION_HPD,
129 DMUB_NOTIFICATION_HPD_IRQ,
130 DMUB_NOTIFICATION_SET_CONFIG_REPLY,
131 DMUB_NOTIFICATION_DPIA_NOTIFICATION,
132 DMUB_NOTIFICATION_MAX
136 * DPIA NOTIFICATION Response Type
138 enum dpia_notify_bw_alloc_status {
140 DPIA_BW_REQ_FAILED = 0,
143 DPIA_BW_ALLOC_CAPS_CHANGED
146 /* enum dmub_memory_access_type - memory access method */
147 enum dmub_memory_access_type {
148 DMUB_MEMORY_ACCESS_DEFAULT,
149 DMUB_MEMORY_ACCESS_CPU = DMUB_MEMORY_ACCESS_DEFAULT,
150 DMUB_MEMORY_ACCESS_DMA
154 * struct dmub_region - dmub hw memory region
155 * @base: base address for region, must be 256 byte aligned
156 * @top: top address for region
164 * struct dmub_window - dmub hw cache window
165 * @off: offset to the fb memory in gpu address space
166 * @r: region in uc address space for cache window
169 union dmub_addr offset;
170 struct dmub_region region;
174 * struct dmub_fb - defines a dmub framebuffer memory region
175 * @cpu_addr: cpu virtual address for the region, NULL if invalid
176 * @gpu_addr: gpu virtual address for the region, NULL if invalid
177 * @size: size of the region in bytes, zero if invalid
186 * struct dmub_srv_region_params - params used for calculating dmub regions
187 * @inst_const_size: size of the fw inst const section
188 * @bss_data_size: size of the fw bss data section
189 * @vbios_size: size of the vbios data
190 * @fw_bss_data: raw firmware bss data section
192 struct dmub_srv_region_params {
193 uint32_t inst_const_size;
194 uint32_t bss_data_size;
196 const uint8_t *fw_inst_const;
197 const uint8_t *fw_bss_data;
198 bool is_mailbox_in_inbox;
202 * struct dmub_srv_region_info - output region info from the dmub service
203 * @fb_size: required minimum fb size for all regions, aligned to 4096 bytes
204 * @num_regions: number of regions used by the dmub service
205 * @regions: region info
207 * The regions are aligned such that they can be all placed within the
208 * same framebuffer but they can also be placed into different framebuffers.
210 * The size of each region can be calculated by the caller:
211 * size = reg.top - reg.base
213 * Care must be taken when performing custom allocations to ensure that each
214 * region base address is 256 byte aligned.
216 struct dmub_srv_region_info {
220 struct dmub_region regions[DMUB_WINDOW_TOTAL];
224 * struct dmub_srv_memory_params - parameters used for driver fb setup
225 * @region_info: region info calculated by dmub service
226 * @cpu_fb_addr: base cpu address for the framebuffer
227 * @cpu_inbox_addr: base cpu address for the gart
228 * @gpu_fb_addr: base gpu virtual address for the framebuffer
229 * @gpu_inbox_addr: base gpu virtual address for the gart
231 struct dmub_srv_memory_params {
232 const struct dmub_srv_region_info *region_info;
234 void *cpu_inbox_addr;
235 uint64_t gpu_fb_addr;
236 uint64_t gpu_inbox_addr;
240 * struct dmub_srv_fb_info - output fb info from the dmub service
241 * @num_fbs: number of required dmub framebuffers
242 * @fbs: fb data for each region
244 * Output from the dmub service helper that can be used by the
245 * driver to prepare dmub_fb that can be passed into the dmub
248 * Assumes that all regions are within the same framebuffer
249 * and have been setup according to the region_info generated
250 * by the dmub service.
252 struct dmub_srv_fb_info {
254 struct dmub_fb fb[DMUB_WINDOW_TOTAL];
258 * struct dmub_srv_hw_params - params for dmub hardware initialization
259 * @fb: framebuffer info for each region
260 * @fb_base: base of the framebuffer aperture
261 * @fb_offset: offset of the framebuffer aperture
262 * @psp_version: psp version to pass for DMCU init
263 * @load_inst_const: true if DMUB should load inst const fw
265 struct dmub_srv_hw_params {
266 struct dmub_fb *fb[DMUB_WINDOW_TOTAL];
269 uint32_t psp_version;
270 bool load_inst_const;
271 bool skip_panel_power_sequence;
273 bool power_optimization;
276 bool usb4_cm_version;
277 bool fw_in_system_memory;
278 bool dpia_hpd_int_enable_supported;
279 bool disable_clock_gate;
280 bool disallow_dispclk_dppclk_ds;
281 enum dmub_memory_access_type mem_access_type;
282 enum dmub_ips_disable_type disable_ips;
286 * struct dmub_diagnostic_data - Diagnostic data retrieved from DMCUB for
287 * debugging purposes, including logging, crash analysis, etc.
289 struct dmub_diagnostic_data {
290 uint32_t dmcub_version;
291 uint32_t scratch[17];
293 uint32_t undefined_address_fault_addr;
294 uint32_t inst_fetch_fault_addr;
295 uint32_t data_write_fault_addr;
296 uint32_t inbox1_rptr;
297 uint32_t inbox1_wptr;
298 uint32_t inbox1_size;
299 uint32_t inbox0_rptr;
300 uint32_t inbox0_wptr;
301 uint32_t inbox0_size;
302 uint32_t gpint_datain0;
303 uint8_t is_dmcub_enabled : 1;
304 uint8_t is_dmcub_soft_reset : 1;
305 uint8_t is_dmcub_secure_reset : 1;
306 uint8_t is_traceport_en : 1;
307 uint8_t is_cw0_enabled : 1;
308 uint8_t is_cw6_enabled : 1;
312 * struct dmub_srv_base_funcs - Driver specific base callbacks
314 struct dmub_srv_base_funcs {
318 * Hook for reading a register.
320 * Return: The 32-bit register value from the given address.
322 uint32_t (*reg_read)(void *ctx, uint32_t address);
327 * Hook for writing a value to the register specified by address.
329 void (*reg_write)(void *ctx, uint32_t address, uint32_t value);
333 * struct dmub_srv_hw_funcs - hardware sequencer funcs for dmub
335 struct dmub_srv_hw_funcs {
336 /* private: internal use only */
338 void (*init)(struct dmub_srv *dmub);
340 void (*reset)(struct dmub_srv *dmub);
342 void (*reset_release)(struct dmub_srv *dmub);
344 void (*backdoor_load)(struct dmub_srv *dmub,
345 const struct dmub_window *cw0,
346 const struct dmub_window *cw1);
348 void (*backdoor_load_zfb_mode)(struct dmub_srv *dmub,
349 const struct dmub_window *cw0,
350 const struct dmub_window *cw1);
351 void (*setup_windows)(struct dmub_srv *dmub,
352 const struct dmub_window *cw2,
353 const struct dmub_window *cw3,
354 const struct dmub_window *cw4,
355 const struct dmub_window *cw5,
356 const struct dmub_window *cw6);
358 void (*setup_mailbox)(struct dmub_srv *dmub,
359 const struct dmub_region *inbox1);
361 uint32_t (*get_inbox1_wptr)(struct dmub_srv *dmub);
363 uint32_t (*get_inbox1_rptr)(struct dmub_srv *dmub);
365 void (*set_inbox1_wptr)(struct dmub_srv *dmub, uint32_t wptr_offset);
367 void (*setup_out_mailbox)(struct dmub_srv *dmub,
368 const struct dmub_region *outbox1);
370 uint32_t (*get_outbox1_wptr)(struct dmub_srv *dmub);
372 void (*set_outbox1_rptr)(struct dmub_srv *dmub, uint32_t rptr_offset);
374 void (*setup_outbox0)(struct dmub_srv *dmub,
375 const struct dmub_region *outbox0);
377 uint32_t (*get_outbox0_wptr)(struct dmub_srv *dmub);
379 void (*set_outbox0_rptr)(struct dmub_srv *dmub, uint32_t rptr_offset);
381 uint32_t (*emul_get_inbox1_rptr)(struct dmub_srv *dmub);
383 void (*emul_set_inbox1_wptr)(struct dmub_srv *dmub, uint32_t wptr_offset);
385 bool (*is_supported)(struct dmub_srv *dmub);
387 bool (*is_psrsu_supported)(struct dmub_srv *dmub);
389 bool (*is_hw_init)(struct dmub_srv *dmub);
390 bool (*is_hw_powered_up)(struct dmub_srv *dmub);
392 void (*enable_dmub_boot_options)(struct dmub_srv *dmub,
393 const struct dmub_srv_hw_params *params);
395 void (*skip_dmub_panel_power_sequence)(struct dmub_srv *dmub, bool skip);
397 union dmub_fw_boot_status (*get_fw_status)(struct dmub_srv *dmub);
399 union dmub_fw_boot_options (*get_fw_boot_option)(struct dmub_srv *dmub);
401 void (*set_gpint)(struct dmub_srv *dmub,
402 union dmub_gpint_data_register reg);
404 bool (*is_gpint_acked)(struct dmub_srv *dmub,
405 union dmub_gpint_data_register reg);
407 uint32_t (*get_gpint_response)(struct dmub_srv *dmub);
409 uint32_t (*get_gpint_dataout)(struct dmub_srv *dmub);
411 void (*configure_dmub_in_system_memory)(struct dmub_srv *dmub);
412 void (*clear_inbox0_ack_register)(struct dmub_srv *dmub);
413 uint32_t (*read_inbox0_ack_register)(struct dmub_srv *dmub);
414 void (*send_inbox0_cmd)(struct dmub_srv *dmub, union dmub_inbox0_data_register data);
415 uint32_t (*get_current_time)(struct dmub_srv *dmub);
417 void (*get_diagnostic_data)(struct dmub_srv *dmub, struct dmub_diagnostic_data *dmub_oca);
419 bool (*should_detect)(struct dmub_srv *dmub);
420 void (*init_reg_offsets)(struct dmub_srv *dmub, struct dc_context *ctx);
422 void (*subvp_save_surf_addr)(struct dmub_srv *dmub, const struct dc_plane_address *addr, uint8_t subvp_index);
426 * struct dmub_srv_create_params - params for dmub service creation
427 * @base_funcs: driver supplied base routines
428 * @hw_funcs: optional overrides for hw funcs
429 * @user_ctx: context data for callback funcs
430 * @asic: driver supplied asic
431 * @fw_version: the current firmware version, if any
432 * @is_virtual: false for hw support only
434 struct dmub_srv_create_params {
435 struct dmub_srv_base_funcs funcs;
436 struct dmub_srv_hw_funcs *hw_funcs;
438 struct dc_context *dc_ctx;
445 * struct dmub_srv - software state for dmcub
446 * @asic: dmub asic identifier
447 * @user_ctx: user provided context for the dmub_srv
448 * @fw_version: the current firmware version, if any
449 * @is_virtual: false if hardware support only
450 * @fw_state: dmub firmware state pointer
457 struct dmub_fb scratch_mem_fb;
458 volatile const struct dmub_fw_state *fw_state;
460 /* private: internal use only */
461 const struct dmub_srv_common_regs *regs;
462 const struct dmub_srv_dcn31_regs *regs_dcn31;
463 struct dmub_srv_dcn32_regs *regs_dcn32;
464 struct dmub_srv_dcn35_regs *regs_dcn35;
466 struct dmub_srv_base_funcs funcs;
467 struct dmub_srv_hw_funcs hw_funcs;
468 struct dmub_rb inbox1_rb;
469 uint32_t inbox1_last_wptr;
471 * outbox1_rb is accessed without locks (dal & dc)
472 * and to be used only in dmub_srv_stat_get_notification()
474 struct dmub_rb outbox1_rb;
476 struct dmub_rb outbox0_rb;
483 uint32_t psp_version;
485 /* Feature capabilities reported by fw */
486 struct dmub_feature_caps feature_caps;
487 struct dmub_visual_confirm_color visual_confirm_color;
491 * struct dmub_notification - dmub notification data
492 * @type: dmub notification type
493 * @link_index: link index to identify aux connection
494 * @result: USB4 status returned from dmub
495 * @pending_notification: Indicates there are other pending notifications
496 * @aux_reply: aux reply
497 * @hpd_status: hpd status
498 * @bw_alloc_reply: BW Allocation reply from CM/DPIA
500 struct dmub_notification {
501 enum dmub_notification_type type;
504 bool pending_notification;
506 struct aux_reply_data aux_reply;
507 enum dp_hpd_status hpd_status;
508 enum set_config_status sc_status;
510 * DPIA notification command.
512 struct dmub_rb_cmd_dpia_notification dpia_notification;
517 * DMUB firmware version helper macro - useful for checking if the version
518 * of a firmware to know if feature or functionality is supported or present.
520 #define DMUB_FW_VERSION(major, minor, revision) \
521 ((((major) & 0xFF) << 24) | (((minor) & 0xFF) << 16) | (((revision) & 0xFF) << 8))
524 * dmub_srv_create() - creates the DMUB service.
525 * @dmub: the dmub service
526 * @params: creation parameters for the service
529 * DMUB_STATUS_OK - success
530 * DMUB_STATUS_INVALID - unspecified error
532 enum dmub_status dmub_srv_create(struct dmub_srv *dmub,
533 const struct dmub_srv_create_params *params);
536 * dmub_srv_destroy() - destroys the DMUB service.
537 * @dmub: the dmub service
539 void dmub_srv_destroy(struct dmub_srv *dmub);
542 * dmub_srv_calc_region_info() - retreives region info from the dmub service
543 * @dmub: the dmub service
544 * @params: parameters used to calculate region locations
545 * @info_out: the output region info from dmub
547 * Calculates the base and top address for all relevant dmub regions
548 * using the parameters given (if any).
551 * DMUB_STATUS_OK - success
552 * DMUB_STATUS_INVALID - unspecified error
555 dmub_srv_calc_region_info(struct dmub_srv *dmub,
556 const struct dmub_srv_region_params *params,
557 struct dmub_srv_region_info *out);
560 * dmub_srv_calc_region_info() - retreives fb info from the dmub service
561 * @dmub: the dmub service
562 * @params: parameters used to calculate fb locations
563 * @info_out: the output fb info from dmub
565 * Calculates the base and top address for all relevant dmub regions
566 * using the parameters given (if any).
569 * DMUB_STATUS_OK - success
570 * DMUB_STATUS_INVALID - unspecified error
572 enum dmub_status dmub_srv_calc_mem_info(struct dmub_srv *dmub,
573 const struct dmub_srv_memory_params *params,
574 struct dmub_srv_fb_info *out);
577 * dmub_srv_has_hw_support() - returns hw support state for dmcub
578 * @dmub: the dmub service
579 * @is_supported: hw support state
581 * Queries the hardware for DMCUB support and returns the result.
583 * Can be called before dmub_srv_hw_init().
586 * DMUB_STATUS_OK - success
587 * DMUB_STATUS_INVALID - unspecified error
589 enum dmub_status dmub_srv_has_hw_support(struct dmub_srv *dmub,
593 * dmub_srv_is_hw_init() - returns hardware init state
596 * DMUB_STATUS_OK - success
597 * DMUB_STATUS_INVALID - unspecified error
599 enum dmub_status dmub_srv_is_hw_init(struct dmub_srv *dmub, bool *is_hw_init);
602 * dmub_srv_hw_init() - initializes the underlying DMUB hardware
603 * @dmub: the dmub service
604 * @params: params for hardware initialization
606 * Resets the DMUB hardware and performs backdoor loading of the
607 * required cache regions based on the input framebuffer regions.
610 * DMUB_STATUS_OK - success
611 * DMUB_STATUS_NO_CTX - dmcub context not initialized
612 * DMUB_STATUS_INVALID - unspecified error
614 enum dmub_status dmub_srv_hw_init(struct dmub_srv *dmub,
615 const struct dmub_srv_hw_params *params);
618 * dmub_srv_hw_reset() - puts the DMUB hardware in reset state if initialized
619 * @dmub: the dmub service
621 * Before destroying the DMUB service or releasing the backing framebuffer
622 * memory we'll need to put the DMCUB into reset first.
624 * A subsequent call to dmub_srv_hw_init() will re-enable the DMCUB.
627 * DMUB_STATUS_OK - success
628 * DMUB_STATUS_INVALID - unspecified error
630 enum dmub_status dmub_srv_hw_reset(struct dmub_srv *dmub);
633 * dmub_srv_sync_inbox1() - sync sw state with hw state
634 * @dmub: the dmub service
636 * Sync sw state with hw state when resume from S0i3
639 * DMUB_STATUS_OK - success
640 * DMUB_STATUS_INVALID - unspecified error
642 enum dmub_status dmub_srv_sync_inbox1(struct dmub_srv *dmub);
645 * dmub_srv_cmd_queue() - queues a command to the DMUB
646 * @dmub: the dmub service
647 * @cmd: the command to queue
649 * Queues a command to the DMUB service but does not begin execution
653 * DMUB_STATUS_OK - success
654 * DMUB_STATUS_QUEUE_FULL - no remaining room in queue
655 * DMUB_STATUS_INVALID - unspecified error
657 enum dmub_status dmub_srv_cmd_queue(struct dmub_srv *dmub,
658 const union dmub_rb_cmd *cmd);
661 * dmub_srv_cmd_execute() - Executes a queued sequence to the dmub
662 * @dmub: the dmub service
664 * Begins execution of queued commands on the dmub.
667 * DMUB_STATUS_OK - success
668 * DMUB_STATUS_INVALID - unspecified error
670 enum dmub_status dmub_srv_cmd_execute(struct dmub_srv *dmub);
673 * dmub_srv_wait_for_hw_pwr_up() - Waits for firmware hardware power up is completed
674 * @dmub: the dmub service
675 * @timeout_us: the maximum number of microseconds to wait
677 * Waits until firmware hardware is powered up. The maximum
678 * wait time is given in microseconds to prevent spinning forever.
681 * DMUB_STATUS_OK - success
682 * DMUB_STATUS_TIMEOUT - timed out
683 * DMUB_STATUS_INVALID - unspecified error
685 enum dmub_status dmub_srv_wait_for_hw_pwr_up(struct dmub_srv *dmub,
686 uint32_t timeout_us);
688 bool dmub_srv_is_hw_pwr_up(struct dmub_srv *dmub);
691 * dmub_srv_wait_for_auto_load() - Waits for firmware auto load to complete
692 * @dmub: the dmub service
693 * @timeout_us: the maximum number of microseconds to wait
695 * Waits until firmware has been autoloaded by the DMCUB. The maximum
696 * wait time is given in microseconds to prevent spinning forever.
698 * On ASICs without firmware autoload support this function will return
702 * DMUB_STATUS_OK - success
703 * DMUB_STATUS_TIMEOUT - wait for phy init timed out
704 * DMUB_STATUS_INVALID - unspecified error
706 enum dmub_status dmub_srv_wait_for_auto_load(struct dmub_srv *dmub,
707 uint32_t timeout_us);
710 * dmub_srv_wait_for_phy_init() - Waits for DMUB PHY init to complete
711 * @dmub: the dmub service
712 * @timeout_us: the maximum number of microseconds to wait
714 * Waits until the PHY has been initialized by the DMUB. The maximum
715 * wait time is given in microseconds to prevent spinning forever.
717 * On ASICs without PHY init support this function will return
721 * DMUB_STATUS_OK - success
722 * DMUB_STATUS_TIMEOUT - wait for phy init timed out
723 * DMUB_STATUS_INVALID - unspecified error
725 enum dmub_status dmub_srv_wait_for_phy_init(struct dmub_srv *dmub,
726 uint32_t timeout_us);
729 * dmub_srv_wait_for_idle() - Waits for the DMUB to be idle
730 * @dmub: the dmub service
731 * @timeout_us: the maximum number of microseconds to wait
733 * Waits until the DMUB buffer is empty and all commands have
734 * finished processing. The maximum wait time is given in
735 * microseconds to prevent spinning forever.
738 * DMUB_STATUS_OK - success
739 * DMUB_STATUS_TIMEOUT - wait for buffer to flush timed out
740 * DMUB_STATUS_INVALID - unspecified error
742 enum dmub_status dmub_srv_wait_for_idle(struct dmub_srv *dmub,
743 uint32_t timeout_us);
746 * dmub_srv_send_gpint_command() - Sends a GPINT based command.
747 * @dmub: the dmub service
748 * @command_code: the command code to send
749 * @param: the command parameter to send
750 * @timeout_us: the maximum number of microseconds to wait
752 * Sends a command via the general purpose interrupt (GPINT).
753 * Waits for the number of microseconds specified by timeout_us
754 * for the command ACK before returning.
756 * Can be called after software initialization.
759 * DMUB_STATUS_OK - success
760 * DMUB_STATUS_TIMEOUT - wait for ACK timed out
761 * DMUB_STATUS_INVALID - unspecified error
764 dmub_srv_send_gpint_command(struct dmub_srv *dmub,
765 enum dmub_gpint_command command_code,
766 uint16_t param, uint32_t timeout_us);
769 * dmub_srv_get_gpint_response() - Queries the GPINT response.
770 * @dmub: the dmub service
771 * @response: the response for the last GPINT
773 * Returns the response code for the last GPINT interrupt.
775 * Can be called after software initialization.
778 * DMUB_STATUS_OK - success
779 * DMUB_STATUS_INVALID - unspecified error
781 enum dmub_status dmub_srv_get_gpint_response(struct dmub_srv *dmub,
785 * dmub_srv_get_gpint_dataout() - Queries the GPINT DATAOUT.
786 * @dmub: the dmub service
787 * @dataout: the data for the GPINT DATAOUT
789 * Returns the response code for the last GPINT DATAOUT interrupt.
791 * Can be called after software initialization.
794 * DMUB_STATUS_OK - success
795 * DMUB_STATUS_INVALID - unspecified error
797 enum dmub_status dmub_srv_get_gpint_dataout(struct dmub_srv *dmub,
801 * dmub_flush_buffer_mem() - Read back entire frame buffer region.
802 * This ensures that the write from x86 has been flushed and will not
804 * @fb: frame buffer to flush
806 * Can be called after software initialization.
808 void dmub_flush_buffer_mem(const struct dmub_fb *fb);
811 * dmub_srv_get_fw_boot_status() - Returns the DMUB boot status bits.
813 * @dmub: the dmub service
814 * @status: out pointer for firmware status
817 * DMUB_STATUS_OK - success
818 * DMUB_STATUS_INVALID - unspecified error, unsupported
820 enum dmub_status dmub_srv_get_fw_boot_status(struct dmub_srv *dmub,
821 union dmub_fw_boot_status *status);
823 enum dmub_status dmub_srv_get_fw_boot_option(struct dmub_srv *dmub,
824 union dmub_fw_boot_options *option);
826 enum dmub_status dmub_srv_cmd_with_reply_data(struct dmub_srv *dmub,
827 union dmub_rb_cmd *cmd);
829 enum dmub_status dmub_srv_set_skip_panel_power_sequence(struct dmub_srv *dmub,
832 bool dmub_srv_get_outbox0_msg(struct dmub_srv *dmub, struct dmcub_trace_buf_entry *entry);
834 bool dmub_srv_get_diagnostic_data(struct dmub_srv *dmub, struct dmub_diagnostic_data *diag_data);
836 bool dmub_srv_should_detect(struct dmub_srv *dmub);
839 * dmub_srv_send_inbox0_cmd() - Send command to DMUB using INBOX0
840 * @dmub: the dmub service
841 * @data: the data to be sent in the INBOX0 command
843 * Send command by writing directly to INBOX0 WPTR
846 * DMUB_STATUS_OK - success
847 * DMUB_STATUS_INVALID - hw_init false or hw function does not exist
849 enum dmub_status dmub_srv_send_inbox0_cmd(struct dmub_srv *dmub, union dmub_inbox0_data_register data);
852 * dmub_srv_wait_for_inbox0_ack() - wait for DMUB to ACK INBOX0 command
853 * @dmub: the dmub service
854 * @timeout_us: the maximum number of microseconds to wait
856 * Wait for DMUB to ACK the INBOX0 message
859 * DMUB_STATUS_OK - success
860 * DMUB_STATUS_INVALID - hw_init false or hw function does not exist
861 * DMUB_STATUS_TIMEOUT - wait for ack timed out
863 enum dmub_status dmub_srv_wait_for_inbox0_ack(struct dmub_srv *dmub, uint32_t timeout_us);
866 * dmub_srv_wait_for_inbox0_ack() - clear ACK register for INBOX0
867 * @dmub: the dmub service
869 * Clear ACK register for INBOX0
872 * DMUB_STATUS_OK - success
873 * DMUB_STATUS_INVALID - hw_init false or hw function does not exist
875 enum dmub_status dmub_srv_clear_inbox0_ack(struct dmub_srv *dmub);
878 * dmub_srv_subvp_save_surf_addr() - Save primary and meta address for subvp on each flip
879 * @dmub: The dmub service
880 * @addr: The surface address to be programmed on the current flip
881 * @subvp_index: Index of subvp pipe, indicates which subvp pipe the address should be saved for
883 * Function to save the surface flip addr into scratch registers. This is to fix a race condition
884 * between FW and driver reading / writing to the surface address at the same time. This is
885 * required because there is no EARLIEST_IN_USE_META.
890 void dmub_srv_subvp_save_surf_addr(struct dmub_srv *dmub, const struct dc_plane_address *addr, uint8_t subvp_index);
892 #if defined(__cplusplus)
896 #endif /* _DMUB_SRV_H_ */