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 9088b4d4aSMichal Wajdeczko /** 10088b4d4aSMichal Wajdeczko * DOC: HXG Message 11088b4d4aSMichal Wajdeczko * 12088b4d4aSMichal Wajdeczko * All messages exchanged with GuC are defined using 32 bit dwords. 13088b4d4aSMichal Wajdeczko * First dword is treated as a message header. Remaining dwords are optional. 14088b4d4aSMichal Wajdeczko * 15088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 16088b4d4aSMichal Wajdeczko * | | Bits | Description | 17088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 18088b4d4aSMichal Wajdeczko * | | | | 19088b4d4aSMichal Wajdeczko * | 0 | 31 | **ORIGIN** - originator of the message | 20088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_ORIGIN_HOST` = 0 | 21088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_ORIGIN_GUC` = 1 | 22088b4d4aSMichal Wajdeczko * | | | | 23088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 24088b4d4aSMichal Wajdeczko * | | 30:28 | **TYPE** - message type | 25088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_REQUEST` = 0 | 26088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_EVENT` = 1 | 27088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_NO_RESPONSE_BUSY` = 3 | 28088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_NO_RESPONSE_RETRY` = 5 | 29088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_RESPONSE_FAILURE` = 6 | 30088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_TYPE_RESPONSE_SUCCESS` = 7 | 31088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 32088b4d4aSMichal Wajdeczko * | | 27:0 | **AUX** - auxiliary data (depends on TYPE) | 33088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 34088b4d4aSMichal Wajdeczko * | 1 | 31:0 | | 35088b4d4aSMichal Wajdeczko * +---+-------+ | 36088b4d4aSMichal Wajdeczko * |...| | **PAYLOAD** - optional payload (depends on TYPE) | 37088b4d4aSMichal Wajdeczko * +---+-------+ | 38088b4d4aSMichal Wajdeczko * | n | 31:0 | | 39088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 40088b4d4aSMichal Wajdeczko */ 41088b4d4aSMichal Wajdeczko 42088b4d4aSMichal Wajdeczko #define GUC_HXG_MSG_MIN_LEN 1u 43*962bd34bSBorislav Petkov #define GUC_HXG_MSG_0_ORIGIN (0x1U << 31) 44088b4d4aSMichal Wajdeczko #define GUC_HXG_ORIGIN_HOST 0u 45088b4d4aSMichal Wajdeczko #define GUC_HXG_ORIGIN_GUC 1u 46088b4d4aSMichal Wajdeczko #define GUC_HXG_MSG_0_TYPE (0x7 << 28) 47088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_REQUEST 0u 48088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_EVENT 1u 49088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_NO_RESPONSE_BUSY 3u 50088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_NO_RESPONSE_RETRY 5u 51088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_RESPONSE_FAILURE 6u 52088b4d4aSMichal Wajdeczko #define GUC_HXG_TYPE_RESPONSE_SUCCESS 7u 53088b4d4aSMichal Wajdeczko #define GUC_HXG_MSG_0_AUX (0xfffffff << 0) 54088b4d4aSMichal Wajdeczko #define GUC_HXG_MSG_n_PAYLOAD (0xffffffff << 0) 55088b4d4aSMichal Wajdeczko 56088b4d4aSMichal Wajdeczko /** 57088b4d4aSMichal Wajdeczko * DOC: HXG Request 58088b4d4aSMichal Wajdeczko * 59088b4d4aSMichal Wajdeczko * The `HXG Request`_ message should be used to initiate synchronous activity 60088b4d4aSMichal Wajdeczko * for which confirmation or return data is expected. 61088b4d4aSMichal Wajdeczko * 62088b4d4aSMichal Wajdeczko * The recipient of this message shall use `HXG Response`_, `HXG Failure`_ 63088b4d4aSMichal Wajdeczko * or `HXG Retry`_ message as a definite reply, and may use `HXG Busy`_ 64088b4d4aSMichal Wajdeczko * message as a intermediate reply. 65088b4d4aSMichal Wajdeczko * 66088b4d4aSMichal Wajdeczko * Format of @DATA0 and all @DATAn fields depends on the @ACTION code. 67088b4d4aSMichal Wajdeczko * 68088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 69088b4d4aSMichal Wajdeczko * | | Bits | Description | 70088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 71088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 72088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 73088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_REQUEST_ | 74088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 75088b4d4aSMichal Wajdeczko * | | 27:16 | **DATA0** - request data (depends on ACTION) | 76088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 77088b4d4aSMichal Wajdeczko * | | 15:0 | **ACTION** - requested action code | 78088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 79088b4d4aSMichal Wajdeczko * | 1 | 31:0 | | 80088b4d4aSMichal Wajdeczko * +---+-------+ | 81088b4d4aSMichal Wajdeczko * |...| | **DATAn** - optional data (depends on ACTION) | 82088b4d4aSMichal Wajdeczko * +---+-------+ | 83088b4d4aSMichal Wajdeczko * | n | 31:0 | | 84088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 85088b4d4aSMichal Wajdeczko */ 86088b4d4aSMichal Wajdeczko 87088b4d4aSMichal Wajdeczko #define GUC_HXG_REQUEST_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN 88088b4d4aSMichal Wajdeczko #define GUC_HXG_REQUEST_MSG_0_DATA0 (0xfff << 16) 89088b4d4aSMichal Wajdeczko #define GUC_HXG_REQUEST_MSG_0_ACTION (0xffff << 0) 90088b4d4aSMichal Wajdeczko #define GUC_HXG_REQUEST_MSG_n_DATAn GUC_HXG_MSG_n_PAYLOAD 91088b4d4aSMichal Wajdeczko 92088b4d4aSMichal Wajdeczko /** 93088b4d4aSMichal Wajdeczko * DOC: HXG Event 94088b4d4aSMichal Wajdeczko * 95088b4d4aSMichal Wajdeczko * The `HXG Event`_ message should be used to initiate asynchronous activity 96088b4d4aSMichal Wajdeczko * that does not involves immediate confirmation nor data. 97088b4d4aSMichal Wajdeczko * 98088b4d4aSMichal Wajdeczko * Format of @DATA0 and all @DATAn fields depends on the @ACTION code. 99088b4d4aSMichal Wajdeczko * 100088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 101088b4d4aSMichal Wajdeczko * | | Bits | Description | 102088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 103088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 104088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 105088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_EVENT_ | 106088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 107088b4d4aSMichal Wajdeczko * | | 27:16 | **DATA0** - event data (depends on ACTION) | 108088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 109088b4d4aSMichal Wajdeczko * | | 15:0 | **ACTION** - event action code | 110088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 111088b4d4aSMichal Wajdeczko * | 1 | 31:0 | | 112088b4d4aSMichal Wajdeczko * +---+-------+ | 113088b4d4aSMichal Wajdeczko * |...| | **DATAn** - optional event data (depends on ACTION) | 114088b4d4aSMichal Wajdeczko * +---+-------+ | 115088b4d4aSMichal Wajdeczko * | n | 31:0 | | 116088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 117088b4d4aSMichal Wajdeczko */ 118088b4d4aSMichal Wajdeczko 119088b4d4aSMichal Wajdeczko #define GUC_HXG_EVENT_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN 120088b4d4aSMichal Wajdeczko #define GUC_HXG_EVENT_MSG_0_DATA0 (0xfff << 16) 121088b4d4aSMichal Wajdeczko #define GUC_HXG_EVENT_MSG_0_ACTION (0xffff << 0) 122088b4d4aSMichal Wajdeczko #define GUC_HXG_EVENT_MSG_n_DATAn GUC_HXG_MSG_n_PAYLOAD 123088b4d4aSMichal Wajdeczko 124088b4d4aSMichal Wajdeczko /** 125088b4d4aSMichal Wajdeczko * DOC: HXG Busy 126088b4d4aSMichal Wajdeczko * 127088b4d4aSMichal Wajdeczko * The `HXG Busy`_ message may be used to acknowledge reception of the `HXG Request`_ 128088b4d4aSMichal Wajdeczko * message if the recipient expects that it processing will be longer than default 129088b4d4aSMichal Wajdeczko * timeout. 130088b4d4aSMichal Wajdeczko * 131088b4d4aSMichal Wajdeczko * The @COUNTER field may be used as a progress indicator. 132088b4d4aSMichal Wajdeczko * 133088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 134088b4d4aSMichal Wajdeczko * | | Bits | Description | 135088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 136088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 137088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 138088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_BUSY_ | 139088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 140088b4d4aSMichal Wajdeczko * | | 27:0 | **COUNTER** - progress indicator | 141088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 142088b4d4aSMichal Wajdeczko */ 143088b4d4aSMichal Wajdeczko 144088b4d4aSMichal Wajdeczko #define GUC_HXG_BUSY_MSG_LEN GUC_HXG_MSG_MIN_LEN 145088b4d4aSMichal Wajdeczko #define GUC_HXG_BUSY_MSG_0_COUNTER GUC_HXG_MSG_0_AUX 146088b4d4aSMichal Wajdeczko 147088b4d4aSMichal Wajdeczko /** 148088b4d4aSMichal Wajdeczko * DOC: HXG Retry 149088b4d4aSMichal Wajdeczko * 150088b4d4aSMichal Wajdeczko * The `HXG Retry`_ message should be used by recipient to indicate that the 151088b4d4aSMichal Wajdeczko * `HXG Request`_ message was dropped and it should be resent again. 152088b4d4aSMichal Wajdeczko * 153088b4d4aSMichal Wajdeczko * The @REASON field may be used to provide additional information. 154088b4d4aSMichal Wajdeczko * 155088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 156088b4d4aSMichal Wajdeczko * | | Bits | Description | 157088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 158088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 159088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 160088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_NO_RESPONSE_RETRY_ | 161088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 162088b4d4aSMichal Wajdeczko * | | 27:0 | **REASON** - reason for retry | 163088b4d4aSMichal Wajdeczko * | | | - _`GUC_HXG_RETRY_REASON_UNSPECIFIED` = 0 | 164088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 165088b4d4aSMichal Wajdeczko */ 166088b4d4aSMichal Wajdeczko 167088b4d4aSMichal Wajdeczko #define GUC_HXG_RETRY_MSG_LEN GUC_HXG_MSG_MIN_LEN 168088b4d4aSMichal Wajdeczko #define GUC_HXG_RETRY_MSG_0_REASON GUC_HXG_MSG_0_AUX 169088b4d4aSMichal Wajdeczko #define GUC_HXG_RETRY_REASON_UNSPECIFIED 0u 170088b4d4aSMichal Wajdeczko 171088b4d4aSMichal Wajdeczko /** 172088b4d4aSMichal Wajdeczko * DOC: HXG Failure 173088b4d4aSMichal Wajdeczko * 174088b4d4aSMichal Wajdeczko * The `HXG Failure`_ message shall be used as a reply to the `HXG Request`_ 175088b4d4aSMichal Wajdeczko * message that could not be processed due to an error. 176088b4d4aSMichal Wajdeczko * 177088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 178088b4d4aSMichal Wajdeczko * | | Bits | Description | 179088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 180088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 181088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 182088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_FAILURE_ | 183088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 184088b4d4aSMichal Wajdeczko * | | 27:16 | **HINT** - additional error hint | 185088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 186088b4d4aSMichal Wajdeczko * | | 15:0 | **ERROR** - error/result code | 187088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 188088b4d4aSMichal Wajdeczko */ 189088b4d4aSMichal Wajdeczko 190088b4d4aSMichal Wajdeczko #define GUC_HXG_FAILURE_MSG_LEN GUC_HXG_MSG_MIN_LEN 191088b4d4aSMichal Wajdeczko #define GUC_HXG_FAILURE_MSG_0_HINT (0xfff << 16) 192088b4d4aSMichal Wajdeczko #define GUC_HXG_FAILURE_MSG_0_ERROR (0xffff << 0) 193088b4d4aSMichal Wajdeczko 194088b4d4aSMichal Wajdeczko /** 195088b4d4aSMichal Wajdeczko * DOC: HXG Response 196088b4d4aSMichal Wajdeczko * 197088b4d4aSMichal Wajdeczko * The `HXG Response`_ message shall be used as a reply to the `HXG Request`_ 198088b4d4aSMichal Wajdeczko * message that was successfully processed without an error. 199088b4d4aSMichal Wajdeczko * 200088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 201088b4d4aSMichal Wajdeczko * | | Bits | Description | 202088b4d4aSMichal Wajdeczko * +===+=======+==============================================================+ 203088b4d4aSMichal Wajdeczko * | 0 | 31 | ORIGIN | 204088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 205088b4d4aSMichal Wajdeczko * | | 30:28 | TYPE = GUC_HXG_TYPE_RESPONSE_SUCCESS_ | 206088b4d4aSMichal Wajdeczko * | +-------+--------------------------------------------------------------+ 207088b4d4aSMichal Wajdeczko * | | 27:0 | **DATA0** - data (depends on ACTION from `HXG Request`_) | 208088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 209088b4d4aSMichal Wajdeczko * | 1 | 31:0 | | 210088b4d4aSMichal Wajdeczko * +---+-------+ | 211088b4d4aSMichal Wajdeczko * |...| | **DATAn** - data (depends on ACTION from `HXG Request`_) | 212088b4d4aSMichal Wajdeczko * +---+-------+ | 213088b4d4aSMichal Wajdeczko * | n | 31:0 | | 214088b4d4aSMichal Wajdeczko * +---+-------+--------------------------------------------------------------+ 215088b4d4aSMichal Wajdeczko */ 216088b4d4aSMichal Wajdeczko 217088b4d4aSMichal Wajdeczko #define GUC_HXG_RESPONSE_MSG_MIN_LEN GUC_HXG_MSG_MIN_LEN 218088b4d4aSMichal Wajdeczko #define GUC_HXG_RESPONSE_MSG_0_DATA0 GUC_HXG_MSG_0_AUX 219088b4d4aSMichal Wajdeczko #define GUC_HXG_RESPONSE_MSG_n_DATAn GUC_HXG_MSG_n_PAYLOAD 220088b4d4aSMichal Wajdeczko 221088b4d4aSMichal 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