1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright(c) 2022, Intel Corporation. All rights reserved.
4  */
5 
6 #ifndef __INTEL_PXP_FW_INTERFACE_CMN_H__
7 #define __INTEL_PXP_FW_INTERFACE_CMN_H__
8 
9 #include <linux/types.h>
10 
11 #define PXP_APIVER(x, y) (((x) & 0xFFFF) << 16 | ((y) & 0xFFFF))
12 
13 /*
14  * there are a lot of status codes for PXP, but we only define the cross-API
15  * common ones that we actually can handle in the kernel driver. Other failure
16  * codes should be printed to error msg for debug.
17  */
18 enum pxp_status {
19 	PXP_STATUS_SUCCESS = 0x0,
20 	PXP_STATUS_ERROR_API_VERSION = 0x1002,
21 	PXP_STATUS_NOT_READY = 0x100e,
22 	PXP_STATUS_PLATFCONFIG_KF1_NOVERIF = 0x101a,
23 	PXP_STATUS_PLATFCONFIG_KF1_BAD = 0x101f,
24 	PXP_STATUS_OP_NOT_PERMITTED = 0x4013
25 };
26 
27 /* Common PXP FW message header */
28 struct pxp_cmd_header {
29 	u32 api_version;
30 	u32 command_id;
31 	union {
32 		u32 status; /* out */
33 		u32 stream_id; /* in */
34 #define PXP_CMDHDR_EXTDATA_SESSION_VALID GENMASK(0, 0)
35 #define PXP_CMDHDR_EXTDATA_APP_TYPE GENMASK(1, 1)
36 #define PXP_CMDHDR_EXTDATA_SESSION_ID GENMASK(17, 2)
37 	};
38 	/* Length of the message (excluding the header) */
39 	u32 buffer_len;
40 } __packed;
41 
42 #endif /* __INTEL_PXP_FW_INTERFACE_CMN_H__ */
43