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