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/sizes.h> 10 #include <linux/types.h> 11 12 /* Heci client ID for PXP commands */ 13 #define HECI_MEADDRESS_PXP 17 14 15 #define PXP_APIVER(x, y) (((x) & 0xFFFF) << 16 | ((y) & 0xFFFF)) 16 17 /* 18 * A PXP sub-section in an HECI packet can be up to 64K big in each direction. 19 * This does not include the top-level GSC header. 20 */ 21 #define PXP_MAX_PACKET_SIZE SZ_64K 22 23 /* 24 * there are a lot of status codes for PXP, but we only define the cross-API 25 * common ones that we actually can handle in the kernel driver. Other failure 26 * codes should be printed to error msg for debug. 27 */ 28 enum pxp_status { 29 PXP_STATUS_SUCCESS = 0x0, 30 PXP_STATUS_ERROR_API_VERSION = 0x1002, 31 PXP_STATUS_NOT_READY = 0x100e, 32 PXP_STATUS_PLATFCONFIG_KF1_NOVERIF = 0x101a, 33 PXP_STATUS_PLATFCONFIG_KF1_BAD = 0x101f, 34 PXP_STATUS_PLATFCONFIG_FIXED_KF1_NOT_SUPPORTED = 0x1037, 35 PXP_STATUS_OP_NOT_PERMITTED = 0x4013 36 }; 37 38 /* Common PXP FW message header */ 39 struct pxp_cmd_header { 40 u32 api_version; 41 u32 command_id; 42 union { 43 u32 status; /* out */ 44 u32 stream_id; /* in */ 45 #define PXP_CMDHDR_EXTDATA_SESSION_VALID GENMASK(0, 0) 46 #define PXP_CMDHDR_EXTDATA_APP_TYPE GENMASK(1, 1) 47 #define PXP_CMDHDR_EXTDATA_SESSION_ID GENMASK(17, 2) 48 }; 49 /* Length of the message (excluding the header) */ 50 u32 buffer_len; 51 } __packed; 52 53 #define PXP43_CMDID_INVALIDATE_STREAM_KEY 0x00000007 54 #define PXP43_CMDID_INIT_SESSION 0x00000036 55 #define PXP43_CMDID_NEW_HUC_AUTH 0x0000003F /* MTL+ */ 56 57 /* PXP-Input-Packet: HUC Auth-only */ 58 struct pxp43_new_huc_auth_in { 59 struct pxp_cmd_header header; 60 u64 huc_base_address; 61 u32 huc_size; 62 } __packed; 63 64 /* PXP-Output-Packet: HUC Load and Authentication or Auth-only */ 65 struct pxp43_huc_auth_out { 66 struct pxp_cmd_header header; 67 } __packed; 68 69 /* PXP-Input-Packet: Init PXP session */ 70 struct pxp43_create_arb_in { 71 struct pxp_cmd_header header; 72 /* header.stream_id fields for vesion 4.3 of Init PXP session: */ 73 #define PXP43_INIT_SESSION_VALID BIT(0) 74 #define PXP43_INIT_SESSION_APPTYPE BIT(1) 75 #define PXP43_INIT_SESSION_APPID GENMASK(17, 2) 76 u32 protection_mode; 77 #define PXP43_INIT_SESSION_PROTECTION_ARB 0x2 78 u32 sub_session_id; 79 u32 init_flags; 80 u32 rsvd[12]; 81 } __packed; 82 83 /* PXP-Input-Packet: Init PXP session */ 84 struct pxp43_create_arb_out { 85 struct pxp_cmd_header header; 86 u32 rsvd[8]; 87 } __packed; 88 89 /* PXP-Input-Packet: Invalidate Stream Key */ 90 struct pxp43_inv_stream_key_in { 91 struct pxp_cmd_header header; 92 u32 rsvd[3]; 93 } __packed; 94 95 /* PXP-Output-Packet: Invalidate Stream Key */ 96 struct pxp43_inv_stream_key_out { 97 struct pxp_cmd_header header; 98 u32 rsvd; 99 } __packed; 100 #endif 101