18c2ecf20Sopenharmony_ci#ifndef _PIO_H 28c2ecf20Sopenharmony_ci#define _PIO_H 38c2ecf20Sopenharmony_ci/* 48c2ecf20Sopenharmony_ci * Copyright(c) 2015-2017 Intel Corporation. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This file is provided under a dual BSD/GPLv2 license. When using or 78c2ecf20Sopenharmony_ci * redistributing this file, you may do so under either license. 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * GPL LICENSE SUMMARY 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or modify 128c2ecf20Sopenharmony_ci * it under the terms of version 2 of the GNU General Public License as 138c2ecf20Sopenharmony_ci * published by the Free Software Foundation. 148c2ecf20Sopenharmony_ci * 158c2ecf20Sopenharmony_ci * This program is distributed in the hope that it will be useful, but 168c2ecf20Sopenharmony_ci * WITHOUT ANY WARRANTY; without even the implied warranty of 178c2ecf20Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 188c2ecf20Sopenharmony_ci * General Public License for more details. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * BSD LICENSE 218c2ecf20Sopenharmony_ci * 228c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 238c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 248c2ecf20Sopenharmony_ci * are met: 258c2ecf20Sopenharmony_ci * 268c2ecf20Sopenharmony_ci * - Redistributions of source code must retain the above copyright 278c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer. 288c2ecf20Sopenharmony_ci * - Redistributions in binary form must reproduce the above copyright 298c2ecf20Sopenharmony_ci * notice, this list of conditions and the following disclaimer in 308c2ecf20Sopenharmony_ci * the documentation and/or other materials provided with the 318c2ecf20Sopenharmony_ci * distribution. 328c2ecf20Sopenharmony_ci * - Neither the name of Intel Corporation nor the names of its 338c2ecf20Sopenharmony_ci * contributors may be used to endorse or promote products derived 348c2ecf20Sopenharmony_ci * from this software without specific prior written permission. 358c2ecf20Sopenharmony_ci * 368c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 378c2ecf20Sopenharmony_ci * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 388c2ecf20Sopenharmony_ci * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 398c2ecf20Sopenharmony_ci * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 408c2ecf20Sopenharmony_ci * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 418c2ecf20Sopenharmony_ci * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 428c2ecf20Sopenharmony_ci * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 438c2ecf20Sopenharmony_ci * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 448c2ecf20Sopenharmony_ci * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 458c2ecf20Sopenharmony_ci * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 468c2ecf20Sopenharmony_ci * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 478c2ecf20Sopenharmony_ci * 488c2ecf20Sopenharmony_ci */ 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci/* send context types */ 518c2ecf20Sopenharmony_ci#define SC_KERNEL 0 528c2ecf20Sopenharmony_ci#define SC_VL15 1 538c2ecf20Sopenharmony_ci#define SC_ACK 2 548c2ecf20Sopenharmony_ci#define SC_USER 3 /* must be the last one: it may take all left */ 558c2ecf20Sopenharmony_ci#define SC_MAX 4 /* count of send context types */ 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* invalid send context index */ 588c2ecf20Sopenharmony_ci#define INVALID_SCI 0xff 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci/* PIO buffer release callback function */ 618c2ecf20Sopenharmony_citypedef void (*pio_release_cb)(void *arg, int code); 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* PIO release codes - in bits, as there could more than one that apply */ 648c2ecf20Sopenharmony_ci#define PRC_OK 0 /* no known error */ 658c2ecf20Sopenharmony_ci#define PRC_STATUS_ERR 0x01 /* credit return due to status error */ 668c2ecf20Sopenharmony_ci#define PRC_PBC 0x02 /* credit return due to PBC */ 678c2ecf20Sopenharmony_ci#define PRC_THRESHOLD 0x04 /* credit return due to threshold */ 688c2ecf20Sopenharmony_ci#define PRC_FILL_ERR 0x08 /* credit return due fill error */ 698c2ecf20Sopenharmony_ci#define PRC_FORCE 0x10 /* credit return due credit force */ 708c2ecf20Sopenharmony_ci#define PRC_SC_DISABLE 0x20 /* clean-up after a context disable */ 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* byte helper */ 738c2ecf20Sopenharmony_ciunion mix { 748c2ecf20Sopenharmony_ci u64 val64; 758c2ecf20Sopenharmony_ci u32 val32[2]; 768c2ecf20Sopenharmony_ci u8 val8[8]; 778c2ecf20Sopenharmony_ci}; 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci/* an allocated PIO buffer */ 808c2ecf20Sopenharmony_cistruct pio_buf { 818c2ecf20Sopenharmony_ci struct send_context *sc;/* back pointer to owning send context */ 828c2ecf20Sopenharmony_ci pio_release_cb cb; /* called when the buffer is released */ 838c2ecf20Sopenharmony_ci void *arg; /* argument for cb */ 848c2ecf20Sopenharmony_ci void __iomem *start; /* buffer start address */ 858c2ecf20Sopenharmony_ci void __iomem *end; /* context end address */ 868c2ecf20Sopenharmony_ci unsigned long sent_at; /* buffer is sent when <= free */ 878c2ecf20Sopenharmony_ci union mix carry; /* pending unwritten bytes */ 888c2ecf20Sopenharmony_ci u16 qw_written; /* QW written so far */ 898c2ecf20Sopenharmony_ci u8 carry_bytes; /* number of valid bytes in carry */ 908c2ecf20Sopenharmony_ci}; 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci/* cache line aligned pio buffer array */ 938c2ecf20Sopenharmony_ciunion pio_shadow_ring { 948c2ecf20Sopenharmony_ci struct pio_buf pbuf; 958c2ecf20Sopenharmony_ci} ____cacheline_aligned; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/* per-NUMA send context */ 988c2ecf20Sopenharmony_cistruct send_context { 998c2ecf20Sopenharmony_ci /* read-only after init */ 1008c2ecf20Sopenharmony_ci struct hfi1_devdata *dd; /* device */ 1018c2ecf20Sopenharmony_ci union pio_shadow_ring *sr; /* shadow ring */ 1028c2ecf20Sopenharmony_ci void __iomem *base_addr; /* start of PIO memory */ 1038c2ecf20Sopenharmony_ci u32 __percpu *buffers_allocated;/* count of buffers allocated */ 1048c2ecf20Sopenharmony_ci u32 size; /* context size, in bytes */ 1058c2ecf20Sopenharmony_ci 1068c2ecf20Sopenharmony_ci int node; /* context home node */ 1078c2ecf20Sopenharmony_ci u32 sr_size; /* size of the shadow ring */ 1088c2ecf20Sopenharmony_ci u16 flags; /* flags */ 1098c2ecf20Sopenharmony_ci u8 type; /* context type */ 1108c2ecf20Sopenharmony_ci u8 sw_index; /* software index number */ 1118c2ecf20Sopenharmony_ci u8 hw_context; /* hardware context number */ 1128c2ecf20Sopenharmony_ci u8 group; /* credit return group */ 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci /* allocator fields */ 1158c2ecf20Sopenharmony_ci spinlock_t alloc_lock ____cacheline_aligned_in_smp; 1168c2ecf20Sopenharmony_ci u32 sr_head; /* shadow ring head */ 1178c2ecf20Sopenharmony_ci unsigned long fill; /* official alloc count */ 1188c2ecf20Sopenharmony_ci unsigned long alloc_free; /* copy of free (less cache thrash) */ 1198c2ecf20Sopenharmony_ci u32 fill_wrap; /* tracks fill within ring */ 1208c2ecf20Sopenharmony_ci u32 credits; /* number of blocks in context */ 1218c2ecf20Sopenharmony_ci /* adding a new field here would make it part of this cacheline */ 1228c2ecf20Sopenharmony_ci 1238c2ecf20Sopenharmony_ci /* releaser fields */ 1248c2ecf20Sopenharmony_ci spinlock_t release_lock ____cacheline_aligned_in_smp; 1258c2ecf20Sopenharmony_ci u32 sr_tail; /* shadow ring tail */ 1268c2ecf20Sopenharmony_ci unsigned long free; /* official free count */ 1278c2ecf20Sopenharmony_ci volatile __le64 *hw_free; /* HW free counter */ 1288c2ecf20Sopenharmony_ci /* list for PIO waiters */ 1298c2ecf20Sopenharmony_ci struct list_head piowait ____cacheline_aligned_in_smp; 1308c2ecf20Sopenharmony_ci seqlock_t waitlock; 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_ci spinlock_t credit_ctrl_lock ____cacheline_aligned_in_smp; 1338c2ecf20Sopenharmony_ci u32 credit_intr_count; /* count of credit intr users */ 1348c2ecf20Sopenharmony_ci u64 credit_ctrl; /* cache for credit control */ 1358c2ecf20Sopenharmony_ci wait_queue_head_t halt_wait; /* wait until kernel sees interrupt */ 1368c2ecf20Sopenharmony_ci struct work_struct halt_work; /* halted context work queue entry */ 1378c2ecf20Sopenharmony_ci}; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_ci/* send context flags */ 1408c2ecf20Sopenharmony_ci#define SCF_ENABLED 0x01 1418c2ecf20Sopenharmony_ci#define SCF_IN_FREE 0x02 1428c2ecf20Sopenharmony_ci#define SCF_HALTED 0x04 1438c2ecf20Sopenharmony_ci#define SCF_FROZEN 0x08 1448c2ecf20Sopenharmony_ci#define SCF_LINK_DOWN 0x10 1458c2ecf20Sopenharmony_ci 1468c2ecf20Sopenharmony_cistruct send_context_info { 1478c2ecf20Sopenharmony_ci struct send_context *sc; /* allocated working context */ 1488c2ecf20Sopenharmony_ci u16 allocated; /* has this been allocated? */ 1498c2ecf20Sopenharmony_ci u16 type; /* context type */ 1508c2ecf20Sopenharmony_ci u16 base; /* base in PIO array */ 1518c2ecf20Sopenharmony_ci u16 credits; /* size in PIO array */ 1528c2ecf20Sopenharmony_ci}; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci/* DMA credit return, index is always (context & 0x7) */ 1558c2ecf20Sopenharmony_cistruct credit_return { 1568c2ecf20Sopenharmony_ci volatile __le64 cr[8]; 1578c2ecf20Sopenharmony_ci}; 1588c2ecf20Sopenharmony_ci 1598c2ecf20Sopenharmony_ci/* NUMA indexed credit return array */ 1608c2ecf20Sopenharmony_cistruct credit_return_base { 1618c2ecf20Sopenharmony_ci struct credit_return *va; 1628c2ecf20Sopenharmony_ci dma_addr_t dma; 1638c2ecf20Sopenharmony_ci}; 1648c2ecf20Sopenharmony_ci 1658c2ecf20Sopenharmony_ci/* send context configuration sizes (one per type) */ 1668c2ecf20Sopenharmony_cistruct sc_config_sizes { 1678c2ecf20Sopenharmony_ci short int size; 1688c2ecf20Sopenharmony_ci short int count; 1698c2ecf20Sopenharmony_ci}; 1708c2ecf20Sopenharmony_ci 1718c2ecf20Sopenharmony_ci/* 1728c2ecf20Sopenharmony_ci * The diagram below details the relationship of the mapping structures 1738c2ecf20Sopenharmony_ci * 1748c2ecf20Sopenharmony_ci * Since the mapping now allows for non-uniform send contexts per vl, the 1758c2ecf20Sopenharmony_ci * number of send contexts for a vl is either the vl_scontexts[vl] or 1768c2ecf20Sopenharmony_ci * a computation based on num_kernel_send_contexts/num_vls: 1778c2ecf20Sopenharmony_ci * 1788c2ecf20Sopenharmony_ci * For example: 1798c2ecf20Sopenharmony_ci * nactual = vl_scontexts ? vl_scontexts[vl] : num_kernel_send_contexts/num_vls 1808c2ecf20Sopenharmony_ci * 1818c2ecf20Sopenharmony_ci * n = roundup to next highest power of 2 using nactual 1828c2ecf20Sopenharmony_ci * 1838c2ecf20Sopenharmony_ci * In the case where there are num_kernel_send_contexts/num_vls doesn't divide 1848c2ecf20Sopenharmony_ci * evenly, the extras are added from the last vl downward. 1858c2ecf20Sopenharmony_ci * 1868c2ecf20Sopenharmony_ci * For the case where n > nactual, the send contexts are assigned 1878c2ecf20Sopenharmony_ci * in a round robin fashion wrapping back to the first send context 1888c2ecf20Sopenharmony_ci * for a particular vl. 1898c2ecf20Sopenharmony_ci * 1908c2ecf20Sopenharmony_ci * dd->pio_map 1918c2ecf20Sopenharmony_ci * | pio_map_elem[0] 1928c2ecf20Sopenharmony_ci * | +--------------------+ 1938c2ecf20Sopenharmony_ci * v | mask | 1948c2ecf20Sopenharmony_ci * pio_vl_map |--------------------| 1958c2ecf20Sopenharmony_ci * +--------------------------+ | ksc[0] -> sc 1 | 1968c2ecf20Sopenharmony_ci * | list (RCU) | |--------------------| 1978c2ecf20Sopenharmony_ci * |--------------------------| ->| ksc[1] -> sc 2 | 1988c2ecf20Sopenharmony_ci * | mask | --/ |--------------------| 1998c2ecf20Sopenharmony_ci * |--------------------------| -/ | * | 2008c2ecf20Sopenharmony_ci * | actual_vls (max 8) | -/ |--------------------| 2018c2ecf20Sopenharmony_ci * |--------------------------| --/ | ksc[n-1] -> sc n | 2028c2ecf20Sopenharmony_ci * | vls (max 8) | -/ +--------------------+ 2038c2ecf20Sopenharmony_ci * |--------------------------| --/ 2048c2ecf20Sopenharmony_ci * | map[0] |-/ 2058c2ecf20Sopenharmony_ci * |--------------------------| +--------------------+ 2068c2ecf20Sopenharmony_ci * | map[1] |--- | mask | 2078c2ecf20Sopenharmony_ci * |--------------------------| \---- |--------------------| 2088c2ecf20Sopenharmony_ci * | * | \-- | ksc[0] -> sc 1+n | 2098c2ecf20Sopenharmony_ci * | * | \---- |--------------------| 2108c2ecf20Sopenharmony_ci * | * | \->| ksc[1] -> sc 2+n | 2118c2ecf20Sopenharmony_ci * |--------------------------| |--------------------| 2128c2ecf20Sopenharmony_ci * | map[vls - 1] |- | * | 2138c2ecf20Sopenharmony_ci * +--------------------------+ \- |--------------------| 2148c2ecf20Sopenharmony_ci * \- | ksc[m-1] -> sc m+n | 2158c2ecf20Sopenharmony_ci * \ +--------------------+ 2168c2ecf20Sopenharmony_ci * \- 2178c2ecf20Sopenharmony_ci * \ 2188c2ecf20Sopenharmony_ci * \- +----------------------+ 2198c2ecf20Sopenharmony_ci * \- | mask | 2208c2ecf20Sopenharmony_ci * \ |----------------------| 2218c2ecf20Sopenharmony_ci * \- | ksc[0] -> sc 1+m+n | 2228c2ecf20Sopenharmony_ci * \- |----------------------| 2238c2ecf20Sopenharmony_ci * >| ksc[1] -> sc 2+m+n | 2248c2ecf20Sopenharmony_ci * |----------------------| 2258c2ecf20Sopenharmony_ci * | * | 2268c2ecf20Sopenharmony_ci * |----------------------| 2278c2ecf20Sopenharmony_ci * | ksc[o-1] -> sc o+m+n | 2288c2ecf20Sopenharmony_ci * +----------------------+ 2298c2ecf20Sopenharmony_ci * 2308c2ecf20Sopenharmony_ci */ 2318c2ecf20Sopenharmony_ci 2328c2ecf20Sopenharmony_ci/* Initial number of send contexts per VL */ 2338c2ecf20Sopenharmony_ci#define INIT_SC_PER_VL 2 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci/* 2368c2ecf20Sopenharmony_ci * struct pio_map_elem - mapping for a vl 2378c2ecf20Sopenharmony_ci * @mask - selector mask 2388c2ecf20Sopenharmony_ci * @ksc - array of kernel send contexts for this vl 2398c2ecf20Sopenharmony_ci * 2408c2ecf20Sopenharmony_ci * The mask is used to "mod" the selector to 2418c2ecf20Sopenharmony_ci * produce index into the trailing array of 2428c2ecf20Sopenharmony_ci * kscs 2438c2ecf20Sopenharmony_ci */ 2448c2ecf20Sopenharmony_cistruct pio_map_elem { 2458c2ecf20Sopenharmony_ci u32 mask; 2468c2ecf20Sopenharmony_ci struct send_context *ksc[]; 2478c2ecf20Sopenharmony_ci}; 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci/* 2508c2ecf20Sopenharmony_ci * struct pio_vl_map - mapping for a vl 2518c2ecf20Sopenharmony_ci * @list - rcu head for free callback 2528c2ecf20Sopenharmony_ci * @mask - vl mask to "mod" the vl to produce an index to map array 2538c2ecf20Sopenharmony_ci * @actual_vls - number of vls 2548c2ecf20Sopenharmony_ci * @vls - numbers of vls rounded to next power of 2 2558c2ecf20Sopenharmony_ci * @map - array of pio_map_elem entries 2568c2ecf20Sopenharmony_ci * 2578c2ecf20Sopenharmony_ci * This is the parent mapping structure. The trailing members of the 2588c2ecf20Sopenharmony_ci * struct point to pio_map_elem entries, which in turn point to an 2598c2ecf20Sopenharmony_ci * array of kscs for that vl. 2608c2ecf20Sopenharmony_ci */ 2618c2ecf20Sopenharmony_cistruct pio_vl_map { 2628c2ecf20Sopenharmony_ci struct rcu_head list; 2638c2ecf20Sopenharmony_ci u32 mask; 2648c2ecf20Sopenharmony_ci u8 actual_vls; 2658c2ecf20Sopenharmony_ci u8 vls; 2668c2ecf20Sopenharmony_ci struct pio_map_elem *map[]; 2678c2ecf20Sopenharmony_ci}; 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ciint pio_map_init(struct hfi1_devdata *dd, u8 port, u8 num_vls, 2708c2ecf20Sopenharmony_ci u8 *vl_scontexts); 2718c2ecf20Sopenharmony_civoid free_pio_map(struct hfi1_devdata *dd); 2728c2ecf20Sopenharmony_cistruct send_context *pio_select_send_context_vl(struct hfi1_devdata *dd, 2738c2ecf20Sopenharmony_ci u32 selector, u8 vl); 2748c2ecf20Sopenharmony_cistruct send_context *pio_select_send_context_sc(struct hfi1_devdata *dd, 2758c2ecf20Sopenharmony_ci u32 selector, u8 sc5); 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci/* send context functions */ 2788c2ecf20Sopenharmony_ciint init_credit_return(struct hfi1_devdata *dd); 2798c2ecf20Sopenharmony_civoid free_credit_return(struct hfi1_devdata *dd); 2808c2ecf20Sopenharmony_ciint init_sc_pools_and_sizes(struct hfi1_devdata *dd); 2818c2ecf20Sopenharmony_ciint init_send_contexts(struct hfi1_devdata *dd); 2828c2ecf20Sopenharmony_ciint init_credit_return(struct hfi1_devdata *dd); 2838c2ecf20Sopenharmony_ciint init_pervl_scs(struct hfi1_devdata *dd); 2848c2ecf20Sopenharmony_cistruct send_context *sc_alloc(struct hfi1_devdata *dd, int type, 2858c2ecf20Sopenharmony_ci uint hdrqentsize, int numa); 2868c2ecf20Sopenharmony_civoid sc_free(struct send_context *sc); 2878c2ecf20Sopenharmony_ciint sc_enable(struct send_context *sc); 2888c2ecf20Sopenharmony_civoid sc_disable(struct send_context *sc); 2898c2ecf20Sopenharmony_ciint sc_restart(struct send_context *sc); 2908c2ecf20Sopenharmony_civoid sc_return_credits(struct send_context *sc); 2918c2ecf20Sopenharmony_civoid sc_flush(struct send_context *sc); 2928c2ecf20Sopenharmony_civoid sc_drop(struct send_context *sc); 2938c2ecf20Sopenharmony_civoid sc_stop(struct send_context *sc, int bit); 2948c2ecf20Sopenharmony_cistruct pio_buf *sc_buffer_alloc(struct send_context *sc, u32 dw_len, 2958c2ecf20Sopenharmony_ci pio_release_cb cb, void *arg); 2968c2ecf20Sopenharmony_civoid sc_release_update(struct send_context *sc); 2978c2ecf20Sopenharmony_civoid sc_return_credits(struct send_context *sc); 2988c2ecf20Sopenharmony_civoid sc_group_release_update(struct hfi1_devdata *dd, u32 hw_context); 2998c2ecf20Sopenharmony_civoid sc_add_credit_return_intr(struct send_context *sc); 3008c2ecf20Sopenharmony_civoid sc_del_credit_return_intr(struct send_context *sc); 3018c2ecf20Sopenharmony_civoid sc_set_cr_threshold(struct send_context *sc, u32 new_threshold); 3028c2ecf20Sopenharmony_ciu32 sc_percent_to_threshold(struct send_context *sc, u32 percent); 3038c2ecf20Sopenharmony_ciu32 sc_mtu_to_threshold(struct send_context *sc, u32 mtu, u32 hdrqentsize); 3048c2ecf20Sopenharmony_civoid hfi1_sc_wantpiobuf_intr(struct send_context *sc, u32 needint); 3058c2ecf20Sopenharmony_civoid sc_wait(struct hfi1_devdata *dd); 3068c2ecf20Sopenharmony_civoid set_pio_integrity(struct send_context *sc); 3078c2ecf20Sopenharmony_ci 3088c2ecf20Sopenharmony_ci/* support functions */ 3098c2ecf20Sopenharmony_civoid pio_reset_all(struct hfi1_devdata *dd); 3108c2ecf20Sopenharmony_civoid pio_freeze(struct hfi1_devdata *dd); 3118c2ecf20Sopenharmony_civoid pio_kernel_unfreeze(struct hfi1_devdata *dd); 3128c2ecf20Sopenharmony_civoid pio_kernel_linkup(struct hfi1_devdata *dd); 3138c2ecf20Sopenharmony_ci 3148c2ecf20Sopenharmony_ci/* global PIO send control operations */ 3158c2ecf20Sopenharmony_ci#define PSC_GLOBAL_ENABLE 0 3168c2ecf20Sopenharmony_ci#define PSC_GLOBAL_DISABLE 1 3178c2ecf20Sopenharmony_ci#define PSC_GLOBAL_VLARB_ENABLE 2 3188c2ecf20Sopenharmony_ci#define PSC_GLOBAL_VLARB_DISABLE 3 3198c2ecf20Sopenharmony_ci#define PSC_CM_RESET 4 3208c2ecf20Sopenharmony_ci#define PSC_DATA_VL_ENABLE 5 3218c2ecf20Sopenharmony_ci#define PSC_DATA_VL_DISABLE 6 3228c2ecf20Sopenharmony_ci 3238c2ecf20Sopenharmony_civoid __cm_reset(struct hfi1_devdata *dd, u64 sendctrl); 3248c2ecf20Sopenharmony_civoid pio_send_control(struct hfi1_devdata *dd, int op); 3258c2ecf20Sopenharmony_ci 3268c2ecf20Sopenharmony_ci/* PIO copy routines */ 3278c2ecf20Sopenharmony_civoid pio_copy(struct hfi1_devdata *dd, struct pio_buf *pbuf, u64 pbc, 3288c2ecf20Sopenharmony_ci const void *from, size_t count); 3298c2ecf20Sopenharmony_civoid seg_pio_copy_start(struct pio_buf *pbuf, u64 pbc, 3308c2ecf20Sopenharmony_ci const void *from, size_t nbytes); 3318c2ecf20Sopenharmony_civoid seg_pio_copy_mid(struct pio_buf *pbuf, const void *from, size_t nbytes); 3328c2ecf20Sopenharmony_civoid seg_pio_copy_end(struct pio_buf *pbuf); 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_civoid seqfile_dump_sci(struct seq_file *s, u32 i, 3358c2ecf20Sopenharmony_ci struct send_context_info *sci); 3368c2ecf20Sopenharmony_ci 3378c2ecf20Sopenharmony_ci#endif /* _PIO_H */ 338