xref: /netbsd-src/sys/external/bsd/drm2/dist/drm/i915/intel_wopcm.h (revision 41ec02673d281bbb3d38e6c78504ce6e30c228c1)
1 /*	$NetBSD: intel_wopcm.h,v 1.2 2021/12/18 23:45:29 riastradh Exp $	*/
2 
3 /*
4  * SPDX-License-Identifier: MIT
5  *
6  * Copyright © 2017-2018 Intel Corporation
7  */
8 
9 #ifndef _INTEL_WOPCM_H_
10 #define _INTEL_WOPCM_H_
11 
12 #include <linux/types.h>
13 
14 /**
15  * struct intel_wopcm - Overall WOPCM info and WOPCM regions.
16  * @size: Size of overall WOPCM.
17  * @guc: GuC WOPCM Region info.
18  * @guc.base: GuC WOPCM base which is offset from WOPCM base.
19  * @guc.size: Size of the GuC WOPCM region.
20  */
21 struct intel_wopcm {
22 	u32 size;
23 	struct {
24 		u32 base;
25 		u32 size;
26 	} guc;
27 };
28 
29 /**
30  * intel_wopcm_guc_base()
31  * @wopcm:	intel_wopcm structure
32  *
33  * Returns the base of the WOPCM shadowed region.
34  *
35  * Returns:
36  * 0 if GuC is not present or not in use.
37  * Otherwise, the GuC WOPCM base.
38  */
intel_wopcm_guc_base(struct intel_wopcm * wopcm)39 static inline u32 intel_wopcm_guc_base(struct intel_wopcm *wopcm)
40 {
41 	return wopcm->guc.base;
42 }
43 
44 /**
45  * intel_wopcm_guc_size()
46  * @wopcm:	intel_wopcm structure
47  *
48  * Returns size of the WOPCM shadowed region.
49  *
50  * Returns:
51  * 0 if GuC is not present or not in use.
52  * Otherwise, the GuC WOPCM size.
53  */
intel_wopcm_guc_size(struct intel_wopcm * wopcm)54 static inline u32 intel_wopcm_guc_size(struct intel_wopcm *wopcm)
55 {
56 	return wopcm->guc.size;
57 }
58 
59 void intel_wopcm_init_early(struct intel_wopcm *wopcm);
60 void intel_wopcm_init(struct intel_wopcm *wopcm);
61 
62 #endif
63