122851890Sopenharmony_ci/****************************************************************************
222851890Sopenharmony_ci ****************************************************************************
322851890Sopenharmony_ci ***
422851890Sopenharmony_ci ***   This header was automatically generated from a Linux kernel header
522851890Sopenharmony_ci ***   of the same name, to make information necessary for userspace to
622851890Sopenharmony_ci ***   call into the kernel available to libc.  It contains only constants,
722851890Sopenharmony_ci ***   structures, and macros generated from the original header, and thus,
822851890Sopenharmony_ci ***   contains no copyrightable information.
922851890Sopenharmony_ci ***
1022851890Sopenharmony_ci ***   To edit the content of this header, modify the corresponding
1122851890Sopenharmony_ci ***   source file (e.g. under external/kernel-headers/original/) then
1222851890Sopenharmony_ci ***   run bionic/libc/kernel/tools/update_all.py
1322851890Sopenharmony_ci ***
1422851890Sopenharmony_ci ***   Any manual change here will be lost the next time this script will
1522851890Sopenharmony_ci ***   be run. You've been warned!
1622851890Sopenharmony_ci ***
1722851890Sopenharmony_ci ****************************************************************************
1822851890Sopenharmony_ci ****************************************************************************/
1922851890Sopenharmony_ci#ifndef _USR_IDXD_H_
2022851890Sopenharmony_ci#define _USR_IDXD_H_
2122851890Sopenharmony_ci#include <stdint.h>
2222851890Sopenharmony_ci#define IDXD_OP_FLAG_FENCE 0x0001
2322851890Sopenharmony_ci#define IDXD_OP_FLAG_BOF 0x0002
2422851890Sopenharmony_ci#define IDXD_OP_FLAG_CRAV 0x0004
2522851890Sopenharmony_ci#define IDXD_OP_FLAG_RCR 0x0008
2622851890Sopenharmony_ci#define IDXD_OP_FLAG_RCI 0x0010
2722851890Sopenharmony_ci#define IDXD_OP_FLAG_CRSTS 0x0020
2822851890Sopenharmony_ci#define IDXD_OP_FLAG_CR 0x0080
2922851890Sopenharmony_ci#define IDXD_OP_FLAG_CC 0x0100
3022851890Sopenharmony_ci#define IDXD_OP_FLAG_ADDR1_TCS 0x0200
3122851890Sopenharmony_ci#define IDXD_OP_FLAG_ADDR2_TCS 0x0400
3222851890Sopenharmony_ci#define IDXD_OP_FLAG_ADDR3_TCS 0x0800
3322851890Sopenharmony_ci#define IDXD_OP_FLAG_CR_TCS 0x1000
3422851890Sopenharmony_ci#define IDXD_OP_FLAG_STORD 0x2000
3522851890Sopenharmony_ci#define IDXD_OP_FLAG_DRDBK 0x4000
3622851890Sopenharmony_ci#define IDXD_OP_FLAG_DSTS 0x8000
3722851890Sopenharmony_cienum dsa_opcode {
3822851890Sopenharmony_ci  DSA_OPCODE_NOOP = 0,
3922851890Sopenharmony_ci  DSA_OPCODE_BATCH,
4022851890Sopenharmony_ci  DSA_OPCODE_DRAIN,
4122851890Sopenharmony_ci  DSA_OPCODE_MEMMOVE,
4222851890Sopenharmony_ci  DSA_OPCODE_MEMFILL,
4322851890Sopenharmony_ci  DSA_OPCODE_COMPARE,
4422851890Sopenharmony_ci  DSA_OPCODE_COMPVAL,
4522851890Sopenharmony_ci  DSA_OPCODE_CR_DELTA,
4622851890Sopenharmony_ci  DSA_OPCODE_AP_DELTA,
4722851890Sopenharmony_ci  DSA_OPCODE_DUALCAST,
4822851890Sopenharmony_ci  DSA_OPCODE_CRCGEN = 0x10,
4922851890Sopenharmony_ci  DSA_OPCODE_COPY_CRC,
5022851890Sopenharmony_ci  DSA_OPCODE_DIF_CHECK,
5122851890Sopenharmony_ci  DSA_OPCODE_DIF_INS,
5222851890Sopenharmony_ci  DSA_OPCODE_DIF_STRP,
5322851890Sopenharmony_ci  DSA_OPCODE_DIF_UPDT,
5422851890Sopenharmony_ci  DSA_OPCODE_CFLUSH = 0x20,
5522851890Sopenharmony_ci};
5622851890Sopenharmony_cienum dsa_completion_status {
5722851890Sopenharmony_ci  DSA_COMP_NONE = 0,
5822851890Sopenharmony_ci  DSA_COMP_SUCCESS,
5922851890Sopenharmony_ci  DSA_COMP_SUCCESS_PRED,
6022851890Sopenharmony_ci  DSA_COMP_PAGE_FAULT_NOBOF,
6122851890Sopenharmony_ci  DSA_COMP_PAGE_FAULT_IR,
6222851890Sopenharmony_ci  DSA_COMP_BATCH_FAIL,
6322851890Sopenharmony_ci  DSA_COMP_BATCH_PAGE_FAULT,
6422851890Sopenharmony_ci  DSA_COMP_DR_OFFSET_NOINC,
6522851890Sopenharmony_ci  DSA_COMP_DR_OFFSET_ERANGE,
6622851890Sopenharmony_ci  DSA_COMP_DIF_ERR,
6722851890Sopenharmony_ci  DSA_COMP_BAD_OPCODE = 0x10,
6822851890Sopenharmony_ci  DSA_COMP_INVALID_FLAGS,
6922851890Sopenharmony_ci  DSA_COMP_NOZERO_RESERVE,
7022851890Sopenharmony_ci  DSA_COMP_XFER_ERANGE,
7122851890Sopenharmony_ci  DSA_COMP_DESC_CNT_ERANGE,
7222851890Sopenharmony_ci  DSA_COMP_DR_ERANGE,
7322851890Sopenharmony_ci  DSA_COMP_OVERLAP_BUFFERS,
7422851890Sopenharmony_ci  DSA_COMP_DCAST_ERR,
7522851890Sopenharmony_ci  DSA_COMP_DESCLIST_ALIGN,
7622851890Sopenharmony_ci  DSA_COMP_INT_HANDLE_INVAL,
7722851890Sopenharmony_ci  DSA_COMP_CRA_XLAT,
7822851890Sopenharmony_ci  DSA_COMP_CRA_ALIGN,
7922851890Sopenharmony_ci  DSA_COMP_ADDR_ALIGN,
8022851890Sopenharmony_ci  DSA_COMP_PRIV_BAD,
8122851890Sopenharmony_ci  DSA_COMP_TRAFFIC_CLASS_CONF,
8222851890Sopenharmony_ci  DSA_COMP_PFAULT_RDBA,
8322851890Sopenharmony_ci  DSA_COMP_HW_ERR1,
8422851890Sopenharmony_ci  DSA_COMP_HW_ERR_DRB,
8522851890Sopenharmony_ci  DSA_COMP_TRANSLATION_FAIL,
8622851890Sopenharmony_ci};
8722851890Sopenharmony_ci#define DSA_COMP_STATUS_MASK 0x7f
8822851890Sopenharmony_ci#define DSA_COMP_STATUS_WRITE 0x80
8922851890Sopenharmony_cistruct dsa_hw_desc {
9022851890Sopenharmony_ci  uint32_t pasid : 20;
9122851890Sopenharmony_ci  uint32_t rsvd : 11;
9222851890Sopenharmony_ci  uint32_t priv : 1;
9322851890Sopenharmony_ci  uint32_t flags : 24;
9422851890Sopenharmony_ci  uint32_t opcode : 8;
9522851890Sopenharmony_ci  uint64_t completion_addr;
9622851890Sopenharmony_ci  union {
9722851890Sopenharmony_ci    uint64_t src_addr;
9822851890Sopenharmony_ci    uint64_t rdback_addr;
9922851890Sopenharmony_ci    uint64_t pattern;
10022851890Sopenharmony_ci    uint64_t desc_list_addr;
10122851890Sopenharmony_ci  };
10222851890Sopenharmony_ci  union {
10322851890Sopenharmony_ci    uint64_t dst_addr;
10422851890Sopenharmony_ci    uint64_t rdback_addr2;
10522851890Sopenharmony_ci    uint64_t src2_addr;
10622851890Sopenharmony_ci    uint64_t comp_pattern;
10722851890Sopenharmony_ci  };
10822851890Sopenharmony_ci  union {
10922851890Sopenharmony_ci    uint32_t xfer_size;
11022851890Sopenharmony_ci    uint32_t desc_count;
11122851890Sopenharmony_ci  };
11222851890Sopenharmony_ci  uint16_t int_handle;
11322851890Sopenharmony_ci  uint16_t rsvd1;
11422851890Sopenharmony_ci  union {
11522851890Sopenharmony_ci    uint8_t expected_res;
11622851890Sopenharmony_ci    struct {
11722851890Sopenharmony_ci      uint64_t delta_addr;
11822851890Sopenharmony_ci      uint32_t max_delta_size;
11922851890Sopenharmony_ci      uint32_t delt_rsvd;
12022851890Sopenharmony_ci      uint8_t expected_res_mask;
12122851890Sopenharmony_ci    };
12222851890Sopenharmony_ci    uint32_t delta_rec_size;
12322851890Sopenharmony_ci    uint64_t dest2;
12422851890Sopenharmony_ci    struct {
12522851890Sopenharmony_ci      uint32_t crc_seed;
12622851890Sopenharmony_ci      uint32_t crc_rsvd;
12722851890Sopenharmony_ci      uint64_t seed_addr;
12822851890Sopenharmony_ci    };
12922851890Sopenharmony_ci    struct {
13022851890Sopenharmony_ci      uint8_t src_dif_flags;
13122851890Sopenharmony_ci      uint8_t dif_chk_res;
13222851890Sopenharmony_ci      uint8_t dif_chk_flags;
13322851890Sopenharmony_ci      uint8_t dif_chk_res2[5];
13422851890Sopenharmony_ci      uint32_t chk_ref_tag_seed;
13522851890Sopenharmony_ci      uint16_t chk_app_tag_mask;
13622851890Sopenharmony_ci      uint16_t chk_app_tag_seed;
13722851890Sopenharmony_ci    };
13822851890Sopenharmony_ci    struct {
13922851890Sopenharmony_ci      uint8_t dif_ins_res;
14022851890Sopenharmony_ci      uint8_t dest_dif_flag;
14122851890Sopenharmony_ci      uint8_t dif_ins_flags;
14222851890Sopenharmony_ci      uint8_t dif_ins_res2[13];
14322851890Sopenharmony_ci      uint32_t ins_ref_tag_seed;
14422851890Sopenharmony_ci      uint16_t ins_app_tag_mask;
14522851890Sopenharmony_ci      uint16_t ins_app_tag_seed;
14622851890Sopenharmony_ci    };
14722851890Sopenharmony_ci    struct {
14822851890Sopenharmony_ci      uint8_t src_upd_flags;
14922851890Sopenharmony_ci      uint8_t upd_dest_flags;
15022851890Sopenharmony_ci      uint8_t dif_upd_flags;
15122851890Sopenharmony_ci      uint8_t dif_upd_res[5];
15222851890Sopenharmony_ci      uint32_t src_ref_tag_seed;
15322851890Sopenharmony_ci      uint16_t src_app_tag_mask;
15422851890Sopenharmony_ci      uint16_t src_app_tag_seed;
15522851890Sopenharmony_ci      uint32_t dest_ref_tag_seed;
15622851890Sopenharmony_ci      uint16_t dest_app_tag_mask;
15722851890Sopenharmony_ci      uint16_t dest_app_tag_seed;
15822851890Sopenharmony_ci    };
15922851890Sopenharmony_ci    uint8_t op_specific[24];
16022851890Sopenharmony_ci  };
16122851890Sopenharmony_ci} __attribute__((packed));
16222851890Sopenharmony_cistruct dsa_raw_desc {
16322851890Sopenharmony_ci  uint64_t field[8];
16422851890Sopenharmony_ci} __attribute__((packed));
16522851890Sopenharmony_cistruct dsa_completion_record {
16622851890Sopenharmony_ci  volatile uint8_t status;
16722851890Sopenharmony_ci  union {
16822851890Sopenharmony_ci    uint8_t result;
16922851890Sopenharmony_ci    uint8_t dif_status;
17022851890Sopenharmony_ci  };
17122851890Sopenharmony_ci  uint16_t rsvd;
17222851890Sopenharmony_ci  uint32_t bytes_completed;
17322851890Sopenharmony_ci  uint64_t fault_addr;
17422851890Sopenharmony_ci  union {
17522851890Sopenharmony_ci    struct {
17622851890Sopenharmony_ci      uint32_t invalid_flags : 24;
17722851890Sopenharmony_ci      uint32_t rsvd2 : 8;
17822851890Sopenharmony_ci    };
17922851890Sopenharmony_ci    uint16_t delta_rec_size;
18022851890Sopenharmony_ci    uint16_t crc_val;
18122851890Sopenharmony_ci    struct {
18222851890Sopenharmony_ci      uint32_t dif_chk_ref_tag;
18322851890Sopenharmony_ci      uint16_t dif_chk_app_tag_mask;
18422851890Sopenharmony_ci      uint16_t dif_chk_app_tag;
18522851890Sopenharmony_ci    };
18622851890Sopenharmony_ci    struct {
18722851890Sopenharmony_ci      uint64_t dif_ins_res;
18822851890Sopenharmony_ci      uint32_t dif_ins_ref_tag;
18922851890Sopenharmony_ci      uint16_t dif_ins_app_tag_mask;
19022851890Sopenharmony_ci      uint16_t dif_ins_app_tag;
19122851890Sopenharmony_ci    };
19222851890Sopenharmony_ci    struct {
19322851890Sopenharmony_ci      uint32_t dif_upd_src_ref_tag;
19422851890Sopenharmony_ci      uint16_t dif_upd_src_app_tag_mask;
19522851890Sopenharmony_ci      uint16_t dif_upd_src_app_tag;
19622851890Sopenharmony_ci      uint32_t dif_upd_dest_ref_tag;
19722851890Sopenharmony_ci      uint16_t dif_upd_dest_app_tag_mask;
19822851890Sopenharmony_ci      uint16_t dif_upd_dest_app_tag;
19922851890Sopenharmony_ci    };
20022851890Sopenharmony_ci    uint8_t op_specific[16];
20122851890Sopenharmony_ci  };
20222851890Sopenharmony_ci} __attribute__((packed));
20322851890Sopenharmony_cistruct dsa_raw_completion_record {
20422851890Sopenharmony_ci  uint64_t field[4];
20522851890Sopenharmony_ci} __attribute__((packed));
20622851890Sopenharmony_ci#endif
207