1 /*
2  * Copyright 2019 Advanced Micro Devices, Inc.
3  *
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:
10  *
11  * The above copyright notice and this permission notice shall be included in
12  * all copies or substantial portions of the Software.
13  *
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.
21  *
22  * Authors: AMD
23  *
24  */
25 
26 #ifndef _DMUB_SRV_H_
27 #define _DMUB_SRV_H_
28 
29 /**
30  * DOC: DMUB interface and operation
31  *
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.
35  *
36  * This interface is not thread-safe. Ensure that all access to the interface
37  * is properly synchronized by the caller.
38  *
39  * Initialization and usage of the DMUB service should be done in the
40  * steps given below:
41  *
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()
46  *
47  * The call to dmub_srv_create() is required to use the server.
48  *
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.
52  *
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().
56  *
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.
59  *
60  * Destroying the DMUB service can be done by calling dmub_srv_destroy().
61  * This does not clear DMUB hardware state, only software state.
62  *
63  * The interface is intended to be standalone and should not depend on any
64  * other component within DAL.
65  */
66 
67 #include "inc/dmub_cmd.h"
68 
69 #if defined(__cplusplus)
70 extern "C" {
71 #endif
72 
73 /* Forward declarations */
74 struct dmub_srv;
75 struct dmub_srv_common_regs;
76 #ifdef CONFIG_DRM_AMD_DC_DCN3_1
77 struct dmub_srv_dcn31_regs;
78 #endif
79 
80 struct dmcub_trace_buf_entry;
81 
82 /* enum dmub_status - return code for dmcub functions */
83 enum dmub_status {
84 	DMUB_STATUS_OK = 0,
85 	DMUB_STATUS_NO_CTX,
86 	DMUB_STATUS_QUEUE_FULL,
87 	DMUB_STATUS_TIMEOUT,
88 	DMUB_STATUS_INVALID,
89 };
90 
91 /* enum dmub_asic - dmub asic identifier */
92 enum dmub_asic {
93 	DMUB_ASIC_NONE = 0,
94 	DMUB_ASIC_DCN20,
95 	DMUB_ASIC_DCN21,
96 	DMUB_ASIC_DCN30,
97 	DMUB_ASIC_DCN301,
98 	DMUB_ASIC_DCN302,
99 	DMUB_ASIC_DCN303,
100 #ifdef CONFIG_DRM_AMD_DC_DCN3_1
101 	DMUB_ASIC_DCN31,
102 #endif
103 	DMUB_ASIC_MAX,
104 };
105 
106 /* enum dmub_window_id - dmub window identifier */
107 enum dmub_window_id {
108 	DMUB_WINDOW_0_INST_CONST = 0,
109 	DMUB_WINDOW_1_STACK,
110 	DMUB_WINDOW_2_BSS_DATA,
111 	DMUB_WINDOW_3_VBIOS,
112 	DMUB_WINDOW_4_MAILBOX,
113 	DMUB_WINDOW_5_TRACEBUFF,
114 	DMUB_WINDOW_6_FW_STATE,
115 	DMUB_WINDOW_7_SCRATCH_MEM,
116 	DMUB_WINDOW_TOTAL,
117 };
118 
119 /* enum dmub_notification_type - dmub outbox notification identifier */
120 enum dmub_notification_type {
121 	DMUB_NOTIFICATION_NO_DATA = 0,
122 	DMUB_NOTIFICATION_AUX_REPLY,
123 	DMUB_NOTIFICATION_HPD,
124 	DMUB_NOTIFICATION_HPD_IRQ,
125 	DMUB_NOTIFICATION_MAX
126 };
127 
128 /**
129  * struct dmub_region - dmub hw memory region
130  * @base: base address for region, must be 256 byte aligned
131  * @top: top address for region
132  */
133 struct dmub_region {
134 	uint32_t base;
135 	uint32_t top;
136 };
137 
138 /**
139  * struct dmub_window - dmub hw cache window
140  * @off: offset to the fb memory in gpu address space
141  * @r: region in uc address space for cache window
142  */
143 struct dmub_window {
144 	union dmub_addr offset;
145 	struct dmub_region region;
146 };
147 
148 /**
149  * struct dmub_fb - defines a dmub framebuffer memory region
150  * @cpu_addr: cpu virtual address for the region, NULL if invalid
151  * @gpu_addr: gpu virtual address for the region, NULL if invalid
152  * @size: size of the region in bytes, zero if invalid
153  */
154 struct dmub_fb {
155 	void *cpu_addr;
156 	uint64_t gpu_addr;
157 	uint32_t size;
158 };
159 
160 /**
161  * struct dmub_srv_region_params - params used for calculating dmub regions
162  * @inst_const_size: size of the fw inst const section
163  * @bss_data_size: size of the fw bss data section
164  * @vbios_size: size of the vbios data
165  * @fw_bss_data: raw firmware bss data section
166  */
167 struct dmub_srv_region_params {
168 	uint32_t inst_const_size;
169 	uint32_t bss_data_size;
170 	uint32_t vbios_size;
171 	const uint8_t *fw_inst_const;
172 	const uint8_t *fw_bss_data;
173 };
174 
175 /**
176  * struct dmub_srv_region_info - output region info from the dmub service
177  * @fb_size: required minimum fb size for all regions, aligned to 4096 bytes
178  * @num_regions: number of regions used by the dmub service
179  * @regions: region info
180  *
181  * The regions are aligned such that they can be all placed within the
182  * same framebuffer but they can also be placed into different framebuffers.
183  *
184  * The size of each region can be calculated by the caller:
185  * size = reg.top - reg.base
186  *
187  * Care must be taken when performing custom allocations to ensure that each
188  * region base address is 256 byte aligned.
189  */
190 struct dmub_srv_region_info {
191 	uint32_t fb_size;
192 	uint8_t num_regions;
193 	struct dmub_region regions[DMUB_WINDOW_TOTAL];
194 };
195 
196 /**
197  * struct dmub_srv_fb_params - parameters used for driver fb setup
198  * @region_info: region info calculated by dmub service
199  * @cpu_addr: base cpu address for the framebuffer
200  * @gpu_addr: base gpu virtual address for the framebuffer
201  */
202 struct dmub_srv_fb_params {
203 	const struct dmub_srv_region_info *region_info;
204 	void *cpu_addr;
205 	uint64_t gpu_addr;
206 };
207 
208 /**
209  * struct dmub_srv_fb_info - output fb info from the dmub service
210  * @num_fbs: number of required dmub framebuffers
211  * @fbs: fb data for each region
212  *
213  * Output from the dmub service helper that can be used by the
214  * driver to prepare dmub_fb that can be passed into the dmub
215  * hw init service.
216  *
217  * Assumes that all regions are within the same framebuffer
218  * and have been setup according to the region_info generated
219  * by the dmub service.
220  */
221 struct dmub_srv_fb_info {
222 	uint8_t num_fb;
223 	struct dmub_fb fb[DMUB_WINDOW_TOTAL];
224 };
225 
226 /*
227  * struct dmub_srv_hw_params - params for dmub hardware initialization
228  * @fb: framebuffer info for each region
229  * @fb_base: base of the framebuffer aperture
230  * @fb_offset: offset of the framebuffer aperture
231  * @psp_version: psp version to pass for DMCU init
232  * @load_inst_const: true if DMUB should load inst const fw
233  */
234 struct dmub_srv_hw_params {
235 	struct dmub_fb *fb[DMUB_WINDOW_TOTAL];
236 	uint64_t fb_base;
237 	uint64_t fb_offset;
238 	uint32_t psp_version;
239 	bool load_inst_const;
240 	bool skip_panel_power_sequence;
241 #ifdef CONFIG_DRM_AMD_DC_DCN3_1
242 	bool disable_z10;
243 #endif
244 };
245 
246 /**
247  * struct dmub_srv_base_funcs - Driver specific base callbacks
248  */
249 struct dmub_srv_base_funcs {
250 	/**
251 	 * @reg_read:
252 	 *
253 	 * Hook for reading a register.
254 	 *
255 	 * Return: The 32-bit register value from the given address.
256 	 */
257 	uint32_t (*reg_read)(void *ctx, uint32_t address);
258 
259 	/**
260 	 * @reg_write:
261 	 *
262 	 * Hook for writing a value to the register specified by address.
263 	 */
264 	void (*reg_write)(void *ctx, uint32_t address, uint32_t value);
265 };
266 
267 /**
268  * struct dmub_srv_hw_funcs - hardware sequencer funcs for dmub
269  */
270 struct dmub_srv_hw_funcs {
271 	/* private: internal use only */
272 
273 	void (*init)(struct dmub_srv *dmub);
274 
275 	void (*reset)(struct dmub_srv *dmub);
276 
277 	void (*reset_release)(struct dmub_srv *dmub);
278 
279 	void (*backdoor_load)(struct dmub_srv *dmub,
280 			      const struct dmub_window *cw0,
281 			      const struct dmub_window *cw1);
282 
283 	void (*setup_windows)(struct dmub_srv *dmub,
284 			      const struct dmub_window *cw2,
285 			      const struct dmub_window *cw3,
286 			      const struct dmub_window *cw4,
287 			      const struct dmub_window *cw5,
288 			      const struct dmub_window *cw6);
289 
290 	void (*setup_mailbox)(struct dmub_srv *dmub,
291 			      const struct dmub_region *inbox1);
292 
293 	uint32_t (*get_inbox1_rptr)(struct dmub_srv *dmub);
294 
295 	void (*set_inbox1_wptr)(struct dmub_srv *dmub, uint32_t wptr_offset);
296 
297 	void (*setup_out_mailbox)(struct dmub_srv *dmub,
298 			      const struct dmub_region *outbox1);
299 
300 	uint32_t (*get_outbox1_wptr)(struct dmub_srv *dmub);
301 
302 	void (*set_outbox1_rptr)(struct dmub_srv *dmub, uint32_t rptr_offset);
303 
304 	void (*setup_outbox0)(struct dmub_srv *dmub,
305 			      const struct dmub_region *outbox0);
306 
307 	uint32_t (*get_outbox0_wptr)(struct dmub_srv *dmub);
308 
309 	void (*set_outbox0_rptr)(struct dmub_srv *dmub, uint32_t rptr_offset);
310 
311 	uint32_t (*emul_get_inbox1_rptr)(struct dmub_srv *dmub);
312 
313 	void (*emul_set_inbox1_wptr)(struct dmub_srv *dmub, uint32_t wptr_offset);
314 
315 	bool (*is_supported)(struct dmub_srv *dmub);
316 
317 	bool (*is_hw_init)(struct dmub_srv *dmub);
318 
319 	bool (*is_phy_init)(struct dmub_srv *dmub);
320 	void (*enable_dmub_boot_options)(struct dmub_srv *dmub,
321 				const struct dmub_srv_hw_params *params);
322 
323 	void (*skip_dmub_panel_power_sequence)(struct dmub_srv *dmub, bool skip);
324 
325 	union dmub_fw_boot_status (*get_fw_status)(struct dmub_srv *dmub);
326 
327 
328 	void (*set_gpint)(struct dmub_srv *dmub,
329 			  union dmub_gpint_data_register reg);
330 
331 	bool (*is_gpint_acked)(struct dmub_srv *dmub,
332 			       union dmub_gpint_data_register reg);
333 
334 	uint32_t (*get_gpint_response)(struct dmub_srv *dmub);
335 
336 	void (*send_inbox0_cmd)(struct dmub_srv *dmub, union dmub_inbox0_data_register data);
337 	uint32_t (*get_current_time)(struct dmub_srv *dmub);
338 };
339 
340 /**
341  * struct dmub_srv_create_params - params for dmub service creation
342  * @base_funcs: driver supplied base routines
343  * @hw_funcs: optional overrides for hw funcs
344  * @user_ctx: context data for callback funcs
345  * @asic: driver supplied asic
346  * @fw_version: the current firmware version, if any
347  * @is_virtual: false for hw support only
348  */
349 struct dmub_srv_create_params {
350 	struct dmub_srv_base_funcs funcs;
351 	struct dmub_srv_hw_funcs *hw_funcs;
352 	void *user_ctx;
353 	enum dmub_asic asic;
354 	uint32_t fw_version;
355 	bool is_virtual;
356 };
357 
358 /**
359  * struct dmub_srv - software state for dmcub
360  * @asic: dmub asic identifier
361  * @user_ctx: user provided context for the dmub_srv
362  * @fw_version: the current firmware version, if any
363  * @is_virtual: false if hardware support only
364  * @fw_state: dmub firmware state pointer
365  */
366 struct dmub_srv {
367 	enum dmub_asic asic;
368 	void *user_ctx;
369 	uint32_t fw_version;
370 	bool is_virtual;
371 	struct dmub_fb scratch_mem_fb;
372 	volatile const struct dmub_fw_state *fw_state;
373 
374 	/* private: internal use only */
375 	const struct dmub_srv_common_regs *regs;
376 #ifdef CONFIG_DRM_AMD_DC_DCN3_1
377 	const struct dmub_srv_dcn31_regs *regs_dcn31;
378 #endif
379 
380 	struct dmub_srv_base_funcs funcs;
381 	struct dmub_srv_hw_funcs hw_funcs;
382 	struct dmub_rb inbox1_rb;
383 	/**
384 	 * outbox1_rb is accessed without locks (dal & dc)
385 	 * and to be used only in dmub_srv_stat_get_notification()
386 	 */
387 	struct dmub_rb outbox1_rb;
388 
389 	struct dmub_rb outbox0_rb;
390 
391 	bool sw_init;
392 	bool hw_init;
393 
394 	uint64_t fb_base;
395 	uint64_t fb_offset;
396 	uint32_t psp_version;
397 
398 	/* Feature capabilities reported by fw */
399 	struct dmub_feature_caps feature_caps;
400 };
401 
402 /**
403  * struct dmub_notification - dmub notification data
404  * @type: dmub notification type
405  * @link_index: link index to identify aux connection
406  * @result: USB4 status returned from dmub
407  * @pending_notification: Indicates there are other pending notifications
408  * @aux_reply: aux reply
409  * @hpd_status: hpd status
410  */
411 struct dmub_notification {
412 	enum dmub_notification_type type;
413 	uint8_t link_index;
414 	uint8_t result;
415 	bool pending_notification;
416 	union {
417 		struct aux_reply_data aux_reply;
418 		enum dp_hpd_status hpd_status;
419 	};
420 };
421 
422 /**
423  * DMUB firmware version helper macro - useful for checking if the version
424  * of a firmware to know if feature or functionality is supported or present.
425  */
426 #define DMUB_FW_VERSION(major, minor, revision) \
427 	((((major) & 0xFF) << 24) | (((minor) & 0xFF) << 16) | ((revision) & 0xFFFF))
428 
429 /**
430  * dmub_srv_create() - creates the DMUB service.
431  * @dmub: the dmub service
432  * @params: creation parameters for the service
433  *
434  * Return:
435  *   DMUB_STATUS_OK - success
436  *   DMUB_STATUS_INVALID - unspecified error
437  */
438 enum dmub_status dmub_srv_create(struct dmub_srv *dmub,
439 				 const struct dmub_srv_create_params *params);
440 
441 /**
442  * dmub_srv_destroy() - destroys the DMUB service.
443  * @dmub: the dmub service
444  */
445 void dmub_srv_destroy(struct dmub_srv *dmub);
446 
447 /**
448  * dmub_srv_calc_region_info() - retreives region info from the dmub service
449  * @dmub: the dmub service
450  * @params: parameters used to calculate region locations
451  * @info_out: the output region info from dmub
452  *
453  * Calculates the base and top address for all relevant dmub regions
454  * using the parameters given (if any).
455  *
456  * Return:
457  *   DMUB_STATUS_OK - success
458  *   DMUB_STATUS_INVALID - unspecified error
459  */
460 enum dmub_status
461 dmub_srv_calc_region_info(struct dmub_srv *dmub,
462 			  const struct dmub_srv_region_params *params,
463 			  struct dmub_srv_region_info *out);
464 
465 /**
466  * dmub_srv_calc_region_info() - retreives fb info from the dmub service
467  * @dmub: the dmub service
468  * @params: parameters used to calculate fb locations
469  * @info_out: the output fb info from dmub
470  *
471  * Calculates the base and top address for all relevant dmub regions
472  * using the parameters given (if any).
473  *
474  * Return:
475  *   DMUB_STATUS_OK - success
476  *   DMUB_STATUS_INVALID - unspecified error
477  */
478 enum dmub_status dmub_srv_calc_fb_info(struct dmub_srv *dmub,
479 				       const struct dmub_srv_fb_params *params,
480 				       struct dmub_srv_fb_info *out);
481 
482 /**
483  * dmub_srv_has_hw_support() - returns hw support state for dmcub
484  * @dmub: the dmub service
485  * @is_supported: hw support state
486  *
487  * Queries the hardware for DMCUB support and returns the result.
488  *
489  * Can be called before dmub_srv_hw_init().
490  *
491  * Return:
492  *   DMUB_STATUS_OK - success
493  *   DMUB_STATUS_INVALID - unspecified error
494  */
495 enum dmub_status dmub_srv_has_hw_support(struct dmub_srv *dmub,
496 					 bool *is_supported);
497 
498 /**
499  * dmub_srv_is_hw_init() - returns hardware init state
500  *
501  * Return:
502  *   DMUB_STATUS_OK - success
503  *   DMUB_STATUS_INVALID - unspecified error
504  */
505 enum dmub_status dmub_srv_is_hw_init(struct dmub_srv *dmub, bool *is_hw_init);
506 
507 /**
508  * dmub_srv_hw_init() - initializes the underlying DMUB hardware
509  * @dmub: the dmub service
510  * @params: params for hardware initialization
511  *
512  * Resets the DMUB hardware and performs backdoor loading of the
513  * required cache regions based on the input framebuffer regions.
514  *
515  * Return:
516  *   DMUB_STATUS_OK - success
517  *   DMUB_STATUS_NO_CTX - dmcub context not initialized
518  *   DMUB_STATUS_INVALID - unspecified error
519  */
520 enum dmub_status dmub_srv_hw_init(struct dmub_srv *dmub,
521 				  const struct dmub_srv_hw_params *params);
522 
523 /**
524  * dmub_srv_hw_reset() - puts the DMUB hardware in reset state if initialized
525  * @dmub: the dmub service
526  *
527  * Before destroying the DMUB service or releasing the backing framebuffer
528  * memory we'll need to put the DMCUB into reset first.
529  *
530  * A subsequent call to dmub_srv_hw_init() will re-enable the DMCUB.
531  *
532  * Return:
533  *   DMUB_STATUS_OK - success
534  *   DMUB_STATUS_INVALID - unspecified error
535  */
536 enum dmub_status dmub_srv_hw_reset(struct dmub_srv *dmub);
537 
538 /**
539  * dmub_srv_cmd_queue() - queues a command to the DMUB
540  * @dmub: the dmub service
541  * @cmd: the command to queue
542  *
543  * Queues a command to the DMUB service but does not begin execution
544  * immediately.
545  *
546  * Return:
547  *   DMUB_STATUS_OK - success
548  *   DMUB_STATUS_QUEUE_FULL - no remaining room in queue
549  *   DMUB_STATUS_INVALID - unspecified error
550  */
551 enum dmub_status dmub_srv_cmd_queue(struct dmub_srv *dmub,
552 				    const union dmub_rb_cmd *cmd);
553 
554 /**
555  * dmub_srv_cmd_execute() - Executes a queued sequence to the dmub
556  * @dmub: the dmub service
557  *
558  * Begins execution of queued commands on the dmub.
559  *
560  * Return:
561  *   DMUB_STATUS_OK - success
562  *   DMUB_STATUS_INVALID - unspecified error
563  */
564 enum dmub_status dmub_srv_cmd_execute(struct dmub_srv *dmub);
565 
566 /**
567  * dmub_srv_wait_for_auto_load() - Waits for firmware auto load to complete
568  * @dmub: the dmub service
569  * @timeout_us: the maximum number of microseconds to wait
570  *
571  * Waits until firmware has been autoloaded by the DMCUB. The maximum
572  * wait time is given in microseconds to prevent spinning forever.
573  *
574  * On ASICs without firmware autoload support this function will return
575  * immediately.
576  *
577  * Return:
578  *   DMUB_STATUS_OK - success
579  *   DMUB_STATUS_TIMEOUT - wait for phy init timed out
580  *   DMUB_STATUS_INVALID - unspecified error
581  */
582 enum dmub_status dmub_srv_wait_for_auto_load(struct dmub_srv *dmub,
583 					     uint32_t timeout_us);
584 
585 /**
586  * dmub_srv_wait_for_phy_init() - Waits for DMUB PHY init to complete
587  * @dmub: the dmub service
588  * @timeout_us: the maximum number of microseconds to wait
589  *
590  * Waits until the PHY has been initialized by the DMUB. The maximum
591  * wait time is given in microseconds to prevent spinning forever.
592  *
593  * On ASICs without PHY init support this function will return
594  * immediately.
595  *
596  * Return:
597  *   DMUB_STATUS_OK - success
598  *   DMUB_STATUS_TIMEOUT - wait for phy init timed out
599  *   DMUB_STATUS_INVALID - unspecified error
600  */
601 enum dmub_status dmub_srv_wait_for_phy_init(struct dmub_srv *dmub,
602 					    uint32_t timeout_us);
603 
604 /**
605  * dmub_srv_wait_for_idle() - Waits for the DMUB to be idle
606  * @dmub: the dmub service
607  * @timeout_us: the maximum number of microseconds to wait
608  *
609  * Waits until the DMUB buffer is empty and all commands have
610  * finished processing. The maximum wait time is given in
611  * microseconds to prevent spinning forever.
612  *
613  * Return:
614  *   DMUB_STATUS_OK - success
615  *   DMUB_STATUS_TIMEOUT - wait for buffer to flush timed out
616  *   DMUB_STATUS_INVALID - unspecified error
617  */
618 enum dmub_status dmub_srv_wait_for_idle(struct dmub_srv *dmub,
619 					uint32_t timeout_us);
620 
621 /**
622  * dmub_srv_send_gpint_command() - Sends a GPINT based command.
623  * @dmub: the dmub service
624  * @command_code: the command code to send
625  * @param: the command parameter to send
626  * @timeout_us: the maximum number of microseconds to wait
627  *
628  * Sends a command via the general purpose interrupt (GPINT).
629  * Waits for the number of microseconds specified by timeout_us
630  * for the command ACK before returning.
631  *
632  * Can be called after software initialization.
633  *
634  * Return:
635  *   DMUB_STATUS_OK - success
636  *   DMUB_STATUS_TIMEOUT - wait for ACK timed out
637  *   DMUB_STATUS_INVALID - unspecified error
638  */
639 enum dmub_status
640 dmub_srv_send_gpint_command(struct dmub_srv *dmub,
641 			    enum dmub_gpint_command command_code,
642 			    uint16_t param, uint32_t timeout_us);
643 
644 /**
645  * dmub_srv_get_gpint_response() - Queries the GPINT response.
646  * @dmub: the dmub service
647  * @response: the response for the last GPINT
648  *
649  * Returns the response code for the last GPINT interrupt.
650  *
651  * Can be called after software initialization.
652  *
653  * Return:
654  *   DMUB_STATUS_OK - success
655  *   DMUB_STATUS_INVALID - unspecified error
656  */
657 enum dmub_status dmub_srv_get_gpint_response(struct dmub_srv *dmub,
658 					     uint32_t *response);
659 
660 /**
661  * dmub_flush_buffer_mem() - Read back entire frame buffer region.
662  * This ensures that the write from x86 has been flushed and will not
663  * hang the DMCUB.
664  * @fb: frame buffer to flush
665  *
666  * Can be called after software initialization.
667  */
668 void dmub_flush_buffer_mem(const struct dmub_fb *fb);
669 
670 /**
671  * dmub_srv_get_fw_boot_status() - Returns the DMUB boot status bits.
672  *
673  * @dmub: the dmub service
674  * @status: out pointer for firmware status
675  *
676  * Return:
677  *   DMUB_STATUS_OK - success
678  *   DMUB_STATUS_INVALID - unspecified error, unsupported
679  */
680 enum dmub_status dmub_srv_get_fw_boot_status(struct dmub_srv *dmub,
681 					     union dmub_fw_boot_status *status);
682 
683 enum dmub_status dmub_srv_cmd_with_reply_data(struct dmub_srv *dmub,
684 					      union dmub_rb_cmd *cmd);
685 
686 bool dmub_srv_get_outbox0_msg(struct dmub_srv *dmub, struct dmcub_trace_buf_entry *entry);
687 
688 #if defined(__cplusplus)
689 }
690 #endif
691 
692 #endif /* _DMUB_SRV_H_ */
693