18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci#ifndef _IOAT_HW_H_ 68c2ecf20Sopenharmony_ci#define _IOAT_HW_H_ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci/* PCI Configuration Space Values */ 98c2ecf20Sopenharmony_ci#define IOAT_MMIO_BAR 0 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci/* CB device ID's */ 128c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_IVB0 0x0e20 138c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_IVB1 0x0e21 148c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_IVB2 0x0e22 158c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_IVB3 0x0e23 168c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_IVB4 0x0e24 178c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_IVB5 0x0e25 188c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_IVB6 0x0e26 198c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_IVB7 0x0e27 208c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_IVB8 0x0e2e 218c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_IVB9 0x0e2f 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_HSW0 0x2f20 248c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_HSW1 0x2f21 258c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_HSW2 0x2f22 268c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_HSW3 0x2f23 278c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_HSW4 0x2f24 288c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_HSW5 0x2f25 298c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_HSW6 0x2f26 308c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_HSW7 0x2f27 318c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_HSW8 0x2f2e 328c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_HSW9 0x2f2f 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BWD0 0x0C50 358c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BWD1 0x0C51 368c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BWD2 0x0C52 378c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BWD3 0x0C53 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDXDE0 0x6f50 408c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDXDE1 0x6f51 418c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDXDE2 0x6f52 428c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDXDE3 0x6f53 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDX0 0x6f20 458c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDX1 0x6f21 468c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDX2 0x6f22 478c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDX3 0x6f23 488c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDX4 0x6f24 498c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDX5 0x6f25 508c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDX6 0x6f26 518c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDX7 0x6f27 528c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDX8 0x6f2e 538c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_BDX9 0x6f2f 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_SKX 0x2021 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IOAT_ICX 0x0b00 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci#define IOAT_VER_1_2 0x12 /* Version 1.2 */ 608c2ecf20Sopenharmony_ci#define IOAT_VER_2_0 0x20 /* Version 2.0 */ 618c2ecf20Sopenharmony_ci#define IOAT_VER_3_0 0x30 /* Version 3.0 */ 628c2ecf20Sopenharmony_ci#define IOAT_VER_3_2 0x32 /* Version 3.2 */ 638c2ecf20Sopenharmony_ci#define IOAT_VER_3_3 0x33 /* Version 3.3 */ 648c2ecf20Sopenharmony_ci#define IOAT_VER_3_4 0x34 /* Version 3.4 */ 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ciint system_has_dca_enabled(struct pci_dev *pdev); 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci#define IOAT_DESC_SZ 64 708c2ecf20Sopenharmony_ci 718c2ecf20Sopenharmony_cistruct ioat_dma_descriptor { 728c2ecf20Sopenharmony_ci uint32_t size; 738c2ecf20Sopenharmony_ci union { 748c2ecf20Sopenharmony_ci uint32_t ctl; 758c2ecf20Sopenharmony_ci struct { 768c2ecf20Sopenharmony_ci unsigned int int_en:1; 778c2ecf20Sopenharmony_ci unsigned int src_snoop_dis:1; 788c2ecf20Sopenharmony_ci unsigned int dest_snoop_dis:1; 798c2ecf20Sopenharmony_ci unsigned int compl_write:1; 808c2ecf20Sopenharmony_ci unsigned int fence:1; 818c2ecf20Sopenharmony_ci unsigned int null:1; 828c2ecf20Sopenharmony_ci unsigned int src_brk:1; 838c2ecf20Sopenharmony_ci unsigned int dest_brk:1; 848c2ecf20Sopenharmony_ci unsigned int bundle:1; 858c2ecf20Sopenharmony_ci unsigned int dest_dca:1; 868c2ecf20Sopenharmony_ci unsigned int hint:1; 878c2ecf20Sopenharmony_ci unsigned int rsvd2:13; 888c2ecf20Sopenharmony_ci #define IOAT_OP_COPY 0x00 898c2ecf20Sopenharmony_ci unsigned int op:8; 908c2ecf20Sopenharmony_ci } ctl_f; 918c2ecf20Sopenharmony_ci }; 928c2ecf20Sopenharmony_ci uint64_t src_addr; 938c2ecf20Sopenharmony_ci uint64_t dst_addr; 948c2ecf20Sopenharmony_ci uint64_t next; 958c2ecf20Sopenharmony_ci uint64_t rsv1; 968c2ecf20Sopenharmony_ci uint64_t rsv2; 978c2ecf20Sopenharmony_ci /* store some driver data in an unused portion of the descriptor */ 988c2ecf20Sopenharmony_ci union { 998c2ecf20Sopenharmony_ci uint64_t user1; 1008c2ecf20Sopenharmony_ci uint64_t tx_cnt; 1018c2ecf20Sopenharmony_ci }; 1028c2ecf20Sopenharmony_ci uint64_t user2; 1038c2ecf20Sopenharmony_ci}; 1048c2ecf20Sopenharmony_ci 1058c2ecf20Sopenharmony_cistruct ioat_xor_descriptor { 1068c2ecf20Sopenharmony_ci uint32_t size; 1078c2ecf20Sopenharmony_ci union { 1088c2ecf20Sopenharmony_ci uint32_t ctl; 1098c2ecf20Sopenharmony_ci struct { 1108c2ecf20Sopenharmony_ci unsigned int int_en:1; 1118c2ecf20Sopenharmony_ci unsigned int src_snoop_dis:1; 1128c2ecf20Sopenharmony_ci unsigned int dest_snoop_dis:1; 1138c2ecf20Sopenharmony_ci unsigned int compl_write:1; 1148c2ecf20Sopenharmony_ci unsigned int fence:1; 1158c2ecf20Sopenharmony_ci unsigned int src_cnt:3; 1168c2ecf20Sopenharmony_ci unsigned int bundle:1; 1178c2ecf20Sopenharmony_ci unsigned int dest_dca:1; 1188c2ecf20Sopenharmony_ci unsigned int hint:1; 1198c2ecf20Sopenharmony_ci unsigned int rsvd:13; 1208c2ecf20Sopenharmony_ci #define IOAT_OP_XOR 0x87 1218c2ecf20Sopenharmony_ci #define IOAT_OP_XOR_VAL 0x88 1228c2ecf20Sopenharmony_ci unsigned int op:8; 1238c2ecf20Sopenharmony_ci } ctl_f; 1248c2ecf20Sopenharmony_ci }; 1258c2ecf20Sopenharmony_ci uint64_t src_addr; 1268c2ecf20Sopenharmony_ci uint64_t dst_addr; 1278c2ecf20Sopenharmony_ci uint64_t next; 1288c2ecf20Sopenharmony_ci uint64_t src_addr2; 1298c2ecf20Sopenharmony_ci uint64_t src_addr3; 1308c2ecf20Sopenharmony_ci uint64_t src_addr4; 1318c2ecf20Sopenharmony_ci uint64_t src_addr5; 1328c2ecf20Sopenharmony_ci}; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_cistruct ioat_xor_ext_descriptor { 1358c2ecf20Sopenharmony_ci uint64_t src_addr6; 1368c2ecf20Sopenharmony_ci uint64_t src_addr7; 1378c2ecf20Sopenharmony_ci uint64_t src_addr8; 1388c2ecf20Sopenharmony_ci uint64_t next; 1398c2ecf20Sopenharmony_ci uint64_t rsvd[4]; 1408c2ecf20Sopenharmony_ci}; 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_cistruct ioat_pq_descriptor { 1438c2ecf20Sopenharmony_ci union { 1448c2ecf20Sopenharmony_ci uint32_t size; 1458c2ecf20Sopenharmony_ci uint32_t dwbes; 1468c2ecf20Sopenharmony_ci struct { 1478c2ecf20Sopenharmony_ci unsigned int rsvd:25; 1488c2ecf20Sopenharmony_ci unsigned int p_val_err:1; 1498c2ecf20Sopenharmony_ci unsigned int q_val_err:1; 1508c2ecf20Sopenharmony_ci unsigned int rsvd1:4; 1518c2ecf20Sopenharmony_ci unsigned int wbes:1; 1528c2ecf20Sopenharmony_ci } dwbes_f; 1538c2ecf20Sopenharmony_ci }; 1548c2ecf20Sopenharmony_ci union { 1558c2ecf20Sopenharmony_ci uint32_t ctl; 1568c2ecf20Sopenharmony_ci struct { 1578c2ecf20Sopenharmony_ci unsigned int int_en:1; 1588c2ecf20Sopenharmony_ci unsigned int src_snoop_dis:1; 1598c2ecf20Sopenharmony_ci unsigned int dest_snoop_dis:1; 1608c2ecf20Sopenharmony_ci unsigned int compl_write:1; 1618c2ecf20Sopenharmony_ci unsigned int fence:1; 1628c2ecf20Sopenharmony_ci unsigned int src_cnt:3; 1638c2ecf20Sopenharmony_ci unsigned int bundle:1; 1648c2ecf20Sopenharmony_ci unsigned int dest_dca:1; 1658c2ecf20Sopenharmony_ci unsigned int hint:1; 1668c2ecf20Sopenharmony_ci unsigned int p_disable:1; 1678c2ecf20Sopenharmony_ci unsigned int q_disable:1; 1688c2ecf20Sopenharmony_ci unsigned int rsvd2:2; 1698c2ecf20Sopenharmony_ci unsigned int wb_en:1; 1708c2ecf20Sopenharmony_ci unsigned int prl_en:1; 1718c2ecf20Sopenharmony_ci unsigned int rsvd3:7; 1728c2ecf20Sopenharmony_ci #define IOAT_OP_PQ 0x89 1738c2ecf20Sopenharmony_ci #define IOAT_OP_PQ_VAL 0x8a 1748c2ecf20Sopenharmony_ci #define IOAT_OP_PQ_16S 0xa0 1758c2ecf20Sopenharmony_ci #define IOAT_OP_PQ_VAL_16S 0xa1 1768c2ecf20Sopenharmony_ci unsigned int op:8; 1778c2ecf20Sopenharmony_ci } ctl_f; 1788c2ecf20Sopenharmony_ci }; 1798c2ecf20Sopenharmony_ci uint64_t src_addr; 1808c2ecf20Sopenharmony_ci uint64_t p_addr; 1818c2ecf20Sopenharmony_ci uint64_t next; 1828c2ecf20Sopenharmony_ci uint64_t src_addr2; 1838c2ecf20Sopenharmony_ci union { 1848c2ecf20Sopenharmony_ci uint64_t src_addr3; 1858c2ecf20Sopenharmony_ci uint64_t sed_addr; 1868c2ecf20Sopenharmony_ci }; 1878c2ecf20Sopenharmony_ci uint8_t coef[8]; 1888c2ecf20Sopenharmony_ci uint64_t q_addr; 1898c2ecf20Sopenharmony_ci}; 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_cistruct ioat_pq_ext_descriptor { 1928c2ecf20Sopenharmony_ci uint64_t src_addr4; 1938c2ecf20Sopenharmony_ci uint64_t src_addr5; 1948c2ecf20Sopenharmony_ci uint64_t src_addr6; 1958c2ecf20Sopenharmony_ci uint64_t next; 1968c2ecf20Sopenharmony_ci uint64_t src_addr7; 1978c2ecf20Sopenharmony_ci uint64_t src_addr8; 1988c2ecf20Sopenharmony_ci uint64_t rsvd[2]; 1998c2ecf20Sopenharmony_ci}; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_cistruct ioat_pq_update_descriptor { 2028c2ecf20Sopenharmony_ci uint32_t size; 2038c2ecf20Sopenharmony_ci union { 2048c2ecf20Sopenharmony_ci uint32_t ctl; 2058c2ecf20Sopenharmony_ci struct { 2068c2ecf20Sopenharmony_ci unsigned int int_en:1; 2078c2ecf20Sopenharmony_ci unsigned int src_snoop_dis:1; 2088c2ecf20Sopenharmony_ci unsigned int dest_snoop_dis:1; 2098c2ecf20Sopenharmony_ci unsigned int compl_write:1; 2108c2ecf20Sopenharmony_ci unsigned int fence:1; 2118c2ecf20Sopenharmony_ci unsigned int src_cnt:3; 2128c2ecf20Sopenharmony_ci unsigned int bundle:1; 2138c2ecf20Sopenharmony_ci unsigned int dest_dca:1; 2148c2ecf20Sopenharmony_ci unsigned int hint:1; 2158c2ecf20Sopenharmony_ci unsigned int p_disable:1; 2168c2ecf20Sopenharmony_ci unsigned int q_disable:1; 2178c2ecf20Sopenharmony_ci unsigned int rsvd:3; 2188c2ecf20Sopenharmony_ci unsigned int coef:8; 2198c2ecf20Sopenharmony_ci #define IOAT_OP_PQ_UP 0x8b 2208c2ecf20Sopenharmony_ci unsigned int op:8; 2218c2ecf20Sopenharmony_ci } ctl_f; 2228c2ecf20Sopenharmony_ci }; 2238c2ecf20Sopenharmony_ci uint64_t src_addr; 2248c2ecf20Sopenharmony_ci uint64_t p_addr; 2258c2ecf20Sopenharmony_ci uint64_t next; 2268c2ecf20Sopenharmony_ci uint64_t src_addr2; 2278c2ecf20Sopenharmony_ci uint64_t p_src; 2288c2ecf20Sopenharmony_ci uint64_t q_src; 2298c2ecf20Sopenharmony_ci uint64_t q_addr; 2308c2ecf20Sopenharmony_ci}; 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_cistruct ioat_raw_descriptor { 2338c2ecf20Sopenharmony_ci uint64_t field[8]; 2348c2ecf20Sopenharmony_ci}; 2358c2ecf20Sopenharmony_ci 2368c2ecf20Sopenharmony_cistruct ioat_pq16a_descriptor { 2378c2ecf20Sopenharmony_ci uint8_t coef[8]; 2388c2ecf20Sopenharmony_ci uint64_t src_addr3; 2398c2ecf20Sopenharmony_ci uint64_t src_addr4; 2408c2ecf20Sopenharmony_ci uint64_t src_addr5; 2418c2ecf20Sopenharmony_ci uint64_t src_addr6; 2428c2ecf20Sopenharmony_ci uint64_t src_addr7; 2438c2ecf20Sopenharmony_ci uint64_t src_addr8; 2448c2ecf20Sopenharmony_ci uint64_t src_addr9; 2458c2ecf20Sopenharmony_ci}; 2468c2ecf20Sopenharmony_ci 2478c2ecf20Sopenharmony_cistruct ioat_pq16b_descriptor { 2488c2ecf20Sopenharmony_ci uint64_t src_addr10; 2498c2ecf20Sopenharmony_ci uint64_t src_addr11; 2508c2ecf20Sopenharmony_ci uint64_t src_addr12; 2518c2ecf20Sopenharmony_ci uint64_t src_addr13; 2528c2ecf20Sopenharmony_ci uint64_t src_addr14; 2538c2ecf20Sopenharmony_ci uint64_t src_addr15; 2548c2ecf20Sopenharmony_ci uint64_t src_addr16; 2558c2ecf20Sopenharmony_ci uint64_t rsvd; 2568c2ecf20Sopenharmony_ci}; 2578c2ecf20Sopenharmony_ci 2588c2ecf20Sopenharmony_ciunion ioat_sed_pq_descriptor { 2598c2ecf20Sopenharmony_ci struct ioat_pq16a_descriptor a; 2608c2ecf20Sopenharmony_ci struct ioat_pq16b_descriptor b; 2618c2ecf20Sopenharmony_ci}; 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_ci#define SED_SIZE 64 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_cistruct ioat_sed_raw_descriptor { 2668c2ecf20Sopenharmony_ci uint64_t a[8]; 2678c2ecf20Sopenharmony_ci uint64_t b[8]; 2688c2ecf20Sopenharmony_ci uint64_t c[8]; 2698c2ecf20Sopenharmony_ci}; 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci#endif 272