18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright IBM Corp. 2000, 2008 48c2ecf20Sopenharmony_ci * Author(s): Utz Bacher <utz.bacher@de.ibm.com> 58c2ecf20Sopenharmony_ci * Jan Glauber <jang@linux.vnet.ibm.com> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci#ifndef __QDIO_H__ 98c2ecf20Sopenharmony_ci#define __QDIO_H__ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 128c2ecf20Sopenharmony_ci#include <asm/cio.h> 138c2ecf20Sopenharmony_ci#include <asm/ccwdev.h> 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci/* only use 4 queues to save some cachelines */ 168c2ecf20Sopenharmony_ci#define QDIO_MAX_QUEUES_PER_IRQ 4 178c2ecf20Sopenharmony_ci#define QDIO_MAX_BUFFERS_PER_Q 128 188c2ecf20Sopenharmony_ci#define QDIO_MAX_BUFFERS_MASK (QDIO_MAX_BUFFERS_PER_Q - 1) 198c2ecf20Sopenharmony_ci#define QDIO_BUFNR(num) ((num) & QDIO_MAX_BUFFERS_MASK) 208c2ecf20Sopenharmony_ci#define QDIO_MAX_ELEMENTS_PER_BUFFER 16 218c2ecf20Sopenharmony_ci#define QDIO_SBAL_SIZE 256 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ci#define QDIO_QETH_QFMT 0 248c2ecf20Sopenharmony_ci#define QDIO_ZFCP_QFMT 1 258c2ecf20Sopenharmony_ci#define QDIO_IQDIO_QFMT 2 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci/** 288c2ecf20Sopenharmony_ci * struct qdesfmt0 - queue descriptor, format 0 298c2ecf20Sopenharmony_ci * @sliba: absolute address of storage list information block 308c2ecf20Sopenharmony_ci * @sla: absolute address of storage list 318c2ecf20Sopenharmony_ci * @slsba: absolute address of storage list state block 328c2ecf20Sopenharmony_ci * @akey: access key for SLIB 338c2ecf20Sopenharmony_ci * @bkey: access key for SL 348c2ecf20Sopenharmony_ci * @ckey: access key for SBALs 358c2ecf20Sopenharmony_ci * @dkey: access key for SLSB 368c2ecf20Sopenharmony_ci */ 378c2ecf20Sopenharmony_cistruct qdesfmt0 { 388c2ecf20Sopenharmony_ci u64 sliba; 398c2ecf20Sopenharmony_ci u64 sla; 408c2ecf20Sopenharmony_ci u64 slsba; 418c2ecf20Sopenharmony_ci u32 : 32; 428c2ecf20Sopenharmony_ci u32 akey : 4; 438c2ecf20Sopenharmony_ci u32 bkey : 4; 448c2ecf20Sopenharmony_ci u32 ckey : 4; 458c2ecf20Sopenharmony_ci u32 dkey : 4; 468c2ecf20Sopenharmony_ci u32 : 16; 478c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci#define QDR_AC_MULTI_BUFFER_ENABLE 0x01 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/** 528c2ecf20Sopenharmony_ci * struct qdr - queue description record (QDR) 538c2ecf20Sopenharmony_ci * @qfmt: queue format 548c2ecf20Sopenharmony_ci * @ac: adapter characteristics 558c2ecf20Sopenharmony_ci * @iqdcnt: input queue descriptor count 568c2ecf20Sopenharmony_ci * @oqdcnt: output queue descriptor count 578c2ecf20Sopenharmony_ci * @iqdsz: input queue descriptor size 588c2ecf20Sopenharmony_ci * @oqdsz: output queue descriptor size 598c2ecf20Sopenharmony_ci * @qiba: absolute address of queue information block 608c2ecf20Sopenharmony_ci * @qkey: queue information block key 618c2ecf20Sopenharmony_ci * @qdf0: queue descriptions 628c2ecf20Sopenharmony_ci */ 638c2ecf20Sopenharmony_cistruct qdr { 648c2ecf20Sopenharmony_ci u32 qfmt : 8; 658c2ecf20Sopenharmony_ci u32 : 16; 668c2ecf20Sopenharmony_ci u32 ac : 8; 678c2ecf20Sopenharmony_ci u32 : 8; 688c2ecf20Sopenharmony_ci u32 iqdcnt : 8; 698c2ecf20Sopenharmony_ci u32 : 8; 708c2ecf20Sopenharmony_ci u32 oqdcnt : 8; 718c2ecf20Sopenharmony_ci u32 : 8; 728c2ecf20Sopenharmony_ci u32 iqdsz : 8; 738c2ecf20Sopenharmony_ci u32 : 8; 748c2ecf20Sopenharmony_ci u32 oqdsz : 8; 758c2ecf20Sopenharmony_ci /* private: */ 768c2ecf20Sopenharmony_ci u32 res[9]; 778c2ecf20Sopenharmony_ci /* public: */ 788c2ecf20Sopenharmony_ci u64 qiba; 798c2ecf20Sopenharmony_ci u32 : 32; 808c2ecf20Sopenharmony_ci u32 qkey : 4; 818c2ecf20Sopenharmony_ci u32 : 28; 828c2ecf20Sopenharmony_ci struct qdesfmt0 qdf0[126]; 838c2ecf20Sopenharmony_ci} __packed __aligned(PAGE_SIZE); 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40 868c2ecf20Sopenharmony_ci#define QIB_RFLAGS_ENABLE_QEBSM 0x80 878c2ecf20Sopenharmony_ci#define QIB_RFLAGS_ENABLE_DATA_DIV 0x02 888c2ecf20Sopenharmony_ci 898c2ecf20Sopenharmony_ci/** 908c2ecf20Sopenharmony_ci * struct qib - queue information block (QIB) 918c2ecf20Sopenharmony_ci * @qfmt: queue format 928c2ecf20Sopenharmony_ci * @pfmt: implementation dependent parameter format 938c2ecf20Sopenharmony_ci * @rflags: QEBSM 948c2ecf20Sopenharmony_ci * @ac: adapter characteristics 958c2ecf20Sopenharmony_ci * @isliba: absolute address of first input SLIB 968c2ecf20Sopenharmony_ci * @osliba: absolute address of first output SLIB 978c2ecf20Sopenharmony_ci * @ebcnam: adapter identifier in EBCDIC 988c2ecf20Sopenharmony_ci * @parm: implementation dependent parameters 998c2ecf20Sopenharmony_ci */ 1008c2ecf20Sopenharmony_cistruct qib { 1018c2ecf20Sopenharmony_ci u32 qfmt : 8; 1028c2ecf20Sopenharmony_ci u32 pfmt : 8; 1038c2ecf20Sopenharmony_ci u32 rflags : 8; 1048c2ecf20Sopenharmony_ci u32 ac : 8; 1058c2ecf20Sopenharmony_ci u32 : 32; 1068c2ecf20Sopenharmony_ci u64 isliba; 1078c2ecf20Sopenharmony_ci u64 osliba; 1088c2ecf20Sopenharmony_ci u32 : 32; 1098c2ecf20Sopenharmony_ci u32 : 32; 1108c2ecf20Sopenharmony_ci u8 ebcnam[8]; 1118c2ecf20Sopenharmony_ci /* private: */ 1128c2ecf20Sopenharmony_ci u8 res[88]; 1138c2ecf20Sopenharmony_ci /* public: */ 1148c2ecf20Sopenharmony_ci u8 parm[128]; 1158c2ecf20Sopenharmony_ci} __attribute__ ((packed, aligned(256))); 1168c2ecf20Sopenharmony_ci 1178c2ecf20Sopenharmony_ci/** 1188c2ecf20Sopenharmony_ci * struct slibe - storage list information block element (SLIBE) 1198c2ecf20Sopenharmony_ci * @parms: implementation dependent parameters 1208c2ecf20Sopenharmony_ci */ 1218c2ecf20Sopenharmony_cistruct slibe { 1228c2ecf20Sopenharmony_ci u64 parms; 1238c2ecf20Sopenharmony_ci}; 1248c2ecf20Sopenharmony_ci 1258c2ecf20Sopenharmony_ci/** 1268c2ecf20Sopenharmony_ci * struct qaob - queue asynchronous operation block 1278c2ecf20Sopenharmony_ci * @res0: reserved parameters 1288c2ecf20Sopenharmony_ci * @res1: reserved parameter 1298c2ecf20Sopenharmony_ci * @res2: reserved parameter 1308c2ecf20Sopenharmony_ci * @res3: reserved parameter 1318c2ecf20Sopenharmony_ci * @aorc: asynchronous operation return code 1328c2ecf20Sopenharmony_ci * @flags: internal flags 1338c2ecf20Sopenharmony_ci * @cbtbs: control block type 1348c2ecf20Sopenharmony_ci * @sb_count: number of storage blocks 1358c2ecf20Sopenharmony_ci * @sba: storage block element addresses 1368c2ecf20Sopenharmony_ci * @dcount: size of storage block elements 1378c2ecf20Sopenharmony_ci * @user0: user defineable value 1388c2ecf20Sopenharmony_ci * @res4: reserved paramater 1398c2ecf20Sopenharmony_ci * @user1: user defineable value 1408c2ecf20Sopenharmony_ci * @user2: user defineable value 1418c2ecf20Sopenharmony_ci */ 1428c2ecf20Sopenharmony_cistruct qaob { 1438c2ecf20Sopenharmony_ci u64 res0[6]; 1448c2ecf20Sopenharmony_ci u8 res1; 1458c2ecf20Sopenharmony_ci u8 res2; 1468c2ecf20Sopenharmony_ci u8 res3; 1478c2ecf20Sopenharmony_ci u8 aorc; 1488c2ecf20Sopenharmony_ci u8 flags; 1498c2ecf20Sopenharmony_ci u16 cbtbs; 1508c2ecf20Sopenharmony_ci u8 sb_count; 1518c2ecf20Sopenharmony_ci u64 sba[QDIO_MAX_ELEMENTS_PER_BUFFER]; 1528c2ecf20Sopenharmony_ci u16 dcount[QDIO_MAX_ELEMENTS_PER_BUFFER]; 1538c2ecf20Sopenharmony_ci u64 user0; 1548c2ecf20Sopenharmony_ci u64 res4[2]; 1558c2ecf20Sopenharmony_ci u64 user1; 1568c2ecf20Sopenharmony_ci u64 user2; 1578c2ecf20Sopenharmony_ci} __attribute__ ((packed, aligned(256))); 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci/** 1608c2ecf20Sopenharmony_ci * struct slib - storage list information block (SLIB) 1618c2ecf20Sopenharmony_ci * @nsliba: next SLIB address (if any) 1628c2ecf20Sopenharmony_ci * @sla: SL address 1638c2ecf20Sopenharmony_ci * @slsba: SLSB address 1648c2ecf20Sopenharmony_ci * @slibe: SLIB elements 1658c2ecf20Sopenharmony_ci */ 1668c2ecf20Sopenharmony_cistruct slib { 1678c2ecf20Sopenharmony_ci u64 nsliba; 1688c2ecf20Sopenharmony_ci u64 sla; 1698c2ecf20Sopenharmony_ci u64 slsba; 1708c2ecf20Sopenharmony_ci /* private: */ 1718c2ecf20Sopenharmony_ci u8 res[1000]; 1728c2ecf20Sopenharmony_ci /* public: */ 1738c2ecf20Sopenharmony_ci struct slibe slibe[QDIO_MAX_BUFFERS_PER_Q]; 1748c2ecf20Sopenharmony_ci} __attribute__ ((packed, aligned(2048))); 1758c2ecf20Sopenharmony_ci 1768c2ecf20Sopenharmony_ci#define SBAL_EFLAGS_LAST_ENTRY 0x40 1778c2ecf20Sopenharmony_ci#define SBAL_EFLAGS_CONTIGUOUS 0x20 1788c2ecf20Sopenharmony_ci#define SBAL_EFLAGS_FIRST_FRAG 0x04 1798c2ecf20Sopenharmony_ci#define SBAL_EFLAGS_MIDDLE_FRAG 0x08 1808c2ecf20Sopenharmony_ci#define SBAL_EFLAGS_LAST_FRAG 0x0c 1818c2ecf20Sopenharmony_ci#define SBAL_EFLAGS_MASK 0x6f 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_PCI_REQ 0x40 1848c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_DATA_CONTINUATION 0x20 1858c2ecf20Sopenharmony_ci 1868c2ecf20Sopenharmony_ci/* Awesome OpenFCP extensions */ 1878c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_TYPE_STATUS 0x00 1888c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_TYPE_WRITE 0x08 1898c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_TYPE_READ 0x10 1908c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_TYPE_WRITE_READ 0x18 1918c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_MORE_SBALS 0x04 1928c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_COMMAND 0x02 1938c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_LAST_SBAL 0x00 1948c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_ONLY_SBAL SBAL_SFLAGS0_COMMAND 1958c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_MIDDLE_SBAL SBAL_SFLAGS0_MORE_SBALS 1968c2ecf20Sopenharmony_ci#define SBAL_SFLAGS0_FIRST_SBAL (SBAL_SFLAGS0_MORE_SBALS | SBAL_SFLAGS0_COMMAND) 1978c2ecf20Sopenharmony_ci 1988c2ecf20Sopenharmony_ci/** 1998c2ecf20Sopenharmony_ci * struct qdio_buffer_element - SBAL entry 2008c2ecf20Sopenharmony_ci * @eflags: SBAL entry flags 2018c2ecf20Sopenharmony_ci * @scount: SBAL count 2028c2ecf20Sopenharmony_ci * @sflags: whole SBAL flags 2038c2ecf20Sopenharmony_ci * @length: length 2048c2ecf20Sopenharmony_ci * @addr: absolute data address 2058c2ecf20Sopenharmony_ci*/ 2068c2ecf20Sopenharmony_cistruct qdio_buffer_element { 2078c2ecf20Sopenharmony_ci u8 eflags; 2088c2ecf20Sopenharmony_ci /* private: */ 2098c2ecf20Sopenharmony_ci u8 res1; 2108c2ecf20Sopenharmony_ci /* public: */ 2118c2ecf20Sopenharmony_ci u8 scount; 2128c2ecf20Sopenharmony_ci u8 sflags; 2138c2ecf20Sopenharmony_ci u32 length; 2148c2ecf20Sopenharmony_ci u64 addr; 2158c2ecf20Sopenharmony_ci} __attribute__ ((packed, aligned(16))); 2168c2ecf20Sopenharmony_ci 2178c2ecf20Sopenharmony_ci/** 2188c2ecf20Sopenharmony_ci * struct qdio_buffer - storage block address list (SBAL) 2198c2ecf20Sopenharmony_ci * @element: SBAL entries 2208c2ecf20Sopenharmony_ci */ 2218c2ecf20Sopenharmony_cistruct qdio_buffer { 2228c2ecf20Sopenharmony_ci struct qdio_buffer_element element[QDIO_MAX_ELEMENTS_PER_BUFFER]; 2238c2ecf20Sopenharmony_ci} __attribute__ ((packed, aligned(256))); 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_ci/** 2268c2ecf20Sopenharmony_ci * struct sl_element - storage list entry 2278c2ecf20Sopenharmony_ci * @sbal: absolute SBAL address 2288c2ecf20Sopenharmony_ci */ 2298c2ecf20Sopenharmony_cistruct sl_element { 2308c2ecf20Sopenharmony_ci u64 sbal; 2318c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_ci/** 2348c2ecf20Sopenharmony_ci * struct sl - storage list (SL) 2358c2ecf20Sopenharmony_ci * @element: SL entries 2368c2ecf20Sopenharmony_ci */ 2378c2ecf20Sopenharmony_cistruct sl { 2388c2ecf20Sopenharmony_ci struct sl_element element[QDIO_MAX_BUFFERS_PER_Q]; 2398c2ecf20Sopenharmony_ci} __attribute__ ((packed, aligned(1024))); 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_ci/** 2428c2ecf20Sopenharmony_ci * struct slsb - storage list state block (SLSB) 2438c2ecf20Sopenharmony_ci * @val: state per buffer 2448c2ecf20Sopenharmony_ci */ 2458c2ecf20Sopenharmony_cistruct slsb { 2468c2ecf20Sopenharmony_ci u8 val[QDIO_MAX_BUFFERS_PER_Q]; 2478c2ecf20Sopenharmony_ci} __attribute__ ((packed, aligned(256))); 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci/** 2508c2ecf20Sopenharmony_ci * struct qdio_outbuf_state - SBAL related asynchronous operation information 2518c2ecf20Sopenharmony_ci * (for communication with upper layer programs) 2528c2ecf20Sopenharmony_ci * (only required for use with completion queues) 2538c2ecf20Sopenharmony_ci * @flags: flags indicating state of buffer 2548c2ecf20Sopenharmony_ci * @user: pointer to upper layer program's state information related to SBAL 2558c2ecf20Sopenharmony_ci * (stored in user1 data of QAOB) 2568c2ecf20Sopenharmony_ci */ 2578c2ecf20Sopenharmony_cistruct qdio_outbuf_state { 2588c2ecf20Sopenharmony_ci u8 flags; 2598c2ecf20Sopenharmony_ci void *user; 2608c2ecf20Sopenharmony_ci}; 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci#define QDIO_OUTBUF_STATE_FLAG_PENDING 0x01 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_ci#define CHSC_AC1_INITIATE_INPUTQ 0x80 2658c2ecf20Sopenharmony_ci 2668c2ecf20Sopenharmony_ci 2678c2ecf20Sopenharmony_ci/* qdio adapter-characteristics-1 flag */ 2688c2ecf20Sopenharmony_ci#define AC1_SIGA_INPUT_NEEDED 0x40 /* process input queues */ 2698c2ecf20Sopenharmony_ci#define AC1_SIGA_OUTPUT_NEEDED 0x20 /* process output queues */ 2708c2ecf20Sopenharmony_ci#define AC1_SIGA_SYNC_NEEDED 0x10 /* ask hypervisor to sync */ 2718c2ecf20Sopenharmony_ci#define AC1_AUTOMATIC_SYNC_ON_THININT 0x08 /* set by hypervisor */ 2728c2ecf20Sopenharmony_ci#define AC1_AUTOMATIC_SYNC_ON_OUT_PCI 0x04 /* set by hypervisor */ 2738c2ecf20Sopenharmony_ci#define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */ 2748c2ecf20Sopenharmony_ci#define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */ 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_ci#define CHSC_AC2_MULTI_BUFFER_AVAILABLE 0x0080 2778c2ecf20Sopenharmony_ci#define CHSC_AC2_MULTI_BUFFER_ENABLED 0x0040 2788c2ecf20Sopenharmony_ci#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010 2798c2ecf20Sopenharmony_ci#define CHSC_AC2_SNIFFER_AVAILABLE 0x0008 2808c2ecf20Sopenharmony_ci#define CHSC_AC2_DATA_DIV_ENABLED 0x0002 2818c2ecf20Sopenharmony_ci 2828c2ecf20Sopenharmony_ci#define CHSC_AC3_FORMAT2_CQ_AVAILABLE 0x8000 2838c2ecf20Sopenharmony_ci 2848c2ecf20Sopenharmony_cistruct qdio_ssqd_desc { 2858c2ecf20Sopenharmony_ci u8 flags; 2868c2ecf20Sopenharmony_ci u8:8; 2878c2ecf20Sopenharmony_ci u16 sch; 2888c2ecf20Sopenharmony_ci u8 qfmt; 2898c2ecf20Sopenharmony_ci u8 parm; 2908c2ecf20Sopenharmony_ci u8 qdioac1; 2918c2ecf20Sopenharmony_ci u8 sch_class; 2928c2ecf20Sopenharmony_ci u8 pcnt; 2938c2ecf20Sopenharmony_ci u8 icnt; 2948c2ecf20Sopenharmony_ci u8:8; 2958c2ecf20Sopenharmony_ci u8 ocnt; 2968c2ecf20Sopenharmony_ci u8:8; 2978c2ecf20Sopenharmony_ci u8 mbccnt; 2988c2ecf20Sopenharmony_ci u16 qdioac2; 2998c2ecf20Sopenharmony_ci u64 sch_token; 3008c2ecf20Sopenharmony_ci u8 mro; 3018c2ecf20Sopenharmony_ci u8 mri; 3028c2ecf20Sopenharmony_ci u16 qdioac3; 3038c2ecf20Sopenharmony_ci u16:16; 3048c2ecf20Sopenharmony_ci u8:8; 3058c2ecf20Sopenharmony_ci u8 mmwc; 3068c2ecf20Sopenharmony_ci} __attribute__ ((packed)); 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ci/* params are: ccw_device, qdio_error, queue_number, 3098c2ecf20Sopenharmony_ci first element processed, number of elements processed, int_parm */ 3108c2ecf20Sopenharmony_citypedef void qdio_handler_t(struct ccw_device *, unsigned int, int, 3118c2ecf20Sopenharmony_ci int, int, unsigned long); 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci/* qdio errors reported to the upper-layer program */ 3148c2ecf20Sopenharmony_ci#define QDIO_ERROR_ACTIVATE 0x0001 3158c2ecf20Sopenharmony_ci#define QDIO_ERROR_GET_BUF_STATE 0x0002 3168c2ecf20Sopenharmony_ci#define QDIO_ERROR_SET_BUF_STATE 0x0004 3178c2ecf20Sopenharmony_ci#define QDIO_ERROR_SLSB_STATE 0x0100 3188c2ecf20Sopenharmony_ci 3198c2ecf20Sopenharmony_ci#define QDIO_ERROR_FATAL 0x00ff 3208c2ecf20Sopenharmony_ci#define QDIO_ERROR_TEMPORARY 0xff00 3218c2ecf20Sopenharmony_ci 3228c2ecf20Sopenharmony_ci/* for qdio_cleanup */ 3238c2ecf20Sopenharmony_ci#define QDIO_FLAG_CLEANUP_USING_CLEAR 0x01 3248c2ecf20Sopenharmony_ci#define QDIO_FLAG_CLEANUP_USING_HALT 0x02 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci/** 3278c2ecf20Sopenharmony_ci * struct qdio_initialize - qdio initialization data 3288c2ecf20Sopenharmony_ci * @q_format: queue format 3298c2ecf20Sopenharmony_ci * @qdr_ac: feature flags to set 3308c2ecf20Sopenharmony_ci * @qib_param_field_format: format for qib_parm_field 3318c2ecf20Sopenharmony_ci * @qib_param_field: pointer to 128 bytes or NULL, if no param field 3328c2ecf20Sopenharmony_ci * @qib_rflags: rflags to set 3338c2ecf20Sopenharmony_ci * @input_slib_elements: pointer to no_input_qs * 128 words of data or NULL 3348c2ecf20Sopenharmony_ci * @output_slib_elements: pointer to no_output_qs * 128 words of data or NULL 3358c2ecf20Sopenharmony_ci * @no_input_qs: number of input queues 3368c2ecf20Sopenharmony_ci * @no_output_qs: number of output queues 3378c2ecf20Sopenharmony_ci * @input_handler: handler to be called for input queues 3388c2ecf20Sopenharmony_ci * @output_handler: handler to be called for output queues 3398c2ecf20Sopenharmony_ci * @irq_poll: Data IRQ polling handler (NULL when not supported) 3408c2ecf20Sopenharmony_ci * @scan_threshold: # of in-use buffers that triggers scan on output queue 3418c2ecf20Sopenharmony_ci * @int_parm: interruption parameter 3428c2ecf20Sopenharmony_ci * @input_sbal_addr_array: per-queue array, each element points to 128 SBALs 3438c2ecf20Sopenharmony_ci * @output_sbal_addr_array: per-queue array, each element points to 128 SBALs 3448c2ecf20Sopenharmony_ci * @output_sbal_state_array: no_output_qs * 128 state info (for CQ or NULL) 3458c2ecf20Sopenharmony_ci */ 3468c2ecf20Sopenharmony_cistruct qdio_initialize { 3478c2ecf20Sopenharmony_ci unsigned char q_format; 3488c2ecf20Sopenharmony_ci unsigned char qdr_ac; 3498c2ecf20Sopenharmony_ci unsigned int qib_param_field_format; 3508c2ecf20Sopenharmony_ci unsigned char *qib_param_field; 3518c2ecf20Sopenharmony_ci unsigned char qib_rflags; 3528c2ecf20Sopenharmony_ci unsigned long *input_slib_elements; 3538c2ecf20Sopenharmony_ci unsigned long *output_slib_elements; 3548c2ecf20Sopenharmony_ci unsigned int no_input_qs; 3558c2ecf20Sopenharmony_ci unsigned int no_output_qs; 3568c2ecf20Sopenharmony_ci qdio_handler_t *input_handler; 3578c2ecf20Sopenharmony_ci qdio_handler_t *output_handler; 3588c2ecf20Sopenharmony_ci void (*irq_poll)(struct ccw_device *cdev, unsigned long data); 3598c2ecf20Sopenharmony_ci unsigned int scan_threshold; 3608c2ecf20Sopenharmony_ci unsigned long int_parm; 3618c2ecf20Sopenharmony_ci struct qdio_buffer ***input_sbal_addr_array; 3628c2ecf20Sopenharmony_ci struct qdio_buffer ***output_sbal_addr_array; 3638c2ecf20Sopenharmony_ci struct qdio_outbuf_state *output_sbal_state_array; 3648c2ecf20Sopenharmony_ci}; 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_ci#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */ 3678c2ecf20Sopenharmony_ci#define QDIO_STATE_ESTABLISHED 0x00000004 /* after qdio_establish */ 3688c2ecf20Sopenharmony_ci#define QDIO_STATE_ACTIVE 0x00000008 /* after qdio_activate */ 3698c2ecf20Sopenharmony_ci#define QDIO_STATE_STOPPED 0x00000010 /* after queues went down */ 3708c2ecf20Sopenharmony_ci 3718c2ecf20Sopenharmony_ci#define QDIO_FLAG_SYNC_INPUT 0x01 3728c2ecf20Sopenharmony_ci#define QDIO_FLAG_SYNC_OUTPUT 0x02 3738c2ecf20Sopenharmony_ci#define QDIO_FLAG_PCI_OUT 0x10 3748c2ecf20Sopenharmony_ci 3758c2ecf20Sopenharmony_ciint qdio_alloc_buffers(struct qdio_buffer **buf, unsigned int count); 3768c2ecf20Sopenharmony_civoid qdio_free_buffers(struct qdio_buffer **buf, unsigned int count); 3778c2ecf20Sopenharmony_civoid qdio_reset_buffers(struct qdio_buffer **buf, unsigned int count); 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ciextern int qdio_allocate(struct ccw_device *cdev, unsigned int no_input_qs, 3808c2ecf20Sopenharmony_ci unsigned int no_output_qs); 3818c2ecf20Sopenharmony_ciextern int qdio_establish(struct ccw_device *cdev, 3828c2ecf20Sopenharmony_ci struct qdio_initialize *init_data); 3838c2ecf20Sopenharmony_ciextern int qdio_activate(struct ccw_device *); 3848c2ecf20Sopenharmony_ciextern void qdio_release_aob(struct qaob *); 3858c2ecf20Sopenharmony_ciextern int do_QDIO(struct ccw_device *, unsigned int, int, unsigned int, 3868c2ecf20Sopenharmony_ci unsigned int); 3878c2ecf20Sopenharmony_ciextern int qdio_start_irq(struct ccw_device *cdev); 3888c2ecf20Sopenharmony_ciextern int qdio_stop_irq(struct ccw_device *cdev); 3898c2ecf20Sopenharmony_ciextern int qdio_get_next_buffers(struct ccw_device *, int, int *, int *); 3908c2ecf20Sopenharmony_ciextern int qdio_inspect_queue(struct ccw_device *cdev, unsigned int nr, 3918c2ecf20Sopenharmony_ci bool is_input, unsigned int *bufnr, 3928c2ecf20Sopenharmony_ci unsigned int *error); 3938c2ecf20Sopenharmony_ciextern int qdio_shutdown(struct ccw_device *, int); 3948c2ecf20Sopenharmony_ciextern int qdio_free(struct ccw_device *); 3958c2ecf20Sopenharmony_ciextern int qdio_get_ssqd_desc(struct ccw_device *, struct qdio_ssqd_desc *); 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_ci#endif /* __QDIO_H__ */ 398