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
17struct xe_bo;
18struct xe_exec_queue;
19struct i915_gsc_proxy_component;
20
21/**
22 * struct xe_gsc - GSC
23 */
24struct 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
51	/** @proxy: sub-structure containing the SW proxy-related variables */
52	struct {
53		/** @proxy.component: struct for communication with mei component */
54		struct i915_gsc_proxy_component *component;
55		/** @proxy.mutex: protects the component binding and usage */
56		struct mutex mutex;
57		/** @proxy.component_added: whether the component has been added */
58		bool component_added;
59		/** @proxy.bo: object to store message to and from the GSC */
60		struct xe_bo *bo;
61		/** @proxy.to_gsc: map of the memory used to send messages to the GSC */
62		struct iosys_map to_gsc;
63		/** @proxy.from_gsc: map of the memory used to recv messages from the GSC */
64		struct iosys_map from_gsc;
65		/** @proxy.to_csme: pointer to the memory used to send messages to CSME */
66		void *to_csme;
67		/** @proxy.from_csme: pointer to the memory used to recv messages from CSME */
68		void *from_csme;
69	} proxy;
70};
71
72#endif
73