1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2023 Intel Corporation
4  */
5 
6 #ifndef _XE_GSC_TYPES_H_
7 #define _XE_GSC_TYPES_H_
8 
9 #include <linux/iosys-map.h>
10 #include <linux/mutex.h>
11 #include <linux/spinlock.h>
12 #include <linux/types.h>
13 #include <linux/workqueue.h>
14 
15 #include "xe_uc_fw_types.h"
16 
17 struct xe_bo;
18 struct xe_exec_queue;
19 struct i915_gsc_proxy_component;
20 
21 /**
22  * struct xe_gsc - GSC
23  */
24 struct xe_gsc {
25 	/** @fw: Generic uC firmware management */
26 	struct xe_uc_fw fw;
27 
28 	/** @security_version: SVN found in the fetched blob */
29 	u32 security_version;
30 
31 	/** @private: Private data for use by the GSC FW */
32 	struct xe_bo *private;
33 
34 	/** @q: Default queue used for submissions to GSC FW */
35 	struct xe_exec_queue *q;
36 
37 	/** @wq: workqueue to handle jobs for delayed load and proxy handling */
38 	struct workqueue_struct *wq;
39 
40 	/** @work: delayed load and proxy handling work */
41 	struct work_struct work;
42 
43 	/** @lock: protects access to the work_actions mask */
44 	spinlock_t lock;
45 
46 	/** @work_actions: mask of actions to be performed in the work */
47 	u32 work_actions;
48 #define GSC_ACTION_FW_LOAD BIT(0)
49 #define GSC_ACTION_SW_PROXY BIT(1)
50 #define GSC_ACTION_ER_COMPLETE BIT(2)
51 
52 	/** @proxy: sub-structure containing the SW proxy-related variables */
53 	struct {
54 		/** @proxy.component: struct for communication with mei component */
55 		struct i915_gsc_proxy_component *component;
56 		/** @proxy.mutex: protects the component binding and usage */
57 		struct mutex mutex;
58 		/** @proxy.component_added: whether the component has been added */
59 		bool component_added;
60 		/** @proxy.bo: object to store message to and from the GSC */
61 		struct xe_bo *bo;
62 		/** @proxy.to_gsc: map of the memory used to send messages to the GSC */
63 		struct iosys_map to_gsc;
64 		/** @proxy.from_gsc: map of the memory used to recv messages from the GSC */
65 		struct iosys_map from_gsc;
66 		/** @proxy.to_csme: pointer to the memory used to send messages to CSME */
67 		void *to_csme;
68 		/** @proxy.from_csme: pointer to the memory used to recv messages from CSME */
69 		void *from_csme;
70 	} proxy;
71 };
72 
73 #endif
74