xref: /linux/drivers/gpu/drm/xe/xe_pcode.h (revision c532de5a67a70f8533d495f8f2aaa9a0491c3ad0)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2022 Intel Corporation
4  */
5 
6 #ifndef _XE_PCODE_H_
7 #define _XE_PCODE_H_
8 
9 #include <linux/types.h>
10 struct xe_tile;
11 struct xe_device;
12 
13 void xe_pcode_init(struct xe_tile *tile);
14 int xe_pcode_probe_early(struct xe_device *xe);
15 int xe_pcode_ready(struct xe_device *xe, bool locked);
16 int xe_pcode_init_min_freq_table(struct xe_tile *tile, u32 min_gt_freq,
17 				 u32 max_gt_freq);
18 int xe_pcode_read(struct xe_tile *tile, u32 mbox, u32 *val, u32 *val1);
19 int xe_pcode_write_timeout(struct xe_tile *tile, u32 mbox, u32 val,
20 			   int timeout_ms);
21 #define xe_pcode_write(tile, mbox, val) \
22 	xe_pcode_write_timeout(tile, mbox, val, 1)
23 
24 int xe_pcode_request(struct xe_tile *tile, u32 mbox, u32 request,
25 		     u32 reply_mask, u32 reply, int timeout_ms);
26 
27 #define PCODE_MBOX(mbcmd, param1, param2)\
28 	(FIELD_PREP(PCODE_MB_COMMAND, mbcmd)\
29 	| FIELD_PREP(PCODE_MB_PARAM1, param1)\
30 	| FIELD_PREP(PCODE_MB_PARAM2, param2))
31 
32 #endif
33