10a8e247dSMichal Wajdeczko /* SPDX-License-Identifier: MIT */ 20a8e247dSMichal Wajdeczko /* 30a8e247dSMichal Wajdeczko * Copyright © 2014-2021 Intel Corporation 40a8e247dSMichal Wajdeczko */ 50a8e247dSMichal Wajdeczko 60a8e247dSMichal Wajdeczko #ifndef _ABI_GUC_MESSAGES_ABI_H 70a8e247dSMichal Wajdeczko #define _ABI_GUC_MESSAGES_ABI_H 80a8e247dSMichal Wajdeczko 9*088b4d4aSMichal Wajdeczko /** 10*088b4d4aSMichal Wajdeczko * DOC: HXG Message 11*088b4d4aSMichal Wajdeczko * 12*088b4d4aSMichal Wajdeczko * All messages exchanged with GuC are defined using 32 bit dwords. 13*088b4d4aSMichal Wajdeczko * First dword is treated as a message header. Remaining dwords are optional. 14*088b4d4aSMichal Wajdeczko * 15*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 16*088b4d4aSMichal Wajdeczko * | | Bits | Description | 17*088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 18*088b4d4aSMichal Wajdeczko * | | | | 19*088b4d4aSMichal Wajdeczko * | 0 | 31 | **ORIGIN** - originator of the message | 20*088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_ORIGIN_HOST` = 0 | 21*088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_ORIGIN_GUC` = 1 | 22*088b4d4aSMichal Wajdeczko * | | | | 23*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 24*088b4d4aSMichal Wajdeczko * | | 30:28 | **TYPE** - message type | 25*088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_REQUEST` = 0 | 26*088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_EVENT` = 1 | 27*088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_NO_RESPONSE_BUSY` = 3 | 28*088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_NO_RESPONSE_RETRY` = 5 | 29*088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_RESPONSE_FAILURE` = 6 | 30*088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_RESPONSE_SUCCESS` = 7 | 31*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 32*088b4d4aSMichal Wajdeczko * | | 27:0 | **AUX** - auxiliary data (depends on TYPE) | 33*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 34*088b4d4aSMichal Wajdeczko * | 1 | 31:0 | | 35*088b4d4aSMichal Wajdeczko * +---+-------+ | 36*088b4d4aSMichal Wajdeczko * |...| | **PAYLOAD** - optional payload (depends on TYPE) | 37*088b4d4aSMichal Wajdeczko * +---+-------+ | 38*088b4d4aSMichal Wajdeczko * | n | 31:0 | | 39*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 40*088b4d4aSMichal Wajdeczko */ 41*088b4d4aSMichal Wajdeczko 42*088b4d4aSMichal Wajdeczko #define GUC_HXG_MSG_MIN_LEN 1u 43*088b4d4aSMichal Wajdeczko #define GUC_HXG_MSG_0_ORIGIN (0x1 << 31) 44*088b4d4aSMichal Wajdeczko #define GUC_HXG_ORIGIN_HOST 0u 45*088b4d4aSMichal Wajdeczko #define GUC_HXG_ORIGIN_GUC 1u 46*088b4d4aSMichal Wajdeczko #define GUC_HXG_MSG_0_TYPE (0x7 << 28) 47*088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_REQUEST 0u 48*088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_EVENT 1u 49*088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_NO_RESPONSE_BUSY 3u 50*088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_NO_RESPONSE_RETRY 5u 51*088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_RESPONSE_FAILURE 6u 52*088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_RESPONSE_SUCCESS 7u 53*088b4d4aSMichal Wajdeczko #define GUC_HXG_MSG_0_AUX (0xfffffff << 0) 54*088b4d4aSMichal Wajdeczko #define GUC_HXG_MSG_n_PAYLOAD (0xffffffff << 0) 55*088b4d4aSMichal Wajdeczko 56*088b4d4aSMichal Wajdeczko /** 57*088b4d4aSMichal Wajdeczko * DOC: HXG Request 58*088b4d4aSMichal Wajdeczko * 59*088b4d4aSMichal Wajdeczko * The `HXG Request`_ message should be used to initiate synchronous activity 60*088b4d4aSMichal Wajdeczko * for which confirmation or return data is expected. 61*088b4d4aSMichal Wajdeczko * 62*088b4d4aSMichal Wajdeczko * The recipient of this message shall use `HXG Response`_, `HXG Failure`_ 63*088b4d4aSMichal Wajdeczko * or `HXG Retry`_ message as a definite reply, and may use `HXG Busy`_ 64*088b4d4aSMichal Wajdeczko * message as a intermediate reply. 65*088b4d4aSMichal Wajdeczko * 66*088b4d4aSMichal Wajdeczko * Format of @DATA0 and all @DATAn fields depends on the @ACTION code. 67*088b4d4aSMichal Wajdeczko * 68*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 69*088b4d4aSMichal Wajdeczko * | | Bits | Description | 70*088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 71*088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 72*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 73*088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_REQUEST_ | 74*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 75*088b4d4aSMichal Wajdeczko * | | 27:16 | **DATA0** - request data (depends on ACTION) | 76*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 77*088b4d4aSMichal Wajdeczko * | | 15:0 | **ACTION** - requested action code | 78*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 79*088b4d4aSMichal Wajdeczko * | 1 | 31:0 | | 80*088b4d4aSMichal Wajdeczko * +---+-------+ | 81*088b4d4aSMichal Wajdeczko * |...| | **DATAn** - optional data (depends on ACTION) | 82*088b4d4aSMichal Wajdeczko * +---+-------+ | 83*088b4d4aSMichal Wajdeczko * | n | 31:0 | | 84*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 85*088b4d4aSMichal Wajdeczko */ 86*088b4d4aSMichal Wajdeczko 87*088b4d4aSMichal Wajdeczko #define GUC_HXG_REQUEST_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN 88*088b4d4aSMichal Wajdeczko #define GUC_HXG_REQUEST_MSG_0_DATA0 (0xfff << 16) 89*088b4d4aSMichal Wajdeczko #define GUC_HXG_REQUEST_MSG_0_ACTION (0xffff << 0) 90*088b4d4aSMichal Wajdeczko #define GUC_HXG_REQUEST_MSG_n_DATAn GUC_HXG_MSG_n_PAYLOAD 91*088b4d4aSMichal Wajdeczko 92*088b4d4aSMichal Wajdeczko /** 93*088b4d4aSMichal Wajdeczko * DOC: HXG Event 94*088b4d4aSMichal Wajdeczko * 95*088b4d4aSMichal Wajdeczko * The `HXG Event`_ message should be used to initiate asynchronous activity 96*088b4d4aSMichal Wajdeczko * that does not involves immediate confirmation nor data. 97*088b4d4aSMichal Wajdeczko * 98*088b4d4aSMichal Wajdeczko * Format of @DATA0 and all @DATAn fields depends on the @ACTION code. 99*088b4d4aSMichal Wajdeczko * 100*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 101*088b4d4aSMichal Wajdeczko * | | Bits | Description | 102*088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 103*088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 104*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 105*088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_EVENT_ | 106*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 107*088b4d4aSMichal Wajdeczko * | | 27:16 | **DATA0** - event data (depends on ACTION) | 108*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 109*088b4d4aSMichal Wajdeczko * | | 15:0 | **ACTION** - event action code | 110*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 111*088b4d4aSMichal Wajdeczko * | 1 | 31:0 | | 112*088b4d4aSMichal Wajdeczko * +---+-------+ | 113*088b4d4aSMichal Wajdeczko * |...| | **DATAn** - optional event data (depends on ACTION) | 114*088b4d4aSMichal Wajdeczko * +---+-------+ | 115*088b4d4aSMichal Wajdeczko * | n | 31:0 | | 116*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 117*088b4d4aSMichal Wajdeczko */ 118*088b4d4aSMichal Wajdeczko 119*088b4d4aSMichal Wajdeczko #define GUC_HXG_EVENT_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN 120*088b4d4aSMichal Wajdeczko #define GUC_HXG_EVENT_MSG_0_DATA0 (0xfff << 16) 121*088b4d4aSMichal Wajdeczko #define GUC_HXG_EVENT_MSG_0_ACTION (0xffff << 0) 122*088b4d4aSMichal Wajdeczko #define GUC_HXG_EVENT_MSG_n_DATAn GUC_HXG_MSG_n_PAYLOAD 123*088b4d4aSMichal Wajdeczko 124*088b4d4aSMichal Wajdeczko /** 125*088b4d4aSMichal Wajdeczko * DOC: HXG Busy 126*088b4d4aSMichal Wajdeczko * 127*088b4d4aSMichal Wajdeczko * The `HXG Busy`_ message may be used to acknowledge reception of the `HXG Request`_ 128*088b4d4aSMichal Wajdeczko * message if the recipient expects that it processing will be longer than default 129*088b4d4aSMichal Wajdeczko * timeout. 130*088b4d4aSMichal Wajdeczko * 131*088b4d4aSMichal Wajdeczko * The @COUNTER field may be used as a progress indicator. 132*088b4d4aSMichal Wajdeczko * 133*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 134*088b4d4aSMichal Wajdeczko * | | Bits | Description | 135*088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 136*088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 137*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 138*088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_BUSY_ | 139*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 140*088b4d4aSMichal Wajdeczko * | | 27:0 | **COUNTER** - progress indicator | 141*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 142*088b4d4aSMichal Wajdeczko */ 143*088b4d4aSMichal Wajdeczko 144*088b4d4aSMichal Wajdeczko #define GUC_HXG_BUSY_MSG_LEN GUC_HXG_MSG_MIN_LEN 145*088b4d4aSMichal Wajdeczko #define GUC_HXG_BUSY_MSG_0_COUNTER GUC_HXG_MSG_0_AUX 146*088b4d4aSMichal Wajdeczko 147*088b4d4aSMichal Wajdeczko /** 148*088b4d4aSMichal Wajdeczko * DOC: HXG Retry 149*088b4d4aSMichal Wajdeczko * 150*088b4d4aSMichal Wajdeczko * The `HXG Retry`_ message should be used by recipient to indicate that the 151*088b4d4aSMichal Wajdeczko * `HXG Request`_ message was dropped and it should be resent again. 152*088b4d4aSMichal Wajdeczko * 153*088b4d4aSMichal Wajdeczko * The @REASON field may be used to provide additional information. 154*088b4d4aSMichal Wajdeczko * 155*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 156*088b4d4aSMichal Wajdeczko * | | Bits | Description | 157*088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 158*088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 159*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 160*088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_RETRY_ | 161*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 162*088b4d4aSMichal Wajdeczko * | | 27:0 | **REASON** - reason for retry | 163*088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_RETRY_REASON_UNSPECIFIED` = 0 | 164*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 165*088b4d4aSMichal Wajdeczko */ 166*088b4d4aSMichal Wajdeczko 167*088b4d4aSMichal Wajdeczko #define GUC_HXG_RETRY_MSG_LEN GUC_HXG_MSG_MIN_LEN 168*088b4d4aSMichal Wajdeczko #define GUC_HXG_RETRY_MSG_0_REASON GUC_HXG_MSG_0_AUX 169*088b4d4aSMichal Wajdeczko #define GUC_HXG_RETRY_REASON_UNSPECIFIED 0u 170*088b4d4aSMichal Wajdeczko 171*088b4d4aSMichal Wajdeczko /** 172*088b4d4aSMichal Wajdeczko * DOC: HXG Failure 173*088b4d4aSMichal Wajdeczko * 174*088b4d4aSMichal Wajdeczko * The `HXG Failure`_ message shall be used as a reply to the `HXG Request`_ 175*088b4d4aSMichal Wajdeczko * message that could not be processed due to an error. 176*088b4d4aSMichal Wajdeczko * 177*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 178*088b4d4aSMichal Wajdeczko * | | Bits | Description | 179*088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 180*088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 181*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 182*088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_FAILURE_ | 183*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 184*088b4d4aSMichal Wajdeczko * | | 27:16 | **HINT** - additional error hint | 185*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 186*088b4d4aSMichal Wajdeczko * | | 15:0 | **ERROR** - error/result code | 187*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 188*088b4d4aSMichal Wajdeczko */ 189*088b4d4aSMichal Wajdeczko 190*088b4d4aSMichal Wajdeczko #define GUC_HXG_FAILURE_MSG_LEN GUC_HXG_MSG_MIN_LEN 191*088b4d4aSMichal Wajdeczko #define GUC_HXG_FAILURE_MSG_0_HINT (0xfff << 16) 192*088b4d4aSMichal Wajdeczko #define GUC_HXG_FAILURE_MSG_0_ERROR (0xffff << 0) 193*088b4d4aSMichal Wajdeczko 194*088b4d4aSMichal Wajdeczko /** 195*088b4d4aSMichal Wajdeczko * DOC: HXG Response 196*088b4d4aSMichal Wajdeczko * 197*088b4d4aSMichal Wajdeczko * The `HXG Response`_ message shall be used as a reply to the `HXG Request`_ 198*088b4d4aSMichal Wajdeczko * message that was successfully processed without an error. 199*088b4d4aSMichal Wajdeczko * 200*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 201*088b4d4aSMichal Wajdeczko * | | Bits | Description | 202*088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 203*088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 204*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 205*088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_SUCCESS_ | 206*088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 207*088b4d4aSMichal Wajdeczko * | | 27:0 | **DATA0** - data (depends on ACTION from `HXG Request`_) | 208*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 209*088b4d4aSMichal Wajdeczko * | 1 | 31:0 | | 210*088b4d4aSMichal Wajdeczko * +---+-------+ | 211*088b4d4aSMichal Wajdeczko * |...| | **DATAn** - data (depends on ACTION from `HXG Request`_) | 212*088b4d4aSMichal Wajdeczko * +---+-------+ | 213*088b4d4aSMichal Wajdeczko * | n | 31:0 | | 214*088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 215*088b4d4aSMichal Wajdeczko */ 216*088b4d4aSMichal Wajdeczko 217*088b4d4aSMichal Wajdeczko #define GUC_HXG_RESPONSE_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN 218*088b4d4aSMichal Wajdeczko #define GUC_HXG_RESPONSE_MSG_0_DATA0 GUC_HXG_MSG_0_AUX 219*088b4d4aSMichal Wajdeczko #define GUC_HXG_RESPONSE_MSG_n_DATAn GUC_HXG_MSG_n_PAYLOAD 220*088b4d4aSMichal Wajdeczko 221*088b4d4aSMichal Wajdeczko /* deprecated */ 2220a8e247dSMichal Wajdeczko #define INTEL_GUC_MSG_TYPE_SHIFT 28 2230a8e247dSMichal Wajdeczko #define INTEL_GUC_MSG_TYPE_MASK (0xF << INTEL_GUC_MSG_TYPE_SHIFT) 2240a8e247dSMichal Wajdeczko #define INTEL_GUC_MSG_DATA_SHIFT 16 2250a8e247dSMichal Wajdeczko #define INTEL_GUC_MSG_DATA_MASK (0xFFF << INTEL_GUC_MSG_DATA_SHIFT) 2260a8e247dSMichal Wajdeczko #define INTEL_GUC_MSG_CODE_SHIFT 0 2270a8e247dSMichal Wajdeczko #define INTEL_GUC_MSG_CODE_MASK (0xFFFF << INTEL_GUC_MSG_CODE_SHIFT) 2280a8e247dSMichal Wajdeczko 2290a8e247dSMichal Wajdeczko enum intel_guc_msg_type { 2300a8e247dSMichal Wajdeczko INTEL_GUC_MSG_TYPE_REQUEST = 0x0, 2310a8e247dSMichal Wajdeczko INTEL_GUC_MSG_TYPE_RESPONSE = 0xF, 2320a8e247dSMichal Wajdeczko }; 2330a8e247dSMichal Wajdeczko 2340a8e247dSMichal Wajdeczko #endif /* _ABI_GUC_MESSAGES_ABI_H */ 235