1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright �� 2023 Intel Corporation
4 */
5
6#ifndef _ABI_GSC_PXP_COMMANDS_ABI_H
7#define _ABI_GSC_PXP_COMMANDS_ABI_H
8
9#include <linux/types.h>
10
11/* Heci client ID for PXP commands */
12#define HECI_MEADDRESS_PXP 17
13
14#define PXP_APIVER(x, y) (((x) & 0xFFFF) << 16 | ((y) & 0xFFFF))
15
16/*
17 * there are a lot of status codes for PXP, but we only define the cross-API
18 * common ones that we actually can handle in the kernel driver. Other failure
19 * codes should be printed to error msg for debug.
20 */
21enum pxp_status {
22	PXP_STATUS_SUCCESS = 0x0,
23	PXP_STATUS_ERROR_API_VERSION = 0x1002,
24	PXP_STATUS_NOT_READY = 0x100e,
25	PXP_STATUS_PLATFCONFIG_KF1_NOVERIF = 0x101a,
26	PXP_STATUS_PLATFCONFIG_KF1_BAD = 0x101f,
27	PXP_STATUS_OP_NOT_PERMITTED = 0x4013
28};
29
30/* Common PXP FW message header */
31struct pxp_cmd_header {
32	u32 api_version;
33	u32 command_id;
34	union {
35		u32 status; /* out */
36		u32 stream_id; /* in */
37#define PXP_CMDHDR_EXTDATA_SESSION_VALID GENMASK(0, 0)
38#define PXP_CMDHDR_EXTDATA_APP_TYPE GENMASK(1, 1)
39#define PXP_CMDHDR_EXTDATA_SESSION_ID GENMASK(17, 2)
40	};
41	/* Length of the message (excluding the header) */
42	u32 buffer_len;
43} __packed;
44
45#define PXP43_CMDID_NEW_HUC_AUTH 0x0000003F /* MTL+ */
46
47/* PXP-Input-Packet: HUC Auth-only */
48struct pxp43_new_huc_auth_in {
49	struct pxp_cmd_header header;
50	u64 huc_base_address;
51	u32 huc_size;
52} __packed;
53
54/* PXP-Output-Packet: HUC Load and Authentication or Auth-only */
55struct pxp43_huc_auth_out {
56	struct pxp_cmd_header header;
57} __packed;
58
59#endif
60